##// END OF EJS Templates
Added casting to qreal in qMin, qFuzzyCompare calls to fix build on arm
Added casting to qreal in qMin, qFuzzyCompare calls to fix build on arm

File last commit:

r1651:03f0dcabe652
r1679:c4f8957d7b15
Show More
qscatterseries.cpp
264 lines | 6.9 KiB | text/x-c | CppLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
**
** 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$
**
****************************************************************************/
Tero Ahola
Integrated scatter type series...
r42 #include "qscatterseries.h"
Michal Klocek
Adds big fat pimpl to series classes...
r938 #include "qscatterseries_p.h"
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 #include "scatterchartitem_p.h"
#include "chartdataset_p.h"
#include "charttheme_p.h"
#include "chartanimator_p.h"
Tero Ahola
Integrated scatter type series...
r42
Tero Ahola
Scatter series documentation; now uses snippets
r300 /*!
\class QScatterSeries
Michal Klocek
Fixes for docs , adds xyseries docs
r481 \brief The QScatterSeries class is used for making scatter charts.
Tero Ahola
Integrated scatter type series...
r42
Tero Ahola
Scatter series documentation; now uses snippets
r300 \mainclass
Michal Klocek
Fixes for docs , adds xyseries docs
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
Scatter series documentation; now uses snippets
r300
Tero Ahola
Documentation fixes....
r995 \image examples_scatterchart.png
Tero Ahola
Scatter series documentation; now uses snippets
r300
Michal Klocek
Fixes for docs , adds xyseries docs
r481 Creating basic scatter chart is simple:
\code
QScatterSeries* series = new QScatterSeries();
Jani Honkonen
rename functions add() -> append()
r796 series->append(0, 6);
series->append(2, 4);
Michal Klocek
Fixes for docs , adds xyseries docs
r481 ...
Tero Ahola
Documentation fixes....
r995 chart->addSeries(series);
Michal Klocek
Fixes for docs , adds xyseries docs
r481 \endcode
Tero Ahola
Scatter series documentation; now uses snippets
r300 */
Tero Ahola
Documenting xy-series
r1491 /*!
\qmlclass ScatterSeries QScatterSeries
\inherits XYSeries
The following QML shows how to create a chart with two simple scatter series:
\snippet ../demos/qmlchart/qml/qmlchart/View5.qml 1
\snippet ../demos/qmlchart/qml/qmlchart/View5.qml 2
\beginfloatleft
\image demos_qmlchart5.png
\endfloat
\clearfloat
*/
Tero Ahola
Integrated scatter type series...
r42
Tero Ahola
Documenting QScatterSeries
r261 /*!
\enum QScatterSeries::MarkerShape
This enum describes the shape used when rendering marker items.
\value MarkerShapeCircle
Michal Klocek
Adds missing scatter intercation implementation...
r541 \value MarkerShapeRectangle
Tero Ahola
Documenting QScatterSeries
r261 */
Jani Honkonen
update scatter docs
r1341 /*!
Tero Ahola
color and borderColor properties to XY charts; removed unnecessary signals
r1481 \property QScatterSeries::color
Fill (brush) color of the series. This is a convenience property for modifying the color of brush.
\sa QScatterSeries::brush()
Jani Honkonen
update scatter docs
r1341 */
Tero Ahola
Added notifiers for scatter properties
r1349 /*!
Tero Ahola
color and borderColor properties to XY charts; removed unnecessary signals
r1481 \property QScatterSeries::borderColor
Line (pen) color of the series. This is a convenience property for modifying the color of pen.
\sa QScatterSeries::pen()
Tero Ahola
Added notifiers for scatter properties
r1349 */
/*!
Tero Ahola
Documenting xy-series
r1491 \property QScatterSeries::markerShape
Defines the shape of the marker used to draw the points in the series. The default shape is MarkerShapeCircle.
Tero Ahola
Added notifiers for scatter properties
r1349 */
Jani Honkonen
update scatter docs
r1341 /*!
Tero Ahola
Documenting xy-series
r1491 \qmlproperty MarkerShape ScatterSeries::markerShape
Defines the shape of the marker used to draw the points in the series. One of ScatterSeries
ScatterSeries.MarkerShapeCircle or ScatterSeries.MarkerShapeRectangle.
The default shape is ScatterSeries.MarkerShapeCircle.
*/
Jani Honkonen
update scatter docs
r1341
Tero Ahola
Documenting xy-series
r1491 /*!
\property QScatterSeries::markerSize
Defines the size of the marker used to draw the points in the series. The default size is 15.0.
*/
/*!
\qmlproperty real ScatterSeries::markerSize
Defines the size of the marker used to draw the points in the series. The default size is 15.0.
Tero Ahola
color and borderColor properties to XY charts; removed unnecessary signals
r1481 */
/*!
\fn void QScatterSeries::colorChanged(QColor color)
Tero Ahola
Documenting xy-series
r1491 Signal is emitted when the fill (brush) color has changed to \a color.
Tero Ahola
color and borderColor properties to XY charts; removed unnecessary signals
r1481 */
/*!
\fn void QScatterSeries::borderColorChanged(QColor color)
Tero Ahola
Documenting xy-series
r1491 Signal is emitted when the line (pen) color has changed to \a color.
*/
/*!
\qmlsignal ScatterSeries::borderColorChanged(color color)
Signal is emitted when the line (pen) color has changed to \a color.
Jani Honkonen
update scatter docs
r1341 */
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Scatter series documentation; now uses snippets
r300 \fn QChartSeriesType QScatterSeries::type() const
Tero Ahola
Documenting xy-series
r1491 Returns QChartSeries::SeriesTypeScatter.
Michal Klocek
Fixes to API , QSeriesType -> SeriesType , add missing getters
r1107 \sa QAbstractSeries, SeriesType
Tero Ahola
Scatter series documentation; now uses snippets
r300 */
Tero Ahola
QDoc to use style sheets...
r260
Tero Ahola
Scatter series documentation; now uses snippets
r300 QTCOMMERCIALCHART_BEGIN_NAMESPACE
Tero Ahola
Documenting QScatterSeries
r261 /*!
Constructs a series object which is a child of \a parent.
*/
Michal Klocek
Adds big fat pimpl to series classes...
r938 QScatterSeries::QScatterSeries(QObject *parent) : QXYSeries(*new QScatterSeriesPrivate(this),parent)
Tero Ahola
Integrated scatter type series...
r42 {
}
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Documenting QScatterSeries
r261 Destroys the object. Note that adding series to QChart transfers the ownership to the chart.
Tero Ahola
QDoc to use style sheets...
r260 */
Tero Ahola
Integrated scatter again. Missing functionality....
r158 QScatterSeries::~QScatterSeries()
Tero Ahola
Integrated scatter type series...
r42 {
Michal Klocek
Fix missing unbind call in destrutor in scatter series
r1270 Q_D(QScatterSeries);
if(d->m_dataset) {
d->m_dataset->removeSeries(this);
}
Tero Ahola
Resizing of QGraphicItems now possible by resize signal from QChart
r48 }
Michal Klocek
Fixes to API , QSeriesType -> SeriesType , add missing getters
r1107 QAbstractSeries::SeriesType QScatterSeries::type() const
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Tero Ahola
Renamed QSeries to QAbstractSeries
r988 return QAbstractSeries::SeriesTypeScatter;
Michal Klocek
Adds big fat pimpl to series classes...
r938 }
Marek Rosa
Scatterseries docs update
r1651 /*!
Sets \a pen used for drawing points' border on the chart. If the pen is not defined, the
pen from chart theme is used.
\sa QChart::setTheme()
*/
Tero Ahola
Color and border color properties of XYSeries
r1537 void QScatterSeries::setPen(const QPen &pen)
{
Q_D(QXYSeries);
if (d->m_pen != pen) {
bool emitColorChanged = d->m_pen.color() != pen.color();
d->m_pen = pen;
emit d->updated();
if (emitColorChanged)
emit borderColorChanged(pen.color());
}
}
Marek Rosa
Scatterseries docs update
r1651 /*!
Sets \a brush used for drawing points on the chart. If the brush is not defined, brush
from chart theme setting is used.
\sa QChart::setTheme()
*/
Tero Ahola
Color and border color properties of XYSeries
r1537 void QScatterSeries::setBrush(const QBrush &brush)
{
Q_D(QScatterSeries);
if (d->m_brush != brush) {
bool emitColorChanged = d->m_brush.color() != brush.color();
d->m_brush = brush;
emit d->updated();
if (emitColorChanged)
emit colorChanged(brush.color());
}
}
Tero Ahola
color and borderColor properties to XY charts; removed unnecessary signals
r1481 void QScatterSeries::setColor(const QColor &color)
{
QBrush b = brush();
if (b.color() != color) {
b.setColor(color);
setBrush(b);
}
}
QColor QScatterSeries::color() const
{
return brush().color();
}
void QScatterSeries::setBorderColor(const QColor &color)
{
QPen p = pen();
if (p.color() != color) {
p.setColor(color);
setPen(p);
}
}
QColor QScatterSeries::borderColor() const
{
return pen().color();
}
Tero Ahola
Scatter customization to QML api
r1276 QScatterSeries::MarkerShape QScatterSeries::markerShape() const
Tero Ahola
Scatter series marker visuals
r195 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 Q_D(const QScatterSeries);
return d->m_shape;
Tero Ahola
Scatter series marker visuals
r195 }
Tero Ahola
Scatter customization to QML api
r1276 void QScatterSeries::setMarkerShape(MarkerShape shape)
Tero Ahola
Scatter series marker visuals
r195 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 Q_D(QScatterSeries);
if (d->m_shape != shape) {
d->m_shape = shape;
Tero Ahola
color and borderColor properties to XY charts; removed unnecessary signals
r1481 emit d->updated();
Michal Klocek
minor. cleanuup in scatter API
r573 }
Tero Ahola
Scatter series marker visuals
r195 }
Tero Ahola
Scatter customization to QML api
r1276 qreal QScatterSeries::markerSize() const
Tero Ahola
Added size customization to QScatterSeries
r397 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 Q_D(const QScatterSeries);
return d->m_size;
Tero Ahola
Added size customization to QScatterSeries
r397 }
Tero Ahola
Scatter customization to QML api
r1276 void QScatterSeries::setMarkerSize(qreal size)
Tero Ahola
Added size customization to QScatterSeries
r397 {
Michal Klocek
Adds big fat pimpl to series classes...
r938 Q_D(QScatterSeries);
if (!qFuzzyIsNull(d->m_size - size)) {
d->m_size = size;
Tero Ahola
color and borderColor properties to XY charts; removed unnecessary signals
r1481 emit d->updated();
Michal Klocek
minor. cleanuup in scatter API
r573 }
Tero Ahola
Added size customization to QScatterSeries
r397 }
Michal Klocek
Adds big fat pimpl to series classes...
r938 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Tero Ahola
Color and border color properties of XYSeries
r1537 QScatterSeriesPrivate::QScatterSeriesPrivate(QScatterSeries* q) :
QXYSeriesPrivate(q),
m_shape(QScatterSeries::MarkerShapeCircle),
m_size(15.0)
Michal Klocek
Adds big fat pimpl to series classes...
r938 {
Tero Ahola
Color and border color properties of XYSeries
r1537 }
Michal Klocek
Adds big fat pimpl to series classes...
r938
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 Chart* QScatterSeriesPrivate::createGraphics(ChartPresenter* presenter)
{
Q_Q(QScatterSeries);
ScatterChartItem *scatter = new ScatterChartItem(q,presenter);
if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
Michal Klocek
Refactors animation handling for xyseries
r1217 scatter->setAnimator(presenter->animator());
scatter->setAnimation(new XYAnimation(scatter));
Michal Klocek
Refactor to use qseries private for implmentation interface...
r943 }
presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
return scatter;
}
Tero Ahola
Scatter customization to QML api
r1276 #include "moc_qscatterseries.cpp"
Michal Klocek
Adds big fat pimpl to series classes...
r938
Tero Ahola
Integrated scatter type series...
r42 QTCOMMERCIALCHART_END_NAMESPACE