Thanks,

I'm not too clear on what you said, "you can call setSelection([]) in each
event of selection".

    function selectHandler() {
        var selection = pieChart.getSelection();
        var message = null;
        for (var i = 0; i < selection.length; i++) {
            var item = selection[i];
            if (item.row != null && item.column != null) {
              message += '{row:' + item.row + ',column:' + item.column +
'}';
            } else if (item.row != null) {
              message += '{row:' + item.row + '}';
            } else if (item.column != null) {
              message += '{column:' + item.column + '}';
            }
        }
        if (message == '') {
            message = 'nothing';
        }
        alert('You selected ' + message);

    }


On Mon, Sep 21, 2009 at 9:16 AM, Bug Chart <bugch...@google.com> wrote:

> Hi.
> When a legend item is clicked, the relevant selected object contains only
> the 'row' property of the relevant series. So by looking at the 'row'
> property only, there is no difference between clicking on the legend or on a
> pie slice.
>
> An additional problem that you might encounter is that the getSelection
> method returns an array of selected objects. If you want this method to
> always return the last pressed item, you can call setSelection([]) in each
> event of selection. This way, on each new select event, exactly one object
> would be in the getSelection array and its 'row' property would indicate the
> corresponding element that was just pressed.
>
> Hope that helps in creating the desired behavior.
>
> BTW: As your question regards the Google Visualization API and not Google
> Chart API, you should have asked this in
> the Google Visualization API Group (
> http://groups.google.com/group/google-visualization-api)
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Chart API" group.
To post to this group, send email to google-chart-api@googlegroups.com
To unsubscribe from this group, send email to 
google-chart-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-chart-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to