echarts icon indicating copy to clipboard operation
echarts copied to clipboard

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

Open tamersalama opened this issue 3 years ago • 12 comments

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

tamersalama avatar Feb 10 '21 18:02 tamersalama

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 [email protected]. 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! 🍵

echarts-bot[bot] avatar Feb 10 '21 18:02 echarts-bot[bot]

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.

tamersalama avatar Mar 11 '21 03:03 tamersalama

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

lambo-huang avatar Apr 30 '21 06:04 lambo-huang

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?

pramitchoudhary avatar Jan 04 '22 16:01 pramitchoudhary

really need this feature for line chart

@Ovilia

coolRoger avatar Aug 25 '22 03:08 coolRoger

Any news on this feature?

novablinkicelance avatar Nov 08 '22 03:11 novablinkicelance

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.

Ovilia avatar Nov 08 '22 04:11 Ovilia

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

howdyhyber avatar Jan 23 '23 08:01 howdyhyber

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:

wanghaiqiangk avatar May 12 '23 09:05 wanghaiqiangk

Hi, No fixe for this issue ?

Franck

Franck92700 avatar May 30 '23 10:05 Franck92700

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

alxnddr avatar Oct 11 '23 23:10 alxnddr

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

Ovilia avatar Feb 05 '24 11:02 Ovilia