Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter dulicanazi

    (@dulicanazi)

    Still not working … this is the complete code from my HTML content field

    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
          function drawChart() {
    
            var data = google.visualization.arrayToDataTable([
              ['Task', 'Hours per Day'],
              ['Sitting',     [jQuery('.wsval input').val()]],
              ['Running',    [jQuery('.testval input').val()]]
            ]);
    
            var options = {
              title: 'My Daily Activities'
            };
    
            var chart = new google.visualization.PieChart(document.getElementById('piechart'));
    
            chart.draw(data, options);
          }
        </script>
    <div id="piechart"></div>

    And at onClick action button i have set up this:

    google.charts.load('current', {'packages':['corechart']});
    google.charts.setOnLoadCallback(drawChart);

    This is the complete code example from google:

    <html>
      <head>
        <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([
              ['Task', 'Hours per Day'],
              ['Work',     11],
              ['Eat',      2],
              ['Commute',  2],
              ['Watch TV', 2],
              ['Sleep',    7]
            ]);
    
            var options = {
              title: 'My Daily Activities'
            };
    
            var chart = new google.visualization.PieChart(document.getElementById('piechart'));
    
            chart.draw(data, options);
          }
        </script>
      </head>
      <body>
        <div id="piechart" style="width: 900px; height: 500px;"></div>
      </body>
    </html>

    I dont know why is not working … i am doing something wrong ?

    Thread Starter dulicanazi

    (@dulicanazi)

    I tried it but not working the … if i leave only one value in the function it will work and show me 100% and the actual field value but if i got more than 1 value it will not work anymore … what could be the problem if you can help me

    Thread Starter dulicanazi

    (@dulicanazi)

    function drawChart() {
            var data = google.visualization.arrayToDataTable([
              ['Task', 'Hours per Day'],
              ['Work',    'fieldname1'],
              ['Eat',      2],
              ['Commute',  2],
              ['Watch TV', 2],
              ['Sleep',    7]
            ]);
    
            var options = {
    backgroundColor: 'transparent',
              title: 'My Daily Activities'
            };
    
            var chart = new google.visualization.PieChart(document.getElementById('piechart'));

    i want to insert the field value here [‘Work’, ‘fieldname1’], how can i do that

    Thread Starter dulicanazi

    (@dulicanazi)

    thanks it’s working you are great !!

    dulicanazi

    (@dulicanazi)

    You can try using a <table></table> with 9 column

Viewing 5 replies - 1 through 5 (of 5 total)