##// END OF EJS Templates
Compilation fix
Michal Klocek -
r232:ca5ae6ab9869
parent child
Show More
@@ -21,7 +21,7 QTCOMMERCIALCHART_USE_NAMESPACE
21
21
22 Widget::Widget(QWidget *parent)
22 Widget::Widget(QWidget *parent)
23 : QWidget(parent)
23 : QWidget(parent)
24 {
24 {
25 setGeometry(100, 100, 800, 600);
25 setGeometry(100, 100, 800, 600);
26
26
27 // right panel layout
27 // right panel layout
@@ -71,10 +71,10 Widget::Widget(QWidget *parent)
71 }
71 }
72
72
73 // hide axis X labels
73 // hide axis X labels
74 QChartAxis newAxis = chartArea->defaultAxisX();
74 QChartAxis* axis = chartArea->axisX();
75 newAxis.setLabelsVisible(false);
75 axis->setLabelsVisible(false);
76 // newAxis.setLabelsOrientation(QChartAxis::LabelsOrientationSlide);
76 // newAxis.setLabelsOrientation(QChartAxis::LabelsOrientationSlide);
77 chartArea->setDefaultAxisX(newAxis);
77
78 }
78 }
79
79
80 Widget::~Widget()
80 Widget::~Widget()
@@ -11,11 +11,6 class ChartWidget : public QChartView
11 Q_OBJECT
11 Q_OBJECT
12 public:
12 public:
13 explicit ChartWidget(QWidget *parent = 0);
13 explicit ChartWidget(QWidget *parent = 0);
14
15 signals:
16
17 public slots:
18
19 };
14 };
20
15
21 #endif // CHARTWIDGET_H
16 #endif // CHARTWIDGET_H
@@ -2,6 +2,7
2 #include "declarativechart.h"
2 #include "declarativechart.h"
3 #include <qscatterseries.h>
3 #include <qscatterseries.h>
4 #include <qlinechartseries.h>
4 #include <qlinechartseries.h>
5 #include <qpieseries.h>
5 #include <cmath>
6 #include <cmath>
6 #include <QDebug>
7 #include <QDebug>
7
8
@@ -59,7 +60,8 void DeclarativeSeries::initSeries()
59 case SeriesTypeBar:
60 case SeriesTypeBar:
60 // fallthrough; bar and scatter use the same test data
61 // fallthrough; bar and scatter use the same test data
61 case SeriesTypeScatter: {
62 case SeriesTypeScatter: {
62 m_series = chart->createSeries((QChartSeries::QChartSeriesType) m_seriesType);
63 m_series = new QScatterSeries();
64 chart->addSeries(m_series);
63 QScatterSeries *scatter = qobject_cast<QScatterSeries *>(m_series);
65 QScatterSeries *scatter = qobject_cast<QScatterSeries *>(m_series);
64 Q_ASSERT(scatter);
66 Q_ASSERT(scatter);
65 for (qreal i = 0; i < 100; i += 0.1)
67 for (qreal i = 0; i < 100; i += 0.1)
@@ -72,7 +74,8 void DeclarativeSeries::initSeries()
72 case SeriesTypePercentBar:
74 case SeriesTypePercentBar:
73 break;
75 break;
74 case SeriesTypePie: {
76 case SeriesTypePie: {
75 m_series = chart->createSeries((QChartSeries::QChartSeriesType) m_seriesType);
77 m_series = new QPieSeries();
78 chart->addSeries(m_series);
76 QList<qreal> data;
79 QList<qreal> data;
77 data << 1.0;
80 data << 1.0;
78 data << 12.0;
81 data << 12.0;
@@ -71,10 +71,7 void ChartDataSet::addSeries(QChartSeries* series, QChartAxis *axisY)
71 break;
71 break;
72 }
72 }
73 case QChartSeries::SeriesTypeBar: {
73 case QChartSeries::SeriesTypeBar: {
74 <<<<<<< HEAD
75 qDebug() << "QChartSeries::SeriesTypeBar";
74 qDebug() << "QChartSeries::SeriesTypeBar";
76 =======
77 >>>>>>> Common naming convention for barcharts
78 QBarChartSeries* barSeries = static_cast<QBarChartSeries*>(series);
75 QBarChartSeries* barSeries = static_cast<QBarChartSeries*>(series);
79 qreal x = barSeries->countCategories();
76 qreal x = barSeries->countCategories();
80 qreal y = barSeries->max();
77 qreal y = barSeries->max();
@@ -19,7 +19,6
19 #include "stackedbarpresenter.h"
19 #include "stackedbarpresenter.h"
20 #include "linechartitem_p.h"
20 #include "linechartitem_p.h"
21 #include "percentbarpresenter.h"
21 #include "percentbarpresenter.h"
22 #include "percentbargroup.h"
23 #include "scatterpresenter_p.h"
22 #include "scatterpresenter_p.h"
24 #include "piepresenter.h"
23 #include "piepresenter.h"
25
24
@@ -232,7 +232,8 void MainWidget::addSeries(QString series, QString data)
232 (*scatter) << QPointF(x.at(i), y.at(i));
232 (*scatter) << QPointF(x.at(i), y.at(i));
233 m_chartWidget->addSeries(scatter);
233 m_chartWidget->addSeries(scatter);
234 } else if (series == "Pie") {
234 } else if (series == "Pie") {
235 newSeries = m_chartWidget->createSeries(QChartSeries::SeriesTypePie);
235 newSeries = new QPieSeries();
236 m_chartWidget->addSeries(newSeries);
236 Q_ASSERT(newSeries->setData(y));
237 Q_ASSERT(newSeries->setData(y));
237 } else if (series == "Line") {
238 } else if (series == "Line") {
238 // TODO: adding data to an existing line series does not give any visuals for some reason
239 // TODO: adding data to an existing line series does not give any visuals for some reason
@@ -254,7 +255,7 void MainWidget::addSeries(QString series, QString data)
254 QBarCategory *category = new QBarCategory;
255 QBarCategory *category = new QBarCategory;
255 *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
256 *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
256
257
257 BarChartSeries* series0 = new BarChartSeries(category, this);
258 QBarChartSeries* series0 = new QBarChartSeries(category, this);
258
259
259 series0->addBarSet(set0);
260 series0->addBarSet(set0);
260 series0->addBarSet(set1);
261 series0->addBarSet(set1);
@@ -270,7 +271,7 void MainWidget::addSeries(QString series, QString data)
270 QBarCategory *category = new QBarCategory;
271 QBarCategory *category = new QBarCategory;
271 *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
272 *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
272
273
273 StackedBarChartSeries* series0 = new StackedBarChartSeries(category, this);
274 QStackedBarChartSeries* series0 = new QStackedBarChartSeries(category, this);
274
275
275 series0->addBarSet(set0);
276 series0->addBarSet(set0);
276 series0->addBarSet(set1);
277 series0->addBarSet(set1);
@@ -286,7 +287,7 void MainWidget::addSeries(QString series, QString data)
286 QBarCategory *category = new QBarCategory;
287 QBarCategory *category = new QBarCategory;
287 *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
288 *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
288
289
289 PercentBarChartSeries* series0 = new PercentBarChartSeries(category, this);
290 QPercentBarChartSeries* series0 = new QPercentBarChartSeries(category, this);
290
291
291 series0->addBarSet(set0);
292 series0->addBarSet(set0);
292 series0->addBarSet(set1);
293 series0->addBarSet(set1);
General Comments 0
You need to be logged in to leave comments. Login now