apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.21k stars 19.61k forks source link

Brush (lineX, lineY) selection values are not available with line charts #14258

Open tamersalama opened 3 years ago

tamersalama commented 3 years ago

Version

5.0.2

Reproduction link

https://codepen.io/tamersalama/pen/mdOraGb?editors=1111

Steps to reproduce

1- Create a line chart with a horizontal selector (lineX) brush

2- Use the brush to select a data range

3- The onbrushselected event fires up normally, however the event parameters' dataIndex (params.batch[0].selected[0].dataIndex) returns an empty array

4- Changing the chart type to scatter or bar will result in a proper dataIndex being returned

What is expected?

It's expected that the dataIndex for the selection to have an array of selected values

What is actually happening?

dataIndex within params.batch[0].selected[0].dataIndex is empty

echarts-bot[bot] commented 3 years ago

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.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical question.

If you are interested in the project, you may also subscribe our mailing list.

Have a nice day! 🍵

tamersalama commented 3 years ago

Thank you for adding this a milestone.

As a workaround (in case anyone encountered the same issue) - I'm using params.areas[0].coordRange to get the selected range. Not perfect but could work is some cases.

lambo-huang commented 3 years ago

跟你一样的需求,你解决了吗

pramitchoudhary commented 2 years ago

Thanks for the above trick @tamersalama Also, brushSelected event doesn't seem to be documented. Will it be possible to add an entry for that in the docs?

coolRoger commented 2 years ago

really need this feature for line chart

@Ovilia

novablinkicelance commented 1 year ago

Any news on this feature?

Ovilia commented 1 year ago

As the document states:

Currently, supported brush types include: scatter, bar, candlestick.

If you are interested in making this feature, please open a pull request.

howdyhyber commented 1 year ago

Is this still considered on the pipeline? this is a good feature if added.

wanghaiqiangk commented 1 year ago

Thank you for adding this a milestone.

As a workaround (in case anyone encountered the same issue) - I'm using params.areas[0].coordRange to get the selected range. Not perfect but could work is some cases.

Thanks. Although this trick is very limited, it does help in my situation. My xAxis is a time type. I want to use brush to select an area and calculate its duration. In such case, the coordRange is enough to do the calculation. But you need to change brush option from global to specific coordinate with brush. xAxisIndex.

And, please consider to implement this feature, team :+1:

Franck92700 commented 1 year ago

Hi, No fixe for this issue ?

Franck

alxnddr commented 11 months ago

Hey @Ovilia, I've created a fix for this. Could you please have a look? https://github.com/apache/echarts/pull/19193

Ovilia commented 7 months ago

@alxnddr Hi, I've commented on the PR. Please have a look. Thanks!