setState() on a ChartRangeFilter via a button

1,244 views
Skip to first unread message

Lionel Garnier

unread,
Aug 23, 2012, 11:51:06 AM8/23/12
to google-visua...@googlegroups.com
Hello again

I am moving forward but I am facing a new issue...
On my page I have a ChartRangeFilter and I want to modify the range when clicking on a button (button id is "ChangeRange").

I am using the following code:

[...]

var chartselect = new google.visualization.ChartRangeFilter(document.getElementById('chartselect'));
        chartselect.draw(data, options);
[...]

document.getElementById('ChangeRange').onclick = function(){
chartselect.setState({'range': {'start': 3, 'end': 5}});
chartselect.draw();
};

I made some tests and the function is triggered when clicking the button. But unfortunately, the range is not moving..!
I checked and when using the getState() in the same function it works, I can retrieve the selected start and end. But I don't really understand how to use the setState().

=> Do you know what is wrong in my piece of code?

Thanks for your feed back and remarks :)

asgallant

unread,
Aug 23, 2012, 1:44:47 PM8/23/12
to google-visua...@googlegroups.com
It works just fine when I do it: http://jsfiddle.net/asgallant/jNVzF/ 

visigoth

unread,
Aug 26, 2012, 3:50:14 AM8/26/12
to google-visua...@googlegroups.com
What browser are you using?

Wild guess here - try loading package 'corechart' in addition to 'controls'.
Although according to the API loading 'controls' is enough, in practice we have a bug where setting an initial state sometimes doesn't affect the target chart (it depends on how quickly the browser manages to dynamically load 'corechart').

If this doesn't work, please attach sample code for us to debug.

Lauren Langley

unread,
Apr 5, 2013, 3:17:17 PM4/5/13
to google-visua...@googlegroups.com
Just wanted to say thanks for this post. It helped me resolve a year-old issue with resetting the control thumbs!

Grateful,
Lauren
Reply all
Reply to author
Forward
0 new messages