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

zan-charts

v0.1.0

Published

Lightweight charts core for Zan ecosystem

Readme

zan-charts

轻量级图表核心库,提供柱状图、折线图、面积图和组合图(combo)能力。

功能特性

  • 支持图表类型:barlineareacombo
  • 支持图例点击显隐序列
  • 支持缩放窗口(含拖拽 brush)
  • 支持 PNG / SVG 导出
  • 支持主题、坐标轴格式化、工具栏开关
  • 提供钩子:图例切换、缩放变化、点位点击

安装

npm install zan-charts

快速开始

import { createChart } from 'zan-charts'

const container = document.getElementById('chart') as HTMLElement

const chart = createChart(container, {
  type: 'line',
  title: '销售趋势',
  categoryField: 'month',
  series: [
    { field: 'sales', label: '销售额' },
    { field: 'profit', label: '利润', type: 'area' }
  ],
  data: [
    { month: '1月', sales: 120, profit: 35 },
    { month: '2月', sales: 150, profit: 42 }
  ],
  enableZoom: true,
  toolbar: {
    enabled: true,
    showResetZoom: true,
    showExportPng: true,
    showExportSvg: true
  }
})

// 后续更新
chart.update({
  data: [
    { month: '3月', sales: 180, profit: 56 }
  ]
})

createChart API

createChart(container, options) 返回 ZanChartHandle

  • update(partialOptions):局部更新配置或数据
  • resetZoom():重置缩放窗口
  • toSvgString():导出 SVG 字符串
  • toDataUrl(type?):导出 data URLimage/png / image/svg+xml
  • download(filename?, type?):下载图片
  • destroy():销毁图表

核心配置(ZanChartOptions)

  • type:图表类型,默认 bar
  • title:图表标题
  • categoryField:类目字段(必填)
  • series:序列定义(必填)
  • data:数据数组(必填)
  • width / height:图表尺寸
  • showLegend:是否显示图例
  • hiddenSeries:默认隐藏的序列字段
  • enableZoom / zoomWindow:缩放配置
  • xAxisFormatter / yAxisFormatter:坐标轴格式化
  • toolbar:工具栏选项(重置缩放、导出按钮等)
  • hooks:交互钩子(onLegendToggleonZoomChangeonPointClick

开发

npm run test
npm run build