diff --git a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-axes-test-single-value-domain-visually-looks-correct-1-snap.png b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-axes-test-single-value-domain-visually-looks-correct-1-snap.png new file mode 100644 index 0000000000..ccf45b0410 Binary files /dev/null and b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-axes-test-single-value-domain-visually-looks-correct-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-does-not-show-annotation-with-y-domain-is-0-0-and-y-0-and-y-1-specified-1-snap.png b/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-does-not-show-annotation-with-y-domain-is-0-0-and-y-0-and-y-1-specified-1-snap.png index 4fe9d32d2d..6b46e08dd6 100644 Binary files a/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-does-not-show-annotation-with-y-domain-is-0-0-and-y-0-and-y-1-specified-1-snap.png and b/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-does-not-show-annotation-with-y-domain-is-0-0-and-y-0-and-y-1-specified-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-does-not-show-annotation-with-y-domain-is-20-20-and-y-0-and-y-1-values-are-specified-1-snap.png b/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-does-not-show-annotation-with-y-domain-is-20-20-and-y-0-and-y-1-values-are-specified-1-snap.png index 80d569ed7c..090ab93c0a 100644 Binary files a/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-does-not-show-annotation-with-y-domain-is-20-20-and-y-0-and-y-1-values-are-specified-1-snap.png and b/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-does-not-show-annotation-with-y-domain-is-20-20-and-y-0-and-y-1-values-are-specified-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-show-annotation-when-y-domain-fit-is-true-1-snap.png b/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-show-annotation-when-y-domain-fit-is-true-1-snap.png index fd70f9c13a..80dd4872b6 100644 Binary files a/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-show-annotation-when-y-domain-fit-is-true-1-snap.png and b/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-show-annotation-when-y-domain-fit-is-true-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-show-annotation-when-y-domain-is-0-0-1-snap.png b/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-show-annotation-when-y-domain-is-0-0-1-snap.png index 4fe9d32d2d..6b46e08dd6 100644 Binary files a/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-show-annotation-when-y-domain-is-0-0-1-snap.png and b/integration/tests/__image_snapshots__/annotations-stories-test-ts-annotations-stories-render-with-zero-domain-or-fit-to-domain-show-annotation-when-y-domain-is-0-0-1-snap.png differ diff --git a/integration/tests/__image_snapshots__/axis-stories-test-ts-axis-stories-renders-multilayer-time-axis-with-a-single-point-and-a-degenerate-zero-width-domain-1-snap.png b/integration/tests/__image_snapshots__/axis-stories-test-ts-axis-stories-renders-multilayer-time-axis-with-a-single-point-and-a-degenerate-zero-width-domain-1-snap.png index 0ff44d0433..329d70e1b4 100644 Binary files a/integration/tests/__image_snapshots__/axis-stories-test-ts-axis-stories-renders-multilayer-time-axis-with-a-single-point-and-a-degenerate-zero-width-domain-1-snap.png and b/integration/tests/__image_snapshots__/axis-stories-test-ts-axis-stories-renders-multilayer-time-axis-with-a-single-point-and-a-degenerate-zero-width-domain-1-snap.png differ diff --git a/package.json b/package.json index 14bab3785e..caf0f27582 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "@types/d3-cloud": "^1.2.5", "@types/d3-collection": "^1.0.8", "@types/d3-interpolate": "^1.3.1", - "@types/d3-scale": "^2.1.1", + "@types/d3-scale": "^3.3.0", "@types/d3-shape": "^2.0.0", "@types/enzyme": "^3.9.0", "@types/enzyme-adapter-react-16": "^1.0.5", diff --git a/packages/charts/package.json b/packages/charts/package.json index 9404b58010..e88dfff9ef 100644 --- a/packages/charts/package.json +++ b/packages/charts/package.json @@ -40,7 +40,7 @@ "d3-cloud": "^1.2.5", "d3-collection": "^1.0.7", "d3-interpolate": "^1.4.0", - "d3-scale": "^1.0.7", + "d3-scale": "3.3.0", "d3-shape": "^2.0.0", "prop-types": "^15.7.2", "re-reselect": "^3.4.0", diff --git a/packages/charts/src/chart_types/heatmap/layout/viewmodel/viewmodel.ts b/packages/charts/src/chart_types/heatmap/layout/viewmodel/viewmodel.ts index cda42c6d48..5d14039553 100644 --- a/packages/charts/src/chart_types/heatmap/layout/viewmodel/viewmodel.ts +++ b/packages/charts/src/chart_types/heatmap/layout/viewmodel/viewmodel.ts @@ -17,7 +17,7 @@ import { ScaleType } from '../../../../scales/constants'; import { LinearScale, OrdinalScale, RasterTimeScale } from '../../../../specs'; import { TextMeasure } from '../../../../utils/bbox/canvas_text_bbox_calculator'; import { addIntervalToTime } from '../../../../utils/chrono/elasticsearch'; -import { clamp, Datum } from '../../../../utils/common'; +import { clamp, Datum, isDefined } from '../../../../utils/common'; import { innerPad, pad } from '../../../../utils/dimensions'; import { Logger } from '../../../../utils/logger'; import { HeatmapStyle, Theme, Visible } from '../../../../utils/themes/theme'; @@ -89,7 +89,7 @@ export function shapeViewModel( .domain([0, elementSizes.grid.width]) .range(xValues); - // compute the cell width (can be smaller then the available size depending on config + // compute the cell width (can be smaller than the available size depending on config const cellWidth = heatmapTheme.cell.maxWidth !== 'fill' && xScale.bandwidth() > heatmapTheme.cell.maxWidth ? heatmapTheme.cell.maxWidth @@ -129,8 +129,8 @@ export function shapeViewModel( // compute each available cell position, color and value const cellMap = table.reduce>((acc, d) => { - const x = xScale(String(d.x)); - const y = yScale(String(d.y))! + gridStrokeWidth; + const x = xScale(d.x); + const y = yScale(d.y); const yIndex = yValues.indexOf(d.y); if (x === undefined || y === undefined || yIndex === -1) { @@ -156,7 +156,7 @@ export function shapeViewModel( x: (heatmapTheme.cell.maxWidth !== 'fill' ? x + xScale.bandwidth() / 2 - heatmapTheme.cell.maxWidth / 2 : x) + gridStrokeWidth, - y, + y: y + gridStrokeWidth, yIndex, width: cellWidthInner, height: cellHeightInner, @@ -230,6 +230,13 @@ export function shapeViewModel( const endX = xInvertedScale(clamp(bottomRight[0], 0, width)); const startY = yInvertedScale(clamp(topLeft[1], 0, currentGridHeight - 1)); const endY = yInvertedScale(clamp(bottomRight[1], 0, currentGridHeight - 1)); + if (!isDefined(startX) || !isDefined(endX) || !isDefined(startY) || !isDefined(endY)) { + return { + cells: [], + x: [], + y: [], + }; + } const allXValuesInRange: Array> = getValuesInRange(xValues, startX, endX); const allYValuesInRange: Array> = getValuesInRange(yValues, startY, endY); diff --git a/packages/charts/src/chart_types/xy_chart/annotations/line/dimensions.ts b/packages/charts/src/chart_types/xy_chart/annotations/line/dimensions.ts index afb05446b2..685a0d1114 100644 --- a/packages/charts/src/chart_types/xy_chart/annotations/line/dimensions.ts +++ b/packages/charts/src/chart_types/xy_chart/annotations/line/dimensions.ts @@ -10,7 +10,7 @@ import { Colors } from '../../../../common/colors'; import { Line } from '../../../../geoms/types'; import { Scale } from '../../../../scales'; import { isBandScale, isContinuousScale } from '../../../../scales/types'; -import { Position, Rotation } from '../../../../utils/common'; +import { isFiniteNumber, Position, Rotation } from '../../../../utils/common'; import { Dimensions, Size } from '../../../../utils/dimensions'; import { GroupId } from '../../../../utils/ids'; import { mergeWithDefaultAnnotationLine } from '../../../../utils/themes/merge_utils'; @@ -56,7 +56,7 @@ function computeYDomainLineAnnotationDimensions( const annotationValueYPosition = yScale.scale(dataValue); // avoid rendering non scalable annotation values - if (Number.isNaN(annotationValueYPosition)) return; + if (!isFiniteNumber(annotationValueYPosition)) return; // avoid rendering annotation with values outside the scale domain if (dataValue < domainStart || dataValue > domainEnd) return; @@ -65,7 +65,7 @@ function computeYDomainLineAnnotationDimensions( horizontal.domain.forEach((horizontalValue) => { const top = vertical.scale(verticalValue); const left = horizontal.scale(horizontalValue); - if (Number.isNaN(top + left)) return; + if (!isFiniteNumber(top + left)) return; const width = isHorizontalChartRotation ? horizontal.bandwidth : vertical.bandwidth; const height = isHorizontalChartRotation ? vertical.bandwidth : horizontal.bandwidth; @@ -139,7 +139,7 @@ function computeXDomainLineAnnotationDimensions( dataValues.forEach((datum: LineAnnotationDatum, i) => { const { dataValue } = datum; let annotationValueXPosition = xScale.scale(dataValue); - if (Number.isNaN(annotationValueXPosition)) { + if (!isFiniteNumber(annotationValueXPosition)) { return; } if (isContinuousScale(xScale) && typeof dataValue === 'number') { @@ -151,8 +151,7 @@ function computeXDomainLineAnnotationDimensions( if (isHistogramMode) { const offset = computeXScaleOffset(xScale, true); const pureScaledValue = xScale.pureScale(dataValue); - if (!Number.isNaN(pureScaledValue)) { - // Number.isFinite is regrettably not a type guard yet https://github.com/microsoft/TypeScript/issues/10038#issuecomment-924115831 + if (isFiniteNumber(pureScaledValue)) { annotationValueXPosition = pureScaledValue - offset; } } else { @@ -165,17 +164,17 @@ function computeXDomainLineAnnotationDimensions( } else { return; } - if (!isFinite(annotationValueXPosition)) { + if (!isFiniteNumber(annotationValueXPosition)) { return; } vertical.domain.forEach((verticalValue) => { horizontal.domain.forEach((horizontalValue) => { - if (Number.isNaN(annotationValueXPosition)) return; + if (!isFiniteNumber(annotationValueXPosition)) return; const top = vertical.scale(verticalValue); const left = horizontal.scale(horizontalValue); - if (Number.isNaN(top + left)) return; + if (!isFiniteNumber(top + left)) return; const width = isHorizontalChartRotation ? horizontal.bandwidth : vertical.bandwidth; const height = isHorizontalChartRotation ? vertical.bandwidth : horizontal.bandwidth; diff --git a/packages/charts/src/chart_types/xy_chart/annotations/rect/dimensions.ts b/packages/charts/src/chart_types/xy_chart/annotations/rect/dimensions.ts index 87c9d152a3..edf3f725da 100644 --- a/packages/charts/src/chart_types/xy_chart/annotations/rect/dimensions.ts +++ b/packages/charts/src/chart_types/xy_chart/annotations/rect/dimensions.ts @@ -8,7 +8,7 @@ import { Scale, ScaleBand, ScaleContinuous } from '../../../../scales'; import { isBandScale, isContinuousScale } from '../../../../scales/types'; -import { isDefined, Position, Rotation } from '../../../../utils/common'; +import { isDefined, isFiniteNumber, Position, Rotation } from '../../../../utils/common'; import { AxisId, GroupId } from '../../../../utils/ids'; import { Point } from '../../../../utils/point'; import { AxisStyle } from '../../../../utils/themes/theme'; @@ -151,7 +151,7 @@ export function computeRectAnnotationDimensions( const id = getAnnotationRectPropsId(annotationSpecId, props.datum, i, vDomainValue, hDomainValue); const top = smallMultiplesScales.vertical.scale(vDomainValue); const left = smallMultiplesScales.horizontal.scale(hDomainValue); - if (Number.isNaN(top + left)) return; + if (!isFiniteNumber(top + left)) return; const panel = { ...panelSize, top, left }; duplicated.push({ ...props, panel, id }); }); @@ -170,7 +170,7 @@ function scaleXonBandScale( const padding = (xScale.step - xScale.originalBandwidth) / 2; let scaledX1 = xScale.scale(x1); let scaledX0 = xScale.scale(x0); - if (Number.isNaN(scaledX1 + scaledX0)) { + if (!isFiniteNumber(scaledX1 + scaledX0)) { return null; } // extend the x1 scaled value to fully cover the last bar @@ -205,9 +205,9 @@ function scaleXonContinuousScale( xScale.totalBarsInCluster > 0 && !isHistogramModeEnabled ? xScale.scale(x1 + xScale.minInterval) : xScale.scale(x1); // the width needs to be computed before adjusting the x anchor const width = Math.abs(scaledX1 - scaledX0); - return Number.isNaN(width) - ? null - : { width, x: scaledX0 - (xScale.bandwidthPadding / 2) * xScale.totalBarsInCluster }; + return isFiniteNumber(width) + ? { width, x: scaledX0 - (xScale.bandwidthPadding / 2) * xScale.totalBarsInCluster } + : null; } /** diff --git a/packages/charts/src/chart_types/xy_chart/crosshair/crosshair_utils.ts b/packages/charts/src/chart_types/xy_chart/crosshair/crosshair_utils.ts index a07f6b38b0..1512a7b285 100644 --- a/packages/charts/src/chart_types/xy_chart/crosshair/crosshair_utils.ts +++ b/packages/charts/src/chart_types/xy_chart/crosshair/crosshair_utils.ts @@ -11,7 +11,7 @@ import { Line, Rect } from '../../../geoms/types'; import { Scale } from '../../../scales'; import { isContinuousScale } from '../../../scales/types'; import { TooltipStickTo } from '../../../specs/constants'; -import { Rotation } from '../../../utils/common'; +import { isFiniteNumber, Rotation } from '../../../utils/common'; import { Dimensions } from '../../../utils/dimensions'; import { Point } from '../../../utils/point'; import { isHorizontalRotation, isVerticalRotation } from '../state/utils/common'; @@ -26,7 +26,7 @@ export function getSnapPosition( totalBarsInCluster = 1, ): { band: number; position: number } | undefined { const position = scale.scale(value); - if (Number.isNaN(position)) { + if (!isFiniteNumber(position)) { return; } diff --git a/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.bands.test.ts.snap b/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.bands.test.ts.snap index 95e6f93301..c351a3beb1 100644 --- a/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.bands.test.ts.snap +++ b/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.bands.test.ts.snap @@ -774,7 +774,7 @@ Array [ }, "width": 25, "x": 75, - "y": 20, + "y": 19.999999999999996, }, ] `; diff --git a/packages/charts/src/chart_types/xy_chart/rendering/area.ts b/packages/charts/src/chart_types/xy_chart/rendering/area.ts index 0d426b89bb..a4803b28ad 100644 --- a/packages/charts/src/chart_types/xy_chart/rendering/area.ts +++ b/packages/charts/src/chart_types/xy_chart/rendering/area.ts @@ -53,7 +53,7 @@ export function renderArea( const y1DatumAccessor = getYDatumValueFn(); const y0DatumAccessor = getYDatumValueFn('y0'); const pathGenerator = area() - .x(({ x }) => (xScale.scale(x) ?? NaN) - xScaleOffset) + .x(({ x }) => xScale.scale(x) - xScaleOffset) .y1(y1Fn) .y0(y0Fn) .defined((datum) => { diff --git a/packages/charts/src/chart_types/xy_chart/rendering/bars.ts b/packages/charts/src/chart_types/xy_chart/rendering/bars.ts index 398ba25184..7d4aa1f37f 100644 --- a/packages/charts/src/chart_types/xy_chart/rendering/bars.ts +++ b/packages/charts/src/chart_types/xy_chart/rendering/bars.ts @@ -10,7 +10,7 @@ import { Color } from '../../../common/colors'; import { Scale } from '../../../scales'; import { ScaleType } from '../../../scales/constants'; import { TextMeasure } from '../../../utils/bbox/canvas_text_bbox_calculator'; -import { clamp, mergePartial } from '../../../utils/common'; +import { clamp, isFiniteNumber, mergePartial } from '../../../utils/common'; import { Dimensions } from '../../../utils/dimensions'; import { BandedAccessorType, BarGeometry } from '../../../utils/geometry'; import { BarSeriesStyle, DisplayValueStyle } from '../../../utils/themes/theme'; @@ -49,7 +49,7 @@ export function renderBars( const isInvertedY = yScale.isInverted; return dataSeries.data.reduce((barTuple: BarTuple, datum) => { const xScaled = xScale.scale(datum.x); - if (!xScale.isValueInDomain(datum.x) || Number.isNaN(xScaled)) { + if (!xScale.isValueInDomain(datum.x) || !isFiniteNumber(xScaled)) { return barTuple; // don't create a bar if not within the xScale domain } const { barGeometries, indexedGeometryMap } = barTuple; @@ -67,7 +67,7 @@ export function renderBars( const height = absHeight === 0 ? absHeight : Math.max(minBarHeight, absHeight); // extend nonzero bars const heightExtension = height - absHeight; const isUpsideDown = finiteHeight < 0; - const finiteY = Number.isNaN(y0Scaled + rawY) ? 0 : rawY; + const finiteY = isFiniteNumber(y0Scaled + rawY) ? rawY : 0; const y = isUpsideDown ? finiteY - height + heightExtension : finiteY - heightExtension; const seriesIdentifier: XYChartSeriesIdentifier = { diff --git a/packages/charts/src/chart_types/xy_chart/rendering/points.ts b/packages/charts/src/chart_types/xy_chart/rendering/points.ts index cc37b46f45..daf817ca9b 100644 --- a/packages/charts/src/chart_types/xy_chart/rendering/points.ts +++ b/packages/charts/src/chart_types/xy_chart/rendering/points.ts @@ -8,7 +8,7 @@ import { Color } from '../../../common/colors'; import { Scale } from '../../../scales'; -import { isNil } from '../../../utils/common'; +import { isFiniteNumber, isNil } from '../../../utils/common'; import { Dimensions } from '../../../utils/dimensions'; import { BandedAccessorType, PointGeometry } from '../../../utils/geometry'; import { PointStyle } from '../../../utils/themes/theme'; @@ -63,7 +63,7 @@ export function renderPoints( // don't create the point if it that point was filled const x = xScale.scale(xValue); - if (Number.isNaN(x)) return acc; + if (!isFiniteNumber(x)) return acc; const points: PointGeometry[] = []; const yDatumKeyNames: Array> = isBandChart ? ['y0', 'y1'] : ['y1']; diff --git a/packages/charts/src/chart_types/xy_chart/rendering/rendering.areas.test.ts b/packages/charts/src/chart_types/xy_chart/rendering/rendering.areas.test.ts index a1f1ce00a2..7144e4d5e2 100644 --- a/packages/charts/src/chart_types/xy_chart/rendering/rendering.areas.test.ts +++ b/packages/charts/src/chart_types/xy_chart/rendering/rendering.areas.test.ts @@ -13,6 +13,7 @@ import { MockStore } from '../../../mocks/store'; import { ScaleType } from '../../../scales/constants'; import { Spec } from '../../../specs'; import { GlobalChartState } from '../../../state/chart_state'; +import { isFiniteNumber } from '../../../utils/common'; import { PointGeometry, AreaGeometry } from '../../../utils/geometry'; import { LIGHT_THEME } from '../../../utils/themes/light_theme'; import { computeSeriesDomainsSelector } from '../state/selectors/compute_series_domains'; @@ -407,7 +408,7 @@ describe('Rendering points - areas', () => { expect(zeroValueIndexdGeometry).toBeDefined(); expect(zeroValueIndexdGeometry.length).toBe(1); // moved to the bottom of the chart - expect(zeroValueIndexdGeometry[0].y).toBe(Infinity); + expect(isFiniteNumber(zeroValueIndexdGeometry[0].y)).toBe(false); // default area theme point radius expect((zeroValueIndexdGeometry[0] as PointGeometry).radius).toBe(LIGHT_THEME.areaSeriesStyle.point.radius); }); diff --git a/packages/charts/src/chart_types/xy_chart/rendering/rendering.bubble.test.ts b/packages/charts/src/chart_types/xy_chart/rendering/rendering.bubble.test.ts index 6a41ffbcae..e0779ee961 100644 --- a/packages/charts/src/chart_types/xy_chart/rendering/rendering.bubble.test.ts +++ b/packages/charts/src/chart_types/xy_chart/rendering/rendering.bubble.test.ts @@ -360,14 +360,6 @@ describe('Rendering points - bubble', () => { expect(points.length).toBe(7); // all the points including null geometries expect(geometriesIndex.size).toEqual(9); - - const zeroValueIndexdGeometry = geometriesIndex.find(null, { - x: 56.25, - y: 100, - }); - expect(zeroValueIndexdGeometry).toBeDefined(); - expect(zeroValueIndexdGeometry.length).toBe(3); - expect(zeroValueIndexdGeometry.find(({ value: { x } }) => x === 5)).toBeDefined(); }); }); describe('Remove points datum is not in domain', () => { diff --git a/packages/charts/src/chart_types/xy_chart/rendering/rendering.lines.test.ts b/packages/charts/src/chart_types/xy_chart/rendering/rendering.lines.test.ts index c80bbeeab6..59bbcf4de1 100644 --- a/packages/charts/src/chart_types/xy_chart/rendering/rendering.lines.test.ts +++ b/packages/charts/src/chart_types/xy_chart/rendering/rendering.lines.test.ts @@ -10,6 +10,7 @@ import { MockGlobalSpec, MockSeriesSpec } from '../../../mocks/specs'; import { MockStore } from '../../../mocks/store'; import { ScaleContinuousType } from '../../../scales'; import { ScaleType } from '../../../scales/constants'; +import { isFiniteNumber } from '../../../utils/common'; import { PointGeometry } from '../../../utils/geometry'; import { LIGHT_THEME } from '../../../utils/themes/light_theme'; import { computeSeriesGeometriesSelector } from '../state/selectors/compute_series_geometries'; @@ -383,7 +384,7 @@ describe('Rendering points - line', () => { expect(zeroValueIndexdGeometry).toBeDefined(); expect(zeroValueIndexdGeometry.length).toBe(1); // the zero value is moved vertically to infinity - expect((zeroValueIndexdGeometry[0] as PointGeometry).y).toBe(Infinity); + expect(isFiniteNumber((zeroValueIndexdGeometry[0] as PointGeometry).y)).toBe(false); expect((zeroValueIndexdGeometry[0] as PointGeometry).radius).toBe(LIGHT_THEME.lineSeriesStyle.point.radius); }); }); diff --git a/packages/charts/src/chart_types/xy_chart/rendering/utils.ts b/packages/charts/src/chart_types/xy_chart/rendering/utils.ts index e807415499..82f45cf2f1 100644 --- a/packages/charts/src/chart_types/xy_chart/rendering/utils.ts +++ b/packages/charts/src/chart_types/xy_chart/rendering/utils.ts @@ -10,7 +10,7 @@ import { LegendItem } from '../../../common/legend'; import { Scale } from '../../../scales'; import { isLogarithmicScale } from '../../../scales/types'; import { MarkBuffer } from '../../../specs'; -import { getDistance } from '../../../utils/common'; +import { getDistance, isFiniteNumber } from '../../../utils/common'; import { BarGeometry, ClippedRanges, isPointGeometry, PointGeometry } from '../../../utils/geometry'; import { GeometryStateStyle, SharedGeometryStateStyle } from '../../../utils/themes/theme'; import { DataSeriesDatum, FilledValues, XYChartSeriesIdentifier } from '../utils/series'; @@ -67,7 +67,7 @@ export function getClippedRanges( return dataset.reduce((acc, data) => { const xScaled = xScale.scale(data.x); - if (Number.isNaN(xScaled)) return acc; + if (!isFiniteNumber(xScaled)) return acc; const xValue = xScaled - xScaleOffset + xScale.bandwidth / 2; diff --git a/packages/charts/src/chart_types/xy_chart/state/__snapshots__/chart_state.debug.test.ts.snap b/packages/charts/src/chart_types/xy_chart/state/__snapshots__/chart_state.debug.test.ts.snap index 0fb8a2c445..76ff0712b6 100644 --- a/packages/charts/src/chart_types/xy_chart/state/__snapshots__/chart_state.debug.test.ts.snap +++ b/packages/charts/src/chart_types/xy_chart/state/__snapshots__/chart_state.debug.test.ts.snap @@ -89,7 +89,7 @@ Object { "color": "#54B399", "key": "groupId{__global__}spec{spec1}yAccessor{1}splitAccessors{}", "name": "spec1", - "path": "M0,141.5L58,99.4L145,0", + "path": "M0,141.5L58,99.39999999999999L145,0", "points": Array [ Object { "mark": null, @@ -317,7 +317,7 @@ Object { "color": "#54B399", "key": "groupId{__global__}spec{spec1}yAccessor{1}splitAccessors{}", "name": "spec1", - "path": "M0,141.5L58,99.4L145,0", + "path": "M0,141.5L58,99.39999999999999L145,0", "points": Array [ Object { "mark": null, diff --git a/packages/charts/src/chart_types/xy_chart/state/selectors/get_brush_area.ts b/packages/charts/src/chart_types/xy_chart/state/selectors/get_brush_area.ts index acb98dc0a3..929b5c04c7 100644 --- a/packages/charts/src/chart_types/xy_chart/state/selectors/get_brush_area.ts +++ b/packages/charts/src/chart_types/xy_chart/state/selectors/get_brush_area.ts @@ -11,7 +11,7 @@ import { GlobalChartState } from '../../../../state/chart_state'; import { createCustomCachedSelector } from '../../../../state/create_selector'; import { getChartRotationSelector } from '../../../../state/selectors/get_chart_rotation'; import { getSettingsSpecSelector } from '../../../../state/selectors/get_settings_specs'; -import { clamp, Rotation } from '../../../../utils/common'; +import { clamp, isFiniteNumber, Rotation } from '../../../../utils/common'; import { Dimensions } from '../../../../utils/dimensions'; import { Point } from '../../../../utils/point'; import { isVerticalRotation } from '../utils/common'; @@ -72,10 +72,12 @@ export function getPointsConstraintToSinglePanel( const hPanel = horizontal.invert(startPlotPoint.x); const vPanel = vertical.invert(startPlotPoint.y); - const hPanelStart = horizontal.scale(hPanel) || 0; + const scaledHorizontal = horizontal.scale(hPanel); + const hPanelStart = isFiniteNumber(scaledHorizontal) ? scaledHorizontal : 0; const hPanelEnd = hPanelStart + horizontal.bandwidth; - const vPanelStart = vertical.scale(vPanel) || 0; + const scaledVertical = vertical.scale(vPanel); + const vPanelStart = isFiniteNumber(scaledVertical) ? scaledVertical : 0; const vPanelEnd = vPanelStart + vertical.bandwidth; const start = { diff --git a/packages/charts/src/chart_types/xy_chart/state/selectors/get_cursor_band.ts b/packages/charts/src/chart_types/xy_chart/state/selectors/get_cursor_band.ts index 7fc6eebe83..23b0d479e4 100644 --- a/packages/charts/src/chart_types/xy_chart/state/selectors/get_cursor_band.ts +++ b/packages/charts/src/chart_types/xy_chart/state/selectors/get_cursor_band.ts @@ -11,6 +11,7 @@ import { SettingsSpec, PointerEvent } from '../../../../specs/settings'; import { GlobalChartState } from '../../../../state/chart_state'; import { createCustomCachedSelector } from '../../../../state/create_selector'; import { getSettingsSpecSelector } from '../../../../state/selectors/get_settings_specs'; +import { isFiniteNumber } from '../../../../utils/common'; import { isValidPointerOverEvent } from '../../../../utils/events'; import { getCursorBandPosition } from '../../crosshair/crosshair_utils'; import { ChartDimensions } from '../../utils/dimensions'; @@ -72,7 +73,7 @@ function getCursorBand( if (isValidPointerOverEvent(xScale, externalPointerEvent)) { fromExternalEvent = true; const x = xScale.pureScale(externalPointerEvent.x); - if (Number.isNaN(x) || x > chartDimensions.width || x < 0) { + if (!isFiniteNumber(x) || x > chartDimensions.width || x < 0) { return; } pointerPosition = { @@ -87,19 +88,19 @@ function getCursorBand( }; } else { xValue = xScale.invertWithStep(orientedProjectedPointerPosition.x, geometriesIndexKeys); - if (!xValue) { + if (!isFiniteNumber(xValue.value)) { return; } } const { horizontal, vertical } = smallMultipleScales; - const topPos = vertical.scale(pointerPosition.verticalPanelValue) || 0; - const leftPos = horizontal.scale(pointerPosition.horizontalPanelValue) || 0; + const topPos = vertical.scale(pointerPosition.verticalPanelValue); + const leftPos = horizontal.scale(pointerPosition.horizontalPanelValue); const panel = { width: horizontal.bandwidth, height: vertical.bandwidth, - top: chartDimensions.top + topPos, - left: chartDimensions.left + leftPos, + top: chartDimensions.top + (isFiniteNumber(topPos) ? topPos : 0), + left: chartDimensions.left + (isFiniteNumber(leftPos) ? leftPos : 0), }; const cursorBand = getCursorBandPosition( settingsSpec.rotation, diff --git a/packages/charts/src/chart_types/xy_chart/state/selectors/get_elements_at_cursor_pos.ts b/packages/charts/src/chart_types/xy_chart/state/selectors/get_elements_at_cursor_pos.ts index f348de641b..8f0b6a8565 100644 --- a/packages/charts/src/chart_types/xy_chart/state/selectors/get_elements_at_cursor_pos.ts +++ b/packages/charts/src/chart_types/xy_chart/state/selectors/get_elements_at_cursor_pos.ts @@ -9,6 +9,7 @@ import { PointerEvent } from '../../../../specs'; import { GlobalChartState } from '../../../../state/chart_state'; import { createCustomCachedSelector } from '../../../../state/create_selector'; +import { isNil } from '../../../../utils/common'; import { isValidPointerOverEvent } from '../../../../utils/events'; import { IndexedGeometry } from '../../../../utils/geometry'; import { ChartDimensions } from '../../utils/dimensions'; @@ -39,14 +40,14 @@ export const getElementAtCursorPositionSelector = createCustomCachedSelector( function getElementAtCursorPosition( orientedProjectedPointerPosition: PointerPosition, - scales: ComputedScales, + { xScale }: ComputedScales, geometriesIndexKeys: (string | number)[], geometriesIndex: IndexedGeometryMap, externalPointerEvent: PointerEvent | null, { chartDimensions }: ChartDimensions, ): IndexedGeometry[] { - if (isValidPointerOverEvent(scales.xScale, externalPointerEvent)) { - const x = scales.xScale.pureScale(externalPointerEvent.x); + if (isValidPointerOverEvent(xScale, externalPointerEvent)) { + const x = xScale.pureScale(externalPointerEvent.x); if (Number.isNaN(x) || x > chartDimensions.width + chartDimensions.left || x < 0) { return []; @@ -54,14 +55,15 @@ function getElementAtCursorPosition( // TODO: Handle external event with spatial points return geometriesIndex.find(externalPointerEvent.x, { x: -1, y: -1 }); } - const xValue = scales.xScale.invertWithStep(orientedProjectedPointerPosition.x, geometriesIndexKeys); - if (!xValue) { + const { value } = xScale.invertWithStep(orientedProjectedPointerPosition.x, geometriesIndexKeys); + + if (isNil(value)) { return []; } // get the elements at cursor position return geometriesIndex .find( - xValue?.value, + value, orientedProjectedPointerPosition, orientedProjectedPointerPosition.horizontalPanelValue, orientedProjectedPointerPosition.verticalPanelValue, diff --git a/packages/charts/src/chart_types/xy_chart/state/selectors/get_projected_scaled_values.ts b/packages/charts/src/chart_types/xy_chart/state/selectors/get_projected_scaled_values.ts index 1ab5296119..b0bc3ef04f 100644 --- a/packages/charts/src/chart_types/xy_chart/state/selectors/get_projected_scaled_values.ts +++ b/packages/charts/src/chart_types/xy_chart/state/selectors/get_projected_scaled_values.ts @@ -25,7 +25,7 @@ export const getProjectedScaledValues = createCustomCachedSelector( } const xValue = xScale.invertWithStep(x, geometriesIndexKeys); - if (!xValue) { + if (!Number.isFinite(xValue.value)) { return; } diff --git a/packages/charts/src/chart_types/xy_chart/state/selectors/get_tooltip_position.ts b/packages/charts/src/chart_types/xy_chart/state/selectors/get_tooltip_position.ts index e12471cb39..d1b47b0d22 100644 --- a/packages/charts/src/chart_types/xy_chart/state/selectors/get_tooltip_position.ts +++ b/packages/charts/src/chart_types/xy_chart/state/selectors/get_tooltip_position.ts @@ -10,6 +10,7 @@ import { AnchorPosition } from '../../../../components/portal/types'; import { isTooltipType } from '../../../../specs/settings'; import { createCustomCachedSelector } from '../../../../state/create_selector'; import { getSettingsSpecSelector } from '../../../../state/selectors/get_settings_specs'; +import { isFiniteNumber } from '../../../../utils/common'; import { getTooltipAnchorPosition } from '../../crosshair/crosshair_utils'; import { computeChartDimensionsSelector } from './compute_chart_dimensions'; import { computeSmallMultipleScalesSelector } from './compute_small_multiple_scales'; @@ -36,14 +37,14 @@ export const getTooltipAnchorPositionSelector = createCustomCachedSelector( return null; } - const topPos = vertical.scale(projectedPointerPosition.verticalPanelValue) || 0; - const leftPos = horizontal.scale(projectedPointerPosition.horizontalPanelValue) || 0; + const topPos = vertical.scale(projectedPointerPosition.verticalPanelValue); + const leftPos = horizontal.scale(projectedPointerPosition.horizontalPanelValue); const panel = { width: horizontal.bandwidth, height: vertical.bandwidth, - top: chartDimensions.chartDimensions.top + topPos, - left: chartDimensions.chartDimensions.left + leftPos, + top: chartDimensions.chartDimensions.top + (isFiniteNumber(topPos) ? topPos : 0), + left: chartDimensions.chartDimensions.left + (isFiniteNumber(leftPos) ? leftPos : 0), }; return getTooltipAnchorPosition( diff --git a/packages/charts/src/chart_types/xy_chart/state/selectors/on_pointer_move_caller.ts b/packages/charts/src/chart_types/xy_chart/state/selectors/on_pointer_move_caller.ts index a08f577ce5..aa987c6da8 100644 --- a/packages/charts/src/chart_types/xy_chart/state/selectors/on_pointer_move_caller.ts +++ b/packages/charts/src/chart_types/xy_chart/state/selectors/on_pointer_move_caller.ts @@ -47,7 +47,7 @@ function getPointerEvent( return { chartId, type: PointerEventType.Out }; } const xValue = xScale.invertWithStep(x, geometriesIndexKeys); - if (!xValue) { + if (!Number.isFinite(xValue.value)) { return { chartId, type: PointerEventType.Out }; } return { diff --git a/packages/charts/src/chart_types/xy_chart/state/selectors/visible_ticks.ts b/packages/charts/src/chart_types/xy_chart/state/selectors/visible_ticks.ts index 5b73f363fd..28bb049aaf 100644 --- a/packages/charts/src/chart_types/xy_chart/state/selectors/visible_ticks.ts +++ b/packages/charts/src/chart_types/xy_chart/state/selectors/visible_ticks.ts @@ -13,7 +13,7 @@ import { AxisSpec, SettingsSpec } from '../../../../specs'; import { createCustomCachedSelector } from '../../../../state/create_selector'; import { getSettingsSpecSelector } from '../../../../state/selectors/get_settings_specs'; import { withTextMeasure } from '../../../../utils/bbox/canvas_text_bbox_calculator'; -import { isRTLString, Position, Rotation } from '../../../../utils/common'; +import { isFiniteNumber, isRTLString, Position, Rotation } from '../../../../utils/common'; import { Size } from '../../../../utils/dimensions'; import { AxisId } from '../../../../utils/ids'; import { multilayerAxisEntry } from '../../axes/timeslip/multilayer_ticks'; @@ -121,6 +121,8 @@ function getVisibleTicks( (enableHistogramMode ? -halfPadding : (scale.bandwidth * shift) / 2) + (scale.isSingleValue() ? 0 : rotationOffset); const firstTickValue = ticks[0]; + const firstTickValueScaled = scale.scale(firstTickValue); + const allTicks: AxisTick[] = makeRaster && isSingleValueScale && typeof firstTickValue === 'number' ? [ @@ -128,8 +130,8 @@ function getVisibleTicks( value: firstTickValue, domainClampedValue: firstTickValue, label: labelFormatter(firstTickValue), - position: (scale.scale(firstTickValue) || 0) + offset, - domainClampedPosition: (scale.scale(firstTickValue) || 0) + offset, + position: (isFiniteNumber(firstTickValueScaled) ? firstTickValueScaled : 0) + offset, + domainClampedPosition: (isFiniteNumber(firstTickValueScaled) ? firstTickValueScaled : 0) + offset, layer: undefined, // no multiple layers with `singleValueScale`s detailedLayer: 0, direction: 'rtl', diff --git a/packages/charts/src/chart_types/xy_chart/state/utils/utils.ts b/packages/charts/src/chart_types/xy_chart/state/utils/utils.ts index 6ba8f49fc4..aa362f628b 100644 --- a/packages/charts/src/chart_types/xy_chart/state/utils/utils.ts +++ b/packages/charts/src/chart_types/xy_chart/state/utils/utils.ts @@ -353,13 +353,13 @@ function renderGeometries( const { stackMode } = ds; - const leftPos = smHScale.scale(ds.smHorizontalAccessorValue) || 0; - const topPos = smVScale.scale(ds.smVerticalAccessorValue) || 0; + const leftPos = smHScale.scale(ds.smHorizontalAccessorValue); + const topPos = smVScale.scale(ds.smVerticalAccessorValue); const panel: Dimensions = { width: smHScale.bandwidth, height: smVScale.bandwidth, - top: topPos, - left: leftPos, + top: isFiniteNumber(topPos) ? topPos : 0, + left: isFiniteNumber(leftPos) ? leftPos : 0, }; const dataSeriesKey = getSeriesKey( { diff --git a/packages/charts/src/chart_types/xy_chart/utils/panel_utils.ts b/packages/charts/src/chart_types/xy_chart/utils/panel_utils.ts index 085c9e4079..a5bc6920dc 100644 --- a/packages/charts/src/chart_types/xy_chart/utils/panel_utils.ts +++ b/packages/charts/src/chart_types/xy_chart/utils/panel_utils.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import { isFiniteNumber } from '../../../utils/common'; import { Point } from '../../../utils/point'; import { SmallMultipleScales } from '../state/selectors/compute_small_multiple_scales'; @@ -28,9 +29,11 @@ export function getPerPanelMap( return [ ...acc, ...horizontal.domain.reduce>((hAcc, horizontalValue) => { + const x = horizontal.scale(horizontalValue); + const y = vertical.scale(verticalValue); const panelAnchor: Point = { - x: horizontal.scale(horizontalValue) || 0, - y: vertical.scale(verticalValue) || 0, + x: isFiniteNumber(x) ? x : 0, + y: isFiniteNumber(y) ? y : 0, }; const fnObj = fn(panelAnchor, horizontalValue, verticalValue, scales); return fnObj ? [...hAcc, { panelAnchor, horizontalValue, verticalValue, ...fnObj }] : hAcc; diff --git a/packages/charts/src/chart_types/xy_chart/utils/scales.test.ts b/packages/charts/src/chart_types/xy_chart/utils/scales.test.ts index 5e6a76fbd0..11a039ed10 100644 --- a/packages/charts/src/chart_types/xy_chart/utils/scales.test.ts +++ b/packages/charts/src/chart_types/xy_chart/utils/scales.test.ts @@ -38,8 +38,8 @@ describe('Series scales', () => { const expectedBandwidth = 120 / 4; expect(scale.bandwidth).toBe(expectedBandwidth); expect(scale.scale(0)).toBe(expectedBandwidth * 3); - expect(scale.scale(1)).toBe(expectedBandwidth * 2); - expect(scale.scale(2)).toBe(expectedBandwidth); + expect(scale.scale(1)).toBeCloseTo(expectedBandwidth * 2); + expect(scale.scale(2)).toBeCloseTo(expectedBandwidth); expect(scale.scale(3)).toBe(0); }); diff --git a/packages/charts/src/scales/index.ts b/packages/charts/src/scales/index.ts index 2f9c0e8322..c1bad53823 100644 --- a/packages/charts/src/scales/index.ts +++ b/packages/charts/src/scales/index.ts @@ -26,7 +26,7 @@ export type ScaleBandType = ScaleOrdinalType; /** * A `Scale` interface. A scale can map an input value within a specified domain * to an output value from a specified range. - * The the value is mapped depending on the `type` (linear, log, sqrt, time, ordinal) + * The value is mapped depending on the `type` (linear, log, sqrt, time, ordinal) * @internal */ export interface Scale { diff --git a/packages/charts/src/scales/scale_band.ts b/packages/charts/src/scales/scale_band.ts index 8293abdf51..a37357dfeb 100644 --- a/packages/charts/src/scales/scale_band.ts +++ b/packages/charts/src/scales/scale_band.ts @@ -12,7 +12,7 @@ import { Scale, ScaleBandType } from '.'; import { PrimitiveValue } from '../chart_types/partition_chart/layout/utils/group_by_rollup'; import { Ratio } from '../common/geometry'; import { RelativeBandsPadding } from '../specs'; -import { clamp, stringifyNullsUndefined } from '../utils/common'; +import { clamp } from '../utils/common'; import { Range } from '../utils/domain'; import { ScaleType } from './constants'; @@ -85,7 +85,7 @@ export class ScaleBand implements Scale { } scale(value?: PrimitiveValue) { - const scaleValue = this.d3Scale(stringifyNullsUndefined(value)); + const scaleValue = this.d3Scale((value as unknown) as T); return typeof scaleValue === 'number' && Number.isFinite(scaleValue) ? scaleValue : NaN; // fixme when TS improves } diff --git a/packages/charts/src/scales/scale_continuous.ts b/packages/charts/src/scales/scale_continuous.ts index 9847c90fb4..3b6a8b5db0 100644 --- a/packages/charts/src/scales/scale_continuous.ts +++ b/packages/charts/src/scales/scale_continuous.ts @@ -15,6 +15,7 @@ import { ScaleLogarithmic, ScalePower, scaleSqrt, + ScaleTime, scaleUtc, } from 'd3-scale'; import { Required } from 'utility-types'; @@ -29,7 +30,15 @@ import { ContinuousDomain, Range } from '../utils/domain'; import { LOG_MIN_ABS_DOMAIN, ScaleType } from './constants'; import { LogScaleOptions } from './types'; -const SCALES = { +type ContinuousScaleType = + | typeof ScaleType.Time + | typeof ScaleType.Linear + | typeof ScaleType.Log + | typeof ScaleType.Sqrt; +const SCALES: Record< + ContinuousScaleType, + () => ScaleContinuousNumeric | ScaleTime +> = { [ScaleType.Linear]: scaleLinear, [ScaleType.Log]: scaleLog, [ScaleType.Sqrt]: scaleSqrt, @@ -165,7 +174,7 @@ export class ScaleContinuous implements Scale { : (d3Scale as D3ScaleNonTime).ticks(scaleOptions.desiredTickCount); this.domain = nicePaddedDomain; - this.project = (d: number) => d3Scale(d); + this.project = (d: number) => d3Scale(d) ?? NaN; this.inverseProject = (d: number) => d3Scale.invert(d); } diff --git a/packages/charts/src/scales/types.ts b/packages/charts/src/scales/types.ts index d9415b3c9b..38ef655963 100644 --- a/packages/charts/src/scales/types.ts +++ b/packages/charts/src/scales/types.ts @@ -12,7 +12,7 @@ import { ScaleBand } from './scale_band'; import { ScaleContinuous } from './scale_continuous'; /** - * Check if a scale is logaritmic + * Check if a scale is logarithmic * @internal */ export function isLogarithmicScale(scale: Scale): scale is ScaleContinuous { diff --git a/packages/charts/src/utils/common.ts b/packages/charts/src/utils/common.ts index 7e2b8d4c71..54e4f39789 100644 --- a/packages/charts/src/utils/common.ts +++ b/packages/charts/src/utils/common.ts @@ -446,19 +446,6 @@ export function getDistance(a: Point, b: Point): number { return Math.sqrt(Math.pow(b.x - a.x, 2) + Math.pow(b.y - a.y, 2)); } -/** @internal */ -export function stringifyNullsUndefined(value?: PrimitiveValue): string | number { - if (value === undefined) { - return 'undefined'; - } - - if (value === null) { - return 'null'; - } - - return value; -} - /** * Determines if an array has all unique values * @@ -628,7 +615,10 @@ export function getOppositeAlignment { + return ( + + + + + + + ); +}; + +Example.parameters = { + markdown: `A series with a single datapoint doesn't have enough data to compute the horizontal x domain. + In this case the chart should render the data point at the middle of the axis. + The same should happen on the Y axis if the domain is configured to be limited to a single value, as in this example. + It should show the full scale from the baseline to the Y value if the domain is automatically computed. +`, +}; diff --git a/storybook/stories/axes/axes.stories.tsx b/storybook/stories/axes/axes.stories.tsx index 2df6221440..347a5fd51f 100644 --- a/storybook/stories/axes/axes.stories.tsx +++ b/storybook/stories/axes/axes.stories.tsx @@ -25,3 +25,4 @@ export { Example as fitDomain } from './11_fit_domain_extent.story'; export { Example as duplicateTicks } from './12_duplicate_ticks.story'; export { Example as labelFormatting } from './13_label_formatting.story'; export { Example as duplicateTicks2 } from './14_duplicate_ticks_2.story'; +export { Example as testSingleValueDomain } from './15_single_value_domain.story'; diff --git a/yarn.lock b/yarn.lock index e2524242e6..50ec6f454f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5736,12 +5736,12 @@ resolved "https://registry.yarnpkg.com/@types/d3-path/-/d3-path-2.0.1.tgz#ca03dfa8b94d8add97ad0cd97e96e2006b4763cb" integrity sha512-6K8LaFlztlhZO7mwsZg7ClRsdLg3FJRzIIi6SZXDWmmSJc2x8dd2VkESbLXdk3p8cuvz71f36S0y8Zv2AxqvQw== -"@types/d3-scale@^2.1.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@types/d3-scale/-/d3-scale-2.1.1.tgz#405e58771ec6ae7b8f7b4178ee1887620759e8f7" - integrity sha512-kNTkbZQ+N/Ip8oX9PByXfDLoCSaZYm+VUOasbmsa6KD850/ziMdYepg/8kLg2plHzoLANdMqPoYQbvExevLUHg== +"@types/d3-scale@^3.3.0": + version "3.3.2" + resolved "https://registry.yarnpkg.com/@types/d3-scale/-/d3-scale-3.3.2.tgz#18c94e90f4f1c6b1ee14a70f14bfca2bd1c61d06" + integrity sha512-gGqr7x1ost9px3FvIfUMi5XA/F/yAf4UkUDtdQhpH92XCT0Oa7zkkRzY61gPVJq+DxpHn/btouw5ohWkbBsCzQ== dependencies: - "@types/d3-time" "*" + "@types/d3-time" "^2" "@types/d3-shape@^2.0.0": version "2.1.3" @@ -5750,10 +5750,10 @@ dependencies: "@types/d3-path" "^2" -"@types/d3-time@*": - version "1.0.10" - resolved "https://registry.yarnpkg.com/@types/d3-time/-/d3-time-1.0.10.tgz#d338c7feac93a98a32aac875d1100f92c7b61f4f" - integrity sha512-aKf62rRQafDQmSiv1NylKhIMmznsjRN+MnXRXTqHoqm0U/UZzVpdrtRnSIfdiLS616OuC1soYeX1dBg2n1u8Xw== +"@types/d3-time@^2": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@types/d3-time/-/d3-time-2.1.1.tgz#743fdc821c81f86537cbfece07093ac39b4bc342" + integrity sha512-9MVYlmIgmRR31C5b4FVSWtuMmBHh2mOWQYfl7XAYOa8dsnb7iEmUmRSWSFgXFtkjxO65d7hTUHQC+RhR/9IWFg== "@types/d3@^3": version "3.5.45" @@ -9485,6 +9485,13 @@ cz-conventional-changelog@3.3.0, cz-conventional-changelog@^3.3.0: optionalDependencies: "@commitlint/load" ">6.1.1" +d3-array@2, d3-array@^2.3.0: + version "2.12.1" + resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-2.12.1.tgz#e20b41aafcdffdf5d50928004ececf815a465e81" + integrity sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ== + dependencies: + internmap "^1.0.0" + d3-array@^1.2.0, d3-array@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-1.2.4.tgz#635ce4d5eea759f6f605863dbcfc30edc737f71f" @@ -9507,6 +9514,11 @@ d3-color@1: resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-1.4.0.tgz#89c45a995ed773b13314f06460df26d60ba0ecaf" integrity sha512-TzNPeJy2+iEepfiL92LAAB7fvnp/dV2YwANPVHdDWmYMm23qIJBYww3qT8I8C1wXrmrg4UWs7BKc2tKIgyjzHg== +"d3-color@1 - 2": + version "2.0.0" + resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-2.0.0.tgz#8d625cab42ed9b8f601a1760a389f7ea9189d62e" + integrity sha512-SPXi0TSKPD4g9tw0NMZFnR95XVgUZiBH+uUTqQuDu1OsE2zomHU7ho0FISciaPvosimixwHFl3WHLGabv6dDgQ== + d3-color@^1.4.0: version "1.4.1" resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-1.4.1.tgz#c52002bf8846ada4424d55d97982fef26eb3bc8a" @@ -9522,6 +9534,11 @@ d3-format@1: resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-1.4.1.tgz#c45f74b17c5a290c072a4ba7039dd19662cd5ce6" integrity sha512-TUswGe6hfguUX1CtKxyG2nymO+1lyThbkS1ifLX0Sr+dOQtAD5gkrffpHnx+yHNKUZ0Bmg5T4AjUQwugPDrm0g== +"d3-format@1 - 2": + version "2.0.0" + resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-2.0.0.tgz#a10bcc0f986c372b729ba447382413aabf5b0767" + integrity sha512-Ab3S6XuE/Q+flY96HXT0jOXcM4EAClYFnRGY5zsjRGNy6qCYrQsMffs7cV5Q9xejb35zxW5hf/guKw34kvIKsA== + d3-interpolate@1: version "1.3.2" resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-1.3.2.tgz#417d3ebdeb4bc4efcc8fd4361c55e4040211fd68" @@ -9529,6 +9546,13 @@ d3-interpolate@1: dependencies: d3-color "1" +"d3-interpolate@1.2.0 - 2": + version "2.0.1" + resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-2.0.1.tgz#98be499cfb8a3b94d4ff616900501a64abc91163" + integrity sha512-c5UhwwTs/yybcmTpAVqwSFl6vrQ8JZJoT5F7xNFK9pymv5C0Ymcc9/LIJHtYIggg/yS9YHw8i8O8tgb9pupjeQ== + dependencies: + d3-color "1 - 2" + d3-interpolate@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-1.4.0.tgz#526e79e2d80daa383f9e0c1c1c7dcc0f0583e987" @@ -9546,6 +9570,17 @@ d3-path@1: resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-2.0.0.tgz#55d86ac131a0548adae241eebfb56b4582dd09d8" integrity sha512-ZwZQxKhBnv9yHaiWd6ZU4x5BtCQ7pXszEV9CU6kRgwIQVQGLMv1oiL4M+MK/n79sYzsj+gcgpPQSctJUsLN7fA== +d3-scale@3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-3.3.0.tgz#28c600b29f47e5b9cd2df9749c206727966203f3" + integrity sha512-1JGp44NQCt5d1g+Yy+GeOnZP7xHo0ii8zsQp6PGzd+C1/dl0KGsp9A7Mxwp+1D1o4unbTTxVdU/ZOIEBoeZPbQ== + dependencies: + d3-array "^2.3.0" + d3-format "1 - 2" + d3-interpolate "1.2.0 - 2" + d3-time "^2.1.1" + d3-time-format "2 - 3" + d3-scale@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-1.0.7.tgz#fa90324b3ea8a776422bd0472afab0b252a0945d" @@ -9580,11 +9615,25 @@ d3-time-format@2: dependencies: d3-time "1" +"d3-time-format@2 - 3": + version "3.0.0" + resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-3.0.0.tgz#df8056c83659e01f20ac5da5fdeae7c08d5f1bb6" + integrity sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag== + dependencies: + d3-time "1 - 2" + d3-time@1: version "1.1.0" resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-1.1.0.tgz#b1e19d307dae9c900b7e5b25ffc5dcc249a8a0f1" integrity sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA== +"d3-time@1 - 2", d3-time@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-2.1.1.tgz#e9d8a8a88691f4548e68ca085e5ff956724a6682" + integrity sha512-/eIQe/eR4kCQwq7yxi7z4c6qEXf2IYGcjoWB5OOQy4Tq9Uv39/947qlDcN2TLkiTzQWzvnsuYPB9TrWaNfipKQ== + dependencies: + d3-array "2" + d@1, d@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" @@ -10768,7 +10817,8 @@ eslint-module-utils@^2.6.0: pkg-dir "^2.0.0" "eslint-plugin-elastic-charts@link:./packages/eslint-plugin-elastic-charts": - version "1.0.0" + version "0.0.0" + uid "" eslint-plugin-eslint-comments@^3.2.0: version "3.2.0" @@ -13329,6 +13379,11 @@ internal-slot@^1.0.2: has "^1.0.3" side-channel "^1.0.2" +internmap@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/internmap/-/internmap-1.0.1.tgz#0017cc8a3b99605f0302f2b198d272e015e5df95" + integrity sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw== + interpret@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" @@ -15254,13 +15309,8 @@ lines-and-columns@^1.1.6: integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= "link-kibana@link:./packages/link_kibana": - version "1.0.0" - dependencies: - chalk "^4.1.1" - change-case "^4.1.2" - glob "^7.1.7" - inquirer "^8.0.0" - ora "^5.4.0" + version "0.0.0" + uid "" lint-staged@^10.5.3: version "10.5.3"