Creating dynamic chart on server side (conditions inside htmlhelper, razor view )

2 posts, 0 answers
  1. Raido Valgeväli
    Raido Valgeväli avatar
    26 posts
    Member since:
    May 2008

    Posted 28 May 2013 Link to this post


    I'm generating the graph dynamically based on loaded description and data.
    The (simplified) code as follows:
    <div class="chart-wrapper">
            .Series(series => {
                foreach (www.Models.ChartDataItem s in d.chart_items)
                    if (s.type == "area") {
                    if (s.type == "line")
    Is there a better (dynamic) way to set chart type without having the if/switch block?
    Besides Aggregate I have a lot of options to set for most (but not all) series. So I wouldn't need to copy the lines for every possible chart type. Is it possible in current solution to catch each series (created by e.g. .Area()) in a variable and conditionally set properties on it?
    Would the current approach to build a "very dynamic" chart in a View recommended? Is it possible build it completely in an Action instead?
    Yes, the question might be related to razor/htmlhelpers in general, still interested in recommended Kendo approach. Thanks.
  2. Hristo Germanov
    Hristo Germanov avatar
    703 posts

    Posted 30 May 2013 Link to this post

    Hi Raido,

    Unfortunately I can't give you better solution than yours. Please excuse us for the inconvenience.

    Hristo Germanov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top