Hi Dhachina,
In the current version of RadControls it is not possible to display the grand total of the stacked Bar/Column Series. However, this effect can be achieved only if your HtmlChart is databound. You can find below two approaches:
Approach1:
- Hide the labels of all Series, except the last one.
- Create an additional column in your datasource that sums up other columns which are bound to other Series.
- Use the additional column from the datasource to populate labels for the last Series through ClientTemplates.
- Set the Position property of the labels of the last Series to OutsideEnd.
You can find an example in the attached archive:
- RadHtmlChart_ColumnSeries_Stacked_GrandTotal1.aspx
- RadHtmlChart_ColumnSeries_Stacked_GrandTotal1.aspx.cs
You can also have a look at the HtmlChart rendering
here.
Approach2:
If you want, however, to keep the labels of other Series as well, you can:
- Create an additional Series.
- Create an additional column in your datasource that is populated with values close to 0 (i.e. 0.001)
- Databind the additional column to the new Series.
- Create another column in your datasource that sums up other columns which are bound to other Series excluding the column with small values close to 0.
- Use this column from the datasource to populate labels for the new Series through ClientTemplates.
- Set the Position property of the labels of the new Series to OutsideEnd.
This approach has two disadvantages:
- The newly created Series will be slightly visible despite their small values.
- If your legend is visible the name of the newly created Series will figure there.
You can find an example in the attached archive:
- RadHtmlChart_ColumnSeries_Stacked_GrandTotal2.aspx
- RadHtmlChart_ColumnSeries_Stacked_GrandTotal2.aspx.cs
You can also have a look at the HtmlChart rendering
here.
All the best,
Danail Vasilev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their
blog feed now.