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 🙏

© 2025 – Pkg Stats / Ryan Hefner

chartjs-chart-treenode-test

v1.0.34

Published

A Chart.js plugin to render tree node graphs

Readme

chartjs-chart-treenode

Renderiza gráficos de árbol (tree node) personalizados en Chart.js a partir de enlaces (from, to, value) usando canvas, sin crear nuevos tipos de gráfico, compatible con scatter.


📦 Instalación

npm install chartjs-chart-treenode

O si usas CDN:

<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-chart-treenode"></script>

Versión de prueba:
Si quieres probar una versión experimental (puede contener errores o cambios inestables), puedes instalar:

npm install chartjs-chart-treenode-test

O por CDN:

<script src="https://cdn.jsdelivr.net/npm/chartjs-chart-treenode-test"></script>

⚠️ Esta versión es solo para pruebas y puede no ser estable.


🧠 ¿Qué es esto?

Este plugin de Chart.js permite visualizar nodos y relaciones jerárquicas (tipo árbol) usando datasets con enlaces from → to. Calcula automáticamente la profundidad, la posición vertical y dibuja conexiones suavizadas entre nodos, con soporte para colores personalizados, bordes y tooltips flotantes personalizados.


📊 Ejemplo de uso

import Chart from 'chart.js/auto';
import { treeNodePlugin } from 'chartjs-chart-treenode';

Chart.register(treeNodePlugin);

const ctx = document.getElementById('treeChart').getContext('2d');

new Chart(ctx, {
  type: 'scatter',
  data: {
    datasets: [{
      label: "Cantidad",
      data: [
        { from: "Root1", to: "A", value: 300 },
        { from: "A", to: "B", value: 200 }
      ],
      nodeColors: {
        "A": "#1976d2",
        "B": "orange"
      },
      nodeBorder: "4px",
      nodeBorderColor: "black"
    }]
  },
  options: {
    responsive: true,
    maintainAspectRatio: false,
    plugins: { legend: { display: false } },
    scales: {
      x: { display: false, min: 0, max: 1 },
      y: { display: false, min: 0, max: 1 }
    }
  },
  plugins: [treeNodePlugin]
});

🧩 Opciones adicionales en el dataset

  • nodeColors: Objeto { label: color } para cambiar el color de cada nodo.
  • nodeBorder: Borde de cada nodo (ej. "2px").
  • nodeBorderColor: Color del borde.
  • column: Objeto { label: columnIndex } para forzar columna de un nodo.
  • priority: Objeto { label: prioridad } para definir el orden vertical dentro de una columna.

🧪 Requisitos

  • Chart.js ^4.x
  • Navegador moderno con soporte para <canvas>

🧑‍💻 Contribuciones

¡Bienvenidas! Puedes abrir un issue o hacer un pull request.


📄 Licencia

MIT