Getting StackedColumnBar Value like 500/1000 (50%)

4 posts, 0 answers
  1. Jan
    Jan avatar
    18 posts
    Member since:
    Mar 2014

    Posted 25 Jul 2014 Link to this post

    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
  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 28 Jul 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jan
    Jan avatar
    18 posts
    Member since:
    Mar 2014

    Posted 30 Jul 2014 in reply to Danail Vasilev Link to this post

    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...
  5. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 30 Jul 2014 Link to this post

    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.

     
Back to Top