echarts-image
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

echarts-image

Chart

Generate chart images using command line or Node.js API. No need to create a website!

Note: you must have internet access when using this tool, because it loads JS from CDN.

Install

npm i echarts-image

CLI

echarts-image option.json chart.png --width 400 --height 300 --dpr 2

API

import { outputChartImage } from 'echarts-image';

// Check examples from echarts website https://echarts.apache.org/examples/
const option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
  },
  yAxis: {
    type: 'value',
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line',
    },
  ],
};

outputChartImage(option, 'output.png', { width: 400, height: 300, dpr: 2 });

Options

width

Width of chart in pixel. Default 400.

height

Height of chart in pixel. Default 300.

dpr

Device pixel rate. Default 1.

Readme

Keywords

Package Sidebar

Install

npm i echarts-image

Weekly Downloads

0

Version

1.0.2

License

none

Unpacked Size

11.1 kB

Total Files

8

Last publish

Collaborators

  • guoyunhe