qscatterseries.cpp
98 lines
| 2.0 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 MarkerShapeCircle | ||||
Michal Klocek
|
r541 | \value MarkerShapeRectangle | ||
Tero Ahola
|
r261 | */ | ||
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 | 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), | ||
Michal Klocek
|
r541 | m_shape(QScatterSeries::MarkerShapeCircle), | ||
Michal Klocek
|
r470 | 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
|
r573 | return 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
|
r573 | if(m_shape!= shape){ | ||
m_shape=shape; | ||||
emit QXYSeries::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
|
r573 | if(m_size != size){ | ||
m_size=size; | ||||
emit updated(); | ||||
} | ||||
Tero Ahola
|
r397 | } | ||
Tero Ahola
|
r42 | QTCOMMERCIALCHART_END_NAMESPACE | ||