本文整理汇总了C++中QwtPlotGrid::enableYMin方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotGrid::enableYMin方法的具体用法?C++ QwtPlotGrid::enableYMin怎么用?C++ QwtPlotGrid::enableYMin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotGrid
的用法示例。
在下文中一共展示了QwtPlotGrid::enableYMin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: populate
void HistPlot::populate()
{
setTitle("Watching TV during a weekend");
setAxisTitle(QwtPlot::yLeft, "Number of People");
setAxisTitle(QwtPlot::xBottom, "Number of Hours");
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableX(false);
grid->enableY(true);
grid->enableXMin(false);
grid->enableYMin(false);
grid->setMajPen(QPen(Qt::black, 0, Qt::SolidLine));
grid->attach(this);
const double juneValues[] = { 7, 19, 24, 32, 10, 5, 3 };
const double novemberValues[] = { 4, 15, 22, 34, 13, 8, 4 };
Histogram *histogramJune = new Histogram("Summer", Qt::red);
histogramJune->setValues(
sizeof(juneValues) / sizeof(double), juneValues);
histogramJune->attach(this);
Histogram *histogramNovember = new Histogram("Winter", Qt::blue);
histogramNovember->setValues(
sizeof(novemberValues) / sizeof(double), novemberValues);
histogramNovember->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: main
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QwtPlot plot;
plot.setCanvasBackground(QColor(Qt::white));
plot.setTitle("Bar Chart");
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableX(false);
grid->enableYMin(true);
grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
grid->attach(&plot);
BarChartItem *item = new BarChartItem();
item->attach(&plot);
QList< QPair<int, QString> > barHeights;
barHeights.append(QPair<int, QString>(10, ""));
barHeights.append(QPair<int, QString>(100, ""));
barHeights.append(QPair<int, QString>(20, ""));
item->setData(barHeights);
plot.enableAxis(QwtPlot::xBottom, false);
plot.resize(600, 400);
plot.show();
return app.exec();
}
示例4: QDialog
SimDialog::SimDialog( QWidget * parent, Qt::WFlags f)
: QDialog(parent, f)
{
setupUi(this);
// setup the plot ...
m_plot->setTitle("Comparing Similarity Measures");
m_plot->insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
// set up the axes ...
m_plot->setAxisTitle(QwtPlot::xBottom, "Variations");
m_plot->setAxisScale(QwtPlot::xBottom, -10, 10);
m_plot->setAxisTitle(QwtPlot::yLeft, "Similarity");
m_plot->setAxisScale(QwtPlot::yLeft, -1.5, 1.5);
// enable grid ...
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableXMin(true);
grid->enableYMin(true);
grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
grid->attach(m_plot);
// Insert zero line at y = 0
QwtPlotMarker *mY = new QwtPlotMarker();
mY->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
mY->setLineStyle(QwtPlotMarker::HLine);
mY->setYValue(0.0);
mY->attach(m_plot);
// Insert zero line at x = 0
QwtPlotMarker *mX = new QwtPlotMarker();
mX->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
mX->setLineStyle(QwtPlotMarker::VLine);
mX->setXValue(0.0);
mX->attach(m_plot);
// Insert new curves
cReg = new QwtPlotCurve("Regular Similarity Measure");
cReg->attach(m_plot);
cOct = new QwtPlotCurve("Octree based Similarity Measure");
cOct->attach(m_plot);
// Set curve styles
cReg->setPen(QPen(Qt::red, 2));
cOct->setPen(QPen(Qt::blue, 2));
// Populate the volume combos ...
MainWindow* _win = (MainWindow *)this->parent();
viewer3d * _view = (viewer3d *) _win->getViewer();
QList<Volume*> _vols = _view->getVolumes();
// append Volume names to combo boxes ...
// Need to modify Volume class so that it stored patient name ...
// More importantly modify PatientBrowser so that the data can be directly
// loaded.
}
示例5: setGridPlot
// Init X axis.
void DataPlot::setGridPlot()
{
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableXMin(true);
grid->enableYMin(true);
grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
grid->attach(this);
}
示例6: QwtPlot
Plot::Plot(QWidget *parent):
QwtPlot(parent),
d_paintedPoints(0),
d_interval(0.0, 10.0),
d_timerId(-1)
{
d_directPainter = new QwtPlotDirectPainter();
setAutoReplot(false);
// We don't need the cache here
canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
//canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
#if defined(Q_WS_X11)
// Even if not recommended by TrollTech, Qt::WA_PaintOutsidePaintEvent
// works on X11. This has a nice effect on the performance.
canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, true);
canvas()->setAttribute(Qt::WA_PaintOnScreen, true);
#endif
plotLayout()->setAlignCanvasToScales(true);
setAxisTitle(QwtPlot::xBottom, "Time [s]");
setAxisScale(QwtPlot::xBottom, d_interval.minValue(), d_interval.maxValue());
setAxisScale(QwtPlot::yLeft, -200.0, 200.0);
QwtPlotGrid *grid = new QwtPlotGrid();
grid->setPen(QPen(Qt::gray, 0.0, Qt::DotLine));
grid->enableX(true);
grid->enableXMin(true);
grid->enableY(true);
grid->enableYMin(false);
grid->attach(this);
d_origin = new QwtPlotMarker();
d_origin->setLineStyle(QwtPlotMarker::Cross);
d_origin->setValue(d_interval.minValue() + d_interval.width() / 2.0, 0.0);
d_origin->setLinePen(QPen(Qt::gray, 0.0, Qt::DashLine));
d_origin->attach(this);
d_curve = new QwtPlotCurve();
d_curve->setStyle(QwtPlotCurve::Lines);
d_curve->setPen(QPen(Qt::green));
#if 1
d_curve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
#endif
#if 1
d_curve->setPaintAttribute(QwtPlotCurve::ClipPolygons, false);
#endif
d_curve->setData(new CurveData());
d_curve->attach(this);
}
示例7: populate
void GenericHistogramView::populate()
{
QwtPlotGrid* grid = new QwtPlotGrid();
grid->enableX(false);
grid->enableY(true);
grid->enableXMin(false);
grid->enableYMin(false);
grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
grid->attach(_qwtPlot);
for(unsigned int i = 0; i < _image->getNbChannels(); ++i)
{
imagein::Array<unsigned int>* histogram;
if(_projection)
histogram = new imagein::ProjectionHistogram(*_image, _value, _horizontal, *_rectangle, i);
else
histogram = new imagein::Histogram(*_image, i, *_rectangle);
int values[histogram->getWidth()];
for(unsigned int j = 0; j < histogram->getWidth(); ++j)
values[j] = (*histogram)[j];
GraphicalHistogram* graphicalHisto;
switch(i)
{
case 0:
if(_image->getNbChannels() == 1 || _image->getNbChannels() == 2)
graphicalHisto = new GraphicalHistogram("Black", Qt::black);
else
graphicalHisto = new GraphicalHistogram("Red", Qt::red);
break;
case 1:
if(_image->getNbChannels() == 1 || _image->getNbChannels() == 2)
graphicalHisto = new GraphicalHistogram("Alpha", Qt::white);
else
graphicalHisto = new GraphicalHistogram("Green", Qt::green);
break;
case 2:
graphicalHisto = new GraphicalHistogram("Blue", Qt::blue);
break;
case 3:
graphicalHisto = new GraphicalHistogram("Alpha", Qt::black);
break;
default:
graphicalHisto = new GraphicalHistogram("Default", Qt::black);
}
graphicalHisto->setValues(sizeof(values) / sizeof(int), values);
if(_horizontal)
graphicalHisto->setOrientation(Qt::Horizontal);
graphicalHisto->attach(_qwtPlot);
_graphicalHistos.push_back(graphicalHisto);
}
}
示例8: QDialog
QmitkHistogramWidget::QmitkHistogramWidget(QWidget * parent, bool showreport)
: QDialog(parent)
{
QBoxLayout *layout = new QVBoxLayout(this);
//***histogram***
QGroupBox *hgroupbox = new QGroupBox("", this);
hgroupbox->setMinimumSize(900, 400);
m_Plot = new QwtPlot(hgroupbox);
m_Plot->setCanvasBackground(QColor(Qt::white));
m_Plot->setTitle("Histogram");
QwtText text = m_Plot->titleLabel()->text();
text.setFont(QFont("Helvetica", 12, QFont::Normal));
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableXMin(true);
grid->enableYMin(true);
grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
grid->attach(m_Plot);
layout->addWidget(hgroupbox);
layout->setSpacing(20);
if (showreport == true)
{
//***report***
QGroupBox *rgroupbox = new QGroupBox("", this);
rgroupbox->setMinimumSize(900, 400);
QLabel *label = new QLabel("Gray Value Analysis", rgroupbox);
label->setAlignment(Qt::AlignHCenter);
label->setFont(QFont("Helvetica", 14, QFont::Bold));
m_Textedit = new QTextEdit(rgroupbox);
m_Textedit->setFont(QFont("Helvetica", 12, QFont::Normal));
m_Textedit->setReadOnly(true);
layout->addWidget(rgroupbox);
}
m_Picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
QwtPicker::PointSelection,
QwtPlotPicker::NoRubberBand, QwtPicker::AlwaysOn,
m_Plot->canvas());
connect(m_Picker, SIGNAL(selected(const QwtDoublePoint &)),
SLOT(OnSelect(const QwtDoublePoint &)));
}
示例9: main
int main(int argc, char **argv)
{
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->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
grid->setMinPen(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<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));
values[i] = value;
pos += width;
}
histogram->setData(QwtIntervalData(intervals, values));
histogram->attach(&plot);
plot.setAxisScale(QwtPlot::yLeft, 0.0, 100.0);
plot.setAxisScale(QwtPlot::xBottom, 0.0, pos);
plot.replot();
#if QT_VERSION < 0x040000
a.setMainWidget(&plot);
#endif
plot.resize(600,400);
plot.show();
return a.exec();
}
示例10: populate
void AnalogGraph::populate()
{
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableX(false);
grid->enableY(false);
grid->enableXMin(false);
grid->enableYMin(false);
grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
grid->attach(this);
analogHistogram_ = new Histogram("", QColor(80, 180, 220, 150));
//analogHistogram_->setValues(analogChannels_);
analogHistogram_->attach(this);
}
示例11: 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();
}
示例12: populate
void ICResultChart::populate()
{
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableX( false );
grid->enableY( true );
grid->enableXMin( false );
grid->enableYMin( false );
grid->setMajorPen( Qt::black, 0, Qt::DotLine );
grid->attach( this );
QColor color = Qt::blue;
color.setAlpha(180);
QwtColumnSymbol *symbol = new QwtColumnSymbol(QwtColumnSymbol::Box);
symbol->setLineWidth(2);
symbol->setFrameStyle(QwtColumnSymbol::Raised);
symbol->setPalette(QPalette(color));
d_barChartItem->setSymbol(symbol);
QVector<double> samples;
QMap<QString, int>::const_iterator i = result.constBegin();
while (i != result.constEnd()) {
samples.append(i.value());
++i;
}
d_barChartItem->setSamples(samples);
double k = (0.0 + SPACING_RATIO) / MARGIN_RATIO;
double m = (0.0 + WINDOW_WIDTH - BAR_WIDTH) / (2 + k * (result.size() - 1));
int margin = static_cast<int>(m);
int spacing = static_cast<int>(m * k);
if (spacing < MIN_SPACING) spacing = MIN_SPACING;
if (margin < MIN_MARGIN) margin = MIN_MARGIN;
d_barChartItem->setSpacing(spacing);
d_barChartItem->setMargin(100);
//d_barChartItem->setLayoutPolicy(QwtPlotAbstractBarChart::FixedSampleSize);
//d_barChartItem->setLayoutHint(BAR_WIDTH);
}
示例13: setValueHist
void HistPlot::setValueHist(const vector<double>& histogram, int origin)
{
setTitle("Histogram");
setAxisTitle(QwtPlot::yLeft, "Count");
setAxisTitle(QwtPlot::xBottom, "Value");
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableX(false);
grid->enableY(true);
grid->enableXMin(false);
grid->enableYMin(false);
grid->setMajPen(QPen(Qt::darkGreen, 0, Qt::SolidLine));
grid->attach(this);
Histogram *histogramJune = new Histogram("Summer", Qt::red);
histogramJune->setValues(
histogram.size(), &histogram[0], origin);
histogramJune->attach(this);
}
示例14: QWidget
PowerBarHistoryPlot::PowerBarHistoryPlot(double defaultTime, double defaultPowerLevel, QWidget* parent)
: QWidget(parent)
, m_overalTime(0.0)
, m_lastSampleTime(0.0)
, m_firstTime(true)
, m_defaultTime(defaultTime)
, m_defaultPowerLevel(defaultPowerLevel)
, m_powerAxisMax(defaultPowerLevel)
, m_powerAxisMin(-1*defaultPowerLevel)
, m_timeAxisMax(defaultTime)
{
m_plot = new QwtPlot();
m_plot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
m_plot->setAxisScale(QwtPlot::xBottom, 0, defaultTime, defaultTime/20.0);
m_plot->setAxisScale(QwtPlot::yLeft, -1 * defaultPowerLevel, defaultPowerLevel, defaultPowerLevel/2.0);
m_plot->setAxisAutoScale(QwtPlot::xBottom, false);
m_plot->setCanvasBackground(QBrush(Qt::white));
m_plot->setAxisTitle(QwtPlot::xBottom, tr(TIME_AXIS_NAME));
m_plot->setAxisTitle(QwtPlot::yLeft, tr(POWER_AXIS_NAME));
// legend
QwtLegend *legend = new QwtLegend;
legend->setFrameStyle(QFrame::Box|QFrame::Sunken);
m_plot->insertLegend(legend, QwtPlot::BottomLegend);
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableX(false);
grid->enableYMin(true);
grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
grid->setMinPen(QPen(Qt::transparent, 0 , Qt::NoPen));
grid->attach(m_plot);
setupCurves();
QHBoxLayout* historyPlotlayout = new QHBoxLayout;
historyPlotlayout->addWidget(m_plot);
historyPlotlayout->setSpacing(0);
setColors(Qt::blue, Qt::red);
setLayout(historyPlotlayout);
}
示例15: QwtPlot
Spectrograph::Spectrograph(QWidget *parent):
QwtPlot(parent)
{
//real-time plotting
d_directPainter = new QwtPlotDirectPainter();
setAutoReplot( false );
//all plot widgets will be displayed on the canvas
setCanvas( new QwtPlotCanvas() );
plotLayout()->setAlignCanvasToScales( true );
//set plot title and range
setAxisTitle( QwtPlot::xBottom, "Frequency (MHz)" );
setAxisTitle( QwtPlot::yLeft, "Amplitude (dB)" );
setAxisScale( QwtPlot::xBottom, 0, RESULT_LENGTH );
setAxisScale( QwtPlot::yLeft, -90, -10);
//black background
setCanvasBackground(QColor(0,0,0));
//add grid
QwtPlotGrid *grid = new QwtPlotGrid();
grid->setPen( Qt::white, 0.0, Qt::DotLine );
grid->enableX( true );
grid->enableXMin( true );
grid->enableY( true );
grid->enableYMin( false );
grid->attach( this );//attach grid to plot
//add curve
d_curve = new QwtPlotCurve();
d_curve->setStyle( QwtPlotCurve::Lines );
d_curve->setPen(Qt::yellow);
d_curve->setPaintAttribute( QwtPlotCurve::ClipPolygons, false );
d_curve->attach( this );//attach curve to plot
for(int i=0; i<RESULT_LENGTH; ++i) {
d_x[i] = i;
}
}