##// END OF EJS Templates
updated barchart examples. minor fixes
updated barchart examples. minor fixes

File last commit:

r276:d062a7f38647
r276:d062a7f38647
Show More
main.cpp
53 lines | 1.7 KiB | text/x-c | CppLexer
sauimone
added missing example files :)
r96 #include <QApplication>
#include <QMainWindow>
sauimone
updated barchart examples. minor fixes
r276 #include <qchartview.h>
sauimone
Common naming convention for barcharts
r216 #include <qstackedbarchartseries.h>
sauimone
updated barchart examples
r170 #include <qbarset.h>
#include <qbarcategory.h>
sauimone
added missing example files :)
r96
sauimone
updated barchart examples. minor fixes
r276 #include "custombarset.h"
sauimone
added missing example files :)
r96 QTCOMMERCIALCHART_USE_NAMESPACE
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMainWindow window;
sauimone
fixed bug in category implementation. model now owns the category and sets
r173 QBarCategory *category = new QBarCategory;
*category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
sauimone
updated barchart examples
r170
sauimone
updated barchart examples. minor fixes
r276 QStackedBarChartSeries* series = new QStackedBarChartSeries(category);
sauimone
updated barchart examples
r170
sauimone
updated barchart examples. minor fixes
r276 // We use custom set, which connects some signals. Could use QBarSet here if we don't need signals
CustomBarSet *set0 = new CustomBarSet;
CustomBarSet *set1 = new CustomBarSet;
CustomBarSet *set2 = new CustomBarSet;
CustomBarSet *set3 = new CustomBarSet;
CustomBarSet *set4 = new CustomBarSet;
sauimone
added missing example files :)
r96
// Create some test data to chart
sauimone
fixed bug in category implementation. model now owns the category and sets
r173 *set0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12;
sauimone
updated barchart examples. minor fixes
r276 *set1 << 5 << 0 << 0 << 4 << 0 << 7 << 8 << 9 << 9 << 0 << 4 << 2;
*set2 << 3 << 5 << 8 << 13 << 8 << 5 << 3 << 2 << 1 << 1 << 3 << 5;
*set3 << 5 << 6 << 7 << 3 << 4 << 5 << 8 << 9 << 10 << 5 << 2 << 7;
sauimone
fixed bug in category implementation. model now owns the category and sets
r173 *set4 << 9 << 7 << 5 << 3 << 1 << 2 << 4 << 6 << 8 << 10 << 1 << 6;
sauimone
updated barchart examples. minor fixes
r276 series->addBarSet(set0);
series->addBarSet(set1);
series->addBarSet(set2);
series->addBarSet(set3);
series->addBarSet(set4);
sauimone
proof of concept implementation for barset and barcategory
r169
sauimone
updated barchart examples. minor fixes
r276 QChartView* chartView = new QChartView(&window);
chartView->addSeries(series);
chartView->setChartTitle("simple stacked barchart");
chartView->setChartTheme(QChart::ChartThemeIcy);
sauimone
added missing example files :)
r96
sauimone
updated barchart examples. minor fixes
r276 window.setCentralWidget(chartView);
sauimone
added missing example files :)
r96 window.resize(400, 300);
window.show();
return a.exec();
}