I am creating funnel chart which get data from mysql table using jquery.it works on other all chart of highcharts but In funnel chart it fails. here is my code
index.php
<script type="text/javascript" src="high-js/funnel-chart.js"></script>
<div id="topcustomer" style="height: 500px;"></div>
funnel-chart.js
$(function () {
var curcust = new Highcharts.Chart({
chart: {
renderTo:'topcustomer',
type: 'funnel',
marginRight: 100
},
title: {
text: 'Top 5 Customer',
x: -50
},
plotOptions: {
series: {
dataLabels: {
enabled: true,
format: '<b>{point.name}</b> ({point.y:,.0f})',
color: 'black',
softConnector: true
},
neckWidth: '30%',
neckHeight: '25%'
//-- Other available options
// height: pixels or percent
// width: pixels or percent
}
},
legend: {
enabled: false
},
series: [{
name: 'Current Month'
}]
});
jQuery.get('data.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/);
cust = line[0] ;
traffic.push([
cust,
line[1]
]);
});
} catch (e) { }
curcust.series[0].data = traffic;
chart = new Highcharts.Chart(curcust);
});
});
data.php
$result = mysql_query("SELECT customer, SUM(amount) AS amo FROM `yearly_sales` GROUP BY customer LIMIT 5");
while($row = mysql_fetch_array($result)) {
echo $row['customer'] . "\t" . $row['amo']. "\n";
}
It doesn't show any error and chart is not generated. is there any error in my code ? please help me out this problem Thanx