本文整理汇总了C++中setAxisScale函数的典型用法代码示例。如果您正苦于以下问题:C++ setAxisScale函数的具体用法?C++ setAxisScale怎么用?C++ setAxisScale使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setAxisScale函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DataPlot
//changing to angle x comparison plot
FsrPlot::FsrPlot(QWidget *parent)
: DataPlot(parent) {
for (int i = 0; i < PLOT_SIZE; ++i)
data_r2[i] = data_l[i] = data_r[i] = data_t[i] = 0.0;
setTitle("angleX");
QwtPlotCurve *curveL = new QwtPlotCurve("filtered angleX");
curveL->attach(this);
curveL->setRawData(t, data_l, PLOT_SIZE);
curveL->setPen(QPen(Qt::red));
QwtPlotCurve *curveR = new QwtPlotCurve("raw angleX");
curveR->attach(this);
curveR->setRawData(t, data_r, PLOT_SIZE);
curveR->setPen(QPen(Qt::blue));
// QwtPlotCurve *curveR2 = new QwtPlotCurve("Right2");
// curveR2->attach(this);
// curveR2->setRawData(t, data_r2, PLOT_SIZE);
// curveR2->setPen(QPen(Qt::black));
// QwtPlotCurve *curveT = new QwtPlotCurve("Total");
// curveT->attach(this);
// curveT->setRawData(t, data_t, PLOT_SIZE);
setAxisScale(QwtPlot::xBottom, 0, PLOT_SIZE - 1);
setAxisScale(QwtPlot::yLeft, -12, 12);
}
示例2: QwtPlotSpectrogram
QwtPlotSpectrogram * PlotViewWidget::addSpectrogramData(SpectrogramData *spectrogramData)
{
QwtPlotSpectrogram *spectrogram = new QwtPlotSpectrogram();
spectrogram->setRenderThreadCount( 0 ); // use system specific thread count
QwtLinearColorMap * colorMap = new QwtLinearColorMap(Qt::white, Qt::black);
spectrogram->setColorMap(colorMap);
spectrogram->setCachePolicy( QwtPlotRasterItem::PaintCache );
spectrogram->setData( spectrogramData );
QRectF r = spectrogramData->boundingRect();
setAxisScale( QwtPlot::yLeft , 0, 5000, 1000);
setAxisScale( QwtPlot::yRight , 0, 5000, 1000);
setAxisScale( QwtPlot::xBottom , r.left(), r.right(), 0.1);
spectrogram->setDisplayMode( QwtPlotSpectrogram::ImageMode, true );
spectrogram->setAlpha(100);
maSpectrogramData << spectrogramData;
maSpectrograms << spectrogram;
spectrogram->attach( this );
repaint();
return spectrogram;
}
示例3: QwtPlotCurve
void Plot::paste()
{
QLocale l;
QClipboard *clipboard = QApplication::clipboard();
QString text = clipboard->text();
if(!text.isEmpty()) {
QList<QString> items = text.split('\n');
QList<float> values;
for(int i = 0; i < items.count(); i++) {
values.append(l.toFloat(items[i]));
}
this->detachItems();
// Insert new curves
curve = new QwtPlotCurve( "y = sin(x)" );
curve->setRenderHint( QwtPlotItem::RenderAntialiased );
curve->setLegendAttribute( QwtPlotCurve::LegendShowLine, true );
curve->setPen( Qt::red );
curve->attach( this );
Data* data = new Data(&values);
curve->setData(data);
setAxisScale( yLeft, data->yMin, data->yMax);
setAxisScale( xBottom, data->xMin, data->xMax);
QwtPlotGrid* grid = new QwtPlotGrid();
grid->setPen(Qt::black, 0.1, Qt::DashLine);
grid->attach(this);
}
}
示例4: max
//-----------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------
void Plot::redraw(double *x, double *y, int n, QString name)
{
if (n == 1) { // That is, this is the first plotting instance.
yscale = max(yscale,calc_yscale(y[0]));
setAxisScale(QwtPlot::yLeft, 0, yscale, 0);
}
// Note: Number of pen colors should match ncmax
QColor pencolor[] = {Qt::black, Qt::red, Qt::blue, Qt::darkGreen, Qt::magenta, Qt::darkCyan };
QPen *pen = new QPen();
QwtLegend *legend = new QwtLegend();
for (int k=0; k<ncmax; k++) {
if (curve[k] == 0) continue;
if (name.compare(curve[k]->title().text()) == 0) {
// Just in case someone set ncmax > # of pen colors (currently = 6)
if (k < 6) {
pen->setColor(pencolor[k]);
} else {
pen->setColor(pencolor[0]);
}
curve[k]->setPen(*pen);
curve[k]->setData(x, y, n);
this->insertLegend(legend, QwtPlot::RightLegend);
double ylast = y[n-1];
if (ylast > yscale) {
yscale = max(yscale,calc_yscale(ylast));
setAxisScale(QwtPlot::yLeft, 0, yscale, 0);
}
replot();
}
}
delete pen;
}
示例5: QwtPlot
IncrementalPlot::IncrementalPlot( QWidget *parent ):
QwtPlot( parent ),
d_curve( NULL )
{
d_directPainter = new QwtPlotDirectPainter( this );
setCanvasBackground(QColor(Qt::black));
setAxisScale(QwtPlot::yLeft, 0, 1024);
setAxisScale(QwtPlot::xBottom, 0, 5000);
if ( QwtPainter::isX11GraphicsSystem() )
{
#if QT_VERSION < 0x050000
canvas()->setAttribute( Qt::WA_PaintOutsidePaintEvent, true );
#endif
canvas()->setAttribute( Qt::WA_PaintOnScreen, true );
}
d_curve = new QwtPlotCurve( "Test Curve" );
d_curve->setData( new CurveData() );
showSymbols( true );
d_curve->attach( this );
setAutoReplot( false );
}
示例6: QwtPlot
DataPlotFFT::DataPlotFFT(QWidget *parent):
QwtPlot(parent),
d_data(NULL),
d_curve(NULL)
{
setAutoReplot(false);
setFrameStyle(QFrame::NoFrame);
setLineWidth(0);
setCanvasLineWidth(2);
//plotLayout()->setAlignCanvasToScales(true);
QwtPlotGrid *grid = new QwtPlotGrid;
grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
grid->attach(this);
setCanvasBackground(Qt::white);
//setCanvasBackground(QColor(29, 100, 141)); // nice blue
//setAxisAutoScale(xBottom);
//s/etAxisAutoScale(yLeft);
setAxisScale(xBottom, 0.5, -0.5);
setAxisScale(yLeft, -10.00, 10.00);
setAxisAutoScale(yLeft);
//setAxisAutoScale(xBottom);
replot();
}
示例7: LOG_MSG
//-----------------------------------------------------------------------------------------
// This is to plot the total number of cognate cells (y2 = ytotal), and the number of
// "seed" cells (y1 = yseed)
//-----------------------------------------------------------------------------------------
void Plot::redraw2(double *x1, double *y1, double *x2, double *y2, int n1, int n2)
{
LOG_MSG("redraw2");
if (n1 == 1) { // That is, this is the first plotting instance.
yscale = max(yscale,calc_yscale_ts(y1[0]));
yscale = max(yscale,calc_yscale_ts(y2[0]));
setAxisScale(QwtPlot::yLeft, 0, yscale, 0);
}
curve[0]->setData(x1, y1, n1);
curve[1]->setData(x2, y2, n2);
QPen *pen = new QPen();
pen->setColor(Qt::red);
curve[1]->setPen(*pen);
delete pen;
this->insertLegend(&QwtLegend(), QwtPlot::RightLegend);
double ylast = y1[n1-1];
double ylast2 = y2[n2-1];
if (ylast2 > ylast) {
ylast = ylast2;
}
if (ylast > yscale) {
yscale = calc_yscale_ts(ylast);
setAxisScale(QwtPlot::yLeft, 0, yscale, 0);
}
replot();
}
示例8: IncrementalPlot
RandomPlot::RandomPlot(QWidget *parent):
IncrementalPlot(parent),
d_timer(0),
d_timerCount(0)
{
setFrameStyle(QFrame::NoFrame);
setLineWidth(0);
setCanvasLineWidth(2);
plotLayout()->setAlignCanvasToScales(true);
QwtPlotGrid *grid = new QwtPlotGrid;
grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
grid->attach(this);
setCanvasBackground(QColor(29, 100, 141)); // nice blue
setAxisScale(xBottom, 0, c_rangeMax);
setAxisScale(yLeft, 0, c_rangeMax);
replot();
// enable zooming
(void) new Zoomer(canvas());
}
示例9: setAxisScale
void Plot::rescale()
{
setAxisScale(QwtPlot::xBottom,
d_mapRect.left(), d_mapRect.right());
setAxisScale(QwtPlot::yLeft,
d_mapRect.top(), d_mapRect.bottom());
}
示例10: QwtPlot
Plot::Plot(QWidget *parent):
QwtPlot( parent )
{
// panning with the left mouse button
(void) new QwtPlotPanner( canvas() );
// zoom in/out with the wheel
(void) new QwtPlotMagnifier( canvas() );
setAutoFillBackground( true );
setPalette( QPalette( QColor( 165, 193, 228 ) ) );
updateGradient();
setTitle("A Simple QwtPlot Demonstration");
insertLegend(new QwtLegend(), QwtPlot::RightLegend);
// axes
setAxisTitle(xBottom, "x -->" );
setAxisScale(xBottom, 0.0, 10.0);
setAxisTitle(yLeft, "y -->");
setAxisScale(yLeft, -1.0, 1.0);
// canvas
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 );
populate();
}
示例11: QwtPlot
SpinScanPolarPlot::SpinScanPolarPlot(QWidget *parent, uint8_t *spinData) : QwtPlot(parent), leftCurve(NULL), rightCurve(NULL), spinData(spinData)
{
// Setup the axis
setAxisTitle(yLeft, "SpinScan");
setAxisMaxMinor(xBottom, 0);
setAxisMaxMinor(yLeft, 0);
QPalette pal;
setAxisScale(yLeft, -90, 90); // max 8 bit plus a little
setAxisScale(xBottom, -90, 90); // max 8 bit plus a little
pal.setColor(QPalette::WindowText, GColor(CSPINSCANLEFT));
pal.setColor(QPalette::Text, GColor(CSPINSCANLEFT));
axisWidget(QwtPlot::yLeft)->setPalette(pal);
axisWidget(QwtPlot::yLeft)->scaleDraw()->setTickLength(QwtScaleDiv::MajorTick, 3);
enableAxis(xBottom, false); // very little value and some cpu overhead
enableAxis(yLeft, false);
rightCurve = new QwtPlotCurve("SpinScan Right");
rightCurve->setRenderHint(QwtPlotItem::RenderAntialiased); // too cpu intensive
rightCurve->attach(this);
rightCurve->setYAxis(QwtPlot::yLeft);
rightSpinScanPolarData = new SpinScanPolarData(spinData, false);
leftCurve = new QwtPlotCurve("SpinScan Left");
leftCurve->setRenderHint(QwtPlotItem::RenderAntialiased); // too cpu intensive
leftCurve->attach(this);
leftCurve->setYAxis(QwtPlot::yLeft);
leftSpinScanPolarData = new SpinScanPolarData(spinData, true);
static_cast<QwtPlotCanvas*>(canvas())->setFrameStyle(QFrame::NoFrame);
configChanged(CONFIG_APPEARANCE); // set colors
}
示例12: changeitems
void matrixofpixels::HistogramPlotProperty(double Xmin, double Xmax, double Ymax)
{
changeitems();
setAxisAutoScale(this->xTop);
setAxisAutoScale(this->xBottom);
//setAxisFont(QwtPlot::xBottom,QFont("Helvetica",15,1));
QwtText xlabel("Value");
QwtText ylabel("Events");
QColor col(Qt::red);
xlabel.setColor(col);
ylabel.setColor(col);
xlabel.setFont(QFont("Helvetica",15,1));
ylabel.setFont(QFont("Helvetica",15,1));
setAxisTitle(QwtPlot::xBottom,xlabel);
setAxisTitle(QwtPlot::yLeft,ylabel);
setCanvasBackground(QColor(Qt::white));
setAxisScale(QwtPlot::xBottom, Xmin, Xmax);
setAxisMaxMinor(QwtPlot::xBottom, 0);
setAxisScale(QwtPlot::yLeft, 0, Ymax);
setAxisMaxMinor(QwtPlot::yLeft, 0);
plotLayout()->setAlignCanvasToScales(true);
his->attach(this);
/*QwtPlotGrid **/grid = new QwtPlotGrid;
grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
grid->attach(this);
replot();
}
示例13: QwtPlot
Plot::Plot( QWidget *parent ):
QwtPlot( parent ),
d_interval( 10.0 ), // seconds
d_timerId( -1 )
{
// Assign a title
setTitle( "Testing Refresh Rates" );
setCanvasBackground( Qt::white );
alignScales();
// Insert grid
d_grid = new QwtPlotGrid();
d_grid->attach( this );
// Insert curve
d_curve = new QwtPlotCurve( "Data Moving Right" );
d_curve->setPen( QPen( 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 );
}
示例14: setAxisScale
void EEGPlot::replotManual()
{
m_arraySeriesData->lockMutex();
setAxisScale(QwtPlot::yLeft,m_arraySeriesData->minimumY(), m_arraySeriesData->maximumY(), m_arraySeriesData->maximumY()/4);
setAxisScale(QwtPlot::xBottom,m_arraySeriesData->minimumX(), m_arraySeriesData->maximumX(),1.0);
replot();
m_arraySeriesData->unLockMutex();
}
示例15: setAxisScale
void
BasicPlot::setAxes(double xmin, double xmax, double ymin, double ymax)
{
setAxisScale(xBottom, xmin, xmax);
setAxisScale(yLeft, ymin, ymax);
replot();
// set zoomer to new axes limits
emit setNewBase(axisScaleDiv(QwtPlot::xBottom), axisScaleDiv(QwtPlot::yLeft));
}