One thing you may want to do is make your data less complex by abstracting the labels into their own array and the data into their own array that way 20% of the above code can be eliminated altogether.

jemz
—
2013-08-19T16:47:06Z —
#5

chris_upjohn said:

I haven't tested this but it should be a good direction as to how you can achieve this.

One thing you may want to do is make your data less complex by abstracting the labels into their own array and the data into their own array that way 20% of the above code can be eliminated altogether.

hi, it says theChartData is not a function in this line " theChartData.push(chartData[j]);"

chris_upjohn
—
2013-08-19T21:33:08Z —
#6

Replace that line with the following.

theChartData.data.push(chartData[j]);

jemz
—
2013-08-20T12:45:57Z —
#7

chris_upjohn said:

Replace that line with the following.

javascripttheChartData.data.push(chartData[j]);

Hi chris, another error after i fixed the linethis is the new error

TypeError: data.datasets[i].data is undefined[Break On This Error]

for (var j=0; j<data.datasets[i].data.length; j++){

chris_upjohn
—
2013-08-20T12:52:54Z —
#8

That looks to be an error occurring within the bar graph library itself, do you have a working copy of the page that I can look at?

jemz
—
2013-08-20T15:12:31Z —
#9

chris_upjohn said:

That looks to be an error occurring within the bar graph library itself, do you have a working copy of the page that I can look at?

Hi chris, I don't have live server to put this up..i am in my local machine...

Pullo
—
2013-08-20T17:58:58Z —
#10

Hey jemz,

I kind of stumbled across this thread.I don't have any experience of using chart.js, but would like to try it out and this seems like a good opportunity.So, would you mind explaining in high level terms, what exactly it is that you are trying to achieve (just assume I know nothing :))

If, as Chris suggests, Chart.js is exhibiting a bug, then maybe we can find a different solution.Also, we should report the bug to the developers.

jemz
—
2013-08-21T02:34:49Z —
#11

Hi pullo,

what exactly it is that you are trying to achieve

Okay, What i want is to query or to fetch records to my employee table and sets the data to the graph...getting all the the status having "Regular" and "Casual" in every month. the result of this query will be encoded to json.

so this is what the data it looks like after the request to the server

There was a previous thread where jemz asked about the PHP side of this app, and I gave him some advice on his DB query and about returning the results as JSON.

Jemz, having seen what you're trying to achieve with the data here in this thread, can you post the PHP code which outputs the data? I think it needs to be revisited to help simplify what you're trying to do here.