From 632e106a06f85d834e404f73f317b187c7531f92 Mon Sep 17 00:00:00 2001 From: Aleksandr Lesnenko Date: Fri, 29 Sep 2023 19:21:02 -0300 Subject: [PATCH] support brush selection on line series --- src/chart/line/LineSeries.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/chart/line/LineSeries.ts b/src/chart/line/LineSeries.ts index 9faf5c5175..85e7b173aa 100644 --- a/src/chart/line/LineSeries.ts +++ b/src/chart/line/LineSeries.ts @@ -42,6 +42,7 @@ import type Polar from '../../coord/polar/Polar'; import {createSymbol, ECSymbol} from '../../util/symbol'; import {Group} from '../../util/graphic'; import {LegendIconParams} from '../../component/legend/LegendModel'; +import type { BrushCommonSelectorsForSeries } from '../../component/brush/selector'; type LineDataValue = OptionDataValue | OptionDataValue[]; @@ -216,6 +217,15 @@ class LineSeriesModel extends SeriesModel { triggerLineEvent: false }; + brushSelector(dataIndex: number, data: SeriesData, selectors: BrushCommonSelectorsForSeries): boolean { + const points = data.getLayout('points'); + const pointOffset = dataIndex * 2; + const x = points[pointOffset]; + const y = points[pointOffset + 1]; + + return selectors.point([x, y]); + } + getLegendIcon(opt: LegendIconParams): ECSymbol | Group { const group = new Group();