首页 > 解决方案 > Charts from user input

问题描述

hi i want to modify this chart values by user input , but i have problems by getting array value from user input . when i`m trying to assing a variable to array chart is not getting it. i tried

This is my code

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

      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Ab', 'Vanzari', 'Cheltuieli', 'Profit'],
          ['2018', 1000, 400, 200],
          ['2019', 1170, 460, 250],
          ['2020', 660, 1120, 300],
          ['2021', 1030, 540, 350]
        ]);

        var options = {
          chart: {
            title: 'Performanta Firmei',
            subtitle: 'Vanzari, Cheltuieli, Si Profit Profit: 2018-2021',
          }
        };

        var chart = new google.charts.Bar(document.getElementById('columnchart_material'));

        chart.draw(data, google.charts.Bar.convertOptions(options));
      }

      
    </script>





  </head>
  <body>
    <div id="columnchart_material" style="width: 800px; height: 500px;"></div>
  </body>
</html>

        
            
        </main>
        <?php include("includes/sidebar.php")?>
    <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
    <script src="script.js"></script>
    
       
</body>

标签: charts

解决方案


推荐阅读