##// END OF EJS Templates
horizontal barchart doc update
sauimone -
r1709:ced7cbe40d33
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,39
1 /*!
2 \example examples/horizontalbarchart
3 \title HorizontalBarChart Example
4 \subtitle
5
6 The example shows how to create a horizontal bar chart. HorizontalBarChart shows the data in sets as separate bars, which are grouped in categories.
7
8 \image examples_horizontalbarchart.png
9
10 Data that barchart visualizes, is defined by QBarSet instances. Here we create the sets and append data
11 to them.
12
13 \snippet ../examples/horizontalbarchart/main.cpp 1
14
15 We create the series and append the sets to it. The horizontalbarseries groups the data from sets to categories.
16 First value of each set are gropuped together at first category second value to second category and so on.
17
18 \snippet ../examples/horizontalbarchart/main.cpp 2
19
20 Then we create a chart and add the series to it.
21
22 \snippet ../examples/horizontalbarchart/main.cpp 3
23
24 We define the categories here and add them to QCategoriesAxis which we then set to be the x-axis of the chart.
25
26 \snippet ../examples/horizontalbarchart/main.cpp 4
27
28 And we also want to show the legend.
29
30 \snippet ../examples/horizontalbarchart/main.cpp 5
31
32 Finally we add the chart onto a view.
33
34 \snippet ../examples/horizontalbarchart/main.cpp 6
35
36 And it is ready to be shown in a window.
37
38 \snippet ../examples/horizontalbarchart/main.cpp 7
39 */
@@ -0,0 +1,17
1 /*!
2 \example examples/horizontalpercentbarchart
3 \title HorizontalPercentBarChart Example
4 \subtitle
5
6 The example shows how to create simple horizontal percent bar chart. Horizontal percent bar chart shows the data in set as percentage of
7 all sets, per category.
8
9 \image examples_horizontalpercentbarchart.png
10
11 Creating horizontal percent bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
12 horizontal percent bar chart, we use QHorizontalPercentBarSeries api instead of QBarSeries. Also, in the
13 \l {BarChart Example} {bar chart} we used nice numbers algorithm to make the y axis numbering look better. With
14 percent bar chart there is no need for that, because the maximum y-axis value is always 100.
15
16 \snippet ../examples/horizontalpercentbarchart/main.cpp 3
17 */
@@ -0,0 +1,15
1 /*!
2 \example examples/horizontalstackedbarchart
3 \title HorizontalStackedBarChart Example
4 \subtitle
5
6 The example shows how to create simple stacked horizontal bar chart. Stacked bar chart shows the data in sets as bars that are
7 stacked on top of each other. The stacking is done per category.
8
9 \image examples_horizontalstackedbarchart.png
10
11 Creating stacked horizontal bar chart is just like creating a regular \l {BarChart Example} {bar chart}, except that for a
12 stacked horizontal bar chart, we use QHorizontalStackedBarSeries api instead of QBarSeries.
13
14 \snippet ../examples/horizontalstackedbarchart/main.cpp 3
15 */
@@ -1,86 +1,89
1 1 /*!
2 2 \page classes.html
3 3 \title QtCommercial Charts API
4 4 \keyword All Classes
5 5
6 6 Charts API is build on top of Qt Graphics View Framework. Charts can be displayed as QGraphicsWidget using QChart class. However
7 7 there is also convenience class QChartView which is QWidget based. These lets quickly use QCharts as normal Qt widget.
8 8
9 9 Each chart type is represented by QAbstractSeries derived class. To create given chart type users have to use instance of related series class and add it to QChart instance.
10 10 \code
11 11 QLineSeries* series = new QLineSeries();
12 12 series->add(0, 6);
13 13 series->add(2, 4);
14 14 ...
15 15 chartView->chart()->addSeries(series);
16 16 chartView->chart()->createDefaultAxes();
17 17 \endcode
18 18
19 19 \raw HTML
20 20 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
21 21 <tr>
22 22 <th class="titleheader" width="25%">
23 23 Common and global
24 24 </th>
25 25 <th class="titleheader" width="25%">
26 26 XY chart
27 27 </th>
28 28 </tr>
29 29 <tr>
30 30 <td valign="top">
31 31 <ul>
32 32 <li><a href="qchart.html">QChart</a></li>
33 33 <li><a href="qchartview.html">QChartView</a></li>
34 34 <li><a href="qabstractaxis.html">QAbstractAxis</a></li>
35 35 <li><a href="qvaluesaxis.html">QValuesAxis</a></li>
36 36 <li><a href="qbarcategoriesaxis.html">QBarCategoriesAxis</a></li>
37 37 <li><a href="qlegend.html">QLegend</a></li>
38 38 <li><a href="qabstractseries.html">QAbstractSeries</a></li>
39 39 <li><a href="qchartglobal.html">QChartGlobal</a></li>
40 40 </ul>
41 41 </td>
42 42 <td valign="top">
43 43 <ul>
44 44 <li><a href="qxyseries.html">QXYSeries</a></li>
45 45 <li><a href="qlineseries.html">QLineSeries</a></li>
46 46 <li><a href="qareaseries.html">QAreaSeries</a></li>
47 47 <li><a href="qscatterseries.html">QScatterSeries</a></li>
48 48 <li><a href="qsplineseries.html">QSplineSeries</a></li>
49 49 <li><a href="qhxymodelmapper.html">QHXYModelMapper</a></li>
50 50 <li><a href="qvxymodelmapper.html">QVXYModelMapper</a></li>
51 51 </ul>
52 52 </td>
53 53 </tr>
54 54 </table>
55 55 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
56 56 <tr>
57 57 <th class="titleheader" width="25%">
58 58 Pie chart
59 59 </th>
60 60 <th class="titleheader" width="25%">
61 61 Bar chart
62 62 </th>
63 63 <tr>
64 64 <td valign="top">
65 65 <ul>
66 66 <li><a href="qpieseries.html">QPieSeries</a></li>
67 67 <li><a href="qpieslice.html">QPieSlice</a></li>
68 68 <li><a href="qhpiemodelmapper.html">QHPieModelMapper</a></li>
69 69 <li><a href="qvpiemodelmapper.html">QVPieModelMapper</a></li>
70 70 </ul>
71 71 </td>
72 72 <td valign="top">
73 73 <ul>
74 74 <li><a href="qbarseries.html">QBarSeries</a></li>
75 75 <li><a href="qbarset.html">QBarSet</a></li>
76 76 <li><a href="qpercentbarseries.html">QPercentBarSeries</a></li>
77 77 <li><a href="qstackedbarseries.html">QStackedBarSeries</a></li>
78 78 <li><a href="qhbarmodelmapper.html">QHBarModelMapper</a></li>
79 79 <li><a href="qvbarmodelmapper.html">QVBarModelMapper</a></li>
80 <li><a href="qhorizontalbarseries.html">QHorizontalBarSeries</a></li>
81 <li><a href="qhorizontalstackedbarseries.html">QHorizontalStackedBarSeries</a></li>
82 <li><a href="qhorizontalpercentbarseries.html">QHorizontalPercentBarSeries</a></li>
80 83 </ul>
81 84 </td>
82 85 </tr>
83 86 </table>
84 87 \endraw
85 88
86 89 */
@@ -1,39 +1,42
1 1 /*!
2 2 \page examples.html
3 3 \title Examples
4 4 \keyword Examples
5 5
6 6 \raw HTML
7 7 <table cellpadding="2" cellspacing="1" border="0" width="100%" class="indextable">
8 8 <tr>
9 9 <th class="titleheader" width="33%">
10 10 List of examples
11 11 </th>
12 12 </tr>
13 13 <tr>
14 14 <td valign="top">
15 15 <ul>
16 16 <li><a href="examples-areachart.html">Area chart</a></li>
17 17 <li><a href="examples-barchart.html">Bar chart</a></li>
18 18 <li><a href="examples-customchart.html">Custom chart</a></li>
19 <li><a href="examples-horizontalbarchart.html">Horizontal bar chart</a></li>
20 <li><a href="examples-horizontalstackedbarchart.html">Horizontal stacked bar chart</a></li>
21 <li><a href="examples-horizontalpercentbarchart.html">Horizontal percent bar chart</a></li>
19 22 <li><a href="examples-legend.html">Legend</a></li>
20 23 <li><a href="examples-linechart.html">Line chart</a></li>
21 24 <li><a href="examples-lineandbar.html">Line and barchart</a></li>
22 25 <li><a href="examples-modeldata.html">Model data</a></li>
23 26 <li><a href="examples-barmodelmapper.html">Bar chart from model</a></li>
24 27 <li><a href="examples-percentbarchart.html">Percent bar chart</a></li>
25 28 <li><a href="examples-piechart.html">Pie chart</a></li>
26 29 <li><a href="examples-piechartdrilldown.html">Pie chart drilldown</a></li>
27 30 <li><a href="examples-presenterchart.html">Presenter chart</a></li>
28 31 <li><a href="examples-scatterchart.html">Scatter chart</a></li>
29 32 <li><a href="examples-scatterinteractions.html">Scatter interactions</a></li>
30 33 <li><a href="examples-splinechart.html">Spline chart</a></li>
31 34 <li><a href="examples-stackedbarchart.html">Stacked bar chart</a></li>
32 35 <li><a href="examples-stackedbarchartdrilldown.html">Stacked bar chart drilldown</a></li>
33 36 <li><a href="examples-zoomlinechart.html">Zoom line</a></li>
34 37 </ul>
35 38 </td>
36 39 </tr>
37 40 </table>
38 41 \endraw
39 42 */
@@ -1,82 +1,111
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$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "qhorizontalbarseries.h"
22 22 #include "qhorizontalbarseries_p.h"
23 23 #include "horizontalbarchartitem_p.h"
24 24 #include "horizontalbaranimation_p.h"
25 25 #include "qbarcategoriesaxis.h"
26 26
27 27 #include "chartdataset_p.h"
28 28 #include "charttheme_p.h"
29 29
30 30
31 31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
32 32
33 /*!
34 \class QHorizontalBarSeries
35 \brief Series for creating horizontal bar chart
36 \mainclass
37
38 QHorizontalBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars
39 as groups, where bars in same category are grouped next to each other. QHorizontalBarSeries groups the data
40 from sets to categories, which are defined by a QStringList.
41
42 See the \l {HorizontalBarChart Example} {horizontal bar chart example} to learn how to create a horizontal bar chart.
43 \image examples_horizontalbarchart.png
44
45 \sa QBarSet, QBarSeries, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries, QHorizontalStackedBarSeries, QHorizontalPercentBarSeries
46 */
47 /*
48 // TODO:
49 \qmlclass Horizontal QHorizontalBarSeries
50 \inherits AbstractBarSeries
51
52 The following QML shows how to create a simple grouped bar chart:
53 \snippet ../demos/qmlchart/qml/qmlchart/View6.qml 1
54 \beginfloatleft
55 \image demos_qmlchart6.png
56 \endfloat
57 \clearfloat
58 */
59
60
61
33 62 QHorizontalBarSeries::QHorizontalBarSeries(QObject *parent) :
34 63 QAbstractBarSeries(*new QHorizontalBarSeriesPrivate(this), parent)
35 64 {
36 65 }
37 66
38 67 QAbstractSeries::SeriesType QHorizontalBarSeries::type() const
39 68 {
40 69 return QAbstractSeries::SeriesTypeHorizontalBar;
41 70 }
42 71
43 72 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
44 73
45 74 QHorizontalBarSeriesPrivate::QHorizontalBarSeriesPrivate(QHorizontalBarSeries *q) : QAbstractBarSeriesPrivate(q)
46 75 {
47 76
48 77 }
49 78
50 79 void QHorizontalBarSeriesPrivate::scaleDomain(Domain& domain)
51 80 {
52 81 qreal minX(domain.minX());
53 82 qreal minY(domain.minY());
54 83 qreal maxX(domain.maxX());
55 84 qreal maxY(domain.maxY());
56 85
57 86 qreal y = categoryCount();
58 87 qreal x = max();
59 88 minX = qMin(minX, x);
60 89 minY = qMin(minY, - (qreal)0.5);
61 90 maxX = qMax(maxX, x);
62 91 maxY = qMax(maxY, y - (qreal)0.5);
63 92
64 93 domain.setRange(minX,maxX,minY,maxY);
65 94 }
66 95
67 96 Chart* QHorizontalBarSeriesPrivate::createGraphics(ChartPresenter* presenter)
68 97 {
69 98 Q_Q(QHorizontalBarSeries);
70 99
71 100 HorizontalBarChartItem* bar = new HorizontalBarChartItem(q,presenter);
72 101 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
73 102 bar->setAnimator(presenter->animator());
74 103 bar->setAnimation(new HorizontalBarAnimation(bar));
75 104 }
76 105 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
77 106 return bar;
78 107 }
79 108
80 109 #include "moc_qhorizontalbarseries.cpp"
81 110
82 111 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,62 +1,61
1 1 #include "qhorizontalpercentbarseries.h"
2 2 #include "qhorizontalpercentbarseries_p.h"
3 3 #include "horizontalpercentbarchartitem_p.h"
4 4 #include "horizontalpercentbaranimation_p.h"
5 5
6 6 #include "chartdataset_p.h"
7 7 #include "charttheme_p.h"
8 8
9 9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 10
11 11 QHorizontalPercentBarSeries::QHorizontalPercentBarSeries(QObject *parent) :
12 12 QAbstractBarSeries(*new QHorizontalPercentBarSeriesPrivate(this), parent)
13 13 {
14 14 }
15 15
16 16 QAbstractSeries::SeriesType QHorizontalPercentBarSeries::type() const
17 17 {
18 18 return QAbstractSeries::SeriesTypeHorizontalPercentBar;
19 19 }
20 20
21 21
22 22
23 23 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
24 24
25 25 QHorizontalPercentBarSeriesPrivate::QHorizontalPercentBarSeriesPrivate(QHorizontalPercentBarSeries *q) : QAbstractBarSeriesPrivate(q)
26 26 {
27 27
28 28 }
29 29
30 30 void QHorizontalPercentBarSeriesPrivate::scaleDomain(Domain& domain)
31 31 {
32 32 qreal minX(domain.minX());
33 33 qreal minY(domain.minY());
34 34 qreal maxX(domain.maxX());
35 35 qreal maxY(domain.maxY());
36 36
37 37 qreal y = categoryCount();
38 38 minX = 0;
39 39 maxX = 100;
40 40 minY = qMin(minY, - (qreal)0.5);
41 41 maxY = qMax(maxY, y - (qreal)0.5);
42 42
43 43 domain.setRange(minX,maxX,minY,maxY);
44 44 }
45 45
46 46 Chart* QHorizontalPercentBarSeriesPrivate::createGraphics(ChartPresenter* presenter)
47 47 {
48 48 Q_Q(QHorizontalPercentBarSeries);
49 49
50 50 HorizontalPercentBarChartItem* bar = new HorizontalPercentBarChartItem(q,presenter);
51 51 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
52 52 bar->setAnimator(presenter->animator());
53 53 bar->setAnimation(new HorizontalPercentBarAnimation(bar));
54 54 }
55 55 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
56 56 return bar;
57 57 }
58 58
59
60 59 #include "moc_qhorizontalpercentbarseries.cpp"
61 60
62 61 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,101 +1,101
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$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 // W A R N I N G
22 22 // -------------
23 23 //
24 24 // This file is not part of the QtCommercial Chart API. It exists purely as an
25 25 // implementation detail. This header file may change from version to
26 26 // version without notice, or even be removed.
27 27 //
28 28 // We mean it.
29 29
30 30 #ifndef QABSTRACTBARSERIES_P_H
31 31 #define QABSTRACTBARSERIES_P_H
32 32
33 33 #include "qabstractbarseries.h"
34 34 #include "qabstractseries_p.h"
35 35 #include <QStringList>
36 36 #include <QAbstractSeries>
37 37
38 38 QTCOMMERCIALCHART_BEGIN_NAMESPACE
39 39
40 40 class QBarModelMapper;
41 41 class QBarCategoriesAxis;
42 42
43 43 class QAbstractBarSeriesPrivate : public QAbstractSeriesPrivate
44 44 {
45 45 Q_OBJECT
46 46 public:
47 47 QAbstractBarSeriesPrivate(QAbstractBarSeries *parent);
48 48 int categoryCount() const;
49 49
50 50 void setBarWidth(qreal width);
51 51 qreal barWidth() const;
52 52
53 53 void setVisible(bool visible);
54 54 void setLabelsVisible(bool visible);
55 55
56 56 void scaleDomain(Domain& domain);
57 57 Chart* createGraphics(ChartPresenter* presenter);
58 58 QList<LegendMarker*> createLegendMarker(QLegend* legend);
59 59
60 60 void initializeAxis(QAbstractAxis* axis);
61 QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
61 virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const;
62 62
63 63 bool append(QBarSet *set);
64 64 bool remove(QBarSet *set);
65 65 bool append(QList<QBarSet* > sets);
66 66 bool remove(QList<QBarSet* > sets);
67 67 bool insert(int index, QBarSet *set);
68 68
69 69 QBarSet* barsetAt(int index);
70 70 qreal min();
71 71 qreal max();
72 72 qreal valueAt(int set, int category);
73 73 qreal percentageAt(int set, int category);
74 74 qreal categorySum(int category);
75 75 qreal absoluteCategorySum(int category);
76 76 qreal maxCategorySum();
77 77 qreal minX();
78 78 qreal maxX();
79 79
80 80 Q_SIGNALS:
81 81 void clicked(int index, QBarSet *barset);
82 82 void updatedBars();
83 83 void restructuredBars();
84 84 void labelsVisibleChanged(bool visible);
85 85
86 86 private:
87 87 void populateCategories(QBarCategoriesAxis* axis);
88 88
89 89 protected:
90 90 QList<QBarSet *> m_barSets;
91 91 qreal m_barWidth;
92 92 bool m_labelsVisible;
93 93 bool m_visible;
94 94
95 95 private:
96 96 Q_DECLARE_PUBLIC(QAbstractBarSeries)
97 97 };
98 98
99 99 QTCOMMERCIALCHART_END_NAMESPACE
100 100
101 101 #endif // QABSTRACTBARSERIES_P_H
@@ -1,206 +1,209
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$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 #include "qabstractseries.h"
22 22 #include "qabstractseries_p.h"
23 23 #include "chartdataset_p.h"
24 24
25 25 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 26
27 27 /*!
28 28 \class QAbstractSeries
29 29 \brief Base class for all QtCommercial Chart series.
30 30 \mainclass
31 31
32 32 Usually you use the series type specific inherited classes instead of the base class.
33 33 \sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QStackedBarSeries,
34 34 QPercentBarSeries, QPieSeries
35 35 */
36 36 /*!
37 37 \qmlclass AbstractSeries
38 38 AbstractSeries is the base class for all series.
39 39 The class cannot be instantiated by the user.
40 40 */
41 41
42 42 /*!
43 43 \enum QAbstractSeries::SeriesType
44 44
45 45 The type of the series object.
46 46
47 47 \value SeriesTypeLine
48 48 \value SeriesTypeArea
49 49 \value SeriesTypeBar
50 50 \value SeriesTypeStackedBar
51 51 \value SeriesTypePercentBar
52 52 \value SeriesTypePie
53 53 \value SeriesTypeScatter
54 54 \value SeriesTypeSpline
55 \value SeriesTypeHorizontalBar
56 \value SeriesTypeHorizontalStackedBar
57 \value SeriesTypeHorizontalPercentBar
55 58 */
56 59
57 60 /*!
58 61 \property QAbstractSeries::type
59 62 The type of the series.
60 63 */
61 64 /*!
62 65 \qmlproperty ChartView.SeriesType AbstractSeries::type
63 66 The type of the series.
64 67 */
65 68
66 69 /*!
67 70 \property QAbstractSeries::name
68 71 \brief name of the series property. The name is shown in legend for QXYSeries.
69 72 */
70 73 /*!
71 74 \qmlproperty string AbstractSeries::name
72 75 Name of the series. The name is shown in legend for QXYSeries.
73 76 */
74 77
75 78 /*!
76 79 \fn void QAbstractSeries::nameChanged()
77 80 This signal is emitted when the series name changes.
78 81 */
79 82 /*!
80 83 \qmlsignal AbstractSeries::onNameChanged()
81 84 This signal is emitted when the series name changes.
82 85 */
83 86
84 87 /*!
85 88 \property QAbstractSeries::visible
86 89 \brief whether the series is visible or not; true by default.
87 90 */
88 91 /*!
89 92 \qmlproperty void AbstractSeries::visible
90 93 Visibility of the series. True by default.
91 94 */
92 95
93 96 /*!
94 97 \fn void QAbstractSeries::visibleChanged()
95 98 Emitted when the series visibility changes.
96 99 */
97 100 /*!
98 101 \qmlsignal AbstractSeries::onVisibleChanged()
99 102 Emitted when the series visibility changes.
100 103 */
101 104 /*!
102 105 \internal
103 106 \brief Constructs ChartSeries object with \a parent.
104 107 */
105 108 QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) :
106 109 QObject(parent),
107 110 d_ptr(&d)
108 111 {
109 112 }
110 113
111 114 /*!
112 115 \brief Virtual destructor for the chart series.
113 116 */
114 117 QAbstractSeries::~QAbstractSeries()
115 118 {
116 119 if(d_ptr->m_dataset) qFatal("Still binded series detected !");
117 120 }
118 121
119 122 void QAbstractSeries::setName(const QString& name)
120 123 {
121 124 if (name != d_ptr->m_name) {
122 125 d_ptr->m_name = name;
123 126 emit nameChanged();
124 127 }
125 128 }
126 129
127 130 QString QAbstractSeries::name() const
128 131 {
129 132 return d_ptr->m_name;
130 133 }
131 134
132 135 /*!
133 136 Sets the visibility of series to \a visible
134 137 */
135 138 void QAbstractSeries::setVisible(bool visible)
136 139 {
137 140 if (visible != d_ptr->m_visible) {
138 141 d_ptr->m_visible = visible;
139 142 emit visibleChanged();
140 143 }
141 144 }
142 145
143 146 /*!
144 147 Returns the visibility of series
145 148 */
146 149 bool QAbstractSeries::isVisible() const
147 150 {
148 151 return d_ptr->m_visible;
149 152 }
150 153
151 154 /*!
152 155 \brief Returns the chart where series belongs to.
153 156
154 157 Set automatically when the series is added to the chart
155 158 and unset when the series is removed from the chart.
156 159 */
157 160 QChart* QAbstractSeries::chart() const
158 161 {
159 162 return d_ptr->m_chart;
160 163 }
161 164
162 165 //void QAbstractSeries::adjustView()
163 166 //{
164 167 // //TODO:
165 168 //}
166 169
167 170 /*!
168 171 \brief Sets the visibility of the series to true
169 172
170 173 \sa setVisible(), isVisible()
171 174 */
172 175 void QAbstractSeries::show()
173 176 {
174 177 setVisible(true);
175 178 }
176 179
177 180 /*!
178 181 \brief Sets the visibility of the series to false
179 182
180 183 \sa setVisible(), isVisible()
181 184 */
182 185 void QAbstractSeries::hide()
183 186 {
184 187 setVisible(false);
185 188 }
186 189
187 190 ///////////////////////////////////////////////////////////////////////////////////////////////////
188 191
189 192 QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries* q):
190 193 q_ptr(q),
191 194 m_chart(0),
192 195 m_dataset(0),
193 196 m_visible(true)
194 197 {
195 198 }
196 199
197 200 QAbstractSeriesPrivate::~QAbstractSeriesPrivate()
198 201 {
199 202 }
200 203
201 204 #include "moc_qabstractseries.cpp"
202 205 #include "moc_qabstractseries_p.cpp"
203 206
204 207 QTCOMMERCIALCHART_END_NAMESPACE
205 208
206 209
General Comments 0
You need to be logged in to leave comments. Login now