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

react-metric-chart-plugin

v1.0.2

Published

A reusable React plugin for metric chart visualization

Readme

React Metric Chart Plugin

一个灵活且可定制的 React 指标图表插件,直接支持 ECharts 配置和统计数据展示。

特性

  • 🚀 开箱即用的图表组件
  • 📊 直接支持 ECharts 配置选项
  • 📈 内置统计数据表格
  • 🎨 可定制的样式和主题
  • 📱 响应式设计
  • 🔍 内置数据过滤和搜索
  • 🧪 完整的 TypeScript 支持
  • 📋 支持数据导出功能

安装

npm install react-metric-chart-plugin
# 或
yarn add react-metric-chart-plugin

快速开始

import React from 'react';
import { MetricChartPlugin } from 'react-metric-chart-plugin';
import type { MetricStats } from 'react-metric-chart-plugin';

function App() {
  // ECharts 配置选项
  const chartOptions = {
    title: {
      text: '系统监控',
      left: 'center'
    },
    tooltip: {
      trigger: 'axis'
    },
    xAxis: {
      type: 'time'
    },
    yAxis: {
      type: 'value'
    },
    series: [
      {
        name: 'CPU使用率',
        type: 'line',
        data: [
          [new Date('2024-01-01 10:00:00').getTime(), 45.2],
          [new Date('2024-01-01 10:01:00').getTime(), 52.1],
          // 更多数据点...
        ],
        itemStyle: { color: '#1890ff' }
      }
    ]
  };

  // 统计数据
  const statsData: MetricStats[] = [
    {
      name: 'CPU使用率',
      current: 52.1,
      maximum: 65.3,
      minimum: 32.8,
      average: 48.7,
      color: '#1890ff'
    }
  ];

  return (
    <MetricChartPlugin
      chartOptions={chartOptions}
      statsData={statsData}
      title="系统监控"
      height={400}
      showTable={true}
      onRefresh={() => console.log('刷新数据')}
    />
  );
}

API 文档

MetricChartPluginProps

| 属性 | 类型 | 默认值 | 说明 | |------|------|--------|------| | chartOptions | any | - | ECharts 配置选项对象 | | statsData | MetricStats[] | [] | 统计数据数组 | | title | string | '指标图表' | 图表标题 | | height | number | 400 | 图表高度 | | showControls | boolean | true | 是否显示控制栏 | | showTable | boolean | true | 是否显示数据表格 | | usePagination | boolean | true | 表格是否使用分页 | | maxHeight | number | 600 | 不使用分页时表格最大高度 | | onRefresh | () => void | - | 刷新回调函数 | | onExport | (data: MetricStats[]) => void | - | 导出回调函数 |

MetricStats

| 属性 | 类型 | 说明 | |------|------|------| | name | string | 指标名称 | | current | number | 当前值 | | maximum | number | 最大值 | | minimum | number | 最小值 | | average | number | 平均值 | | color | string | 颜色(用于图表和表格) |

开发

# 安装依赖
npm install

# 开发模式
npm run dev

# 运行测试
npm test

# 构建
npm run build

许可证

MIT