QCustomPlot Discussion and Comments

Integers as x-axes valuesReturn to overview


I've searched for this topic in this board already, but I could not find a proper solution, especially for the current version.

My short question is: Is it possible, to create a graph which has doubles as y-axes-values and integers as x-axes values? I want to avoid that i have to cast the values to double because I have to work with these values of the plottable after the user clicks on the graph. So it is important that the values are not rounded or modified in any way.



The short answer is no if you use QCPGraph. That only works with doubles. The long answer is yes, but you will need to implement your own QCPAbstractPlottable.

Why don't you like rounding? There will be no loss of integer precision if you use qRound() to go back from graph doubles to the int in your system.

Thank you for your answers. i wanted to avoid converting from int to doubles and then converting from doubles to int. But qRound works fine for this moment.