Skip to content

Commit

Permalink
use const to export series
Browse files Browse the repository at this point in the history
  • Loading branch information
illetid committed Oct 24, 2024
1 parent 0cd7d11 commit 5bb1171
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 83 deletions.
18 changes: 6 additions & 12 deletions src/model/series/area-series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,12 @@ export const areaStyleDefaults: AreaStyleOptions = {
pointMarkersVisible: false,
};

export class AreaSeries implements BuiltInSeriesDefinition<'Area'> {
// eslint-disable-next-line @typescript-eslint/tslint/config
public readonly type = 'Area' as const;
// eslint-disable-next-line @typescript-eslint/tslint/config
public readonly isBuiltIn = true as const;
public readonly defaultOptions: AreaStyleOptions = areaStyleDefaults;
export const areaSeries: BuiltInSeriesDefinition<'Area'> = {
type: 'Area' as const,
isBuiltIn: true as const,
defaultOptions: areaStyleDefaults,
/**
* @internal
*/
public createPaneView(series: ISeries<'Area'>, model: IChartModelBase): IUpdatablePaneView {
return new SeriesAreaPaneView(series, model);
}
}

export const areaSeries = new AreaSeries();
createPaneView: (series: ISeries<'Area'>, model: IChartModelBase): IUpdatablePaneView => new SeriesAreaPaneView(series, model),
};
33 changes: 19 additions & 14 deletions src/model/series/bar-series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,24 @@ export const barStyleDefaults: BarStyleOptions = {
thinBars: true,
};

export class BarSeries implements BuiltInSeriesDefinition<'Bar'> {
// eslint-disable-next-line @typescript-eslint/tslint/config
public readonly type = 'Bar' as const;
// eslint-disable-next-line @typescript-eslint/tslint/config
public readonly isBuiltIn = true as const;
// export class BarSeries implements BuiltInSeriesDefinition<'Bar'> {
// // eslint-disable-next-line @typescript-eslint/tslint/config
// public readonly type = 'Bar' as const;
// // eslint-disable-next-line @typescript-eslint/tslint/config
// public readonly isBuiltIn = true as const;

public readonly defaultOptions: BarStyleOptions = barStyleDefaults;
/**
* @internal
*/
public createPaneView(series: ISeries<'Bar'>, model: IChartModelBase): IUpdatablePaneView {
return new SeriesBarsPaneView(series, model);
}
}
// public readonly defaultOptions: BarStyleOptions = barStyleDefaults;
// /**
// * @internal
// */
// public createPaneView(series: ISeries<'Bar'>, model: IChartModelBase): IUpdatablePaneView {
// return new SeriesBarsPaneView(series, model);
// }
// }

export const barSeries = new BarSeries();
export const barSeries: BuiltInSeriesDefinition<'Bar'> = {
type: 'Bar' as const,
isBuiltIn: true as const,
defaultOptions: barStyleDefaults,
createPaneView: (series: ISeries<'Bar'>, model: IChartModelBase): IUpdatablePaneView => new SeriesBarsPaneView(series, model),
};
35 changes: 20 additions & 15 deletions src/model/series/baseline-series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,23 @@ export const baselineStyleDefaults: BaselineStyleOptions = {
pointMarkersVisible: false,
};

export class BaselineSeries implements BuiltInSeriesDefinition<'Baseline'> {
// eslint-disable-next-line @typescript-eslint/tslint/config
public readonly type = 'Baseline' as const;
// eslint-disable-next-line @typescript-eslint/tslint/config
public readonly isBuiltIn = true as const;
public readonly defaultOptions: BaselineStyleOptions = baselineStyleDefaults;
/**
* @internal
*/
public createPaneView(series: ISeries<'Baseline'>, model: IChartModelBase): IUpdatablePaneView {
return new SeriesBaselinePaneView(series, model);
}
}

export const baselineSeries = new BaselineSeries();
// export class BaselineSeries implements BuiltInSeriesDefinition<'Baseline'> {
// // eslint-disable-next-line @typescript-eslint/tslint/config
// public readonly type = 'Baseline' as const;
// // eslint-disable-next-line @typescript-eslint/tslint/config
// public readonly isBuiltIn = true as const;
// public readonly defaultOptions: BaselineStyleOptions = baselineStyleDefaults;
// /**
// * @internal
// */
// public createPaneView(series: ISeries<'Baseline'>, model: IChartModelBase): IUpdatablePaneView {
// return new SeriesBaselinePaneView(series, model);
// }
// }
export const baselineSeries: BuiltInSeriesDefinition<'Baseline'> = {
type: 'Baseline' as const,
isBuiltIn: true as const,
defaultOptions: baselineStyleDefaults,
createPaneView: (series: ISeries<'Baseline'>, model: IChartModelBase): IUpdatablePaneView => new SeriesBaselinePaneView(series, model),
};

33 changes: 19 additions & 14 deletions src/model/series/candlestick-series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,23 @@ export const candlestickStyleDefaults: CandlestickStyleOptions = {
wickDownColor: '#ef5350',
};

export class CandlestickSeries implements BuiltInSeriesDefinition<'Candlestick'> {
// eslint-disable-next-line @typescript-eslint/tslint/config
public readonly type = 'Candlestick' as const;
// eslint-disable-next-line @typescript-eslint/tslint/config
public readonly isBuiltIn = true as const;
public readonly defaultOptions: CandlestickStyleOptions = candlestickStyleDefaults;
/**
* @internal
*/
public createPaneView(series: ISeries<'Candlestick'>, model: IChartModelBase): IUpdatablePaneView {
return new SeriesCandlesticksPaneView(series, model);
}
}
// export class CandlestickSeries implements BuiltInSeriesDefinition<'Candlestick'> {
// // eslint-disable-next-line @typescript-eslint/tslint/config
// public readonly type = 'Candlestick' as const;
// // eslint-disable-next-line @typescript-eslint/tslint/config
// public readonly isBuiltIn = true as const;
// public readonly defaultOptions: CandlestickStyleOptions = candlestickStyleDefaults;
// /**
// * @internal
// */
// public createPaneView(series: ISeries<'Candlestick'>, model: IChartModelBase): IUpdatablePaneView {
// return new SeriesCandlesticksPaneView(series, model);
// }
// }

export const candlestickSeries = new CandlestickSeries();
export const candlestickSeries: BuiltInSeriesDefinition<'Candlestick'> = {
type: 'Candlestick' as const,
isBuiltIn: true as const,
defaultOptions: candlestickStyleDefaults,
createPaneView: (series: ISeries<'Candlestick'>, model: IChartModelBase): IUpdatablePaneView => new SeriesCandlesticksPaneView(series, model),
};
33 changes: 19 additions & 14 deletions src/model/series/histogram-series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@ export const histogramStyleDefaults: HistogramStyleOptions = {
base: 0,
};

export class HistogramSeries implements BuiltInSeriesDefinition<'Histogram'> {
// eslint-disable-next-line @typescript-eslint/tslint/config
public readonly type = 'Histogram' as const;
// eslint-disable-next-line @typescript-eslint/tslint/config
public readonly isBuiltIn = true as const;
public readonly defaultOptions: HistogramStyleOptions = histogramStyleDefaults;
/**
* @internal
*/
public createPaneView(series: ISeries<'Histogram'>, model: IChartModelBase): IUpdatablePaneView {
return new SeriesHistogramPaneView(series, model);
}
}
// export class HistogramSeries implements BuiltInSeriesDefinition<'Histogram'> {
// // eslint-disable-next-line @typescript-eslint/tslint/config
// public readonly type = 'Histogram' as const;
// // eslint-disable-next-line @typescript-eslint/tslint/config
// public readonly isBuiltIn = true as const;
// public readonly defaultOptions: HistogramStyleOptions = histogramStyleDefaults;
// /**
// * @internal
// */
// public createPaneView(series: ISeries<'Histogram'>, model: IChartModelBase): IUpdatablePaneView {
// return new SeriesHistogramPaneView(series, model);
// }
// }
export const histogramSeries: BuiltInSeriesDefinition<'Histogram'> = {
type: 'Histogram' as const,
isBuiltIn: true as const,
defaultOptions: histogramStyleDefaults,
createPaneView: (series: ISeries<'Histogram'>, model: IChartModelBase): IUpdatablePaneView => new SeriesHistogramPaneView(series, model),
};

export const histogramSeries = new HistogramSeries();
34 changes: 20 additions & 14 deletions src/model/series/line-series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,27 @@ export const lineStyleDefaults: LineStyleOptions = {
lastPriceAnimation: LastPriceAnimationMode.Disabled,
pointMarkersVisible: false,
};

// export class LineSeries implements BuiltInSeriesDefinition<'Line'> {
// // eslint-disable-next-line @typescript-eslint/tslint/config
// public readonly type = 'Line' as const;
// // eslint-disable-next-line @typescript-eslint/tslint/config
// public readonly isBuiltIn = true as const;
// public readonly defaultOptions: LineStyleOptions = lineStyleDefaults;
// /**
// * @internal
// */
// public createPaneView(series: ISeries<'Line'>, model: IChartModelBase): IUpdatablePaneView {
// return new SeriesLinePaneView(series, model);
// }
// }
/*
* Line series
*/
export class LineSeries implements BuiltInSeriesDefinition<'Line'> {
// eslint-disable-next-line @typescript-eslint/tslint/config
public readonly type = 'Line' as const;
// eslint-disable-next-line @typescript-eslint/tslint/config
public readonly isBuiltIn = true as const;
public readonly defaultOptions: LineStyleOptions = lineStyleDefaults;
/**
* @internal
*/
public createPaneView(series: ISeries<'Line'>, model: IChartModelBase): IUpdatablePaneView {
return new SeriesLinePaneView(series, model);
}
}
export const lineSeries: BuiltInSeriesDefinition<'Line'> = {
type: 'Line' as const,
isBuiltIn: true as const,
defaultOptions: lineStyleDefaults,
createPaneView: (series: ISeries<'Line'>, model: IChartModelBase): IUpdatablePaneView => new SeriesLinePaneView(series, model),
};

export const lineSeries = new LineSeries();

0 comments on commit 5bb1171

Please sign in to comment.