New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

canvas-pie-chart

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

canvas-pie-chart

Canvas based pie chart generator.

1.0.2
Source
npm
Version published
Weekly downloads
3
200%
Maintainers
1
Weekly downloads
 
Created
Source

✨ 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

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

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();

Keywords

pie

FAQs

Package last updated on 03 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts