Skip to content

Commit

Permalink
fix: errors in XAxisTimeLabelsGenerator after prepending candles
Browse files Browse the repository at this point in the history
  • Loading branch information
kokovtsev committed Oct 3, 2023
1 parent 43df2e5 commit d106364
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/chart/components/chart/chart-base.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type DataPoint<T extends BaseType> = T extends 'candle' ? Candle : DataSeriesPoi
type VisualPoint<T extends BaseType> = T extends 'candle' ? VisualCandle : VisualSeriesPoint;
export interface PrependedCandlesData {
prependedCandlesWidth: number;
prependedCandlesCount: number;
preparedCandles: Candle[];
}

Expand Down
1 change: 1 addition & 0 deletions src/chart/components/chart/chart.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ export class ChartModel extends ChartBaseElement {
this.scale.moveXStart(this.scale.xStart + prependedCandlesWidth);
this.candlesPrependSubject.next({
prependedCandlesWidth,
prependedCandlesCount: updateResult.prepended,
preparedCandles,
});

Expand Down
6 changes: 3 additions & 3 deletions src/chart/components/x_axis/x-axis.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ export class XAxisComponent extends ChartBaseElement {
this.addRxSubscription(
this.chartComponent.chartModel.candlesPrependSubject
.pipe(
filter(({ preparedCandles }) => preparedCandles.length !== 0),
map(({ preparedCandles }) => {
filter(({ prependedCandlesCount }) => prependedCandlesCount !== 0),
map(({ prependedCandlesCount }) => {
return this.chartComponent.chartModel.mainCandleSeries.visualPoints.slice(
0,
preparedCandles.length,
prependedCandlesCount,
);
}),
)
Expand Down

0 comments on commit d106364

Please sign in to comment.