本文整理汇总了C++中QwtPlotCurve::setYAxis方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotCurve::setYAxis方法的具体用法?C++ QwtPlotCurve::setYAxis怎么用?C++ QwtPlotCurve::setYAxis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotCurve
的用法示例。
在下文中一共展示了QwtPlotCurve::setYAxis方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QwtPlotCurve
QwtPlotCurve * PlotViewWidget::addCurveData(WaveformData *curveData, bool secondary, QColor col)
{
maWaveformData << curveData;
QwtPlotCurve *waveCurve = new QwtPlotCurve("dummy");
waveCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
waveCurve->setPen(QPen(col));
waveCurve->setSamples( curveData );
maCurves << waveCurve;
waveCurve->attach(this);
if( !mSecondaryAxis || maCurves.length() == 0 ) // no secondary axis or just one plot
{
replot();
setAxisScaleDiv(QwtPlot::yRight, axisScaleDiv(QwtPlot::yLeft));
replot();
}
else
{
if(secondary)
{
setAxisAutoScale(QwtPlot::yRight);
waveCurve->setYAxis(QwtPlot::yRight);
}
else
{
waveCurve->setYAxis(QwtPlot::yLeft);
}
}
repaint();
return waveCurve;
}
示例2: addCurves
void HarmPlot::addCurves() throw (QLE)
{
Harmonics* harmonics = new Harmonics(this->dir, this->ii);
for(int i=0; i <= MAX_HARM - 2; i++) {
this->data[i] = harmonics->getHarm(i+2); // begin from second harmonic
if( ! this->data[i])
continue; // have not more harmonic in IR
QString name = "Harmonic";
name += i;
QwtPlotCurve* curve = new QwtPlotCurve(name);
curve->setPen(QPen(HARM_COLORS[i]));
curve->setYAxis(QwtPlot::yLeft);
curve->attach(this);
curve->setSamples(this->data[i]->freqs, this->data[i]->values, this->data[i]->length);
}
delete harmonics;
}
示例3: throw
IRPlot::IRPlot(const QString& aDir, IRInfo anIi, QWidget *parent) throw (QLE) : QwtPlot(parent)
{
this->dir = aDir;
this->ii = anIi;
this->time = 0;
this->amps = 0;
this->setAutoReplot(false);
this->setCanvasBackground(BG_COLOR);
unsigned curveLength = this->calculate();
this->setAxisScale( xBottom, this->time[0], this->time[curveLength-1]);
this->setAxisAutoScale( xBottom);
this->setAxisScale( yLeft, -1.5, 1.5);
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableXMin(true);
#if QWT_VERSION > 0x060000
grid->setMajorPen(QPen(MAJ_PEN_COLOR, 0, Qt::DotLine));
grid->setMinorPen(QPen(MIN_PEN_COLOR, 0 , Qt::DotLine));
#else
grid->setMajPen(QPen(MAJ_PEN_COLOR, 0, Qt::DotLine));
grid->setMinPen(QPen(MIN_PEN_COLOR, 0 , Qt::DotLine));
#endif
grid->attach(this);
QwtPlotCurve* ampCurve = new QwtPlotCurve("IR_Plot");
ampCurve->setPen(QPen(AMP_CURVE_COLOR));
ampCurve->setYAxis(QwtPlot::yLeft);
ampCurve->attach(this);
ampCurve->setSamples(this->time, this->amps, curveLength);
QwtPlotPanner* panner = new QwtPlotPanner(this->canvas());
panner->setMouseButton(Qt::MidButton);
panner->setEnabled(true);
this->setAutoReplot(true);
}
示例4: linePlotData
void LinePlot::linePlotData(LinePlotData::Ptr data, const std::string& name, QColor color, double offset )
{
if (!data) return;
// set based on data - record overall min and max
if ( (data->minX() < m_xAxisMin) || (data->maxX() > m_xAxisMax) )
{
if (data->minX() < m_xAxisMin) m_xAxisMin = data->minX();
if (data->maxX() > m_xAxisMax) m_xAxisMax = data->maxX();
}
if (numberOfCurves() == 0)
{
m_lineThickness = 10;
}
/// todo - curve collection - shared pointers
QwtPlotCurve * curve = new QwtPlotCurve(toQString(name));
if (color == Qt::color0)
{ // generate new color from color map
color = curveColor(m_lastColor);
m_lastColor = color;
}
curve->setPen(curvePen(color));
curve->attach(m_qwtPlot);
curve->setData(*data);
// check for number of different units (std::string based)
QString curveUnits = toQString(data->units());
if (m_leftAxisUnits == "NONE SPECIFIED")
{
m_leftAxisUnits = curveUnits;
this->leftAxisTitleFromUnits(toString(m_leftAxisUnits));
curve->setYAxis(QwtPlot::yLeft);
m_qwtPlot->enableAxis(QwtPlot::yRight, false);
}
else if (m_leftAxisUnits.toUpper() == curveUnits.toUpper())
{
curve->setYAxis(QwtPlot::yLeft);
m_qwtPlot->enableAxis(QwtPlot::yRight, false);
}
else if (m_rightAxisUnits == "NONE SPECIFIED")
{
m_rightAxisUnits = curveUnits;
this->rightAxisTitleFromUnits(toString(m_rightAxisUnits));
curve->setYAxis(QwtPlot::yRight);
m_qwtPlot->enableAxis(QwtPlot::yRight, true);
}
else if (m_rightAxisUnits.toUpper() == curveUnits.toUpper())
{
curve->setYAxis(QwtPlot::yRight);
m_qwtPlot->enableAxis(QwtPlot::yRight, true);
}
else // more than 2 units - scale all curves
{
scaleCurves(curve);
m_qwtPlot->enableAxis(QwtPlot::yRight, false);
this->leftAxisTitle("Scaled");
}
/// update legend and replot
showCurve(curve, true);
// initZoomer();
}