# canvas-pie-chart

> Canvas based pie chart generator.

Latest version **1.0.7** (published 2020-10-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install canvas-pie-chart
pnpm add canvas-pie-chart
yarn add canvas-pie-chart
bun add canvas-pie-chart
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2020-10-03 |
| First published | 2020-10-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 314.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Barış Demirci |
| Maintainers | leydihavuc |
| Keywords | pie, chart, pie-chart, canvas, graph |

## Links

- npm: https://www.npmjs.com/package/canvas-pie-chart
- Repository: https://github.com/barbarbar338/canvas-pie-chart
- npm.io page: https://npm.io/package/canvas-pie-chart

## Dependencies (1)

- [canvas](https://npm.io/package/canvas.md) ^2.6.1

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 1.0.7 (latest) — 2020-10-03
- 1.0.6 — 2020-10-03
- 1.0.5 — 2020-10-03
- 1.0.4 — 2020-10-03
- 1.0.3 — 2020-10-03
- 1.0.2 — 2020-10-03
- 1.0.1 — 2020-10-03
- 1.0.0 — 2020-10-03

## README

# ✨ Canvas Based Pie Chart Generator
- An easy-to-use canvas based pie chart generator 👀
- specify labels and size, and leave the rest to the system. 🦄

# 🔥 Installation
- Download package with command `npm install canvas-pie-chart` or `yarn add canvas-pie-chart`

# 💡 CommonJS Example
```js
const { PieChart } = require("canvas-pie-chart"); // import chart generator
/* 
    Create a new PieChard instance
    options:
        - labels: { 
            text: label text
            size: label size
        }
        blackOrWhiteInvert: if true, labels are written on a black-and-white basis else written in contrasting colors
        size: chart image size
*/
const chart = new PieChart({
    labels: [
        {
            text: "Option one",
            size: 4
        },
        {
            text: "Option two",
            size: 7
        },
        {
            text: "Option three",
            size: 15
        }
    ],
    blackOrWhiteInvert: true,
    size: 1024
});

// draw chart output
const buffer = chart.draw();
```
# 💡 ES6 Example
```js
import { PieChart } from "canvas-pie-chart"; // import chart generator
/* 
    Create a new PieChard instance
    options:
        - labels: { 
            text: label text
            size: label size
        }
        blackOrWhiteInvert: if true, labels are written on a black-and-white basis else written in contrasting colors
        size: chart image size
*/
const chart = new PieChart({
    labels: [
        {
            text: "Option one",
            size: 4
        },
        {
            text: "Option two",
            size: 7
        },
        {
            text: "Option three",
            size: 15
        }
    ],
    blackOrWhiteInvert: true,
    size: 1024
});

// draw chart output
const buffer = chart.draw();
```

---
_Source: https://npm.io/package/canvas-pie-chart · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
