[Feature] Line style for varied segments and connectNulls
- Dominant language
- TypeScript
- Stars
- 67.3k
- Forks
- 19.8k
- Avg merge
- 11d 14h
- Merged PRs (30d)
- 8
Description
### What problem does this feature solve?
Current API lacks the ability to control line style for varied segments. For example, if we want to make different styles for a line series, we have to mock it using many series, which is not an elegant way to do.

### What does the proposed API look like?
The new option should give the developer the control over line styles for different line segments. The API could be:
```js
{
data: [{
value: 10,
lineStyle: {...}, // controls the line style after this data
areaStyle: {...}
}]
}
```
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: {...}
}]
}
```
We should also provide a way to set the lineStyle for the lines from `connectNulls`. The API may be
```js
{
nullLineStyle: {...},
nullAreaStyle: {...}
}
```
or
```js
{
connectNullStyle: {
lineStyle: {...},
areaStyle: {...}
}
}
```
or
```js
{
linePieces: [{
rule: function(params) { return params.isConnectNulls },
lineStyle: {...},
areaStyle: {...}
}]
}
```
This issue is a task for [OSPP](https://summer-ospp.ac.cn/#/org/prodetail/22ffc0285) so it will probably be fixed by a student from the program. Discussion about the design and your own requirement is always welcomed.
Contributor guide
Assessment
This issue has not been assessed yet.