2015년 1월 7일 수요일

Re: [visualization-api] Hiding few Zoom buttons in Annotation Chart

Can you please post your full script?

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


It worked :) Thank you so much.

On Tuesday, August 19, 2014 6:35:49 PM UTC+5:30, Daniel LaLiberte wrote:
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] }
}


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




댓글 없음:

댓글 쓰기