本文整理汇总了C++中xAxis函数的典型用法代码示例。如果您正苦于以下问题:C++ xAxis函数的具体用法?C++ xAxis怎么用?C++ xAxis使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xAxis函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xAxis
void XYChartCore::paintAxis(QPainter* painter)
{
const qreal minKey = xAxis()->minimumValue();
const qreal maxKey = xAxis()->maximumValue();
const qreal minValue = yAxis()->minimumValue();
const qreal maxValue = yAxis()->maximumValue();
const QPointF origo = translatePoint(QPointF(0.0, 0.0));
const QPointF p1 = translatePoint(QPointF(minKey, 0.0));
const QPointF p2 = translatePoint(QPointF(maxKey, 0.0));
const QPointF p3 = translatePoint(QPointF(0.0, minValue));
const QPointF p4 = translatePoint(QPointF(0.0, maxValue));
if (origo != p1)
painter->drawLine(origo, p1);
if (origo != p2)
painter->drawLine(origo, p2);
if (origo != p3)
painter->drawLine(origo, p3);
if (origo != p4)
painter->drawLine(origo, p4);
}
示例2: plot
void QwtPlotZoomer::rescale()
{
QwtPlot *plt = plot();
if ( !plt )
return;
const QRectF &rect = d_data->zoomStack[d_data->zoomRectIndex];
if ( rect != scaleRect() )
{
const bool doReplot = plt->autoReplot();
plt->setAutoReplot( false );
double x1 = rect.left();
double x2 = rect.right();
if ( !plt->axisScaleDiv( xAxis() ).isIncreasing() )
qSwap( x1, x2 );
plt->setAxisScale( xAxis(), x1, x2 );
double y1 = rect.top();
double y2 = rect.bottom();
if ( !plt->axisScaleDiv( yAxis() ).isIncreasing() )
qSwap( y1, y2 );
plt->setAxisScale( yAxis(), y1, y2 );
plt->setAutoReplot( doReplot );
plt->replot();
}
}
示例3: setXValue
void ImageMarker::updateBoundingRect() {
if (!plot()) return;
setXValue(plot()->invTransform(xAxis(), d_pos.x()));
d_x_right = plot()->invTransform(xAxis(), d_pos.x() + d_size.width());
setYValue(plot()->invTransform(yAxis(), d_pos.y()));
d_y_bottom = plot()->invTransform(yAxis(), d_pos.y() + d_size.height());
}
示例4: plot
/*!
Return normalized bounding rect of the axes
\warning Calling QwtPlot::setAxisScale() while QwtPlot::autoReplot() is FALSE
leaves the axis in an 'intermediate' state.
In this case, to prevent buggy behaviour, you must call
QwtPlot::replot() before calling QwtPlotPicker::scaleRect().
This quirk will be removed in a future release.
\sa QwtPlot::autoReplot(), QwtPlot::replot().
*/
QwtDoubleRect QwtPlotPicker::scaleRect() const
{
const QwtPlot *plt = plot();
const QwtDoubleRect rect(
plt->axisScale(xAxis())->lBound(),
plt->axisScale(xAxis())->hBound(),
plt->axisScale(yAxis())->lBound(),
plt->axisScale(yAxis())->hBound()
);
return rect.normalize();
}
示例5: clearLabels
void Spectrogram::createLabels()
{
clearLabels();
QwtValueList levels = contourLevels();
const int numLevels = levels.size();
for (int l = 0; l < numLevels; l++){
PlotMarker *m = new PlotMarker(l, d_labels_angle);
QwtText t = QwtText(QString::number(levels[l]));
t.setColor(d_labels_color);
t.setFont(d_labels_font);
if (d_white_out_labels)
t.setBackgroundBrush(QBrush(Qt::white));
else
t.setBackgroundBrush(QBrush(Qt::transparent));
m->setLabel(t);
int x_axis = xAxis();
int y_axis = yAxis();
m->setAxis(x_axis, y_axis);
if (d_graph && d_show_labels)
m->attach(d_graph);
d_labels_list << m;
}
}
示例6: boundingRect
QwtDoubleRect PlotCurve::boundingRect() const
{
QwtDoubleRect r = QwtPlotCurve::boundingRect();
double percent = 0.01;
double dw = percent*fabs(r.right() - r.left());
double left = r.left() - dw;
if (left <= 0.0) {
ScaleEngine *sc_engine = (ScaleEngine *)this->plot()->axisScaleEngine(xAxis());
if (sc_engine && (sc_engine->type() == ScaleTransformation::Log10 ||
sc_engine->type() == ScaleTransformation::Log2 ||
sc_engine->type() == ScaleTransformation::Ln))
left = r.left();
}
r.setLeft(left);
r.setRight(r.right() + dw);
double dh = percent*fabs(r.top() - r.bottom());
r.setBottom(r.bottom() + dh);
double top = r.top() - dh;
if (top <= 0.0) {
ScaleEngine *sc_engine = (ScaleEngine *)this->plot()->axisScaleEngine(yAxis());
if (sc_engine && (sc_engine->type() == ScaleTransformation::Log10 ||
sc_engine->type() == ScaleTransformation::Log2 ||
sc_engine->type() == ScaleTransformation::Ln))
top = r.top();
}
r.setTop(top);
return r;
}
示例7: makeChamber
BaseIF* makeChamber(const Real& radius,
const Real& thick,
const Real& offset,
const Real& height)
{
RealVect zero(D_DECL(0.0,0.0,0.0));
RealVect xAxis(D_DECL(1.0,0.0,0.0));
bool inside = true;
Vector<BaseIF*> pieces;
// Create a chamber
TiltedCylinderIF chamberOut(radius + thick/2.0,xAxis,zero, inside);
TiltedCylinderIF chamberIn (radius - thick/2.0,xAxis,zero,!inside);
IntersectionIF infiniteChamber(chamberIn,chamberOut);
pieces.push_back(&infiniteChamber);
RealVect normal1(D_DECL(1.0,0.0,0.0));
RealVect point1(D_DECL(offset,0.0,0.0));
PlaneIF plane1(normal1,point1,inside);
pieces.push_back(&plane1);
RealVect normal2(D_DECL(-1.0,0.0,0.0));
RealVect point2(D_DECL(offset+height,0.0,0.0));
PlaneIF plane2(normal2,point2,inside);
pieces.push_back(&plane2);
IntersectionIF* chamber = new IntersectionIF(pieces);
return chamber;
}
示例8: minZoomSize
/*!
Expand the selected rectangle to minZoomSize() and zoom in
if accepted.
\param ok If true, complete the selection and emit selected signals
otherwise discard the selection.
\sa accept(), minZoomSize()
\return True if the selection has been accepted, false otherwise
*/
bool QwtPlotZoomer::end( bool ok )
{
ok = QwtPlotPicker::end( ok );
if ( !ok )
return false;
QwtPlot *plot = QwtPlotZoomer::plot();
if ( !plot )
return false;
const QPolygon &pa = selection();
if ( pa.count() < 2 )
return false;
QRect rect = QRect( pa.first(), pa.last() );
rect = rect.normalized();
const QwtScaleMap xMap = plot->canvasMap( xAxis() );
const QwtScaleMap yMap = plot->canvasMap( yAxis() );
QRectF zoomRect = QwtScaleMap::invTransform( xMap, yMap, rect ).normalized();
zoomRect = qwtExpandedZoomRect( zoomRect, minZoomSize(),
xMap.transformation(), yMap.transformation() );
zoom( zoomRect );
return true;
}
示例9: xAxis
Matrix RendererD3D::GetBillboardMatrix(Vector cameraPos, Vector upVector)
{
Vector xAxis(0.0f,0.0f,0.0f);
Vector yAxis(0.0f,0.0f,0.0f);
Vector zAxis(0.0f,0.0f,0.0f);
Vector upVect(0.0f,1.0f,0.0f);
Vector cameraVector = cameraPos;
zAxis = cameraVector;
zAxis.normalize();
xAxis = zAxis.Cross(upVect);
xAxis.normalize();
yAxis = xAxis.Cross(zAxis);
yAxis.normalize();
Matrix transform = { xAxis.x, xAxis.y, xAxis.z, 0.0f,
yAxis.x, yAxis.y, yAxis.z, 0.0f,
zAxis.x, zAxis.y, zAxis.z, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f };
return transform;
}
示例10: QPoint
QPoint ArrowMarker::endPoint() const {
if (!plot())
return QPoint();
return QPoint(plot()->transform(xAxis(), d_rect.right()),
plot()->transform(yAxis(), d_rect.bottom()));
}
示例11: makeVanes
BaseIF* makeVanes(const int& num,
const Real& thick,
const RealVect& normal,
const Real& innerRadius,
const Real& outerRadius,
const Real& offset,
const Real& height)
{
RealVect zero(D_DECL(0.0,0.0,0.0));
RealVect xAxis(D_DECL(1.0,0.0,0.0));
BaseIF* oneVane = makeVane(thick,normal,innerRadius,outerRadius,offset,height);
Vector<BaseIF*> eachVane;
for (int i = 0; i < num; i++)
{
Real angle = i * 2*M_PI / num;
TransformIF* currentVane = new TransformIF(*oneVane);
currentVane->rotate(angle,zero,xAxis);
eachVane.push_back(currentVane);
}
UnionIF* allVanes = new UnionIF(eachVane);
return allVanes;
}
示例12: plot
void QwtPlotScaleItem::updateBorders()
{
const QwtPlot *plt = plot();
if ( plt == NULL || !d_data->scaleDivFromAxis )
return;
const QRect r = plt->canvas()->contentsRect();
d_data->canvasRectCache = r;
QwtDoubleInterval interval;
if ( d_data->scaleDraw->orientation() == Qt::Horizontal )
{
const QwtScaleMap map = plt->canvasMap(xAxis());
interval.setMinValue(map.invTransform(r.left()));
interval.setMaxValue(map.invTransform(r.right()));
}
else
{
const QwtScaleMap map = plt->canvasMap(yAxis());
interval.setMinValue(map.invTransform(r.bottom()));
interval.setMaxValue(map.invTransform(r.top()));
}
QwtScaleDiv scaleDiv = d_data->scaleDraw->scaleDiv();
scaleDiv.setInterval(interval);
d_data->scaleDraw->setScaleDiv(scaleDiv);
}
示例13: QwtPlotMarker
void Grid::enableZeroLineY(bool enable)
{
Graph *d_plot = (Graph *)plot();
if (!d_plot)
return;
if (!mrkY && enable) {
mrkY = new QwtPlotMarker();
d_plot->insertMarker(mrkY);
mrkY->setRenderHint(QwtPlotItem::RenderAntialiased, false);
mrkY->setAxis(xAxis(), yAxis());
mrkY->setLineStyle(QwtPlotMarker::HLine);
mrkY->setValue(0.0, 0.0);
QColor c = Qt::black;
if (d_plot->axisEnabled (QwtPlot::xBottom))
c = d_plot->axisWidget(QwtPlot::xBottom)->palette().color(QPalette::Foreground);
else if (d_plot->axisEnabled (QwtPlot::xTop))
c = d_plot->axisWidget(QwtPlot::xTop)->palette().color(QPalette::Foreground);
mrkY->setLinePen(QPen(c, d_plot->axesLinewidth(), Qt::SolidLine));
} else if (mrkY && !enable){
mrkY->detach();
d_plot->replot();
mrkY = NULL;
}
}
示例14: Spectrogram
Spectrogram* Spectrogram::copy(Graph *g)
{
Spectrogram *new_s = new Spectrogram(g, matrix());
new_s->setDisplayMode(QwtPlotSpectrogram::ImageMode, testDisplayMode(QwtPlotSpectrogram::ImageMode));
new_s->setDisplayMode(QwtPlotSpectrogram::ContourMode, testDisplayMode(QwtPlotSpectrogram::ContourMode));
new_s->setCustomColorMap(color_map);
new_s->setAxis(xAxis(), yAxis());
new_s->setDefaultContourPen(defaultContourPen());
new_s->color_map_policy = color_map_policy;
new_s->d_show_labels = d_show_labels;
new_s->d_labels_angle = d_labels_angle;
new_s->d_labels_color = d_labels_color;
new_s->d_white_out_labels = d_white_out_labels;
new_s->d_labels_font = d_labels_font;
new_s->d_labels_x_offset = d_labels_x_offset;
new_s->d_labels_y_offset = d_labels_y_offset;
new_s->setContourLevels(contourLevels());
if (defaultContourPen().style() == Qt::NoPen && !d_color_map_pen)
new_s->setContourPenList(d_pen_list);
else
new_s->d_color_map_pen = d_color_map_pen;
QList <PlotMarker *> lst = new_s->labelsList();
int count = lst.size();
for(int i = 0; i < count; i++){
PlotMarker *m = lst[i];
PlotMarker *mrk = d_labels_list[i];
if (m && mrk)
m->setLabelOffset(mrk->xLabelOffset(), mrk->yLabelOffset());
}
return new_s;
}
示例15: xAxis
void ScrollZoomer::layoutScrollBars(const QRect &rect) {
int hPos = xAxis();
if (hScrollBarPosition() == OppositeToScale) hPos = oppositeAxis(hPos);
int vPos = yAxis();
if (vScrollBarPosition() == OppositeToScale) vPos = oppositeAxis(vPos);
ScrollBar *hScrollBar = horizontalScrollBar();
ScrollBar *vScrollBar = verticalScrollBar();
const int hdim = hScrollBar ? hScrollBar->extent() : 0;
const int vdim = vScrollBar ? vScrollBar->extent() : 0;
if (hScrollBar && hScrollBar->isVisible())
{
int x = rect.x();
int y = (hPos == QwtPlot::xTop) ? rect.top() : rect.bottom() - hdim + 1;
int w = rect.width();
if (vScrollBar && vScrollBar->isVisible())
{
if (vPos == QwtPlot::yLeft)
x += vdim;
w -= vdim;
}
hScrollBar->setGeometry(x, y, w, hdim);
}
if (vScrollBar && vScrollBar->isVisible())
{
int pos = yAxis();
if (vScrollBarPosition() == OppositeToScale)
pos = oppositeAxis(pos);
int x = (vPos == QwtPlot::yLeft) ? rect.left() : rect.right() - vdim + 1;
int y = rect.y();
int h = rect.height();
if (hScrollBar && hScrollBar->isVisible())
{
if (hPos == QwtPlot::xTop)
y += hdim;
h -= hdim;
}
vScrollBar->setGeometry(x, y, vdim, h);
}
if (hScrollBar && hScrollBar->isVisible() && vScrollBar
&& vScrollBar->isVisible())
{
if (d_cornerWidget)
{
QRect cornerRect(vScrollBar->pos().x(), hScrollBar->pos().y(), vdim,
hdim);
d_cornerWidget->setGeometry(cornerRect);
}
}
}