This is a migrated thread and some comments may be shown as answers.

Dynamic Chart with multiple series is missing categoryAxis text

5 Answers 180 Views
Charts
This is a migrated thread and some comments may be shown as answers.
don
Top achievements
Rank 1
don asked on 29 Mar 2013, 03:06 PM
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}]}]}

5 Answers, 1 is accepted

Sort by
0
Hristo Germanov
Telerik team
answered on 29 Mar 2013, 04:19 PM
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!
0
don
Top achievements
Rank 1
answered on 29 Mar 2013, 04:29 PM
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
0
Hristo Germanov
Telerik team
answered on 01 Apr 2013, 07:32 AM
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!
0
Gordon
Top achievements
Rank 1
answered on 27 Oct 2014, 04:47 PM
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?
0
Hristo Germanov
Telerik team
answered on 29 Oct 2014, 12:17 PM
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!
 
Tags
Charts
Asked by
don
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
don
Top achievements
Rank 1
Gordon
Top achievements
Rank 1
Share this question
or