google-charts
ES6 Google Charts Module that allows asynchronous loading
Installation
yarn add -D google-charts
or
npm i -D google-charts
Quick Start
; //Load the charts library with a callbackGoogleCharts; { // Standard google charts functionality is available as GoogleCharts.api after load const data = GoogleChartsapivisualization; const pie_1_chart = document; pie_1_chart;}
Advanced Usage
; //Load the 'corecharts'. You do not need to provide that as a type.GoogleCharts; /* * Load a specific type(s) of chart(s). You can call this as many times as you need from anywhere in your app* GoogleCharts is a singleton and will not allow the script to be loaded more than once* The mapsApiKey is only required for certain GeoCharts*/GoogleCharts; { /* Pie chart 1 */ const pie_1_data = GoogleChartsapivisualization; const pie_1_options = pieHole: 08 pieSliceTextStyle: color: 'black' slices: 0: color: '#7ec252' 1: color: '#a4ce57' 2: color: '#cfe4ad' legend: position: 'bottom' textStyle: color: 'black' fontSize: 13 fontName: 'EncodeSans' title: 'Chart 1' titleTextStyle: color: 'black' fontSize: 13 fontName: 'EncodeSans' chartArea: left: 0 top: 0 width: '100%' height: '80%' pieSliceText: 'none' ; const pie_1_chart = document; pie_1_chart; /* Column chart 1 */ const col_1_data = GoogleChartsapivisualization; const col_1_options = legend: position: 'bottom' textStyle: color: 'black' fontSize: 13 fontName: 'EncodeSans' bar: groupWidth: '25%' colors: '#808e97' '#b9c3ca' '#dde4e8' isStacked: true chartArea: left: 0 top: 0 width: '100%' height: '80%' axisTitlesPosition: 'none' hAxis: textPosition: 'none' gridlines: color: 'transparent' baselineColor: 'transparent' vAxis: textPosition: 'none' gridlines: color: 'transparent' baselineColor: 'transparent' ; const col_1_chart = document; col_1_chart;} { /* Geo Chart */ const geo_1_data = GoogleChartsapivisualization; const geo_1_options = region: 'US' resolution: 'provinces' is3D: true legend: numberFormat:'$###,###' const geo_1_chart = document; geo_1_chart;}