##// END OF EJS Templates
Updated barchart documentation
sauimone -
r319:c54c34ca0b57
parent child
Show More
@@ -12,12 +12,14 int main(int argc, char *argv[])
12 12 QApplication a(argc, argv);
13 13 QMainWindow window;
14 14
15 //! [1]
15 16 QBarCategory *category = new QBarCategory;
16 17 *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
18 //! [1]
17 19
20 //! [2]
18 21 QBarChartSeries* series= new QBarChartSeries(category);
19 22
20 // We use custom set, which connects some signals. Could use QBarSet here if we don't need signals
21 23 QBarSet *set0 = new QBarSet("Bub");
22 24 QBarSet *set1 = new QBarSet("Bob");
23 25 QBarSet *set2 = new QBarSet("Guybrush");
@@ -36,9 +38,12 int main(int argc, char *argv[])
36 38 series->addBarSet(set2);
37 39 series->addBarSet(set3);
38 40 series->addBarSet(set4);
41 //! [2]
39 42
40 series->enableToolTip(true);
41 series->enableFloatingValues(true);
43 //! [3]
44 series->enableToolTip();
45 series->enableFloatingValues();
46 //! [3]
42 47
43 48 QChartView* chartView = new QChartView(&window);
44 49 chartView->addSeries(series);
@@ -46,7 +51,7 int main(int argc, char *argv[])
46 51 chartView->setChartTheme(QChart::ChartThemeIcy);
47 52
48 53 window.setCentralWidget(chartView);
49 window.resize(400, 300);
54 window.resize(600, 300);
50 55 window.show();
51 56
52 57 return a.exec();
@@ -16,6 +16,7 int main(int argc, char *argv[])
16 16 QBarCategory *category = new QBarCategory;
17 17 *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
18 18
19 //! [1]
19 20 QPercentBarChartSeries* series = new QPercentBarChartSeries(category);
20 21
21 22 QBarSet *set0 = new QBarSet("Bub");
@@ -36,9 +37,10 int main(int argc, char *argv[])
36 37 series->addBarSet(set2);
37 38 series->addBarSet(set3);
38 39 series->addBarSet(set4);
40 //! [1]
39 41
40 series->enableToolTip(true);
41 series->enableFloatingValues(true);
42 series->enableToolTip();
43 series->enableFloatingValues();
42 44
43 45 QChartView* chartView = new QChartView(&window);
44 46 chartView->addSeries(series);
@@ -12,6 +12,7 int main(int argc, char *argv[])
12 12 QApplication a(argc, argv);
13 13 QMainWindow window;
14 14
15 //! [1]
15 16 QBarCategory *category = new QBarCategory;
16 17 *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
17 18
@@ -36,8 +37,9 int main(int argc, char *argv[])
36 37 series->addBarSet(set3);
37 38 series->addBarSet(set4);
38 39
39 series->enableToolTip(true);
40 series->enableFloatingValues(true);
40 series->enableToolTip();
41 series->enableFloatingValues();
42 //! [1]
41 43
42 44 QChartView* chartView = new QChartView(&window);
43 45 chartView->addSeries(series);
@@ -11,6 +11,11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
11 11 creating a QBarCategory class and appending the labels of categories to it.
12 12 The QBarCategory is then given to bar chart series class.
13 13
14 \mainclass
15
16 Example on how to create a category:
17 \snippet ../example/barchart/main.cpp 1
18
14 19 \sa QBarChartSeries, QStackedBarChartSeries, QPercentBarChartSeries
15 20 */
16 21
@@ -15,6 +15,15 QTCOMMERCIALCHART_BEGIN_NAMESPACE
15 15 QBarSet data sets. QBarChartSeries groups the data from sets to categories, which are defined
16 16 by QBarCategory class.
17 17
18 \mainclass
19
20 Example on how to add sets to bar chart:
21 \snippet ../example/barchart/main.cpp 2
22
23
24 Example on how to enable tooltip and floating values:
25 \snippet ../example/barchart/main.cpp 3
26
18 27 \sa QBarCategory, QBarSet, QStackedBarChartSeries, QPercentBarChartSeries
19 28 */
20 29
@@ -25,28 +34,28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
25 34 */
26 35 /*!
27 36 \fn void QBarChartSeries::changed(int index)
28 \brief INTERNAL \a index
37 \brief \internal \a index
29 38 */
30 39 /*!
31 40 \fn void QBarChartSeries::floatingValuesEnabled(bool enabled)
32 \brief INTERNAL \a enabled
41 \brief \internal \a enabled
33 42 */
34 43 /*!
35 44 \fn void QBarChartSeries::toolTipEnabled(bool enabled)
36 \brief INTERNAL \a enabled
45 \brief \internal \a enabled
37 46 */
38 47 /*!
39 48 \fn void QBarChartSeries::separatorsEnabled(bool enabled)
40 \brief INTERNAL \a enabled
49 \brief \internal \a enabled
41 50 */
42 51 /*!
43 52 \fn void QBarChartSeries::showToolTip(QPoint pos, QString tip)
44 \brief INTERNAL \a pos \a tip
53 \brief \internal \a pos \a tip
45 54 */
46 55
47 56 /*!
48 57 Constructs empty QBarChartSeries. Parameter \a category defines the categories for chart.
49 QBarChartSeries is QObject which is a child of a\a parent.
58 QBarChartSeries is QObject which is a child of a \a parent.
50 59 */
51 60 QBarChartSeries::QBarChartSeries(QBarCategory *category, QObject *parent)
52 61 : QChartSeries(parent)
@@ -80,7 +89,9 int QBarChartSeries::countSets()
80 89
81 90 /*!
82 91 Simple iterator for set. Returns pointer to next set in series.
83 Returns first set, if \a getFirst is true. If series is empty, returns 0.
92 Returns first set, if parameter \a getFirst is true.
93 If series is empty, returns 0.
94 Returns 0 after last set.
84 95 */
85 96 QBarSet* QBarChartSeries::nextSet(bool getFirst)
86 97 {
@@ -106,7 +117,7 QList<QString> QBarChartSeries::legend()
106 117 }
107 118
108 119 /*!
109 INTERNAL \a category
120 \internal \a category
110 121 */
111 122 QString QBarChartSeries::label(int category)
112 123 {
@@ -164,7 +175,7 void QBarChartSeries::enableSeparators(bool enabled)
164 175 }
165 176
166 177 /*!
167 INTERNAL
178 \internal
168 179 */
169 180 int QBarChartSeries::countCategories()
170 181 {
@@ -172,7 +183,7 int QBarChartSeries::countCategories()
172 183 }
173 184
174 185 /*!
175 INTERNAL
186 \internal
176 187 */
177 188 qreal QBarChartSeries::min()
178 189 {
@@ -180,7 +191,7 qreal QBarChartSeries::min()
180 191 }
181 192
182 193 /*!
183 INTERNAL
194 \internal
184 195 */
185 196 qreal QBarChartSeries::max()
186 197 {
@@ -188,7 +199,7 qreal QBarChartSeries::max()
188 199 }
189 200
190 201 /*!
191 INTERNAL \a set \a category
202 \internal \a set \a category
192 203 */
193 204 qreal QBarChartSeries::valueAt(int set, int category)
194 205 {
@@ -196,7 +207,7 qreal QBarChartSeries::valueAt(int set, int category)
196 207 }
197 208
198 209 /*!
199 INTERNAL \a set \a category
210 \internal \a set \a category
200 211 */
201 212 qreal QBarChartSeries::percentageAt(int set, int category)
202 213 {
@@ -204,7 +215,7 qreal QBarChartSeries::percentageAt(int set, int category)
204 215 }
205 216
206 217 /*!
207 INTERNAL \a category
218 \internal \a category
208 219 */
209 220 qreal QBarChartSeries::categorySum(int category)
210 221 {
@@ -212,7 +223,7 qreal QBarChartSeries::categorySum(int category)
212 223 }
213 224
214 225 /*!
215 INTERNAL
226 \internal
216 227 */
217 228 qreal QBarChartSeries::maxCategorySum()
218 229 {
@@ -220,7 +231,7 qreal QBarChartSeries::maxCategorySum()
220 231 }
221 232
222 233 /*!
223 INTERNAL
234 \internal
224 235 */
225 236 BarChartModel& QBarChartSeries::model()
226 237 {
@@ -30,11 +30,11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 30 */
31 31 /*!
32 32 \fn void QBarSet::toggleFloatingValues()
33 \brief INTERNAL
33 \brief \internal
34 34 */
35 35 /*!
36 36 \fn void QBarSet::showToolTip(QPoint pos, QString tip)
37 \brief INTERNAL \a pos \a tip
37 \brief \internal \a pos \a tip
38 38 */
39 39
40 40
@@ -129,7 +129,7 const QBrush& QBarSet::brush() const
129 129 }
130 130
131 131 /*!
132 INTERNAL
132 \internal
133 133 */
134 134 void QBarSet::barClicked()
135 135 {
@@ -140,7 +140,7 void QBarSet::barClicked()
140 140 }
141 141
142 142 /*!
143 INTERNAL \a pos
143 \internal \a pos
144 144 */
145 145 void QBarSet::barHoverEntered(QPoint pos)
146 146 {
@@ -149,7 +149,7 void QBarSet::barHoverEntered(QPoint pos)
149 149 }
150 150
151 151 /*!
152 INTERNAL
152 \internal
153 153 */
154 154 void QBarSet::barHoverLeaved()
155 155 {
@@ -10,6 +10,11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 10 of all bars in category. One QPercentBarChartSeries can contain multible QBarSet data sets.
11 11 QBarChartSeries groups the data from sets to categories, which are defined by QBarCategory class.
12 12
13 \mainclass
14
15 Example on using QPercentBarChartSeries
16 \snippet ../example/percentbarchart/main.cpp 1
17
13 18 \sa QBarCategory, QBarSet, QStackedBarChartSeries, QBarChartSeries
14 19 */
15 20
@@ -21,7 +26,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
21 26
22 27 /*!
23 28 Constructs empty QPercentBarChartSeries. Parameter \a category defines the categories for chart.
24 QPercentBarChartSeries is QObject which is a child of a\a parent.
29 QPercentBarChartSeries is QObject which is a child of a \a parent.
25 30 */
26 31 QPercentBarChartSeries::QPercentBarChartSeries(QBarCategory *category, QObject *parent)
27 32 : QBarChartSeries(category, parent)
@@ -10,6 +10,11 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 10 stacked on top of each other. One QStackedBarChartSeries can contain multible QBarSet data sets.
11 11 QStackedBarChartSeries groups the data from sets to categories, which are defined by QBarCategory class.
12 12
13 \mainclass
14
15 Example on using QStackedBarChartSeries
16 \snippet ../example/stackedbarchart/main.cpp 1
17
13 18 \sa QBarCategory, QBarSet, QPercentBarChartSeries, QBarChartSeries
14 19 */
15 20
@@ -21,7 +26,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
21 26
22 27 /*!
23 28 Constructs empty QStackedBarChartSeries. Parameter \a category defines the categories for chart.
24 QStackedBarChartSeries is QObject which is a child of a\a parent.
29 QStackedBarChartSeries is QObject which is a child of a \a parent.
25 30 */
26 31 QStackedBarChartSeries::QStackedBarChartSeries(QBarCategory *category, QObject *parent)
27 32 : QBarChartSeries(category, parent)
General Comments 0
You need to be logged in to leave comments. Login now