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

@albertluo213/chart-render

v1.0.4

Published

Lightweight chart rendering component for Cube Chart

Readme

@cube-chart/render

轻量级图表渲染组件,用于在应用中展示图表。

特性

  • 📦 轻量级,无编辑器依赖
  • 🚀 高性能渲染,基于 VChart
  • 🎨 支持多种图表类型(折线图、柱状图、饼图等)
  • 📱 响应式设计,自适应容器大小
  • 🔌 易于集成,支持 Vanilla JS 和 React

安装

npm install @cube-chart/render

快速开始

Vanilla JavaScript

import { ChartRenderer } from '@cube-chart/render';
import '@cube-chart/render/style.css';

const renderer = new ChartRenderer({
  container: '#chart-container',
  config: {
    type: 'line',
    data: {
      values: [
        { x: '2024-01', y: 100 },
        { x: '2024-02', y: 150 },
        { x: '2024-03', y: 200 }
      ]
    },
    xField: 'x',
    yField: 'y'
  }
});

// 渲染图表
renderer.render();

// 更新数据
renderer.updateData(newData);

// 销毁
renderer.destroy();

React

import { ChartRenderer } from '@cube-chart/render/react';
import '@cube-chart/render/style.css';

function App() {
  const config = {
    type: 'line',
    data: {
      values: [
        { x: '2024-01', y: 100 },
        { x: '2024-02', y: 150 }
      ]
    },
    xField: 'x',
    yField: 'y'
  };

  return (
    <ChartRenderer 
      config={config}
      style={{ width: '100%', height: '400px' }}
    />
  );
}

API 文档

ChartRenderer

构造函数选项

interface ChartRendererOptions {
  container: string | HTMLElement;  // 容器元素或选择器
  config: ChartConfig;               // 图表配置
  theme?: string;                    // 主题名称
  responsive?: boolean;              // 是否响应式,默认 true
}

方法

  • render(): 渲染图表
  • updateConfig(config): 更新图表配置
  • updateData(data): 更新图表数据
  • resize(): 手动触发图表大小调整
  • destroy(): 销毁图表实例

事件

renderer.on('rendered', () => {
  console.log('图表渲染完成');
});

renderer.on('dataUpdated', (data) => {
  console.log('数据已更新', data);
});

renderer.on('error', (error) => {
  console.error('渲染错误', error);
});

支持的图表类型

  • line - 折线图
  • bar - 柱状图
  • pie - 饼图
  • area - 面积图
  • scatter - 散点图
  • gauge - 仪表盘
  • funnel - 漏斗图
  • radar - 雷达图

License

MIT