Google Charts API

Is it possible to take a table read in from File Reader and connect to this API to return a chart? I'm trying to also get a better understanding of the scope of the Google API node outside of Analytics. 

 

Hello,

Would love to know as well.

As of KNIME 2.10 you can install the KNIME JavaScript based nodes plugin, which is available under the KNIME labs extensions. After installing find the 'Generic JavaScript View' node. This node allows you to provide your own CSS and JavaScript to code a view.

I did a little proof of concept for the Google Charts API for you. A couple pointers: ​ 

  • The Google API is loaded with jQuery, so select jQuery as a dependency.
  • The generally used google.setOnLoadCallback() does not work with this approach. Setting the callback directly in the google.load method does the trick.
  • At the moment the node does not have an image outport to pass on the generated SVG to the workflow. We plan to add that feature in the future.

Below is a basic example, which I took of the Chart Gallery and adapted it to work with dynamic loading.

$('body').append('<div id="chart_div"></div>');

drawChart = function() {
	var data = google.visualization.arrayToDataTable([
          ['Country', 'Popularity'],
          ['Germany', 200],
          ['United States', 300],
          ['Brazil', 400],
          ['Canada', 500],
          ['France', 600],
          ['RU', 700]
        ]);

        var options = {};

        var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));

        chart.draw(data, options);
}

$.getScript('https://www.google.com/jsapi')
  .done(function( script, textStatus ) {
    google.load('visualization', '1', {packages:['corechart'], callback:drawChart});
  })
  .fail(function( jqxhr, settings, exception ) {
    alert("Loading Google API failed.");
});
html, body, #chart_div {
	width: 100%;
	height: 100%;
	margin: 0;
}

#chart_div {
	overflow: hidden;
}

Looks like the URL in the JavaScript code block automatically got converted into a link.

Line 21 should be:
$.getScript('https://www.google.com/jsapi')