##// END OF EJS Templates
Spline to QML API
Spline to QML API

File last commit:

r706:989e7d47a51a
r732:4aded284df80
Show More
main.cpp
67 lines | 1.9 KiB | text/x-c | CppLexer
Michal Klocek
Adds more axis handling...
r176 #include <QApplication>
#include <QMainWindow>
#include <qchartview.h>
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 #include <qlineseries.h>
Michal Klocek
Adds more axis handling...
r176 #include <qchart.h>
#include <qchartaxis.h>
Michal Klocek
Adds qchartaxiscategories class
r445 #include <qchartaxiscategories.h>
Michal Klocek
Adds more axis handling...
r176
QTCOMMERCIALCHART_USE_NAMESPACE
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMainWindow window;
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 QLineSeries* series0 = new QLineSeries();
Michal Klocek
Adds more axis handling...
r176 QPen blue(Qt::blue);
blue.setWidth(3);
series0->setPen(blue);
Michal Klocek
Adds custom categories + example
r706 *series0 << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10,5);
Michal Klocek
Adds more axis handling...
r176
QChartView* chartView = new QChartView(&window);
chartView->setRenderHint(QPainter::Antialiasing);
Michal Klocek
Adds custom categories + example
r706 chartView->setChartTitle("Simple axis example");
Michal Klocek
Adds more axis handling...
r176 chartView->addSeries(series0);
Michal Klocek
Adds opacity to shades
r188
QLinearGradient backgroundGradient;
backgroundGradient.setColorAt(0.0, Qt::white);
Michal Klocek
Bugfix dangling pointer in qlegend, remove debug info
r572 backgroundGradient.setColorAt(1.0, Qt::white);
Michal Klocek
Adds opacity to shades
r188 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
chartView->setChartBackgroundBrush(backgroundGradient);
Michal Klocek
Adds more axis handling...
r176
Michal Klocek
Fixes axischart example
r225 QChartAxis* axisX = chartView->axisX();
Michal Klocek
Adds custom categories + example
r706 axisX->setRange(0,10);
axisX->setTicksCount(4);
axisX->setGridLineVisible(true);
axisX->setShadesVisible(false);
Michal Klocek
Adds more axis handling...
r176
Michal Klocek
Fixes axischart example
r225 QChartAxis* axisY = chartView->axisY();
Michal Klocek
Adds custom categories + example
r706 axisY->setRange(0,10);
Michal Klocek
Fixes axischart example
r225 axisY->setLabelsAngle(45);
Michal Klocek
Adds custom categories + example
r706 axisY->setTicksCount(4);
axisY->setShadesPen(Qt::NoPen);
axisY->setShadesOpacity(0.5);
axisY->setShadesBrush(Qt::blue);
Michal Klocek
Bugfix dangling pointer in qlegend, remove debug info
r572 axisY->setGridLineVisible(false);
Michal Klocek
Adds custom categories + example
r706 axisY->setShadesVisible(true);
Michal Klocek
Adds qchartaxiscategories class
r445
Michal Klocek
Adds custom categories + example
r706 QChartAxisCategories* categoriesX = axisX->categories();
categoriesX->insert(1,"low");
categoriesX->insert(5,"optimal");
categoriesX->insert(10,"high");
Michal Klocek
Adds qchartaxiscategories class
r445
Michal Klocek
Adds custom categories + example
r706 QChartAxisCategories* categoriesY = axisY->categories();
categoriesY->insert(1,"slow");
categoriesY->insert(5,"med");
categoriesY->insert(10,"fast");
Michal Klocek
Adds more axis handling...
r176
window.setCentralWidget(chartView);
window.resize(400, 300);
window.show();
return a.exec();
}