本文整理汇总了C++中QwtPlotCurve类的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotCurve类的具体用法?C++ QwtPlotCurve怎么用?C++ QwtPlotCurve使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QwtPlotCurve类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_y_axis_logscale
void Data_analysis_gui::set_y_axis_logscale( bool on ) {
/*
if (plot_->axisScaleEngine(QwtPlot::xBottom)->transformation()->type() ==
QwtScaleTransformation::Log10 && on)
return;
if (plot_->axisScaleEngine(QwtPlot::xBottom)->transformation()->type() ==
QwtScaleTransformation::Linear && (!on))
return;
*/
if( on ) {
// Before allowing to go to log scaling, make sure all values are > 0:
// if some are < 0, return without doing anything
QwtPlotItemList L = plot_->itemList();
for (int i = 0; i < L.size(); ++i) {
if (L[i]->rtti() == QwtPlotItem::Rtti_PlotCurve) {
QwtPlotCurve * curve = dynamic_cast<QwtPlotCurve*>(L[i]);
if (curve->minYValue() <= 0)
return;
}
}
plot_->setAxisScaleEngine(QwtPlot::yLeft, new QwtLog10ScaleEngine);
}
else
plot_->setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
plot_->replot();
}
示例2: foreach
void CDataPlot::rebuild(void)
{
for(int ci = 0; ci < m_portalCurveMap.count(); ++ci)
{
if(m_portalCurveMap.values().at(ci))
{
m_portalCurveMap.values().at(ci)->detach();
delete m_portalCurveMap.values().at(ci);
}
}
m_portalCurveMap.clear();
if(m_algTreeModel)
{
QList<CPortal*> portals = m_algTreeModel->checkedPortalList();
foreach(CPortal *portal, portals)
{
if(!portal) continue;
QwtPlotCurve *curve = new QwtPlotCurve(portal->caption());
curve->setData(new CCurveData(portal));
curve->setPen(portal->dataColor(), 3);
curve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
curve->attach(this);
m_portalCurveMap[portal] = curve;
}
}
refresh();
}
示例3: setTitleX
void Curves::resamples()
{
setTitleX();
foreach(int i, curves.keys()){
if(i >= file->size()){
delete curves.take(i);
}
else{
QwtPlotCurve* curve = curves.value(i);
curve->setSamples(
file->samples(iX),
file->samples(i)
);
}
}
ownerOuts->repaint();
if(in){
if(iIn >= file->size()){
iIn = -1;
delete in;
in = NULL;
}
else{
in->setSamples(
file->samples(iX),
file->samples(iIn)
);
}
static_cast<InPlot*>(ownerIn)->clearInterval();
}
}
示例4: itemList
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuSummaryQwtPlot::selectClosestCurve(const QPoint& pos)
{
QwtPlotCurve* closestCurve = NULL;
double distMin = DBL_MAX;
const QwtPlotItemList& itmList = itemList();
for(QwtPlotItemIterator it = itmList.begin(); it != itmList.end(); it++)
{
if((*it)->rtti() == QwtPlotItem::Rtti_PlotCurve)
{
QwtPlotCurve* candidateCurve = static_cast<QwtPlotCurve*>(*it);
double dist = DBL_MAX;
candidateCurve->closestPoint(pos, &dist);
if(dist < distMin)
{
closestCurve = candidateCurve;
distMin = dist;
}
}
}
if(closestCurve && distMin < 20)
{
RimSummaryCurve* selectedCurve = m_plotDefinition->findRimCurveFromQwtCurve(closestCurve);
if(selectedCurve)
{
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(selectedCurve);
}
}
}
示例5: removeSampleSource
void AmplitudePlot::removeSampleSource(PointSampler* src) {
QwtPlotCurve* curve = _sources.take(src);
curve->detach();
src->disconnect(this);
delete curve;
updatePlot();
}
示例6: QwtPlotCurve
unsigned int QmitkPlotWidget::InsertCurve(const char* title)
{
QwtPlotCurve* curve = new QwtPlotCurve(QwtText(title));
m_PlotCurveVector.push_back(curve);
curve->attach(m_Plot);
return static_cast<unsigned int> (m_PlotCurveVector.size() - 1);
}
示例7: QwtPlotCurve
void Plot::insertCurve(Qt::Orientation o,
const QColor &c, double base)
{
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setPen(c);
curve->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,
Qt::gray, c, QSize(8, 8)));
double x[10];
double y[sizeof(x) / sizeof(x[0])];
for ( uint i = 0; i < sizeof(x) / sizeof(x[0]); i++ )
{
double v = 5.0 + i * 10.0;
if ( o == Qt::Horizontal )
{
x[i] = v;
y[i] = base;
}
else
{
x[i] = base;
y[i] = v;
}
}
curve->setSamples(x, y, sizeof(x) / sizeof(x[0]));
curve->attach(this);
}
示例8: setAutoScale
void PlotSettingsDialog::
setAutoScale( const std::vector<QwtPlot*>& plots, QwtPlot::Axis axis ) {
const double margin = 1.05;
for( unsigned int i=0 ; i < plots.size() ; i++ ) {
double max = -9e99;
double min = 9e99;
QwtPlotItemList L = plots[i]->itemList();
for (int id = 0; id < L.size(); ++id) {
if (L[id]->rtti() != QwtPlotItem::Rtti_PlotCurve)
continue;
QwtPlotCurve *curve = dynamic_cast<QwtPlotCurve*>(L[i]);
if( axis == QwtPlot::xBottom ) {
max = std::max( max, curve->maxXValue() );
min = std::min( min, curve->minXValue() );
}
else {
max = std::max( max, curve->maxYValue() );
min = std::min( min, curve->minYValue() );
}
}
plots[i]->setAxisScale( axis, min*(2-margin), max*margin );
plots[i]->replot();
}
}
示例9: QwtPlotCurve
void Plot::drawDots(QVector< QVector<struct numCluster> > data, double n, double k, int index, int size, int number)
{
int j, l;
QPolygonF points;
QwtPlotCurve *curve;
QwtSymbol *symbol;
points.clear();
curve = new QwtPlotCurve();//QString("y = norm%1(x)").arg(index));
curve->setItemAttribute(QwtPlotItem::Legend, false);
curve->setStyle( QwtPlotCurve::Dots );
for (l = 0; l < data.size(); l++){
if (data[l][number].cluster == index){
// ПЕРЕДЕЛАТЬ если возможно!!! Нужно, чтобы он печатал сразу для всех кластеров одной л.п.
if (index == 0 && data[l][number].number < n){
points << QPointF(data[l][number].number, 1);
}else if (index == size - 1 && data[l][number].number > n){
points << QPointF(data[l][number].number, 1);
}else{
points << QPointF(data[l][number].number, func_normal(data[l][number].number,n,k));
}
//std::cout << index << "data = " << data[l][i].number << std::endl;
}
}
curve->setSamples(points);
switch (index % 5){
case 0:
symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::yellow ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
curve->setSymbol(symbol);
break;
case 1:
symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::green ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
curve->setSymbol(symbol);
break;
case 2:
symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::cyan ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
curve->setSymbol(symbol);
break;
case 3:
symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::magenta ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
curve->setSymbol(symbol);
break;
case 4:
symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::gray ), QPen( Qt::red, 1 ), QSize( 8, 8 ) );
curve->setSymbol(symbol);
break;
default:
break;
}
curve->attach(this);
this->replot();
}
示例10: getSymbolSize
int CurvesModel::getSymbolSize(int row) const {
SolvWidget* solv = solvers->at(row);
QwtPlotCurve* curve = solv->curve;
if(curve->symbol() != NULL && curve->symbol()->style() != QwtSymbol::NoSymbol) {
return curve->symbol()->size().width();
}
return 7;
}
示例11: getSymbolColor
QColor CurvesModel::getSymbolColor(int row) const {
SolvWidget* solv = solvers->at(row);
QwtPlotCurve* curve = solv->curve;
if(curve->symbol() != NULL && curve->symbol()->style() != QwtSymbol::NoSymbol) {
return curve->symbol()->pen().color();
}
return curve->pen().color();
}
示例12: QwtPlotCurve
QwtPlotCurve* Curves::createCurve(int i) const
{
QwtPlotCurve* curve = new QwtPlotCurve(file->header(i));
curve->setRenderHint(QwtPlotCurve::RenderAntialiased);
curve->setPen(QPen(QColor(rand() % 255, rand() % 255, rand() % 255), 2));
curve->setPaintAttribute(QwtPlotCurve::ClipPolygons);
return curve;
}
示例13: double
void Plot::drawFunc(QVector params, double (*f)(double, QVector)){
int j;
QwtPlotCurve *curve = new QwtPlotCurve(QString("m: %1; a: %2").arg(m).arg(a));
curve->setData(new FuncData(params, f));
curve->attach(this);
this->replot();
}
示例14: QwtPlotCurve
void MQwt::curve(var iX, var iY, var iTitle)
{
QwtPlotCurve* curve = new QwtPlotCurve(iTitle.str());
curve->attach(mPlot);
curve->setRenderHint(QwtPlotItem::RenderAntialiased);
curve->setSamples(
iX.ptr<double>(), iY.ptr<double>(), std::min(iX.size(), iY.size())
);
}
示例15: fit
void ExpDecayDialog::fit()
{
QString curve = boxName->currentText();
QwtPlotCurve *c = graph->curve(curve);
QStringList curvesList = graph->analysableCurvesList();
if (!c || !curvesList.contains(curve)){
QMessageBox::critical(this,tr("QtiPlot - Warning"),
tr("The curve <b> %1 </b> doesn't exist anymore! Operation aborted!").arg(curve));
boxName->clear();
boxName->addItems(curvesList);
return;
}
ApplicationWindow *app = (ApplicationWindow *)this->parent();
if (!app)
return;
if (fitter)
delete fitter;
if (slopes == 3){
double x_init[7] = {1.0, boxFirst->value(), 1.0, boxSecond->value(), 1.0, boxThird->value(), boxYOffset->value()};
fitter = new ThreeExpFit(app, graph);
fitter->setInitialGuesses(x_init);
} else if (slopes == 2) {
double x_init[5] = {1.0, boxFirst->value(), 1.0, boxSecond->value(), boxYOffset->value()};
fitter = new TwoExpFit(app, graph);
fitter->setInitialGuesses(x_init);
} else if (slopes == 1 || slopes == -1){
double x_init[3] = {boxAmplitude->value(), slopes*boxFirst->value(), boxYOffset->value()};
fitter = new ExponentialFit(app, graph, slopes == -1);
fitter->setInitialGuesses(x_init);
}
if (fitter->setDataFromCurve(boxName->currentText(), boxStart->value(), c->maxXValue())){
fitter->setColor(boxColor->currentItem());
fitter->scaleErrors(app->fit_scale_errors);
fitter->setOutputPrecision(app->fit_output_precision);
fitter->generateFunction(app->generateUniformFitPoints, app->fitPoints);
fitter->fit();
double *results = fitter->results();
boxFirst->setValue(results[1]);
if (slopes < 2){
boxAmplitude->setValue(results[0]);
boxYOffset->setValue(results[2]);
} else if (slopes == 2){
boxSecond->setValue(results[3]);
boxYOffset->setValue(results[4]);
} else if (slopes == 3){
boxSecond->setValue(results[3]);
boxThird->setValue(results[5]);
boxYOffset->setValue(results[6]);
}
}
}