echarts [Feature] Marklines from dataset

mzillmmw  于 4个月前  发布在  Echarts
关注(0)|答案(2)|浏览(95)

What problem does this feature solve?

Right now there is no way to set the markline from the dataset with encode. It could prove very useful to do so, since this way updating the dataset would affect the whole chart. Imagine if the target is the avg/min/max of a value that is not displayed in the chart; using the current valueIndex and valueDim it is not achievable.

I believe the intention of the dataset is to be able to just have the data or content that the chart needs to display and the rest of the ECharts object is used to show that data. In my opinion, markline, markpoints, etc. are also really important pieces of data that should be specified through the dataset.

My use case

This is happening to me in a chart that I want to calculate the average of a ratio: I have a bar chart displaying the for each bar a ratio calculated like A/B . The markline needs to show the average, but it is not the same to do (A0/B0+A1/B1)/2 (the current behavior when markline set to "avg") than (A0+A1)/(B0+B1). I want to show the latter value, but I can't by only updating the dataset; I need to update the series object, etc. Being able to specify this value in the dataset would simplify the process.

What does the proposed API look like?

Inside markline add the encode option. The property data and property encode would be mutually exclusive like it is now for the series encode and data.

markLine: {
       encode: [{
           type: "avg" | "min" | "max",
           dim: string | number
       }]
}
0h4hbjxa

0h4hbjxa1#

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

np8igboo

np8igboo2#

I still think this feature would be useful, since encode becomes useless once you need to user marks

相关问题