Local Databinding with Multiple series

2 posts, 0 answers
  1. Cameron
    Cameron avatar
    2 posts
    Member since:
    May 2015

    Posted 17 Feb Link to this post

    Hey there,

    I'm currently using MVC, and have a view model that contains two Enumerables, each one representing a different series for use in the Donut Chart.

    Normally, with a single enumerable, I would use the code below to bind the series.  

    In my case the view model has two enumerables, Model.Series1 and Model.Series2.  How would I go about modifying this code to accommodate the two series?

    @(Html.Kendo().Chart(Model)
        .Name("chart")
        .Title("Single Series")
        .Legend(legend => legend
            .Position(ChartLegendPosition.Bottom)
        )
        .Series(series =>
        {
            series.Donut(
                model => model.Value,  // The data to use
                model => model.Category, // The category Name
                model => model.Color, // The color to use for the category
                null // How far out the donut section should pop out
            );
     
        })
        .Tooltip(tooltip => tooltip
            .Visible(true)
            .Template("#= category # - #= kendo.format('{0:P}', percentage) #")
        )
    )

  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 19 Feb Link to this post

    Hi Cameron,

    You could define multiple series in Kendo UI Donut Chart in the following way:
    .Series(series => {
       series.Donut(
           model => model.Value,  // The data to use
           model => model.Category, // The category Name
           model => model.Color, // The color to use for the category
           null // How far out the donut section should pop out
       );
       series.Donut(
           model => model.Percentage,
           model => model.Source
       );
    })
     

    Regards,
    Iliana Nikolova
    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
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top