qscatterseries.cpp
108 lines
| 2.3 KiB
| text/x-c
|
CppLexer
Tero Ahola
|
r42 | #include "qscatterseries.h" | ||
#include "qchart.h" | ||||
Tero Ahola
|
r300 | /*! | ||
\class QScatterSeries | ||||
Michal Klocek
|
r481 | \brief The QScatterSeries class is used for making scatter charts. | ||
Tero Ahola
|
r42 | |||
Tero Ahola
|
r300 | \mainclass | ||
Michal Klocek
|
r481 | The scatter data is displayed as a collection of points on the chart. Each point determines the position on the horizontal axis | ||
and the vertical axis. | ||||
Tero Ahola
|
r300 | |||
Michal Klocek
|
r481 | \image scatterchart.png | ||
Tero Ahola
|
r300 | |||
Michal Klocek
|
r481 | Creating basic scatter chart is simple: | ||
\code | ||||
QScatterSeries* series = new QScatterSeries(); | ||||
series->add(0, 6); | ||||
series->add(2, 4); | ||||
... | ||||
chartView->addSeries(series); | ||||
\endcode | ||||
Tero Ahola
|
r300 | */ | ||
Tero Ahola
|
r42 | |||
Tero Ahola
|
r261 | /*! | ||
\enum QScatterSeries::MarkerShape | ||||
This enum describes the shape used when rendering marker items. | ||||
\value MarkerShapeDefault | ||||
\value MarkerShapeX | ||||
\value MarkerShapeRectangle | ||||
Tero Ahola
|
r459 | \value MarkerShapeRoundedRectangle | ||
Tero Ahola
|
r261 | \value MarkerShapeTiltedRectangle | ||
\value MarkerShapeTriangle | ||||
\value MarkerShapeCircle | ||||
*/ | ||||
Tero Ahola
|
r260 | /*! | ||
Tero Ahola
|
r300 | \fn QChartSeriesType QScatterSeries::type() const | ||
\brief Returns QChartSeries::SeriesTypeScatter. | ||||
Michal Klocek
|
r481 | \sa QSeries, QSeriesType | ||
Tero Ahola
|
r300 | */ | ||
Tero Ahola
|
r260 | |||
Tero Ahola
|
r300 | /*! | ||
Michal Klocek
|
r481 | \fn void QScatterSeries::clicked(const QPointF& point) | ||
\brief Signal is emitted when user clicks the \a point on scatter chart. | ||||
Tero Ahola
|
r300 | */ | ||
Tero Ahola
|
r260 | |||
Tero Ahola
|
r300 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||
Tero Ahola
|
r261 | /*! | ||
Constructs a series object which is a child of \a parent. | ||||
*/ | ||||
Tero Ahola
|
r158 | QScatterSeries::QScatterSeries(QObject *parent) : | ||
Michal Klocek
|
r470 | QXYSeries(parent), | ||
m_shape(QScatterSeries::MarkerShapeDefault), | ||||
m_size(9.0) | ||||
Tero Ahola
|
r42 | { | ||
} | ||||
Tero Ahola
|
r260 | /*! | ||
Tero Ahola
|
r261 | Destroys the object. Note that adding series to QChart transfers the ownership to the chart. | ||
Tero Ahola
|
r260 | */ | ||
Tero Ahola
|
r158 | QScatterSeries::~QScatterSeries() | ||
Tero Ahola
|
r42 | { | ||
Tero Ahola
|
r48 | } | ||
Tero Ahola
|
r261 | /*! | ||
Tero Ahola
|
r459 | Returns the shape used for drawing markers. | ||
Tero Ahola
|
r261 | */ | ||
Tero Ahola
|
r459 | QScatterSeries::MarkerShape QScatterSeries::shape() const | ||
Tero Ahola
|
r195 | { | ||
Michal Klocek
|
r470 | return (QScatterSeries::MarkerShape) m_shape; | ||
Tero Ahola
|
r195 | } | ||
Tero Ahola
|
r261 | /*! | ||
Tero Ahola
|
r300 | Overrides the default shape of the marker items with a user defined \a shape. The default shape | ||
is defined by chart theme setting. | ||||
Tero Ahola
|
r261 | */ | ||
Tero Ahola
|
r358 | void QScatterSeries::setShape(MarkerShape shape) | ||
Tero Ahola
|
r195 | { | ||
Michal Klocek
|
r470 | m_shape = shape; | ||
emit updated(); | ||||
Tero Ahola
|
r195 | } | ||
Tero Ahola
|
r397 | /*! | ||
Returns the size of the marker items. | ||||
*/ | ||||
Tero Ahola
|
r459 | qreal QScatterSeries::size() const | ||
Tero Ahola
|
r397 | { | ||
Michal Klocek
|
r470 | return m_size; | ||
Tero Ahola
|
r397 | } | ||
/*! | ||||
Set the \a size of the marker items. The default size is 9.0. | ||||
*/ | ||||
void QScatterSeries::setSize(qreal size) | ||||
{ | ||||
Michal Klocek
|
r470 | m_size = size; | ||
emit updated(); | ||||
Tero Ahola
|
r397 | } | ||
Michal Klocek
|
r470 | |||
Tero Ahola
|
r42 | #include "moc_qscatterseries.cpp" | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||