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:
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>
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>