echarts markLine on line serie doesn't respect zoom

lrl1mhuk  于 2022-11-03  发布在  Echarts
关注(0)|答案(8)|浏览(218)

during zoom phase, markLine with type=average doesn't respect the correct zoom window, but show the avg of all the dataset.

it's possible to force it to calculate the avg of the "visible" zoom window of data?

for instance if i zoom from 1 to 10 i want to see the avg calculated from 1 to 10 not from 0 to end_data

wbgh16ku

wbgh16ku1#

I think that is exactly what markLine of type average is doing...:
Go to example https://ecomfe.github.io/echarts-examples/public/editor.html?c=area-simple
Add a markLine:

markLine: {
                data: [
                    {type: 'average', name: 'test'},
                ],
            },

This markLine shows the average of the current view...

mxg2im7a

mxg2im7a2#

it doesn't work for me

here a demo

http://jsfiddle.net/qsbLt2a9/

avg of temp = 27,5 (correctly displayed if no zoom)

if i zoom on a interval of 29/30 the avg stay 27.5

that's the full view ( correct)

that's the zoomed view ( not correct)

s6fujrry

s6fujrry3#

OK, it looks like "filtermode":"none" in "dataZoom" prevents the line from being adjusted, since nothing is being filtered out... unfortunately if you set "filtermode" to "filter" with so few series data items, the line draw is then not completed either...

6tqwzwtp

6tqwzwtp4#

so, we can consider that a bug?
filtermode and markLine shouldn't "interfere" imho.

0yycz8jy

0yycz8jy5#

I think it is just as it was designed. By filtering out all data points being not in visible range, the average value is re-calculated. This is at least the explanation. Whether it is considered as a bug or a new feature request, it depends on the contributors.
If I had to implement this, I would filter out all non-visible points, but I would complete the line drawings towards the left/right edge of the viewport by looking at the unfiltered series...

fsi0uk1n

fsi0uk1n6#

Probably we need to support another filerMode option, with filter out all values outside the view, except the ones next to the points inside the view.
This option makes sense only in line chart, but after all line chart is a commonly used chart.

2jcobegt

2jcobegt7#

well it make sense also for people that use custom item renderer actually, and want to track back previous record.

wfauudbj

wfauudbj8#

I would say a nice feature would be also to be able to apply filterMode only to certain datasets you want.
I've the common issue of lines/markAreas disappearing when zooming, it can be solved by setting filterMode: none but if I do that performance-wise the graph becomes very bad.

相关问题