This is a migrated thread and some comments may be shown as answers.

Need to display Grand Total on top of the Htmlchart stacked bars

14 Answers 226 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Moorthy
Top achievements
Rank 1
Moorthy asked on 26 Feb 2013, 10:12 PM
Hello,

I need to display Grand Total on top of the Htmlchart stacked bars in addition to each stacked bar item value but i do not know how to do that.

I tried to use DefaultLabelValue with "#STSUM"  but it is not avilable or i do not know how to use it.

Can you please help me with this?

I have attached the screen shot for the same.

Thanks,
Dhachina

14 Answers, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 27 Feb 2013, 01:50 PM
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:
  1. Hide the labels of all Series, except the last one.
  2. Create an additional column in your datasource that sums up other columns which are bound to other Series.
  3. Use the additional column from the datasource to populate labels for the last Series through ClientTemplates.
  4. 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:
  1. Create an additional Series.
  2. Create an additional column in your datasource that is populated with values close to 0 (i.e. 0.001)
  3. Databind the additional column to the new Series.
  4. 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.
  5. Use this column from the datasource to populate labels for the new Series through ClientTemplates.
  6. 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.


0
Moorthy
Top achievements
Rank 1
answered on 28 Feb 2013, 10:16 PM

Thank you so much for the alternate solutions.

Will this be fixed in next or near future releases?

Thanks,
Dhachina
0
Danail Vasilev
Telerik team
answered on 01 Mar 2013, 03:48 PM
Hello Dhachina,

This is not a bug in the control but rather a feature request. Actually you are the first one to ask about it, so if we receive other requests as well, our developers might consider its implementation in the future.

Kind regards,
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.
0
RBeco
Top achievements
Rank 1
answered on 22 Apr 2013, 12:48 PM
Hello,

We would like this feature as well. We have exactly the same situation where we want to display the grand total of the stacked bar.

Approach 1 is not feasible because in our case not every stacked bar (a column displaying data for a year) will have data for all the series and setting the visibility of the labels to false for every series but the last, will result in no label if one column doesn't happen to have any data for the last series 

Approach 2 is not feasible for exactly the disadvantages described here. It will clutter up the chart and possibly confuse the client to have an item in the legend that is not really an item.

We really hope you can add this.

Thanks in advance!

0
Danail Vasilev
Telerik team
answered on 24 Apr 2013, 12:48 PM
Hi All,

I have logged this idea as a feature request in our feedback portal here, so that you can monitor, comment or raise its priority by voting on it. If it gets enough votes we might consider its implementation for the future.

You can also find attached a modified version of one of the examples from my previous posts so that now it handles the described unexpected behaviors. Said shortly I have created an additional series with the following settings:
  • series items are set with insignificantly small values (e.g. 0.001)
  • the name property of the series is not specified, so that it is not visible in the legend
  • the color of the series matches the color of the plot area, so that the series items and the legend of the series are not visible
  • clienttemplates for the labels of this series is used in order to sum up the grand total and display it


Greetings,
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.
0
Newton
Top achievements
Rank 1
answered on 15 Sep 2014, 09:34 AM
Hi,

How do you do this in server side code?

Thanks 
0
Danail Vasilev
Telerik team
answered on 16 Sep 2014, 01:29 PM
Hello Newton,

Generally the same property and tag names used for the declarative creation can also be used for the programmatic creation of Telerik UI controls.

You can find an example of a RadHtmlChart programmatic creation in this online demo.

Regards,
Danail Vasilev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Mahmoud
Top achievements
Rank 1
answered on 24 Sep 2014, 11:02 AM
Hi Danail,
Actually, we are looking for this feature since a while, appreciate if you can confirm adding it to next release
0
Danail Vasilev
Telerik team
answered on 29 Sep 2014, 08:29 AM
Hello Mahmoud,

Generally we receive many requests about features, improvements and fixes regarding 80+ controls. Considering the fact that it is not physically possible to implement the numerous request for all of the controls we let our clients decide which are the most wanted features by voting on them. 

Currently, however, this feature has less votes than other ones and therefore it gets a lower priority. If it gets enough votes and then approval from our management it may be implemented for the future.

For the time being I can suggest that you vote on the feedback item and use the example from the Displaying Grand Total In Stacked Series Labels And Pie Series Legend KB article in order to achieve the desired effect.


Regards,
Danail Vasilev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Srinivas
Top achievements
Rank 1
answered on 09 Apr 2015, 08:54 PM
Does any of your recent releases like Q1 2015 have this feature added to the HTML Chart ?
0
Marin Bratanov
Telerik team
answered on 10 Apr 2015, 02:14 PM

Hello Srinivas,

As the feedback portal (http://feedback.telerik.com/Project/108/Feedback/Details/46952-add-grand-total-labels-for-stacked-column-and-bar-series) states - the feature is not yet implemented. Its status is Approved, meaning that we believe it is a good idea, but it is not Completed, which would mean it is already implemented.

For the time being, you should use the approach from the Knowldege Base article: http://www.telerik.com/support/kb/aspnet-ajax/chart-%28html5%29/details/displaying-grand-total-in-stacked-series-labels-and-pie-series-legend.

Regards,

Marin Bratanov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Licensing
Top achievements
Rank 1
answered on 07 Jan 2016, 03:31 PM

Hello,

 Has this feature been implemented?

0
Marin Bratanov
Telerik team
answered on 11 Jan 2016, 08:04 AM

Hello,

As the Feedback portal page states—this feature has not been implemented yet.

Regards,

Marin Bratanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Олег
Top achievements
Rank 1
answered on 28 Feb 2017, 11:55 AM

Hello, need a help.

When I create project like here http://www.telerik.com/support/kb/aspnet-ajax/chart-%28html5%29/details/displaying-grand-total-in-stacked-series-labels-and-pie-series-legend

expression like #=dataItem.Cat1Percent + dataItem.Cat2Percent + dataItem.Cat3Percent + dataItem.Cat4Percent...# calculates double values wrong.:
2.68+7.61+4.96+2.3+1.98+2.7+1.08+0.56+0.68+0.32+0.32 = 25.189999999999997
O my god, what can I do with it?

Tags
Chart (HTML5)
Asked by
Moorthy
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Moorthy
Top achievements
Rank 1
RBeco
Top achievements
Rank 1
Newton
Top achievements
Rank 1
Mahmoud
Top achievements
Rank 1
Srinivas
Top achievements
Rank 1
Marin Bratanov
Telerik team
Licensing
Top achievements
Rank 1
Олег
Top achievements
Rank 1
Share this question
or