ChartRangeFilter Control Date Issue

94 views
Skip to first unread message

Noobie All

unread,
Aug 12, 2015, 10:37:53 PM8/12/15
to Google Visualization API

Daniel LaLiberte

unread,
Aug 13, 2015, 8:07:07 AM8/13/15
to Google Visualization API
I suspect the problem is that the filter results in no data being sent out, and then the date axis shows the default range over several years, but you are not displaying the year in your format.  Could you provide a working example that demonstrates the problem you are seeing?

On Wed, Aug 12, 2015 at 10:37 PM, Noobie All <noob...@gmail.com> wrote:

--
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 google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA

Noobie All

unread,
Aug 15, 2015, 1:37:49 PM8/15/15
to Google Visualization API
Dear Daniel

Here is a sample link. Please take a look.
http://codepen.io/noobiemania/pen/bdybgj






On Thursday, August 13, 2015 at 8:07:07 PM UTC+8, Daniel LaLiberte wrote:
I suspect the problem is that the filter results in no data being sent out, and then the date axis shows the default range over several years, but you are not displaying the year in your format.  Could you provide a working example that demonstrates the problem you are seeing?
On Wed, Aug 12, 2015 at 10:37 PM, Noobie All <noob...@gmail.com> wrote:

--
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 google-visualization-api+unsub...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.



--
dlali...@Google.com   5CC, Cambridge MA
daniel.l...@GMail.com 9 Juniper Ridge Road, Acton MA

Daniel LaLiberte

unread,
Aug 16, 2015, 10:24:55 AM8/16/15
to Google Visualization API
Thanks.  Yes, it is as I said, except only one data point is left, which results in the same problem of not knowing how far to extend the hAxis around that one point.  If you add 'yyyy' to your format, you'll see the large range of years.  

One relatively easy solution is that you can now use the AnnotationChart for this, and turn off the display of annotations.  The AnnotationChart uses a ChartRangeFilter internally, and gets the range from the range selector and applies that to the viewWindow of the chart.  That's effectively what you would need to do yourself without the AnnotationChart because otherwise the chart doesn't know what the intended range should be when you only provide it 1 point.

On Sat, Aug 15, 2015 at 1:37 PM, Noobie All <noob...@gmail.com> wrote:
Dear Daniel

Here is a sample link. Please take a look.
http://codepen.io/noobiemania/pen/bdybgj






On Thursday, August 13, 2015 at 8:07:07 PM UTC+8, Daniel LaLiberte wrote:
I suspect the problem is that the filter results in no data being sent out, and then the date axis shows the default range over several years, but you are not displaying the year in your format.  Could you provide a working example that demonstrates the problem you are seeing?
On Wed, Aug 12, 2015 at 10:37 PM, Noobie All <noob...@gmail.com> wrote:

--
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 google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.



--
dlali...@Google.com   5CC, Cambridge MA
daniel.l...@GMail.com 9 Juniper Ridge Road, Acton 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 google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA

Noobie All

unread,
Aug 17, 2015, 9:04:14 PM8/17/15
to google-visua...@googlegroups.com
Dear Daniel

Thanks for the advice, I will update you again once I worked on it.
By the way, may I asked what do you mean by "one data point is left"?


--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/2ZGk60rp7Iw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.

Daniel LaLiberte

unread,
Aug 17, 2015, 9:25:45 PM8/17/15
to Google Visualization API

As you change the chartrangefilter you are filtering the data to just the row that are within the range selected, so there are fewer data points than the whole table has.  The problem occurs once you filter out all but one row or data point.

Noobie All

unread,
Sep 16, 2015, 2:53:57 AM9/16/15
to google-visua...@googlegroups.com
Dear Daniel

The suggestion you had given did not work for my case as I have other type of charts to display as well.
May I know if there is other ways for me to resolve this?

Daniel LaLiberte

unread,
Sep 17, 2015, 3:25:50 PM9/17/15
to Google Visualization API
What you'll need to do is modify the view of each chart that uses the same date range every time the user changes the ChartRangeFilter.    Something like this:

var chartWrapper = ... your Chart wrapper.
var rangeWrapper = ... your ChartRangeFilter wrapper.

google.visualization.events.addListener(rangeWrapper,
              'statechange',
              handleRangeChange)

function handleRangeChange() {
  var state = rangeWrapper.getState();
  var viewWindow = {
    'min': state['range']['start'],
    'max': state['range']['end']
  };
  chartWrapper.setOption('hAxis.viewWindow', viewWindow);
}



For more options, visit https://groups.google.com/d/optout.

Noobie All

unread,
Sep 20, 2015, 3:05:12 PM9/20/15
to google-visua...@googlegroups.com
Dear Daniel

Thanks, will update you once I work on it again.

Reply all
Reply to author
Forward
0 new messages