void DataSourceControlWidget::treatScatterSizeChanging() { if (mDataSource) { auto graphStyle = mDataSource->graphStyle(); auto scatterStyle = graphStyle->scatterStyle(); scatterStyle.setSize(ui->scatterSizeDoubleSpinBox->value()); graphStyle->setScatterStyle(scatterStyle); } }
void DataSourceControlWidget::treatScatterDecimationChanging() { if (mDataSource) { auto graphStyle = mDataSource->graphStyle(); auto scatterStyle = graphStyle->scatterStyle(); scatterStyle.setDecimation(ui->scatterDecimationSpinBox->value()); graphStyle->setScatterStyle(scatterStyle); } }
void DataSourceControlWidget::treatScatterShapeChanging() { if (mDataSource) { auto graphStyle = mDataSource->graphStyle(); auto scatterStyle = graphStyle->scatterStyle(); scatterStyle.setShape(std::get<0>(scatterShapeMap[ui->scatterShapeComboBox->currentIndex()])); graphStyle->setScatterStyle(scatterStyle); } }
/*! Constructs a curve which uses \a keyAxis as its key axis ("x") and \a valueAxis as its value axis ("y"). \a keyAxis and \a valueAxis must reside in the same QCustomPlot instance and not have the same orientation. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though. The constructed QCPCurve can be added to the plot with QCustomPlot::addPlottable, QCustomPlot then takes ownership of the graph. */ QCPCurve::QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis) : QCPAbstractPlottable(keyAxis, valueAxis) { mData = new QCPCurveDataMap; mPen.setColor(Qt::blue); mPen.setStyle(Qt::SolidLine); mBrush.setColor(Qt::blue); mBrush.setStyle(Qt::NoBrush); mSelectedPen = mPen; mSelectedPen.setWidthF(2.5); mSelectedPen.setColor(QColor(80, 80, 255)); // lighter than Qt::blue of mPen mSelectedBrush = mBrush; setScatterStyle(QCPScatterStyle()); setLineStyle(lsLine); }
void qmlPlotPaintedItem::appendGraph(QQmlListProperty<qmlGraph> *list, qmlGraph *pdt) { auto& info = Info(list); auto& m_CustomPlot = *info.plot; info.m_graphs.append(pdt); auto makeAxis = [&](QCPAxis* ref, QCPAxis::AxisType type, qmlAxis* qmlAx){ if (qmlAx) { if (!qmlAx->isDefault()) ref = m_CustomPlot.axisRect(0)->addAxis(type); ref->setVisible(qmlAx->isVisible()); if (auto label = qmlAx->getLabel()) { if (!label->getText().isEmpty()) ref->setLabel(label->getText()); if (label->getColor().isValid()) ref->setLabelColor(label->getColor()); if (!label->getFont().isEmpty()) { QFont axFont; axFont.fromString(label->getFont()); ref->setLabelFont(axFont); } } if (auto tick = qmlAx->getTick()) { if (!tick->getFont().isEmpty()) ref->setTickLabelFont(tick->getFont()); const auto& tickVec = tick->getTickVector(); if (!tickVec.empty()) { ref->setAutoTicks(false); ref->setTickVector(tickVec); } const auto& tickLab = tick->getTickLabels(); if (!tickLab.empty()) { ref->setAutoTickLabels(false); ref->setTickVectorLabels(tickLab); } } } return ref; }; auto graph = m_CustomPlot.addGraph( makeAxis(m_CustomPlot.xAxis, QCPAxis::atBottom, pdt->getXAxis()), makeAxis(m_CustomPlot.yAxis, QCPAxis::atLeft, pdt->getYAxis())); graph->setName(pdt->getName()); graph->setPen(pdt->getPen()->getPen()); graph->setLineStyle(pdt->getLineStyle()); if (auto scatterInfo = pdt->getScatter()) { graph->setScatterStyle(scatterInfo->getStyle()); } }