getImageURI is not defined for google.charts.Bar

0

Could you help me? It appears is the error that is not an undefined function when I use google.charts.Bar, I need to convert the graphic into an image to download it in pdf.

    
asked by marco orozco 11.07.2018 в 20:45
source

1 answer

0
//este es mi codigo   
//Grafia en barra
    function chartBar(arrayReport, titulo, grafica_id, tipo, id_export){
        google.charts.load('current', {packages: ['corechart','bar']});
        google.charts.setOnLoadCallback(function(){ drawChartBar(arrayReport, titulo, grafica_id, tipo, id_export) });
    }

    //Inicia grafica de barra
    function drawChartBar(json_data, titulo, grafica_id, tipo, id_export){

            var data = google.visualization.arrayToDataTable(json_data);

            var options = {
                width:1000,
                height:300,
                chart: {
                    title: titulo,
                  },
                chartArea: {width: '60%'},
                hAxis: {
                  minValue: 0,
                  format: '0'
                },
                bars: 'horizontal' // Required for Material Bar Charts.
            };

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

            google.visualization.events.addListener(chart, 'ready', function () {
                imgUrls[id_export].push(chart.getImageURI());
            });
            chart.draw(data,options);
    }
    
answered by 11.07.2018 в 21:18