Reputation: 1702
Javascript code -
$.jqplot.config.enablePlugins = true;
var defaultHighlighter = {tooltipAxes: 'y',showTooltip: true,tooltipLocation: 'n',tooltipOffset: 10,yvalues:1,formatString:'%.0f user'};
var globalTicks = [[-1,' '],[0,'12 am'],[1,'1 am'],[2,'2 am'],[3,'3 am'],[4,'4 am'],[5,'5 am'],[6,'6 am'],[7,'7 am'],[8,'8 am'],[9,'9 am'],[10,'10 am'],[11,'11 am'],[12,'12 pm'],[13,'1 pm'],[14,'2 pm'],[15,'3 pm'],[16,'4 pm'],[17,'5 pm'],[18,'6 pm'],[19,'7 pm'],[20,'8 pm'],[21,'9 pm'],[22,'10 pm'],[23,'11 pm'],[24,[' ']]];
var fullGraphOptions = {seriesDefaults: {pointLabels:{show:false},showMarker:true,markerOptions:{style: 'filledCircle'}},axes:{xaxis:{rendererOptions:{tickRenderer:$.jqplot.CanvasAxisTickRenderer},tickOptions:{angle:-45},ticks:globalTicks},yaxis:{min:0,tickOptions:{formatString:'%.0f'}}},highlighter:defaultHighlighter};
fullanalysis1 = $.jqplot('hourlyGraph-1', [[[63,63],[68,68],[87,87],[108,108],[135,135],[138,138],[147,147],[167,167],[130,130],[145,145],[144,144],[127,127],[134,134],[132,132],[147,147],[158,158],[157,157],[166,166],[170,170],[124,124],[107,107],[77,77],[62,62],[88,88]]], fullGraphOptions);
fullanalysis2 = $.jqplot('hourlyGraph-2', [[[63,63],[68,68],[87,87],[108,108],[135,135],[138,138],[147,147],[167,167],[130,130],[145,145],[144,144],[127,127],[134,134],[132,132],[147,147],[158,158],[157,157],[166,166],[170,170],[124,124],[107,107],[77,77],[62,62],[88,88]]], fullGraphOptions);
fullanalysis3 = $.jqplot('hourlyGraph-3', [[[63,63],[68,68],[87,87],[108,108],[135,135],[138,138],[147,147],[167,167],[130,130],[145,145],[144,144],[127,127],[134,134],[132,132],[147,147],[158,158],[157,157],[166,166],[170,170],[124,124],[107,107],[77,77],[62,62],[88,88]]], fullGraphOptions);
fullanalysis4 = $.jqplot('hourlyGraph-4', [[[63,63],[68,68],[87,87],[108,108],[135,135],[138,138],[147,147],[167,167],[130,130],[145,145],[144,144],[127,127],[134,134],[132,132],[147,147],[158,158],[157,157],[166,166],[170,170],[124,124],[107,107],[77,77],[62,62],[88,88]]], fullGraphOptions);
All the four graphs have the same result -
No plotting is done at all.
The data I have in the code is just a sample.
What could be the problem? The screenshot's of Firefox running on Fedora 14.
Thank you,all.
Edit: I don't get any error in the Firebug console.
Upvotes: 0
Views: 1131
Reputation: 19353
You seems to have got your data formatted the wrong way. You are trying to graph a single series with an array. Instead of giving data as [63,63],[68,68],[87,87 ...], It should be [63,68,87 ...]. Here is the right way to do get the chart running:
var data = [63, 68, 87, 108,135,138,147,167,130];
var globalTicks = ['12 am','1 am','2 am','3 am','4 am','5 am','6 am','7 am','8 am'];
var fullGraphOptions = {
seriesDefaults: {
pointLabels:{
show:true
},
showMarker:true,
markerOptions:{
style: 'filledCircle'
}
},
axes:{
xaxis:{
renderer: $.jqplot.CategoryAxisRenderer,
tickRenderer:$.jqplot.CanvasAxisTickRenderer,
tickOptions:{
angle:-45
},
ticks:globalTicks
},
yaxis:{
min:0,
tickOptions:{
formatString:'%.0f'
}
}
},
highlighter:defaultHighlighter
};
fullanalysis1 = $.jqplot('chartdiv', [data], fullGraphOptions);
Upvotes: 1