diff --git a/api/charts.api.md b/api/charts.api.md index 23fd66fe05..79517048fd 100644 --- a/api/charts.api.md +++ b/api/charts.api.md @@ -107,7 +107,7 @@ export const AreaSeries: React_2.FunctionComponent; stackMode?: StackMode; @@ -266,7 +266,7 @@ export const BarSeries: React_2.FunctionComponent; stackMode?: StackMode; @@ -364,7 +364,7 @@ export const BubbleSeries: React_2.FunctionComponent; pointStyleAccessor?: PointStyleAccessor; }; @@ -1375,7 +1375,7 @@ export const LineSeries: React_2.FunctionComponent; pointStyleAccessor?: PointStyleAccessor; @@ -1948,7 +1948,7 @@ export interface SeriesSpec extends Spec { groupId: string; hideInLegend?: boolean; name?: SeriesNameAccessor; - seriesType: SeriesTypes; + seriesType: SeriesType; // @deprecated sortIndex?: number; // (undocumented) @@ -1965,10 +1965,10 @@ export interface SeriesSpec extends Spec { // @public (undocumented) export type SeriesSpecs = Array; -// Warning: (ae-missing-release-tag) "SeriesTypes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "SeriesType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const SeriesTypes: Readonly<{ +export const SeriesType: Readonly<{ Area: "area"; Bar: "bar"; Line: "line"; @@ -1976,7 +1976,7 @@ export const SeriesTypes: Readonly<{ }>; // @public -export type SeriesTypes = $Values; +export type SeriesType = $Values; // Warning: (ae-missing-release-tag) "Settings" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // diff --git a/docs/0-Intro/1-Overview.mdx b/docs/0-Intro/1-Overview.mdx index 6da9dda314..387bbcb7db 100644 --- a/docs/0-Intro/1-Overview.mdx +++ b/docs/0-Intro/1-Overview.mdx @@ -143,7 +143,7 @@ export interface SeriesSpec { /** An array of data */ data: Datum[]; /** The type of series you are looking to render */ - seriesType: SeriesTypes; + seriesType: SeriesType; /** Set colors for specific series */ customSeriesColors?: CustomSeriesColors; /** If the series should appear in the legend @@ -201,7 +201,7 @@ A `BarSeriesSpec` for example is the following intersection type: export type BarSeriesSpec = SeriesSpec & SeriesAccessors & SeriesScales & { - seriesType: SeriesTypes.Bar; + seriesType: SeriesType.Bar; }; ``` diff --git a/docs/2-ChartPropTables/13-AreaProps.md b/docs/2-ChartPropTables/13-AreaProps.md index dca325fe1d..ee1f748d32 100644 --- a/docs/2-ChartPropTables/13-AreaProps.md +++ b/docs/2-ChartPropTables/13-AreaProps.md @@ -12,7 +12,7 @@ Default props are set in the area_series.tsx file | data `(required)` | datum[] | | An array of data | | chartType | `typeof ChartType.XYAxis` | ChartType.XYAxis | | | specType | `typeof SpecType.Series` | SpecType.Series | | -| seriesType| `typeof SeriesTypes.Area` | SeriesTypes.Area | | +| seriesType| `typeof SeriesType.Area` | SeriesType.Area | | | groupId | string | DEFAULT_GLOBAL_ID | | | yScaleToDataExtent | boolean | false | | | hideInLegend | boolean | false | hide the series in the legend | diff --git a/docs/2-ChartPropTables/14-LineProps.md b/docs/2-ChartPropTables/14-LineProps.md index d7e8fb116d..2dd6febc72 100644 --- a/docs/2-ChartPropTables/14-LineProps.md +++ b/docs/2-ChartPropTables/14-LineProps.md @@ -5,7 +5,7 @@ | id `(required)`|`string` ||The id of the spec | | chartType | `typeof ChartType.XYAxis` | ChartType.XYAxis | | | specType | `typeof SpecType.Series` | SpecType.Series | | -| seriesTypes | | SeriesTypes.Line | | +| seriesTypes | | SeriesType.Line | | | groupId || DEFAULT_GROUP_ID |The ID of the line | | xScaleType `(required)`| `ScaleType (ScaleType.Ordinal or ScaleType.Linear or ScaleType.Time)`|ScaleType.Ordinal | The x axis scale type | | yScaleType `(required)`| `ScaleType (ScaleType.Ordinal or ScaleType.Linear or ScaleType.Time)`| ScaleType.Linear | The y axis scale type | diff --git a/src/chart_types/xy_chart/crosshair/crosshair_utils.linear_snap.test.ts b/src/chart_types/xy_chart/crosshair/crosshair_utils.linear_snap.test.ts index 2d923b2b37..ee62c8f72b 100644 --- a/src/chart_types/xy_chart/crosshair/crosshair_utils.linear_snap.test.ts +++ b/src/chart_types/xy_chart/crosshair/crosshair_utils.linear_snap.test.ts @@ -23,7 +23,7 @@ import { SpecType } from '../../../specs/constants'; import { Dimensions } from '../../../utils/dimensions'; import { computeSeriesDomains } from '../state/utils/utils'; import { computeXScale } from '../utils/scales'; -import { BasicSeriesSpec, SeriesTypes } from '../utils/specs'; +import { BasicSeriesSpec, SeriesType } from '../utils/specs'; import { getCursorBandPosition, getSnapPosition } from './crosshair_utils'; describe('Crosshair utils linear scale', () => { @@ -37,7 +37,7 @@ describe('Crosshair utils linear scale', () => { specType: SpecType.Series, id: barSeries1SpecId, groupId: 'group1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, data: [ [0, 0], [1, 0], @@ -53,7 +53,7 @@ describe('Crosshair utils linear scale', () => { specType: SpecType.Series, id: barSeries2SpecId, groupId: 'group1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, data: [ [0, 2], [1, 2], @@ -69,7 +69,7 @@ describe('Crosshair utils linear scale', () => { specType: SpecType.Series, id: lineSeries1SpecId, groupId: 'group1', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, data: [ [0, 0], [1, 0], @@ -85,7 +85,7 @@ describe('Crosshair utils linear scale', () => { specType: SpecType.Series, id: lineSeries2SpecId, groupId: 'group1', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, data: [ [0, 2], [1, 2], diff --git a/src/chart_types/xy_chart/crosshair/crosshair_utils.ordinal_snap.test.ts b/src/chart_types/xy_chart/crosshair/crosshair_utils.ordinal_snap.test.ts index f9b97f30d3..8e4ddd6412 100644 --- a/src/chart_types/xy_chart/crosshair/crosshair_utils.ordinal_snap.test.ts +++ b/src/chart_types/xy_chart/crosshair/crosshair_utils.ordinal_snap.test.ts @@ -22,7 +22,7 @@ import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { computeSeriesDomains } from '../state/utils/utils'; import { computeXScale } from '../utils/scales'; -import { BasicSeriesSpec, SeriesTypes } from '../utils/specs'; +import { BasicSeriesSpec, SeriesType } from '../utils/specs'; import { getSnapPosition } from './crosshair_utils'; describe('Crosshair utils ordinal scales', () => { @@ -36,7 +36,7 @@ describe('Crosshair utils ordinal scales', () => { specType: SpecType.Series, id: barSeries1SpecId, groupId: 'group1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, data: [ ['a', 0], ['b', 0], @@ -52,7 +52,7 @@ describe('Crosshair utils ordinal scales', () => { specType: SpecType.Series, id: barSeries2SpecId, groupId: 'group1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, data: [ ['a', 2], ['b', 2], @@ -68,7 +68,7 @@ describe('Crosshair utils ordinal scales', () => { specType: SpecType.Series, id: lineSeries1SpecId, groupId: 'group1', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, data: [ ['a', 0], ['b', 0], @@ -84,7 +84,7 @@ describe('Crosshair utils ordinal scales', () => { specType: SpecType.Series, id: lineSeries2SpecId, groupId: 'group1', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, data: [ ['a', 2], ['b', 2], diff --git a/src/chart_types/xy_chart/domains/x_domain.test.ts b/src/chart_types/xy_chart/domains/x_domain.test.ts index 74b3eb6b95..a0f8b01c08 100644 --- a/src/chart_types/xy_chart/domains/x_domain.test.ts +++ b/src/chart_types/xy_chart/domains/x_domain.test.ts @@ -23,7 +23,7 @@ import { ScaleType } from '../../../scales/constants'; import { SpecType, Direction, BinAgg } from '../../../specs/constants'; import { Logger } from '../../../utils/logger'; import { getDataSeriesFromSpecs } from '../utils/series'; -import { BasicSeriesSpec, SeriesTypes } from '../utils/specs'; +import { BasicSeriesSpec, SeriesType } from '../utils/specs'; import { convertXScaleTypes, findMinInterval, mergeXDomain } from './x_domain'; jest.mock('../../../utils/logger', () => ({ @@ -48,7 +48,7 @@ describe('X Domain', () => { test('Should return correct scale type with single bar', () => { const seriesSpecs: Pick[] = [ { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear, }, ]; @@ -62,7 +62,7 @@ describe('X Domain', () => { test('Should return correct scale type with single bar with Ordinal', () => { const seriesSpecs: Pick[] = [ { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Ordinal, }, ]; @@ -76,7 +76,7 @@ describe('X Domain', () => { test('Should return correct scale type with single area', () => { const seriesSpecs: Pick[] = [ { - seriesType: SeriesTypes.Area, + seriesType: SeriesType.Area, xScaleType: ScaleType.Linear, }, ]; @@ -89,7 +89,7 @@ describe('X Domain', () => { test('Should return correct scale type with single line (time)', () => { const seriesSpecs: Pick[] = [ { - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Time, timeZone: 'utc-3', }, @@ -104,12 +104,12 @@ describe('X Domain', () => { test('Should return correct scale type with multi line with same scale types (time) same tz', () => { const seriesSpecs: Pick[] = [ { - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Time, timeZone: 'UTC-3', }, { - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Time, timeZone: 'utc-3', }, @@ -124,12 +124,12 @@ describe('X Domain', () => { test('Should return correct scale type with multi line with same scale types (time) coerce to UTC', () => { const seriesSpecs: Pick[] = [ { - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Time, timeZone: 'utc-3', }, { - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Time, timeZone: 'utc+3', }, @@ -145,11 +145,11 @@ describe('X Domain', () => { test('Should return correct scale type with multi line with different scale types (linear, ordinal)', () => { const seriesSpecs: Pick[] = [ { - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Linear, }, { - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Ordinal, }, ]; @@ -162,11 +162,11 @@ describe('X Domain', () => { test('Should return correct scale type with multi bar, area with different scale types (linear, ordinal)', () => { const seriesSpecs: Pick[] = [ { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear, }, { - seriesType: SeriesTypes.Area, + seriesType: SeriesType.Area, xScaleType: ScaleType.Ordinal, }, ]; @@ -179,11 +179,11 @@ describe('X Domain', () => { test('Should return correct scale type with multi bar, area with same scale types (linear, linear)', () => { const seriesSpecs: Pick[] = [ { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear, }, { - seriesType: SeriesTypes.Area, + seriesType: SeriesType.Area, xScaleType: ScaleType.Time, timeZone: 'utc+3', }, @@ -201,7 +201,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds1', groupId: 'g1', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Linear, @@ -218,7 +218,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds2', groupId: 'g1', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Linear, @@ -233,7 +233,7 @@ describe('X Domain', () => { const mergedDomain = mergeXDomain( [ { - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Linear, }, ], @@ -247,7 +247,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds1', groupId: 'g1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Linear, @@ -264,7 +264,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds2', groupId: 'g1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Linear, @@ -280,7 +280,7 @@ describe('X Domain', () => { const mergedDomain = mergeXDomain( [ { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear, }, ], @@ -294,7 +294,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds1', groupId: 'g1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Linear, @@ -311,7 +311,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds2', groupId: 'g2', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Linear, @@ -327,11 +327,11 @@ describe('X Domain', () => { const mergedDomain = mergeXDomain( [ { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear, }, { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear, }, ], @@ -345,7 +345,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds1', groupId: 'g1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Linear, @@ -362,7 +362,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds2', groupId: 'g2', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Linear, @@ -378,11 +378,11 @@ describe('X Domain', () => { const mergedDomain = mergeXDomain( [ { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear, }, { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear, }, ], @@ -396,7 +396,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds1', groupId: 'g1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Linear, @@ -413,7 +413,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds2', groupId: 'g2', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Ordinal, @@ -429,11 +429,11 @@ describe('X Domain', () => { const mergedDomain = mergeXDomain( [ { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear, }, { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Ordinal, }, ], @@ -448,7 +448,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds1', groupId: 'g1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Linear, @@ -466,7 +466,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds2', groupId: 'g2', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Linear, @@ -487,11 +487,11 @@ describe('X Domain', () => { mergeXDomain( [ { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear, }, { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear, }, ], @@ -513,7 +513,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds1', groupId: 'g1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Linear, @@ -530,7 +530,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds2', groupId: 'g2', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Ordinal, @@ -546,11 +546,11 @@ describe('X Domain', () => { const mergedDomain = mergeXDomain( [ { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear, }, { - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Ordinal, }, ], @@ -564,7 +564,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds1', groupId: 'g1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Ordinal, @@ -581,7 +581,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds2', groupId: 'g2', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Time, @@ -597,11 +597,11 @@ describe('X Domain', () => { const mergedDomain = mergeXDomain( [ { - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Ordinal, }, { - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Time, }, ], @@ -615,7 +615,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds1', groupId: 'g1', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Ordinal, @@ -632,7 +632,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds2', groupId: 'g2', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Linear, @@ -648,11 +648,11 @@ describe('X Domain', () => { const mergedDomain = mergeXDomain( [ { - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Ordinal, }, { - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Linear, }, ], @@ -668,7 +668,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds1', groupId: 'g1', - seriesType: SeriesTypes.Area, + seriesType: SeriesType.Area, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Linear, @@ -680,7 +680,7 @@ describe('X Domain', () => { specType: SpecType.Series, id: 'ds2', groupId: 'g2', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xAccessor: 'x', yAccessors: ['y'], xScaleType: ScaleType.Ordinal, @@ -694,11 +694,11 @@ describe('X Domain', () => { const mergedDomain = mergeXDomain( [ { - seriesType: SeriesTypes.Area, + seriesType: SeriesType.Area, xScaleType: ScaleType.Linear, }, { - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Ordinal, }, ], @@ -738,7 +738,7 @@ describe('X Domain', () => { const xValues = new Set([1, 2, 3, 4, 5]); const xDomain = { min: 0, max: 3 }; const specs: Pick[] = [ - { seriesType: SeriesTypes.Line, xScaleType: ScaleType.Linear }, + { seriesType: SeriesType.Line, xScaleType: ScaleType.Linear }, ]; const basicMergedDomain = mergeXDomain(specs, xValues, xDomain); @@ -762,7 +762,7 @@ describe('X Domain', () => { const xValues = new Set([1, 2, 3, 4, 5]); const xDomain = { min: 0 }; const specs: Pick[] = [ - { seriesType: SeriesTypes.Line, xScaleType: ScaleType.Linear }, + { seriesType: SeriesType.Line, xScaleType: ScaleType.Linear }, ]; const mergedDomain = mergeXDomain(specs, xValues, xDomain); @@ -780,7 +780,7 @@ describe('X Domain', () => { const xValues = new Set([1, 2, 3, 4, 5]); const xDomain = { max: 3 }; const specs: Pick[] = [ - { seriesType: SeriesTypes.Line, xScaleType: ScaleType.Linear }, + { seriesType: SeriesType.Line, xScaleType: ScaleType.Linear }, ]; const mergedDomain = mergeXDomain(specs, xValues, xDomain); @@ -798,7 +798,7 @@ describe('X Domain', () => { const xValues = new Set(['a', 'b', 'c', 'd']); const xDomain = ['a', 'b', 'c']; const specs: Pick[] = [ - { seriesType: SeriesTypes.Bar, xScaleType: ScaleType.Ordinal }, + { seriesType: SeriesType.Bar, xScaleType: ScaleType.Ordinal }, ]; const basicMergedDomain = mergeXDomain(specs, xValues, xDomain); expect(basicMergedDomain.domain).toEqual(['a', 'b', 'c']); @@ -814,7 +814,7 @@ describe('X Domain', () => { describe('should account for custom minInterval', () => { const xValues = new Set([1, 2, 3, 4, 5]); const specs: Pick[] = [ - { seriesType: SeriesTypes.Bar, xScaleType: ScaleType.Linear }, + { seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear }, ]; test('with valid minInterval', () => { @@ -852,7 +852,7 @@ describe('X Domain', () => { const ordinalSpecs = MockSeriesSpecs.fromPartialSpecs([ { id: 'ordinal1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Ordinal, data: [ { x: 'a', y: 2 }, @@ -863,7 +863,7 @@ describe('X Domain', () => { }, { id: 'ordinal2', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Ordinal, data: [ { x: 'a', y: 4 }, @@ -877,7 +877,7 @@ describe('X Domain', () => { const linearSpecs = MockSeriesSpecs.fromPartialSpecs([ { id: 'linear1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear, data: [ { x: 1, y: 2 }, @@ -888,7 +888,7 @@ describe('X Domain', () => { }, { id: 'linear2', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, xScaleType: ScaleType.Linear, data: [ { x: 1, y: 4 }, diff --git a/src/chart_types/xy_chart/domains/x_domain.ts b/src/chart_types/xy_chart/domains/x_domain.ts index dd260b7355..da9dea7b89 100644 --- a/src/chart_types/xy_chart/domains/x_domain.ts +++ b/src/chart_types/xy_chart/domains/x_domain.ts @@ -24,7 +24,7 @@ import { compareByValueAsc, identity } from '../../../utils/common'; import { computeContinuousDataDomain, computeOrdinalDataDomain } from '../../../utils/domain'; import { Logger } from '../../../utils/logger'; import { isCompleteBound, isLowerBound, isUpperBound } from '../utils/axis_type_utils'; -import { BasicSeriesSpec, CustomXDomain, SeriesTypes, XScaleType } from '../utils/specs'; +import { BasicSeriesSpec, CustomXDomain, SeriesType, XScaleType } from '../utils/specs'; import { XDomain } from './types'; /** @@ -201,7 +201,7 @@ export function convertXScaleTypes( if (specs.length === 0 || seriesTypes.size === 0 || scaleTypes.size === 0) { return null; } - const isBandScale = seriesTypes.has(SeriesTypes.Bar); + const isBandScale = seriesTypes.has(SeriesType.Bar); if (scaleTypes.size === 1) { const scaleType = scaleTypes.values().next().value; let timeZone: string | undefined; diff --git a/src/chart_types/xy_chart/domains/y_domain.test.ts b/src/chart_types/xy_chart/domains/y_domain.test.ts index 57935f5989..81c90ecf0e 100644 --- a/src/chart_types/xy_chart/domains/y_domain.test.ts +++ b/src/chart_types/xy_chart/domains/y_domain.test.ts @@ -26,7 +26,7 @@ import { Position } from '../../../utils/common'; import { BARCHART_1Y0G } from '../../../utils/data_samples/test_dataset'; import { Logger } from '../../../utils/logger'; import { computeSeriesDomainsSelector } from '../state/selectors/compute_series_domains'; -import { BasicSeriesSpec, SeriesTypes, DEFAULT_GLOBAL_ID, StackMode } from '../utils/specs'; +import { BasicSeriesSpec, SeriesType, DEFAULT_GLOBAL_ID, StackMode } from '../utils/specs'; import { coerceYScaleTypes, groupSeriesByYGroup } from './y_domain'; jest.mock('../../../utils/logger', () => ({ @@ -231,7 +231,7 @@ describe('Y Domain', () => { specType: SpecType.Series, id: 'spec1', groupId: 'group1', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -243,7 +243,7 @@ describe('Y Domain', () => { specType: SpecType.Series, id: 'spec2', groupId: 'group2', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -266,7 +266,7 @@ describe('Y Domain', () => { specType: SpecType.Series, id: 'spec1', groupId: 'group1', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -279,7 +279,7 @@ describe('Y Domain', () => { specType: SpecType.Series, id: 'spec2', groupId: 'group2', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -303,7 +303,7 @@ describe('Y Domain', () => { specType: SpecType.Series, id: 'spec1', groupId: 'group', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -316,7 +316,7 @@ describe('Y Domain', () => { specType: SpecType.Series, id: 'spec2', groupId: 'group', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -338,7 +338,7 @@ describe('Y Domain', () => { specType: SpecType.Series, id: 'spec1', groupId: 'group1', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -351,7 +351,7 @@ describe('Y Domain', () => { specType: SpecType.Series, id: 'spec2', groupId: 'group1', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -364,7 +364,7 @@ describe('Y Domain', () => { specType: SpecType.Series, id: 'spec3', groupId: 'group2', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', diff --git a/src/chart_types/xy_chart/domains/y_domain.ts b/src/chart_types/xy_chart/domains/y_domain.ts index 4bb6199577..25f88cfde5 100644 --- a/src/chart_types/xy_chart/domains/y_domain.ts +++ b/src/chart_types/xy_chart/domains/y_domain.ts @@ -27,7 +27,7 @@ import { getSpecDomainGroupId } from '../state/utils/spec'; import { isCompleteBound, isLowerBound, isUpperBound } from '../utils/axis_type_utils'; import { groupBy } from '../utils/group_data_series'; import { DataSeries } from '../utils/series'; -import { BasicSeriesSpec, YDomainRange, SeriesTypes, StackMode } from '../utils/specs'; +import { BasicSeriesSpec, YDomainRange, SeriesType, StackMode } from '../utils/specs'; import { YDomain } from './types'; export type YBasicSeriesSpec = Pick< @@ -47,8 +47,7 @@ export function mergeYDomain(dataSeries: DataSeries[], domainsByGroupId: Map !isStacked && !isFiltered); const customDomain = domainsByGroupId.get(groupId); const hasNonZeroBaselineTypes = groupedDataSeries.some( - ({ seriesType, isFiltered }) => - seriesType === SeriesTypes.Bar || (seriesType === SeriesTypes.Area && !isFiltered), + ({ seriesType, isFiltered }) => seriesType === SeriesType.Bar || (seriesType === SeriesType.Area && !isFiltered), ); const domain = mergeYDomainForGroup(stacked, nonStacked, hasNonZeroBaselineTypes, customDomain); if (!domain) { @@ -187,7 +186,7 @@ export function groupSeriesByYGroup(specs: YBasicSeriesSpec[]) { * @internal */ export function isHistogramEnabled(specs: YBasicSeriesSpec[]) { - return specs.some(({ seriesType, enableHistogramMode }) => seriesType === SeriesTypes.Bar && enableHistogramMode); + return specs.some(({ seriesType, enableHistogramMode }) => seriesType === SeriesType.Bar && enableHistogramMode); } /** @@ -197,7 +196,7 @@ export function isHistogramEnabled(specs: YBasicSeriesSpec[]) { * @internal */ export function isStackedSpec(spec: YBasicSeriesSpec, histogramEnabled: boolean) { - const isBarAndHistogram = spec.seriesType === SeriesTypes.Bar && histogramEnabled; + const isBarAndHistogram = spec.seriesType === SeriesType.Bar && histogramEnabled; const hasStackAccessors = spec.stackAccessors && spec.stackAccessors.length > 0; return isBarAndHistogram || hasStackAccessors; } diff --git a/src/chart_types/xy_chart/legend/legend.test.ts b/src/chart_types/xy_chart/legend/legend.test.ts index 8778fb4331..8ba78ea4c4 100644 --- a/src/chart_types/xy_chart/legend/legend.test.ts +++ b/src/chart_types/xy_chart/legend/legend.test.ts @@ -31,7 +31,7 @@ import { AxisStyle } from '../../../utils/themes/theme'; import { computeLegendSelector } from '../state/selectors/compute_legend'; import { computeSeriesDomainsSelector } from '../state/selectors/compute_series_domains'; import { getSeriesName } from '../utils/series'; -import { AxisSpec, BasicSeriesSpec, SeriesTypes } from '../utils/specs'; +import { AxisSpec, BasicSeriesSpec, SeriesType } from '../utils/specs'; import { getLegendExtra } from './legend'; const nullDisplayValue = { @@ -46,7 +46,7 @@ const spec1: BasicSeriesSpec = { id: 'spec1', name: 'Spec 1 title', groupId: 'group', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -59,7 +59,7 @@ const spec2: BasicSeriesSpec = { specType: SpecType.Series, id: 'spec2', groupId: 'group', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', diff --git a/src/chart_types/xy_chart/rendering/rendering.areas.test.ts b/src/chart_types/xy_chart/rendering/rendering.areas.test.ts index 03ec78b29e..5ae4ce5096 100644 --- a/src/chart_types/xy_chart/rendering/rendering.areas.test.ts +++ b/src/chart_types/xy_chart/rendering/rendering.areas.test.ts @@ -920,7 +920,7 @@ describe('Rendering points - areas', () => { // specType: SpecType.Series, // id: SPEC_ID, // groupId: GROUP_ID, - // seriesType: SeriesTypes.Area, + // seriesType: SeriesType.Area, // data: [ // [0, 10], // [1, 5], diff --git a/src/chart_types/xy_chart/rendering/rendering.bars.test.ts b/src/chart_types/xy_chart/rendering/rendering.bars.test.ts index ed22548b8d..2486c4c6e9 100644 --- a/src/chart_types/xy_chart/rendering/rendering.bars.test.ts +++ b/src/chart_types/xy_chart/rendering/rendering.bars.test.ts @@ -217,7 +217,7 @@ describe('Rendering bars', () => { // specType: SpecType.Series, // id: spec1Id, // groupId: GROUP_ID, - // seriesType: SeriesTypes.Bar, + // seriesType: SeriesType.Bar, // data: [ // [0, 10], // [1, 5], @@ -232,7 +232,7 @@ describe('Rendering bars', () => { // specType: SpecType.Series, // id: spec2Id, // groupId: GROUP_ID, - // seriesType: SeriesTypes.Bar, + // seriesType: SeriesType.Bar, // data: [ // [0, 20], // [1, 10], @@ -373,7 +373,7 @@ describe('Rendering bars', () => { // specType: SpecType.Series, // id: SPEC_ID, // groupId: GROUP_ID, - // seriesType: SeriesTypes.Bar, + // seriesType: SeriesType.Bar, // data: [ // [0, 10], // [1, 5], @@ -445,7 +445,7 @@ describe('Rendering bars', () => { // specType: SpecType.Series, // id: SPEC_ID, // groupId: GROUP_ID, - // seriesType: SeriesTypes.Bar, + // seriesType: SeriesType.Bar, // data: [ // [1, 0], // [2, 1], @@ -491,7 +491,7 @@ describe('Rendering bars', () => { // specType: SpecType.Series, // id: spec1Id, // groupId: GROUP_ID, - // seriesType: SeriesTypes.Bar, + // seriesType: SeriesType.Bar, // data: [ // [0, 10], // [1, 5], @@ -506,7 +506,7 @@ describe('Rendering bars', () => { // specType: SpecType.Series, // id: spec2Id, // groupId: GROUP_ID, - // seriesType: SeriesTypes.Bar, + // seriesType: SeriesType.Bar, // data: [ // [0, 20], // [1, 10], @@ -627,7 +627,7 @@ describe('Rendering bars', () => { // specType: SpecType.Series, // id: spec1Id, // groupId: GROUP_ID, - // seriesType: SeriesTypes.Bar, + // seriesType: SeriesType.Bar, // data: [ // [1546300800000, 10], // [1546387200000, 5], @@ -642,7 +642,7 @@ describe('Rendering bars', () => { // specType: SpecType.Series, // id: spec2Id, // groupId: GROUP_ID, - // seriesType: SeriesTypes.Bar, + // seriesType: SeriesType.Bar, // data: [ // [1546300800000, 20], // [1546387200000, 10], @@ -766,7 +766,7 @@ describe('Rendering bars', () => { // specType: SpecType.Series, // id: SPEC_ID, // groupId: GROUP_ID, - // seriesType: SeriesTypes.Bar, + // seriesType: SeriesType.Bar, // data: [ // [0, 0], // [1, 1], @@ -834,7 +834,7 @@ describe('Rendering bars', () => { // specType: SpecType.Series, // id: SPEC_ID, // groupId: GROUP_ID, - // seriesType: SeriesTypes.Bar, + // seriesType: SeriesType.Bar, // data, // xAccessor: 0, // yAccessors: [1], diff --git a/src/chart_types/xy_chart/rendering/rendering.lines.test.ts b/src/chart_types/xy_chart/rendering/rendering.lines.test.ts index 674b74e37c..b0ffa7aa2e 100644 --- a/src/chart_types/xy_chart/rendering/rendering.lines.test.ts +++ b/src/chart_types/xy_chart/rendering/rendering.lines.test.ts @@ -26,7 +26,7 @@ import { Position } from '../../../utils/common'; import { PointGeometry } from '../../../utils/geometry'; import { LIGHT_THEME } from '../../../utils/themes/light_theme'; import { computeSeriesGeometriesSelector } from '../state/selectors/compute_series_geometries'; -import { SeriesTypes } from '../utils/specs'; +import { SeriesType } from '../utils/specs'; const SPEC_ID = 'spec_1'; const GROUP_ID = 'group_1'; @@ -115,7 +115,7 @@ describe('Rendering points - line', () => { const pointSeriesSpec1 = MockSeriesSpec.line({ id: spec1Id, groupId: GROUP_ID, - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, data: [ [0, 10], [1, 5], diff --git a/src/chart_types/xy_chart/specs/area_series.tsx b/src/chart_types/xy_chart/specs/area_series.tsx index 3228bd1a6d..d7a6b19fb4 100644 --- a/src/chart_types/xy_chart/specs/area_series.tsx +++ b/src/chart_types/xy_chart/specs/area_series.tsx @@ -23,12 +23,12 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { specComponentFactory, getConnect } from '../../../state/spec_factory'; -import { AreaSeriesSpec, HistogramModeAlignments, DEFAULT_GLOBAL_ID, SeriesTypes } from '../utils/specs'; +import { AreaSeriesSpec, HistogramModeAlignments, DEFAULT_GLOBAL_ID, SeriesType } from '../utils/specs'; const defaultProps = { chartType: ChartType.XYAxis, specType: SpecType.Series, - seriesType: SeriesTypes.Area, + seriesType: SeriesType.Area, groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Linear, yScaleType: ScaleType.Linear, diff --git a/src/chart_types/xy_chart/specs/bar_series.tsx b/src/chart_types/xy_chart/specs/bar_series.tsx index 9770a98de9..94045d0503 100644 --- a/src/chart_types/xy_chart/specs/bar_series.tsx +++ b/src/chart_types/xy_chart/specs/bar_series.tsx @@ -23,12 +23,12 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { specComponentFactory, getConnect } from '../../../state/spec_factory'; -import { BarSeriesSpec, DEFAULT_GLOBAL_ID, SeriesTypes } from '../utils/specs'; +import { BarSeriesSpec, DEFAULT_GLOBAL_ID, SeriesType } from '../utils/specs'; const defaultProps = { chartType: ChartType.XYAxis, specType: SpecType.Series, - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Ordinal, yScaleType: ScaleType.Linear, diff --git a/src/chart_types/xy_chart/specs/bubble_series.tsx b/src/chart_types/xy_chart/specs/bubble_series.tsx index 75646c8c71..99f2347000 100644 --- a/src/chart_types/xy_chart/specs/bubble_series.tsx +++ b/src/chart_types/xy_chart/specs/bubble_series.tsx @@ -23,12 +23,12 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { specComponentFactory, getConnect } from '../../../state/spec_factory'; -import { BubbleSeriesSpec, DEFAULT_GLOBAL_ID, SeriesTypes } from '../utils/specs'; +import { BubbleSeriesSpec, DEFAULT_GLOBAL_ID, SeriesType } from '../utils/specs'; const defaultProps = { chartType: ChartType.XYAxis, specType: SpecType.Series, - seriesType: SeriesTypes.Bubble, + seriesType: SeriesType.Bubble, groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Ordinal, yScaleType: ScaleType.Linear, diff --git a/src/chart_types/xy_chart/specs/histogram_bar_series.tsx b/src/chart_types/xy_chart/specs/histogram_bar_series.tsx index 07fb407556..cc13068623 100644 --- a/src/chart_types/xy_chart/specs/histogram_bar_series.tsx +++ b/src/chart_types/xy_chart/specs/histogram_bar_series.tsx @@ -23,12 +23,12 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { specComponentFactory, getConnect } from '../../../state/spec_factory'; -import { HistogramBarSeriesSpec, DEFAULT_GLOBAL_ID, SeriesTypes } from '../utils/specs'; +import { HistogramBarSeriesSpec, DEFAULT_GLOBAL_ID, SeriesType } from '../utils/specs'; const defaultProps = { chartType: ChartType.XYAxis, specType: SpecType.Series, - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Linear, yScaleType: ScaleType.Linear, diff --git a/src/chart_types/xy_chart/specs/line_series.tsx b/src/chart_types/xy_chart/specs/line_series.tsx index da8c382e9c..4d1a3d4a11 100644 --- a/src/chart_types/xy_chart/specs/line_series.tsx +++ b/src/chart_types/xy_chart/specs/line_series.tsx @@ -23,12 +23,12 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { specComponentFactory, getConnect } from '../../../state/spec_factory'; -import { LineSeriesSpec, DEFAULT_GLOBAL_ID, HistogramModeAlignments, SeriesTypes } from '../utils/specs'; +import { LineSeriesSpec, DEFAULT_GLOBAL_ID, HistogramModeAlignments, SeriesType } from '../utils/specs'; const defaultProps = { chartType: ChartType.XYAxis, specType: SpecType.Series, - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Ordinal, yScaleType: ScaleType.Linear, diff --git a/src/chart_types/xy_chart/state/chart_state.interactions.test.ts b/src/chart_types/xy_chart/state/chart_state.interactions.test.ts index d6c7c9f24b..41a5dfa023 100644 --- a/src/chart_types/xy_chart/state/chart_state.interactions.test.ts +++ b/src/chart_types/xy_chart/state/chart_state.interactions.test.ts @@ -33,7 +33,7 @@ import { GlobalChartState } from '../../../state/chart_state'; import { getSettingsSpecSelector } from '../../../state/selectors/get_settings_specs'; import { Position, RecursivePartial } from '../../../utils/common'; import { AxisStyle } from '../../../utils/themes/theme'; -import { BarSeriesSpec, BasicSeriesSpec, AxisSpec, SeriesTypes } from '../utils/specs'; +import { BarSeriesSpec, BasicSeriesSpec, AxisSpec, SeriesType } from '../utils/specs'; import { computeSeriesGeometriesSelector } from './selectors/compute_series_geometries'; import { getCursorBandPositionSelector } from './selectors/get_cursor_band'; import { getProjectedPointerPositionSelector } from './selectors/get_projected_pointer_position'; @@ -55,7 +55,7 @@ const ordinalBarSeries: BarSeriesSpec = { specType: SpecType.Series, id: SPEC_ID, groupId: GROUP_ID, - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, data: [ [0, 10], [1, 5], @@ -71,7 +71,7 @@ const linearBarSeries: BarSeriesSpec = { specType: SpecType.Series, id: SPEC_ID, groupId: GROUP_ID, - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, data: [ [0, 10], [1, 5], diff --git a/src/chart_types/xy_chart/state/chart_state.timescales.test.ts b/src/chart_types/xy_chart/state/chart_state.timescales.test.ts index cfddeea5e3..a3681a1761 100644 --- a/src/chart_types/xy_chart/state/chart_state.timescales.test.ts +++ b/src/chart_types/xy_chart/state/chart_state.timescales.test.ts @@ -30,7 +30,7 @@ import { upsertSpec, specParsed } from '../../../state/actions/specs'; import { chartStoreReducer, GlobalChartState } from '../../../state/chart_state'; import { LIGHT_THEME } from '../../../utils/themes/light_theme'; import { mergeWithDefaultTheme } from '../../../utils/themes/merge_utils'; -import { LineSeriesSpec, SeriesTypes } from '../utils/specs'; +import { LineSeriesSpec, SeriesType } from '../utils/specs'; import { computeSeriesGeometriesSelector } from './selectors/compute_series_geometries'; import { getComputedScalesSelector } from './selectors/get_computed_scales'; import { getTooltipInfoSelector } from './selectors/get_tooltip_values_highlighted_geoms'; @@ -50,7 +50,7 @@ describe('Render chart', () => { specType: SpecType.Series, id: 'lines', groupId: 'line', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Time, yScaleType: ScaleType.Linear, xAccessor: 0, @@ -125,7 +125,7 @@ describe('Render chart', () => { specType: SpecType.Series, id: 'lines', groupId: 'line', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Time, yScaleType: ScaleType.Linear, xAccessor: 0, @@ -198,7 +198,7 @@ describe('Render chart', () => { specType: SpecType.Series, id: 'lines', groupId: 'line', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, xScaleType: ScaleType.Time, yScaleType: ScaleType.Linear, xAccessor: 0, diff --git a/src/chart_types/xy_chart/state/selectors/count_bars_in_cluster.ts b/src/chart_types/xy_chart/state/selectors/count_bars_in_cluster.ts index fd8cfc809a..bd01192d6b 100644 --- a/src/chart_types/xy_chart/state/selectors/count_bars_in_cluster.ts +++ b/src/chart_types/xy_chart/state/selectors/count_bars_in_cluster.ts @@ -19,7 +19,7 @@ import createCachedSelector from 're-reselect'; -import { SeriesTypes } from '../../../../specs'; +import { SeriesType } from '../../../../specs'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; import { groupBy } from '../../utils/group_data_series'; import { SeriesDomainsAndData } from '../utils/types'; @@ -35,7 +35,7 @@ export const countBarsInClusterSelector = createCachedSelector( /** @internal */ export function countBarsInCluster({ formattedDataSeries }: SeriesDomainsAndData, isHistogramEnabled: boolean): number { - const barDataSeries = formattedDataSeries.filter(({ seriesType }) => seriesType === SeriesTypes.Bar); + const barDataSeries = formattedDataSeries.filter(({ seriesType }) => seriesType === SeriesType.Bar); const dataSeriesGroupedByPanel = groupBy( barDataSeries, diff --git a/src/chart_types/xy_chart/state/utils/common.test.ts b/src/chart_types/xy_chart/state/utils/common.test.ts index 09f61ffb6a..0ea8470d81 100644 --- a/src/chart_types/xy_chart/state/utils/common.test.ts +++ b/src/chart_types/xy_chart/state/utils/common.test.ts @@ -23,7 +23,7 @@ import { ScaleType } from '../../../../scales/constants'; import { SpecType } from '../../../../specs'; import { BARCHART_1Y1G } from '../../../../utils/data_samples/test_dataset'; import { Point } from '../../../../utils/point'; -import { AreaSeriesSpec, SeriesTypes, LineSeriesSpec, BarSeriesSpec } from '../../utils/specs'; +import { AreaSeriesSpec, SeriesType, LineSeriesSpec, BarSeriesSpec } from '../../utils/specs'; import { isHorizontalRotation, isVerticalRotation, @@ -58,7 +58,7 @@ describe('Type Checks', () => { specType: SpecType.Series, id: 'area', groupId: 'group1', - seriesType: SeriesTypes.Area, + seriesType: SeriesType.Area, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -71,7 +71,7 @@ describe('Type Checks', () => { specType: SpecType.Series, id: 'line', groupId: 'group2', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -85,7 +85,7 @@ describe('Type Checks', () => { specType: SpecType.Series, id: 'bar', groupId: 'group2', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', diff --git a/src/chart_types/xy_chart/state/utils/common.ts b/src/chart_types/xy_chart/state/utils/common.ts index 63a762b420..1b480f125d 100644 --- a/src/chart_types/xy_chart/state/utils/common.ts +++ b/src/chart_types/xy_chart/state/utils/common.ts @@ -20,7 +20,7 @@ import { LegendItem } from '../../../../common/legend'; import { getDistance, Rotation } from '../../../../utils/common'; import { Point } from '../../../../utils/point'; -import { BasicSeriesSpec, SeriesTypes } from '../../utils/specs'; +import { BasicSeriesSpec, SeriesType } from '../../utils/specs'; import { GeometriesCounts } from './types'; export const MAX_ANIMATABLE_BARS = 300; @@ -41,7 +41,7 @@ export function isVerticalRotation(chartRotation: Rotation) { * @internal */ export function isLineAreaOnlyChart(specs: BasicSeriesSpec[]) { - return !specs.some((spec) => spec.seriesType === SeriesTypes.Bar); + return !specs.some((spec) => spec.seriesType === SeriesType.Bar); } /** @internal */ diff --git a/src/chart_types/xy_chart/utils/series.test.ts b/src/chart_types/xy_chart/utils/series.test.ts index 4a0c0d383b..3b3a05f040 100644 --- a/src/chart_types/xy_chart/utils/series.test.ts +++ b/src/chart_types/xy_chart/utils/series.test.ts @@ -43,7 +43,7 @@ import { DataSeries, splitSeriesDataByAccessors, } from './series'; -import { BasicSeriesSpec, LineSeriesSpec, SeriesTypes, AreaSeriesSpec } from './specs'; +import { BasicSeriesSpec, LineSeriesSpec, SeriesType, AreaSeriesSpec } from './specs'; import { formatStackedDataSeriesValues } from './stacked_series_utils'; const dg = new SeededDataGenerator(); @@ -445,7 +445,7 @@ describe('Series', () => { chartType: ChartType.XYAxis, id: 'spec1', groupId: 'group', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -458,7 +458,7 @@ describe('Series', () => { chartType: ChartType.XYAxis, id: 'spec2', groupId: 'group2', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -478,7 +478,7 @@ describe('Series', () => { chartType: ChartType.XYAxis, id: 'spec1', groupId: 'group', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -491,7 +491,7 @@ describe('Series', () => { chartType: ChartType.XYAxis, id: 'spec2', groupId: 'group2', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', @@ -580,7 +580,7 @@ describe('Series', () => { chartType: ChartType.XYAxis, id, groupId: 'group', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, yScaleType: ScaleType.Log, xScaleType: ScaleType.Linear, xAccessor: 'x', diff --git a/src/chart_types/xy_chart/utils/series.ts b/src/chart_types/xy_chart/utils/series.ts index 5bb674e656..9d19cfbee8 100644 --- a/src/chart_types/xy_chart/utils/series.ts +++ b/src/chart_types/xy_chart/utils/series.ts @@ -31,7 +31,7 @@ import { groupSeriesByYGroup, isHistogramEnabled, isStackedSpec } from '../domai import { SmallMultiplesGroupBy } from '../state/selectors/get_specs'; import { applyFitFunctionToDataSeries } from './fit_function_utils'; import { groupBy } from './group_data_series'; -import { BasicSeriesSpec, SeriesNameConfigOptions, SeriesSpecs, SeriesTypes, StackMode } from './specs'; +import { BasicSeriesSpec, SeriesNameConfigOptions, SeriesSpecs, SeriesType, StackMode } from './specs'; import { datumXSortPredicate, formatStackedDataSeriesValues } from './stacked_series_utils'; /** @internal */ @@ -78,7 +78,7 @@ export interface XYChartSeriesIdentifier extends SeriesIdentifier { /** @internal */ export type DataSeries = XYChartSeriesIdentifier & { groupId: GroupId; - seriesType: SeriesTypes; + seriesType: SeriesType; data: DataSeriesDatum[]; isStacked: boolean; stackMode: StackMode | undefined; @@ -88,7 +88,7 @@ export type DataSeries = XYChartSeriesIdentifier & { }; /** @internal */ -export type DataSeriesCounts = { [key in SeriesTypes]: number }; +export type DataSeriesCounts = { [key in SeriesType]: number }; /** @internal */ export function getSeriesIndex(series: SeriesIdentifier[], target: SeriesIdentifier): number { diff --git a/src/chart_types/xy_chart/utils/specs.ts b/src/chart_types/xy_chart/utils/specs.ts index 32058b6904..26a5ba2087 100644 --- a/src/chart_types/xy_chart/utils/specs.ts +++ b/src/chart_types/xy_chart/utils/specs.ts @@ -51,7 +51,7 @@ export type BarStyleOverride = RecursivePartial | Color | null; /** @public */ export type PointStyleOverride = RecursivePartial | Color | null; -export const SeriesTypes = Object.freeze({ +export const SeriesType = Object.freeze({ Area: 'area' as const, Bar: 'bar' as const, Line: 'line' as const, @@ -62,7 +62,7 @@ export const SeriesTypes = Object.freeze({ * XY series type * @public */ -export type SeriesTypes = $Values; +export type SeriesType = $Values; /** * The offset and mode applied when stacking values @@ -366,7 +366,7 @@ export interface SeriesSpec extends Spec { /** An array of data */ data: Datum[]; /** The type of series you are looking to render */ - seriesType: SeriesTypes; + seriesType: SeriesType; /** Set colors for specific series */ color?: SeriesColorAccessor; /** @@ -494,8 +494,8 @@ export type SeriesSpecs = Array; */ export type BarSeriesSpec = BasicSeriesSpec & Postfixes & { - /** @defaultValue `bar` {@link (SeriesTypes:type) | SeriesTypes.Bar} */ - seriesType: typeof SeriesTypes.Bar; + /** @defaultValue `bar` {@link (SeriesType:type) | SeriesType.Bar} */ + seriesType: typeof SeriesType.Bar; /** If true, will stack all BarSeries and align bars to ticks (instead of centered on ticks) */ enableHistogramMode?: boolean; barSeriesStyle?: RecursivePartial; @@ -554,8 +554,8 @@ export type FitConfig = { */ export type LineSeriesSpec = BasicSeriesSpec & HistogramConfig & { - /** @defaultValue `line` {@link (SeriesTypes:type) | SeriesTypes.Line} */ - seriesType: typeof SeriesTypes.Line; + /** @defaultValue `line` {@link (SeriesType:type) | SeriesType.Line} */ + seriesType: typeof SeriesType.Line; curve?: CurveType; lineSeriesStyle?: RecursivePartial; /** @@ -574,8 +574,8 @@ export type LineSeriesSpec = BasicSeriesSpec & * @alpha */ export type BubbleSeriesSpec = BasicSeriesSpec & { - /** @defaultValue `bubble` {@link (SeriesTypes:type) | SeriesTypes.Bubble} */ - seriesType: typeof SeriesTypes.Bubble; + /** @defaultValue `bubble` {@link (SeriesType:type) | SeriesType.Bubble} */ + seriesType: typeof SeriesType.Bubble; bubbleSeriesStyle?: RecursivePartial; /** * An optional functional accessor to return custom color or style for point datum @@ -590,8 +590,8 @@ export type BubbleSeriesSpec = BasicSeriesSpec & { export type AreaSeriesSpec = BasicSeriesSpec & HistogramConfig & Postfixes & { - /** @defaultValue `area` {@link (SeriesTypes:type) | SeriesTypes.Area} */ - seriesType: typeof SeriesTypes.Area; + /** @defaultValue `area` {@link (SeriesType:type) | SeriesType.Area} */ + seriesType: typeof SeriesType.Area; /** The type of interpolator to be used to interpolate values between points */ curve?: CurveType; areaSeriesStyle?: RecursivePartial; @@ -894,22 +894,22 @@ export function isRectAnnotation(spec: AnnotationSpec): spec is RectAnnotationSp /** @internal */ export function isBarSeriesSpec(spec: BasicSeriesSpec): spec is BarSeriesSpec { - return spec.seriesType === SeriesTypes.Bar; + return spec.seriesType === SeriesType.Bar; } /** @internal */ export function isBubbleSeriesSpec(spec: BasicSeriesSpec): spec is BubbleSeriesSpec { - return spec.seriesType === SeriesTypes.Bubble; + return spec.seriesType === SeriesType.Bubble; } /** @internal */ export function isLineSeriesSpec(spec: BasicSeriesSpec): spec is LineSeriesSpec { - return spec.seriesType === SeriesTypes.Line; + return spec.seriesType === SeriesType.Line; } /** @internal */ export function isAreaSeriesSpec(spec: BasicSeriesSpec): spec is AreaSeriesSpec { - return spec.seriesType === SeriesTypes.Area; + return spec.seriesType === SeriesType.Area; } /** @internal */ diff --git a/src/mocks/series/series.ts b/src/mocks/series/series.ts index e56a24afd9..fb56fbeac7 100644 --- a/src/mocks/series/series.ts +++ b/src/mocks/series/series.ts @@ -21,7 +21,7 @@ import { shuffle } from 'lodash'; import { FullDataSeriesDatum, WithIndex } from '../../chart_types/xy_chart/utils/fit_function'; import { DataSeries, DataSeriesDatum, XYChartSeriesIdentifier } from '../../chart_types/xy_chart/utils/series'; -import { SeriesTypes } from '../../specs'; +import { SeriesType } from '../../specs'; import { mergePartial } from '../../utils/common'; import { MockSeriesSpec } from '../specs'; import { getRandomNumberGenerator } from '../utils'; @@ -46,7 +46,7 @@ export class MockDataSeries { key: 'spec1', data: [], groupId: 'group1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, stackMode: undefined, spec: MockSeriesSpec.bar(), isStacked: false, diff --git a/src/mocks/specs/specs.ts b/src/mocks/specs/specs.ts index 9b819f9705..72174498fc 100644 --- a/src/mocks/specs/specs.ts +++ b/src/mocks/specs/specs.ts @@ -32,7 +32,7 @@ import { HistogramBarSeriesSpec, LineSeriesSpec, BasicSeriesSpec, - SeriesTypes, + SeriesType, BubbleSeriesSpec, LineAnnotationSpec, RectAnnotationSpec, @@ -52,7 +52,7 @@ export class MockSeriesSpec { chartType: ChartType.XYAxis, specType: SpecType.Series, id: 'spec1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Ordinal, yScaleType: ScaleType.Linear, @@ -67,7 +67,7 @@ export class MockSeriesSpec { chartType: ChartType.XYAxis, specType: SpecType.Series, id: 'spec1', - seriesType: SeriesTypes.Bar, + seriesType: SeriesType.Bar, groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Ordinal, yScaleType: ScaleType.Linear, @@ -82,7 +82,7 @@ export class MockSeriesSpec { chartType: ChartType.XYAxis, specType: SpecType.Series, id: 'spec1', - seriesType: SeriesTypes.Area, + seriesType: SeriesType.Area, groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Ordinal, yScaleType: ScaleType.Linear, @@ -97,7 +97,7 @@ export class MockSeriesSpec { chartType: ChartType.XYAxis, specType: SpecType.Series, id: 'spec1', - seriesType: SeriesTypes.Line, + seriesType: SeriesType.Line, groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Ordinal, yScaleType: ScaleType.Linear, @@ -112,7 +112,7 @@ export class MockSeriesSpec { chartType: ChartType.XYAxis, specType: SpecType.Series, id: 'spec1', - seriesType: SeriesTypes.Bubble, + seriesType: SeriesType.Bubble, groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Ordinal, yScaleType: ScaleType.Linear, @@ -218,17 +218,17 @@ export class MockSeriesSpec { }); } - static byType(type?: SeriesTypes | 'histogram'): BasicSeriesSpec { + static byType(type?: SeriesType | 'histogram'): BasicSeriesSpec { switch (type) { - case SeriesTypes.Line: + case SeriesType.Line: return MockSeriesSpec.lineBase; - case SeriesTypes.Area: + case SeriesType.Area: return MockSeriesSpec.areaBase; - case SeriesTypes.Bubble: + case SeriesType.Bubble: return MockSeriesSpec.bubbleBase; case 'histogram': return MockSeriesSpec.histogramBarBase; - case SeriesTypes.Bar: + case SeriesType.Bar: default: return MockSeriesSpec.barBase; } diff --git a/stories/mixed/6_fitting.tsx b/stories/mixed/6_fitting.tsx index 2cefac6709..6a8ab91320 100644 --- a/stories/mixed/6_fitting.tsx +++ b/stories/mixed/6_fitting.tsx @@ -30,7 +30,7 @@ import { ScaleType, Settings, Fit, - SeriesTypes, + SeriesType, } from '../../src'; import { SB_KNOBS_PANEL } from '../utils/storybook'; @@ -103,10 +103,10 @@ export const Example = () => { const seriesType = select( 'seriesType', { - Area: SeriesTypes.Area, - Line: SeriesTypes.Line, + Area: SeriesType.Area, + Line: SeriesType.Line, }, - SeriesTypes.Area, + SeriesType.Area, ); const dataKey = select( 'dataset', @@ -179,7 +179,7 @@ export const Example = () => { /> - {seriesType === SeriesTypes.Area ? ( + {seriesType === SeriesType.Area ? (