Skip to Content
Hookboard
Components

Chart components

Every chart component a card can use, with its properties and an example.

Each component is an object with a type and the properties listed for it. Text and number properties may also hold a {{ }} template or a { "$bind": "…" } object; see Data, state and bindings. Every component also accepts the common properties.

lineChart

A line chart over a list of rows.

Does not take children.

PropertyTypeRequiredDefaultWhat it does
dataany JSONyesRows to plot, usually a binding such as {{data.history}}.
xtextyesKey of each row used for the horizontal axis.
serieslist of objectsyesThe series to draw.
series[].keytextyesKey of each row that holds this series' value.
series[].labeltextName shown in the legend and tooltip.
series[].tone"1" "2" "3" "4" "5"Which chart color to use.
heightnumber200Height in pixels.
legendbooleanfalseShow a legend.
curvedbooleantrueSmooth the lines.
{
  "type": "lineChart",
  "data": [
    {
      "day": "Mon",
      "visits": 120,
      "signups": 8
    },
    {
      "day": "Tue",
      "visits": 180,
      "signups": 14
    },
    {
      "day": "Wed",
      "visits": 150,
      "signups": 11
    },
    {
      "day": "Thu",
      "visits": 210,
      "signups": 19
    },
    {
      "day": "Fri",
      "visits": 260,
      "signups": 23
    }
  ],
  "x": "day",
  "series": [
    {
      "key": "visits",
      "label": "Visits"
    }
  ]
}

areaChart

A filled area chart over a list of rows.

Does not take children.

PropertyTypeRequiredDefaultWhat it does
dataany JSONyesRows to plot, usually a binding such as {{data.history}}.
xtextyesKey of each row used for the horizontal axis.
serieslist of objectsyesThe series to draw.
series[].keytextyesKey of each row that holds this series' value.
series[].labeltextName shown in the legend and tooltip.
series[].tone"1" "2" "3" "4" "5"Which chart color to use.
heightnumber200Height in pixels.
legendbooleanfalseShow a legend.
stackedbooleanStack the series.
{
  "type": "areaChart",
  "data": [
    {
      "day": "Mon",
      "visits": 120,
      "signups": 8
    },
    {
      "day": "Tue",
      "visits": 180,
      "signups": 14
    },
    {
      "day": "Wed",
      "visits": 150,
      "signups": 11
    },
    {
      "day": "Thu",
      "visits": 210,
      "signups": 19
    },
    {
      "day": "Fri",
      "visits": 260,
      "signups": 23
    }
  ],
  "x": "day",
  "series": [
    {
      "key": "visits",
      "label": "Visits"
    }
  ]
}

barChart

A bar chart over a list of rows.

Does not take children.

PropertyTypeRequiredDefaultWhat it does
dataany JSONyesRows to plot, usually a binding such as {{data.history}}.
xtextyesKey of each row used for the horizontal axis.
serieslist of objectsyesThe series to draw.
series[].keytextyesKey of each row that holds this series' value.
series[].labeltextName shown in the legend and tooltip.
series[].tone"1" "2" "3" "4" "5"Which chart color to use.
heightnumber200Height in pixels.
legendbooleanfalseShow a legend.
stackedbooleanStack the series.
horizontalbooleanDraw bars sideways.
{
  "type": "barChart",
  "data": [
    {
      "day": "Mon",
      "visits": 120,
      "signups": 8
    },
    {
      "day": "Tue",
      "visits": 180,
      "signups": 14
    },
    {
      "day": "Wed",
      "visits": 150,
      "signups": 11
    },
    {
      "day": "Thu",
      "visits": 210,
      "signups": 19
    },
    {
      "day": "Fri",
      "visits": 260,
      "signups": 23
    }
  ],
  "x": "day",
  "series": [
    {
      "key": "visits",
      "label": "Visits"
    },
    {
      "key": "signups",
      "label": "Signups"
    }
  ]
}

pieChart

A donut chart showing parts of a whole.

Does not take children.

PropertyTypeRequiredDefaultWhat it does
dataany JSONyesRows, one per slice.
nametextyesKey of each row holding the slice name.
valuetextyesKey of each row holding the slice value.
heightnumber200Height in pixels.
legendbooleantrueShow a legend.
{
  "type": "pieChart",
  "data": [
    {
      "name": "Chrome",
      "value": 62
    },
    {
      "name": "Safari",
      "value": 24
    },
    {
      "name": "Firefox",
      "value": 14
    }
  ],
  "name": "name",
  "value": "value"
}

sparkline

A tiny trend line without axes, for use beside a figure.

Does not take children.

PropertyTypeRequiredDefaultWhat it does
dataany JSONyesA list of numbers, or rows when a key is given.
keytextKey of each row holding the value.
heightnumber36Height in pixels.
tone"primary" "success" "warning" "danger""primary"Line color.
{
  "type": "sparkline",
  "data": [
    4,
    7,
    5,
    9,
    12,
    10,
    15
  ]
}

On this page