modifying options of a ChartWrapper

124 views
Skip to first unread message

Philippe Ribeiro

unread,
Jun 10, 2012, 11:40:09 AM6/10/12
to Google Visualization API
Hi All, I'm currently using ChartWrapper and ControlWrapper to develop
some utilities in a project I have been working on.
let me use this example from Controls and Dashboards from the example:
var pieChart = new google.visualization.ChartWrapper({
'chartType': 'PieChart',
'containerId': 'chart_div',
'options': {
'width': 300,
'height': 300,
'pieSliceText': 'value',
'legend': 'right'
}
});

I know pieChart is of the type ChartWrapper, but I'm using a PieChart
object to draw the chart. Now, how do I do to set up the options of
the PieChart object, and not of the ChartWrapper?
I tried to use getChart, but that always returned me null. I suppose
ChartWrapper has an object of the type PieChart. If somehow I could
access that object, so I could set up some options to fullfil my
needs.
Does someone know how to do it?

visigoth

unread,
Jun 11, 2012, 5:26:13 AM6/11/12
to google-visua...@googlegroups.com
Hi Philippe,

I am not sure I understand the problem exactly.
The 'options' parameter in the ChartWrapper constructor is passed to the underlying chart as is.
If you want to make it 3D for example, simple add 'is3D': true to the options.
To set an option after construction, use the setOption(key, value) method of ChartWrapper. It too passes the option directly to the chart.
Documentation for the ChartWrapper is available here.

HTH,
Visigoth
Reply all
Reply to author
Forward
0 new messages