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

Local Databinding with Multiple series

1 Answer 104 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Cameron
Top achievements
Rank 1
Cameron asked on 17 Feb 2016, 05:56 PM

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) #")
    )
)

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 19 Feb 2016, 01:59 PM
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
Tags
Chart
Asked by
Cameron
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Share this question
or