Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/
import d3 from 'd3';
import type { PartialTheme } from '@elastic/charts';
import type { Theme } from '@elastic/charts';
import type { PointerEvent } from '@elastic/charts';
import { CHART_HEIGHT } from '../constants';
interface ChartScales {
Expand All @@ -18,7 +18,7 @@ export function drawCursor(
chartId: string,
config: { plotEarliest: number; plotLatest: number },
chartScales: ChartScales,
chartTheme: PartialTheme
chartTheme: Theme
) {
if (!chartScales) return;
const { lineChartXScale, margin: updatedMargin } = chartScales;
Expand All @@ -28,12 +28,7 @@ export function drawCursor(
if (!chartElement || !lineChartXScale) return;
chartElement.select('.ml-anomaly-chart-cursor-line').remove();

const crosshairLine = chartTheme?.crosshair?.line ?? {
visible: true,
stroke: '#69707D',
strokeWidth: 1,
dash: [4, 4],
};
const crosshairLine = chartTheme.crosshair.line;
const cursorData =
cursor &&
cursor.type === 'Over' &&
Expand All @@ -57,8 +52,6 @@ export function drawCursor(
const xPosition = lineChartXScale(ts);
return `M${xPosition},${CHART_HEIGHT} ${xPosition},0`;
})
// Use elastic chart's cursor line style if possible
// @ts-expect-error upgrade typescript v5.4.5
.style('stroke', crosshairLine.stroke)
.style('stroke-width', `${crosshairLine.strokeWidth}px`)
.style('stroke-dasharray', crosshairLine.dash?.join(',') ?? '4,4')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ export class TimeRangeSelector extends Component {
index: 2,
label: startLabels[2],
body: (
// eslint-disable-next-line no-use-before-define
<DatePickerWithInput
date={datePickerTimes.start}
onChange={this.setStartTime}
Expand Down Expand Up @@ -148,7 +147,6 @@ export class TimeRangeSelector extends Component {
/>
),
body: (
// eslint-disable-next-line no-use-before-define
<DatePickerWithInput
date={datePickerTimes.end}
onChange={this.setEndTime}
Expand Down