I'm not sure if this is a bug, but I am unable to determine the cause
of it or get it to stop happening. I found that a click on ANY square
in the legend causes the first column of the Column Chart to become
selected/deselected depending on its initial state. I have an alert
popping up right now, and I can tell you that it does not give a row
or a column number when the click is in the legend. It does give a row
and column if the click is on the actual column. I am using GWT to
code the visualization. Here is my selection handler: Let me know if
you need the table code as well. Thanks!
    private SelectHandler createSelectHandler(final ColumnChart chart)
{
        return new SelectHandler() {

            @Override
            public void onSelect(SelectEvent event) {

                 String message = "Selected: ";
                int column = 0;
                int row = 0;
                // May be multiple selections.
                JsArray<Selection> selections = chart.getSelections();

                for (int i = 0; i < selections.length(); i++) {
                    // add a new line for each selection
                    message += i == 0 ? "" : "\n" + " i " + i;
                    Selection selection = selections.get(i);
                    // message += " i is " + 1;

                    if (selection.isCell()) {

                        row = selection.getRow();
                        column = selection.getColumn();
                        //Window.alert("selected row " + row + "
selected column " + column );
                         message += "row is: " + row + ":" + column +
" columns selected " + i + " is i's value";

                    } else if (selection.isRow()) {
                        row = selection.getRow();
                        message += "row " + row + " selected";

                    }

                }//end for

//the code below is probably irrelevant. It is used to communicate
with other widgets and pass selections
                //get ids of selected fixes
                ArrayList<String> idlist = new ArrayList<String>();
                ArrayList<String> idmapcol = idmap.get(column);
                idlist.addAll(idmapcol);

                //add old ids
                if ((oldids != null) && (!oldids.isEmpty())) {
                    //if oldids contains any of the new selections,
deselect
                    for (String i : idlist) {
                        if (oldids.contains(i)) {
                            oldids.removeAll(idlist);
                            idlist.clear();
                        }
                    }
                    //add ids that are still selected
                    for (String d : oldids) {
                        idlist.add(d);
                    }
                }

                //send focus message with selections
                selectedids = idlist.toArray(new
String[idlist.size()]);
                lasttime = sendSelect(selectedids);

                 Window.alert(message + " " + selectedids.toString());
            }//end onSelect
        };
    } //end createSelectHandler

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

Reply via email to