##// END OF EJS Templates
review fix: Removed iterator from barseries. Remove const from brush and pen. Renamed setters for tooltip, floating values and separators
review fix: Removed iterator from barseries. Remove const from brush and pen. Renamed setters for tooltip, floating values and separators

File last commit:

r351:ffa92b8e34c9
r357:82b904eaae07
Show More
qlineseries.cpp
195 lines | 3.6 KiB | text/x-c | CppLexer
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 #include "qlineseries.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 /*!
Michal Klocek
fix docs of qlineseries
r350 \class QLineSeries
\brief The QLineSeries class is used for making line charts.
Michal Klocek
Refactor documentation...
r331
\mainclass
A line chart is used to show information as a series of data points
connected by straight lines.
\image linechart.png
Michal Klocek
fix docs of qlineseries
r350 To create line charts, users need to first QLineSeries object.
Michal Klocek
Refactor documentation...
r331
\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
*/
/*!
Michal Klocek
fix docs of qlineseries
r350 \fn virtual QChartSeriesType QLineSeries::type() const
Michal Klocek
Refactor documentation...
r331 \brief Returns type of series.
\sa QChartSeries, QChartSeriesType
*/
/*!
Michal Klocek
fix docs of qlineseries
r350 \fn QPen QLineSeries::pen() const
Michal Klocek
Refactor documentation...
r331 \brief Returns the pen used to draw line for this series.
\sa setPen()
*/
/*!
Michal Klocek
fix docs of qlineseries
r350 \fn bool QLineSeries::isPointsVisible() const
Michal Klocek
Refactor documentation...
r331 \brief Returns if the points are drawn for this series.
\sa setPointsVisible()
*/
/*!
Michal Klocek
fix docs of qlineseries
r350 \fn void QLineSeries::changed(int index)
Michal Klocek
Refactor documentation...
r331 \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
Rename QLineChartSeries to QLineSeries
r349 QLineSeries::QLineSeries(QObject* parent):QChartSeries(parent),
Michal Klocek
Add pointsVisible setting for line series
r185 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
Rename QLineChartSeries to QLineSeries
r349 QLineSeries::~QLineSeries()
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.
*/
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 void QLineSeries::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 }
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.
*/
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 void QLineSeries::add(const QPointF& point)
Michal Klocek
Refactor documentation...
r331 {
m_x<<point.x();
m_y<<point.y();
}
/*!
Michal Klocek
Remove index from QLineChartSeries API
r348 Modifies \a y value for given \a x a value.
Michal Klocek
Refactor documentation...
r331 */
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 void QLineSeries::replace(qreal x,qreal y)
Michal Klocek
Refactors qchart , adds line animation...
r131 {
Michal Klocek
Remove index from QLineChartSeries API
r348 int index = m_x.indexOf(x);
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.
Michal Klocek
Remove index from QLineChartSeries API
r348 Replaces current y value of for given \a point x value with \a point y value.
Michal Klocek
Refactor documentation...
r331 */
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 void QLineSeries::replace(const QPointF& point)
Michal Klocek
Refactor documentation...
r331 {
Michal Klocek
Remove index from QLineChartSeries API
r348 int index = m_x.indexOf(point.x());
Michal Klocek
Refactor documentation...
r331 m_x[index]=point.x();
m_y[index]=point.y();
emit changed(index);
}
Michal Klocek
Remove index from QLineChartSeries API
r348 /*!
Removes current \a x and y value.
*/
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 void QLineSeries::remove(qreal x)
Michal Klocek
Remove index from QLineChartSeries API
r348 {
}
/*!
Michal Klocek
Fix doc class names
r351 Removes current \a point x value. Note \a point y value is ignored.
Michal Klocek
Remove index from QLineChartSeries API
r348 */
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 void QLineSeries::remove(const QPointF& point)
Michal Klocek
Remove index from QLineChartSeries API
r348 {
}
Michal Klocek
Refactor documentation...
r331
/*!
Clears all the data.
*/
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 void QLineSeries::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
Rename QLineChartSeries to QLineSeries
r349 qreal QLineSeries::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
Rename QLineChartSeries to QLineSeries
r349 qreal QLineSeries::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
Rename QLineChartSeries to QLineSeries
r349 int QLineSeries::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
Rename QLineChartSeries to QLineSeries
r349 void QLineSeries::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.
*/
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 void QLineSeries::setPointsVisible(bool visible)
Michal Klocek
Refactor documentation...
r331 {
m_pointsVisible=visible;
}
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 QDebug operator<< (QDebug debug, const QLineSeries 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
Rename QLineChartSeries to QLineSeries
r349 #include "moc_qlineseries.cpp"
Michal Klocek
Refactors qchart , adds line animation...
r131
Tero Ahola
Renamed to QtCommercialChart
r30 QTCOMMERCIALCHART_END_NAMESPACE