Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $koneksi=mysql_connect('localhost','root','');
- mysql_select_db('toy_store',$koneksi);
- $sql=mysql_query("SELECT nama_band,vote FROM tb_voting");
- $series=array();
- $categories=array();
- while($record=mysql_fetch_array($sql)){
- $series[]="{name: '".$record['nama_band']."',data:".$record['vote']."}";
- $categories[]=$record['nama_band'];
- }
- ?>
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Highcharts Example</title>
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
- <script type="text/javascript">
- $(function () {
- $('#container').highcharts({
- chart: {
- type: 'column'
- },
- title: {
- text: 'Voting'
- },
- subtitle: {
- text: 'Source: WorldClimate.com'
- },
- xAxis: {
- categories: ['<?php echo implode("','",$categories);?>']
- },
- yAxis: {
- min: 0,
- title: {
- text: 'Rainfall (mm)'
- }
- },
- tooltip: {
- headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
- pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
- '<td style="padding:0"><b>{point.y:.1f} Vote</b></td></tr>',
- footerFormat: '</table>',
- shared: true,
- useHTML: true
- },
- plotOptions: {
- column: {
- pointPadding: 0.2,
- borderWidth: 0
- }
- },
- series: [<?php echo implode(",",$series);?>]
- });
- });
- </script>
- </head>
- <body>
- <script src="js/highcharts.js"></script>
- <script src="js/modules/exporting.js"></script>
- <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement