##// END OF EJS Templates
Started documenting QChart
Started documenting QChart

File last commit:

r261:0212e399865a
r264:98bded228a4b
Show More
qscatterseries.cpp
207 lines | 4.6 KiB | text/x-c | CppLexer
Tero Ahola
Integrated scatter type series...
r42 #include "qscatterseries.h"
Tero Ahola
Moved scatter impl into a subfolder
r194 #include "scatterseries_p.h"
Tero Ahola
Integrated scatter type series...
r42 #include "qchart.h"
QTCOMMERCIALCHART_BEGIN_NAMESPACE
Tero Ahola
Integrated scatter again. Missing functionality....
r158 QScatterSeriesPrivate::QScatterSeriesPrivate() :
Tero Ahola
Scatter series marker visuals
r195 m_data(QList<QPointF>()),
m_markerPen(QPen()),
m_markerBrush(QBrush()),
m_markerShape(QScatterSeries::MarkerShapeDefault)
Tero Ahola
Integrated scatter type series...
r42 {
Tero Ahola
Scatter series marker visuals
r195 // Initialize pen color to invalid to use a theme color by default
m_markerPen.setColor(QColor::Invalid);
m_markerBrush.setColor(QColor::Invalid);
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 MarkerShapePoint
\value MarkerShapeX
\value MarkerShapeRectangle
\value MarkerShapeTiltedRectangle
\value MarkerShapeTriangle
\value MarkerShapeCircle
*/
Tero Ahola
QDoc to use style sheets...
r260 /*!
\class QScatterSeries
\brief QtCommercial Chart series API for showing scatter series.
Example on how to create a chart with scatter series:
\code
#include <qchartglobal.h>
#include <qchartview.h>
#include <qscatterseries.h>
...
QTCOMMERCIALCHART_USE_NAMESPACE
// Create chart widget
QChartView *chartView = new QChartView();
QScatterSeries *scatter = new QScatterSeries();
*scatter << QPointF(0.5, 5.0) << QPointF(1.0, 4.5) << QPointF(1.0, 5.5) << QPointF(1.5, 5.0);
chartView->addSeries(scatter);
// Then add the QChartView into a layout...
\endcode
The example code would result the following:
\image scatter_example1.jpg
*/
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) :
QChartSeries(parent),
d(new QScatterSeriesPrivate())
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
Integrated scatter again. Missing functionality....
r158 delete d;
Tero Ahola
Resizing of QGraphicItems now possible by resize signal from QChart
r48 }
Tero Ahola
QDoc to use style sheets...
r260 /*!
Add single data point to the series.
Tero Ahola
Documenting QScatterSeries
r261 For example:
\code
mySeries.addData(QPointF(0.5, 5.0));
\endcode
Tero Ahola
QDoc to use style sheets...
r260 */
Tero Ahola
added stream operator to scatter series
r180 void QScatterSeries::addData(QPointF value)
Tero Ahola
Refactored series creation with QChart
r61 {
Tero Ahola
added stream operator to scatter series
r180 d->m_data.append(value);
emit changed();
}
Tero Ahola
QDoc to use style sheets...
r260 /*!
Stream operator for adding a data point to the series.
\sa addData(), QScatterSeries::addData(QPointF value)
For example:
\code
mySeries << QPointF(0.5, 5.0)
<< QPointF(1.0, 4.5);
\endcode
*/
Tero Ahola
added stream operator to scatter series
r180 QScatterSeries& QScatterSeries::operator << (const QPointF &value)
{
d->m_data.append(value);
Tero Ahola
Modifying QScatterSeries API
r179 emit changed();
Tero Ahola
added stream operator to scatter series
r180 return *this;
Tero Ahola
Modifying QScatterSeries API
r179 }
Tero Ahola
Integrated scatter again. Missing functionality....
r158
Tero Ahola
QDoc to use style sheets...
r260 /*!
Replaces the data of the series with the given list of data points.
*/
Tero Ahola
added stream operator to scatter series
r180 void QScatterSeries::setData(QList<QPointF> data)
Tero Ahola
Modifying QScatterSeries API
r179 {
Tero Ahola
added stream operator to scatter series
r180 d->m_data = data;
Tero Ahola
Integrated scatter again. Missing functionality....
r158 emit changed();
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
Integrated scatter again. Missing functionality....
r158 QList<QPointF> QScatterSeries::data()
Tero Ahola
Draft implementation for setting color themes for a chart
r64 {
Tero Ahola
Integrated scatter again. Missing functionality....
r158 return d->m_data;
Tero Ahola
Draft implementation for setting color themes for a chart
r64 }
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Documenting QScatterSeries
r261 Overrides the default pen used for drawing a marker item with a user defined pen. The default
pen is defined by chart theme setting.
For example:
\code
QPen pen(QColor(0, 255, 0, 80), 3);
myScatter->setMarkerPen(pen);
\endcode
Would present your scatter markers with an opaque, uglyish green outlines:
\image scatter_example_pen.jpg
\sa setMarkerBrush()
\sa QChart::setTheme()
Tero Ahola
QDoc to use style sheets...
r260 */
Tero Ahola
Modifying QScatterSeries API
r179 void QScatterSeries::setMarkerPen(QPen pen)
Tero Ahola
Color themes now enabled for scatter, pie and line series.
r75 {
Tero Ahola
Modifying QScatterSeries API
r179 d->m_markerPen = pen;
Tero Ahola
Color themes now enabled for scatter, pie and line series.
r75 }
Tero Ahola
QDoc to use style sheets...
r260 /*!
Tero Ahola
Documenting QScatterSeries
r261 Returns the pen used for drawing markers.
Tero Ahola
QDoc to use style sheets...
r260 */
Tero Ahola
Modifying QScatterSeries API
r179 QPen QScatterSeries::markerPen()
Tero Ahola
Integrated scatter type series...
r42 {
Tero Ahola
Modifying QScatterSeries API
r179 return d->m_markerPen;
Tero Ahola
Integrated scatter type series...
r42 }
Tero Ahola
Documenting QScatterSeries
r261 /*!
Overrides the default brush of the marker items with a user defined brush. The default
brush is defined by chart theme setting.
For example:
\code
QBrush brush(QColor(255, 0, 0, 100), Qt::SolidPattern);
myRandomScatter->setMarkerBrush(brush);
\endcode
Would fill your scatter markers with an opaque red color:
\image scatter_example_brush.jpg
\sa setMarkerPen()
\sa QChart::setTheme()
*/
Tero Ahola
Scatter series marker visuals
r195 void QScatterSeries::setMarkerBrush(QBrush brush)
{
d->m_markerBrush = brush;
}
Tero Ahola
Documenting QScatterSeries
r261 /*!
Returns the brush used for drawing markers.
*/
Tero Ahola
Scatter series marker visuals
r195 QBrush QScatterSeries::markerBrush()
{
return d->m_markerBrush;
}
Tero Ahola
Documenting QScatterSeries
r261 /*!
Overrides the default shape of the marker items with a user defined shape. The default
shape is defined by chart theme setting.
For example:
\code
myScatter->setMarkerShape(QScatterSeries::MarkerShapeRectangle);
\endcode
Would make your scatter marker items rectangle:
\image scatter_example_shape.jpg
*/
Tero Ahola
Scatter series marker visuals
r195 void QScatterSeries::setMarkerShape(MarkerShape shape)
{
d->m_markerShape = shape;
}
Tero Ahola
Documenting QScatterSeries
r261 /*!
Returns the shape used for drawing markers.
*/
Tero Ahola
Scatter series marker visuals
r195 QScatterSeries::MarkerShape QScatterSeries::markerShape()
{
return (QScatterSeries::MarkerShape) d->m_markerShape;
}
Tero Ahola
Integrated scatter type series...
r42 #include "moc_qscatterseries.cpp"
QTCOMMERCIALCHART_END_NAMESPACE