##// END OF EJS Templates
minor documentation fixes for barchart
sauimone -
r396:b9c9fb13c5b7
parent child
Show More
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -1,76 +1,76
1 #include <QApplication>
1 #include <QApplication>
2 #include <QMainWindow>
2 #include <QMainWindow>
3 #include <qchartview.h>
3 #include <qchartview.h>
4 #include <qbarseries.h>
4 #include <qbarseries.h>
5 #include <qbarset.h>
5 #include <qbarset.h>
6 #include <qchartaxis.h>
6 #include <qchartaxis.h>
7 #include <QStringList>
7 #include <QStringList>
8
8
9 QTCOMMERCIALCHART_USE_NAMESPACE
9 QTCOMMERCIALCHART_USE_NAMESPACE
10
10
11 int main(int argc, char *argv[])
11 int main(int argc, char *argv[])
12 {
12 {
13 QApplication a(argc, argv);
13 QApplication a(argc, argv);
14 QMainWindow window;
14 QMainWindow window;
15
15
16 //! [1]
16 //! [1]
17 // Define categories
17 // Define categories
18 QStringList categories;
18 QStringList categories;
19 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
19 categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
20 //! [1]
20 //! [1]
21
21
22 //! [2]
22 //! [2]
23 // Create some test sets for chat
23 // Create some test sets for chat
24
24
25 QBarSet *set0 = new QBarSet("Bub");
25 QBarSet *set0 = new QBarSet("Bub");
26 QBarSet *set1 = new QBarSet("Bob");
26 QBarSet *set1 = new QBarSet("Bob");
27 QBarSet *set2 = new QBarSet("Guybrush");
27 QBarSet *set2 = new QBarSet("Guybrush");
28 QBarSet *set3 = new QBarSet("Larry");
28 QBarSet *set3 = new QBarSet("Larry");
29 QBarSet *set4 = new QBarSet("Zak");
29 QBarSet *set4 = new QBarSet("Zak");
30
30
31 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
31 *set0 << 1 << 2 << 3 << 4 << 5 << 6;
32 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
32 *set1 << 5 << 0 << 0 << 4 << 0 << 7;
33 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
33 *set2 << 3 << 5 << 8 << 13 << 8 << 5;
34 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
34 *set3 << 5 << 6 << 7 << 3 << 4 << 5;
35 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
35 *set4 << 9 << 7 << 5 << 3 << 1 << 2;
36 //! [2]
36 //! [2]
37
37
38 //! [3]
38 //! [3]
39 // Create series and add sets to it
39 // Create series and add sets to it
40 QBarSeries* series= new QBarSeries(categories);
40 QBarSeries* series= new QBarSeries(categories);
41
41
42 series->addBarSet(set0);
42 series->addBarSet(set0);
43 series->addBarSet(set1);
43 series->addBarSet(set1);
44 series->addBarSet(set2);
44 series->addBarSet(set2);
45 series->addBarSet(set3);
45 series->addBarSet(set3);
46 series->addBarSet(set4);
46 series->addBarSet(set4);
47 //! [3]
47 //! [3]
48
48
49 //! [4]
49 //! [4]
50 // Enable some features
50 // Enable some features
51 series->setToolTipEnabled();
51 series->setToolTipEnabled();
52 series->setFloatingValuesEnabled();
52 series->setFloatingValuesEnabled();
53 //! [4]
53 //! [4]
54
54
55 //! [5]
55 //! [5]
56 // Create view for chart and add series to it. Apply theme.
56 // Create view for chart and add series to it. Apply theme.
57
57
58 QChartView* chartView = new QChartView(&window);
58 QChartView* chartView = new QChartView(&window);
59 chartView->addSeries(series);
59 chartView->addSeries(series);
60 chartView->setChartTitle("simple stacked barchart");
60 chartView->setChartTitle("simple barchart");
61 chartView->setChartTheme(QChart::ChartThemeIcy);
61 chartView->setChartTheme(QChart::ChartThemeIcy);
62 //! [5]
62 //! [5]
63
63
64 //! [6]
64 //! [6]
65 chartView->axisX()->setAxisVisible(false);
65 chartView->axisX()->setAxisVisible(false);
66 chartView->axisX()->setGridVisible(false);
66 chartView->axisX()->setGridVisible(false);
67 chartView->axisX()->setLabelsVisible(false);
67 chartView->axisX()->setLabelsVisible(false);
68 //! [6]
68 //! [6]
69
69
70 window.setCentralWidget(chartView);
70 window.setCentralWidget(chartView);
71 window.resize(400, 300);
71 window.resize(400, 300);
72 window.show();
72 window.show();
73
73
74 return a.exec();
74 return a.exec();
75 }
75 }
76
76
@@ -1,57 +1,57
1 #include "qseries.h"
1 #include "qseries.h"
2
2
3 /*!
3 /*!
4 \class QSeries
4 \class QSeries
5 \brief Base class for all QtCommercial Chart series.
5 \brief Base class for all QtCommercial Chart series.
6 \mainclass
6 \mainclass
7
7
8 Usually you use the series type specific inherited classes instead of the base class.
8 Usually you use the series type specific inherited classes instead of the base class.
9 \sa QScatterSeries
9 \sa QScatterSeries
10 */
10 */
11
11
12 /*!
12 /*!
13 \enum QSeries::QSeriesType
13 \enum QSeries::QSeriesType
14
14
15 The type of the series object.
15 The type of the series object.
16
16
17 \value SeriesTypeLine
17 \value SeriesTypeLine
18 \value SeriesTypeArea
18 \value SeriesTypeArea
19 \value SeriesTypeBar
19 \value SeriesTypeBar
20 \value SeriesTypeStackedBar
20 \value SeriesTypeStackedBar
21 \value SeriesTypePercentBar
21 \value SeriesTypePercentBar
22 \value SeriesTypePie
22 \value SeriesTypePie
23 \value SeriesTypeScatter
23 \value SeriesTypeScatter
24 \value SeriesTypeSpline
24 \value SeriesTypeSpline
25 */
25 */
26
26
27 /*!
27 /*!
28 \fn QSeries::QSeries(QObject *parent)
28 \fn QSeries::QSeries(QObject *parent)
29 \brief Constructs ChartSeries object with \a parent.
29 \brief Constructs ChartSeries object with \a parent.
30 */
30 */
31
31
32 /*!
32 /*!
33 \fn QSeries::~QSeries()
33 \fn QSeries::~QSeries()
34 \brief Virtual destructor for the chart series.
34 \brief Virtual destructor for the chart series.
35 */
35 */
36
36
37 /*!
37 /*!
38 \fn QSeriesType QSeries::type() const
38 \fn QSeriesType QSeries::type() const
39 \brief The type of the series.
39 \brief The type of the series.
40 */
40 */
41
41
42 /*!
42 /*!
43 \fn bool QSeries::setModel(QAbstractItemModel *model)
43 \fn bool QSeries::setModel(QAbstractItemModel *model)
44 \brief Use the \a model to provide data for the series. The model overrides possible user data
44 \brief Use the \a model to provide data for the series. The model overrides possible user data
45 set with QChartSeries type specific data setters. For example if you call both
45 set with QChartSeries type specific data setters. For example if you call both
46 QScatterSeries::addData() and QScatterSeries::setModel, only the data provided by the model is
46 QScatterSeries::addData() and QScatterSeries::setModel, only the data provided by the model is
47 used by the series. Returns true if the model is valid for the series.
47 used by the series. Returns true if the model is valid for the series.
48 */
48 */
49
49
50 /*!
50 /*!
51 \fn QList<QSeries::Legend> legend()
51 \fn QList<QSeries::Legend> QSeries::legend()
52 \brief Returns the legend of the series. If series is empty, empty list is returned.
52 \brief Returns the legend of the series. If series is empty, empty list is returned.
53 */
53 */
54
54
55 QTCOMMERCIALCHART_BEGIN_NAMESPACE
55 QTCOMMERCIALCHART_BEGIN_NAMESPACE
56 #include "moc_qseries.cpp"
56 #include "moc_qseries.cpp"
57 QTCOMMERCIALCHART_END_NAMESPACE
57 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now