3.9.2 • Published 9 months ago

chartjs-chart-waffle v3.9.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

chartjs-chart-waffle

Chart.js module for waffle charts.

waffle chart example

Install

npm install --save chart.js chartjs-chart-waffle

yarn add chart.js chartjs-chart-waffle

Usage

Data Structure

Sample (Vanilla Chart.js)

const config = {
  type: "waffle",
  data: {
    labels: ["Apple", "Orange", "Banana"],
    datasets: [
      {
        data: [10, 3, 5],
        backgroundColor: [
          "rgba(255, 26, 104, 1)",
          "rgba(54, 162, 235, 1)",
          "rgba(255, 206, 86, 1)",
        ],
      },
    ],
  },
  options: {
    row: 8,
    column: 8,
    gap: 16,
    total: 50,
    fill: true,
    fillColor: "#eee",
    radius: 8,
  },
};

Sample (React) Example

Options

NameTypeDefaultDescription
labelsstring[]RequiredLabels. (Appears in tooltip)
datanumber[]RequiredData points
backgroundColorstring[]RequiredColor of active data points
rownumberRequiredNumber of rows
columnnumberRequiredNumber of columns
gapnumber5Gap between blocks in px
totalnumber-Arbitrary total of the waffle data. Default: Sum of the data array
fillbooleanfalseFill placeholder blocks
fillColorstring#eeeColor of placeholder blocks
radiusnumber4Corner radius of a block

Roadmap

  • Chart.js v4 compatible
  • Legends
  • Better types
  • Animation

Credits

  • Inspired by @sgratzl and his work within Chart.js ecosystem
3.9.2

9 months ago

3.9.1

9 months ago