JavaScript
var data = [
{"ProjectID":"A","Year":"AAAAA","Month":1,"Expense":30},
{"ProjectID":"A","Year":"DDDDDDDDDDDD","Month":2,"Expense":70},
{"ProjectID":"A","Year":"CCCCCCCCCCCC","Month":3,"Expense":10},
{"ProjectID":"A","Year":"IIIIIIIIIIIIII","Month":4,"Expense":90},
{"ProjectID":"A","Year":"EEEE","Month":5,"Expense":85},
{"ProjectID":"B","Year":"AAAAA","Month":1,"Expense":70},
{"ProjectID":"B","Year":"DDDDDDDDDDDD","Month":2,"Expense":30},
{"ProjectID":"B","Year":"CCCCCCCCCCCC","Month":3,"Expense":90},
{"ProjectID":"B","Year":"IIIIIIIIIIIIII","Month":4,"Expense":10},
{"ProjectID":"B","Year":"EEEE","Month":5,"Expense":15}];
var withLabelShorter = false;
$(document).ready(function() {
initializeChart("Top",1,5,false,false);
$("#all").click(function() {
initializeChart("Top",1,5,false,false);
$("#chartBot").remove();
});
$("#1").click(function() {splitTable(1);});
$("#2").click(function() {splitTable(2);});
$("#3").click(function() {splitTable(3);});
$("#4").click(function() {splitTable(4);});
$("#withShortLabels").click(function() {withLabelShorter = !withLabelShorter;});
});
function splitTable(breakpoint){
initializeChart("Top",1,breakpoint,false,false);
initializeChart("Bot",breakpoint+1,5,false,false);
};
function initializeChart(which, start, end, withLegend, withTitle){
$("#chart" + which).remove();
$("#dad").append("<div id=\"chart" + which +"\" style=\"height:" + ((end-start+1) * 25 + (withLegend ? 100 : 40)) + "px" + "; width:550px\"></div>");
var labelShorter = (withLabelShorter ? "#=shortLabel(value)#" : "#=value#");
$("#chart" + which).kendoChart({
title: {
text: "Total records processed",
visible: withTitle
},
dataSource: {
data: data,
group: {
field: "ProjectID"
},
filter: [{
field: "Month",
...