Sankey: setAction is not a function

170 views
Skip to first unread message

Gyula Kósa

unread,
Jun 17, 2021, 7:50:43 AM6/17/21
to Google Visualization API
Hi! I'm following the developer guide at https://developers.google.com/chart/interactive/docs/customizing_tooltip_content#full.

I get 'Sankey chart.html:66 Uncaught (in promise) TypeError: chart.setAction is not a function' error in the browser console for the following implementation.

I'm wondering what do I wrong?

    <script type="text/javascript">
        google.charts.load("current", {packages:['sankey', 'wordtree']});
        
        google.charts.setOnLoadCallback(drawSankeyChart);

        function drawSankeyChart() {
          var data = new google.visualization.DataTable();
          data.addColumn('string', 'From');
          data.addColumn('string', 'To');
          data.addColumn('number', 'Weight');
          data.addRows([
            ...
          ]);
      
          // Set chart options
          var options = {
            width: 1000,
            tooltip: {
                trigger: 'selection'
            }
          };
      
          var chart = new google.visualization.Sankey(document.getElementById('sankey_multiple'));
      
          chart.setAction({
                id: 'remove',
                text: 'Remove',
                action: function() {
                    selection = chart.getSelection();
                    alert(selection[0].row + 'will be removed');
                    }
                });

            chart.draw(data, options);
         };
...

Charles Friedo

unread,
Jun 29, 2021, 6:10:59 AM6/29/21
to Google Visualization API
Hello,

You can create Sankey chart without coding in Google Sheets and Excel.

ChartExpo™ is a data visualization tool with 50+ custom chart types.

You can make charts with few clicks..
Sharing video on How to create Sankey diagram

Installation Sources:

Claus Hack

unread,
Nov 8, 2021, 3:44:24 PM11/8/21
to Google Visualization API
Hi, 
i don't know if you still need it, but setAction is probably not compatible with sankey. The documentation is misleading. 

visio chart

unread,
Nov 1, 2024, 4:01:05 PMNov 1
to Google Visualization API
Hi,

If you are looking to create a Sankey Diagram online or in Microsoft Power BI then try VisioChart they offer 10 level of Sankey Diagram on Power BI and web platform.

Reply all
Reply to author
Forward
0 new messages