Skip to content
Patrick Ruhsert edited this page Feb 17, 2017 · 17 revisions

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

Table of contents

svyGCharts properties

The component has the following properties:

Property Type Default Description

| enabled | Boolean | true | The enable state of the component, default true. | | readOnly | dataprovider | false | The readonly state of the component, default false. | | styleClass | String | null | Additional style class(es) of the component | | visible | Boolean | true | The visible property of the component, default true. |

svyGCharts API

Method Params Return Description
drawChart type:String, data:Array>, options:Object Draws a chart of the given type using the given data and options
getSelection ChartSelection[] Gets the current selection of the chart as a ChartSelection array
setSelection row:Number, column:Number Sets the selection of the chart of the given row and column
setValue row:Number, column:Number, value:Object Sets the given value of the given row and column and updates the chart

drawChart

Params

Type Name Description Required
String type The chart type e.g. 'BarChart', 'ScatterChart', 'ColumnChart', 'PieChart' Required
Array data The data to show Required
Object options The chart options Required

Returns void

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

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

Params none

Returns ChartSelection[]

Gets the current selection of the chart as a ChartSelection array

setSelection

Params

Type Name Description Required
Number row row or null if the whole row should be selected Required
Number column column or null if the whole column should be selected Required

Returns void

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

setValue

Params

Type Name Description Required
Number row row number Required
Number column column number Required
Number value value Required

Returns void

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

svyGCharts events

Event Params Return Description
onAction event:JSEvent Method that is executed when the enter key is hit.
onDataChange oldValue:String, newValue:String, event:JSEvent Boolean Method that is executed when the data in the component is successfully changed.
onFocusGained event:JSEvent The method that is executed when the component gains focus.
onFocusLost event:JSEvent The method that is executed when the component looses focus.
onRightClick event:JSEvent The method that is executed when a right click occurs in the text field.
Clone this wiki locally