##// END OF EJS Templates
Added known issue about OSX chart lib name
Added known issue about OSX chart lib name

File last commit:

r1349:b992458fc24a
r1417:b1c8f04d3106
Show More
qscatterseries.cpp
178 lines | 4.4 KiB | text/x-c | CppLexer
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the Qt Commercial Charts Add-on.
**
** $QT_BEGIN_LICENSE$
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qscatterseries.h"
#include "qscatterseries_p.h"
#include "scatterchartitem_p.h"
#include "chartdataset_p.h"
#include "charttheme_p.h"
#include "chartanimator_p.h"
/*!
\class QScatterSeries
\brief The QScatterSeries class is used for making scatter charts.
\mainclass
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.
\image examples_scatterchart.png
Creating basic scatter chart is simple:
\code
QScatterSeries* series = new QScatterSeries();
series->append(0, 6);
series->append(2, 4);
...
chart->addSeries(series);
\endcode
*/
/*!
\enum QScatterSeries::MarkerShape
This enum describes the shape used when rendering marker items.
\value MarkerShapeCircle
\value MarkerShapeRectangle
*/
/*!
\property QScatterSeries::markerShape
Defines the shape of the marker used to draw the points in the series.
*/
/*!
\fn void QScatterSeries::markerShapeChanged()
Emitted when marker shape is changed
*/
/*!
\fn void QScatterSeries::markerSizeChanged()
Emitted when marker size is changed
*/
/*!
\property QScatterSeries::markerSize
Defines the size of the marker used to draw the points in the series.
*/
/*!
\fn QChartSeriesType QScatterSeries::type() const
\brief Returns QChartSeries::SeriesTypeScatter.
\sa QAbstractSeries, SeriesType
*/
QTCOMMERCIALCHART_BEGIN_NAMESPACE
/*!
Constructs a series object which is a child of \a parent.
*/
QScatterSeries::QScatterSeries(QObject *parent) : QXYSeries(*new QScatterSeriesPrivate(this),parent)
{
}
/*!
Destroys the object. Note that adding series to QChart transfers the ownership to the chart.
*/
QScatterSeries::~QScatterSeries()
{
Q_D(QScatterSeries);
if(d->m_dataset) {
d->m_dataset->removeSeries(this);
}
}
QAbstractSeries::SeriesType QScatterSeries::type() const
{
return QAbstractSeries::SeriesTypeScatter;
}
/*!
Returns the shape used for drawing markers.
*/
QScatterSeries::MarkerShape QScatterSeries::markerShape() const
{
Q_D(const QScatterSeries);
return d->m_shape;
}
/*!
Overrides the default shape of the marker items with a user defined \a shape. The default shape
is defined by chart theme setting.
*/
void QScatterSeries::setMarkerShape(MarkerShape shape)
{
Q_D(QScatterSeries);
if (d->m_shape != shape) {
d->m_shape = shape;
emit markerShapeChanged();
}
}
/*!
Returns the size of the marker items.
*/
qreal QScatterSeries::markerSize() const
{
Q_D(const QScatterSeries);
return d->m_size;
}
/*!
Set the \a size of the marker items. The default size is 15.
*/
void QScatterSeries::setMarkerSize(qreal size)
{
Q_D(QScatterSeries);
if (!qFuzzyIsNull(d->m_size - size)) {
d->m_size = size;
emit markerSizeChanged();
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
QScatterSeriesPrivate::QScatterSeriesPrivate(QScatterSeries* q):QXYSeriesPrivate(q),
m_shape(QScatterSeries::MarkerShapeCircle),
m_size(15.0)
{
};
Chart* QScatterSeriesPrivate::createGraphics(ChartPresenter* presenter)
{
Q_Q(QScatterSeries);
ScatterChartItem *scatter = new ScatterChartItem(q,presenter);
if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
scatter->setAnimator(presenter->animator());
scatter->setAnimation(new XYAnimation(scatter));
}
presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
return scatter;
}
#include "moc_qscatterseries.cpp"
QTCOMMERCIALCHART_END_NAMESPACE