I am stuck at data connect from mysql database to HighCharts
highchart.js code below
<script type="text/javascript">
$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container5',
plotBackgroundColor: null,
plotBorderWidth: 2,
plotShadow: false
},
title: {
text: '<p><?php echo $chart5; ?></p>'
},
// tooltip: {
// pointFormat: '{series.name}: <b>{point.percentage}%</b>',
// percentageDecimals: 1
// },
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
xAxis: {
categories: [<?php echo "'".implode("','",$data)."'"; ?>]
},
series: [{
type: 'pie',
data: [<?php echo implode(",",$data1); ?>]
}]
});
});
});
</script>
and my database.php:
$data = array();
$sql = "SELECT x_axis FROM licence_chart ";
$result9 = mysql_query($sql);
$data9 = array();
while ($row = mysql_fetch_array($result9)) {
$data9 = $row['x_axis'];
$data[] = $data9;
}
$data1 = array();
$sql = "SELECT y_axis FROM licence_chart ";
$result10 = mysql_query($sql);
$data10 = array();
while ($row = mysql_fetch_array($result10)) {
$data10 = $row['y_axis'];
$data1[] = $data10;
}
echo "'".join("','",$data)."'";
echo join(",",$data1);
when I run this code in localhost then pie chart shows but in x-axies
values are not shown
that values are shown like Slice
.but y-axies
value are display correctly ,
in licence_chart
table data like this in table x_axies
, y_axies
are columns
x_axies{crome,opera,ie,firefox,safari}
y_axies{0.12,0.23,23.2,56.2,2}
i want inhighchart.js
file in data[]
data will come like this
['safari',10],
['firefox',1.5],
['ie',0.5]
so What am I doing wrong in database.php
and highchatr.js
file please tell me and correct my code .