QCustomPlot Discussion and Comments

Change line/color of selected graphReturn to overview

Hi,
I'm evaluating QCutomPlot 2.0.0beta with Qt 5.7 to use it in an oscilloscope application, so many graphs with different scales.

Question: how can I change color and thicness of selected graph(x) ? Is there a function setSelectableBasePen() for graph() as well as for Axis()?

Thanks,
Calzo

There are several examples using the QCPGraph::setPen function in the demos section. here is a small snippet from http://www.qcustomplot.com/index.php/demos/sincscatterdemo:

QPen pen;
pen.setWidth(1);
pen.setColor(QColor(180,180,180));
customPlot->graph(0)->setPen(pen);

Is this what you are looking for void QCPAbstractPlottable::setSelectionDecorator ( QCPSelectionDecorator * decorator) ?

setSelectionDecorator does exactly what I want.
Thanks.

By the way I have noticed that pen thicness of the graphs must be 0 (or 1) to avoid a fall down in performance (I replot every 50ms max). For now it's not a problem, but in the future could be.

Thanks again.

Also if you don't want to set decorator you can change current decorator properties with
QCPSelectionDecorator * QCPAbstractPlottable::selectionDecorator ( ) const

examples:

ui->customPlot->graph()->selectionDecorator()->setPen(QPen(Qt::green));
someGraph->selectionDecorator()->setPen(QPen(Qt::green));