Skip to content

Commit

Permalink
refactor(D3 plugin): rename WidgetType -> SeriesType
Browse files Browse the repository at this point in the history
  • Loading branch information
korvin89 committed Dec 28, 2023
1 parent 54633c1 commit 1734a15
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/constants/widget-data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const WidgetType = {
export const SeriesType = {
Area: 'area',
BarX: 'bar-x',
BarY: 'bar-y',
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/d3/renderer/validation/index.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/types/widget-data/area.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -29,7 +29,7 @@ export type AreaMarkerOptions = PointMarkerOptions & {
};

export type AreaSeries<T = any> = BaseSeries & {
type: typeof WidgetType.Area;
type: typeof SeriesType.Area;
data: AreaSeriesData<T>[];
/** The name of the series (used in legend, tooltip etc) */
name: string;
Expand Down
4 changes: 2 additions & 2 deletions src/types/widget-data/bar-x.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -29,7 +29,7 @@ export type BarXSeriesData<T = any> = BaseSeriesData<T> & {
};

export type BarXSeries<T = any> = BaseSeries & {
type: typeof WidgetType.BarX;
type: typeof SeriesType.BarX;
data: BarXSeriesData<T>[];
/** The name of the series (used in legend, tooltip etc) */
name: string;
Expand Down
4 changes: 2 additions & 2 deletions src/types/widget-data/bar-y.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -23,7 +23,7 @@ export type BarYSeriesData<T = any> = BaseSeriesData<T> & {
};

export type BarYSeries<T = any> = BaseSeries & {
type: typeof WidgetType.BarY;
type: typeof SeriesType.BarY;
data: BarYSeriesData<T>[];
/** The name of the series (used in legend, tooltip etc) */
name: string;
Expand Down
4 changes: 2 additions & 2 deletions src/types/widget-data/line.ts
Original file line number Diff line number Diff line change
@@ -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<T = any> = BaseSeriesData<T> & {
/**
Expand Down Expand Up @@ -29,7 +29,7 @@ export type LineMarkerOptions = PointMarkerOptions & {
};

export type LineSeries<T = any> = BaseSeries & {
type: typeof WidgetType.Line;
type: typeof SeriesType.Line;
data: LineSeriesData<T>[];
/** The name of the series (used in legend, tooltip etc) */
name: string;
Expand Down
4 changes: 2 additions & 2 deletions src/types/widget-data/pie.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {WidgetType} from '../../constants';
import {SeriesType} from '../../constants';
import type {BaseSeries, BaseSeriesData} from './base';
import {ChartKitWidgetLegend, RectLegendSymbolOptions} from './legend';

Expand All @@ -17,7 +17,7 @@ export type ConnectorShape = 'straight-line' | 'polyline';
export type ConnectorCurve = 'linear' | 'basic';

export type PieSeries<T = any> = BaseSeries & {
type: typeof WidgetType.Pie;
type: typeof SeriesType.Pie;
data: PieSeriesData<T>[];
/**
* The color of the border surrounding each segment.
Expand Down
4 changes: 2 additions & 2 deletions src/types/widget-data/scatter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {WidgetType} from '../../constants';
import {SeriesType} from '../../constants';
import type {BaseSeries, BaseSeriesData} from './base';
import type {ChartKitWidgetLegend, RectLegendSymbolOptions} from './legend';

Expand Down Expand Up @@ -27,7 +27,7 @@ export type ScatterSeriesData<T = any> = BaseSeriesData<T> & {
};

export type ScatterSeries<T = any> = BaseSeries & {
type: typeof WidgetType.Scatter;
type: typeof SeriesType.Scatter;
data: ScatterSeriesData<T>[];
/** The name of the series (used in legend, tooltip etc) */
name: string;
Expand Down

0 comments on commit 1734a15

Please sign in to comment.