##// END OF EJS Templates
Basic logvalueaxis example added
Marek Rosa -
r2365:b2dcbae22d23
parent child
Show More
@@ -0,0 +1,5
1 !include( ../examples.pri ) {
2 error( "Couldn't find the examples.pri file!" )
3 }
4 TARGET = logvalueaxis
5 SOURCES += main.cpp
@@ -0,0 +1,73
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include <QApplication>
22 #include <QMainWindow>
23 #include <QChartView>
24 #include <QLineSeries>
25 #include <QValueAxis>
26 #include <QLogValueAxis>
27
28 QTCOMMERCIALCHART_USE_NAMESPACE
29
30 int main(int argc, char *argv[])
31 {
32 QApplication a(argc, argv);
33
34 //![1]
35 QLineSeries *series = new QLineSeries();
36 *series << QPointF(1, 7) << QPointF(2, 73) << QPointF(3, 268) << QPointF(4, 17) << QPointF(5, 4325) << QPointF(6, 723);
37 //![1]
38
39 //![3]
40 QChart *chart = new QChart();
41 chart->addSeries(series);
42 chart->legend()->hide();
43 //![3]
44
45 //![4]
46 QValueAxis *axisX = new QValueAxis;
47 axisX->setTitleText("Data point");
48 axisX->setTickCount(6);
49 axisX->setLabelFormat("%i");
50 chart->addAxis(axisX, Qt::AlignBottom);
51 series->attachAxis(axisX);
52
53 QLogValueAxis *axisY = new QLogValueAxis;
54 axisY->setBase(2);
55 axisY->setTitleText("Values");
56 chart->addAxis(axisY, Qt::AlignLeft);
57 series->attachAxis(axisY);
58 //![4]
59
60 //![5]
61 QChartView *chartView = new QChartView(chart);
62 chartView->setRenderHint(QPainter::Antialiasing);
63 //![5]
64
65 //![6]
66 QMainWindow window;
67 window.setCentralWidget(chartView);
68 window.resize(800, 600);
69 window.show();
70 //![6]
71
72 return a.exec();
73 }
@@ -30,7 +30,8 SUBDIRS += \
30 temperaturerecords \
30 temperaturerecords \
31 donutchart \
31 donutchart \
32 multiaxis \
32 multiaxis \
33 legendmarkers
33 legendmarkers \
34 logvalueaxis
34
35
35 !linux-arm*: {
36 !linux-arm*: {
36 SUBDIRS += \
37 SUBDIRS += \
General Comments 0
You need to be logged in to leave comments. Login now