Google Charts

svyGCharts Google charts component for NG client

The Google charts (svyGCharts) component is a simple wrapper for the google charts API (see https://developers.google.com/chart/).

Here is a little example. This code

var data = [
     ['Genre', 'Fantasy & Sci Fi', 'Romance', 'Mystery/Crime', 'General', 'Western', 'Literature', 
          { role: 'annotation' }],
     ['2010', 10, 24, 20, 32, 18, 5, ''],
     ['2020', 16, 22, 23, 30, 16, 9, ''],
     ['2030', 28, 19, 29, 30, 12, 13, '']
];
var options = {
     width: 800,
     height: 600,
     legend: { position: 'top', maxLines: 3 },
     bar: { groupWidth: '75%' },
     isStacked: true
};
elements.svygooglecharts.drawChart('BarChart', data, options);

will create this chart

Table of contents

svyGCharts properties

The component has the following properties:

ChartSelection type

ChartSelection is a component specific javascript type returned as an Array of such by getSelection or most of the events with the following properties:

svyGCharts API

drawChart

Draws a chart of the given type using the given data and options.

Params

Returns void

For chart types, the proper way to provide data and possible options see the documentation for the chart type you want at https://developers.google.com/chart/interactive/docs/quick_start.

As options you can provide exactly the options that a specific chart supports. There is one special property on the options that you can set called "firstRowIsData". That controls whether the first row of the data defines a header row or not. If true, all rows are assumed to be data. If false, the first row is assumed to be a header row, and the values are assigned as column labels. Default is false.

getSelection

Gets the current selection of the chart as a ChartSelection array

Params none

Returns Array<ChartSelection>

setSelection

Sets the selection of the chart of the given row and column

Params

Returns void

setValue

Sets the given value of the given row and column and updates the chart

Params

Returns void

svyGCharts events

Last updated