Skip to content

Commit

Permalink
Add horzBehaviour getter on the Chart Api
Browse files Browse the repository at this point in the history
  • Loading branch information
SlicedSilver committed Dec 9, 2024
1 parent 135dfe7 commit 4ebcc11
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/api/chart-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@ export class ChartApi<HorzScaleItem> implements IChartApiBase<HorzScaleItem>, Da
this._chartWidget.model().clearCurrentPosition(true);
}

public horzBehaviour(): IHorzScaleBehavior<HorzScaleItem> {
return this._horzScaleBehavior;
}

private _addSeriesImpl<
TSeries extends SeriesType,
TData extends WhitespaceData<HorzScaleItem> = SeriesDataItemTypeMap<HorzScaleItem>[TSeries],
Expand Down
6 changes: 6 additions & 0 deletions src/api/ichart-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ChartOptionsImpl } from '../model/chart-model';
import { BarData, HistogramData, LineData, WhitespaceData } from '../model/data-consumer';
import { Time } from '../model/horz-scale-behavior-time/types';
import { CustomData, ICustomSeriesPaneView } from '../model/icustom-series';
import { IHorzScaleBehavior } from '../model/ihorz-scale-behavior';
import { Point } from '../model/point';
import {
CustomSeriesOptions,
Expand Down Expand Up @@ -338,4 +339,9 @@ export interface IChartApiBase<HorzScaleItem = Time> {
* @returns Dimensions of the chart pane
*/
paneSize(paneIndex?: number): PaneSize;

/**
* Returns the horizontal scale behaviour.
*/
horzBehaviour(): IHorzScaleBehavior<HorzScaleItem>;
}
2 changes: 1 addition & 1 deletion src/api/yield-chart-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class YieldChartApi extends ChartApi<number> implements IYieldCurveChartA
}

private _initWhitespaceSeries(): void {
const horzBehaviour = this._horzScaleBehavior as YieldCurveHorzScaleBehavior;
const horzBehaviour = this.horzBehaviour() as YieldCurveHorzScaleBehavior;
const whiteSpaceSeries = this.addSeries(lineSeries);

let currentWhitespaceHash: string;
Expand Down

0 comments on commit 4ebcc11

Please sign in to comment.