##// END OF EJS Templates
minor. some docs fix
minor. some docs fix

File last commit:

r470:5c708e3e7c7c
r480:89946aa027f9
Show More
qscatterseries.cpp
206 lines | 4.6 KiB | text/x-c | CppLexer
Tero Ahola
Integrated scatter type series...
r42 #include "qscatterseries.h"
#include "qchart.h"
Tero Ahola
Scatter series documentation; now uses snippets
r300 /*!
\class QScatterSeries
\brief QtCommercial Chart series API for showing scatter series.
Tero Ahola
Integrated scatter type series...
r42
Tero Ahola
Scatter series documentation; now uses snippets
r300 \mainclass
Example on how to create a chart with scatter series:
\snippet ../example/scatter/main.cpp 1
The example code would result the following:
\image scatter_example1.jpg
Tero Ahola
Added size customization to QScatterSeries
r397
To customize the graphical representation of the series, you can modify pen, brush, shape and
size of the marker items. For example:
\snippet ../example/scatter/main.cpp 3
Would present your scatter markers as big rectangles with opaque, uglyish green outlines and
opaque red filling instead of the beatiful markers defined by the chart's theme:
\image scatter_example_custom.jpg
Tero Ahola
Scatter series documentation; now uses snippets
r300 */
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 MarkerShapeDefault
\value MarkerShapeX
\value MarkerShapeRectangle
Tero Ahola
Scatter API review: changed signal now private etc.
r459 \value MarkerShapeRoundedRectangle
Tero Ahola
Documenting QScatterSeries
r261 \value MarkerShapeTiltedRectangle
\value MarkerShapeTriangle
\value MarkerShapeCircle
*/
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Scatter series documentation; now uses snippets
r300 \fn QChartSeriesType QScatterSeries::type() const
\brief Returns QChartSeries::SeriesTypeScatter.
*/
Tero Ahola
QDoc to use style sheets...
r260
Tero Ahola
Scatter series documentation; now uses snippets
r300 /*!
Tero Ahola
Clicked, remove and clear to QScatterSeries
r394 \fn void QScatterSeries::clicked(QPointF coordinate)
User clicked the scatter series. Note that the \a coordinate is the chart coordinate that the
click occurred on; not necessarily a data point coordinate. To find the corresponding (closest)
data point you can use closestPoint().
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.
*/
Tero Ahola
Integrated scatter again. Missing functionality....
r158 QScatterSeries::QScatterSeries(QObject *parent) :
Michal Klocek
Refactor scatter chart to fit the other classes...
r470 QXYSeries(parent),
m_shape(QScatterSeries::MarkerShapeDefault),
m_size(9.0)
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 {
Tero Ahola
Resizing of QGraphicItems now possible by resize signal from QChart
r48 }
Tero Ahola
added stream operator to scatter series
r180
Tero Ahola
QDoc to use style sheets...
r260
Tero Ahola
Scatter series documentation; now uses snippets
r300 /*!
Stream operator for adding a data point with \a value to the series.
Tero Ahola
Fixing review findings in QScatterSeries
r358 \sa add()
Tero Ahola
QDoc to use style sheets...
r260
Tero Ahola
Scatter series documentation; now uses snippets
r300 For example:
Tero Ahola
Added size customization to QScatterSeries
r397 \snippet ../example/scatter/main.cpp 2
Tero Ahola
QDoc to use style sheets...
r260 */
Michal Klocek
Refactor scatter chart to fit the other classes...
r470
Tero Ahola
Integrated scatter again. Missing functionality....
r158
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Scatter series documentation; now uses snippets
r300 Stream operator for adding a list of points to the series.
Tero Ahola
Fixing review findings in QScatterSeries
r358 \sa add()
Tero Ahola
Scatter series documentation; now uses snippets
r300 */
Michal Klocek
Refactor scatter chart to fit the other classes...
r470
Tero Ahola
Scatter series documentation; now uses snippets
r300
/*!
Replaces the data of the series with the given list of data \a points.
Tero Ahola
QDoc to use style sheets...
r260 */
Michal Klocek
Refactor scatter chart to fit the other classes...
r470
Tero Ahola
Refactored series creation with QChart
r61
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Documenting QScatterSeries
r261 Returns the current list of data points of the series.
Tero Ahola
QDoc to use style sheets...
r260 */
Tero Ahola
Draft implementation for setting color themes for a chart
r64
Tero Ahola
Clicked, remove and clear to QScatterSeries
r394 /*!
Tero Ahola
Replace to QScatterSeries
r395 Replaces the point at \a index with \a newPoint. Returns true if \a index is a valid position
in the series data, false otherwise.
Tero Ahola
Clicked, remove and clear to QScatterSeries
r394 */
Michal Klocek
Refactor scatter chart to fit the other classes...
r470
Tero Ahola
Replace to QScatterSeries
r395
/*!
Remove the data point at \a index. Returns true if a point was removed, false if the point
at \a index does not exist on the series.
*/
Michal Klocek
Refactor scatter chart to fit the other classes...
r470
Tero Ahola
Clicked, remove and clear to QScatterSeries
r394
/*!
Remove all occurrences of \a point from the series and returns the number of points removed.
*/
Michal Klocek
Refactor scatter chart to fit the other classes...
r470
Tero Ahola
Clicked, remove and clear to QScatterSeries
r394
/*!
Remove all data points from the series.
*/
/*!
Returns the index of the data point that is closest to \a coordinate. If several data points
are at the same distance from the \a coordinate, returns the last one. If no points exist,
returns -1.
Michal Klocek
Refactor scatter chart to fit the other classes...
r470
Tero Ahola
Clicked, remove and clear to QScatterSeries
r394 int QScatterSeries::closestPoint(QPointF coordinate)
{
qreal distance(-1);
int pointIndex(-1);
for (int i(0); i < d->m_data.count(); i++) {
QPointF dataPoint = d->m_data.at(i);
QPointF difference = dataPoint - coordinate;
if (i == 0 || difference.manhattanLength() <= distance) {
distance = difference.manhattanLength();
pointIndex = i;
}
}
return pointIndex;
}
Michal Klocek
Refactor scatter chart to fit the other classes...
r470 */
Tero Ahola
Clicked, remove and clear to QScatterSeries
r394
Tero Ahola
Scatter API review: changed signal now private etc.
r459 /*!
Returns the pen used for drawing markers.
*/
Michal Klocek
Refactor scatter chart to fit the other classes...
r470
Tero Ahola
Scatter API review: changed signal now private etc.
r459
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Scatter series documentation; now uses snippets
r300 Overrides the default pen used for drawing a marker item with a user defined \a pen. The
default pen is defined by chart theme setting.
Tero Ahola
Documenting QScatterSeries
r261
Tero Ahola
Fixing review findings in QScatterSeries
r358 \sa setBrush()
Tero Ahola
Scatter series documentation; now uses snippets
r300 \sa QChart::setChartTheme()
Tero Ahola
QDoc to use style sheets...
r260 */
Michal Klocek
Refactor scatter chart to fit the other classes...
r470
Tero Ahola
Color themes now enabled for scatter, pie and line series.
r75
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Scatter API review: changed signal now private etc.
r459 Returns the brush used for drawing markers.
Tero Ahola
QDoc to use style sheets...
r260 */
Michal Klocek
Refactor scatter chart to fit the other classes...
r470
Tero Ahola
Integrated scatter type series...
r42
Tero Ahola
Documenting QScatterSeries
r261 /*!
Tero Ahola
Scatter series documentation; now uses snippets
r300 Overrides the default brush of the marker items with a user defined \a brush. The default brush
is defined by chart theme setting.
Tero Ahola
Documenting QScatterSeries
r261
Tero Ahola
Fixing review findings in QScatterSeries
r358 \sa setPen()
Tero Ahola
Scatter series documentation; now uses snippets
r300 \sa QChart::setChartTheme()
Tero Ahola
Documenting QScatterSeries
r261 */
Tero Ahola
Scatter series marker visuals
r195
Tero Ahola
Documenting QScatterSeries
r261 /*!
Tero Ahola
Scatter API review: changed signal now private etc.
r459 Returns the shape used for drawing markers.
Tero Ahola
Documenting QScatterSeries
r261 */
Tero Ahola
Scatter API review: changed signal now private etc.
r459 QScatterSeries::MarkerShape QScatterSeries::shape() const
Tero Ahola
Scatter series marker visuals
r195 {
Michal Klocek
Refactor scatter chart to fit the other classes...
r470 return (QScatterSeries::MarkerShape) m_shape;
Tero Ahola
Scatter series marker visuals
r195 }
Tero Ahola
Documenting QScatterSeries
r261 /*!
Tero Ahola
Scatter series documentation; now uses snippets
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
Documenting QScatterSeries
r261 */
Tero Ahola
Fixing review findings in QScatterSeries
r358 void QScatterSeries::setShape(MarkerShape shape)
Tero Ahola
Scatter series marker visuals
r195 {
Michal Klocek
Refactor scatter chart to fit the other classes...
r470 m_shape = shape;
emit updated();
Tero Ahola
Scatter series marker visuals
r195 }
Tero Ahola
Added size customization to QScatterSeries
r397 /*!
Returns the size of the marker items.
*/
Tero Ahola
Scatter API review: changed signal now private etc.
r459 qreal QScatterSeries::size() const
Tero Ahola
Added size customization to QScatterSeries
r397 {
Michal Klocek
Refactor scatter chart to fit the other classes...
r470 return m_size;
Tero Ahola
Added size customization to QScatterSeries
r397 }
/*!
Set the \a size of the marker items. The default size is 9.0.
*/
void QScatterSeries::setSize(qreal size)
{
Michal Klocek
Refactor scatter chart to fit the other classes...
r470 m_size = size;
emit updated();
Tero Ahola
Added size customization to QScatterSeries
r397 }
Michal Klocek
Refactor scatter chart to fit the other classes...
r470
Tero Ahola
Integrated scatter type series...
r42 #include "moc_qscatterseries.cpp"
QTCOMMERCIALCHART_END_NAMESPACE