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

Kendo Pie Chart Sum, Count, Avg

2 Answers 430 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Gokhan
Top achievements
Rank 1
Gokhan asked on 17 Oct 2014, 12:14 PM
I have a problem with Kendo Pie chart about "Aggregate" functions(count, sum, average).Everyting works with Bar or Column chart but when i try to show pie chart i can't use count, sum, average functions of Kendo Pie Chart's.

I can show my values invidually but i can't group my values(like euro, dolar, lira)How can i group my values and show them with Pie chart?

Here is my model:
public decimal MoneyValue{ get; set; }
public string MoneyName{ get; set; }

My values are coming like that with Pie Chart.:
Euro - 10
Dolar- 100
Dolar - 50
Euro -15
Dolar - 50
Lira - 45

I need to show values like that:
Euro - Count: 2 Total:25 Avg: 12,5
Dolar - Count: 3 Total: 200 Avg: 66,6
Lira Count: 1 Total: 200 Avg: 200

View Code


View Code@(Html.Kendo().Chart(Model)
.Name("chart")
.Title(title => title
.Text(@ViewBag.a)
.Position(ChartTitlePosition.Top))
.Legend(legend => legend
.Visible(false)
.Position(ChartLegendPosition.Top))
.Series(series =>
{
series.Pie(model => model.MoneyValue, categoryExpression: model => model.MoneyName);
// .Aggregate(ChartSeriesAggregate.Count)
//.Labels(labels => labels.Visible(true).Position(ChartBarLabelsPosition.Center));

//here i get the error. It shows there is no .Aggregate function so i can't group my values.

})


.Theme("metro")
.Tooltip(tooltip => tooltip
.Visible(true)
.Template("#= category #: #= value #"))
.Events(ev => ev.DataBound("onDB"))

)

Kendo Count - Sum - Average functions:(i've no problem with them, they work correctly.)<div class="configuration-horizontal">

<div class="config-section">
<center>
<span class="configHead">Grafik </span>
</center>
<ul class="options">

<td>
<input id="aggregateSum" name="aggregate" type="radio" value="sum" autocomplete="off" />

Sum

</td>
<td>
<input id="aggregateAvg" name="aggregate" type="radio" value="avg"
autocomplete="off" />

Avg

</td>
<td>
<input id="aggregateCount" name="aggregate" type="radio" value="count" checked="checked" autocomplete="off" />

Count

</td>
</ul>

</div>
</div>
<script>
$(".configuration-horizontal").bind("change", refresh);

function refresh() {
var chart = $("#chart").data("kendoChart"),
series = chart.options.series,
categoryAxis = chart.options.categoryAxis,
baseUnitInputs = $("input:radio[name=baseUnit]"),
aggregateInputs = $("input:radio[name=aggregate]");

for (var i = 0, length = series.length; i < length; i++) {
series[i].aggregate = aggregateInputs.filter(":checked").val();
}

categoryAxis.baseUnit = baseUnitInputs.filter(":checked").val();

chart.refresh();
}
</script>

2 Answers, 1 is accepted

Sort by
0
Accepted
Hristo Germanov
Telerik team
answered on 17 Oct 2014, 01:18 PM
Hello Gokhan,

Currently the Kendo UI Chart doesn't support aggregates for Pie series. I would suggest to submit your request in Kendo's UserVoice so other members of the community can evaluate, comment on and vote for it. 

Regards,
Hristo Germanov
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.

 
0
Gokhan
Top achievements
Rank 1
answered on 17 Oct 2014, 01:57 PM
Thank you. I will.
Tags
Chart
Asked by
Gokhan
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
Gokhan
Top achievements
Rank 1
Share this question
or