You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/07/24 14:42:27 UTC

[GitHub] [echarts] zz5840 commented on issue #17138: [Feature] Line style for varied segments and connectNulls

zz5840 commented on issue #17138:
URL: https://github.com/apache/echarts/issues/17138#issuecomment-1193331807

   @Ovilia I'd like to add following properties to option in [LineSeries.ts#L72](https://github.com/apache/echarts/blob/67afcbd2c8a7d110263fc3e90d5080251fa2ec93/src/chart/line/LineSeries.ts#L72) for implementing the second proposal:
   
   ```js
   
   export interface LinePieceData {
       index: number
       leftValue: number
       rightValue: number
       lineStyle: LineStyleOption
       isConnectNulls: boolean
   }
   
   export interface LinePiecesOption {
       indexes?: number[]
       rules: (piece: LinePieceData) => boolean
       lineStyle?: LineStyleOption
   }
   
   export interface LineSeriesOption {
       // ...
       linePieces?: LinePiecesOption[]
   }
   ```
   
   The new API can be call by providing the `linePieces` option as you proposed:
   
   > or something similar to [visualMap.pieces](https://echarts.apache.org/en/option.html#visualMap-piecewise.pieces):
   > 
   > ```js
   > {
   >   linePieces: [{
   >     index: [0, 2, 4], // the index of line segments
   >     lineStyle: {...},
   >     areaStyle: {...}
   >   }]
   > }
   > ```
   > 
   > or callback rules:
   > 
   > ```js
   > {
   >   linePieces: [{
   >     rule: function(params) { return params.dataIndex % 4 === 1; },
   >     lineStyle: {...},
   >     areaStyle: {...}
   >   }]
   > }
   > ```
   
   When using property `rules` to indicate which pieces should this style applied to, the callback function will receive the following arguments as a `piece` object:
   
   
   ```js
   export interface LinePieceData {
       // index of the line piece
       index: number
       // left endpoint value of the line piece
       leftValue: number
       // right endpoint value of the line piece
       rightValue: number
       // line style will be applied to the line piece
       lineStyle: LineStyleOption
       // indicates if the piece is used to connect null data
       isConnectNulls: boolean
   }
   ```
   
   What do you think of this implement?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org