Hiding few Zoom buttons in Annotation Chart

718 views
Skip to first unread message

Shivani Kanakhara

unread,
Aug 19, 2014, 2:07:03 AM8/19/14
to google-visua...@googlegroups.com
Can we hide few zoom buttons in Annotation Chart? In case where data contains only date and no time then there would be no use of zoom buttons- 1hour, 1day.
Also can we add zoom buttons like for 2 years, 10 years..as per need??

Daniel LaLiberte

unread,
Aug 19, 2014, 9:05:49 AM8/19/14
to google-visua...@googlegroups.com
There is a new feature coming out in the next release that will let you configure the zoom buttons.  You can use this now if you load version '1.1'.

Here is a summary of how to use it.  There are two options, 'zoomButtons' and 'zoomButtonsOrder'.  The zoomButtonsOrder value is just an array of strings that defaults to this:

  zoomButtonsOrder: [
    '1-hour', '1-day', '5-days', '1-week',
    '1-month', '3-months', '6-months', '1-year', 'max'
  ]

Each string is the name of a zoom button corresponding to a button configuration.  The buttons are configured with the zoomButtons option, which is an object with this default value:

 zoomButtons: {
  '1-second': { 'label': '1s', 'offset': [0, 0, 1] },
  '5-seconds': { 'label': '5s', 'offset': [0, 0, 5] },
  '10-seconds': { 'label': '10s', 'offset': [0, 0, 10] },
  '15-seconds': { 'label': '15s', 'offset': [0, 0, 15] },
  '1-minute': { 'label': '1min', 'offset': [0, 1, 0] },
  '5-minutes': { 'label': '5min', 'offset': [0, 5, 0] },
  '10-minutes': { 'label': '10min', 'offset': [0, 10, 0] },
  '15-minutes': { 'label': '15min', 'offset': [0, 15, 0] },
  '1-hour': { 'label': '1h', 'offset': [1, 0, 0] },
  '6-hours': { 'label': '6h', 'offset': [6, 0, 0] },
  '1-day': { 'label': '1d', 'offset': [1, 0, 0, 0, 0]},
  '5-days': { 'label': '5d', 'offset': [5, 0, 0, 0, 0] },
  '1-week': { 'label': '1w', 'offset': [7, 0, 0, 0, 0] },
  '1-month': { 'label': '1m', 'offset': [1, 0, 0, 0, 0, 0] },
  '3-months': { 'label': '3m', 'offset': [3, 0, 0, 0, 0, 0] },
  '6-months': { 'label': '6m', 'offset': [6, 0, 0, 0, 0, 0] },
  '1-year': { 'label': '1y', 'offset': [1, 0, 0, 0, 0, 0, 0] },
  'max': {
    'label': 'max',
    'range': {
      'start': null,
      'end': null
    }
  }
}

For each button configuration, the 'offset' property is a timeofday value, extended to allow 1 to 7 array elements.  The 'range' property value is an object with 'start' and 'end' properties which are either null or Dates.  A null value means extend to the start or end of the data range.  I haven't tested the range option much so you might find problems.  (Now that I think about it, the start and end values should allow a timeofday value that specify a distance from the start or end of the data range, so you could, for example, configure a 'last minute' button with range: { start: [0, 1, 0] }.)

You can override just the properties you want, or you can define new buttons by adding new properties to this object.  So you could define a 10-years button like so:

zoomButtons: {
  '10-years': { 'label': '10y', 'offset': [10, 0, 0, 0, 0, 0, 0] }
}




On Tue, Aug 19, 2014 at 2:07 AM, Shivani Kanakhara <shivani...@gmail.com> wrote:
Can we hide few zoom buttons in Annotation Chart? In case where data contains only date and no time then there would be no use of zoom buttons- 1hour, 1day.
Also can we add zoom buttons like for 2 years, 10 years..as per need??

--
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

Shivani Kanakhara

unread,
Aug 19, 2014, 9:29:35 AM8/19/14
to google-visua...@googlegroups.com
It worked :) Thank you so much.
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

Chuka

unread,
Jan 5, 2015, 8:21:52 PM1/5/15
to google-visua...@googlegroups.com
Dear Friend

Can you please post your full script?

I can't figure out how to inject code Zoombuttons.

Chuka
Reply all
Reply to author
Forward
0 new messages