echarts
echarts copied to clipboard
Brush (lineX, lineY) selection values are not available with line charts
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
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! 🍵
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 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?
really need this feature for line chart
@Ovilia
Any news on this feature?
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.
Is this still considered on the pipeline? this is a good feature if added.
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:
Hi, No fixe for this issue ?
Franck
Hey @Ovilia, I've created a fix for this. Could you please have a look? https://github.com/apache/echarts/pull/19193
@alxnddr Hi, I've commented on the PR. Please have a look. Thanks!