/*! \brief Attach the marker to a Y axis \param key Marker key \param axis Axis to be attached \return \c TRUE if the specified marker exists */ bool QwtPlot::setMarkerYAxis(long key, int axis) { QwtPlotMarker *m; if ((m = d_markers->find(key))) { m->setYAxis(axis); return TRUE; } else return FALSE; }
void Graph::addMarker(double val, const QColor &color, int axis) { QwtPlotMarker *m = new QwtPlotMarker(); m->setLineStyle(axis == QwtPlot::xBottom ? QwtPlotMarker::VLine : QwtPlotMarker::HLine); m->setLinePen(QPen(color)); m->setYAxis(axis); m->setValue(val, val); m->attach(this); m->setLabel(QString::number(val)); if(axis == QwtPlot::xBottom) m->setLabelAlignment(Qt::AlignLeft | Qt::AlignVCenter); else m->setLabelAlignment(Qt::AlignTop | Qt::AlignHCenter); getMarkers(axis).push_back(m); }