Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Selecting the axis markers in QChart
adamahl last edited by
I am using QtCharts and I am trying to figure out how to set the markers on the x- and y-axis to the values they are based on. With the code I have now the axis values are set with the default ticker I assume.
chart->legend()->hide(); chart->addSeries(motor_1); chart->createDefaultAxes(); chart->setTitle("Motor 1"); chart->setMargins(QMargins(0,0,0,0)); int max_x = *std::max_element(duration_list.begin(),duration_list.end()); chart->axisX()->setRange(0, round(max_x*1.1)); int max_y = *std::max_element(endvalue_list.begin(),endvalue_list.end()); chart->axisY()->setRange(0,round(max_y)); ui->gridLayout->addWidget(chartview); chartview->setRenderHint(QPainter::Antialiasing);
If the points I want too plot are (0,0),(5,0),(6,36),(30,36) I want markers on the x-axis with values; 0,5,6,30. And on the y-axis; 0,36.
Is there some setting that lets me set the axis values myself?