PDA

View Full Version : Align X axis with JSON data (Highcharts adapter)



x0ner
5 Jan 2011, 1:47 PM
I am using the Highcharts adapter to display a line graph containing 3 lines.

x-axis = weeks
y-axis = counts

I am getting my data using ajax and then storing in a JsonStore:

var store_all = new Ext.data.JsonStore({
fields:['week', 'count_all'],
url: 'controls/query.php?type=cases&group=all',
root: "data"
});

The problem I am having is when it plots the data. In some cases I do not have data for a particular week, so I may not have 52 points to plot. I am wondering how I can get my weeks field to align based on the x-axis. So in other words, if the week is 4 in my JSON then I want it to plot on week 4 on the x-axis. I have defined my count as the dataIndex and that properly displays, but I am not sure how to define the week so they match up.

x0ner
5 Jan 2011, 2:09 PM
There seems to be an xField parameter that I can use, but it does not seem to work.

x0ner
5 Jan 2011, 2:20 PM
Added the xField into the series to solve the problem.