##// END OF EJS Templates
Adds to themes support to lineseries
Adds to themes support to lineseries

File last commit:

r150:19743dc8af25
r152:a883350fc5d3
Show More
qchart.cpp
190 lines | 4.0 KiB | text/x-c | CppLexer
Michal Klocek
adds missing files form previous commit
r12 #include "qchart.h"
Tero Ahola
Integrated scatter type series...
r42 #include "qscatterseries.h"
#include "qscatterseries_p.h"
Tero Ahola
Integrated draft version of pie series
r51 #include "qpieseries.h"
Michal Klocek
Refactora axis and line chart to use graphics items insted of painter.
r85 #include "qchartaxis.h"
Michal Klocek
Refactors qchart , adds line animation...
r131 #include "chartpresenter_p.h"
#include "chartdataset_p.h"
Michal Klocek
Refactored for MVP...
r139
//series
#include "barchartseries.h"
#include "stackedbarchartseries.h"
#include "percentbarchartseries.h"
Michal Klocek
Fix previous broken commit
r145 #include "qlinechartseries.h"
Michal Klocek
Refactored for MVP...
r139
Tero Ahola
Integrated scatter type series...
r42 #include <QGraphicsScene>
Michal Klocek
Adds layout support for charts....
r115 #include <QGraphicsSceneResizeEvent>
Michal Klocek
Refactor current draft to fit int current design specs...
r21 #include <QDebug>
Michal Klocek
adds missing files form previous commit
r12
Tero Ahola
Renamed to QtCommercialChart
r30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
Michal Klocek
adds missing files form previous commit
r12
Michal Klocek
Adds layout support for charts....
r115 QChart::QChart(QGraphicsItem *parent, Qt::WindowFlags wFlags) : QGraphicsWidget(parent,wFlags),
Michal Klocek
Refactor themes...
r143 m_backgroundItem(0),
m_titleItem(0),
m_dataset(new ChartDataSet(this)),
m_presenter(new ChartPresenter(this,m_dataset))
Michal Klocek
adds missing files form previous commit
r12 {
}
Michal Klocek
Refactor themes...
r143 QChart::~QChart() {}
Michal Klocek
adds missing files form previous commit
r12
Michal Klocek
Refactor current draft to fit int current design specs...
r21 void QChart::addSeries(QChartSeries* series)
Michal Klocek
adds missing files form previous commit
r12 {
Michal Klocek
Refactor themes...
r143 m_dataset->addSeries(series);
Tero Ahola
Fixed line series usage in the test app
r65 }
Michal Klocek
Refactor themes...
r143 //TODO on review, is it really needed ??
Tero Ahola
Fixed line series usage in the test app
r65 QChartSeries* QChart::createSeries(QChartSeries::QChartSeriesType type)
{
// TODO: support also other types; not only scatter and pie
QChartSeries *series(0);
switch (type) {
Michal Klocek
Refactor themes...
r143 case QChartSeries::SeriesTypeLine: {
Michal Klocek
Fix previous broken commit
r145 series = QLineChartSeries::create();
Michal Klocek
Refactor themes...
r143 break;
}
case QChartSeries::SeriesTypeBar: {
series = new BarChartSeries(this);
break;
}
case QChartSeries::SeriesTypeStackedBar: {
series = new StackedBarChartSeries(this);
break;
}
case QChartSeries::SeriesTypePercentBar: {
series = new PercentBarChartSeries(this);
break;
}
case QChartSeries::SeriesTypeScatter: {
series = new QScatterSeries(this);
break;
}
case QChartSeries::SeriesTypePie: {
series = new QPieSeries(this);
break;
}
default:
Tero Ahola
Refactored series creation with QChart
r61 Q_ASSERT(false);
Tero Ahola
Integrated scatter type series...
r42 break;
}
Tero Ahola
Fixed line series usage in the test app
r65 addSeries(series);
return series;
Tero Ahola
Integrated scatter type series...
r42 }
Tero Ahola
Resizing of QGraphicItems now possible by resize signal from QChart
r48
Michal Klocek
Change background gradient to use ObjectBoundingMode...
r122 void QChart::setChartBackgroundBrush(const QBrush& brush)
{
Michal Klocek
Refactor themes...
r143 if(!m_backgroundItem) {
Michal Klocek
Change background gradient to use ObjectBoundingMode...
r122 m_backgroundItem = new QGraphicsRectItem(this);
m_backgroundItem->setZValue(-1);
}
m_backgroundItem->setBrush(brush);
m_backgroundItem->update();
}
void QChart::setChartBackgroundPen(const QPen& pen)
{
Michal Klocek
Refactor themes...
r143 if(!m_backgroundItem) {
Michal Klocek
Change background gradient to use ObjectBoundingMode...
r122 m_backgroundItem = new QGraphicsRectItem(this);
m_backgroundItem->setZValue(-1);
}
m_backgroundItem->setPen(pen);
m_backgroundItem->update();
}
Michal Klocek
Adds title support
r87 void QChart::setTitle(const QString& title,const QFont& font)
Michal Klocek
Add background to chart...
r69 {
Michal Klocek
Adds title support
r87 if(!m_titleItem) m_titleItem = new QGraphicsTextItem(this);
m_titleItem->setPlainText(title);
m_titleItem->setFont(font);
Michal Klocek
Add background to chart...
r69 }
Michal Klocek
Adds pimpl to qchart class
r28 int QChart::margin() const
{
Jani Honkonen
Pie chart refactoring
r142 return m_presenter->margin();
Michal Klocek
Adds pimpl to qchart class
r28 }
Michal Klocek
adds missing files form previous commit
r12 void QChart::setMargin(int margin)
{
Michal Klocek
Refactor themes...
r143 m_presenter->setMargin(margin);
Michal Klocek
adds missing files form previous commit
r12 }
Tero Ahola
Color themes now enabled for scatter, pie and line series.
r75 void QChart::setTheme(QChart::ChartThemeId theme)
Tero Ahola
Draft implementation for setting color themes for a chart
r64 {
Michal Klocek
Refactor themes...
r143 m_presenter->setTheme(theme);
Tero Ahola
Draft implementation for setting color themes for a chart
r64 }
Tero Ahola
Proof-of-concept for QML api...
r120 QChart::ChartThemeId QChart::theme()
{
Michal Klocek
Adds cliping and proper zoom handling for line chart
r150 return m_presenter->theme();
Tero Ahola
Proof-of-concept for QML api...
r120 }
Michal Klocek
Adds layout support for charts....
r115 void QChart::zoomInToRect(const QRectF& rectangle)
Michal Klocek
Add zoom support...
r67 {
Michal Klocek
Refactored for MVP...
r139 m_presenter->zoomInToRect(rectangle);
Michal Klocek
Add zoom support...
r67 }
void QChart::zoomIn()
{
Michal Klocek
Refactored for MVP...
r139 m_presenter->zoomIn();
Michal Klocek
Add zoom support...
r67 }
void QChart::zoomOut()
{
Michal Klocek
Refactored for MVP...
r139 m_presenter->zoomOut();
Michal Klocek
Add zoom support...
r67 }
Tero Ahola
QChartWidget now zooms only x axis and zoom is reset with right click
r93 void QChart::zoomReset()
{
Michal Klocek
Refactored for MVP...
r139 m_presenter->zoomReset();
Tero Ahola
QChartWidget now zooms only x axis and zoom is reset with right click
r93 }
Michal Klocek
Refactora axis and line chart to use graphics items insted of painter.
r85 void QChart::setAxisX(const QChartAxis& axis)
{
Michal Klocek
Refactor themes...
r143
Michal Klocek
Refactora axis and line chart to use graphics items insted of painter.
r85 }
void QChart::setAxisY(const QChartAxis& axis)
{
Michal Klocek
Refactor themes...
r143
Michal Klocek
Refactora axis and line chart to use graphics items insted of painter.
r85 }
void QChart::setAxisY(const QList<QChartAxis>& axis)
{
//TODO not implemented
}
void QChart::setAxis(AxisItem *item, const QChartAxis& axis)
{
Michal Klocek
Refactor themes...
r143
Michal Klocek
Refactora axis and line chart to use graphics items insted of painter.
r85 }
Michal Klocek
Adds layout support for charts....
r115 void QChart::resizeEvent(QGraphicsSceneResizeEvent *event)
{
m_rect = QRectF(QPoint(0,0),event->newSize());
QRectF rect = m_rect.adjusted(margin(),margin(), -margin(), -margin());
// recalculate title position
if (m_titleItem) {
QPointF center = m_rect.center() -m_titleItem->boundingRect().center();
m_titleItem->setPos(center.x(),m_rect.top()/2 + margin()/2);
}
//recalculate background gradient
if (m_backgroundItem) {
m_backgroundItem->setRect(rect);
}
Michal Klocek
Removes obsolate methods from qchart
r117 QGraphicsWidget::resizeEvent(event);
Michal Klocek
Adds layout support for charts....
r115 update();
}
Tero Ahola
Draft implementation for setting color themes for a chart
r64 #include "moc_qchart.cpp"
Tero Ahola
Resizing of QGraphicItems now possible by resize signal from QChart
r48
Tero Ahola
Renamed to QtCommercialChart
r30 QTCOMMERCIALCHART_END_NAMESPACE