Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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.

    explain3.png
    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


Log in to reply