0
votes

I want to display vote records per service in my column chart. Then, when i click 1 of the service it will show up the vote records of that service by day.

<?php 
$sql = $mysqli->query("SELECT * FROM services");
while ($row0 = $sql0->fetch_assoc()) {
$sid0 = $row0['sid'];
$service[] = $row0['service'];

$sql1 = $mysqli->query("SELECT COUNT(*) as totalVotes FROM entries where sid = '$sid0'");
while ($row01 = $sql01->fetch_assoc()) {
$totalVote01 = $row01['totalVotes'];
$vote01[] = (int)$totalVote01;
}
}
?>

<script>
Highcharts.chart('container', {
chart: {
type: 'column'
},
xAxis: {
categories: ['<?php echo join($service, ', ') ?>']
}
series: [{
name: 'Total Votes per Service',
data: [{
name: '<?php echo join($service, ', ') ?>',
y: '<?php echo join($vote01, ', ') ?>',
drilldown: '<?php echo join($service, ', ') ?>'
}]
}]

})
</script>

Error: Highcharts error #14: www.highcharts.com/errors/14

Please help me with codes, my presentation is tomorrow badly need your help. Just a beginner. Thank you so very much!

1
Highcharts error: This happens if using a string as a data point. Try to pass numbers as data, now your data is as an array of strings eg. '13' -> should be 13.Wojciech Chmiel

1 Answers

0
votes

Problem is in this line

y: '<?php echo join($vote01, ', ') ?>',

It will return a String as '12' You need to pass a number here.

You can try withoit quote

y: <?php echo join($vote01, ', ') ?>,

or parse value before setting

y: parseFloat('<?php echo join($vote01, ', ') ?>' ),