本文整理汇总了C++中QwtPlotGrid::setMinorPen方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotGrid::setMinorPen方法的具体用法?C++ QwtPlotGrid::setMinorPen怎么用?C++ QwtPlotGrid::setMinorPen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotGrid
的用法示例。
在下文中一共展示了QwtPlotGrid::setMinorPen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: populate
void Plot::populate()
{
QwtPlotGrid *grid = new QwtPlotGrid();
grid->setMinorPen( Qt::black, 0, Qt::DashLine );
grid->enableXMin( true );
grid->attach( this );
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setTitle("Some Points");
curve->setPen( Qt::blue, 4 ),
curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
QwtSymbol *symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::yellow ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
curve->setSymbol( symbol );
QPolygonF points;
points << QPointF( 10.0, 4.4 )
<< QPointF( 100.0, 3.0 ) << QPointF( 200.0, 4.5 )
<< QPointF( 300.0, 6.8 ) << QPointF( 400.0, 7.9 )
<< QPointF( 500.0, 7.1 ) << QPointF( 600.0, 7.9 )
<< QPointF( 700.0, 7.1 ) << QPointF( 800.0, 5.4 )
<< QPointF( 900.0, 2.8 ) << QPointF( 1000.0, 3.6 );
curve->setSamples( points );
curve->attach( this );
}
示例2: QwtPlot
Plot::Plot( QWidget *parent ):
QwtPlot( parent )
{
setAutoFillBackground( true );
setPalette( Qt::darkGray );
setCanvasBackground( Qt::white );
plotLayout()->setAlignCanvasToScales( true );
initAxis( QwtAxis::yLeft, "Local Time", Qt::LocalTime );
initAxis( QwtAxis::yRight,
"Coordinated Universal Time ( UTC )", Qt::UTC );
QwtPlotPanner *panner = new QwtPlotPanner( canvas() );
QwtPlotMagnifier *magnifier = new QwtPlotMagnifier( canvas() );
for ( int axis = 0; axis < QwtAxis::PosCount; axis++ )
{
const bool on = QwtAxis::isYAxis( axis );
setAxisVisible( axis, on );
panner->setAxisEnabled( axis, on );
magnifier->setAxisEnabled( axis, on );
}
QwtPlotGrid *grid = new QwtPlotGrid();
grid->setMajorPen( Qt::black, 0, Qt::SolidLine );
grid->setMinorPen( Qt::gray, 0 , Qt::SolidLine );
grid->enableX( false );
grid->enableXMin( false );
grid->enableY( true );
grid->enableYMin( true );
grid->attach( this );
}
示例3: QwtPlot
// MyPlot2D::MyPlot2D(QWidget *parent, const char *name)
MyPlot2D::MyPlot2D( QWidget *parent ):
QwtPlot(parent) {
setAutoReplot( false );
setTitle( "Comparison of WATER FIT against Measurements" );
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setBorderRadius( 10 );
setCanvas( canvas );
setCanvasBackground( QColor( "LightGray" ) );
// legend
// QwtLegend *legend = new QwtLegend;
// insertLegend( legend, QwtPlot::BottomLegend );
// grid
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableXMin( true );
grid->setMajorPen( Qt::white, 0, Qt::DotLine );
grid->setMinorPen( Qt::gray, 0 , Qt::DotLine );
grid->attach( this );
// axes
enableAxis( QwtPlot::yRight );
setAxisTitle( QwtPlot::xBottom, "Distance from CAX (cm)" );
setAxisTitle( QwtPlot::yLeft, "Relative Output Factor" );
// setAxisTitle( QwtPlot::yRight, "Phase [deg]" );
// setAxisMaxMajor( QwtPlot::xBottom, 6 );
// setAxisMaxMinor( QwtPlot::xBottom, 9 );
// setAxisScaleEngine( QwtPlot::xBottom, new QwtLogScaleEngine );
setAutoReplot( true );
}
示例4: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//-----------------------------------------------------
vBox = new QWidget;
vBox->setWindowTitle( "Графік температури" );
TempPlot *plot = new TempPlot;
plot->setParent(this);
plot->setTitle( "Графік температури" );
QwtPlotGrid *grid;
grid = new QwtPlotGrid;
grid->enableXMin(true);
grid->setMajorPen(QPen(Qt::gray,0,Qt::DashLine));
grid->setMinorPen((QPen(Qt::gray,0,Qt::DotLine)));
grid->attach(plot);
QwtPlotZoomer *zoom;
zoom = new QwtPlotZoomer(plot->canvas());
zoom->setRubberBandPen(QPen(Qt::white));
const int margin = 1;
plot->setContentsMargins( margin, margin, margin, margin );
QVBoxLayout *layout = new QVBoxLayout( vBox );
layout->addWidget( plot );
vBox->resize( 650, 330);
//-----------------------------------------------------
vBox2 = new QWidget;
vBox2->setWindowTitle( "Графік рівня радіосигналу");
RssiPlot *plot2 = new RssiPlot;
plot2->setParent(this);
plot2->setTitle( "Графік рівня радіосигналу" );
QwtPlotGrid *grid2;
grid2 = new QwtPlotGrid;
grid2->enableXMin(true);
grid2->setMajorPen(QPen(Qt::gray,0,Qt::DashLine));
grid2->setMinorPen((QPen(Qt::gray,0,Qt::DotLine)));
grid2->attach(plot2);
QwtPlotZoomer *zoom2;
zoom2 = new QwtPlotZoomer(plot2->canvas());
zoom2->setRubberBandPen(QPen(Qt::white));
const int margin2 = 1;
plot2->setContentsMargins( margin2, margin2, margin2, margin2 );
QVBoxLayout *layout2 = new QVBoxLayout( vBox2 );
layout2->addWidget( plot2 );
vBox2->resize( 650, 330 );
//-----------------------------------------------------
timer = new QTimer(this);
serial = new QSerialPort(this);
QString str;
foreach (const QSerialPortInfo &serialPortInfo, QSerialPortInfo::availablePorts()) {
str=serialPortInfo.portName();
ui->comboBox_2->addItem(str);
}
示例5: QwtPlot
MavPlot::MavPlot(QWidget *parent) : QwtPlot(parent), _havePrintColors(false) {
setAutoReplot(false);
setTitle("MAV System Data Plot");
setCanvasBackground(QColor(Qt::darkGray));
// legend
QwtLegend *legend = new QwtLegend;
insertLegend(legend, QwtPlot::BottomLegend);
#if (QWT_VERSION < QWT_VERSION_CHECK(6,1,0))
legend->setItemMode(QwtLegend::ClickableItem);
connect(this, SIGNAL(legendClicked(QwtPlotItem*)), SLOT(legendClicked(QwtPlotItem*)));
#else
legend->setDefaultItemMode(QwtLegendData::Clickable);
connect(legend, SIGNAL(clicked(const QVariant&, int)), SLOT(legendClickedNew(const QVariant&, int)));
#endif
// grid
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableXMin(true);
#if (QWT_VERSION < QWT_VERSION_CHECK(6,1,0))
grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
grid->setMinPen(QPen(QColor(0x8, 0x8, 0x8), 0 , Qt::DotLine));
#else
grid->setMajorPen(QPen(Qt::gray, 0, Qt::DotLine));
grid->setMinorPen(QPen(QColor(0x8, 0x8, 0x8), 0 , Qt::DotLine));
#endif
grid->attach(this);
// axes
//enableAxis(QwtPlot::yRight);
setAxisTitle(QwtPlot::xBottom, "time");
setAxisScaleDraw(QwtPlot::xBottom, new HumanReadableTime()); // no need to de-alloc or store, plot does it
// A-B markers
for (int i=0; i<2; i++) {
_user_markers[i].setLineStyle(QwtPlotMarker::VLine);
_user_markers[i].setLabelAlignment(Qt::AlignRight | Qt::AlignBottom);
_user_markers[i].setLinePen(QPen(QColor(255, 140, 0), 0, Qt::SolidLine));
_user_markers_visible[i] = false;
}
_user_markers[0].setLabel(QwtText("A"));
_user_markers[1].setLabel(QwtText("B"));
// data marker
_data_marker.setLineStyle(QwtPlotMarker::VLine);
_data_marker.setLinePen(QPen(QColor(255, 160, 47), 2, Qt::SolidLine));
_data_marker.setLabel(QwtText("data"));
_data_marker.setLabelAlignment(Qt::AlignTop | Qt::AlignRight);
_data_marker_visible = false;
_data_marker.setZ(9999); // higher value -> paint on top of everything else
setAutoReplot(true);
}
示例6: plot
void MQwt::plot()
{
mPlot = new QwtPlot(&mMain);
mPlot->setCanvasBackground(QColor("White"));
mPlot->setAutoReplot(true);
// Grid; optional but I like them
QwtPlotGrid *grid = new QwtPlotGrid;
grid->attach(mPlot);
grid->setMajorPen(Qt::black, 0, Qt::DotLine);
grid->setMinorPen(Qt::gray, 0, Qt::DotLine);
mMain.setCentralWidget(mPlot);
mMain.show();
}
示例7: createSpectrumPlot
void SpectrumWindow::createSpectrumPlot()
{
m_pSpectrumPlot = new QwtPlot();
m_pSpectrumPlot->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
m_pSpectrumPlot->setMinimumSize(0, 0);
m_pSpectrumPlot->setBaseSize(0, 0);
m_pSpectrumPlot->enableAxis(QwtPlot::xBottom, true);
m_pSpectrumPlot->enableAxis(QwtPlot::yLeft, true);
QwtLogScaleEngine *pLogScale = new QwtLogScaleEngine();
m_pSpectrumPlot->setAxisScaleEngine(QwtPlot::xBottom, pLogScale);
m_pSpectrumPlot->setAxisAutoScale(QwtPlot::xBottom, false);
m_pSpectrumPlot->setAxisScale(QwtPlot::xBottom, cMinFrequency, cMaxFrequency);
m_pSpectrumPlot->setAxisFont(QwtPlot::xBottom, cAxisFont);
m_pSpectrumPlot->setAxisFont(QwtPlot::yLeft, cAxisFont);
m_pSpectrumPlot->setCanvasBackground(QColor(19, 19, 22));
dynamic_cast<QwtPlotCanvas*>(m_pSpectrumPlot->canvas())->setFrameShadow(QFrame::Plain);
m_pSpectrumPicker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
QwtPicker::CrossRubberBand,
QwtPicker::AlwaysOn,
m_pSpectrumPlot->canvas());
m_pSpectrumPicker->setTrackerPen(QColor(128, 255, 255));
QwtText title(tr("Frequency, Hz"));
title.setFont(cAxisTitleFont);
title.setColor(cAxisTitleColor);
m_pSpectrumPlot->setAxisTitle(QwtPlot::xBottom, title);
m_pSpectrumPlot->setAxisAutoScale(QwtPlot::yLeft, false);
//m_pSpectrumPlot->setAxisScale(QwtPlot::yLeft, 0.0, 1.0);
m_pSpectrumPlot->setAxisScale(QwtPlot::yLeft, cDbScale, 0.0);
m_yAxisScale = 1.0;
QwtPlotGrid *pGrid = new QwtPlotGrid();
pGrid->enableXMin(true);
pGrid->setMajorPen(Qt::darkGray, 0, Qt::DotLine);
pGrid->setMinorPen(Qt::gray, 0, Qt::DotLine);
pGrid->attach(m_pSpectrumPlot);
QPen pen;
pen.setColor(cSpectrumColor);
pen.setWidthF(1.0f);
m_pSpectrumCurve = new QwtPlotCurve();
m_pSpectrumCurve->setPen(pen);
m_pSpectrumCurve->setBrush(cSpectrumFillColor);
m_pSpectrumCurve->setBaseline(cDbScale - 50); // Add offset to compensate plot margins
m_pSpectrumCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
m_pSpectrumCurve->attach(m_pSpectrumPlot);
}
示例8: main
int main( int argc, char **argv )
{
//using HistogramItem = QwtPlotItem;
using HistogramItem = QwtPlotHistogram;
//using QwtIntervalData = QwtSeriesData<QwtIntervalSample>;
QApplication a(argc, argv);
QwtPlot plot;
plot.setCanvasBackground(QColor(Qt::white));
plot.setTitle("Histogram");
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableXMin(true);
grid->enableYMin(true);
grid->setMajorPen(QPen(Qt::black, 0, Qt::DotLine));
grid->setMinorPen(QPen(Qt::gray, 0 , Qt::DotLine));
grid->attach(&plot);
HistogramItem *histogram = new HistogramItem;
//histogram->setColor(Qt::darkCyan);
const int numValues = 20;
//QwtArray<QwtDoubleInterval> intervals(numValues);
QwtArray<QwtIntervalSample> intervals(numValues);
QwtArray<double> values(numValues);
double pos = 0.0;
for ( int i = 0; i < (int)intervals.size(); i++ )
{
//const int width = 5 + rand() % 15;
const int value = rand() % 100;
//intervals[i] = QwtDoubleInterval(pos, pos + double(width));
intervals[i] = QwtIntervalSample(value, pos, pos + double(width));
//values[i] = value;
pos += width;
}
//histogram->setData(QwtIntervalData(intervals, values));
histogram->setSamples(intervals);
//histogram->setSamples(QwtIntervalData(intervals, values));
//QwtIntervalData d;
//histogram->setData(d);
histogram->attach(&plot);
plot.setAxisScale(QwtPlot::yLeft, 0.0, 100.0);
plot.setAxisScale(QwtPlot::xBottom, 0.0, pos);
plot.replot();
plot.resize(600,400);
plot.show();
return a.exec();
}
示例9: area
Plot::Plot( QWidget *parent, const QwtInterval &interval ):
QwtPlot( parent )
{
for ( int axis = 0; axis < QwtPlot::axisCnt; axis ++ )
setAxisScale( axis, interval.minValue(), interval.maxValue() );
setCanvasBackground( QColor( Qt::darkBlue ) );
plotLayout()->setAlignCanvasToScales( true );
// grid
QwtPlotGrid *grid = new QwtPlotGrid;
//grid->enableXMin(true);
grid->setMajorPen( Qt::white, 0, Qt::DotLine );
grid->setMinorPen( Qt::gray, 0 , Qt::DotLine );
grid->attach( this );
const int numEllipses = 10;
for ( int i = 0; i < numEllipses; i++ )
{
const double x = interval.minValue() +
qrand() % qRound( interval.width() );
const double y = interval.minValue() +
qrand() % qRound( interval.width() );
const double r = interval.minValue() +
qrand() % qRound( interval.width() / 6 );
const QRectF area( x - r, y - r , 2 * r, 2 * r );
RectItem *item = new RectItem( RectItem::Ellipse );
item->setRenderHint( QwtPlotItem::RenderAntialiased, true );
item->setRect( area );
item->setPen( QPen( Qt::yellow ) );
item->attach( this );
}
TextItem *textItem = new TextItem();
textItem->setText( "Navigation Example" );
textItem->attach( this );
d_rectOfInterest = new RectItem( RectItem::Rect );
d_rectOfInterest->setPen( Qt::NoPen );
QColor c = Qt::gray;
c.setAlpha( 100 );
d_rectOfInterest->setBrush( QBrush( c ) );
d_rectOfInterest->attach( this );
}
示例10: chartSetting
void panelControlMotor::chartSetting()
{
QwtPlotGrid *grid = new QwtPlotGrid();
ui->chartTemp->setAutoReplot(true);
grid->setMinorPen(QPen(Qt::gray, 0, Qt::DotLine));
grid->setMajorPen(QPen(Qt::gray, 0, Qt::DotLine));
grid->enableX(true);
grid->enableY(true);
grid->attach(ui->chartTemp);
temperature = new QwtPlotCurve();
temperature->setTitle("temperature");
temperature->setPen(Qt::black, 2, Qt::SolidLine);
temperature->setRenderHint(QwtPlotItem::RenderAntialiased, true);
temperature->attach(ui->chartTemp);
}
示例11: throw
HarmPlot::HarmPlot(const QString& aDir, IRInfo anIi, QWidget *parent) throw (QLE) : QwtPlot(parent)
{
this->setAttribute(Qt::WA_DeleteOnClose);
this->dir = aDir;
this->ii = anIi;
this->data = (HarmData**) new char[sizeof(HarmData*) * (MAX_HARM - 1)];
this->setAutoReplot(false);
this->setCanvasBackground(BG_COLOR);
this->setAxisScale(QwtPlot::yLeft, -120.0, 20.0);
this->setAxisMaxMajor(QwtPlot::yLeft, 7);
this->setAxisMaxMinor(QwtPlot::yLeft, 10);
this->setAxisMaxMajor(QwtPlot::xBottom, 6);
this->setAxisMaxMinor(QwtPlot::xBottom, 10);
#if QWT_VERSION > 0x060000
QwtLogScaleEngine* logEngine = new QwtLogScaleEngine(10.0);
#else
QwtLog10ScaleEngine* logEngine = new QwtLog10ScaleEngine();
#endif
this->setAxisScaleEngine(QwtPlot::xBottom, logEngine);
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);
this->addCurves();
QwtPlotPanner* panner = new QwtPlotPanner(this->canvas());
panner->setMouseButton(Qt::MidButton);
panner->setEnabled(true);
this->setAutoReplot(true);
}
示例12: createWaveformPlot
void SpectrumWindow::createWaveformPlot()
{
m_pWaveformPlot = new QwtPlot();
m_pWaveformPlot->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
m_pWaveformPlot->setMinimumSize(0, 0);
m_pWaveformPlot->setBaseSize(0, 0);
m_pWaveformPlot->enableAxis(QwtPlot::xBottom, true);
m_pWaveformPlot->enableAxis(QwtPlot::yLeft, true);
m_pWaveformPlot->setAxisFont(QwtPlot::xBottom, cAxisFont);
QwtText title(tr("Time, ms"));
title.setFont(cAxisTitleFont);
title.setColor(cAxisTitleColor);
m_pWaveformPlot->setAxisTitle(QwtPlot::xBottom, title);
m_pWaveformPlot->setAxisFont(QwtPlot::yLeft, cAxisFont);
m_pWaveformPlot->setAxisAutoScale(QwtPlot::yLeft, false);
m_pWaveformPlot->setAxisScale(QwtPlot::yLeft, -1.0, 1.0);
m_pWaveformPlot->setCanvasBackground(QColor(32, 24, 16));
dynamic_cast<QwtPlotCanvas*>(m_pWaveformPlot->canvas())->setFrameShadow(QFrame::Plain);
m_pWaveformPicker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
QwtPicker::CrossRubberBand,
QwtPicker::AlwaysOn,
m_pWaveformPlot->canvas());
m_pWaveformPicker->setTrackerPen(QColor(255, 255, 128));
QwtPlotGrid *pGrid = new QwtPlotGrid();
pGrid->enableXMin(true);
pGrid->setMajorPen(Qt::darkGray, 0, Qt::DotLine);
pGrid->setMinorPen(Qt::gray, 0, Qt::DotLine);
pGrid->attach(m_pWaveformPlot);
QPen pen;
pen.setColor(cWaveformColor);
pen.setWidthF(1.5f);
m_pWaveformCurve = new QwtPlotCurve();
m_pWaveformCurve->setPen(pen);
m_pWaveformCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
m_pWaveformCurve->attach(m_pWaveformPlot);
}
示例13: 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);
}
示例14: populate
void Histograma::populate(QImage *img)
{
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableX(false);
grid->enableY(true);
grid->enableXMin(true);
grid->enableYMin(true);
grid->setMajorPen(QPen(Qt::black, 0, Qt::DotLine));
grid->setMinorPen(QPen(Qt::gray, 0, Qt::DotLine));
grid->attach(this);
int cinza, mQtd = 0;
int x, y;
// Quantidade de pontos de 0 a 255
const int pts = 256;
QVector<float> valores(pts);
// inicializa os valores com 0
for (int i = 0; i < pts; i++)
valores[i] = 0.0;
for (x = 0; x < img->width(); x++) {
for (y = 0; y < img->height(); y++) {
cinza = qGray(img->pixel(QPoint(x,y)));
valores[cinza]++;
if (valores[cinza] > mQtd)
mQtd = valores[cinza];
}
}
Histogram *hist = new Histogram("", Qt::black);
hist->setValues(pts, &valores);
hist->attach(this);
this->replot();
}
示例15: Plots_Create
//---------------------------------------------------------------------------
void Plots::Plots_Create(PlotType Type)
{
// Paddings
if (paddings[Type]==NULL)
{
paddings[Type]=new QWidget(this);
paddings[Type]->setVisible(false);
}
// General design of plot
QwtPlot* plot = new QwtPlot(this);
plot->setVisible(false);
plot->setMinimumHeight(1);
plot->enableAxis(QwtPlot::xBottom, Type==PlotType_Axis);
plot->setAxisMaxMajor(QwtPlot::yLeft, 0);
plot->setAxisMaxMinor(QwtPlot::yLeft, 0);
plot->setAxisScale(QwtPlot::xBottom, 0, FileInfoData->Videos[0]->x_Max[XAxis_Kind_index]);
if (PerPlotGroup[Type].Count>3)
plot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// Plot grid
QwtPlotGrid *grid = new QwtPlotGrid();
grid->enableXMin(true);
grid->enableYMin(true);
grid->setMajorPen(Qt::darkGray, 0, Qt::DotLine );
grid->setMinorPen(Qt::gray, 0 , Qt::DotLine );
grid->attach(plot);
// Plot curves
for(unsigned j=0; j<PerPlotGroup[Type].Count; ++j)
{
plotsCurves[Type][j] = new QwtPlotCurve(PerPlotName[PerPlotGroup[Type].Start+j].Name);
QColor c;
switch (PerPlotGroup[Type].Count)
{
case 1 :
switch (Type)
{
case PlotType_YDiff: c=Qt::darkGreen; break;
case PlotType_UDiff: c=Qt::darkBlue; break;
case PlotType_VDiff: c=Qt::darkRed; break;
default: c=Qt::black;
}
break;
case 2 :
switch (j)
{
case 0: c=Qt::darkGreen; break;
case 1: c=Qt::darkRed; break;
default: c=Qt::black;
}
break;
case 3 :
switch (j)
{
case 0: c=Qt::darkRed; break;
case 1: c=Qt::darkBlue; break;
case 2: c=Qt::darkGreen; break;
default: c=Qt::black;
}
break;
case 5 :
switch (j)
{
case 0: c=Qt::red; break;
case 1: c=QColor::fromRgb(0x00, 0x66, 0x00); break; //Qt::green
case 2: c=Qt::black; break;
case 3: c=Qt::green; break;
case 4: c=Qt::red; break;
default: c=Qt::black;
}
break;
default: c=Qt::black;
}
plotsCurves[Type][j]->setPen(c);
plotsCurves[Type][j]->setRenderHint(QwtPlotItem::RenderAntialiased);
plotsCurves[Type][j]->setZ(plotsCurves[Type][j]->z()-j); //Invert data order (e.g. MAX before MIN)
plotsCurves[Type][j]->attach(plot);
}
// Legends
QwtLegend *legend = new QwtLegend(this);
legend->setVisible(false);
legend->setMinimumHeight(1);
legend->setMaxColumns(1);
QFont Font=legend->font();
#ifdef _WIN32
Font.setPointSize(6);
#else // _WIN32
Font.setPointSize(8);
#endif //_WIN32
legend->setFont(Font);
connect(plot, SIGNAL(legendDataChanged(const QVariant &, const QList<QwtLegendData> &)), legend, SLOT(updateLegend(const QVariant &, const QList<QwtLegendData> &)));
plot->updateLegend();
// Assignment
plots[Type]=plot;
//.........这里部分代码省略.........