apache / apache/echarts

[Feature] Line style for varied segments and connectNulls

Open
#17,138 25 comments 17 reactions 0 assignees View on GitHub
en new-feature topic: line
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.

052a24de686d38783a9723dbb

### 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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.