Skip to content

Instantly share code, notes, and snippets.

@shailen
Created October 25, 2013 03:58
Show Gist options
  • Save shailen/7149267 to your computer and use it in GitHub Desktop.
Save shailen/7149267 to your computer and use it in GitHub Desktop.
import 'dart:html';
import 'dart:js';
void main() {
JsObject google = context['google'];
google.callMethod('load', ['visualization', '1',
new JsObject.jsify({'packages': ['corechart']})]);
google.callMethod('setOnLoadCallback', [() {
var data = google['visualization'].callMethod('arrayToDataTable',
new JsObject.jsify([
['Year', 'Sales', 'Expenses'],
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540]]));
var options = new JsObject.jsify({'title': 'Company Performance'});
var chart = new JsObject(google['visualization']['LineChart'],
[querySelector('#chart_div')]);
chart.callMethod('draw', [data, options]);
}]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment