My mistake again, it should be:
var rowCount = dateFilter.getControl).applyFilter().getNumberOfRows();
On Thursday, April 10, 2014 10:10:30 AM UTC-4, Nick wrote:
>
> When I try to execute the code I get a javascript exception: Object #<Jw>
> has no method 'applyFilter'. I looked in the documentation and I can't
> find this method. Maybe there's a typo in the method name?
>
> On Wednesday, April 9, 2014 8:01:38 PM UTC-4, asgallant wrote:
>>
>> The "statechange" event fires before the chart is redrawn with the new
>> data, so you might have to take a different approach. I have not tested
>> this, and it probably won't work if you have more than one filter, but I
>> *think* this should work:
>>
>> google.visualization.events.addListener(dateFilter, 'statechange',
>> function () {
>> var rowCount = dateFilter.applyFilter().getNumberOfRows();
>> if (rowCount < 12) {
>> chart.setOption('bar.groupWidth', 15);
>> }
>> else {
>> chart.setOption('bar.groupWidth', '90%');
>> }
>> chart.draw();
>> });
>>
>>
>>
>> On Wednesday, April 9, 2014 11:32:08 AM UTC-4, Nick wrote:
>>>
>>> I noticed an issue each time the event is triggered, rowCount is equal
>>> to the number of rows not of the current but the previous selection. Do you
>>> have an idea how I could fix that?
>>>
>>> Thank you
>>>
>>> On Tuesday, April 8, 2014 8:44:49 PM UTC-4, asgallant wrote:
>>>>
>>>> Sorry, my mistake. the #getDataTable method should be a function call,
>>>> not a property:
>>>>
>>>> var rowCount = chart.getDataTable().getNumberOfRows();
>>>>
>>>> On Tuesday, April 8, 2014 12:27:11 PM UTC-4, Nick wrote:
>>>>>
>>>>> Thanks for your answers! However I still have a problem with the
>>>>> groupWidth option.. The chart.getDataTable.getNumberOfRows()
>>>>> statement returns Object function (){return this.n} has no method
>>>>> 'getNumberOfRows' I tried to several alternative ways to get the
>>>>> number of rows for the current selection of the DateRangeFilter but
>>>>> without
>>>>> any success.
>>>>>
>>>>> On Monday, April 7, 2014 4:10:19 PM UTC-4, asgallant wrote:
>>>>>>
>>>>>> Use a "statechange" event handler on the date filter to check how
>>>>>> many rows of data are in the filtered set, and change the bar.groupWidth
>>>>>> option if the number is below 12:
>>>>>>
>>>>>> google.visualization.events.addListener(dateFilter, 'statechange',
>>>>>> function () {
>>>>>> var rowCount = chart.getDataTable.getNumberOfRows();
>>>>>> if (rowCount < 12) {
>>>>>> chart.setOption('bar.groupWidth', 15);
>>>>>> }
>>>>>> else {
>>>>>> chart.setOption('bar.groupWidth', '90%');
>>>>>> }
>>>>>> chart.draw();
>>>>>> });
>>>>>>
>>>>>> The Visualization API loads with the browser's locale by default, so
>>>>>> whatever your users have set is what loads. You can force a particular
>>>>>> locale by specifying the "language" parameter in the google.load call.
>>>>>> This can only be done when the API is first loaded - you can't change
>>>>>> locale without reloading the page. See the
>>>>>> documenation<https://developers.google.com/chart/interactive/docs/library_loading_enhancements#loadwithlocale>for
>>>>>> details.
>>>>>>
>>>>>> The width of the DateRangeFilter is not configurable. You can submit
>>>>>> a feature
>>>>>> request<http://code.google.com/p/google-visualization-api-issues/issues/list>to
>>>>>> add support for that.
>>>>>>
>>>>>>
--
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.
For more options, visit https://groups.google.com/d/optout.