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

Multyplying QChart Legends By a constant



  • Hi everyone!

    Im working on an aplication that makes Graphs about Scattering parameters.

    This graphs may be in function of the frequency, or in function of the time.
    Frecuencies go from Hz to GigaHz
    Seconds go from Seconds to nanoseconds.

    In my program, I express all of the Frecuencies on Hertz, and all of the Times on seconds, using a double variable.

    That means, that If i want to store 10 ns, my variable woluld be 0,00000001
    If i want to store 5 MHz, my variable would be 5000000

    Here goes a screenshot of one of my graphs.

    0_1527530019204_Grafico.jpg

    This graph goes from -1.3 ns to 1.3 ns

    The question.

    I would like the legend to show exactly that "-1.3 to 1.3" and the on the AxisX I would write (Time [ns])
    Basically, I would need all of the text in the labels to be multiplied by 1000000000.

    I know that this could be done differently. When im adding the points, I could simply multiply each value with the constant. But thats not what I want.
    I want the points to be stored in the graph with their REAL value (on Hz, or Seconds, and loads of decimal points)
    I want the scale to show a smart value.
    What i mean by smart value?
    If the time is bigger than 1. Then leave the value and on the title express Seconds
    If the time is between 1 and 0.001, multiply it by 1000 and on the title express Miliseconds
    If the time is between 0.001 and 0.000001. multiply it by 1000000 and on the title express Microseconds

    I need a way to alter the labels without editing the information of each point.

    Any ideas? Could someone point me in the correct direction?
    Thanks in advance


Log in to reply