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

@efxlab/chart-react

v0.2.0

Published

React components for EfxChart - ECharts-based multi-chart dashboards

Readme

@efx/chart-react

React components for building ECharts-based multi-chart dashboards with declarative ASCII templates.

Installation

npm install @efx/chart-react echarts
# or
pnpm add @efx/chart-react echarts

Peer Dependencies

  • react ^18.0.0 || ^19.0.0
  • echarts ^5.0.0 || ^6.0.0

Quick Start

import {
  EfxChartsLayout,
  EfxChart,
  FINANCE_LAYOUT,
  generateTimeSeriesData,
} from '@efx/chart-react'

function Dashboard() {
  return (
    <EfxChartsLayout
      template={FINANCE_LAYOUT}
      sidebarPosition="left"
      gap={20}
      onChartReady={(chart) => console.log('Ready!')}
    >
      <EfxChart
        section="header"
        type="line"
        title="Revenue Trend"
        data={generateTimeSeriesData(30)}
        xAxis={{ type: 'time' }}
      />
      <EfxChart
        section="sidebar"
        type="bar"
        title="Categories"
        data={[
          { name: 'A', value: 100 },
          { name: 'B', value: 200 },
        ]}
        invertAxis
      />
      <EfxChart
        section="main"
        type="line"
        title="Main Chart"
        data={generateTimeSeriesData(90)}
      />
      <EfxChart
        section="footer"
        type="bar"
        title="Summary"
        data={generateTimeSeriesData(12)}
      />
    </EfxChartsLayout>
  )
}

Components

EfxChartsLayout

Container that renders a single ECharts instance with multiple chart grids.

<EfxChartsLayout
  template={FINANCE_LAYOUT}   // ASCII layout template
  sidebarPosition="left"      // 'left' | 'right'
  gap={20}                    // Gap between sections (px)
  gapX={20}                   // Horizontal gap override
  gapY={10}                   // Vertical gap override
  renderer="canvas"           // 'canvas' | 'svg'
  theme="dark"                // ECharts theme name
  onChartReady={(chart) => {}}
  onEvents={{
    click: (params, chart) => {},
    mouseover: (params, chart) => {},
  }}
>
  {/* EfxChart children */}
</EfxChartsLayout>

EfxChart

Declarative chart section configuration (doesn't render anything directly).

<EfxChart
  section="main"              // Section ID from template
  type="line"                 // Chart type
  title="My Chart"            // Section title
  data={[...]}                // Chart data
  xAxis={{ type: 'time' }}    // X-axis config
  yAxis={{ type: 'value' }}   // Y-axis config
  series={{ smooth: true }}   // Series options
  padding="50,20"             // Internal padding
  axisPointer={{              // Crosshair config
    type: 'cross',
    snap: true,
  }}
/>

createTypedChart

Factory function for type-safe section autocomplete:

import { createTypedChart, FINANCE_LAYOUT } from '@efx/chart-react'

const EfxChart = createTypedChart(FINANCE_LAYOUT)

// Now section prop has autocomplete:
<EfxChart section="header" />  // TS autocomplete: "header" | "sidebar" | "main" | "footer"

Available Templates

import {
  FINANCE_LAYOUT,      // header, sidebar, main, footer
  DASHBOARD_LAYOUT,    // header, main, sidebar, footer
  COMPARISON_LAYOUT,   // title, left, right, summary
  GRID_2X2_LAYOUT,     // tl, tr, bl, br (quadrants)
  ANALYTICS_LAYOUT,    // kpi1-4, main, side
  MONITORING_LAYOUT,   // chart1-6 (3x2 grid)
} from '@efx/chart-react'

Streaming Data Support

For progressive data loading with visual feedback:

import { useStreamingData, EfxChartsLayout } from '@efx/chart-react'

function StreamingDashboard({ loaderData }) {
  const { chartData, sectionLoadingStates } = useStreamingData({
    loaderData,
    sections: ['header', 'sidebar', 'main', 'footer'],
  })

  return (
    <EfxChartsLayout
      template={FINANCE_LAYOUT}
      loadingStrategy="streaming"
      sectionLoadingStates={sectionLoadingStates}
    >
      <EfxChart section="header" data={chartData.header} />
      <EfxChart section="main" data={chartData.main} />
      {/* ... */}
    </EfxChartsLayout>
  )
}

Core Hooks

useEChartsInstance

Low-level hook for ECharts lifecycle management:

import { useEChartsInstance } from '@efx/chart-react'

const { getEchartsInstance, instanceRef } = useEChartsInstance(containerRef, {
  option: chartOption,
  events: { click: handleClick },
  onReady: (chart) => console.log('Ready'),
  theme: 'dark',
  renderer: 'canvas',
  autoResize: true,
})

useResizeObserver

Observe container size changes:

import { useResizeObserver } from '@efx/chart-react'

useResizeObserver(containerRef, {
  onResize: (entry) => console.log(entry.contentRect),
  debounceMs: 100,
})

EChartsRenderer

Standalone ECharts renderer component:

import { EChartsRenderer } from '@efx/chart-react'

<EChartsRenderer
  option={chartOption}
  theme="dark"
  style={{ height: 400 }}
  onReady={(chart) => {}}
/>

Data Generators

Utility functions for generating sample data:

import {
  generateTimeSeriesData,
  generateCategoryData,
  generateScatterData,
  generatePieData,
  generateCandlestickData,
} from '@efx/chart-react'

Related Packages

  • @efx/chart-core - Framework-agnostic types and utilities
  • @efx/layout-react - CSS Grid layout components (works great with EfxChart)

License

MIT