Repository navigation
Closed
Labels
Description
问题简述 (One-line summary)
During zooming ECharts does not paint lines to chart boundaries if the target point is outside of the visible coordinate range. Mark areas however are painted to chart boundaries. But mark areas also disappear if both start and end coordinates of the mark area are outside the visible coordinate range.
版本及环境 (Version & Environment)
- ECharts 版本 (ECharts version): 3.2.0 / master branch
- 浏览器类型和版本 (Browser version): all
- 操作系统类型和版本 (OS Version): all
重现步骤 (Steps to reproduce)
- Open https://jsfiddle.net/wy0v5yqv/ or used options posted below
- Move left handle of zoom slider slightly to the right and left most line part will disappear (bad), but left most mark area still visible (good)
- Move right handle of zoom slider slightly to the left and right most line part will disappear (bad), but right most mark area still visible (good)
- Move right handle of zoom slider further to the right and remaining line part will disappear once its target point is out of zoom range (bad). Moving the handle even further to the right until the zoomed/visible range crosses the right edge of the left most mark area causes the left most mark area to disappear as well. Now you have an empty chart (bad).
期望结果 (Expected behaviour)
Lines and mark areas should be painted even if their points are outside of the zoomed area. If you don't want that all the time, at least make it configurable.
可能哪里有问题 (What went wrong)
See "Steps to reproduce" above.
ECharts配置项 (ECharts option)
option = {
legend: {
data:['issue']
},
dataZoom: [
{ type: 'slider', show: true },
{ type: 'inside', show: true }
],
xAxis: {
type: 'time',
},
yAxis: {
type: 'value',
max: 50
},
series: [
{
name:'issue',
type:'line',
data:[
{name : "2016-01-01", value: ["2016-01-01 00:00:00", 5]},
{name : "2016-01-02", value: ["2016-01-02 00:00:00", 15]},
{name : "2016-01-03", value: ["2016-01-03 00:00:00", 25]},
{name : "2016-01-03", value: ["2016-01-05 00:00:00", 15]},
],
markArea: {
silent: true,
data: [
[
{ coord: ["2016-01-01 00:00:00", 5] },
{ coord: ["2016-01-01 23:59:59", 15] }
],
[
{ coord: ["2016-01-02 00:00:00", 10] },
{ coord: ["2016-01-02 23:59:59", 20] }
],
[
{ coord: ["2016-01-03 00:00:00", 15] },
{ coord: ["2016-01-03 23:59:59", 35] }
]
]
},
}
]
}其他信息 (Other comments)
https://jsfiddle.net/wy0v5yqv/
Activity
pissang commentedon Jul 14, 2016
That's because what dataZoom do is to zoom and filter the data, not simply zoom the view. So even if you move left handle of zoom slider slightly, the first data will still be filtered and not shown in the finally view.
jnehlmeier commentedon Jul 14, 2016
@pissang I tried adding
filterMode: 'empty'to the data zoom options because I thought that might change the behavior (a bit tough to guess without english docs :)), but it doesn't. Lines / mark areas still disappear.That behavior is a bit annoying when you zoom into a data set and then move the zoomed area across the whole data set, e.g you have 3 years of data and zoom into a week or month and then move this zoom window. Sometimes mark areas can disappear and if you have some larger gaps in your dataset the chart line itself can disappear. IMHO its confusing.
What if you still filter data but keep the first left and right data points outside the range in your model so you can render the chart correctly?
pissang commentedon Jul 14, 2016
I found markArea may do disappear unexpectedly. I will fix it in the next version.
And about line we agree it's a bit annoying when sliding the window which there is no much data on the view. But it's difficult to "keep the first left and right data points outside the range" in this architecture. Sorry about that. And we will try to figure out a good way to solve the problem.
About
filterMode: 'empty'. In this mode the filtered data will be replaced with'-'instead of being removed. It is used not that often.jarben commentedon Jul 22, 2016
Any thoughts or progress on this one? Could the view "snap" to the nearest unfiltered data points if boundaryGap is false? Similarly to what happens in the 'category' type?
Or filterMode:'hidden' which wouldn't filter data but just clip line in the view?
Nick74k commentedon Mar 31, 2017
The same problem (And even worser) with Y axe. X axe just gives a shorter graph. Y axe removes a parts of graph completely, cutting it into small pieces, not linked with each other, and not cutted by graph edges visually, or dramatically changes its shape, depending on filterMode. Is it possible to make zooming without filtering? Please, please, please make filterMode: "none" for us and we will be happy completely )))
Look at this - the same graph with Y zooming to 25, to 24 with filtermode="filter" and to 24 with filtermode="empty"
P.S. And is it possible to add this option to toolbox->feature->dataZoom also?
P.S.2 Commenting of row seriesData.filterSelf(dim, isInWindow); at AxisProxy.filterdata gives needed functionality of graph.
BlueBeN82 commentedon May 24, 2017
Any updates on this one?
jorat1346 commentedon Sep 21, 2017
I changed the line at echarts/src/component/dataZoom/dataZoomProcessor.js@54 from:
dataZoomModel.getAxisProxy(dimNames.name, axisIndex).filterData(dataZoomModel);to
dataZoomModel.getAxisProxy(dimNames.name, axisIndex);It mint not be the best way to do this for fast rendering, but it works for me for now.
mvdkwast commentedon Dec 2, 2017
Based on jorat1346 comment, as a work-around I changed the line echarts/src/component/dataZoom/AxisProxy.js@307 to :
That way I can specify write the following in my dataZoom section :
This doesn't solve the issue with marklines / areas.
Is there any work in progress on this ?
iozbek commentedon Nov 8, 2018
filtermode: 'none'resolves the problem.ryantunis commentedon Jan 9, 2020
Adding filterMode: none doesn't resolve this problem for me. The mark line still disappears when zooming in.
Echarts Version: 4.6.0
Data Zoom Settings:
Line Series Object with MarkLine:
kgtBiligoat commentedon May 21, 2020
@ryantunis how do you fixed this problem now
BaSmile commentedon May 21, 2020
@kgtBiligoat For a zoom type 'inside', filter:'none' works for me.
1 remaining item
tomkp75 commentedon Jun 25, 2020
filterMode does not work for me either.
Also, this workaround might not always answer the need. One may want to filter on the serie and not on the marks.
The way I found a markArea would stick is by setting xAxis only (or yAxis only), or to also set x or y as a percentage which is inconvenient as it refers the pixels on the screen not the chart axis. All my other attempts to set both width and height resulted in the markArea disappearing.
bojue214 commentedon Nov 20, 2020
Any updates on this one?
mmm2006 commentedon Dec 17, 2020
请问,这个问题有解答吗?我也遇到了同样的问题,标记了一个markArea, 通过datazoom放大的时候,只要markarea的范围超过了当前datazoom的区域,markarea就会消失。例子:https://echarts.apache.org/examples/zh/editor.html?c=area-rainfall 也能很容易就浮现这个问题,希望能提供解决方法。谢谢
kkua22 commentedon Jan 10, 2021
@Ovilia Any info? Setting filterMode: 'none' does not help my marklines still disappear as soon as I zoom in.
kevalbhatt commentedon Jan 12, 2021
For me
filterMode: "none"worked.but after this found another issue. The bar is going outside of the x-axis
@pissang any help would appreciate
mackeroo commentedon Jan 12, 2021
Similar to others in this thread,
filterMode: "none"is not working for me, and I've been tracking this thread for updates on this issue. @kevalbhatt I'm curious -- if you change the slider on the right to06-2019, yourmarkLine(blue horizontal line at ~2.4m) doesn't disappear? I expect the markLine to persist up until06-2019in this case.y0nd0 commentedon Apr 2, 2021
We could implement another
filterModeor change the current default filter by simply include one more point on each side. So that the left and right are always outside of the view. So you have no gaps anymore.I don't know how the filter works (not viewed the source code), but we just have to include exact one point left and right. You know what I mean?
I could create a new issue if you want. But I thought I ask first.
dthunn commentedon Apr 28, 2021
Having the same issue, "filterMode: none" does nothing for me, issue should not be closed.
dummyGit1 commentedon Aug 17, 2021
as an alternative fix you can use the below code to generate multiple mark lines so that even with zoom you will have it working
const getCoords = (xMin = 0, yMin = 0, xMax = 1, yMax = 1, accuracy = 10) => {
const xDiff = (xMax - xMin) / accuracy;
const yDiff = (yMax - yMin) / accuracy;
let presentXVal = xMin;
let presentYVal = yMin;
const dataArr = [];
while (presentXVal <= xMax) {
let coordArr: { coord: number[] }[] = [];
coordArr = [{ coord: [presentXVal, presentYVal] }];
presentXVal += xDiff;
presentYVal += yDiff;
coordArr.push({ coord: [presentXVal, presentYVal] });
dataArr.push(coordArr);
}
return dataArr;
};
locinus commentedon Aug 22, 2021
Other workaround proposed on the other topic: #14835 (comment)
Nurech commentedon Mar 4, 2022
filtermode: 'none'should be default IMO. Was quite troublesome to get to this post to solve the visual problem itself creates. Anyway, glad I found this post!Zamlos commentedon Apr 24, 2023
This issue is not solved
rafalrat commentedon May 4, 2023
I can confirm that the issue still exists. My case is as such: I have a bar chart with 100 entries and a
markAreastarting at 11th measurement, I zoom in and scroll the data to the right. The left-hand side of the area gets cut off when the first tick on the X-axis is not at [0, 0] in the current view port. Please compare:The first tick is not at [0, 0]:

When the first tick is at [0, 0], then the area is not cropped:

Below a minimalistic configuration of the mentioned problem:
and here is a working demo. Please zoom-in the chart and start scrolling to the right to the see the effect.
Does anyone have an idea how to solve this issue. It is quite annoying when the
markAreagets cut off as the zoomed-in chart is being scrolled.helgasoft commentedon Oct 6, 2024
@rafalrat, defining markArea.data by yAxis only will maintain a smooth scroll -
[{yAxis: 0, itemStyle:{ color:'gold'}},{yAxis: 20}]752841728 commentedon Mar 12, 2025
This issue is not solved