QCustomPlot Discussion and Comments

Replot Slowing Data downReturn to overview

I currently have 3 graphs on one form and replotting the 3 graphs consecutively temporarily slows down the entire form. Is there any chance that I could remove certain features from the plot that would enhance its speed. Here is what my plot looks like

        plot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
	
	plot->xAxis->setSubTickLength(3);
	plot->xAxis->setTickLength(10);
	plot->xAxis->setBasePen(QPen(Qt::white, 1));
	plot->yAxis->setBasePen(QPen(Qt::white, 1));
	plot->xAxis->setTickPen(QPen(Qt::white, 1));
	plot->yAxis->setTickPen(QPen(Qt::white, 1));
	plot->xAxis->setSubTickPen(QPen(Qt::white, 1));
	plot->yAxis->setSubTickPen(QPen(Qt::white, 1));
	plot->xAxis->setTickLabelColor(Qt::white);
	plot->yAxis->setTickLabelColor(Qt::white);
	plot->xAxis->setUpperEnding(QCPLineEnding::esSpikeArrow);
	plot->yAxis->setUpperEnding(QCPLineEnding::esSpikeArrow);
	plot->xAxis->grid()->setPen(QPen(QColor(140, 140, 140), 1, Qt::DotLine)); //Square 
	plot->yAxis->grid()->setPen(QPen(QColor(140, 140, 140), 1, Qt::DotLine));
	plot->xAxis->grid()->setSubGridPen(QPen(QColor(80, 80, 80), 1, Qt::DotLine));
	plot->yAxis->grid()->setSubGridPen(QPen(QColor(80, 80, 80), 1, Qt::DotLine));
	plot->xAxis->grid()->setSubGridVisible(true);
	plot->yAxis->grid()->setSubGridVisible(true);
	plot->xAxis->grid()->setZeroLinePen(Qt::NoPen);
	plot->yAxis->grid()->setZeroLinePen(Qt::NoPen);

	QLinearGradient plotGradient;
	plotGradient.setStart(0, 0);
	plotGradient.setFinalStop(0, 350);
	plotGradient.setColorAt(0, QColor(80, 80, 80));
	plotGradient.setColorAt(1, QColor(50, 50, 50));
	plot->setBackground(plotGradient);

	QLinearGradient axisRectGradient;
	axisRectGradient.setStart(0, 0);
	axisRectGradient.setFinalStop(0, 350);
	axisRectGradient.setColorAt(0, QColor(80, 80, 80));
	axisRectGradient.setColorAt(1, QColor(30, 30, 30));

	plot->axisRect()->setRangeDragAxes(plot->xAxis,plot->yAxis);

	plot->axisRect()->setBackground(axisRectGradient);
	plot->xAxis->setLabel("Strike");

	plot->xAxis->setAutoTickStep(false);
	plot->xAxis->setAutoSubTicks(false);
	plot->xAxis->setTickStep(x_min_diff);
	plot->xAxis->setSubTickCount(x_min_diff);

	plot->xAxis->setRange(strikes_x.at(strikes_x.size()-1)-x_min_diff,strikes_x.at(0)+x_min_diff);

	//Customize the ticks and sub-ticks on the x and y axis
	ui.LinePlot->yAxis->setAutoTickStep(true);
	ui.LinePlot->yAxis->setAutoSubTicks(false);

By replot slowing data down I mean its slowing the form down

1. Try to optimize your application code (not shown here) to minimize number of replots. If you use sequence of rescaleAxes and replot, try to minimize number of these.

2. Use profiler.