Skip to content

Chart Types: Time Series

Patrick Moran edited this page Feb 21, 2018 · 2 revisions

What it looks like

timeSeries

How to use this chart type

chartType: 'timeSeries'

Note: this chart type expects your api to return a two dimensional array. It should be an array of time, value pairs where the time is the numeric value of the time (Unix Time) and value is the value you would like to display for that time.

Example

[
  [1510790400000, 0],
  [1510876800000, 0],
  [1510963200000, 366],
  [1511654400000, 694],
  [1512259200000, 537],
  [1512950400000, 361],
  [1513036800000, 38],
  [1513728000000, 33],
  [1513814400000, 0],
  [1513900800000, 0]
]

Optional Properties

valueAttribute [String]

The application expects your api to return an array, but you can also return an object where your return array is a property nested in that object. You must use the valueAttribute property to tell the app where to look for the correct property.

This should be a string that describes the path to the value from the object returned from the api. Nested objects should be separated by a .

Example

Your api response looks like this:

  {
    data: {
      attributes: {
        value: [
          [1510790400000, 0],
          [1510876800000, 0],
          [1510963200000, 366],
          [1511654400000, 694],
          [1512259200000, 537],
          [1512950400000, 361],
          [1513036800000, 38],
          [1513728000000, 33],
          [1513814400000, 0],
          [1513900800000, 0]
        ]
      }
    }
  }

The value is the array that you would like to use to create the bar chart so your valueAttribute would be 'data.attributes.value'