From c54c34ca0b5783f9d788fb9fc4b3bb935c3d0bab 2012-02-24 13:52:57 From: sauimone Date: 2012-02-24 13:52:57 Subject: [PATCH] Updated barchart documentation --- diff --git a/example/barchart/main.cpp b/example/barchart/main.cpp index 9cbf30d..0397b69 100644 --- a/example/barchart/main.cpp +++ b/example/barchart/main.cpp @@ -12,12 +12,14 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); QMainWindow window; + //! [1] QBarCategory *category = new QBarCategory; *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; + //! [1] + //! [2] QBarChartSeries* series= new QBarChartSeries(category); - // We use custom set, which connects some signals. Could use QBarSet here if we don't need signals QBarSet *set0 = new QBarSet("Bub"); QBarSet *set1 = new QBarSet("Bob"); QBarSet *set2 = new QBarSet("Guybrush"); @@ -36,9 +38,12 @@ int main(int argc, char *argv[]) series->addBarSet(set2); series->addBarSet(set3); series->addBarSet(set4); + //! [2] - series->enableToolTip(true); - series->enableFloatingValues(true); + //! [3] + series->enableToolTip(); + series->enableFloatingValues(); + //! [3] QChartView* chartView = new QChartView(&window); chartView->addSeries(series); @@ -46,7 +51,7 @@ int main(int argc, char *argv[]) chartView->setChartTheme(QChart::ChartThemeIcy); window.setCentralWidget(chartView); - window.resize(400, 300); + window.resize(600, 300); window.show(); return a.exec(); diff --git a/example/percentbarchart/main.cpp b/example/percentbarchart/main.cpp index 7680b89..5dd7966 100644 --- a/example/percentbarchart/main.cpp +++ b/example/percentbarchart/main.cpp @@ -16,6 +16,7 @@ int main(int argc, char *argv[]) QBarCategory *category = new QBarCategory; *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; + //! [1] QPercentBarChartSeries* series = new QPercentBarChartSeries(category); QBarSet *set0 = new QBarSet("Bub"); @@ -36,9 +37,10 @@ int main(int argc, char *argv[]) series->addBarSet(set2); series->addBarSet(set3); series->addBarSet(set4); + //! [1] - series->enableToolTip(true); - series->enableFloatingValues(true); + series->enableToolTip(); + series->enableFloatingValues(); QChartView* chartView = new QChartView(&window); chartView->addSeries(series); diff --git a/example/stackedbarchart/main.cpp b/example/stackedbarchart/main.cpp index 39ceaef..9012f4f 100644 --- a/example/stackedbarchart/main.cpp +++ b/example/stackedbarchart/main.cpp @@ -12,6 +12,7 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); QMainWindow window; + //! [1] QBarCategory *category = new QBarCategory; *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; @@ -36,8 +37,9 @@ int main(int argc, char *argv[]) series->addBarSet(set3); series->addBarSet(set4); - series->enableToolTip(true); - series->enableFloatingValues(true); + series->enableToolTip(); + series->enableFloatingValues(); + //! [1] QChartView* chartView = new QChartView(&window); chartView->addSeries(series); diff --git a/src/barchart/qbarcategory.cpp b/src/barchart/qbarcategory.cpp index ef1cc21..d2195fa 100644 --- a/src/barchart/qbarcategory.cpp +++ b/src/barchart/qbarcategory.cpp @@ -11,6 +11,11 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE creating a QBarCategory class and appending the labels of categories to it. The QBarCategory is then given to bar chart series class. + \mainclass + + Example on how to create a category: + \snippet ../example/barchart/main.cpp 1 + \sa QBarChartSeries, QStackedBarChartSeries, QPercentBarChartSeries */ diff --git a/src/barchart/qbarchartseries.cpp b/src/barchart/qbarchartseries.cpp index a4a0d49..f9fe16b 100644 --- a/src/barchart/qbarchartseries.cpp +++ b/src/barchart/qbarchartseries.cpp @@ -15,6 +15,15 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE QBarSet data sets. QBarChartSeries groups the data from sets to categories, which are defined by QBarCategory class. + \mainclass + + Example on how to add sets to bar chart: + \snippet ../example/barchart/main.cpp 2 + + + Example on how to enable tooltip and floating values: + \snippet ../example/barchart/main.cpp 3 + \sa QBarCategory, QBarSet, QStackedBarChartSeries, QPercentBarChartSeries */ @@ -25,28 +34,28 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! \fn void QBarChartSeries::changed(int index) - \brief INTERNAL \a index + \brief \internal \a index */ /*! \fn void QBarChartSeries::floatingValuesEnabled(bool enabled) - \brief INTERNAL \a enabled + \brief \internal \a enabled */ /*! \fn void QBarChartSeries::toolTipEnabled(bool enabled) - \brief INTERNAL \a enabled + \brief \internal \a enabled */ /*! \fn void QBarChartSeries::separatorsEnabled(bool enabled) - \brief INTERNAL \a enabled + \brief \internal \a enabled */ /*! \fn void QBarChartSeries::showToolTip(QPoint pos, QString tip) - \brief INTERNAL \a pos \a tip + \brief \internal \a pos \a tip */ /*! Constructs empty QBarChartSeries. Parameter \a category defines the categories for chart. - QBarChartSeries is QObject which is a child of a\a parent. + QBarChartSeries is QObject which is a child of a \a parent. */ QBarChartSeries::QBarChartSeries(QBarCategory *category, QObject *parent) : QChartSeries(parent) @@ -80,7 +89,9 @@ int QBarChartSeries::countSets() /*! Simple iterator for set. Returns pointer to next set in series. - Returns first set, if \a getFirst is true. If series is empty, returns 0. + Returns first set, if parameter \a getFirst is true. + If series is empty, returns 0. + Returns 0 after last set. */ QBarSet* QBarChartSeries::nextSet(bool getFirst) { @@ -106,7 +117,7 @@ QList QBarChartSeries::legend() } /*! - INTERNAL \a category + \internal \a category */ QString QBarChartSeries::label(int category) { @@ -164,7 +175,7 @@ void QBarChartSeries::enableSeparators(bool enabled) } /*! - INTERNAL + \internal */ int QBarChartSeries::countCategories() { @@ -172,7 +183,7 @@ int QBarChartSeries::countCategories() } /*! - INTERNAL + \internal */ qreal QBarChartSeries::min() { @@ -180,7 +191,7 @@ qreal QBarChartSeries::min() } /*! - INTERNAL + \internal */ qreal QBarChartSeries::max() { @@ -188,7 +199,7 @@ qreal QBarChartSeries::max() } /*! - INTERNAL \a set \a category + \internal \a set \a category */ qreal QBarChartSeries::valueAt(int set, int category) { @@ -196,7 +207,7 @@ qreal QBarChartSeries::valueAt(int set, int category) } /*! - INTERNAL \a set \a category + \internal \a set \a category */ qreal QBarChartSeries::percentageAt(int set, int category) { @@ -204,7 +215,7 @@ qreal QBarChartSeries::percentageAt(int set, int category) } /*! - INTERNAL \a category + \internal \a category */ qreal QBarChartSeries::categorySum(int category) { @@ -212,7 +223,7 @@ qreal QBarChartSeries::categorySum(int category) } /*! - INTERNAL + \internal */ qreal QBarChartSeries::maxCategorySum() { @@ -220,7 +231,7 @@ qreal QBarChartSeries::maxCategorySum() } /*! - INTERNAL + \internal */ BarChartModel& QBarChartSeries::model() { diff --git a/src/barchart/qbarset.cpp b/src/barchart/qbarset.cpp index b347503..b934773 100644 --- a/src/barchart/qbarset.cpp +++ b/src/barchart/qbarset.cpp @@ -30,11 +30,11 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! \fn void QBarSet::toggleFloatingValues() - \brief INTERNAL + \brief \internal */ /*! \fn void QBarSet::showToolTip(QPoint pos, QString tip) - \brief INTERNAL \a pos \a tip + \brief \internal \a pos \a tip */ @@ -129,7 +129,7 @@ const QBrush& QBarSet::brush() const } /*! - INTERNAL + \internal */ void QBarSet::barClicked() { @@ -140,7 +140,7 @@ void QBarSet::barClicked() } /*! - INTERNAL \a pos + \internal \a pos */ void QBarSet::barHoverEntered(QPoint pos) { @@ -149,7 +149,7 @@ void QBarSet::barHoverEntered(QPoint pos) } /*! - INTERNAL + \internal */ void QBarSet::barHoverLeaved() { diff --git a/src/barchart/qpercentbarchartseries.cpp b/src/barchart/qpercentbarchartseries.cpp index 5982882..b8d6a61 100644 --- a/src/barchart/qpercentbarchartseries.cpp +++ b/src/barchart/qpercentbarchartseries.cpp @@ -10,6 +10,11 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE of all bars in category. One QPercentBarChartSeries can contain multible QBarSet data sets. QBarChartSeries groups the data from sets to categories, which are defined by QBarCategory class. + \mainclass + + Example on using QPercentBarChartSeries + \snippet ../example/percentbarchart/main.cpp 1 + \sa QBarCategory, QBarSet, QStackedBarChartSeries, QBarChartSeries */ @@ -21,7 +26,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE /*! Constructs empty QPercentBarChartSeries. Parameter \a category defines the categories for chart. - QPercentBarChartSeries is QObject which is a child of a\a parent. + QPercentBarChartSeries is QObject which is a child of a \a parent. */ QPercentBarChartSeries::QPercentBarChartSeries(QBarCategory *category, QObject *parent) : QBarChartSeries(category, parent) diff --git a/src/barchart/qstackedbarchartseries.cpp b/src/barchart/qstackedbarchartseries.cpp index 2044b34..a7534a0 100644 --- a/src/barchart/qstackedbarchartseries.cpp +++ b/src/barchart/qstackedbarchartseries.cpp @@ -10,6 +10,11 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE stacked on top of each other. One QStackedBarChartSeries can contain multible QBarSet data sets. QStackedBarChartSeries groups the data from sets to categories, which are defined by QBarCategory class. + \mainclass + + Example on using QStackedBarChartSeries + \snippet ../example/stackedbarchart/main.cpp 1 + \sa QBarCategory, QBarSet, QPercentBarChartSeries, QBarChartSeries */ @@ -21,7 +26,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE /*! Constructs empty QStackedBarChartSeries. Parameter \a category defines the categories for chart. - QStackedBarChartSeries is QObject which is a child of a\a parent. + QStackedBarChartSeries is QObject which is a child of a \a parent. */ QStackedBarChartSeries::QStackedBarChartSeries(QBarCategory *category, QObject *parent) : QBarChartSeries(category, parent)