QChart in C++: How to get the y-axis value of more than one QLineseries at a time ?
-
Hi,
since some time i am trying to find out how i can get the y-axis value of different signal lines (=Qlineseries) in a QChart belonging to the same x-axis coordinates but did not find a way. I hope somebody can give me a hint.
To explain better what i mean please see the example chart above (text and circles added manually for explanation reasons)
The chart has 5 QLineSeries where each Series uses the same X-axis.
With the mouse i am pointing to eg. the QLineseries 1 line, get the X,Y position and the x,y value of the curve at that position (similar to the Callout example of Qchart), marked with a red circle here.
At the same time i draw a crosshair cursor at this position.
Now i want to know the y-axis value of all the other QLineseries at the point where they meet the x-coordinate of the light green crosshair cursor (marked with the red circle in this picture. This circle is not present in the orignal plot, its just for explanation)mapToValue does not help since i need the x and y coordinates which i have only for QLineSeries 1 but not for the other QLineSeries at this time. Only the x coordinate is available.
Since the different QLineSeries data have different sample times it is also not possible to say get the index of the value in QLineSeries1 and use the same index for all the other QLineSeries.
Also important to know is that the lines contain hughe amout of data (some MB) so checking each value of the different QLineSeries until it matches does not work because it will be slow. Another topic is that the values where the cursor is pointing to is interpolated out of the „real“ data in the QLineSeries. Which means the exact x-axis value may not be found in the other QLineSeries real data.Thank you for reading the long explanation text. Hopefully someone can give me ideas how to implement.
Best regards,
Bruno -
Hi,
I'm just evaluating Qt Charts for a similar use case that your are describing. Did you solve the issue in the meantime?
An idea might be that you track the different multiples of your sampling rate. So if Line1 has 100 and Line2 has 20 you have a factor of 1/5 that gives you the index of Line2 in case you Crosshair cursor is linked to Line1. If your sampling rate is not certain multiple you probably can only do a search for the right index given from the (time?) value of the x-axis.I haven't checked other Qt Chars possibilities yet. Maybe there is a sort of tracker mechanism that allows you to do so. Some other people answered to similar questions that this example https://www3.sra.co.jp/qt/relation/doc/qtcharts/qtcharts-callout-example.html might be a good starting point for a solution.
Please let me know if you found a good approach.
Best Regards
Markus