Hola a todos, tengo la siguiente grafica en higtcharts
<script>
$(function () {
// Create the chart
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Browser market shares. January, 2015 to May, 2015'
},
subtitle: {
text: 'Click the columns to view versions. Source: <a href="http://netmarketshare.com">netmarketshare.com</a>.'
},
xAxis: {
type: 'category'
},
yAxis: {
title: {
text: 'Total percent market share'
}
},
legend: {
enabled: false
},
plotOptions: {
series: {
borderWidth: 0,
dataLabels: {
enabled: true,
format: '{point.y:.1f}%'
}
}
},
tooltip: {
headerFormat: '<span style="font-size:11px">{series.name}</span><br>',
pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.y:.2f}%</b> of total<br/>'
},
series: [{
name: 'Brands',
colorByPoint: true,
data: [{
name: 'Ingresos',
y: [1],
drilldown: 'Microsoft Internet Explorer'
}, {
name: 'Egresos',
y: [2],
drilldown: 'Chrome'
}
]
}],
});
});
</script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<button type="button" class="btn btn-primary btn-label-left" onClick="GenerarGraficos()">
<span><i class="fa fa-clock-o"></i></span>
Generar
</button>
la funcion js
function GenerarGraficos(){
//alert("generar grafica");
var fechainicial= document.getElementById("input_date").value;
var fechafinal= document.getElementById("input_date2").value;
//alert(fechainicial);
//alert(fechafinal);
var params ={
"INICIAL":fechainicial,
"FINAL":fechafinal,
"ACT": 'GENERAR_REPORTE' //type of process which will be used in the ajax call
};
$.ajax({
data: params, // the sent information
url: 'usuariog.php', // the server file whc
type: 'post',
beforeSend: function () { //before make the ajax call
var chart = $('#container').highcharts();
chart.showLoading();
},
error: function(response){ //if an error happens it will be processed here
var chart = $('#container').highcharts();
chart.hideLoading();
alert("error: Chart error");
popup('popUpDiv');
},
success: function (response) { // the result of the call will be processed here
var result = eval(response);
//alert(response);
alert(result);
var chart = $('#container').highcharts();
//var chart3 = $('#container3').highcharts();
chart.xAxis[0].setCategories(result[0]);
chart.series[0].setData(result[1]); //ingresos
//chart.series[1].setData(result[2]); //egresos
}
});
}
y el php
CASE "GENERAR_REPORTE" :
$fecha1= filter_input(INPUT_POST, "INICIAL");
$fecha2= filter_input(INPUT_POST, "FINAL");
$inicial=date("Y-m-d",strtotime($fecha1));
$final=date("Y-m-d",strtotime($fecha2));
$result=mysql_query("SELECT SUM(total) AS total FROM logs_ingresos WHERE fecha >='".$inicial."' AND fecha<='".$final."'");
while($rs = mysql_fetch_array($result)) {
$ingresos[] = $rs['total'];
}
$label = 1;
$data[0]= $label;
$data[]=$ingresos;
break;
el problema es que en la grafica no me pinta nada :( no se que estoy haciendo mal, por favor si alguien me puede ayudar se lo agradeceria muchisimo
Saludos