##// END OF EJS Templates
Refactors click signal to line,area,spline,scatter charts
Refactors click signal to line,area,spline,scatter charts

File last commit:

r530:d482058261e4
r571:0bb609016fcc
Show More
main.cpp
45 lines | 1.1 KiB | text/x-c | CppLexer
Michal Klocek
Add zoom support...
r67 #include "chartwidget.h"
#include <QApplication>
#include <QMainWindow>
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 #include <qlineseries.h>
Michal Klocek
Add zoom support...
r67 #include <cmath>
QTCOMMERCIALCHART_USE_NAMESPACE
#define PI 3.14159265358979
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
Refactora axis and line chart to use graphics items insted of painter.
r85 QPen blue(Qt::blue);
blue.setWidth(3);
series0->setPen(blue);
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 QLineSeries* series1 = new QLineSeries();
Michal Klocek
Refactora axis and line chart to use graphics items insted of painter.
r85 QPen red(Qt::red);
red.setWidth(3);
series1->setPen(red);
Michal Klocek
Add zoom support...
r67
int numPoints = 100;
for (int x = 0; x <= numPoints; ++x) {
Michal Klocek
Refactors qchart , adds line animation...
r131 series0->add(x, fabs(sin(PI/50*x)*100));
series1->add(x, fabs(cos(PI/50*x)*100));
Michal Klocek
Add zoom support...
r67 }
ChartWidget* chartWidget = new ChartWidget(&window);
Michal Klocek
Adds titles to all linechart examples
r88 chartWidget->setRenderHint(QPainter::Antialiasing);
Michal Klocek
Adds font handling for chart's titile...
r192 chartWidget->setChartTitle("Zoom in/out line chart example");
Michal Klocek
Animation refactor...
r530 chartWidget->setAnimationOptions(QChart::AllAnimations);
Michal Klocek
Add zoom support...
r67 chartWidget->addSeries(series0);
chartWidget->addSeries(series1);
window.setCentralWidget(chartWidget);
window.resize(400, 300);
window.show();
return a.exec();
}