File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -364,7 +364,6 @@ <h2>Chart gallery</h2>
364364
365365 < google-chart
366366 type ="sankey "
367- options ='{"title": "Distribution of days in 2001H1"} '
368367 cols ='[{"label": "From", "type": "string"},
369368 {"label": "To", "type": "string"},
370369 {"label": "Weight", "type": "number"}] '
@@ -444,6 +443,31 @@ <h2>Chart gallery</h2>
444443 } ( ) ) ;
445444 </ script >
446445
446+ < p > Here's a wordtree:</ p >
447+
448+ < google-chart
449+ type ="wordtree "
450+ data ='[["Phrases"],
451+ ["cats are better than dogs"],
452+ ["cats eat kibble"],
453+ ["cats are better than hamsters"],
454+ ["cats are awesome"],
455+ ["cats are people too"],
456+ ["cats eat mice"],
457+ ["cats meowing"],
458+ ["cats in the cradle"],
459+ ["cats eat mice"],
460+ ["cats in the cradle lyrics"],
461+ ["cats eat kibble"],
462+ ["cats for adoption"],
463+ ["cats are family"],
464+ ["cats eat mice"],
465+ ["cats are better than kittens"],
466+ ["cats are evil"],
467+ ["cats are weird"],
468+ ["cats eat mice"]
469+ ] '> </ google-chart >
470+
447471 < p > Here are three gauges:</ p >
448472
449473 < google-chart
Original file line number Diff line number Diff line change 99 /** @type {string } Most charts use this package. */
1010 var DEFACTO_CHART_PACKAGE = 'corechart' ;
1111
12+ /** @enum {string} Namespaces that contain chart constructors. */
13+ var Namespace = {
14+ CHARTS : 'charts' ,
15+ VIS : 'visualization'
16+ } ;
17+
1218 /**
1319 * A collection of chart type details.
1420 *
2834 'bubble' : {
2935 ctor : 'BubbleChart' ,
3036 } ,
37+ 'calendar' : {
38+ ctor : 'Calendar' ,
39+ pkg : 'calendar' ,
40+ } ,
3141 'candlestick' : {
3242 ctor : 'CandlestickChart' ,
3343 } ,
3747 'combo' : {
3848 ctor : 'ComboChart' ,
3949 } ,
50+ 'gauge' : {
51+ ctor : 'Gauge' ,
52+ pkg : 'gauge' ,
53+ } ,
4054 'geo' : {
4155 ctor : 'GeoChart' ,
4256 } ,
7993 ctor : 'Timeline' ,
8094 pkg : 'timeline' ,
8195 } ,
82- 'gauge' : {
83- ctor : 'Gauge' ,
84- pkg : 'gauge' ,
85- } ,
8696 'treemap' : {
8797 ctor : 'TreeMap' ,
8898 pkg : 'treemap' ,
8999 } ,
90- 'calendar' : {
91- ctor : 'Calendar' ,
92- pkg : 'calendar' ,
100+ 'wordtree' : {
101+ ctor : 'WordTree' ,
102+ namespace : Namespace . VIS ,
103+ pkg : 'wordtree' ,
93104 }
94105 } ;
95106
96107 /**
97- * Returns the namespace for the given chart type.
108+ * The Google Charts constructor namespace inferred from the given chart type.
98109 * @param {string } type the type of the chart
99110 * @return {!Object } the namespace that contains the chart's constructor
100111 */
101112 function namespaceForType ( type ) {
102- return google [ type . indexOf ( 'md-' ) === 0 ? 'charts' : 'visualization' ] ;
113+ return google [ type . indexOf ( 'md-' ) === 0 ? Namespace . CHARTS : Namespace . VIS ] ;
103114 }
104115
105116 /** @type {!Object<string, boolean> } set-like object of gviz packages to load */
216227 }
217228 return this . _loadPackages ( [ chartData . pkg || DEFACTO_CHART_PACKAGE ] )
218229 . then ( function ( ) {
219- return namespaceForType ( type ) [ chartData . ctor ] ;
230+ var namespace = google [ chartData . namespace ] || namespaceForType ( type ) ;
231+ return namespace [ chartData . ctor ] ;
220232 } ) ;
221233 } ,
222234
Original file line number Diff line number Diff line change 111111 * - `table`
112112 * - `timeline`
113113 * - `treemap`
114+ * - `wordtree`
114115 *
115116 * See <a href="https://google-developers.appspot.com/chart/interactive/docs/gallery">Google Visualization API reference (Chart Gallery)</a>
116117 * for details.
You can’t perform that action at this time.
0 commit comments