##// END OF EJS Templates
Adds rubberband for zooming...
Adds rubberband for zooming * adds qchartview class * implements mouse events for handling rubberband

File last commit:

r58:1c099f3b0fd1
r58:1c099f3b0fd1
Show More
main.cpp
55 lines | 1.3 KiB | text/x-c | CppLexer
Michal Klocek
adds missing files form previous commit
r12 #include <QApplication>
#include <QMainWindow>
Michal Klocek
Adds rubberband for zooming...
r58 #include <qchartview.h>
Michal Klocek
Refactor current draft to fit int current design specs...
r21 #include <qxychartseries.h>
Michal Klocek
adds missing files form previous commit
r12 #include <qchart.h>
#include <cmath>
Tero Ahola
Renamed to QtCommercialChart
r30 QTCOMMERCIALCHART_USE_NAMESPACE
Michal Klocek
adds missing files form previous commit
r12
#define PI 3.14159265358979
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMainWindow window;
Michal Klocek
Refactor current draft to fit int current design specs...
r21 QXYChartSeries* series0 = QXYChartSeries::create();
Michal Klocek
adds missing files form previous commit
r12 series0->setColor(Qt::blue);
Michal Klocek
Refactor current draft to fit int current design specs...
r21 QXYChartSeries* series1 = QXYChartSeries::create();
Michal Klocek
adds missing files form previous commit
r12 series1->setColor(Qt::red);
Michal Klocek
Refactor current draft to fit int current design specs...
r21 QXYChartSeries* series2 = QXYChartSeries::create();
Michal Klocek
adds missing files form previous commit
r12 series2->setColor(Qt::gray);
Michal Klocek
Refactor current draft to fit int current design specs...
r21 QXYChartSeries* series3 = QXYChartSeries::create();
Michal Klocek
adds missing files form previous commit
r12 series3->setColor(Qt::green);
int numPoints = 100;
for (int x = 0; x < numPoints; ++x) {
series0->add(x,0);
Michal Klocek
change function example in xylinechart example
r14 series1->add(x, abs(sin(PI/50*x)*100));
series2->add(x, abs(cos(PI/50*x)*100));
Michal Klocek
adds missing files form previous commit
r12 series3->add(x,100);
}
Michal Klocek
Refactor current draft to fit int current design specs...
r21 QList<QXYChartSeries*> dataset;
Michal Klocek
adds missing files form previous commit
r12
Michal Klocek
Refactor current draft to fit int current design specs...
r21 //qDebug()<<"Series 1:" << *series1;
//qDebug()<<"Series 2:" << *series2;
Michal Klocek
adds missing files form previous commit
r12
dataset << series0;
dataset << series1;
dataset << series2;
dataset << series3;
Michal Klocek
Adds rubberband for zooming...
r58 QChartView* chartView = new QChartView(&window);
chartView->addSeries(series1);
chartView->addSeries(series2);
Michal Klocek
adds missing files form previous commit
r12
Michal Klocek
Adds rubberband for zooming...
r58 window.setCentralWidget(chartView);
Michal Klocek
adds missing files form previous commit
r12 window.resize(400, 300);
window.show();
return a.exec();
}