Skip to content

Commit

Permalink
Merge pull request #94 from devexperts/remove-unused-hover-data
Browse files Browse the repository at this point in the history
enhancement: remove-unused-hover-data
  • Loading branch information
KirillBobkov authored Dec 18, 2023
2 parents 9e84700 + 53a3dca commit c57d5e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/chart/inputhandlers/hover-producer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface HoverParts {

export interface Hover extends BaseHover, HoverParts {}
export interface HoverProducerPart<T = unknown> {
getData(hover: BaseHover): T;
getData(hover: BaseHover): T | undefined;
}

export interface HoverProducerParts {
Expand Down
10 changes: 9 additions & 1 deletion src/chart/model/compare-series-hover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
import { ChartModel } from '../components/chart/chart.model';
import { BaseHover, HoverProducerPart } from '../inputhandlers/hover-producer.component';
import { MainCandleSeriesModel } from './main-candle-series.model';

export interface CompareSeriesHover {
instrument: string;
Expand All @@ -21,7 +22,14 @@ export class CompareSeriesHoverProducerPart implements HoverProducerPart<Compare
* @param {BaseHover} hover - The hover object containing the x-coordinate.
* @returns {CompareSeriesHover[]} An array of objects containing the instrument symbol, price and id of each series of candles.
*/
getData(hover: BaseHover): CompareSeriesHover[] {
getData(hover: BaseHover): CompareSeriesHover[] | undefined {
if (
this.chartModel.candleSeries.length === 1 &&
this.chartModel.candleSeries[0] instanceof MainCandleSeriesModel
) {
return;
}

const { x } = hover;

const candle = this.chartModel.candleFromX(x);
Expand Down

0 comments on commit c57d5e2

Please sign in to comment.