##// END OF EJS Templates

File last commit:

r333:71620f1a347f
r337:1f21d3bffe32 merge
Show More
qlinechartseries.cpp
182 lines | 3.6 KiB | text/x-c | CppLexer
/ src / linechart / qlinechartseries.cpp
Michal Klocek
Fix naming convention for lineseries...
r144 #include "qlinechartseries.h"
Michal Klocek
Refactor current draft to fit int current design specs...
r21
Tero Ahola
Renamed to QtCommercialChart
r30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
Michal Klocek
Refactor current draft to fit int current design specs...
r21
Michal Klocek
Refactor documentation...
r331 /*!
\class QLineChartSeries
\brief The QLineChartSeries class is used for making line charts.
\mainclass
A line chart is used to show information as a series of data points
connected by straight lines.
\image linechart.png
To create line charts, users need to first QLineChartSeries object.
\snippet ../example/linechart/main.cpp 1
Populate with the data
\snippet ../example/linechart/main.cpp 2
Add created series objects to QChartView or QChart instance.
\snippet ../example/linechart/main.cpp 3
*/
/*!
\fn virtual QChartSeriesType QLineChartSeries::type() const
\brief Returns type of series.
\sa QChartSeries, QChartSeriesType
*/
/*!
\fn QPen QLineChartSeries::pen() const
\brief Returns the pen used to draw line for this series.
\sa setPen()
*/
/*!
Michal Klocek
Adds missing doc for qchartaxis
r333 \fn bool QLineChartSeries::isPointsVisible() const
Michal Klocek
Refactor documentation...
r331 \brief Returns if the points are drawn for this series.
\sa setPointsVisible()
*/
/*!
\fn void QLineChartSeries::changed(int index)
\brief \internal \a index
*/
/*!
Constructs empty series object which is a child of \a parent.
When series object is added to QChartView or QChart instance ownerships is transfered.
*/
Michal Klocek
Add pointsVisible setting for line series
r185 QLineChartSeries::QLineChartSeries(QObject* parent):QChartSeries(parent),
m_pointsVisible(false)
Michal Klocek
Refactor current draft to fit int current design specs...
r21 {
}
Michal Klocek
Refactor documentation...
r331 /*!
Destroys the object. Series added to QChartView or QChart instances are owned by those,
and are deleted when mentioned object are destroyed.
*/
Michal Klocek
Fix naming convention for lineseries...
r144 QLineChartSeries::~QLineChartSeries()
Michal Klocek
Refactor current draft to fit int current design specs...
r21 {
}
Michal Klocek
Refactor documentation...
r331 /*!
Adds data point \a x \a y to the series. Points are connected with lines on the chart.
Function returns index, which can be used to modify data.
*/
Michal Klocek
Fix naming convention for lineseries...
r144 int QLineChartSeries::add(qreal x,qreal y)
Michal Klocek
Refactor current draft to fit int current design specs...
r21 {
m_x<<x;
m_y<<y;
Michal Klocek
Refactors qchart , adds line animation...
r131 return m_x.size()-1;
}
Michal Klocek
Refactor documentation...
r331 /*!
This is an overloaded function.
Adds data \a point to the series. Points are connected with lines on the chart.
Function returns index, which can be used to modify data.
*/
int QLineChartSeries::add(const QPointF& point)
{
m_x<<point.x();
m_y<<point.y();
return m_x.size()-1;
}
/*!
Modifies data within \a index, sets new \a x and \a y values.
*/
Michal Klocek
Fix naming convention for lineseries...
r144 void QLineChartSeries::set(int index,qreal x,qreal y)
Michal Klocek
Refactors qchart , adds line animation...
r131 {
m_x[index]=x;
m_y[index]=y;
emit changed(index);
Michal Klocek
Refactor current draft to fit int current design specs...
r21 }
Michal Klocek
Refactor documentation...
r331 /*!
This is an overloaded function.
Modifies data within \a index, sets new \a point value.
*/
void QLineChartSeries::set(int index,const QPointF& point)
{
m_x[index]=point.x();
m_y[index]=point.y();
emit changed(index);
}
/*!
Clears all the data.
*/
Michal Klocek
Fix naming convention for lineseries...
r144 void QLineChartSeries::clear()
Michal Klocek
Refactor current draft to fit int current design specs...
r21 {
m_x.clear();
m_y.clear();
}
Michal Klocek
Refactor documentation...
r331 /*!
\internal \a pos
*/
Michal Klocek
Fix naming convention for lineseries...
r144 qreal QLineChartSeries::x(int pos) const
Michal Klocek
Refactor current draft to fit int current design specs...
r21 {
return m_x.at(pos);
}
Michal Klocek
Refactor documentation...
r331 /*!
\internal \a pos
*/
Michal Klocek
Fix naming convention for lineseries...
r144 qreal QLineChartSeries::y(int pos) const
Michal Klocek
Refactor current draft to fit int current design specs...
r21 {
return m_y.at(pos);
}
Michal Klocek
Refactor documentation...
r331 /*!
Returns number of data points within series.
*/
Michal Klocek
Fix naming convention for lineseries...
r144 int QLineChartSeries::count() const
Michal Klocek
Refactor current draft to fit int current design specs...
r21 {
Q_ASSERT(m_x.size() == m_y.size());
return m_x.size();
}
Michal Klocek
Refactor documentation...
r331 /*!
Sets \a pen used for drawing given series..
*/
Michal Klocek
Fix naming convention for lineseries...
r144 void QLineChartSeries::setPen(const QPen& pen)
Michal Klocek
Refactora axis and line chart to use graphics items insted of painter.
r85 {
m_pen=pen;
}
Michal Klocek
Refactor documentation...
r331 /*!
Sets if data points are \a visible and should be drawn on line.
*/
void QLineChartSeries::setPointsVisible(bool visible)
{
m_pointsVisible=visible;
}
Michal Klocek
Fix naming convention for lineseries...
r144 QDebug operator<< (QDebug debug, const QLineChartSeries series)
Michal Klocek
Refactor current draft to fit int current design specs...
r21 {
Q_ASSERT(series.m_x.size() == series.m_y.size());
int size = series.m_x.size();
for (int i=0;i<size;i++) {
debug.nospace() << "(" << series.m_x.at(i) << ','<< series.m_y.at(i) << ") ";
}
return debug.space();
}
Michal Klocek
Refactor documentation...
r331
Michal Klocek
Fix naming convention for lineseries...
r144 #include "moc_qlinechartseries.cpp"
Michal Klocek
Refactors qchart , adds line animation...
r131
Tero Ahola
Renamed to QtCommercialChart
r30 QTCOMMERCIALCHART_END_NAMESPACE