本文整理汇总了C++中QwtPlotCanvas::setFrameStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotCanvas::setFrameStyle方法的具体用法?C++ QwtPlotCanvas::setFrameStyle怎么用?C++ QwtPlotCanvas::setFrameStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotCanvas
的用法示例。
在下文中一共展示了QwtPlotCanvas::setFrameStyle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QwtPlot
Plotter::Plotter( QWidget *parent ):
QwtPlot( parent )
{
// Assign a title
setTitle( "WAVE DATA" );
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setFrameStyle( QFrame::Box | QFrame::Plain );
canvas->setLineWidth( 1 );
canvas->setPalette( Qt::white );
setCanvas( canvas );
alignScales();
// Insert grid
d_grid = new QwtPlotGrid();
d_grid->attach( this );
// Axis
setAxisTitle( QwtPlot::xBottom, "Time" );
// setAxisScale( QwtPlot::xBottom, -d_interval, 0.0 );
setAxisTitle( QwtPlot::yLeft, "Amplitude" );
// setAxisScale( QwtPlot::yLeft, -1.0, 1.0 );
resize(600, 350);
}
示例2: canvasPalette
BarChart::BarChart( QWidget *parent ):
QwtPlot( parent )
{
const struct
{
const char *distro;
const int hits;
QColor color;
} pageHits[] =
{
{ "Arch", 1114, QColor( "DodgerBlue" ) },
{ "Debian", 1373, QColor( "#d70751" ) },
{ "Fedora", 1638, QColor( "SteelBlue" ) },
{ "Mageia", 1395, QColor( "Indigo" ) },
{ "Mint", 3874, QColor( 183, 255, 183 ) },
{ "openSuSE", 1532, QColor( 115, 186, 37 ) },
{ "Puppy", 1059, QColor( "LightSkyBlue" ) },
{ "Ubuntu", 2391, QColor( "FireBrick" ) }
};
setAutoFillBackground( true );
setPalette( QColor( "Linen" ) );
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setLineWidth( 2 );
canvas->setFrameStyle( QFrame::Box | QFrame::Sunken );
canvas->setBorderRadius( 10 );
QPalette canvasPalette( QColor( "Plum" ) );
canvasPalette.setColor( QPalette::Foreground, QColor( "Indigo" ) );
canvas->setPalette( canvasPalette );
setCanvas( canvas );
setTitle( "DistroWatch Page Hit Ranking, April 2012" );
d_barChartItem = new DistroChartItem();
QVector< double > samples;
for ( uint i = 0; i < sizeof( pageHits ) / sizeof( pageHits[ 0 ] ); i++ )
{
d_distros += pageHits[ i ].distro;
samples += pageHits[ i ].hits;
d_barChartItem->addDistro(
pageHits[ i ].distro, pageHits[ i ].color );
}
d_barChartItem->setSamples( samples );
d_barChartItem->attach( this );
insertLegend( new QwtLegend() );
setOrientation( 0 );
setAutoReplot( false );
}
示例3: Plot
Plot( QWidget *parent = NULL ):
QwtPlot( parent )
{
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setLineWidth( 1 );
canvas->setFrameStyle( QFrame::Box | QFrame::Plain );
setCanvas( canvas );
}
示例4: setupExpoPlot
void ConfigStabilizationWidget::setupExpoPlot()
{
ui->expoPlot->setMouseTracking(false);
ui->expoPlot->setAxisScale(QwtPlot::xBottom, 0, 100, 25);
QwtText title;
title.setText(tr("Input %"));
title.setFont(ui->expoPlot->axisFont(QwtPlot::xBottom));
ui->expoPlot->setAxisTitle(QwtPlot::xBottom, title);
ui->expoPlot->setAxisScale(QwtPlot::yLeft, 0, 100, 25);
title.setText(tr("Output %"));
title.setFont(ui->expoPlot->axisFont(QwtPlot::yLeft));
ui->expoPlot->setAxisTitle(QwtPlot::yLeft, title);
QwtPlotCanvas *plotCanvas = dynamic_cast<QwtPlotCanvas *>(ui->expoPlot->canvas());
if (plotCanvas) {
plotCanvas->setFrameStyle(QFrame::NoFrame);
}
ui->expoPlot->canvas()->setCursor(QCursor());
m_plotGrid.setMajorPen(QColor(Qt::gray));
m_plotGrid.setMinorPen(QColor(Qt::lightGray));
m_plotGrid.enableXMin(false);
m_plotGrid.enableYMin(false);
m_plotGrid.attach(ui->expoPlot);
m_expoPlotCurveRoll.setRenderHint(QwtPlotCurve::RenderAntialiased);
QColor rollColor(Qt::red);
rollColor.setAlpha(180);
m_expoPlotCurveRoll.setPen(QPen(rollColor, 2));
m_expoPlotCurveRoll.attach(ui->expoPlot);
replotExpoRoll(ui->expoSpinnerRoll->value());
m_expoPlotCurveRoll.show();
QColor pitchColor(Qt::green);
pitchColor.setAlpha(180);
m_expoPlotCurvePitch.setRenderHint(QwtPlotCurve::RenderAntialiased);
m_expoPlotCurvePitch.setPen(QPen(pitchColor, 2));
m_expoPlotCurvePitch.attach(ui->expoPlot);
replotExpoPitch(ui->expoSpinnerPitch->value());
m_expoPlotCurvePitch.show();
QColor yawColor(Qt::blue);
yawColor.setAlpha(180);
m_expoPlotCurveYaw.setRenderHint(QwtPlotCurve::RenderAntialiased);
m_expoPlotCurveYaw.setPen(QPen(yawColor, 2));
m_expoPlotCurveYaw.attach(ui->expoPlot);
replotExpoYaw(ui->expoSpinnerYaw->value());
m_expoPlotCurveYaw.show();
}
示例5: canvasPalette
FrameNumberVisualizator::FrameNumberVisualizator(int duree,int dataFreq,int min, int max, QWidget *parent):
QWidget(parent),
duree_de_visualisation(duree),
frequency(dataFreq)
{
QHBoxLayout * mainLayout = new QHBoxLayout;
this->setLayout(mainLayout);
plot = new QwtPlot();
mainLayout->addWidget(plot,5);
//Axis
plot->enableAxis(QwtPlot::xBottom,false);
plot->setAxisScale( QwtPlot::xBottom, 0.0, duree_de_visualisation );
plot->setAxisScale( QwtPlot::yLeft, 0, 1000 );
// canvas
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setLineWidth( 1 );
canvas->setFrameStyle( QFrame::Box | QFrame::Plain );
canvas->setBorderRadius( 15 );
QPalette canvasPalette( Qt::white );
canvasPalette.setColor( QPalette::Foreground, QColor( 133, 190, 232 ) );
canvas->setPalette( canvasPalette );
plot->setCanvas( canvas );
curve = new QwtPlotCurve("frame");
curve->setRenderHint( QwtPlotItem::RenderAntialiased );
curve->setLegendAttribute( QwtPlotCurve::LegendShowLine, true );
curve->setPen( Qt::red );
curve->attach( plot );
timerReplot = new QTimer;
timerReplot->setInterval(50);
connect(timerReplot,SIGNAL(timeout()),plot,SLOT(replot()));
timerRescale = new QTimer;
timerRescale->setInterval(1000);
connect(timerRescale,SIGNAL(timeout()),SLOT(rescale()));
}
示例6: canvasPalette
Plot::Plot(QWidget *parent):
QwtPlot( parent )
{
setAutoFillBackground( true );
setPalette( QPalette( QColor( 165, 193, 228 ) ) );
updateGradient();
setTitle( "График аппроксимации" );
insertLegend( new QwtLegend(), QwtPlot::RightLegend );
// axes
setAxisTitle( xBottom, "" );
setAxisScale( xBottom, 0.0, 60.0 );
setAxisTitle( yLeft, "Функция принадлежности -->" );
setAxisScale( yLeft, -0.1, 1.1 );
// canvas
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setLineWidth( 1 );
canvas->setFrameStyle( QFrame::Box | QFrame::Plain );
canvas->setBorderRadius( 15 );
QPalette canvasPalette( Qt::white );
canvasPalette.setColor( QPalette::Foreground, QColor( 133, 190, 232 ) );
canvas->setPalette( canvasPalette );
setCanvas( canvas );
// panning with the left mouse button
//( void ) new QwtPlotPanner( canvas );
// zoom in/out with the wheel
( void ) new QwtPlotMagnifier( canvas );
zoom = new QwtPlotZoomer(canvas);
zoom->setRubberBandPen(QPen(Qt::red));
clear();
// ...a horizontal line at y = 0...
<<<<<<< HEAD
示例7: initQwtPlot
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void StatsGenMDFWidget::initQwtPlot(QString xAxisName, QString yAxisName, QwtPlot* plot)
{
QPalette pal;
pal.setColor(QPalette::Text, Qt::white);
pal.setColor(QPalette::Foreground, Qt::white);
pal.setColor(QPalette::Window, Qt::black);
plot->setPalette( pal );
plot->plotLayout()->setAlignCanvasToScales( true );
for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
{
plot->axisWidget( axis )->setMargin( 0 );
plot->axisWidget(axis)->setPalette(pal);
}
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setAutoFillBackground( false );
canvas->setFrameStyle( QFrame::NoFrame );
canvas->setPalette(pal);
plot->setCanvas( canvas );
QFont font;
font.setBold(true);
QwtText xAxis(xAxisName);
xAxis.setColor(Qt::white);
xAxis.setRenderFlags( Qt::AlignHCenter | Qt::AlignTop );
xAxis.setFont(font);
QwtText yAxis(yAxisName);
yAxis.setColor(Qt::white);
yAxis.setRenderFlags( Qt::AlignHCenter | Qt::AlignTop );
yAxis.setFont(font);
const int margin = 5;
plot->setContentsMargins( margin, margin, margin, margin );
plot->setAxisTitle(QwtPlot::xBottom, xAxis);
plot->setAxisTitle(QwtPlot::yLeft, yAxis);
}
示例8: QwtPlotCanvas
PlotZoz::PlotZoz(QWidget *)
{
// Прозрачность полотна
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setFrameStyle(QFrame::NoFrame);
canvas->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
canvas->setPaintAttribute(QwtPlotCanvas::Opaque, false);
canvas->setAttribute(Qt::WA_OpaquePaintEvent, false);
canvas->setAutoFillBackground( false );
setCanvas(canvas);
plotLayout()->setAlignCanvasToScales(true);
// Отключаем щкалы деления
for (int i=0; i<QwtPlot::axisCnt; i++) {
axisScaleDraw(i)->enableComponent(QwtScaleDraw::Ticks, false);
axisScaleDraw(i)->enableComponent(QwtScaleDraw::Backbone, false);
}
pltSpectrogram = new PlotSpectr();
pltRasterData = new PlotRasterData();
pltGrid = new QwtPlotGrid;
pltGrid->enableXMin(true); // разрешаем отображение линий сетки, соответствующих вспомогательным делениям нижней шкалы
pltGrid->enableYMin(true); // разрешаем отображение линий сетки, соответствующих вспомогательным делениям нижней шкалы
pltGrid->setMajorPen(QPen(Qt::gray,0,Qt::DotLine)); // черный для основных делений
pltGrid->setMinorPen(QPen(Qt::gray,0,Qt::DotLine)); // серый для вспомогательных
pltGrid->attach(this);
setAxisMaxMajor(0,20);
setAxisMaxMinor(0,0);
setAxisMaxMajor(1,20);
setAxisMaxMinor(1,0);
setAxisMaxMajor(2,20);
setAxisMaxMinor(2,0);
setAxisMaxMajor(3,20);
setAxisMaxMinor(3,0);
canvas->setCursor(Qt::ArrowCursor);
setMouseTracking(true);
for (int i=0; i<QwtPlot::axisCnt; i++)
axisWidget(i)->setMouseTracking(true);
}
示例9: canvasPalette
CallLogPlot::CallLogPlot(QwtPlot* plot, QObject* parent)
:QObject(parent)
, m_plot(plot)
, m_barScaleDrawX(NULL)
, m_barCount(0)
{
Q_ASSERT(m_plot);
m_plot->setAutoReplot(false);
// 设置图表颜色
m_plot->setAutoFillBackground(true);
m_plot->setPalette(QColor("Linen"));
// 设置图表画布
QwtPlotCanvas* canvas = new QwtPlotCanvas();
canvas->setLineWidth(2);
canvas->setFrameStyle(QFrame::Box | QFrame::Sunken);
QPalette canvasPalette(QColor("Plum"));
canvasPalette.setColor(QPalette::Foreground, QColor("Indigo"));
canvas->setPalette(canvasPalette);
m_plot->setCanvas(canvas);
// 创建柱状图表
m_barChart = new BarChart();
m_barChart->attach(m_plot);
m_barChart->setOrientation(Qt::Vertical);
// 设置X坐标轴
m_barScaleDrawX = new BarScaleDrawX();
m_plot->setAxisMaxMajor(QwtPlot::xBottom, 0);
m_plot->setAxisScaleDraw(QwtPlot::xBottom, m_barScaleDrawX);
// 设置Y坐标轴
m_barScaleDrawY = new BarScaleDrawY();
m_plot->setAxisMaxMinor(QwtPlot::yLeft, 3);
m_plot->setAxisScaleDraw(QwtPlot::yLeft, m_barScaleDrawY);
// 设置布局
m_plot->plotLayout()->setCanvasMargin(0);
m_plot->replot();
}
示例10: canvasPalette
Psd::Psd(QWidget *parent) :
QWidget(parent),
ui(new Ui::Psd)
{
ui->setupUi(this);
ui->plot->setTitle("原信号:cos(2*PI*40*i)+3*cos(2*PI*100*i)+w(n)");
ui->plot->setAutoFillBackground( true );
ui->plot->insertLegend( new QwtLegend(), QwtPlot::RightLegend );
ui->plot->setAutoReplot( false );
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setLineWidth( 1 );
canvas->setFrameStyle( QFrame::Box | QFrame::Plain );
canvas->setBorderRadius( 15 );
QPalette canvasPalette( Qt::white );
canvasPalette.setColor( QPalette::Foreground, QColor( 133, 190, 232 ) );
canvas->setPalette( canvasPalette );
ui->plot->setCanvas( canvas );
( void ) new QwtPlotPanner( canvas );
( void ) new QwtPlotMagnifier( canvas );
cSin->setRenderHint( QwtPlotItem::RenderAntialiased );
cSin->setLegendAttribute( QwtPlotCurve::LegendShowLine, false );
cSin->setPen( Qt::red );
cSin->attach( ui->plot );
QwtPlotMarker *mY = new QwtPlotMarker();
mY->setLabelAlignment( Qt::AlignRight | Qt::AlignTop );
mY->setLineStyle( QwtPlotMarker::HLine );
mY->setYValue( 0.0 );
mY->attach( ui->plot );
init();
pf();
populate();
}
示例11: QwtPlot
Plot::Plot( QWidget *parent ):
QwtPlot( parent ),
d_interval( 10.0 ), // seconds
d_timerId( -1 )
{
// Assign a title
setTitle( "Testing Refresh Rates" );
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setFrameStyle( QFrame::Box | QFrame::Plain );
canvas->setLineWidth( 1 );
canvas->setPalette( Qt::white );
setCanvas( canvas );
alignScales();
// Insert grid
d_grid = new QwtPlotGrid();
d_grid->attach( this );
// Insert curve
d_curve = new QwtPlotCurve( "Data Moving Right" );
d_curve->setPen( Qt::black );
d_curve->setData( new CircularBuffer( d_interval, 10 ) );
d_curve->attach( this );
// Axis
setAxisTitle( QwtPlot::xBottom, "Seconds" );
setAxisScale( QwtPlot::xBottom, -d_interval, 0.0 );
setAxisTitle( QwtPlot::yLeft, "Values" );
setAxisScale( QwtPlot::yLeft, -1.0, 1.0 );
d_clock.start();
setSettings( d_settings );
}
示例12: canvasPalette
Plot::Plot( QWidget *parent ):
QwtPlot( parent )
{
//setAutoFillBackground( true );
//setPalette( QPalette( QColor( 165, 193, 228 ) ) );
//updateGradient();
//setTitle( "A Simple QwtPlot Demonstration" );
//insertLegend( new QwtLegend(), QwtPlot::BottomLegend );
// axes
setAxisTitle( xBottom, "x -->" );
setAxisScale( xBottom, 0.0, 360.0 );
setAxisTitle( yLeft, "y -->" );
setAxisScale( yLeft, -10.0, 10.0 );
// canvas
QwtPlotCanvas *canvas = new QwtPlotCanvas();
//canvas->setLineWidth( 1 );
canvas->setFrameStyle( QFrame::StyledPanel );
//canvas->setBorderRadius( 15 );
QwtPlotGrid* grid = new QwtPlotGrid();
grid->setPen(Qt::black, 0.1, Qt::DashLine);
grid->attach(this);
QPalette canvasPalette( Qt::white );
canvasPalette.setColor( QPalette::Foreground, QColor( 133, 190, 232 ) );
canvas->setPalette( canvasPalette );
setCanvas( canvas );
// panning with the left mouse button
QwtPlotPanner* panner = new QwtPlotPanner( canvas );
panner->setMouseButton(Qt::LeftButton, Qt::ControlModifier);
// zoom in/out with the wheel
QwtPlotMagnifier* magnifier = new QwtPlotMagnifier( canvas );
magnifier->setAxisEnabled(xBottom, false);
QwtPlotZoomer* zoomer = new QwtPlotZoomer(canvas);
zoomer->setKeyPattern( QwtEventPattern::KeyRedo, Qt::Key_I, Qt::ShiftModifier );
zoomer->setKeyPattern( QwtEventPattern::KeyUndo, Qt::Key_O, Qt::ShiftModifier );
zoomer->setKeyPattern( QwtEventPattern::KeyHome, Qt::Key_Home );
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton, Qt::ShiftModifier);
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ShiftModifier);
canvas->setFocusPolicy(Qt::StrongFocus);
canvas->setFocusIndicator(QwtPlotCanvas::ItemFocusIndicator);
canvas->setFocus();
//canvas->setFrameShadow(QwtPlot::Plain);
//canvas->setCursor(Qt::arrowCursor);
canvas->setLineWidth(0);
//canvas->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
//canvas->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
//populate();
}
示例13: title
Plot::Plot( QWidget *parent ):
QwtPlot( parent)
{
setPalette( Qt::black );
// we want to have the axis scales like a frame around the
// canvas
plotLayout()->setAlignCanvasToScales( true );
for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
axisWidget( axis )->setMargin( 0 );
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setAutoFillBackground( false );
canvas->setFrameStyle( QFrame::NoFrame );
setCanvas( canvas );
setAxisScale( QwtPlot::yLeft, 0.0, 10.0 );
// a title
QwtText title( "Picker Demo" );
title.setColor( Qt::white );
title.setRenderFlags( Qt::AlignHCenter | Qt::AlignTop );
QFont font;
font.setBold( true );
title.setFont( font );
QwtPlotTextLabel *titleItem = new QwtPlotTextLabel();
titleItem->setText( title );
titleItem->attach( this );
#if 1
// section
//QColor c( "PaleVioletRed" );
QwtPlotZoneItem* zone = new QwtPlotZoneItem();
zone->setPen( Qt::darkGray );
zone->setBrush( QColor( "#834358" ) );
zone->setOrientation( Qt::Horizontal );
zone->setInterval( 3.8, 5.7 );
zone->attach( this );
#else
// grid
QwtPlotGrid *grid = new QwtPlotGrid();
grid->setMajorPen( Qt::white, 0, Qt::DotLine );
grid->setMinorPen( Qt::gray, 0 , Qt::DotLine );
grid->attach( this );
#endif
// curves
QPolygonF points1;
points1 << QPointF( 0.2, 4.4 ) << QPointF( 1.2, 3.0 )
<< QPointF( 2.7, 4.5 ) << QPointF( 3.5, 6.8 )
<< QPointF( 4.7, 7.9 ) << QPointF( 5.8, 7.1 );
insertCurve( "Curve 1", "DarkOrange", points1 );
QPolygonF points2;
points2 << QPointF( 0.4, 8.7 ) << QPointF( 1.4, 7.8 )
<< QPointF( 2.3, 5.5 ) << QPointF( 3.3, 4.1 )
<< QPointF( 4.4, 5.2 ) << QPointF( 5.6, 5.7 );
insertCurve( "Curve 2", "DodgerBlue", points2 );
CurveTracker* tracker = new CurveTracker( this->canvas() );
// for the demo we want the tracker to be active without
// having to click on the canvas
tracker->setStateMachine( new QwtPickerTrackerMachine() );
tracker->setRubberBandPen( QPen( "MediumOrchid" ) );
}
示例14: QwtPlot
//---------------------------------------------------------------------------
Plot::Plot( size_t streamPos, size_t Type, size_t Group, QWidget *parent ) :
QwtPlot( parent ),
m_streamPos( streamPos ),
m_type( Type ),
m_group( Group )
{
setAutoReplot( false );
QwtPlotCanvas* canvas = dynamic_cast<QwtPlotCanvas*>( this->canvas() );
if ( canvas )
{
canvas->setFrameStyle( QFrame::Plain | QFrame::Panel );
canvas->setLineWidth( 1 );
#if 1
canvas->setPalette( QColor("Cornsilk") );
#endif
}
setAxisMaxMajor( QwtPlot::yLeft, 0 );
setAxisMaxMinor( QwtPlot::yLeft, 0 );
setAxisScaleDraw( QwtPlot::yLeft, new PlotScaleDrawY() );
enableAxis( QwtPlot::xBottom, false );
// something invalid
setAxisScale( QwtPlot::xBottom, -1, 0 );
setAxisScale( QwtPlot::yLeft, -1, 0 );
// 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( this );
m_cursor = new PlotCursor( canvas );
m_cursor->setPosition( 0 );
// curves
for( unsigned j = 0; j < PerStreamType[m_type].PerGroup[m_group].Count; ++j )
{
QwtPlotCurve* curve = new QwtPlotCurve( PerStreamType[m_type].PerItem[PerStreamType[m_type].PerGroup[m_group].Start + j].Name );
curve->setPen( curveColor( j ) );
curve->setRenderHint( QwtPlotItem::RenderAntialiased );
curve->setZ( curve->z() - j ); //Invert data order (e.g. MAX before MIN)
curve->attach( this );
m_curves += curve;
}
// visual helpers
if ( m_type == Type_Video )
switch (m_group)
{
case Group_Y :
Plot_AddHLine( this, 16, 61, 89, 171);
Plot_AddHLine( this, 235, 220, 20, 60);
break;
case Group_U :
case Group_V :
Plot_AddHLine( this, 16, 61, 89, 171);
Plot_AddHLine( this, 240, 220, 20, 60);
break;
case Group_Sat :
Plot_AddHLine( this, 88, 255, 0, 255);
Plot_AddHLine( this, 118, 220, 20, 60);
break;
default : ;
}
PlotPicker* picker = new PlotPicker( canvas, &PerStreamType[m_type], m_group, &m_curves );
connect( picker, SIGNAL( moved( const QPointF& ) ), SLOT( onPickerMoved( const QPointF& ) ) );
connect( picker, SIGNAL( selected( const QPointF& ) ), SLOT( onPickerMoved( const QPointF& ) ) );
connect( axisWidget( QwtPlot::xBottom ), SIGNAL( scaleDivChanged() ), SLOT( onXScaleChanged() ) );
// legend
m_legend = new PlotLegend();
connect( this, SIGNAL( legendDataChanged( const QVariant &, const QList<QwtLegendData> & ) ),
m_legend, SLOT( updateLegend( const QVariant &, const QList<QwtLegendData> & ) ) );
updateLegend();
}
示例15: canvasPalette
Plot::Plot(QWidget *parent):
QwtPlot( parent )
{
setAutoFillBackground( true );
setPalette( QPalette( QColor( 165, 193, 228 ) ) );
updateGradient();
setTitle( "График аппроксимации" );
insertLegend( new QwtLegend(), QwtPlot::RightLegend );
// axes
setAxisTitle( xBottom, "" );
setAxisScale( xBottom, 0.0, 10.0 );
setAxisTitle( yLeft, "Функция принадлежности -->" );
setAxisScale( yLeft, 0, 2 );
// canvas
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setLineWidth( 1 );
canvas->setFrameStyle( QFrame::Box | QFrame::Plain );
canvas->setBorderRadius( 15 );
QPalette canvasPalette( Qt::white );
canvasPalette.setColor( QPalette::Foreground, QColor( 133, 190, 232 ) );
canvas->setPalette( canvasPalette );
setCanvas( canvas );
// panning with the left mouse button
( void ) new QwtPlotPanner( canvas );
// zoom in/out with the wheel
( void ) new QwtPlotMagnifier( canvas );
// ...a horizontal line at y = 0...
QwtPlotMarker *mY = new QwtPlotMarker();
mY->setLabel( QString::fromLatin1( "y = 0" ) );
mY->setLabelAlignment( Qt::AlignRight | Qt::AlignTop );
mY->setLineStyle( QwtPlotMarker::HLine );
mY->setYValue( 0.0 );
mY->attach( this );
// ...a horizontal line at y = 1...
QwtPlotMarker *mY1 = new QwtPlotMarker();
mY1->setLabel( QString::fromLatin1( "y = 1" ) );
mY1->setLabelAlignment( Qt::AlignRight | Qt::AlignTop );
mY1->setLineStyle( QwtPlotMarker::HLine );
mY1->setYValue( 1.0 );
mY1->setLinePen(Qt::black, 1, Qt::DashLine);
mY1->attach( this );
// ...a vertical line at x = 0
QwtPlotMarker *mX = new QwtPlotMarker();
mX->setLabel( QString::fromLatin1( "x = 0" ) );
mX->setLabelAlignment( Qt::AlignLeft | Qt::AlignBottom );
mX->setLabelOrientation( Qt::Vertical );
mX->setLineStyle( QwtPlotMarker::VLine );
mX->setLinePen( Qt::black, 0, Qt::DashDotLine );
mX->setXValue( 0 );
mX->attach( this );
// curvePoints = new QwtPlotCurve();
// curvePoints->setStyle( QwtPlotCurve::Dots );
// curvePoints->attach( this );
}