Kendo堆积条形图配置 [英] Kendo Stacked Bar Chart configuration

查看:119
本文介绍了Kendo堆积条形图配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MVC应用,我的控制器正在将以下json数据传递到我的视图中

I have an MVC app and my controller is passing the following json data to my view

data:
{
    "Category":"Q1 2013",
    "Name":"Female",
    "Count":5000
},
{
    "Category":"Q1 2013",
    "Name":"Male",
    "Count":5000
}
{
    "Category":"Q1 2012",
    "Name":"Female",
    "Count":3500
},
{
    "Category":"Q1 2012",
    "Name":"Male",
    "Count":5000
}

我需要知道如何配置Kendo堆积条形图以显示这样的数据 http://jsfiddle .net/ihatemash/B6LSX/

I need to know how to configure my Kendo stacked bar chart to display the data like this http://jsfiddle.net/ihatemash/B6LSX/

我不知道如何配置系列和类别以正确显示堆积的条形图.

I can't figure out how to configure the series and category to show the stacked bar chart correctly.

推荐答案

这是工作示例 http://jsfiddle.net/idhasitha/F2TQ8/

尝试这样

var data = [

    {"Name":1,"Year":2011,"Expense":200.00},
    {"Name":1,"Year":2012,"Expense":274.91},
    {"Name":5,"Year":2011,"Expense":100.00},
    {"Name":5,"Year":2012,"Expense":315.84},

];

$(document).ready(function() {
    $("#chart").kendoChart({
        theme: "silver",
        title: {
            text: "Total records processed"
        },
        legend: {
            position: "bottom"
        },
        dataSource: {
            data: data,
            group: {
                field: "Name"
            }
        },
        transitions: false,
        series: [{
            type: "column",
            stack: "true",
            field: "Expense"
        }],
        categoryAxis: {
            field: "Year"                                
        }
    });
});

这篇关于Kendo堆积条形图配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆