npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

anonimiza-canvas-chart

v1.1.1

Published

Canvas chart library for spline charts with customizable axis limits

Readme

anonimiza-canvas-chart

Canvas chart library for spline charts with customizable axis limits.

Installation

npm install anonimiza-canvas-chart

Usage

const { createSplineChart } = require('anonimiza-canvas-chart');

const base64Image = createSplineChart({
    primaryAxis: [...],
    secondaryAxis: [...],
    title: "Meu Gráfico",
    width: 800,
    height: 600,
    showXLabel: true,
    showYLabel: true,
    showTitle: true,
    showLegends: true,
    grid: true,
    zeroMargin: false,
    xAxisLabel: "Vazão (m³/h)",
    maxXOverride: 50,  // Limita o eixo X em 50
});

Parameters

| Parameter | Type | Description | |-----------|------|-------------| | primaryAxis | Array | Array de objetos com curvas para o eixo Y primário | | secondaryAxis | Array | Array de objetos com curvas para o eixo Y secundário | | title | String | Título do gráfico | | width | Number | Largura do canvas em pixels | | height | Number | Altura do canvas em pixels | | showXLabel | Boolean | Exibir labels do eixo X | | showYLabel | Boolean | Exibir labels do eixo Y | | showTitle | Boolean | Exibir título | | showLegends | Boolean | Exibir legendas | | grid | Boolean | Exibir grid | | zeroMargin | Boolean | Remover margens | | xAxisLabel | String | Label do eixo X | | maxXOverride | Number | Novo - Define limite máximo customizado para o eixo X | | maxYOverride | Number/Array | Novo - Define limite máximo customizado para o eixo Y primário | | maxYSecondaryOverride | Number/Array | Novo - Define limite máximo customizado para o eixo Y secundário |

Axis Structure

const primaryAxis = [
    {
        label: "AMT (m)",
        font: "14px Arial",
        curves: [
            {
                label: "60 Hz",
                color: "#6366f1",
                width: 2,
                data: [[0, 30], [10, 29], [20, 27], [30, 24], [40, 18], [50, 10]],
                point: [25, 24],  // Ponto de operação
                hideLegend: false,
            }
        ],
        geometry: {
            data: [],  // Coordenadas para área preenchida
            color: "rgba(0,0,0,0.1)"
        }
    }
];

Example: Limiting X Axis

// Sem limite - pega o maior valor das curvas (ex: curva do sistema vai até 180)
createSplineChart({
    primaryAxis: pumpCurves,
    secondaryAxis: systemCurve,
    // ... outras opções
});

// Com limite em 50 - corta a visualização no X = 50
createSplineChart({
    primaryAxis: pumpCurves,
    secondaryAxis: systemCurve,
    maxXOverride: 50,  // ← Força limite do eixo X
    // ... outras opções
});

Output

A função retorna uma string base64 da imagem PNG gerada.

const base64 = createSplineChart({ ... });

// Usar em HTML
const imgSrc = `data:image/png;base64,${base64}`;

// Salvar em arquivo
const fs = require('fs');
fs.writeFileSync('chart.png', Buffer.from(base64, 'base64'));

License

MIT