From 1734a15b6971a322f8cebd3e43fb78733a724768 Mon Sep 17 00:00:00 2001 From: Evgeny Alaev Date: Thu, 28 Dec 2023 18:16:18 +0300 Subject: [PATCH] refactor(D3 plugin): rename WidgetType -> SeriesType --- src/constants/widget-data.ts | 2 +- src/plugins/d3/renderer/validation/index.ts | 4 ++-- src/types/widget-data/area.ts | 4 ++-- src/types/widget-data/bar-x.ts | 4 ++-- src/types/widget-data/bar-y.ts | 4 ++-- src/types/widget-data/line.ts | 4 ++-- src/types/widget-data/pie.ts | 4 ++-- src/types/widget-data/scatter.ts | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/constants/widget-data.ts b/src/constants/widget-data.ts index 6529548c..131c6804 100644 --- a/src/constants/widget-data.ts +++ b/src/constants/widget-data.ts @@ -1,4 +1,4 @@ -export const WidgetType = { +export const SeriesType = { Area: 'area', BarX: 'bar-x', BarY: 'bar-y', diff --git a/src/plugins/d3/renderer/validation/index.ts b/src/plugins/d3/renderer/validation/index.ts index 54cf9593..ac152834 100644 --- a/src/plugins/d3/renderer/validation/index.ts +++ b/src/plugins/d3/renderer/validation/index.ts @@ -1,7 +1,7 @@ import get from 'lodash/get'; import isEmpty from 'lodash/isEmpty'; -import {WidgetType} from '../../../../constants'; +import {SeriesType} from '../../../../constants'; import {ChartKitError, CHARTKIT_ERROR_CODE} from '../../../../libs'; import { BarXSeries, @@ -19,7 +19,7 @@ import {DEFAULT_AXIS_TYPE} from '../constants'; type XYSeries = ScatterSeries | BarXSeries | BarYSeries | LineSeries; -const AVAILABLE_SERIES_TYPES = Object.values(WidgetType); +const AVAILABLE_SERIES_TYPES = Object.values(SeriesType); const validateXYSeries = (args: { series: XYSeries; diff --git a/src/types/widget-data/area.ts b/src/types/widget-data/area.ts index 11de0312..f9ae413c 100644 --- a/src/types/widget-data/area.ts +++ b/src/types/widget-data/area.ts @@ -1,4 +1,4 @@ -import {WidgetType} from '../../constants'; +import {SeriesType} from '../../constants'; import type {BaseSeries, BaseSeriesData} from './base'; import type {ChartKitWidgetLegend, RectLegendSymbolOptions} from './legend'; import type {PointMarkerOptions} from './marker'; @@ -29,7 +29,7 @@ export type AreaMarkerOptions = PointMarkerOptions & { }; export type AreaSeries = BaseSeries & { - type: typeof WidgetType.Area; + type: typeof SeriesType.Area; data: AreaSeriesData[]; /** The name of the series (used in legend, tooltip etc) */ name: string; diff --git a/src/types/widget-data/bar-x.ts b/src/types/widget-data/bar-x.ts index 7e1d76f6..ca5aa657 100644 --- a/src/types/widget-data/bar-x.ts +++ b/src/types/widget-data/bar-x.ts @@ -1,4 +1,4 @@ -import {WidgetType} from '../../constants'; +import {SeriesType} from '../../constants'; import type {BaseSeries, BaseSeriesData} from './base'; import type {ChartKitWidgetSeriesOptions} from './series'; import {ChartKitWidgetLegend, RectLegendSymbolOptions} from './legend'; @@ -29,7 +29,7 @@ export type BarXSeriesData = BaseSeriesData & { }; export type BarXSeries = BaseSeries & { - type: typeof WidgetType.BarX; + type: typeof SeriesType.BarX; data: BarXSeriesData[]; /** The name of the series (used in legend, tooltip etc) */ name: string; diff --git a/src/types/widget-data/bar-y.ts b/src/types/widget-data/bar-y.ts index 529c9655..3815c5b1 100644 --- a/src/types/widget-data/bar-y.ts +++ b/src/types/widget-data/bar-y.ts @@ -1,4 +1,4 @@ -import {WidgetType} from '../../constants'; +import {SeriesType} from '../../constants'; import type {BaseSeries, BaseSeriesData} from './base'; import type {ChartKitWidgetSeriesOptions} from './series'; import {ChartKitWidgetLegend, RectLegendSymbolOptions} from './legend'; @@ -23,7 +23,7 @@ export type BarYSeriesData = BaseSeriesData & { }; export type BarYSeries = BaseSeries & { - type: typeof WidgetType.BarY; + type: typeof SeriesType.BarY; data: BarYSeriesData[]; /** The name of the series (used in legend, tooltip etc) */ name: string; diff --git a/src/types/widget-data/line.ts b/src/types/widget-data/line.ts index 30138a79..33d521b4 100644 --- a/src/types/widget-data/line.ts +++ b/src/types/widget-data/line.ts @@ -1,7 +1,7 @@ import type {BaseSeries, BaseSeriesData} from './base'; import type {ChartKitWidgetLegend, RectLegendSymbolOptions} from './legend'; import type {PointMarkerOptions} from './marker'; -import {DashStyle, LineCap, WidgetType} from '../../constants'; +import {DashStyle, LineCap, SeriesType} from '../../constants'; export type LineSeriesData = BaseSeriesData & { /** @@ -29,7 +29,7 @@ export type LineMarkerOptions = PointMarkerOptions & { }; export type LineSeries = BaseSeries & { - type: typeof WidgetType.Line; + type: typeof SeriesType.Line; data: LineSeriesData[]; /** The name of the series (used in legend, tooltip etc) */ name: string; diff --git a/src/types/widget-data/pie.ts b/src/types/widget-data/pie.ts index f065d9be..3b09d5d9 100644 --- a/src/types/widget-data/pie.ts +++ b/src/types/widget-data/pie.ts @@ -1,4 +1,4 @@ -import {WidgetType} from '../../constants'; +import {SeriesType} from '../../constants'; import type {BaseSeries, BaseSeriesData} from './base'; import {ChartKitWidgetLegend, RectLegendSymbolOptions} from './legend'; @@ -17,7 +17,7 @@ export type ConnectorShape = 'straight-line' | 'polyline'; export type ConnectorCurve = 'linear' | 'basic'; export type PieSeries = BaseSeries & { - type: typeof WidgetType.Pie; + type: typeof SeriesType.Pie; data: PieSeriesData[]; /** * The color of the border surrounding each segment. diff --git a/src/types/widget-data/scatter.ts b/src/types/widget-data/scatter.ts index 79a4f941..c543a123 100644 --- a/src/types/widget-data/scatter.ts +++ b/src/types/widget-data/scatter.ts @@ -1,4 +1,4 @@ -import {WidgetType} from '../../constants'; +import {SeriesType} from '../../constants'; import type {BaseSeries, BaseSeriesData} from './base'; import type {ChartKitWidgetLegend, RectLegendSymbolOptions} from './legend'; @@ -27,7 +27,7 @@ export type ScatterSeriesData = BaseSeriesData & { }; export type ScatterSeries = BaseSeries & { - type: typeof WidgetType.Scatter; + type: typeof SeriesType.Scatter; data: ScatterSeriesData[]; /** The name of the series (used in legend, tooltip etc) */ name: string;