Google charts used our app but when i call getImageURI function not working

Google charts used our app but when i call getImageURI function.Then message display
The getImageURI is not function.All liberies included but what is problem my code

code as follows:-

var my_div = document.getElementById('chart_div');
    var my_chart = new google.visualization.ChartType(chart_div);

    google.visualization.events.addListener(my_chart, 'ready', function () {
      my_div.innerHTML = '<img src="' + my_chart.getImageURI() + '">';
    });

    my_chart.draw(data);

Please suggest solution. What’s wrong with my code. i want save the chart in the image.

you need to call getImageURI() on a chart object, which you can get by calling getChart() on your my_chart entity.

my_div.innerHTML = '<img src="' + my_chart.getChart().getImageURI() + '">';

Thanks, that issue was resolved myself.

Mind leaving the sollution here then :3 might be usseful for others

I tried this solution but doesn’t work in Timeline charts, do you know why?

Any code sample to look at?

Hi,
I tried this solution but doesn’t work.

My idea would be to present a graph on the page, which is working, and save the same graph when I submit the page in a variable.

I need this chart to create a PDF report when I run the submit.

If possible to help me?

Tks!!

Code:
div class=“col-12” id=“GRAFICOCOMPARATIVO” style=“width: 800px; height: 600px;”>

script type=“text/javascript” src=“https:// www. gstatic. com/charts/loader.js”>

script type="text/javascript">

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

  google.charts.setOnLoadCallback(drawChart);

           

  function drawChart() {

    var data = google.visualization.arrayToDataTable([

     ['Perguntas' <?php

                       $k = $i;

                       for ($row = 0; $row < $k; $row++)

                       {  

                          echo ",'". $ListaTipos[$row] . " - " . $ListaFases[$row] . "'";

                       } ?>],

                    <?php

                       $k = $i;

                       for ($col = 0; $col < 9; $col++)

                       { ?>

                          ['P<?php echo $col+1;?>' <?php   

                          for ($row = 0; $row < $k; $row++)

                          {  

                             echo ", " . ($ListaValores[$row][$col]) ; 

                          } ?>],

                          <?php 

                       } ?>

  ]);

  var options = {

     chart: {

        title: 'Dashboard',

        subtitle: 'Auto-Avaliação vs FeedBack',

        

     }

  };

  var chart_area = document.getElementById('GRAFICOCOMPARATIVO');

  var chart = new google.charts.Bar(chart_area);

  

  google.visualization.events.addListener(chart, 'ready', function () {

     var imageURI = chart.getchart().getImageURI();

     chart_div.innerHTML = '<img alt="chart" src="' + imageURI + '" />';

     

     // send chart image

     $.ajax({

        type: 'POST',

        url: 'submit4.php',

        data: {

              'chartImage': imageURI,

            },

        success: function() {

           console.log('image sent');

        }

     });

  });

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

}

/script>

sorry for late !! :innocent:

var chart = new google.visualization.LineChart(linechart_material);
	
	google.visualization.events.addListener(chart, 'ready', function () {		
		 var img = chart.getImageURI();
		
		jQuery('#chart_image').attr('src',img); 
	 });
	chart.draw(data, options);

here is my working code