There is no zoom completed callback.  But setting up the 'ready' listener
does seem to work for me.  You have to do it after the chart is recreated,
since it applies to that chart.   Like this:

        // Must recreate the chart, to reenable the explorer mode.
        chart = new
google.visualization.ColumnChart(document.getElementById('my_chart'));
        google.visualization.events.addOneTimeListener(chart, 'ready',
          function(){
            console.info('setSelection', sel);
            chart.setSelection([sel]);
        });
        google.visualization.events.addListener(chart, 'select',
showHideSeries);

See:  https://jsfiddle.net/dlaliberte/7accj9sm/7/

On Wed, Aug 2, 2017 at 4:47 PM, vlad <[email protected]> wrote:

> The OneTimeListener idea is great.  It appears, though, the listener setup
> would be better placed in zoom call-back, as it has no effect inside the
> select callback.
>
> Any way to get that zoom event exposed?
>
>
> On Wednesday, August 2, 2017 at 4:31:56 PM UTC-4, Daniel LaLiberte wrote:
>>
>>
>> For the first problem, you can add a oneTimeListener after the chart is
>> 'ready' to reselect the same thing:
>>
>>         google.visualization.events.addOneTimeListener(chart, 'ready',
>>           function(){
>>             console.info('setSelection', sel);
>>             chart.setSelection([sel]);
>>         });
>>
>> For the second problem, this is currently difficult to workaround and
>> maybe not worth the trouble.  You'd have to grab the viewWindow after each
>> change (by polling, or perhaps only when a series is selected), and use
>> that in the recreated chart.  See getChartAreaBoundingBox for the method
>> you would need to use.
>>
>>
>> On Wed, Aug 2, 2017 at 4:17 PM, vlad <[email protected]> wrote:
>>
>>> This is great help, thanks Daniel!
>>>
>>> Two things are still failing after the fix:
>>>
>>> 1.  When one series is hidden and zoom is performed, the zooming in on
>>> data for visible series happens, but the legend state is reset from crossed
>>> out to "normal".
>>> 2.  When zoomed in and attempting to "hide" a series, it hides, but the
>>> viewable window is reset.
>>>
>>> How do I overcome these?
>>>
>>> On Wednesday, August 2, 2017 at 3:54:47 PM UTC-4, Daniel LaLiberte wrote:
>>>>
>>>> This problem (broken explorer mode) is a bug that came up in the last
>>>> release.  There is no workaround other than to recreate the chart (new
>>>> ColumnChart).  You can see this by adding, before your chart.draw() call in
>>>> showHideSeries:
>>>>
>>>>         // Must recreate the chart, to reenable the explorer mode.
>>>>         chart = new google.visualization.ColumnCha
>>>> rt(document.getElementById('my_chart'));
>>>>         google.visualization.events.addListener(chart, 'select',
>>>> showHideSeries);
>>>>
>>>> You can see this here: https://jsfiddle.net/dlaliberte/7accj9sm/5/
>>>>
>>>>
>>>> On Wed, Aug 2, 2017 at 3:23 PM, vlad <[email protected]> wrote:
>>>>
>>>>> I have made a sample chart here (https://jsfiddle.net/vzelenko
>>>>> /7accj9sm/) that indicates the problem I am facing.
>>>>>
>>>>> The chart offers a script that hides/shows data series by clicking on
>>>>> the legend.  It also supports pan/zoom functionality on hAxis.  After the
>>>>> click to hide data is made, the pan/zoom resets the view and no longer
>>>>> works.  Hide/show still works (more or less.)
>>>>>
>>>>> Any help with how to restore pan/zoom would be appreciated.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> - vlad
>>>>>
>>>>> --
>>>>> 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 https://groups.google.com/grou
>>>>> p/google-visualization-api.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/google-visualization-api/
>>>>> 2987351f-e1f4-4663-b15e-f37e49a2114d%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/google-visualization-api/2987351f-e1f4-4663-b15e-f37e49a2114d%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Daniel LaLiberte
>>>> <https://plus.google.com/100631381223468223275?prsrc=2>
>>>> [email protected]   5CC, Cambridge MA
>>>>
>>> --
>>> 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 https://groups.google.com/grou
>>> p/google-visualization-api.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/google-visualization-api/d87f9c89-5162-49fe-a9a5-46e3c3
>>> 9eb29a%40googlegroups.com
>>> <https://groups.google.com/d/msgid/google-visualization-api/d87f9c89-5162-49fe-a9a5-46e3c39eb29a%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
>> [email protected]   5CC, Cambridge MA
>>
> --
> 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 google-visualization-api@
> googlegroups.com.
> Visit this group at https://groups.google.com/
> group/google-visualization-api.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/google-visualization-api/5380e84d-7991-4e45-8704-
> 6f014bba63ac%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/5380e84d-7991-4e45-8704-6f014bba63ac%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
[email protected] <[email protected]>   5CC, Cambridge MA

-- 
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 https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJNxXd68-udkkM%2BP0upC207gPMH8ackKkdZZydVYXNhRcQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to