echarts
echarts copied to clipboard
add startValue and endValue parameters in zoom event triggered by slider
What problem does this feature solve?
When user uses slider to zoom the chart, the event triggered does not have parameters startValue and endValue. It only has start and end percentage values.
What does the proposed API look like?
Version
4.2.1
Reproduction link
https://www.echartsjs.com/examples/en/editor.html?c=line-simple
Steps to reproduce
- Please copy the following code into input on the left side.
option = {
title: {
text: 'ECharts 入门示例'
},
tooltip: {},
legend: {
data:['销量']
},
xAxis: {
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'line',
data: [5, 20, 36, 10, 10, 20]
}],
dataZoom: [
{
type: 'slider',
show: true,
realtime: false
},
]
};
myChart.on('dataZoom', function (params) {
console.log(params);
// should return exact values, but returns undefined
console.log(params.startValue);
console.log(params.endValue);
});
- Then try to zoom the chart and have a look at console.
What is expected?
As described in the docs, datazoom event includes startValue and endValue in the payload if the event is triggered by using toolbox. But I think the datazoom event (triggered by the slider) should also take parameters startValue and endValue besides start and end percentage parameters.
What is actually happening?
startValue and endValue parameters are not included in the payload of the event.
Thank you.
Hi! We've received your issue and please be patient to get responded. 🎉 The average response time is expected to be within one day for weekdays.
In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.
Have a nice day! 🍵
Please see the note at: https://echarts.apache.org/en/api.html#events.datazoom
// data value of zoom start position; only exists in zoom event of triggered by toolbar
Hi @Ovilia! I'm already aware of this note. My purpose is to see the same values not only in datazoom event triggered by toolbox, but also in the event triggered by the slider.
@umutcanbolat Did you solve the problem? I find it.
https://stackoverflow.com/questions/42503988/echarts-datazoom-event-does-not-return-timestamp-but-only-percentages/43910746#43910746
@devhaks I managed to solve the problem but think this is still an issue.
+1 any updates on this?
honestly, the solution at https://stackoverflow.com/questions/42503988/echarts-datazoom-event-does-not-return-timestamp-but-only-percentages/43910746#43910746 feels like an unnecessary workaround
Any news about this fix?
+1
+1
+1111111111
+1 , Any news on this??
+1111111111
+1...
+++++++++++++++++++++++++++++++++1