graphic
graphic copied to clipboard
How to get the converted chart values from interaction channel
When obtaining gesture signals from the interaction channel, we get some info such as the local position of the gesture, the type, etc.
However, what we need from this interaction channel is the actual chart values at the gesture position. Is there a way to obtain this data?
If any PR is necessary for this, we would love to make one :)
Thanks!
If the values you mentioned is the data values, you can use selection signal, which is set in element's selectionChannel: https://pub.dev/documentation/graphic/latest/graphic/GeomElement/selectionChannel.html
It will give you the index of the values and you can look up in the original data list.
If you mean any arbitrary values, there are invert methods inside the chart that can invert a chart position to data value but they are not exposed.
I think the easiest way is to to calculate your self with gesture position (since you know the range of coord positions and max and min data value), for example you know the coord width is from 5 to 95, and data is from 0 to 1, then a tap on 50 indicates value 0.5.
There needs a way to access and calculate all value status of the whole chain.