Advertisement
justhrun

highcharts_index.html

Sep 16th, 2014
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.81 KB | None | 0 0
  1. <html><head>
  2. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  3. <title>Pilkada 2018 - HTML</title>
  4. <script type="text/javascript" src="js/jquery-1.9.1.min.js" ></script>
  5. <script type="text/javascript" src="js/highcharts.js" ></script>
  6. <script type="text/javascript" src="js/themes/gray.js"></script>
  7. <script type="text/javascript">
  8.         $(document).ready(function() {
  9.                 var options = {
  10.                         chart: {
  11.                                 renderTo: 'container',
  12.                                 defaultSeriesType: 'line',
  13.                                 marginRight: 130,
  14.                                 marginBottom: 25
  15.                         },
  16.                         title: {
  17.                                 text: 'Project Requests',
  18.                                 x: -20 //center
  19.                         },
  20.                         subtitle: {
  21.                                 text: '',
  22.                                 x: -20
  23.                         },
  24.                         xAxis: {
  25.                                 categories: []
  26.                         },
  27.                         yAxis: {
  28.                                 title: {
  29.                                         text: 'Hasil suara'
  30.                                 },
  31.                                 plotLines: [{
  32.                                         value: 0,
  33.                                         width: 1,
  34.                                         color: '#808080'
  35.                                 }]
  36.                         },
  37.                         tooltip: {
  38.                                 formatter: function() {
  39.                                                 return '<b>'+ this.series.name +'</b><br/>'+
  40.                                                 this.x +': '+ this.y;
  41.                                 }
  42.                         },
  43.                         legend: {
  44.                                 layout: 'vertical',
  45.                                 align: 'right',
  46.                                 verticalAlign: 'top',
  47.                                 x: -10,
  48.                                 y: 100,
  49.                                 borderWidth: 0
  50.                         },
  51.                         series: []
  52.                 }
  53.                 setInterval(function() { getData(); }, 3000);
  54.                 function getData(){
  55.                         $.getJSON("data.php", function(json) {
  56.                                 options.xAxis.categories = json[0]['kecamatan'];
  57.                                 options.series = json[1]['hasil'];
  58.                                 chart = new Highcharts.Chart(options);
  59.                         });
  60.                 }
  61.         });
  62. </script>
  63. </head>
  64. <body>
  65. <div id="container" style="width: 100%; height: 400px; margin: 0 auto"></div>
  66. </body>
  67. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement