Some values of my chart are not drawn. Do you have any idea of the reason of this?
This is my code in the JSP:
- Code: Select all
function renderChart(container, subTitle){
Date date = new Date();
var url = "getData.html";
var series=[],dataJ={
name:"J",
data: []
};
$.getJSON(url, null,function(data){
$.each(data, function(key, val) {
$.each(val, function(key2, value) {
var hour = key2.substring(0, 2);
date.setHours(parseInt(hour));
var minutes = key2.substring(3, 6);
date.setMinutes(parseInt(minutes));
dataJ.data.push([dateFin.getTime() + 1000 * 60 * 60, value]);
});
series.push(dataJ);
if (key == 0) {
dataJ={
name:"J-7",
type: 'line',
data: [],
color: '#000000'
};
} else if (key == 1) {
dataJ={
id: "A1",
type: 'line',
name:"A-1",
data: [],
color: '#808080'
};
}
drawChart(container, subTitle);
});
}
function drawChart(div, title, series){
var chart = new Highcharts.Chart({
chart: {
renderTo: div,
defaultSeriesType: 'area',
},
title: {
text: title
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
hour: '%H:%M'
}
},
yAxis:
{
title: {
text: "School"
},
labels: {
formatter: function() {
return Highcharts.numberFormat(this.value, 0);
}
},
min: 0
},
tooltip: {
crosshairs: true,
shared: true,
formatter: function() {
var s = Highcharts.dateFormat('%d-%b-%y à %H:%M',this.x);
$.each(this.points, function(i, point) {
s += '<br/><b>'+ point.series.name +'</b>: '+point.y;
});
return s;
}
},
exporting: {
enabled: false
},
plotOptions: {
area: {
marker: {
enabled: false,
symbol: 'circle',
radius: 2,
states: {
hover: {
enabled: true
}
}
}
}
},
series: series
});
}
The data that I get from my controller (List<Map<String, Integer>>) is this:
- Code: Select all
[{00:00=0, 00:15=0, 00:30=0, 00:45=0, 01:00=0, 01:15=0, 01:30=0, 01:45=0, 02:00=0, 02:15=0, 02:30=0, 02:45=8, 03:00=0, 03:15=3, 03:30=0, 03:45=0, 04:00=0, 04:15=0, 04:30=0, 04:45=3, 05:00=0, 05:15=2, 05:30=0, 05:45=5, 06:00=0, 06:15=1, 06:30=0, 06:45=1, 07:00=5, 07:15=0, 07:30=1, 07:45=5, 08:00=0, 08:15=0, 08:30=0, 08:45=0, 09:00=0, 09:15=0, 09:30=8, 09:45=3, 10:00=6, 10:15=11}, {00:00=0, 00:15=0, 00:30=0, 00:45=0, 01:00=0, 01:15=0, 01:30=0, 01:45=0, 02:00=0, 02:15=0, 02:30=0, 02:45=0, 03:00=0, 03:15=2, 03:30=0, 03:45=0, 04:00=0, 04:15=0, 04:30=1, 04:45=0, 05:00=0, 05:15=0, 05:30=0, 05:45=5, 06:00=0, 06:15=0, 06:30=0, 06:45=0, 07:00=5, 07:15=0, 07:30=1, 07:45=0, 08:00=0, 08:15=0, 08:30=0, 08:45=0, 09:00=0, 09:15=0, 09:30=2, 09:45=1, 10:00=5, 10:15=13}, {00:00=0, 00:15=0, 00:30=0, 00:45=0, 01:00=0, 01:15=0, 01:30=0, 01:45=1, 02:00=0, 02:15=0, 02:30=0, 02:45=0, 03:00=0, 03:15=0, 03:30=0, 03:45=1, 04:00=1, 04:15=0, 04:30=2, 04:45=0, 05:00=2, 05:15=0, 05:30=0, 05:45=1, 06:00=0, 06:15=0, 06:30=0, 06:45=0, 07:00=0, 07:15=0, 07:30=0, 07:45=0, 08:00=0, 08:15=0, 08:30=0, 08:45=0, 09:00=0, 09:15=0, 09:30=3, 09:45=0, 10:00=2, 10:15=4}]
The values between 07:45 and 10:00 are not drawn in my charts. why?