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 🙏

© 2024 – Pkg Stats / Ryan Hefner

echarts-solid

v0.2.0

Published

ECharts components for SolidJS

Downloads

527

Readme

echarts-solid

pnpm

echarts-solid is a library that provides components for integrating ECharts with SolidJS apps. It includes two main components: ECharts and EChartsAutoSize, both designed to make it easier to work with ECharts in Solid-based projects.

Quick start

Install it:

npm i echarts-solid echarts
# or
yarn add echarts-solid echarts
# or
pnpm add echarts-solid echarts

Use it:

import { ECharts } from 'echarts-solid'

function MyChartComponent() {
  const options = {
    // ... your ECharts option here
  };

  return (
    <ECharts
      option={options}
      width={600}
      height={400}
    />
  );
}

For responsive charts, use the EChartsAutoSize component:

import { EChartsAutoSize } from 'echarts-solid'

function MyResponsiveChartComponent() {
  const options = {
    // ... your ECharts option here
  };

  return (
    <EChartsAutoSize
      option={options}
    />
  );
}

Components

ECharts

ECharts is a component that renders an ECharts chart with specified options and styles.

Props

  • option: ECharts option object with data and configuration.
  • width, height: The dimensions of the chart.
  • initOptions: Optional parameters for the ECharts instance initialization.
  • notMerge: Whether not to merge with previous option.
  • lazyUpdate: Whether to update chart immediately.
  • isLoading: Displays a loading animation when the chart is being prepared or data is being fetched.
  • loadingOptions: The options for the loading animation.
  • resizeOptions: Options to pass to ECharts' resize method.
  • theme: Theme to be applied to the chart instance.
  • eventHandlers: An object to attach event handlers to the chart instance.
  • onInit: Callback function that is invoked with the chart instance when it is initialized.
  • class, style: Standard HTML attributes for styling.
  • ref: Ref of the div element that is used for the chart.

EChartsAutoSize

EChartsAutoSize is similar to ECharts but automatically adjusts its size based on its container's size.

Props

It has all the same props as ECharts, except for width and height because it adjusts to the chart element's size.

Events

You can attach event handlers to different chart events by passing an eventHandlers object. Each key is the event name, and the value can be the handler function or an object with query for filtering and handler for the function itself.

const eventHandlers = {
  'click': (event: ECElementEvent) => {
    console.log('Chart is clicked!', event);
  }
};

<EChartsAutoSize
  option={options}
  eventHandlers={eventHandlers}
/>

Loading State

You can control the display of a loading animation by using the isLoading and loadingOptions props:

<EChartsAutoSize
  option={options}
  isLoading={true}
  loadingOptions={{ text: 'Data is loading...' }}
/>

Contributing

Contributions to the echarts-solid library are encouraged and appreciated.

License

echarts-solid is MIT licensed.