Solved QtCharts : put min and max of y-axis manually
-
Hello everyone,
Does someone know how can I set the min-max of y-axis from the QchartView (GUI) ?
Thanks for your help
-
Is it a good idea to pop up a dialog outside QChartView or by right click inside QChartView to set ranges of X-Y axes
-
@joecfd Hello,thanks for your reply
yes why not it is an intermediate solution, but I wonder if it is possible to change the values directly on the ChartView :) -
You are probably looking for this QAbstactAxis#setRange.
-
@pl45m4
yes absolutely i need to use QAbstactAxis#setRange from the view.For this I guess that I have to use paintEvent, to draw a LineEdit for the min and max, like this I can put the new min/max .
-
@halima said in QtCharts : put min and max of y-axis manually:
For this I guess that I have to use paintEvent, to draw a LineEdit for the min and max, like this I can put the new min/max
No. Just get your current Y-Axis from your QChart and set your values as new range (Min, Max).
QAbstractAxis *yAxis = myChart->axis(Qt::Vertical); // Only works, if you have 1 series, otherwise you have to pass the series after the orientation yAxis->setRange(min, max);
-
@pl45m4
Thanks for your help and reply :)
I think I'm not explained my problem well. my problem is more in the HMI. how can I write the min and max that I want in the Qchartview to pass them to QAbstactAxis#setRange. -
-
@pl45m4 Ok thanks a lot ;)