Skip to content

Pie and donut ​

Labels are written outside and moved apart. On a narrow screen they become a legend.

Code ​

ts
createChart(host, {
  type: "pie",
  center: "99",
  data: [
    {
      name: "Search",
      value: 42
    },
    {
      name: "Direct",
      value: 31
    },
    {
      name: "Social",
      value: 18
    },
    {
      name: "E-mail",
      value: 5
    },
    {
      name: "Print",
      value: 2
    },
    {
      name: "Events",
      value: 1
    }
  ]
});

Pie ​

ts
createChart(host, {
  type: "pie",
  inner: 0,
  data: [
    {
      name: "Yes",
      value: 64
    },
    {
      name: "No",
      value: 27
    },
    {
      name: "Unsure",
      value: 9
    }
  ]
});

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

MIT License