Type:Chart - pvande/Tranquil GitHub Wiki

See This Example

    {
      "type": "chart",
      "url": "/jsonp?url=https://raw.github.com/gist/ea7cda4c830ce44c18a8/chart-data.json&callback=?",
    }

Keys

  • url

    The URL to fetch JSONP data from. The name of the JSONP callback function should be represented as a ?, and should be the last query parameter.

  • data

    A Javascript object containing an example of the data being consumed by the widget. This will be used as a stand-in for data from the URL before the initial load, and can be used as a substitute for the URL's data (e.g. for development).

  • interval

    The time to wait before polling url for data updates, in milliseconds. Defaults to one minute.

  • filter

    The name of (or path to) a Javascript function. The named function will be invoked with each JSON object requested, and its return value will be used as the widget's data source. Defaults to the identity function.

  • template

    A Javascript object containing Mustache templates to be used as partials.

    • title

      Used to render the x-axis title for each bar in the chart. Defaults to '{{title}}'.

    • info

      Used to render additional information above each bar. Defaults to '{{info}}'.

    • _bar

      Used to render each element of the chart. Reserved for internal use.

Data

Default (Expected)

    [
      {
        "title": "x-axis label #1",
        "percentage": 100,
        "info": "annotation #1",
      },
      {
        "title": "x-axis label #2",
        "percentage": 100,
        "info": "annotation #2",
      },
      ...
      {
        "title": "x-axis label #n",
        "percentage": 100,
        "info": "annotation #n",
      }
    ]

Minimum

[
  {
    "percentage": 100,
  },
  {
    "percentage": 100,
  },
  ...
  {
    "percentage": 100,
  }
]