Skip to content

Bars ​

Grouped, stacked, horizontal, with negative values and labels.

Code ​

ts
createChart(host, {
  type: "xy",
  categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
  series: [
    {
      name: "Orders",
      kind: "bar",
      data: [40, 49, 56, 59, 57, 51, 45, 40, 39, 43, 51, 61],
      showLabel: true
    }
  ]
});

Horizontal, negative values ​

ts
createChart(host, {
  type: "xy",
  horizontal: true,
  categories: ["A very long name that will be shortened", "Area B", "Area C", "Area D", "Area E"],
  series: [
    {
      name: "Change",
      kind: "bar",
      data: [42, 31, 12, -8, -21],
      showLabel: true
    }
  ]
});

Stacked, with totals ​

ts
createChart(host, {
  type: "xy",
  horizontal: true,
  stacked: true,
  totals: true,
  legend: true,
  categories: ["Area A", "Area B", "Area C"],
  series: [
    {
      name: "Coffee",
      kind: "bar",
      data: [40, 25, 12]
    },
    {
      name: "Tea",
      kind: "bar",
      data: [18, 0, 9]
    },
    {
      name: "Juice",
      kind: "bar",
      data: [6, 4, 2]
    }
  ]
});

Turned names ​

ts
createChart(host, {
  type: "xy",
  labelAngle: -45,
  categories: ["North coast", "South coast", "Old harbour", "Green valley", "Upper town", "Lakeside", "West hills"],
  series: [
    {
      name: "Visits",
      kind: "bar",
      data: [32, 28, 25, 21, 18, 14, 9],
      showLabel: true
    }
  ]
});

Every field is in the API. Change this chart in the playground.

MIT License