I'm trying the get data out of a text file and generating a jqplot graph.
The problem is i cant make the plugin read the data even if i save it exactly as the demo version. Note: the demo data works well with my script, it's just something with formatting my data that i cant get a hang of.
Thanks alot
this is my script:
$(document).ready(function() {
var chartdata = 0;
function parseData(data){
//do something with the data
chartdata = '['+data+']';
//alert("data is: " + chartdata);
var line1=chartdata;
var plot1 = $.jqplot('chartdiv', [line1], {
title:'Active Users',
axes:{
xaxis:{
renderer:$.jqplot.DateAxisRenderer,
tickOptions:{
formatString:'%b %#d'
}
},
yaxis:{
tickOptions:{
formatString:'$%.2f'
}
}
},
highlighter: {
show: true,
sizeAdjust: 7.5
},
cursor: {
show: false
}
});
}
$.get("userschart.txt",parseData);
});
thats my code, line1 var is the problem.
this is the original example code that works:
var line1=[['23-May-08', 578.55], ['20-Jun-08', 566.5], ['25-Jul-08', 480.88], ['22-Aug-08', 509.84],
['26-Sep-08', 454.13], ['24-Oct-08', 379.75], ['21-Nov-08', 303], ['26-Dec-08', 308.56],
['23-Jan-09', 299.14], ['20-Feb-09', 346.51], ['20-Mar-09', 325.99], ['24-Apr-09', 486.15]];
and this is to content of my textfile userschart.txt:
['11-Dec-13',6],['12-Dec-13',6],['13-Dec-13',6],['14-Dec-13',6],['15-Dec-13',6]