@@ -21,7 +21,7 QTCOMMERCIALCHART_USE_NAMESPACE | |||
|
21 | 21 | |
|
22 | 22 | Widget::Widget(QWidget *parent) |
|
23 | 23 | : QWidget(parent) |
|
24 | { | |
|
24 | { | |
|
25 | 25 | setGeometry(100, 100, 800, 600); |
|
26 | 26 | |
|
27 | 27 | // right panel layout |
@@ -71,10 +71,10 Widget::Widget(QWidget *parent) | |||
|
71 | 71 | } |
|
72 | 72 | |
|
73 | 73 | // hide axis X labels |
|
74 |
QChartAxis |
|
|
75 |
|
|
|
74 | QChartAxis* axis = chartArea->axisX(); | |
|
75 | axis->setLabelsVisible(false); | |
|
76 | 76 | // newAxis.setLabelsOrientation(QChartAxis::LabelsOrientationSlide); |
|
77 | chartArea->setDefaultAxisX(newAxis); | |
|
77 | ||
|
78 | 78 | } |
|
79 | 79 | |
|
80 | 80 | Widget::~Widget() |
@@ -11,11 +11,6 class ChartWidget : public QChartView | |||
|
11 | 11 | Q_OBJECT |
|
12 | 12 | public: |
|
13 | 13 | explicit ChartWidget(QWidget *parent = 0); |
|
14 | ||
|
15 | signals: | |
|
16 | ||
|
17 | public slots: | |
|
18 | ||
|
19 | 14 | }; |
|
20 | 15 | |
|
21 | 16 | #endif // CHARTWIDGET_H |
@@ -2,6 +2,7 | |||
|
2 | 2 | #include "declarativechart.h" |
|
3 | 3 | #include <qscatterseries.h> |
|
4 | 4 | #include <qlinechartseries.h> |
|
5 | #include <qpieseries.h> | |
|
5 | 6 | #include <cmath> |
|
6 | 7 | #include <QDebug> |
|
7 | 8 | |
@@ -59,7 +60,8 void DeclarativeSeries::initSeries() | |||
|
59 | 60 | case SeriesTypeBar: |
|
60 | 61 | // fallthrough; bar and scatter use the same test data |
|
61 | 62 | case SeriesTypeScatter: { |
|
62 | m_series = chart->createSeries((QChartSeries::QChartSeriesType) m_seriesType); | |
|
63 | m_series = new QScatterSeries(); | |
|
64 | chart->addSeries(m_series); | |
|
63 | 65 | QScatterSeries *scatter = qobject_cast<QScatterSeries *>(m_series); |
|
64 | 66 | Q_ASSERT(scatter); |
|
65 | 67 | for (qreal i = 0; i < 100; i += 0.1) |
@@ -72,7 +74,8 void DeclarativeSeries::initSeries() | |||
|
72 | 74 | case SeriesTypePercentBar: |
|
73 | 75 | break; |
|
74 | 76 | case SeriesTypePie: { |
|
75 | m_series = chart->createSeries((QChartSeries::QChartSeriesType) m_seriesType); | |
|
77 | m_series = new QPieSeries(); | |
|
78 | chart->addSeries(m_series); | |
|
76 | 79 | QList<qreal> data; |
|
77 | 80 | data << 1.0; |
|
78 | 81 | data << 12.0; |
@@ -71,10 +71,7 void ChartDataSet::addSeries(QChartSeries* series, QChartAxis *axisY) | |||
|
71 | 71 | break; |
|
72 | 72 | } |
|
73 | 73 | case QChartSeries::SeriesTypeBar: { |
|
74 | <<<<<<< HEAD | |
|
75 | 74 | qDebug() << "QChartSeries::SeriesTypeBar"; |
|
76 | ======= | |
|
77 | >>>>>>> Common naming convention for barcharts | |
|
78 | 75 | QBarChartSeries* barSeries = static_cast<QBarChartSeries*>(series); |
|
79 | 76 | qreal x = barSeries->countCategories(); |
|
80 | 77 | qreal y = barSeries->max(); |
@@ -19,7 +19,6 | |||
|
19 | 19 | #include "stackedbarpresenter.h" |
|
20 | 20 | #include "linechartitem_p.h" |
|
21 | 21 | #include "percentbarpresenter.h" |
|
22 | #include "percentbargroup.h" | |
|
23 | 22 | #include "scatterpresenter_p.h" |
|
24 | 23 | #include "piepresenter.h" |
|
25 | 24 |
@@ -232,7 +232,8 void MainWidget::addSeries(QString series, QString data) | |||
|
232 | 232 | (*scatter) << QPointF(x.at(i), y.at(i)); |
|
233 | 233 | m_chartWidget->addSeries(scatter); |
|
234 | 234 | } else if (series == "Pie") { |
|
235 | newSeries = m_chartWidget->createSeries(QChartSeries::SeriesTypePie); | |
|
235 | newSeries = new QPieSeries(); | |
|
236 | m_chartWidget->addSeries(newSeries); | |
|
236 | 237 | Q_ASSERT(newSeries->setData(y)); |
|
237 | 238 | } else if (series == "Line") { |
|
238 | 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 | 255 | QBarCategory *category = new QBarCategory; |
|
255 | 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 | 260 | series0->addBarSet(set0); |
|
260 | 261 | series0->addBarSet(set1); |
@@ -270,7 +271,7 void MainWidget::addSeries(QString series, QString data) | |||
|
270 | 271 | QBarCategory *category = new QBarCategory; |
|
271 | 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 | 276 | series0->addBarSet(set0); |
|
276 | 277 | series0->addBarSet(set1); |
@@ -286,7 +287,7 void MainWidget::addSeries(QString series, QString data) | |||
|
286 | 287 | QBarCategory *category = new QBarCategory; |
|
287 | 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 | 292 | series0->addBarSet(set0); |
|
292 | 293 | series0->addBarSet(set1); |
General Comments 0
You need to be logged in to leave comments.
Login now