Nubie starting here

53 views
Skip to first unread message

Gabriel Gratival

unread,
Mar 27, 2021, 10:49:19 AMMar 27
to Google Visualization API
I want to use a Sankey's Diagram that I configured in jsfiddle in a google sheet. But it is not working, dont know for sure why.

This is what I'm typing in: 

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

      function drawChart() {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'From');
        data.addColumn('string', 'To');
        data.addColumn('number', 'Weight');
        data.addRows([
    [ 'Intenções', 'Intenções Aprovadas', 483 ],
[ 'Intenções', 'Reprovados SERASA', 422],
          [ 'Reprovados SERASA', 'Assinadas', 0.1],
          [ 'Intenções Aprovadas', 'Canceladas', 248 ],
[ 'Intenções Aprovadas', 'Assinadas', 235 ],
          [ 'Canceladas', 'Instaladas', 0.1 ],
          [ 'Assinadas', 'Quebras', 25 ],
          [ 'Assinadas', 'Instaladas', 210 ],
        ]);

        var colors = ['#b2df8a', '#b2df8a', '#FBAEAE', '#b2df8a', '#FBAEAE', '#b2df8a', '#FBAEAE' ];
        
       
       // Sets chart options.
        var options = {
          width: 800,
          sankey: { 
          node: { colors: colors, nodePadding: 10, width:50 },
          link: { colorMode: 'gradient', colors: colors}
            }
        };

        // Instantiates and draws our chart, passing in some options.
        var chart = new google.visualization.Sankey(document.getElementById('sankey_basic'));
        chart.draw(data, options);
      }

Charles Friedo

unread,
Jul 1, 2021, 6:34:59 AMJul 1
to Google Visualization API
Dear Gabriel,

You can create Sankey diagram directly in Google Sheets with data visualization add-on.

ChartExpo™ can create 50+ custom charts from few clicks without coding.
You can export chart code or diagram in any format.

Installation Source:
Reply all
Reply to author
Forward
0 new messages