##// END OF EJS Templates
Fix pie animation chrash
Fix pie animation chrash

File last commit:

r2273:1c49aa901cb2
r2321:9b8615dbb840
Show More
main.cpp
83 lines | 2.2 KiB | text/x-c | CppLexer
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the Qt Commercial Charts Add-on.
**
** $QT_BEGIN_LICENSE$
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QApplication>
#include <QMainWindow>
#include <QChartView>
#include <QLineSeries>
#include <QValueAxis>
#include <QTime>
#include <QValueAxis>
QTCOMMERCIALCHART_USE_NAMESPACE
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
//![1]
QLineSeries *series;
QValueAxis *axisX;
QValueAxis *axisY;
QChart *chart = new QChart();
for (int i = 0; i < 5; i++) {
series = new QLineSeries;
for (int k(0); k < 8; k++)
series->append(i + k, qrand() % 20);
chart->addSeries(series);
axisX = new QValueAxis;
axisX->setTickCount(7 + i);
axisX->setLinePenColor(series->pen().color());
axisY = new QValueAxis;
axisY->setTickCount(7 + i);
axisY->setLinePenColor(series->pen().color());
chart->addAxis(axisX,i % 2?Qt::AlignTop:Qt::AlignBottom);
chart->addAxis(axisY,i % 2?Qt::AlignRight:Qt::AlignLeft);
series->attachAxis(axisX);
series->attachAxis(axisY);
}
//![2]
//![3]
chart->legend()->hide();
chart->setTitle("Simple line chart example");
//![3]
//![4]
QChartView *chartView = new QChartView(chart);
chartView->setRenderHint(QPainter::Antialiasing);
//![4]
//![5]
QMainWindow window;
window.setCentralWidget(chartView);
window.resize(800, 600);
window.show();
//![5]
return a.exec();
}