kura2yamato

fushion chart

Apr 5th, 2022 (edited)
943
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.55 KB | None | 0 0
  1. <script>
  2. var label_thread_sungai = [];
  3. var data_thread_pij = [];
  4.  
  5. <?php
  6. $chartData=[];
  7. foreach ($thread_per_sungai->getResult() as $key => $value){
  8.     $chartData[]=[
  9.         'label'=>$value->sungai,
  10.         'value'=>$value->Nilai_pij
  11.     ];
  12.         // label_thread_sungai.push('<?= $value->sungai  ');
  13.         // data_thread_pij.push('<?= $value->Nilai_pij  ');
  14. endforeach;
  15.  
  16. ?>
  17.  /*
  18.  const chartData = [{
  19.         "label": "Venezuela",
  20.         "value": "290"
  21.     }
  22.     ]
  23. */
  24.  
  25.     const chartData = <?=json_encode($chartData);?> ;
  26.  
  27.     // const chartData = {
  28.     //     datasets: [{
  29.     //         "label": label_thread_sungai,
  30.     //         "value": data_thread_pij
  31.     //     }],
  32.     //     labels: label_thread_sungai,
  33.     // }
  34.  
  35.     //STEP 3 - Chart Configurations
  36.     const chartConfig = {
  37.         type: 'column3d',
  38.         renderAt: 'chart-container',
  39.         width: '100%',
  40.         height: '400',
  41.         dataFormat: 'json',
  42.         dataSource: {
  43.             // Chart Configuration
  44.             "chart": {
  45.                 "caption": "Countries With Most Oil Reserves [2017-18]",
  46.                 "subCaption": "In MMbbl = One Million barrels",
  47.                 "xAxisName": "Country",
  48.                 "yAxisName": "Reserves (MMbbl)",
  49.                 "numberSuffix": "K",
  50.                 "theme": "fusion",
  51.             },
  52.             // Chart Data
  53.             data: chartData
  54.         }
  55.     };
  56.  
  57.  
  58.     FusionCharts.ready(function() {
  59.         var fusioncharts = new FusionCharts(chartConfig);
  60.         fusioncharts.render();
  61.     });
  62. </script>
  63.  
Add Comment
Please, Sign In to add comment