Thank You very much for Read this and i apologize if my english is not very good.
Well, i'm trying to do a highchart pie chart, but the labels don't appear, only the numbers. i've been searching, but i can't find the answer, and i'm new in this.
This is my data_2.php file:
<?php
$con = mysql_connect("localhost","root","");
if (!$con) { die('Could not connect: ' . mysql_error()); }
mysql_select_db("pymesonline", $con);
$result = mysql_query("SELECT descripcion_p, sum(cantidad_vendida) FROM venta_producto GROUP BY descripcion_p");
while($row = mysql_fetch_array($result)) {
echo $row['descripcion_p'] . "\t" . $row['sum(cantidad_vendida)']. "\n"; }
mysql_close($con);
?>
And this my script:
var a = jQuery.noConflict();
a(document).ready(function(){
var chart;
var options = {
chart: {
renderTo: 'container',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: 'Productos Mas Vendidos',
x: -20 //center
},
subtitle: {
text: 'Historico',
x: -20
},
series: [{
type: 'pie',
name: 'Cantidad Vendida',
}]
}
jQuery.get('clases/data_2.php', null, function(tsv) {
var lines = [];
traffic = [];
try {
// split the data return into lines and parse them
tsv = tsv.split(/\n/g);
jQuery.each(tsv, function(i, line) {
line = line.split(/\t/);
date = Date.parse(line[0]);
traffic.push([
date,
parseInt(line[1].replace(',', ''), 10)
]);
});
} catch (e) { }
options.series[0].data = traffic;
chart = new Highcharts.Chart(options);
});
});
The result is this, and i don't know what is wrong, everything it's ok, except by the labels. I appreciate too much the helps, thank you so much.