I try to modify the Piechart so that when the user clicks on a specific 
slice the color of the other slices are set to grey.
In order to keep the slice that was clicked selected I have to call 
setSelected() after I draw the piechart with the updated colors. 

This works fine in the playground. However when I try to do the same thing 
in GWT I get following exception: 

com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read 
property 'J' of null
at Unknown.Y.setSelection(
http://www.google.com/uds/api/visualization/1.0/3d716ed6cd3d640646e5b2629c9…/format+de,default,geochart,orgchart,motionchart+de,corechart.I.js@60:1322<http://www.google.com/uds/api/visualization/1.0/3d716ed6cd3d640646e5b2629c922551/format+de,default,geochart,orgchart,motionchart+de,corechart.I.js@60>)
 
at Unknown.Y.setSelection(
http://www.google.com/uds/api/visualization/1.0/3d716ed6cd3d640646e5b2629c9…format+de,default,geochart,orgchart,motionchart+de,corechart.I.js@430:1330<http://www.google.com/uds/api/visualization/1.0/3d716ed6cd3d640646e5b2629c922551/format+de,default,geochart,orgchart,motionchart+de,corechart.I.js@430>)
 
at Unknown.setSelections(
http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@9:160278<http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@9>)
 
at Unknown.$setSelections(
http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@3:76291<http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@3>)
 
at Unknown.execute_25(
http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@3:48443<http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@3>)
 
at Unknown.$executeScheduled(
http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@30:120671<http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@30>)
 
at Unknown.runScheduledTasks(
http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@84:120581<http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@84>)
 
at Unknown.$flushPostEventPumpCommands(
http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@5:120491<http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@5>)
 
at Unknown.execute_40(
http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@3:120644<http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@3>)
 
at Unknown.execute_39(
http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@14:120565<http://localhost:9876/browser/4B5E804E6AD1764D2DA0F9F71B52BDDF.cache.js@14>
) 

The playground code is here:
<http://savedbythegoog.appspot.com/?id=3f3a2110da942f7b954756c7e4d44a2315407cfe>
http://savedbythegoog.appspot.com/?id=3f3a2110da942f7b954756c7e4d44a2315407cfe

The GWT code looks like this: 

JsArray<Selection> selections = null;
PieChart chart = new PieChart(createEmptyDataTable(),getPieOptions());

chart.addSelectHandler(new SelectHandler() {
            @Override
            public void onSelect(SelectEvent selectEvent) {
               selections = chart.getSelections();
                greyOutSlices(selections);
            }

        });
chart.addReadyHandler(new ReadyHandler() {
    @Override
    public void onReady(ReadyEvent readyEvent) {
        if (selections != null && selections.length() != 0) {

            chart.setSelections(selections);
        }
    }
});
private void greyOutSlices(JsArray<Selection> selections) {
        pieChart.draw(dataTable,options); // draw with greyed out slices

}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to