@@ -1,9 +1,9 | |||
|
1 | 1 | !include( ../examples.pri ) { |
|
2 | 2 | error( "Couldn't find the examples.pri file!" ) |
|
3 | 3 | } |
|
4 | 4 | |
|
5 |
TARGET = c |
|
|
5 | TARGET = customechart | |
|
6 | 6 | SOURCES += main.cpp |
|
7 | 7 | |
|
8 | 8 | |
|
9 | 9 |
@@ -1,95 +1,124 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE:BSD$ |
|
10 | 10 | ** You may use this file under the terms of the BSD license as follows: |
|
11 | 11 | ** |
|
12 | 12 | ** "Redistribution and use in source and binary forms, with or without |
|
13 | 13 | ** modification, are permitted provided that the following conditions are |
|
14 | 14 | ** met: |
|
15 | 15 | ** * Redistributions of source code must retain the above copyright |
|
16 | 16 | ** notice, this list of conditions and the following disclaimer. |
|
17 | 17 | ** * Redistributions in binary form must reproduce the above copyright |
|
18 | 18 | ** notice, this list of conditions and the following disclaimer in |
|
19 | 19 | ** the documentation and/or other materials provided with the |
|
20 | 20 | ** distribution. |
|
21 | 21 | ** * Neither the name of Digia nor the names of its contributors |
|
22 | 22 | ** may be used to endorse or promote products derived from this |
|
23 | 23 | ** software without specific prior written permission. |
|
24 | 24 | ** |
|
25 | 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
26 | 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
27 | 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
28 | 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
29 | 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
30 | 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
31 | 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
32 | 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
33 | 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
34 | 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
35 | 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." |
|
36 | 36 | ** $QT_END_LICENSE$ |
|
37 | 37 | ** |
|
38 | 38 | ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). |
|
39 | 39 | ** |
|
40 | 40 | ****************************************************************************/ |
|
41 | 41 | |
|
42 | 42 | #include <QApplication> |
|
43 | 43 | #include <QMainWindow> |
|
44 | 44 | #include <QChartView> |
|
45 | 45 | #include <QLineSeries> |
|
46 | 46 | |
|
47 | 47 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
48 | 48 | |
|
49 | 49 | int main(int argc, char *argv[]) |
|
50 | 50 | { |
|
51 | 51 | QApplication a(argc, argv); |
|
52 | 52 | |
|
53 | 53 | //![1] |
|
54 | 54 | QLineSeries* series = new QLineSeries(); |
|
55 |
QPen blue(Qt:: |
|
|
55 | QPen blue(Qt::yellow); | |
|
56 | 56 | blue.setWidth(3); |
|
57 | 57 | series->setPen(blue); |
|
58 | 58 | //![1] |
|
59 | 59 | //![2] |
|
60 | 60 | *series << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10,5); |
|
61 | 61 | //![2] |
|
62 | 62 | //![3] |
|
63 | 63 | QChart* chart = new QChart(); |
|
64 | 64 | chart->addSeries(series); |
|
65 |
chart->setTitle(" |
|
|
65 | chart->setTitle("Simple customchart example"); | |
|
66 | 66 | //![3] |
|
67 | 67 | //![4] |
|
68 | 68 | QFont font; |
|
69 | 69 | font.setPixelSize(18); |
|
70 | 70 | chart->setTitleFont(font); |
|
71 |
chart->setTitleBrush(Qt:: |
|
|
71 | chart->setTitleBrush(Qt::yellow); | |
|
72 | 72 | |
|
73 | 73 | QLinearGradient backgroundGradient; |
|
74 |
backgroundGradient.set |
|
|
75 |
backgroundGradient.set |
|
|
74 | backgroundGradient.setStart(QPointF(0,0)); | |
|
75 | backgroundGradient.setFinalStop(QPointF(0,1)); | |
|
76 | backgroundGradient.setColorAt(0.0, 0x3cc63c); | |
|
77 | backgroundGradient.setColorAt(1.0, 0x26f626); | |
|
76 | 78 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
77 | 79 | chart->setBackgroundBrush(backgroundGradient); |
|
78 | ||
|
79 | QPen black(Qt::black); | |
|
80 | chart->axisX()->setGridLinePen(black); | |
|
81 | chart->axisX()->setAxisPen(black); | |
|
82 | chart->axisY()->setGridLinePen(black); | |
|
83 | chart->axisY()->setAxisPen(black); | |
|
84 | 80 | //![4] |
|
85 | 81 | //![5] |
|
82 | QPen black(Qt::black); | |
|
83 | QChartAxis* axisX = chart->axisX(); | |
|
84 | QChartAxis* axisY = chart->axisY(); | |
|
85 | ||
|
86 | axisX->setAxisPen(black); | |
|
87 | axisY->setAxisPen(black); | |
|
88 | axisX->setGridLineVisible(false); | |
|
89 | axisY->setGridLineVisible(false); | |
|
90 | ||
|
91 | axisY->setShadesPen(Qt::NoPen); | |
|
92 | axisY->setShadesOpacity(0.5); | |
|
93 | axisY->setShadesBrush(Qt::white); | |
|
94 | axisY->setShadesVisible(true); | |
|
95 | //![5] | |
|
96 | //![6] | |
|
97 | QChartAxisCategories* categoriesX = chart->axisX()->categories(); | |
|
98 | categoriesX->insert(1,"low"); | |
|
99 | categoriesX->insert(5,"optimal"); | |
|
100 | categoriesX->insert(10,"high"); | |
|
101 | ||
|
102 | QChartAxisCategories* categoriesY = chart->axisY()->categories(); | |
|
103 | categoriesY->insert(1,"slow"); | |
|
104 | categoriesY->insert(5,"med"); | |
|
105 | categoriesY->insert(10,"fast"); | |
|
106 | //![6] | |
|
107 | //![7] | |
|
108 | axisX->setRange(0,10); | |
|
109 | axisX->setTicksCount(4); | |
|
110 | axisY->setRange(0,10); | |
|
111 | axisY->setTicksCount(4); | |
|
112 | //![7] | |
|
113 | //![8] | |
|
86 | 114 | QChartView* chartView = new QChartView(chart); |
|
87 | 115 | chartView->setRenderHint(QPainter::Antialiasing); |
|
88 |
//![ |
|
|
116 | //![8] | |
|
117 | //![9] | |
|
89 | 118 | QMainWindow window; |
|
90 | 119 | window.setCentralWidget(chartView); |
|
91 | 120 | window.resize(400, 300); |
|
92 | 121 | window.show(); |
|
93 |
//![ |
|
|
122 | //![9] | |
|
94 | 123 | return a.exec(); |
|
95 | 124 | } |
@@ -1,32 +1,30 | |||
|
1 | 1 | TEMPLATE = subdirs |
|
2 | 2 | SUBDIRS += \ |
|
3 | 3 | areachart \ |
|
4 | #axischart \ | |
|
5 | 4 | barchart \ |
|
6 | 5 | #chartview \ |
|
7 |
c |
|
|
8 | #customcolors \ | |
|
6 | customchart \ | |
|
9 | 7 | #dynamiclinechart \ |
|
10 | 8 | #ekgchart \ |
|
11 | 9 | #gdpbarchart \ |
|
12 | 10 | linechart \ |
|
13 | 11 | #multichart \ |
|
14 | 12 | percentbarchart \ |
|
15 | 13 | piechart \ |
|
16 | 14 | #piechartdrilldown \ |
|
17 | 15 | #presenterchart \ |
|
18 | 16 | scatterchart \ |
|
19 | 17 | #scatterinteractions \ |
|
20 | 18 | #splinechart \ |
|
21 | 19 | stackedbarchart \ |
|
22 | 20 | #stackedbarchartdrilldown \ |
|
23 | 21 | #tablemodelchart \ |
|
24 | 22 | zoomlinechart |
|
25 | 23 | |
|
26 | 24 | |
|
27 | 25 | |
|
28 | 26 | |
|
29 | 27 | |
|
30 | 28 | |
|
31 | 29 | |
|
32 | 30 |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now