I am using Highcharts and it reports for the whole year.
I have data only until August (as it is August) but when I plot the graph it plots until December with value as 0 (Sep to Dec).
I don´t want to plot the graph if the values are 0 and I want to plot only until August for this year but for the last year it has to plot until Dec as I have data in my database.
Here's my code:
Code: Select all
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<script>
Highcharts.chart('container', {
xAxis: {
min: 0,
max: 11,
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
crosshair: true
},
yAxis: {
min: 0,
title: {
text: '',
}
},
plotOptions: {
series: {
dataLabels: {
enabled: true
},
enableMouseTracking: true
}
},
exporting: {
sourceWidth: 1800,
sourceHeight: 500,
scale: 1
},
credits: {
enabled: false
},
chart: {
type: 'line'
},
title: {
text: "Demo Graph"
},
subtitle: {
text: 'Marks'
},
tooltip: {
shared: true
},
series: [{
name: 'Average',
//type: 'column',
color: 'orange',
data: [
[0, <?php echo round($janCount);?>],
[1, <?php echo round($febCount);?>],
[2, <?php echo round($marCount);?>],
[3, <?php echo round($aprCount);?>],
[4, <?php echo round($mayCount);?>],
[5, <?php echo round($junCount);?>],
[6, <?php echo round($julCount);?>],
[7, <?php echo round($augCount);?>],
[8, <?php echo round($sepCount);?>],
[9, <?php echo round($octCount);?>],
[10, <?php echo round($novCount);?>],
[11, <?php echo round($decCount);?>]],
marker: {
enabled: true
},
states: {
hover: {
lineWidth: 0
}
},
enableMouseTracking: true
}, {
name: 'Minimum',
//type: 'spline',
color: 'darkblue',
data: [
<?php echo round($janCount1);?>,
<?php echo round($febCount1);?>,
<?php echo round($marCount1);?>,
<?php echo round($aprCount1);?>,
<?php echo round($mayCount1);?>,
<?php echo round($junCount1);?>,
<?php echo round($julCount1);?>,
<?php echo round($augCount1);?>,
<?php echo round($sepCount1);?>,
<?php echo round($octCount1);?>,
<?php echo round($novCount1);?>,
<?php echo round($decCount1);?>],
marker: {
enabled: true
},
states: {
hover: {
lineWidth: 0
}
},
enableMouseTracking: true
}]
});
</script>