qscatterseries.cpp
98 lines
| 2.0 KiB
| text/x-c
|
CppLexer
|
r42 | #include "qscatterseries.h" | ||
#include "qchart.h" | ||||
|
r300 | /*! | ||
\class QScatterSeries | ||||
|
r481 | \brief The QScatterSeries class is used for making scatter charts. | ||
|
r42 | |||
|
r300 | \mainclass | ||
|
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. | ||||
|
r300 | |||
|
r481 | \image scatterchart.png | ||
|
r300 | |||
|
r481 | Creating basic scatter chart is simple: | ||
\code | ||||
QScatterSeries* series = new QScatterSeries(); | ||||
series->add(0, 6); | ||||
series->add(2, 4); | ||||
... | ||||
chartView->addSeries(series); | ||||
\endcode | ||||
|
r300 | */ | ||
|
r42 | |||
|
r261 | /*! | ||
\enum QScatterSeries::MarkerShape | ||||
This enum describes the shape used when rendering marker items. | ||||
\value MarkerShapeCircle | ||||
|
r541 | \value MarkerShapeRectangle | ||
|
r261 | */ | ||
|
r260 | /*! | ||
|
r300 | \fn QChartSeriesType QScatterSeries::type() const | ||
\brief Returns QChartSeries::SeriesTypeScatter. | ||||
|
r481 | \sa QSeries, QSeriesType | ||
|
r300 | */ | ||
|
r260 | |||
|
r300 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||
|
r261 | /*! | ||
Constructs a series object which is a child of \a parent. | ||||
*/ | ||||
|
r158 | QScatterSeries::QScatterSeries(QObject *parent) : | ||
|
r470 | QXYSeries(parent), | ||
|
r541 | m_shape(QScatterSeries::MarkerShapeCircle), | ||
|
r702 | m_size(15.0) | ||
|
r42 | { | ||
} | ||||
|
r260 | /*! | ||
|
r261 | Destroys the object. Note that adding series to QChart transfers the ownership to the chart. | ||
|
r260 | */ | ||
|
r158 | QScatterSeries::~QScatterSeries() | ||
|
r42 | { | ||
|
r48 | } | ||
|
r261 | /*! | ||
|
r459 | Returns the shape used for drawing markers. | ||
|
r261 | */ | ||
|
r459 | QScatterSeries::MarkerShape QScatterSeries::shape() const | ||
|
r195 | { | ||
|
r573 | return m_shape; | ||
|
r195 | } | ||
|
r261 | /*! | ||
|
r300 | Overrides the default shape of the marker items with a user defined \a shape. The default shape | ||
is defined by chart theme setting. | ||||
|
r261 | */ | ||
|
r358 | void QScatterSeries::setShape(MarkerShape shape) | ||
|
r195 | { | ||
|
r743 | if (m_shape != shape) { | ||
m_shape = shape; | ||||
|
r573 | emit QXYSeries::updated(); | ||
} | ||||
|
r195 | } | ||
|
r397 | /*! | ||
Returns the size of the marker items. | ||||
*/ | ||||
|
r459 | qreal QScatterSeries::size() const | ||
|
r397 | { | ||
|
r470 | return m_size; | ||
|
r397 | } | ||
/*! | ||||
Set the \a size of the marker items. The default size is 9.0. | ||||
*/ | ||||
void QScatterSeries::setSize(qreal size) | ||||
{ | ||||
|
r743 | if (m_size != size) { | ||
m_size = size; | ||||
|
r573 | emit updated(); | ||
} | ||||
|
r397 | } | ||
|
r42 | QTCOMMERCIALCHART_END_NAMESPACE | ||