Different dataSource filter for each series

1 posts, 0 answers
  1. Cody
    Cody avatar
    3 posts
    Member since:
    Aug 2012

    Posted 20 Aug 2012 Link to this post

    I'm having an issue with binding a json file to my chart. I am attempting to have a multi axes chart with stacked and grouped columns. I have it working with static data but cannot get it to work with the dataSource json file. I believe I need to be able to filter the datasource differently for each series. I've included a sample of the function, am I going about this wrong?

    $("#ApplesOrangesChart").kendoChart({
    theme: $(document).data("kendoSkin") || "default",
    datasource: {
    transport: {
    read:  "testjson.json",
    },
    sort: {
    field: "MonthNumber",
    dir: "asc"
    },
    },
    title: {
    text: "Apples to Oranges 2011 vs 2012",
    },
    legend: {
    visible: true,
    position: "bottom",
    },
    seriesDefaults: {
    type: "column",
    },
    series: [{
    name: "2011 Apples",
    stack: "2011",
    axis: "monthly",
    field: "AppleValue",
    filter: { field: "Year", operator: "eq", value: 2011 },
    }, {
    name: "2011 Oranges",
    stack: "2011",
    axis: "monthly",
    field: "OrangeValue",
    filter: { field: "Year", operator: "eq", value: 2011 },
    }, {
    name: "2012 Apples",
    stack: "2012",
    axis: "monthly",
    field: "AppleValue",
    filter: { field: "Year", operator: "eq", value: 2012 },
    }, {
    name: "2012 Oranges",
    stack: "2012",
    axis: "monthly",
    field: "OrangeValue",
    filter: { field: "Year", operator: "eq", value: 2012 },
    },{
    type: "line",
    axis: "cumulative",
    field: "CumlativeValue",
    filter: { field: "Year", operator: "eq", value: 2011 },
    name: "2011 Cumulative",
    }, {
    type: "line",
    axis: "cumulative",
    field: "WonCumlativeValue",
    filter: { field: "Year", operator: "eq", value: 2012 },
    name: "2012 Cumulative",
    }],
    valueAxis: [{
    name: "monthly",
    title: {text: "Monthly"},
    labels: {
    template: "#= kendo.format('{0:N0}', value / 1000) # M"
    },
    },
    {
    name: "cumulative",
    title: {text: "Cumulative"},
    labels: {
    format: "C"
    },
    }],
    categoryAxis: {
    categories: ["Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec"],
    majorGridLines: {
    visible: false
    },
    },
    });
Back to Top