Kendu Donut asp.net core Group and Aggregate

1 Answer 56 Views
Chart
Dave
Top achievements
Rank 1
Dave asked on 21 May 2021, 04:30 PM

I am trying to aggregate my chart data but having no luck, I can do this using jqery version but not the .net core verion.

date is coming from a view model:
DataValue
DataCategory
DataColour

I have multiple entries so I need to sum the DataCategory up.

Ive been trying aggregates.Add and groups.add to the data source but ive had no luck getting the chart to display correctly.

@(Html.Kendo().Chart(Model.ChartSetup)
            .Name(@"ChartName")

            .Series(series =>
            {

                series.Donut(model => model.DataValue, categoryExpression: model => model.DataCategory).ColorField("DataColour")

             .Overlay(o => o.Gradient(ChartSeriesGradient.None))

                .Labels(labels => labels
                .Position(ChartBarLabelsPosition.OutsideEnd)

                .Visible(false)

                      .Template("#= category # - #= kendo.format('{0:P}', percentage)#")
                );
            })


            )

1 Answer, 1 is accepted

Sort by
0
Aleksandar
Telerik team
answered on 26 May 2021, 10:40 AM

Hi Dave,

I can suggest referring to the Binding to Remote Data Demo for the Donut Chart as it demonstrates how to configure the grouping in the DataSource:

.DataSource(ds => ds
            .Read(read => read.Action("_WorldScreenResolution", "Donut_Charts"))
            .Group(group => group.Add(item => item.Year))
            .Sort(sort => sort.Add(item=> item.OrderNumber)))

Make sure to click on the View Source tab to review the complete source code behind the demo.

Regards,
Aleksandar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Chart
Asked by
Dave
Top achievements
Rank 1
Answers by
Aleksandar
Telerik team
Share this question
or