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

@chainsys/sab-react-charts

v1.0.1

Published

Extended ECharts React wrapper - full Apache ECharts functionality for React applications

Readme

@chainsys/sab-react-charts

Extended ECharts React wrapper – use Apache ECharts in React with full API parity. All chart types and options from the ECharts Examples gallery are supported via a thin React layer over the official ECharts API.

Installation

ECharts is bundled inside this package. Install only the wrapper (and React):

npm install @chainsys/sab-react-charts
# or
yarn add @chainsys/sab-react-charts
# or
pnpm add @chainsys/sab-react-charts

Peer dependencies: react >=19.2.0, react-dom >=19.2.0 and node.js >=22.21.1. You do not need to install echarts separately for 2D charts.

Quick start

import { SabReactCharts } from '@chainsys/sab-react-charts';
import type { EChartsOption } from 'echarts';

const option: EChartsOption = {
  xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] },
  yAxis: { type: 'value' },
  series: [{ type: 'line', data: [120, 200, 150, 80, 70, 110, 130] }],
};

export function MyChart() {
  return <SabReactCharts option={option} style={{ height: 400 }} />;
}

API

<SabReactCharts> props

Options are aligned with ngx-echarts where applicable.

| Prop | Type | Default | Description | |------|------|--------|-------------| | option | EChartsOption \| null | required | Full ECharts option object (all 2D and 3D chart types). | | merge | EChartsOption \| null | - | Extra option merged on top when calling setOption (ngx-echarts parity). | | notMerge | boolean | false | Do not merge with previous option when updating. | | lazyUpdate | boolean | false | Lazy update (e.g. for large data). | | replaceMerge | string[] | - | Replace specified components when updating. | | theme | string \| object | - | Theme name (e.g. 'light', 'dark') or custom theme object for echarts.init(). | | opts | EChartsInitOpts | - | Init options: devicePixelRatio, renderer ('canvas' \| 'svg'), useDirtyRect, useCoarsePointer, pointerSize, width, height, locale, ssr. | | echarts | typeof echarts | default import | Custom echarts namespace (e.g. with echarts-gl registered) for 3D charts. | | style | CSSProperties | - | Container div style (e.g. width, height). | | className | string | - | Container div class name. | | onChartReady | (chart: ECharts) => void | - | Callback when the chart instance is ready. | | onEvents | Record<string, (params: unknown) => void> | - | ECharts event handlers, e.g. { click: (params) => {} }. | | shouldSetOption | (prev, next) => boolean | () => true | Return false to skip calling setOption for a given update. | | loading | boolean \| EChartsLoadingOption | false | Show loading overlay. | | loadingType | string | 'default' | Loading type passed to showLoading(type, opts). | | autoResize | boolean | true | Resize chart when container size changes (ResizeObserver). |

Ref API

Attach a ref to access the ECharts instance:

import { useRef } from 'react';
import { SabReactCharts } from '@chainsys/sab-react-charts';
import type { SabReactChartsRef } from '@chainsys/sab-react-charts';

function MyChart() {
  const chartRef = useRef<SabReactChartsRef>(null);

  const handleResize = () => chartRef.current?.getEchartsInstance().resize();
  const handleExport = () => {
    const url = chartRef.current?.getEchartsInstance().getDataURL({ type: 'png' });
    // use url
  };

  return (
    <>
      <button onClick={handleResize}>Resize</button>
      <button onClick={handleExport}>Export PNG</button>
      <SabReactCharts ref={chartRef} option={option} />
    </>
  );
}
  • getEchartsInstance() – Returns the ECharts instance. Use it for resize(), getDataURL(), getOption(), appendData(), clear(), etc. See ECharts API.

useECharts hook

Optional hook for ref + getter:

import { SabReactCharts, useECharts } from '@chainsys/sab-react-charts';

function MyChart() {
  const [chartRef, getInstance] = useECharts();
  return <SabReactCharts ref={chartRef} option={option} />;
}

Chart types and options

All ECharts chart types and options are supported. Pass any valid ECharts option; the wrapper forwards it to ECharts without modification.

2D chart types: line, bar, pie, scatter, radar, map, heatmap, candlestick, gauge, funnel, treemap, graph, sunburst, boxplot, parallel, sankey, themeRiver, custom series, and combo charts (e.g. line + bar).

3D chart types (require echarts-gl): bar3D, line3D, scatter3D, surface, map3D, lines3D. See 3D charts below.

For themes and maps, use the echarts package directly:

import * as echarts from 'echarts';
echarts.registerTheme('myTheme', { ... });
echarts.registerMap('myMap', geoJSON);
// Then use theme="myTheme" or the map in your option

3D charts (echarts-gl, optional)

ECharts is bundled in this package; 3D charts (bar3D, line3D, scatter3D, surface, map3D, lines3D) are not bundled. To use them, install and register echarts-gl and pass the extended echarts via the echarts prop:

npm install echarts-gl
import * as echarts from 'echarts';
import 'echarts-gl';
import { SabReactCharts } from '@chainsys/sab-react-charts';

const option = {
  grid3D: {},
  xAxis3D: {}, yAxis3D: {}, zAxis3D: {},
  series: [{ type: 'bar3D', data: [...] }],
};
<SabReactCharts echarts={echarts} option={option} style={{ height: 400 }} />

License

MIT