本文整理汇总了C++中QwtPlotCurve::x方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotCurve::x方法的具体用法?C++ QwtPlotCurve::x怎么用?C++ QwtPlotCurve::x使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotCurve
的用法示例。
在下文中一共展示了QwtPlotCurve::x方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: closestCurve
int Plot::closestCurve(int xpos, int ypos, int &dist, int &point)
{
QwtScaleMap map[QwtPlot::axisCnt];
for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
map[axis] = canvasMap(axis);
double dmin = 1.0e10;
int key = -1;
for (QMapIterator<int, QwtPlotCurve *> it = d_curves.begin(); it != d_curves.end(); ++it )
{
QwtPlotCurve *c = (QwtPlotCurve *)it.data();
if (!c)
continue;
for (int i=0; i<c->dataSize(); i++)
{
double cx = map[c->xAxis()].xTransform(c->x(i)) - double(xpos);
double cy = map[c->yAxis()].xTransform(c->y(i)) - double(ypos);
double f = qwtSqr(cx) + qwtSqr(cy);
if (f < dmin)
{
dmin = f;
key = it.key();
point = i;
}
}
}
dist = int(sqrt(dmin));
return key;
}
示例2: activateCurve
void FFTDialog::activateCurve(int index)
{
if (graph)
{
QwtPlotCurve *c = graph->curve(index);
if (!c)
return;
boxSampling->setText(QString::number(c->x(1) - c->x(0)));
}
else if (d_table)
{
double x0 = d_table->text(0, index).toDouble();
double x1 = d_table->text(1, index).toDouble();
boxSampling->setText(QString::number(x1 - x0));
}
};
示例3: scaleCurves
void LinePlot::scaleCurves(QwtPlotCurve *curve)
{
/// multiple curves based on units
const QwtPlotItemList &listPlotItem = m_qwtPlot->itemList();
QwtPlotCurve *plotCurve;
QwtPlotItemIterator itPlotItem;
int curveCount = numberOfCurves();
switch (curveCount)
{
case 0:
{
curve->setYAxis(QwtPlot::yLeft);
m_qwtPlot->enableAxis(QwtPlot::yRight, false);
break;
}
case 1:
{
curve->setYAxis(QwtPlot::yRight);
m_qwtPlot->enableAxis(QwtPlot::yRight, true);
break;
}
default: //scale
m_qwtPlot->enableAxis(QwtPlot::yRight, false);
// find min, max of all curves
// scale
int i;
for ( itPlotItem = listPlotItem.begin();itPlotItem!=listPlotItem.end();++itPlotItem)
{
if ( (*itPlotItem)->rtti() == QwtPlotItem::Rtti_PlotCurve)
{
plotCurve = (QwtPlotCurve*) (*itPlotItem);
if ((plotCurve->minYValue() != 0) || (plotCurve->maxYValue() != 1))
{
QwtArray<double> xData(plotCurve->dataSize());
QwtArray<double> yData(plotCurve->dataSize());
for (i = 0; i < plotCurve->dataSize(); i++)
{
xData[i] = plotCurve->x(i);
yData[i] = (plotCurve->y(i) - plotCurve->minYValue())/ (plotCurve->maxYValue() - plotCurve->minYValue());
}
// reset data
plotCurve->setTitle(plotCurve->title().text() + "[" + QString::number(plotCurve->minYValue()) + ", " + QString::number(plotCurve->maxYValue()) + "]");
plotCurve->setData(xData,yData);
}
}
}
break;
}
}