echarts icon indicating copy to clipboard operation
echarts copied to clipboard

add startValue and endValue parameters in zoom event triggered by slider

Open umutcanbolat opened this issue 6 years ago • 14 comments

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.

umutcanbolat avatar Jun 18 '19 19:06 umutcanbolat

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! 🍵

echarts-bot[bot] avatar Jun 18 '19 19:06 echarts-bot[bot]

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

Ovilia avatar Jun 19 '19 08:06 Ovilia

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 avatar Jun 20 '19 14:06 umutcanbolat

@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 avatar Jul 14 '19 14:07 devhaks

@devhaks I managed to solve the problem but think this is still an issue.

umutcanbolat avatar Jul 15 '19 10:07 umutcanbolat

+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

DhrubajitPC avatar Mar 05 '20 10:03 DhrubajitPC

Any news about this fix?

anthony-bt avatar Apr 02 '20 18:04 anthony-bt

+1

derekflint avatar Oct 19 '20 13:10 derekflint

+1

helgasoft avatar Nov 07 '20 20:11 helgasoft

+1111111111

liho98 avatar Aug 05 '21 13:08 liho98

+1 , Any news on this??

MIhailsPopovs avatar May 30 '22 15:05 MIhailsPopovs

+1111111111

DaveMDS avatar Dec 07 '22 17:12 DaveMDS

+1...

rvillette avatar Jan 23 '24 14:01 rvillette

+++++++++++++++++++++++++++++++++1

reshetnik avatar Feb 05 '24 14:02 reshetnik