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

Getting StackedColumnBar Value like 500/1000 (50%)

3 Answers 13 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Jan
Top achievements
Rank 1
Jan asked on 25 Jul 2014, 11:06 AM
Hello,

I'm trying to implement a (maybe unusual) absolute / relative value-based RadHtmlChart with Stacked Column Series.

As category, I'm using the departments of our company. For each Department, there exist three shifts. Per shift, there are three kinds of times.
So, in case of three departments, i.e.:
ColumnSeries 1:
    - Shift 1, Value 1, Department 1 - 3
ColumnSeries 2:
    - Shift 1, Value 2, Department 1 - 3
...and so on.

The problem now is: I want to display each (sub-)bar's amount of the total bar's count. But everything I try ends up on the problem
that only a column SERIES (multiple sub-bars), not a series ITEM is accessible neither by C# nor by Javascript. That means, only values of all three subbars as a series are accessible, not a subbar's value compared to the current bar in (I hope this is understandable ;-) ).

What I need is something like:

Chart.PlotArea.Department1.Shift1.Value1.Tooltip =  Chart.PlotArea.Department1.Shift1.Value1 + " / " + Sum([...].Value1 + [...].Value2 + [...].Value3);

It would be the best to know both absolute and relative values (500/1000, 50%), but beginning even one of the two values would be nice to get.

Thanks in advance,

Jan

3 Answers, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 28 Jul 2014, 12:18 PM
Hi Jan,

You can use templates in order to achieve the expected behavior from the tooltip/label. Please refer to Displaying Grand Total In Stacked Series Labels And Pie Series Legend KB article for details. The KB shows how to display grand total but you can use the same approach for calculating the portion of each item within a category.

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
Jan
Top achievements
Rank 1
answered on 30 Jul 2014, 05:59 AM
Hello Danail,

thank you for your quick answer. This is basically what I need, but I have some further questions:

Is it necessary to bind the Chart via DataFieldY? I'm using a more complex way to get my data and fill the Series (CodeBehind), so maybe there is another way to achieve the "#dataItem.Value1 + 2 + 3#" approach? As I think it is not possible to get the dataItem when binding the values programmatically...
0
Danail Vasilev
Telerik team
answered on 30 Jul 2014, 12:27 PM
Hi Jan,

When the chart is created programmatically it is not possible to access other items' values. Therefore I can suggest that instead of creating chart items programmatically create a data source programmatically and then bind it to the chart. This would let you access the dataItem object.

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.

 
Tags
Chart (HTML5)
Asked by
Jan
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Jan
Top achievements
Rank 1
Share this question
or