Dynamic Chart with multiple series is missing categoryAxis text

6 posts, 0 answers
  1. don
    don avatar
    19 posts
    Member since:
    Dec 2008

    Posted 29 Mar 2013 Link to this post

    My issue is with the categoryAxis not showing the text.  Which becomes an issue when trying to understand the graphing points.  I have included my code below with a small sample dataset to show what is going on.  Thank you!

    var chartOptions = {
    theme: "",
    seriesDefaults: {
    type: "line"
    },
    title: {
    text: ""
    },
    legend: {
    position: "bottom"
    },
    series: "",
    categoryAxis: {
    field: "category"
    }
    };

    //Set Chart Data
    chartOptions.series = dataSetContents.Series;
    chartOptions.seriesDefaults = { type: $("#chartType").val() };
    chartOptions.theme = $("#colorType").val();
    chartOptions.title = { text: $("#dimensionsType").val() + " BY " + $("#dataType").val() };

    function createChart() {
    $("#chart").kendoChart(
    $.extend(true, {}, chartOptions)
    );
    }

    my series is set up as the following:
    {
        name: "2008-2010"
        data: [{
           category: "2008"
           value: "500"
        }]
    }

    full text is here:
    {"Series":[{"name":"2008-2010","data":[{"category":"2010 - Q01","value":733},{"category":"2009 - Q02","value":921},{"category":"2008 - Q01","value":690},{"category":"2009 - Q01","value":1584},{"category":"2008 - Q03","value":1778},{"category":"2008 - Q04","value":359},{"category":"2008 - Q02","value":1308},{"category":"2009 - Q04","value":64},{"category":"2007 - Q03","value":20},{"category":"2009 - Q03","value":411},{"category":"2010 - Q02","value":17},{"category":"2007 - Q04","value":19},{"category":"2007 - Q02","value":11},{"category":"2007 - Q01","value":5}]},{"name":"2009 Data","data":[{"category":"2008 - Q01","value":6230},{"category":"2008 - Q02","value":7635},{"category":"2008 - Q03","value":4294},{"category":"2007 - Q03","value":101},{"category":"2007 - Q02","value":86},{"category":"2007 - Q04","value":65},{"category":"2007 - Q01","value":63},{"category":"2009 - Q02","value":8}]}]}

  2. Hristo Germanov
    Admin
    Hristo Germanov avatar
    703 posts

    Posted 29 Mar 2013 Link to this post

    Hello don,

    You need to bind your chart via dataSource because the category field works only with it. I think that you should do something similar like this: http://jsbin.com/efabuy/5/edit

    I hope this helps you.

    Kind regards,
    Hristo Germanov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. don
    don avatar
    19 posts
    Member since:
    Dec 2008

    Posted 29 Mar 2013 Link to this post

    Thank you for the quick response. I tried the route you suggested originally, however, my issue was when I began to have multiple series as I do with this json object:

    {"Series":[{"name":"2009 Data","data":[{"category":"2008","value":18159},{"category":"2007","value":315},{"category":"2009","value":8}]},{"name":"2008-2010","data":[{"category":"2010","value":750},{"category":"2009","value":2980},{"category":"2008","value":4135},{"category":"2007","value":55}]}]}

    Would you make any modifications based on the above object?

    I am trying to make it so I can add a series based on a user selection of multiple datasets.

    Thank you
  4. Hristo Germanov
    Admin
    Hristo Germanov avatar
    703 posts

    Posted 01 Apr 2013 Link to this post

    Hi don,

    In your case you need to pass this categories to the chart's categoryAxis.

    All the best,
    Hristo Germanov
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Gordon
    Gordon avatar
    16 posts
    Member since:
    Feb 2009

    Posted 27 Oct 2014 in reply to Hristo Germanov Link to this post

    This doesn't help when the Category axis contains hundreds of date-time values.
    Can this functionality be considered for future versions of the kendo charts?
  6. Hristo Germanov
    Admin
    Hristo Germanov avatar
    703 posts

    Posted 29 Oct 2014 Link to this post

    Hi Gordon,

    Unfortunately this task is not easy for implementation. Could you please try to rewrite your data like in this example? I think that this is the best approach in your case.

    Regards,
    Hristo Germanov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top