diff --git a/example/axischart/axischart.pro b/example/axischart/axischart.pro index 2cd2444..1bef56e 100644 --- a/example/axischart/axischart.pro +++ b/example/axischart/axischart.pro @@ -1,15 +1,8 @@ -!include( ../../common.pri ) { - error( "Couldn't find the common.pri file!" ) +!include( ../example.pri ) { + error( "Couldn't find the example.pri file!" ) } - -!include( ../../integrated.pri ) { - error( "Couldn't find the integrated.pri file !") -} - TARGET = axisChart -TEMPLATE = app -QT += core gui -SOURCES += main.cpp +SOURCES = main.cpp diff --git a/example/example.pri b/example/example.pri new file mode 100644 index 0000000..4ed8249 --- /dev/null +++ b/example/example.pri @@ -0,0 +1,10 @@ +!include( ../common.pri ) { + error( "Couldn't find the common.pri file!" ) +} + +!include( ../integrated.pri ) { + error( "Couldn't find the integrated.pri file !") +} + +TEMPLATE = app +QT += core gui \ No newline at end of file diff --git a/example/example.pro b/example/example.pro index 321ce98..7884189 100644 --- a/example/example.pro +++ b/example/example.pro @@ -10,5 +10,5 @@ SUBDIRS += linechart \ dynamiclinechart \ axischart \ multichart \ - axischart\ - gdpbarchart + gdpbarchart \ + presenterchart diff --git a/example/presenterchart/chartview.cpp b/example/presenterchart/chartview.cpp new file mode 100644 index 0000000..f1fa540 --- /dev/null +++ b/example/presenterchart/chartview.cpp @@ -0,0 +1,57 @@ +#include "chartview.h" +#include +#include + +ChartView::ChartView(QWidget* parent):QChartView(parent), +m_index(0) +{ + QObject::connect(&m_timer,SIGNAL(timeout()),this,SLOT(handleTimeout())); + m_timer.setInterval(3000); + + QTime now = QTime::currentTime(); + qsrand((uint)now.msec()); + + QLineChartSeries* series0 = new QLineChartSeries(); + QPen blue(Qt::blue); + blue.setWidth(3); + series0->setPen(blue); + QLineChartSeries* series1 = new QLineChartSeries(); + QPen red(Qt::red); + red.setWidth(3); + series1->setPen(red); + QLineChartSeries* series2 = new QLineChartSeries(); + QPen green(Qt::green); + green.setWidth(3); + series2->setPen(green); + + int numPoints = 10; + + for (int x = 0; x <= numPoints; ++x) { + series0->add(x, qrand() % 100); + series1->add(x, qrand() % 100); + series2->add(x, qrand() % 100); + } + + addSeries(series0); + + m_series< +#include + +QTCOMMERCIALCHART_USE_NAMESPACE + +class ChartView: public QChartView +{ + Q_OBJECT +public: + ChartView(QWidget* parent=0); + virtual ~ChartView(); + +public slots: + void handleTimeout(); + +private: + QTimer m_timer; + QList m_series; + int m_index; +}; + +#endif /* CHARTVIEW_H_ */ diff --git a/example/presenterchart/main.cpp b/example/presenterchart/main.cpp new file mode 100644 index 0000000..fe739c7 --- /dev/null +++ b/example/presenterchart/main.cpp @@ -0,0 +1,16 @@ +#include "chartview.h" +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QMainWindow window; + ChartView chartView(&window); + chartView.setRenderHint(QPainter::Antialiasing); + chartView.setChartTitle("Three random line charts"); + window.setCentralWidget(&chartView); + window.resize(400, 300); + window.show(); + return a.exec(); +} diff --git a/example/presenterchart/presenterchart.pro b/example/presenterchart/presenterchart.pro new file mode 100644 index 0000000..ce135d2 --- /dev/null +++ b/example/presenterchart/presenterchart.pro @@ -0,0 +1,6 @@ +!include( ../example.pri ) { + error( "Couldn't find the example.pri file!" ) +} +TARGET = presenterChart +HEADERS += chartview.h +SOURCES += main.cpp chartview.cpp \ No newline at end of file