Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-30-2012, 05:48 PM   PM User | #1
raposu
New to the CF scene

 
Join Date: Oct 2012
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
raposu is an unknown quantity at this point
syntax error

Hello, I have a graph that does not work:

I have this file: data.php

Quote:
Categorias,14/10/12 19:00,14/10/12 18:00,14/10/12 17:00,14/10/12 16:00,14/10/12 15:00,14/10/12 14:00,14/10/12 13:00,14/10/12 12:00,14/10/12 11:00,14/10/12 10:00,14/10/12 09:00,14/10/12 08:00,14/10/12 07:00,14/10/12 06:00,14/10/12 05:00,14/10/12 04:00,14/10/12 03:00,14/10/12 02:00,14/10/12 01:00,14/10/12 00:00,13/10/12 23:00,13/10/12 22:00,13/10/12 21:00,13/10/12 20:00
Rainfall,0.0,0.0,0.8,0.4,0.6,1.8,0.0,0.0,1.6,0.0,0.0,0.0,0.0,0.0,0.0,0.4,2.2,0.8,0.0,0.0,0.0,0.0,0.0 ,0.0
Sea-Level Pressure,971.2,971.0,970.9,970.8,970.1,970.1,969.6,969.6,969.2,967.7,967.0,967.3,967.4,968.3,969.0,9 69.0,971.1,971.4,972.2,972.7,973.2,973.9,974.3,974.2
Temperature,10.3,11.3,10.4,10.4,11.4,11.4,14.4,12.6,11.7,14.5,13.7,13.5,11.2,10.2,9.7,9.7,10.4,10.7, 10.9,11.4,11.9,12.7,13.6,14.2
and this script:

Code:
var chart; // global
/**
* Request data from the server, add it to the graph and set a timeout to request again
*/
function requestData() {
$.ajax({
url: 'data.php',
success: function(data) {
// Split the lines
var lines = data.split('\n');
$.each(lines, function(lineNo, line) {
var items = line.split(',');

// header line containes categories
if (lineNo === 0) {
$.each(items, function(itemNo, item) {
if (itemNo > 0) options.xAxis.categories.push(item);
});
}
// the rest of the lines contain data with their name in the first position
else {
$.each(items, function(itemNo, item) {
if (itemNo === 0) {
options.series[lineNo-1].name = item;

} else {
options.series[lineNo-1].data.push(parseFloat(item));
}
});
}
});
console.log(options);
var chart = new Highcharts.Chart(options);
});
});
requestData() function

I think I have a syntax error, and this string is correct?


Cualquier idea sería de gran ayuda, llevo semanas dando vueltas sin acierto

Thank's
raposu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:34 PM.


Advertisement
Log in to turn off these ads.