本文整理汇总了C++中QwtPlotCurve::y方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotCurve::y方法的具体用法?C++ QwtPlotCurve::y怎么用?C++ QwtPlotCurve::y使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtPlotCurve
的用法示例。
在下文中一共展示了QwtPlotCurve::y方法的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: 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;
}
}
示例3: setYScale
/**
* Set the scale of the vertical axis
* @param from :: Minimum value
* @param to :: Maximum value
*/
void OneCurvePlot::setYScale(double from, double to)
{
if (isYLogScale())
{
if (from == 0 && to == 0)
{
from = 1;
to = 10;
}
else
{
double yPositiveMin = to;
QMap<QString,QwtPlotCurve*>::const_iterator cv = m_stored.begin();
QwtPlotCurve* curve = NULL;
do
{
if (cv != m_stored.end())
{
curve = cv.value();
++cv;
}
else if (curve == m_curve)
{
curve = NULL;
break;
}
else
{
curve = m_curve;
}
if (!curve) break;
int n = curve->dataSize();
for(int i = 0; i < n; ++i)
{
double y = curve->y(i);
if (y > 0 && y < yPositiveMin)
{
yPositiveMin = y;
}
}
}while(curve);
from = yPositiveMin;
}
}
setAxisScale(QwtPlot::yLeft,from,to);
m_zoomer->setZoomBase();
}