void SaxsviewImage::setAxisTitleFont(const QFont& font) { for (int i = QwtPlot::yLeft; i < QwtPlot::axisCnt; ++i) { QwtText t = axisTitle(i); t.setFont(font); setAxisTitle(i, t); } }
void PeriodogramDisplay::handleUpdateAxis(void) { QString axisTitle("Hz"); double factor = std::max(_sampleRate, _centerFreq); if (factor >= 2e9) { factor = 1e9; axisTitle = "GHz"; } else if (factor >= 2e6) { factor = 1e6; axisTitle = "MHz"; } else if (factor >= 2e3) { factor = 1e3; axisTitle = "kHz"; } _mainPlot->setAxisTitle(QwtPlot::xBottom, axisTitle); _mainPlot->zoomer()->setAxis(QwtPlot::xBottom, QwtPlot::yLeft); _sampleRateWoAxisUnits = _sampleRate/factor; _centerFreqWoAxisUnits = _centerFreq/factor; const qreal freqLow = _fftModeComplex?(_centerFreqWoAxisUnits-_sampleRateWoAxisUnits/2):0.0; _mainPlot->setAxisScale(QwtPlot::xBottom, freqLow, _centerFreqWoAxisUnits+_sampleRateWoAxisUnits/2); _mainPlot->setAxisScale(QwtPlot::yLeft, _refLevel-_dynRange, _refLevel); _mainPlot->updateAxes(); //update after axis changes _mainPlot->zoomer()->setZoomBase(); //record current axis settings this->handleZoomed(_mainPlot->zoomer()->zoomBase()); //reload }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RiuSummaryQwtPlot::setDefaults() { QPalette newPalette(palette()); newPalette.setColor(QPalette::Background, Qt::white); setPalette(newPalette); setAutoFillBackground(true); setCanvasBackground(Qt::white); QFrame* canvasFrame = dynamic_cast<QFrame*>(canvas()); if (canvasFrame) { canvasFrame->setFrameShape(QFrame::NoFrame); } canvas()->setMouseTracking(true); canvas()->installEventFilter(this); QPen gridPen(Qt::SolidLine); gridPen.setColor(Qt::lightGray); m_grid->setPen(gridPen); enableAxis(QwtPlot::xBottom, true); enableAxis(QwtPlot::yLeft, true); enableAxis(QwtPlot::xTop, false); enableAxis(QwtPlot::yRight, false); plotLayout()->setAlignCanvasToScales(true); useDateBasedTimeAxis(); QFont xAxisFont = axisFont(QwtPlot::xBottom); xAxisFont.setPixelSize(11); setAxisFont(QwtPlot::xBottom, xAxisFont); setAxisMaxMinor(QwtPlot::xBottom, 2); QFont yAxisFont = axisFont(QwtPlot::yLeft); yAxisFont.setPixelSize(11); setAxisFont(QwtPlot::yLeft, yAxisFont); setAxisMaxMinor(QwtPlot::yLeft, 3); QwtText axisTitleY = axisTitle(QwtPlot::yLeft); QFont yAxisTitleFont = axisTitleY.font(); yAxisTitleFont.setPixelSize(11); yAxisTitleFont.setBold(false); axisTitleY.setFont(yAxisTitleFont); axisTitleY.setRenderFlags(Qt::AlignRight); setAxisTitle(QwtPlot::yLeft, axisTitleY); QwtLegend* legend = new QwtLegend(this); // The legend will be deleted in the destructor of the plot or when // another legend is inserted. this->insertLegend(legend, BottomLegend); }
QFont SaxsviewImage::axisTitleFont() const { return axisTitle(QwtPlot::xBottom).font(); }
QString SaxsviewImage::axisTitleZ() const { return axisTitle(QwtPlot::yRight).text(); }
void SaxsviewImage::setAxisTitleZ(const QString& text) { QwtText t = axisTitle(QwtPlot::yRight); t.setText(text); setAxisTitle(QwtPlot::yRight, t); }
QString SaxsviewImage::axisTitleY() const { return axisTitle(QwtPlot::yLeft).text(); }
QString SaxsviewImage::axisTitleX() const { return axisTitle(QwtPlot::xBottom).text(); }
void SaxsviewImage::setAxisTitleX(const QString& text) { QwtText t = axisTitle(QwtPlot::xBottom); t.setText(text); setAxisTitle(QwtPlot::xBottom, t); }