Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(847)

Side by Side Diff: dart/third_party/pkg/js/example/google-chart/bubblechart.dart

Issue 57393002: Version 0.8.10.2 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 // A JS Interop sample accessing the Google Charts API. The sample is based on
6 // the Bubble Chart example here:
7 // https://developers.google.com/chart/interactive/docs/gallery/bubblechart
8
9 import 'dart:html';
10 import 'package:js/js.dart' as js;
11
12 void drawVisualization() {
13 var gviz = js.context.google.visualization;
14
15 // Create and populate the data table.
16 var listData = [
17 ['ID', 'Life Expectancy', 'Fertility Rate', 'Region', 'Population'],
18 ['CAN', 80.66, 1.67, 'North America', 33739900],
19 ['DEU', 79.84, 1.36, 'Europe', 81902307],
20 ['DNK', 78.6, 1.84, 'Europe', 5523095],
21 ['EGY', 72.73, 2.78, 'Middle East', 79716203],
22 ['GBR', 80.05, 2, 'Europe', 61801570],
23 ['IRN', 72.49, 1.7, 'Middle East', 73137148],
24 ['IRQ', 68.09, 4.77, 'Middle East', 31090763],
25 ['ISR', 81.55, 2.96, 'Middle East', 7485600],
26 ['RUS', 68.6, 1.54, 'Europe', 141850000],
27 ['USA', 78.09, 2.05, 'North America', 307007000]
28 ];
29
30 var arrayData = js.array(listData);
31
32 var tableData = gviz.arrayToDataTable(arrayData);
33
34 var options = js.map({
35 'title': 'Correlation between life expectancy, fertility rate and population of some world countries (2010)',
36 'hAxis': {'title': 'Life Expectancy'},
37 'vAxis': {'title': 'Fertility Rate'},
38 'bubble': {'textStyle': {'fontSize': 11}}
39 });
40
41 // Create and draw the visualization.
42 var chart = new js.Proxy(gviz.BubbleChart,
43 query('#visualization'));
44 chart.draw(tableData, options);
45 }
46
47 main() {
48 js.context.google.load('visualization', '1', js.map(
49 {
50 'packages': ['corechart'],
51 'callback': new js.Callback.once(drawVisualization)
52 }));
53 }
OLDNEW
« no previous file with comments | « dart/third_party/pkg/js/codereview.settings ('k') | dart/third_party/pkg/js/example/google-chart/bubblechart.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698