Skip to content

Commit

Permalink
feat(line): design api to use line segment style
Browse files Browse the repository at this point in the history
  • Loading branch information
pe-3 committed Dec 11, 2022
1 parent 074aa81 commit 2749011
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions src/chart/line/LineSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ import {
import SeriesData from '../../data/SeriesData';
import type Cartesian2D from '../../coord/cartesian/Cartesian2D';
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 { createSymbol, ECSymbol } from '../../util/symbol';
import { Group } from '../../util/graphic';
import { LegendIconParams } from '../../component/legend/LegendModel';

type LineDataValue = OptionDataValue | OptionDataValue[];

Expand All @@ -52,6 +52,13 @@ interface LineStateOptionMixin {
}
}

interface LineSegmentCallBackParams {
dataIndex: number,
dataVal: number
}

type LineSegmentOption = [number, number] | ((params: LineSegmentCallBackParams) => boolean);

export interface LineStateOption<TCbParams = never> {
itemStyle?: ItemStyleOption<TCbParams>
label?: SeriesLabelOption
Expand Down Expand Up @@ -120,6 +127,17 @@ export interface LineSeriesOption extends SeriesOption<LineStateOption<CallbackD
data?: (LineDataValue | LineDataItemOption)[]

triggerLineEvent?: boolean

linePieces?: {
segment: LineSegmentOption,
lineStyle: LineStyleOption,
areaStyle: AreaStyleOption
}[]

connectNullStyle?: {
lineStyle: LineStyleOption,
areaStyle: AreaStyleOption
}
}

class LineSeriesModel extends SeriesModel<LineSeriesOption> {
Expand Down Expand Up @@ -174,11 +192,11 @@ class LineSeriesModel extends SeriesModel<LineSeriesOption> {
scale: true
},
// areaStyle: {
// origin of areaStyle. Valid values:
// `'auto'/null/undefined`: from axisLine to data
// `'start'`: from min to data
// `'end'`: from data to max
// origin: 'auto'
// origin of areaStyle. Valid values:
// `'auto'/null/undefined`: from axisLine to data
// `'start'`: from min to data
// `'end'`: from data to max
// origin: 'auto'
// },
// false, 'start', 'end', 'middle'
step: false,
Expand Down

0 comments on commit 2749011

Please sign in to comment.