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

@synerity/charts

v1.2.5

Published

A comprehensive, framework-agnostic chart library built with D3 and Tailwind CSS. Features 11 chart types with real-time updates, export functionality, and enterprise-level UI

Readme

@synerity/charts

A comprehensive, framework-agnostic chart library built with D3 and Tailwind CSS. Supports multiple chart types with beautiful animations and export functionality.

🚀 Quick Start

Installation

npm install @synerity/charts

Basic Usage

<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
  <div id="chart" class="w-full h-96"></div>
  
  <script type="module">
    import { BarChart } from '@synerity/charts';
    
    const data = [
      { label: 'Q1', value: 120 },
      { label: 'Q2', value: 180 },
      { label: 'Q3', value: 150 },
      { label: 'Q4', value: 220 }
    ];

    new BarChart({
      container: '#chart',
      data: data
    });
  </script>
</body>
</html>

📊 Chart Types

Bar Chart

import { BarChart } from '@synerity/charts';

new BarChart({
  container: '#bar-chart',
  data: [
    { label: 'Q1', value: 120, color: '#3B82F6' },
    { label: 'Q2', value: 180, color: '#10B981' }
  ],
  options: {
    animate: true,
    showValues: true,
    showGrid: true,
    barPadding: 0.1,
    borderRadius: 4
  }
});

Line Chart

import { LineChart } from '@synerity/charts';

new LineChart({
  container: '#line-chart',
  data: [
    { label: 'Jan', value: 65, color: '#3B82F6' },
    { label: 'Feb', value: 78, color: '#10B981' }
  ],
  options: {
    animate: true,
    showPoints: true,
    showGrid: true,
    curveType: 'monotoneX',
    strokeWidth: 2
  }
});

Pie Chart

import { PieChart } from '@synerity/charts';

new PieChart({
  container: '#pie-chart',
  data: [
    { label: 'Desktop', value: 45, color: '#3B82F6' },
    { label: 'Mobile', value: 35, color: '#10B981' }
  ],
  options: {
    animate: true,
    showLabels: true,
    showValues: true,
    innerRadius: 0,
    outerRadius: 150
  }
});

Scatter Plot

import { ScatterPlot } from '@synerity/charts';

new ScatterPlot({
  container: '#scatter-plot',
  data: [
    { x: 10, y: 20, label: 'Point 1', color: '#3B82F6' },
    { x: 20, y: 35, label: 'Point 2', color: '#10B981' }
  ],
  options: {
    animate: true,
    showGrid: true,
    showTrendLine: true,
    pointRadius: 6,
    pointOpacity: 0.7
  }
});

📤 Export Functionality

Export Manager

import { ExportManager } from '@synerity/charts';

const exportManager = new ExportManager(container);

// Export as PNG
const pngBlob = await exportManager.exportPNG({
  format: 'png',
  width: 800,
  height: 600,
  quality: 0.9
});

// Export as SVG
const svgString = await exportManager.exportSVG({
  format: 'svg',
  includeStyles: true
});

// Export as PDF (requires jsPDF)
const pdfBlob = await exportManager.exportPDF({
  format: 'pdf',
  title: 'Chart Export',
  author: 'Synerity Charts'
});

// Export data as CSV
const csvString = exportManager.exportCSV(data, 'chart-data.csv');

// Export data as JSON
const jsonString = exportManager.exportJSON(data, 'chart-data.json');

🛠️ Development

Build the Library

npm run build

Development Mode

npm run dev

Testing

npm test
npm run test:coverage

Demos

  • Open demo.html for basic bar chart demo
  • Open demo-all-charts.html for comprehensive demo with all chart types and export functionality

✨ Features

Chart Types

  • 🎯 Bar Charts: Animated bars with customizable styling
  • 📈 Line Charts: Smooth curves with data points
  • 🥧 Pie Charts: Interactive slices with labels
  • 🔵 Scatter Plots: Data points with trend lines

Export Formats

  • 🖼️ PNG: High-resolution image export
  • 🎨 SVG: Vector graphics with embedded styles
  • 📄 PDF: Document export with metadata
  • 📊 CSV: Data export with headers
  • 📋 JSON: Structured data export

Core Features

  • 🎨 Beautiful Design: Tailwind CSS color palette
  • 📊 Framework Agnostic: Works with any JavaScript framework
  • Lightweight: Only depends on D3.js
  • 🎭 Customizable: Extensive options for styling
  • 📱 Responsive: Built-in responsive design
  • 🎯 TypeScript: Full TypeScript support
  • 🎬 Animations: Smooth transitions and effects
  • 🔄 Data Updates: Real-time data updates with proper cleanup

📚 API Reference

Chart Configuration

interface ChartConfig {
  container: string | HTMLElement;
  data: ChartData[] | ScatterData[];
  options?: BarChartOptions | LineChartOptions | PieChartOptions | ScatterPlotOptions;
}

Data Types

interface ChartData {
  label: string;
  value: number;
  color?: string;
}

interface ScatterData {
  x: number;
  y: number;
  label?: string;
  color?: string;
}

Export Configuration

interface ExportConfig {
  format: 'png' | 'svg' | 'pdf';
  filename?: string;
  width?: number;
  height?: number;
  backgroundColor?: string;
  quality?: number;
}

🎯 Browser Support

  • Chrome 90+
  • Firefox 88+
  • Safari 14+
  • Edge 90+

📄 License

MIT License - see LICENSE file for details.