Show Values Google LineChart

30 views
Skip to first unread message

Ricardo Milbrath

unread,
Oct 23, 2018, 1:33:37 PM10/23/18
to Google Visualization API

I need the values ​​of each point to appear when the graph is loaded, without having to move the mouse to appear and show the result of the point, follow image and the code of the graph

Capturar.PNG

And Code: 

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
      google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawChart);

    
      function drawChart() {
                     
      
        var data = google.visualization.arrayToDataTable([
          ['', 'Limite', 'Resultado'],                                                                      
                     <?php

      while (($array = oci_fetch_array($stmt, OCI_BOTH)) != false) {
               $mes= $array["MES"];
               $limite_1 = $array["LIMITE"];
               $realizado_1 = $array["REALIZADO"];
                                     
               $realizado = str_replace(",",".", $realizado_1);
               $limite = str_replace(",",".", $limite_1);
                                     
              ?>                               
                                        
         
          ['<?php echo $mes ?>',<?php echo $limite ?>,<?php echo $realizado ?>],

         <?php } ?>
        ]);
        
        var options = {
          title: '% Quebra Financeira Açougue',
          curveType: 'function',
          legend: { position: 'bottom' }
          
        };
        
        var chart = new google.visualization.LineChart(document.getElementById('curve_chart1'));

        chart.draw(data, options);
      }
    </script>


:)


Capturar.PNG

Ricardo Milbrath

unread,
Oct 25, 2018, 9:51:10 AM10/25/18
to Google Visualization API
I add role : annotation ! :D
Reply all
Reply to author
Forward
0 new messages