Prueba algo asi:
Código PHP:
Ver original<?php
$arrayMeses = array('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre');
//fetch department names from the department table
$sql = "SELECT Month(created_at) AS Meses, Sum(total) AS total_Mes FROM sell WHERE Year(created_at)=2016 GROUP BY Meses ORDER BY Meses asc";
{
$valores["total_mes"][]=$row[1];
$valores["meses"][]=$arrayMeses[date($row[0])-1]; }
/* Optienes algo como esto:
{"total_mes":[8,130,166,112],"meses":["Enero","Febrero","Marzo","Abril"]}
*/
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highcharts Example</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<style type="text/css">
${demo.css}
</style>
<script type="text/javascript">
$(function () {
var valores = eval('('+'<?php echo $valores_json; ?>'+')');
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Ventas mensuales'
},
subtitle: {
text: '2016'
},
xAxis: {
categories: valores["meses"],
crosshair: true
},
yAxis: {
min: 0,
title: {
text: 'Dolares (USD)'
}
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.1f} usd</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
series: [{
name: 'Total Mes',
data: valores["total_mes"]
}, {
name: 'Gastos',
data: valores["gastos"]
}, {
name: 'Devoluciones',
data: valores["devoluciones"]
}]
});
});
</script>
</head>
<body>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
</body>
</html>