diff --git a/doc/src/example-barchart.qdoc b/doc/src/example-barchart.qdoc index 2c72a94..51b8b9d 100644 --- a/doc/src/example-barchart.qdoc +++ b/doc/src/example-barchart.qdoc @@ -1,5 +1,5 @@ /*! - \example example/barchart + \example examples/barchart \title BarChart Example \subtitle @@ -9,31 +9,31 @@ First we define categories. - \snippet ../example/barchart/main.cpp 1 + \snippet ../examples/barchart/main.cpp 1 Data that barchart visualizes, is defined by QBarSet instances. Here we create some sets and append data we want to visulaize to them. - \snippet ../example/barchart/main.cpp 2 + \snippet ../examples/barchart/main.cpp 2 To combine the sets and categories to a chart, we need to create QBarSeries instance. When creating the QBarSeries, the categories must be known. Sets can be added later. For example purposes the sets are added to series here. - \snippet ../example/barchart/main.cpp 3 + \snippet ../examples/barchart/main.cpp 3 We want our barchart to behave so, that when mouse is hovered over bar, the name of set which the bar represents is shown as tooltip. Also when we click the bar, floating values for the set are toggled. Floating values are the data values that are drawn on top of bars. - \snippet ../example/barchart/main.cpp 4 + \snippet ../examples/barchart/main.cpp 4 Here we create the view and add our series to it. Also we set the title and theme we want our chart to use - \snippet ../example/barchart/main.cpp 5 + \snippet ../examples/barchart/main.cpp 5 For barchart, we don't need X-axis to be visible, so it can be disabled. - \snippet ../example/barchart/main.cpp 6 + \snippet ../examples/barchart/main.cpp 6 */ \ No newline at end of file diff --git a/doc/src/example-percentbarchart.qdoc b/doc/src/example-percentbarchart.qdoc index b2e784b..7244b58 100644 --- a/doc/src/example-percentbarchart.qdoc +++ b/doc/src/example-percentbarchart.qdoc @@ -1,5 +1,5 @@ /*! - \example example/percentbarchart + \example examples/percentbarchart \title PercentBarChart Example \subtitle @@ -9,31 +9,31 @@ First we define categories. - \snippet ../example/percentbarchart/main.cpp 1 + \snippet ../examples/percentbarchart/main.cpp 1 Data that barchart visualizes, is defined by QBarSet instances. Here we create some sets and append data we want to visulaize to them. - \snippet ../example/percentbarchart/main.cpp 2 + \snippet ../examples/percentbarchart/main.cpp 2 To combine the sets and categories to a chart, we need to create QBarSeries instance. When creating the QBarSeries, the categories must be known. Sets can be added later. For example purposes the sets are added to series here. - \snippet ../example/percentbarchart/main.cpp 3 + \snippet ../examples/percentbarchart/main.cpp 3 We want our barchart to behave so, that when mouse is hovered over bar, the name of set which the bar represents is shown as tooltip. Also when we click the bar, floating values for the set are toggled. Floating values are the data values that are drawn on top of bars. - \snippet ../example/percentbarchart/main.cpp 4 + \snippet ../examples/percentbarchart/main.cpp 4 Here we create the view and add our series to it. Also we set the title and theme we want our chart to use - \snippet ../example/percentbarchart/main.cpp 5 + \snippet ../examples/percentbarchart/main.cpp 5 For barchart, we don't need X-axis to be visible, so it can be disabled. - \snippet ../example/percentbarchart/main.cpp 6 + \snippet ../examples/percentbarchart/main.cpp 6 */ \ No newline at end of file diff --git a/doc/src/example-stackedbarchart-drilldown.qdoc b/doc/src/example-stackedbarchart-drilldown.qdoc index 2f0260b..e5402b7 100644 --- a/doc/src/example-stackedbarchart-drilldown.qdoc +++ b/doc/src/example-stackedbarchart-drilldown.qdoc @@ -1,5 +1,5 @@ /*! - \example example/stackedbarchartdrilldown + \example examples/stackedbarchartdrilldown \title StackedBarChart Drilldown Example \subtitle @@ -14,29 +14,29 @@ Here we define a drilldown series, which adds mapping for categories to other drilldown series. Purpose of drilldown series is to contain knowledge of the drilldown structure. The mapDrilldownSeries function maps the category to given series. We can ask the mapping for category with drilldownSeries(QString category) function. - \snippet ../example/stackedbarchartdrilldown/main.cpp 1 + \snippet ../examples/stackedbarchartdrilldown/main.cpp 1 To enable drilldown we create own view, which implements handler for right click. All QBarSeries derived classes send out rightClicked(QBarSet*, QString) signal when series is clicked with right mouse button. The parameters QBarSet and QString contain the pointer to clicked bar set and name of category, where click occured. In our DrilldownChart we implement handler, which selects the drilldown chart with the category. - \snippet ../example/stackedbarchartdrilldown/main.cpp 2 + \snippet ../examples/stackedbarchartdrilldown/main.cpp 2 Here we define data, which we use to construct the chart. - \snippet ../example/stackedbarchartdrilldown/main.cpp 3 + \snippet ../examples/stackedbarchartdrilldown/main.cpp 3 To create the drilldown structure, we first create our top level series, which we call seasonSeries. For each month in seasonSeries we create a drilldown series, called weeklySeries which contains more detailed data for that month. In weeklySeries, we use the drilldown handler to bring us back to seasonSeries. To do this we add mapping to the series. The seasonSeries is mapped to weeklySeries for each month. Every weeklySeries is mapped back to the seasonSeries. To make mapping work, we connect the rightClicked signals from our series to the drilldownChart. - \snippet ../example/stackedbarchartdrilldown/main.cpp 4 + \snippet ../examples/stackedbarchartdrilldown/main.cpp 4 When we have our drilldown structure ready, we can add the data to it. Here we generate random crop for each plant in each week. The monthly crop is calculated from weekly crops. To enable floating values, we connect the clicked signal to toggle the value of corresponding set. - \snippet ../example/stackedbarchartdrilldown/main.cpp 5 + \snippet ../examples/stackedbarchartdrilldown/main.cpp 5 Here we set the chart to show top level series initially. - \snippet ../example/stackedbarchartdrilldown/main.cpp 6 + \snippet ../examples/stackedbarchartdrilldown/main.cpp 6 */ \ No newline at end of file diff --git a/doc/src/example-stackedbarchart.qdoc b/doc/src/example-stackedbarchart.qdoc index 9b61eb7..9055c6e 100644 --- a/doc/src/example-stackedbarchart.qdoc +++ b/doc/src/example-stackedbarchart.qdoc @@ -9,31 +9,31 @@ First we define categories. - \snippet ../example/stackedbarchart/main.cpp 1 + \snippet ../examples/stackedbarchart/main.cpp 1 Data that barchart visualizes, is defined by QBarSet instances. Here we create some sets and append data we want to visulaize to them. - \snippet ../example/stackedbarchart/main.cpp 2 + \snippet ../examples/stackedbarchart/main.cpp 2 To combine the sets and categories to a chart, we need to create QBarSeries instance. When creating the QBarSeries, the categories must be known. Sets can be added later. For example purposes the sets are added to series here. - \snippet ../example/stackedbarchart/main.cpp 3 + \snippet ../examples/stackedbarchart/main.cpp 3 We want our barchart to behave so, that when mouse is hovered over bar, the name of set which the bar represents is shown as tooltip. Also when we click the bar, floating values for the set are toggled. Floating values are the data values that are drawn on top of bars. - \snippet ../example/stackedbarchart/main.cpp 4 + \snippet ../examples/stackedbarchart/main.cpp 4 Here we create the view and add our series to it. Also we set the title and theme we want our chart to use - \snippet ../example/stackedbarchart/main.cpp 5 + \snippet ../examples/stackedbarchart/main.cpp 5 For barchart, we don't need X-axis to be visible, so it can be disabled. - \snippet ../example/stackedbarchart/main.cpp 6 + \snippet ../examples/stackedbarchart/main.cpp 6 */ \ No newline at end of file diff --git a/src/barchart/qbarset.cpp b/src/barchart/qbarset.cpp index 803c2e6..ec7da1d 100644 --- a/src/barchart/qbarset.cpp +++ b/src/barchart/qbarset.cpp @@ -109,6 +109,9 @@ void QBarSet::setValue(int index, qreal value) mValues.replace(index,value); } +/*! + Returns total sum of all values in barset. +*/ qreal QBarSet::total() { qreal total(0); @@ -118,7 +121,6 @@ qreal QBarSet::total() return total; } - /*! Sets pen for set. Bars of this set are drawn using \a pen */