##// END OF EJS Templates
Marek Rosa -
r337:1f21d3bffe32 merge
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,51
1 /*!
2 \page classes.html
3 \title QtCommercial Charts API
4 \keyword All Classes
5
6 \raw HTML
7 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
8 <tr>
9 <th class="titleheader" width="33%">
10 List of classes
11 </th>
12 </tr>
13 <tr>
14 <td valign="top">
15 <ul>
16 <li><a href="qbarcategory.html">QBarCategory</a></li>
17 <li><a href="qbarchartseries.html">QBarChartSeries</a></li>
18 <li><a href="qbarset.html">QBarSet</a></li>
19 <li><a href="qchart.html">QChart</a></li>
20 <li><a href="qchartaxis.html">QChartAxis</a></li>
21 <li><a href="qchartseries.html">QChartSeries</a></li>
22 <li><a href="qchartview.html">QChartView</a></li>
23 <li><a href="qlinechartseries.html">QLineChartSeries</a></li>
24 <li><a href="qpercentbarchartseries.html">QPercentBarChartSeries</a></li>
25 <li><a href="qpieseries.html">QPieSeries</a></li>
26 <li><a href="qpieslice.html">QPieSlice</a></li>
27 <li><a href="qscatterseries.html">QScatterSeries</a></li>
28 <li><a href="qstackedbarchartseries.html">QStackedBarChartSeries</a></li>
29 </ul>
30 </td>
31 </tr>
32 </table>
33
34 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
35 <tr>
36 <th class="titleheader" width="33%">
37 Other files:
38 </th>
39 </tr>
40 <tr>
41 <td valign="top">
42 <ul>
43 <li><a href="qchartglobal.html">QChartGlobal</a></li>
44 </ul>
45 </td>
46 </tr>
47 </table>
48
49 \endraw
50
51 */
@@ -0,0 +1,9
1 /*!
2 \example example/barchart
3 \title LineChart Example
4 \subtitle
5
6 The example shows how to create simple bar chart.
7
8 ...
9 */ No newline at end of file
@@ -0,0 +1,9
1 /*!
2 \example example/linechart
3 \title LineChart Example
4 \subtitle
5
6 The example shows how to create simple line chart.
7
8 ...
9 */ No newline at end of file
@@ -0,0 +1,9
1 /*!
2 \example example/piechart
3 \title LineChart Example
4 \subtitle
5
6 The example shows how to create simple pie chart.
7
8 ...
9 */ No newline at end of file
@@ -0,0 +1,24
1 /*!
2 \page examples.html
3 \title Examples
4 \keyword Examples
5
6 \raw HTML
7 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
8 <tr>
9 <th class="titleheader" width="33%">
10 List of examples
11 </th>
12 </tr>
13 <tr>
14 <td valign="top">
15 <ul>
16 <li><a href="example-barchart.html">Bar Chart example</a></li>
17 <li><a href="example-linechart.html">Line Chart example</a></li>
18 <li><a href="example-piechart.html">Pie Chart example</a></li>
19 </ul>
20 </td>
21 </tr>
22 </table>
23 \endraw
24 */
@@ -0,0 +1,26
1 /*!
2 \page tutorials.html
3 \title Tutorials
4 \keyword Tutorials
5
6 For example, to create a chart with line series using a widget based application:
7 \snippet ../example/chartview/main.cpp 1
8 \image chartview_example.jpg
9
10 To replace the line series with a pie series you use the dedicated QPieSeries class:
11 \snippet ../example/chartview/main.cpp 3
12 \image chartview_example_pie.jpg
13
14 To use a scatter series you use QScatterSeries class:
15 \snippet ../example/chartview/main.cpp 4
16 \image chartview_example_scatter.jpg
17
18 And to show a bar series you use one of the bar series classes, for example QBarChartSeries:
19 \snippet ../example/chartview/main.cpp 5
20 \image chartview_example_bar.jpg
21
22 If you need to give a more professional touch to your chart you can switch from the default
23 theme to one of the other themes:
24 \snippet ../example/chartview/main.cpp 2
25 \image chartview_example_theme.jpg
26 */
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -1,13 +1,19
1 include(qt-html-default-styles.qdocconf)
1 include(qchart-html.qdocconf)
2
2
3 HTML.postheader = \
3 HTML.postheader = \
4 "<div class=\"header\" id=\"qtdocheader\">\n" \
4 "<div class=\"header\" id=\"qtdocheader\">\n" \
5 " <div class=\"content\"> \n" \
5 " <div class=\"content\"> \n" \
6 " <a href=\"index.html\" class=\"qtref\"><span>QChart Reference Documentation</span></a>\n" \
6 " <img src=\"images/qcharts.png\" alt=\"qcharts\"/>\n" \
7 " <p class=\"qtref\"> \n" \
8 " <span>Reference Documentation</span>\n" \
9 " </p>\n" \
7 " </div>\n" \
10 " </div>\n" \
8 " <div class=\"breadcrumb toolblock\">\n" \
11 " <div class=\"breadcrumb toolblock\">\n" \
9 " <ul>\n" \
12 " <ul>\n" \
10 " <li class=\"first\"><a href=\"index.html\">Home</a></li>\n" \
13 " <li class=\"first\"><a href=\"index.html\">About</a></li>\n" \
14 " <li><a href=\"classes.html\">API Classes</a></li>\n" \
15 " <li><a href=\"tutorials.html\">Tutorials</a></li>\n" \
16 " <li><a href=\"examples.html\">Examples</a></li>\n" \
11 " <!-- Breadcrumbs go here -->\n"
17 " <!-- Breadcrumbs go here -->\n"
12
18
13 HTML.postpostheader = \
19 HTML.postpostheader = \
@@ -33,6 +39,8 HTML.footer = \
33 " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \
39 " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \
34 " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \
40 " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \
35 " with the terms contained in a written agreement between you and Digia.</p>\n" \
41 " with the terms contained in a written agreement between you and Digia.</p>\n" \
42 " <p>\n" \
43 " <img src=\"images/digia_logo.png\" alt=\"digia\" /></p>\n" \
36 "</div>\n" \
44 "</div>\n" \
37
45
38 # Files not referenced in any qdoc file.
46 # Files not referenced in any qdoc file.
@@ -45,5 +53,5 qhp.QDoc.extraFiles = index.html \
45 images/bullet_sq.png \
53 images/bullet_sq.png \
46 images/bullet_up.png \
54 images/bullet_up.png \
47 images/horBar.png \
55 images/horBar.png \
48 images/sprites-combined.png \
56 images/qcharts.png \
49 style/offline.css
57 style/offline.css
@@ -12,7 +12,9 HTML.scripts =
12 # These also need to be listed in qhp.Qt.extraFiles with the correct
12 # These also need to be listed in qhp.Qt.extraFiles with the correct
13 # directory prefixes.
13 # directory prefixes.
14
14
15 extraimages.HTML = qt-logo.png \
15 extraimages.HTML = qt_commercial_logo.png \
16 digia_logo.png \
17 qcharts.png \
16 arrow_down.png \
18 arrow_down.png \
17 breadcrumb.png \
19 breadcrumb.png \
18 bullet_gt.png \
20 bullet_gt.png \
@@ -20,7 +22,10 extraimages.HTML = qt-logo.png \
20 bullet_sq.png \
22 bullet_sq.png \
21 bullet_up.png \
23 bullet_up.png \
22 horBar.png \
24 horBar.png \
23 sprites-combined.png
25 bg.png
26
27
28
24
29
25 # Include the style sheets and scripts used.
30 # Include the style sheets and scripts used.
26
31
@@ -32,3 +37,5 HTML.headerscripts =
32 HTML.endheader = \
37 HTML.endheader = \
33 "</head>\n" \
38 "</head>\n" \
34 "<body>\n"
39 "<body>\n"
40
41 HTML.nobreadcrumbs = true No newline at end of file
@@ -1,6 +1,6
1 include(compat.qdocconf)
1 include(compat.qdocconf)
2 include(macros.qdocconf)
2 include(macros.qdocconf)
3 include(qt-html-templates.qdocconf)
3 include(qchart-html-template.qdocconf)
4
4
5 project = QtCommercialCharts
5 project = QtCommercialCharts
6 description = Library for creating charts
6 description = Library for creating charts
@@ -10,13 +10,11 sourcedirs = ../src \
10 ./src
10 ./src
11 headerdirs = ../src \
11 headerdirs = ../src \
12 ../example
12 ../example
13 exampledirs = ../src \
13 exampledirs = ../ \
14 ../example
14 ../src \
15
15 ../example
16 HTML.templatedir = .
16
17 HTML.stylesheets = style/offline.css
17 excludefiles += ../example/linechart/linechart.pro
18 HTML.headerstyles= "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline.css\" />\n"
19 HTML.nobreadcrumbs = true
20
18
21 sources.fileextensions = *.cpp *.qdoc *.mm *.qml
19 sources.fileextensions = *.cpp *.qdoc *.mm *.qml
22 headers.fileextensions = *.h *.ch *.h++ *.hh *.hpp *.hxx
20 headers.fileextensions = *.h *.ch *.h++ *.hh *.hpp *.hxx
@@ -1,51 +1,29
1 /*!
1 /*!
2 \page index.html
2 \page index.html
3 \title QtCommercial Charts
3 \keyword About
4 \keyword All Classes
5
4
6 TODO: restructure the document
5 \raw HTML
7
6 <div class="qchart">
8 QtCommercial Charts introduction...
7 <img src="images/qt_commercial_logo.png" alt="qtcommercial"/>
9 For example, to create a chart with line series using a widget based application:
10 \snippet ../example/chartview/main.cpp 1
11 \image chartview_example.jpg
12
13 Showing a few more series:
14 \snippet ../example/chartview/main.cpp 3
15 \image chartview_example_pie.jpg
16 \snippet ../example/chartview/main.cpp 4
17 \image chartview_example_scatter.jpg
18 \snippet ../example/chartview/main.cpp 5
19 \image chartview_example_bar.jpg
20
21 If you need to give a more professional touch to your chart you can switch to one of the
22 pre-defined themes:
23 \snippet ../example/chartview/main.cpp 2
24 \image chartview_example_theme.jpg
25
26 \raw HTML
27 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
28 <tr>
29 <th class="titleheader" width="33%">
30 List of classes
31 </th>
32 </tr>
33 <tr>
34 <td valign="top">
35 <ul>
36 <li><a href="qchart.html">QChart</a></li>
37 <li><a href="qchartview.html">QChartView</a></li>
38 <li><a href="qchartseries.html">QChartSeries</a></li>
39 <li><a href="qlinechartseries.html">QLineChartSeries</a></li>
40 <li><a href="qpieseries.html">QPieSeries</a></li>
41 <li><a href="qbarchartseries.html">QBarChartSeries</a></li>
42 <li><a href="qstackedbarchartseries.html">QStackedBarChartSeries</a></li>
43 <li><a href="qpercentbarchartseries.html">QPercentBarChartSeries</a></li>
44 <li><a href="qscatterseries.html">QScatterSeries</a></li>
45 </ul>
46 </td>
47 </tr>
48 </table>
49 \endraw
50
8
9 <p>
10 QCharts is a part of Qt Commercial addons package. It provides a set of simple chart components which are available for Qt Commercial customers.
11 It uses Qt Graphics View Framework, therefore charts can be easily integrated 2D modern user interfaces. QCharts can be used as QWidgets, QGraphicsWidget or QML elements.
12 Users can easily create impressive graphs by selecting one of the charts themes.
13 </p>
14 <table><tr>
15 <td><img src="images/linechart.png" alt="linechart" /></td>
16 <td><img src="images/chartview_example_bar.jpg " alt="barchart" /></td>
17 <td><img src="images/chartview_example_pie.jpg " alt="piechart" /></td>
18 </tr>
19 <tr>
20 <td><img src="images/chartview_example.jpg " alt="linechart" /></td>
21 <td><img src="images/chartview_example_scatter.jpg " alt="scatterchart" /></td>
22 <td><img src="images/chartview_example_theme.jpg " alt="themechart" /></td>
23 </tr>
24 </table>
25 </div>
26 \endraw
27
28
51 */
29 */
@@ -1,6 +1,24
1 @media screen
1 @media screen
2 {
2 {
3
3
4 .qchart
5 {
6 width: 80%;
7 margin-left: auto;
8 margin-right: auto;
9 margin-top: 50px;
10 }
11
12 .qchart img
13 {
14 float:left;
15 }
16
17 .qchart table
18 {
19 margin-top: 50px;
20 }
21
4 /* basic elements */
22 /* basic elements */
5 html
23 html
6 {
24 {
@@ -232,25 +250,36
232 {
250 {
233 color: #00732F;
251 color: #00732F;
234 font-weight: bold;
252 font-weight: bold;
235 font-size: 130%;
253 font-size: 100%;
254 text-align: center;
236 }
255 }
237
256
238 .header .content
257 .header .content
239 {
258 {
240 margin-bottom: 0.5em
259 /* margin-bottom: 0.5em*/
241 }
260 }
242
261
262 .header .content img
263 {
264 display: block;
265 margin-left: auto;
266 margin-right: auto;
267 width: 100px;
268 }
269
243 .naviNextPrevious
270 .naviNextPrevious
244 {
271 {
245 display: none
272 display: none
246 }
273 }
247 .header .breadcrumb
274 .header .breadcrumb
248 {
275 {
249 font-size: 90%;
276 font-size: 100%;
250 padding: 0.5em 0 0.5em 1em;
277 padding: 0.5em 0 0.5em 1em;
251 margin: 0;
278 margin: 0;
252 background-color: #fafafa;
279 /*background-color: #393735;*/
253 height: 1.35em;
280 font-weight: bold;
281 background: #ffffff url(../images/bg.png) repeat-x;
282 height: 20px;
254 border-bottom: 1px solid #d1d1d1;
283 border-bottom: 1px solid #d1d1d1;
255 }
284 }
256
285
@@ -268,7 +297,7
268 .header .breadcrumb ul li
297 .header .breadcrumb ul li
269 {
298 {
270 float: left;
299 float: left;
271 background: url(../images/breadcrumb.png) no-repeat 0 3px;
300 /*background: url(../images/breadcrumb.png) no-repeat 0 3px;*/
272 padding-left: 1.5em;
301 padding-left: 1.5em;
273 margin-left: 1.5em;
302 margin-left: 1.5em;
274 }
303 }
@@ -280,9 +309,15
280
309
281 .header .breadcrumb ul li a
310 .header .breadcrumb ul li a
282 {
311 {
283 color: #00732F;
312 color: #ffffff;
284 }
313 }
285
314
315 .header .breadcrumb ul li a:hover
316 {
317 color: #00732F;
318 text-decoration: none;
319 }
320
286 .header .breadcrumb ul li.first
321 .header .breadcrumb ul li.first
287 {
322 {
288 background-image: none;
323 background-image: none;
@@ -479,7 +514,7
479
514
480 .content .toc h3 {
515 .content .toc h3 {
481 border-bottom: 0px;
516 border-bottom: 0px;
482 margin-top: 0px;
517 margin-top: 10px;
483 }
518 }
484
519
485 .content .toc h3 a:hover {
520 .content .toc h3 a:hover {
@@ -18,6 +18,7 int main(int argc, char *argv[])
18 //! [1]
18 //! [1]
19 // Create chart view
19 // Create chart view
20 QChartView *chartView = new QChartView();
20 QChartView *chartView = new QChartView();
21 chartView->setRenderHint(QPainter::Antialiasing);
21 // Add series to the chart
22 // Add series to the chart
22 QLineChartSeries *line = new QLineChartSeries();
23 QLineChartSeries *line = new QLineChartSeries();
23 line->add(0.0, 0.8);
24 line->add(0.0, 0.8);
@@ -33,6 +34,7 int main(int argc, char *argv[])
33
34
34 //! [3]
35 //! [3]
35 // Add pie series
36 // Add pie series
37 // ...
36 QPieSeries *pie = new QPieSeries();
38 QPieSeries *pie = new QPieSeries();
37 pie->add(3.4, "slice1");
39 pie->add(3.4, "slice1");
38 pie->add(6.7, "slice2");
40 pie->add(6.7, "slice2");
@@ -41,6 +43,7 int main(int argc, char *argv[])
41
43
42 //! [4]
44 //! [4]
43 // Add scatter series
45 // Add scatter series
46 // ...
44 QScatterSeries *scatter = new QScatterSeries();
47 QScatterSeries *scatter = new QScatterSeries();
45 for (qreal x(0); x < 100; x += 0.5) {
48 for (qreal x(0); x < 100; x += 0.5) {
46 qreal y = rand() % 100;
49 qreal y = rand() % 100;
@@ -50,6 +53,7 int main(int argc, char *argv[])
50 //! [4]
53 //! [4]
51
54
52 //! [5]
55 //! [5]
56 // ...
53 // Add bar series
57 // Add bar series
54 QBarCategory *barCategory = new QBarCategory();
58 QBarCategory *barCategory = new QBarCategory();
55 *barCategory << "Jan"
59 *barCategory << "Jan"
@@ -65,7 +69,7 int main(int argc, char *argv[])
65 //! [5]
69 //! [5]
66
70
67 QMainWindow w;
71 QMainWindow w;
68 w.resize(350, 250);
72 w.resize(380, 250);
69 w.setCentralWidget(chartView);
73 w.setCentralWidget(chartView);
70 w.show();
74 w.show();
71
75
@@ -7,36 +7,46
7
7
8 QTCOMMERCIALCHART_USE_NAMESPACE
8 QTCOMMERCIALCHART_USE_NAMESPACE
9
9
10 #define PI 3.14159265358979
11
12 int main(int argc, char *argv[])
10 int main(int argc, char *argv[])
13 {
11 {
14 QApplication a(argc, argv);
12 QApplication a(argc, argv);
15
13
16 QMainWindow window;
14 QMainWindow window;
17
15
16 //![1]
17
18 QLineChartSeries* series0 = new QLineChartSeries();
18 QLineChartSeries* series0 = new QLineChartSeries();
19 QPen blue(Qt::blue);
19 QPen blue(Qt::blue);
20 blue.setWidth(3);
20 blue.setWidth(3);
21 series0->setPen(blue);
21 series0->setPen(blue);
22
22 QLineChartSeries* series1 = new QLineChartSeries();
23 QLineChartSeries* series1 = new QLineChartSeries();
23 QPen red(Qt::red);
24 QPen red(Qt::red);
24 red.setWidth(3);
25 red.setWidth(3);
25 series1->setPen(red);
26 series1->setPen(red);
26
27 //![1]
27 int numPoints = 100;
28
28
29 //![2]
29 for (int x = 0; x <= numPoints; ++x) {
30 series0->add(0, 6);
30 series0->add(x, fabs(sin(PI/50*x)*100));
31 series0->add(2, 4);
31 series1->add(x, fabs(cos(PI/50*x)*100));
32 series0->add(3, 8);
32 }
33 series0->add(7, 4);
33
34 series0->add(10,5);
35
36 series1->add(1, 1);
37 series1->add(3, 3);
38 series1->add(7, 6);
39 series1->add(8, 3);
40 series1->add(10,2);
41 //![2]
42 //![3]
34 QChartView* chartView = new QChartView(&window);
43 QChartView* chartView = new QChartView(&window);
35
44
36 chartView->setRenderHint(QPainter::Antialiasing);
45 chartView->setRenderHint(QPainter::Antialiasing);
37 chartView->setChartTitle("Basic line chart example");
46 chartView->setChartTitle("Basic line chart example");
38 chartView->addSeries(series0);
47 chartView->addSeries(series0);
39 chartView->addSeries(series1);
48 chartView->addSeries(series1);
49 //![3]
40
50
41 window.setCentralWidget(chartView);
51 window.setCentralWidget(chartView);
42 window.resize(400, 300);
52 window.resize(400, 300);
@@ -114,7 +114,7 void AxisItem::handleAxisUpdate(QChartAxis* axis)
114 setAxisPen(axis->axisPen());
114 setAxisPen(axis->axisPen());
115 setLabelsPen(axis->labelsPen());
115 setLabelsPen(axis->labelsPen());
116 setLabelsBrush(axis->labelsBrush());
116 setLabelsBrush(axis->labelsBrush());
117 setLabelsFont(axis->labelFont());
117 setLabelsFont(axis->labelsFont());
118 setGridPen(axis->gridPen());
118 setGridPen(axis->gridPen());
119 setShadesPen(axis->shadesPen());
119 setShadesPen(axis->shadesPen());
120 setShadesBrush(axis->shadesBrush());
120 setShadesBrush(axis->shadesBrush());
@@ -2,15 +2,75
2
2
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4
4
5 /*!
6 \class QLineChartSeries
7 \brief The QLineChartSeries class is used for making line charts.
8
9 \mainclass
10
11 A line chart is used to show information as a series of data points
12 connected by straight lines.
13
14 \image linechart.png
15
16 To create line charts, users need to first QLineChartSeries object.
17
18 \snippet ../example/linechart/main.cpp 1
19
20 Populate with the data
21
22 \snippet ../example/linechart/main.cpp 2
23
24 Add created series objects to QChartView or QChart instance.
25
26 \snippet ../example/linechart/main.cpp 3
27
28 */
29
30 /*!
31 \fn virtual QChartSeriesType QLineChartSeries::type() const
32 \brief Returns type of series.
33 \sa QChartSeries, QChartSeriesType
34 */
35
36 /*!
37 \fn QPen QLineChartSeries::pen() const
38 \brief Returns the pen used to draw line for this series.
39 \sa setPen()
40 */
41
42 /*!
43 \fn bool QLineChartSeries::isPointsVisible() const
44 \brief Returns if the points are drawn for this series.
45 \sa setPointsVisible()
46 */
47
48
49 /*!
50 \fn void QLineChartSeries::changed(int index)
51 \brief \internal \a index
52 */
53
54 /*!
55 Constructs empty series object which is a child of \a parent.
56 When series object is added to QChartView or QChart instance ownerships is transfered.
57 */
5 QLineChartSeries::QLineChartSeries(QObject* parent):QChartSeries(parent),
58 QLineChartSeries::QLineChartSeries(QObject* parent):QChartSeries(parent),
6 m_pointsVisible(false)
59 m_pointsVisible(false)
7 {
60 {
8 }
61 }
9
62 /*!
63 Destroys the object. Series added to QChartView or QChart instances are owned by those,
64 and are deleted when mentioned object are destroyed.
65 */
10 QLineChartSeries::~QLineChartSeries()
66 QLineChartSeries::~QLineChartSeries()
11 {
67 {
12 }
68 }
13
69
70 /*!
71 Adds data point \a x \a y to the series. Points are connected with lines on the chart.
72 Function returns index, which can be used to modify data.
73 */
14 int QLineChartSeries::add(qreal x,qreal y)
74 int QLineChartSeries::add(qreal x,qreal y)
15 {
75 {
16 m_x<<x;
76 m_x<<x;
@@ -18,6 +78,21 int QLineChartSeries::add(qreal x,qreal y)
18 return m_x.size()-1;
78 return m_x.size()-1;
19 }
79 }
20
80
81 /*!
82 This is an overloaded function.
83 Adds data \a point to the series. Points are connected with lines on the chart.
84 Function returns index, which can be used to modify data.
85 */
86 int QLineChartSeries::add(const QPointF& point)
87 {
88 m_x<<point.x();
89 m_y<<point.y();
90 return m_x.size()-1;
91 }
92
93 /*!
94 Modifies data within \a index, sets new \a x and \a y values.
95 */
21 void QLineChartSeries::set(int index,qreal x,qreal y)
96 void QLineChartSeries::set(int index,qreal x,qreal y)
22 {
97 {
23 m_x[index]=x;
98 m_x[index]=x;
@@ -25,22 +100,46 void QLineChartSeries::set(int index,qreal x,qreal y)
25 emit changed(index);
100 emit changed(index);
26 }
101 }
27
102
103 /*!
104 This is an overloaded function.
105 Modifies data within \a index, sets new \a point value.
106 */
107 void QLineChartSeries::set(int index,const QPointF& point)
108 {
109 m_x[index]=point.x();
110 m_y[index]=point.y();
111 emit changed(index);
112 }
113
114
115 /*!
116 Clears all the data.
117 */
28 void QLineChartSeries::clear()
118 void QLineChartSeries::clear()
29 {
119 {
30 m_x.clear();
120 m_x.clear();
31 m_y.clear();
121 m_y.clear();
32 }
122 }
33
123
124 /*!
125 \internal \a pos
126 */
34 qreal QLineChartSeries::x(int pos) const
127 qreal QLineChartSeries::x(int pos) const
35 {
128 {
36 return m_x.at(pos);
129 return m_x.at(pos);
37 }
130 }
38
131
132 /*!
133 \internal \a pos
134 */
39 qreal QLineChartSeries::y(int pos) const
135 qreal QLineChartSeries::y(int pos) const
40 {
136 {
41 return m_y.at(pos);
137 return m_y.at(pos);
42 }
138 }
43
139
140 /*!
141 Returns number of data points within series.
142 */
44 int QLineChartSeries::count() const
143 int QLineChartSeries::count() const
45 {
144 {
46 Q_ASSERT(m_x.size() == m_y.size());
145 Q_ASSERT(m_x.size() == m_y.size());
@@ -49,11 +148,22 int QLineChartSeries::count() const
49
148
50 }
149 }
51
150
151 /*!
152 Sets \a pen used for drawing given series..
153 */
52 void QLineChartSeries::setPen(const QPen& pen)
154 void QLineChartSeries::setPen(const QPen& pen)
53 {
155 {
54 m_pen=pen;
156 m_pen=pen;
55 }
157 }
56
158
159 /*!
160 Sets if data points are \a visible and should be drawn on line.
161 */
162 void QLineChartSeries::setPointsVisible(bool visible)
163 {
164 m_pointsVisible=visible;
165 }
166
57 QDebug operator<< (QDebug debug, const QLineChartSeries series)
167 QDebug operator<< (QDebug debug, const QLineChartSeries series)
58 {
168 {
59 Q_ASSERT(series.m_x.size() == series.m_y.size());
169 Q_ASSERT(series.m_x.size() == series.m_y.size());
@@ -66,10 +176,7 QDebug operator<< (QDebug debug, const QLineChartSeries series)
66 return debug.space();
176 return debug.space();
67 }
177 }
68
178
69 void QLineChartSeries::setPointsVisible(bool visible)
179
70 {
71 m_pointsVisible=visible;
72 }
73 #include "moc_qlinechartseries.cpp"
180 #include "moc_qlinechartseries.cpp"
74
181
75 QTCOMMERCIALCHART_END_NAMESPACE
182 QTCOMMERCIALCHART_END_NAMESPACE
@@ -19,11 +19,13 public:
19 public: // from QChartSeries
19 public: // from QChartSeries
20 virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeLine;}
20 virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeLine;}
21 int add(qreal x, qreal y);
21 int add(qreal x, qreal y);
22 int add(const QPointF& point);
22 void set(int index,qreal x,qreal y);
23 void set(int index,qreal x,qreal y);
24 void set(int index,const QPointF& point);
23 void clear();
25 void clear();
24
26
25 void setPen(const QPen& pen);
27 void setPen(const QPen& pen);
26 const QPen& pen() const { return m_pen;}
28 QPen pen() const { return m_pen;}
27
29
28 void setPointsVisible(bool visible);
30 void setPointsVisible(bool visible);
29 bool isPointsVisible() const {return m_pointsVisible;}
31 bool isPointsVisible() const {return m_pointsVisible;}
@@ -2,6 +2,138
2
2
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4
4
5 /*!
6 \class QChartAxis
7 \brief The QChartAxis class is used for manipulating chart's axis
8 and for adding optional axes to the chart.
9 \mainclass
10
11 There is only one x Axis, however there can be multiple y axes.
12 Each chart series can be bound to exactly one Y axis and the share common X axis.
13 Axis can be setup to show axis line with ticks, gird lines and shades.
14
15 */
16
17 /*!
18 \fn bool QChartAxis::isAxisVisible() const
19 \brief Returns if axis is visible
20 \sa setAxisVisible()
21 */
22
23 /*!
24 \fn QPen QChartAxis::axisPen() const
25 \brief Returns pen used to draw axis and ticks.
26 \sa setAxisPen()
27 */
28
29
30 /*!
31 \fn bool QChartAxis::isGridVisible() const
32 \brief Returns if grid is visible
33 \sa setGridVisible()
34 */
35
36 /*!
37 \fn QPen QChartAxis::gridPen() const
38 \brief Returns pen used to draw grid.
39 \sa setGridPen()
40 */
41
42 /*!
43 \fn bool QChartAxis::isLabelsVisible() const
44 \brief Returns if grid is visible
45 \sa setLabelsVisible()
46 */
47
48 /*!
49 \fn QPen QChartAxis::labelsPen() const
50 \brief Returns the pen used to labels.
51 \sa setLabelsPen()
52 */
53
54 /*!
55 \fn QBrush QChartAxis::labelsBrush() const
56 \brief Returns brush used to draw labels.
57 \sa setLabelsBrush()
58 */
59
60 /*!
61 \fn QFont QChartAxis::labelsFont() const
62 \brief Returns font used to draw labels.
63 \sa setLabelsFont()
64 */
65
66 /*!
67 \fn QFont QChartAxis::labelsAngle() const
68 \brief Returns angle used to draw labels.
69 \sa setLabelsAngle()
70 */
71
72 /*!
73 \fn bool QChartAxis::isShadesVisible() const
74 \brief Returns if shades are visible.
75 \sa setShadesVisible()
76 */
77
78 /*!
79 \fn qreal QChartAxis::shadesOpacity() const
80 \brief Returns opacity of shades.
81 */
82
83 /*!
84 \fn QPen QChartAxis::shadesPen() const
85 \brief Returns pen used to draw shades.
86 \sa setShadesPen()
87 */
88
89 /*!
90 \fn QBrush QChartAxis::shadesBrush() const
91 \brief Returns brush used to draw shades.
92 \sa setShadesBrush()
93 */
94
95 /*!
96 \fn qreal QChartAxis::min() const
97 \brief Returns minimum value on the axis.
98 \sa setMin()
99 */
100
101 /*!
102 \fn qreal QChartAxis::max() const
103 \brief Returns maximim value on the axis.
104 \sa setMax()
105 */
106
107 /*!
108 \fn void QChartAxis::minChanged(qreal min)
109 \brief Axis emits signal when \a min of axis has changed.
110 */
111
112 /*!
113 \fn void QChartAxis::maxChanged(qreal max)
114 \brief Axis emits signal when \a max of axis has changed.
115 */
116 /*!
117 \fn int QChartAxis::ticksCount() const
118 \brief Return number of ticks on the axis
119 \sa setTicksCount()
120 */
121
122 /*!
123 \fn void QChartAxis::update(QChartAxis*)
124 \brief \internal
125 */
126
127 /*!
128 \fn void QChartAxis::ticksChanged(QChartAxis*)
129 \brief \internal
130 */
131
132 /*!
133 Constructs new axis object which is a child of \a parent. Ownership is taken by
134 QChatView or QChart when axis added.
135 */
136
5 QChartAxis::QChartAxis(QObject* parent):QObject(parent),
137 QChartAxis::QChartAxis(QObject* parent):QObject(parent),
6 m_axisVisible(true),
138 m_axisVisible(true),
7 m_gridVisible(true),
139 m_gridVisible(true),
@@ -16,88 +148,134 m_ticksCount(5)
16
148
17 }
149 }
18
150
151 /*!
152 Destructor of the axis object. When axis is added to chart, chart object takes ownership.
153 */
154
19 QChartAxis::~QChartAxis()
155 QChartAxis::~QChartAxis()
20 {
156 {
21 }
157 }
22
158
159 /*!
160 Sets \a pen used to draw axis line and ticks.
161 */
23 void QChartAxis::setAxisPen(const QPen& pen)
162 void QChartAxis::setAxisPen(const QPen& pen)
24 {
163 {
25 m_axisPen=pen;
164 m_axisPen=pen;
26 emit update(this);
165 emit update(this);
27 }
166 }
28
167
168 /*!
169 Sets if axis and ticks are \a visible.
170 */
29 void QChartAxis::setAxisVisible(bool visible)
171 void QChartAxis::setAxisVisible(bool visible)
30 {
172 {
31 m_axisVisible=visible;
173 m_axisVisible=visible;
32 emit update(this);
174 emit update(this);
33 }
175 }
34
176
177 /*!
178 Sets if grid is \a visible.
179 */
35 void QChartAxis::setGridVisible(bool visible)
180 void QChartAxis::setGridVisible(bool visible)
36 {
181 {
37 m_gridVisible=visible;
182 m_gridVisible=visible;
38 emit update(this);
183 emit update(this);
39 }
184 }
40
185
186 /*!
187 Sets \a pen used to draw grid.
188 */
41 void QChartAxis::setGridPen(const QPen& pen)
189 void QChartAxis::setGridPen(const QPen& pen)
42 {
190 {
43 m_gridPen=pen;
191 m_gridPen=pen;
44 emit update(this);
192 emit update(this);
45 }
193 }
46
194
195 /*!
196 Sets if axis' labels are \a visible.
197 */
47 void QChartAxis::setLabelsVisible(bool visible)
198 void QChartAxis::setLabelsVisible(bool visible)
48 {
199 {
49 m_labelsVisible=visible;
200 m_labelsVisible=visible;
50 emit update(this);
201 emit update(this);
51 }
202 }
52
203
204 /*!
205 Sets \a pen used to draw labels.
206 */
53 void QChartAxis::setLabelsPen(const QPen& pen)
207 void QChartAxis::setLabelsPen(const QPen& pen)
54 {
208 {
55 m_labelsPen=pen;
209 m_labelsPen=pen;
56 emit update(this);
210 emit update(this);
57 }
211 }
58
212
213 /*!
214 Sets \a brush used to draw labels.
215 */
59 void QChartAxis::setLabelsBrush(const QBrush& brush)
216 void QChartAxis::setLabelsBrush(const QBrush& brush)
60 {
217 {
61 m_labelsBrush=brush;
218 m_labelsBrush=brush;
62 emit update(this);
219 emit update(this);
63 }
220 }
64
221
222 /*!
223 Sets \a font used to draw labels.
224 */
65 void QChartAxis::setLabelsFont(const QFont& font)
225 void QChartAxis::setLabelsFont(const QFont& font)
66 {
226 {
67 m_labelsFont=font;
227 m_labelsFont=font;
68 emit update(this);
228 emit update(this);
69 }
229 }
70
230
231 /*!
232 Sets \a angle for all the labels on given axis.
233 */
71 void QChartAxis::setLabelsAngle(int angle)
234 void QChartAxis::setLabelsAngle(int angle)
72 {
235 {
73 m_labelsAngle=angle;
236 m_labelsAngle=angle;
74 emit update(this);
237 emit update(this);
75 }
238 }
76
239
240 /*!
241 Sets if shades are \a visible.
242 */
77 void QChartAxis::setShadesVisible(bool visible)
243 void QChartAxis::setShadesVisible(bool visible)
78 {
244 {
79 m_shadesVisible=visible;
245 m_shadesVisible=visible;
80 emit update(this);
246 emit update(this);
81 }
247 }
82
248
249 /*!
250 Sets \a pen used to draw shades.
251 */
83 void QChartAxis::setShadesPen(const QPen& pen)
252 void QChartAxis::setShadesPen(const QPen& pen)
84 {
253 {
85 m_shadesPen=pen;
254 m_shadesPen=pen;
86 emit update(this);
255 emit update(this);
87 }
256 }
88
257
258 /*!
259 Sets \a brush used to draw shades.
260 */
89 void QChartAxis::setShadesBrush(const QBrush& brush)
261 void QChartAxis::setShadesBrush(const QBrush& brush)
90 {
262 {
91 m_shadesBrush=brush;
263 m_shadesBrush=brush;
92 emit update(this);
264 emit update(this);
93 }
265 }
94
266
267 /*!
268 Sets \a opacity of the shades.
269 */
95 void QChartAxis::setShadesOpacity(qreal opacity)
270 void QChartAxis::setShadesOpacity(qreal opacity)
96 {
271 {
97 m_shadesOpacity=opacity;
272 m_shadesOpacity=opacity;
98 emit update(this);
273 emit update(this);
99 }
274 }
100
275
276 /*!
277 Sets \a min value on the axis.
278 */
101 void QChartAxis::setMin(qreal min)
279 void QChartAxis::setMin(qreal min)
102 {
280 {
103 if(m_min!=min){
281 if(m_min!=min){
@@ -106,6 +284,9 void QChartAxis::setMin(qreal min)
106 }
284 }
107 }
285 }
108
286
287 /*!
288 Sets \a max value on the axis.
289 */
109 void QChartAxis::setMax(qreal max)
290 void QChartAxis::setMax(qreal max)
110 {
291 {
111 if(m_max!=max){
292 if(m_max!=max){
@@ -114,35 +295,53 void QChartAxis::setMax(qreal max)
114 }
295 }
115 }
296 }
116
297
298 /*!
299 Sets range from \a min to \a max on the axis.
300 */
117 void QChartAxis::setRange(qreal min, qreal max)
301 void QChartAxis::setRange(qreal min, qreal max)
118 {
302 {
119 setMin(min);
303 setMin(min);
120 setMax(max);
304 setMax(max);
121 }
305 }
122
306
307 /*!
308 Sets \a count for ticks on the axis.
309 */
123 void QChartAxis::setTicksCount(int count)
310 void QChartAxis::setTicksCount(int count)
124 {
311 {
125 m_ticksCount=count;
312 m_ticksCount=count;
126 emit ticksChanged(this);
313 emit ticksChanged(this);
127 }
314 }
128
315
316 /*!
317 TODO: refactor me. Sets string \a label for \a value on the axis.
318 */
129 void QChartAxis::addAxisTickLabel(qreal value,const QString& label)
319 void QChartAxis::addAxisTickLabel(qreal value,const QString& label)
130 {
320 {
131 m_ticks.insert(value,label);
321 m_ticks.insert(value,label);
132 emit ticksChanged(this);
322 emit ticksChanged(this);
133 }
323 }
134
324
325 /*!
326 TODO: refactor me. Removes label for \a value on the axis.
327 */
135 void QChartAxis::removeAxisTickLabel(qreal value)
328 void QChartAxis::removeAxisTickLabel(qreal value)
136 {
329 {
137 m_ticks.remove(value);
330 m_ticks.remove(value);
138 emit ticksChanged(this);
331 emit ticksChanged(this);
139 }
332 }
140
333
334 /*!
335 TODO: refactor me. Returns label for \a value on the axis.
336 */
141 QString QChartAxis::axisTickLabel(qreal value) const
337 QString QChartAxis::axisTickLabel(qreal value) const
142 {
338 {
143 return m_ticks.value(value);
339 return m_ticks.value(value);
144 }
340 }
145
341
342 /*!
343 TODO: refactor me. Removes all the string labels for on the axis.
344 */
146 void QChartAxis::clearAxisTickLabels()
345 void QChartAxis::clearAxisTickLabels()
147 {
346 {
148 m_ticks.clear();
347 m_ticks.clear();
@@ -20,8 +20,6 public:
20 void setAxisVisible(bool visible);
20 void setAxisVisible(bool visible);
21 void setAxisPen(const QPen& pen);
21 void setAxisPen(const QPen& pen);
22 QPen axisPen() const { return m_axisPen;};
22 QPen axisPen() const { return m_axisPen;};
23 void setAxisBrush(const QBrush& brush);
24 QBrush axisBrush() const { return m_axisBrush;};
25
23
26 //grid handling
24 //grid handling
27 bool isGridVisible() const { return m_gridVisible;};
25 bool isGridVisible() const { return m_gridVisible;};
@@ -37,7 +35,7 public:
37 void setLabelsBrush(const QBrush& brush);
35 void setLabelsBrush(const QBrush& brush);
38 QBrush labelsBrush() const { return m_labelsBrush;}
36 QBrush labelsBrush() const { return m_labelsBrush;}
39 void setLabelsFont(const QFont& font);
37 void setLabelsFont(const QFont& font);
40 QFont labelFont() const { return m_labelsFont;}
38 QFont labelsFont() const { return m_labelsFont;}
41 void setLabelsAngle(int angle);
39 void setLabelsAngle(int angle);
42 int labelsAngle() const { return m_labelsAngle;};
40 int labelsAngle() const { return m_labelsAngle;};
43
41
@@ -27,23 +27,6
27 QChartSeries and other chart related objects like QChartAxis and QChartLegend. If you want to
27 QChartSeries and other chart related objects like QChartAxis and QChartLegend. If you want to
28 display a chart in your existing QGraphicsScene, you can use the QChart class instead.
28 display a chart in your existing QGraphicsScene, you can use the QChart class instead.
29
29
30 For example, to create a chart with line series using a widget based application:
31 \snippet ../example/chartview/main.cpp 1
32 \image chartview_example.jpg
33
34 Showing a few more series:
35 \snippet ../example/chartview/main.cpp 3
36 \image chartview_example_pie.jpg
37 \snippet ../example/chartview/main.cpp 4
38 \image chartview_example_scatter.jpg
39 \snippet ../example/chartview/main.cpp 5
40 \image chartview_example_bar.jpg
41
42 If you need to give a more professional touch to your chart you can switch to one of the
43 pre-defined themes:
44 \snippet ../example/chartview/main.cpp 2
45 \image chartview_example_theme.jpg
46
47 \sa QChart
30 \sa QChart
48 */
31 */
49
32
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed, binary diff hidden
NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now