https://github.com/guoyunhe/echarts-image
Convert data to chart image easily, without making web pages
https://github.com/guoyunhe/echarts-image
Last synced: 3 months ago
JSON representation
Convert data to chart image easily, without making web pages
- Host: GitHub
- URL: https://github.com/guoyunhe/echarts-image
- Owner: guoyunhe
- Created: 2023-03-24T13:30:19.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-24T16:03:14.000Z (about 2 years ago)
- Last Synced: 2025-02-10T21:27:08.382Z (4 months ago)
- Language: TypeScript
- Size: 71.3 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# echarts-image

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
```bash
npm i echarts-image
```## CLI
```bash
echarts-image option.json chart.png --width 400 --height 300 --dpr 2
```## API
```js
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`.