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

echart5-canvars-ssr

v1.0.0

Published

Echarts server side render by node canvas, generate chart image by Echarts5, support http access. 使用NodeJs服务器端渲染echarts 5图表,生成图片格式,支持网络访问

Downloads

11

Readme

echarts5-canvas-ssr

Echarts server side render by node canvas, generate chart image by Echarts. Upgrade Echarts version to 5. 使用NodeJs服务器端渲染echarts图表,生成图片格式。将Echarts版本提升到5.

forked from neilli1024/node-echarts-canvas , 2 changes:

  1. update echarts version to 5.
  2. use neilli1024/echarts-ssr-server's http access.
  3. merge ecomfe/echarts-wordcloud to project. Modify to support server-side create.

Install

OS | Command ----- | ----- OS X | brew install pkg-config cairo pango libpng jpeg giflib Ubuntu | sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++ Fedora | sudo yum install cairo cairo-devel cairomm-devel libjpeg-turbo-devel pango pango-devel pangomm pangomm-devel giflib-devel Solaris | pkgin install cairo pango pkg-config xproto renderproto kbproto xextproto Windows | Instructions on our wiki

npm install node-echarts-canvas

Usage

var echarts = require('node-echarts-canvas');
var config = {
    width: 500, // Image width, type is number.
    height: 500, // Image height, type is number.
    option: {}, // Echarts configuration, type is Object.
    //If the path  is not set, return the Buffer of image.
    path: '', // Path is filepath of the image which will be created.
    enableAutoDispose: true  //Enable auto-dispose echarts after the image is created.
}

echarts(config)

Config

|name|type|default|description| |---|---|---|---| |width|Number|500|Image width| |height|Number|500|Image height| |option|Object|{}|Echarts Options| |path|String|-|Path is filepath of the image which will be created. If the path is empty, return buffer.| |enableAutoDispose|Boolean|true|Enable auto-dispose echarts after the image is created.|

Http access

Usage

Using http post to fetch a picture.

Install

Method 1 : Using docker (not finish yet)

docker run -d -p 8081:8081 --name echarts-ssr-server --restart=always mosliu/echart5-canvars-ssr

Method 2 : Run with Node.

1. 安装依赖

操作系统 | 安装命令 ----- | ----- OS X | brew install pkg-config cairo pango libpng jpeg giflib Ubuntu | sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++ Fedora | sudo yum install cairo cairo-devel cairomm-devel libjpeg-turbo-devel pango pango-devel pangomm pangomm-devel giflib-devel Solaris | pkgin install cairo pango pkg-config xproto renderproto kbproto xextproto Windows | Instructions on our wiki

2. 下载并安装

git clone [email protected]:jessezhang007007/echarts-ssr-server.git
cd echarts-ssr-server
npm install
npm start

三、访问服务

1. 访问方式:使用http请求访问服务

2. 请求参数格式:

{
    "width": 800,
        "height": 500,
        "option": {
        "backgroundColor": "#fff",
            "xAxis": {
            "type": "category",
                "data": [
                "Mon",
                "Tue",
                "Wed",
                "Thu",
                "Fri",
                "Sat",
                "Sun"
            ]
        },
        "yAxis": {
            "type": "value"
        },
        "series": [{
            "data": [
                820,
                932,
                901,
                934,
                1290,
                1330,
                1320
            ],
            "type": "line"
        }]
    }
}

参数JSON里的第一层属性说明:

|属性名|类型|默认值|说明| |---|---|---|---| |width|Number|600|图片宽度| |height|Number|400|图片高度| |option|Object|{}|Echarts 的 Option 配置,参考Echarts文档|

3. GET方式访问

注意:GET方式只适合参数数据量小的情况,参数数据量大的时候请使用POST方式。

http://localhost:8081/?config=%7B%22width%22%3A800%2C%22height%22%3A500%2C%22option%22%3A%7B%22backgroundColor%22%3A%22%23fff%22%2C%22xAxis%22%3A%7B%22type%22%3A%22category%22%2C%22data%22%3A%5B%22Mon%22%2C%22Tue%22%2C%22Wed%22%2C%22Thu%22%2C%22Fri%22%2C%22Sat%22%2C%22Sun%22%5D%7D%2C%22yAxis%22%3A%7B%22type%22%3A%22value%22%7D%2C%22series%22%3A%5B%7B%22data%22%3A%5B820%2C932%2C901%2C934%2C1290%2C1330%2C1320%5D%2C%22type%22%3A%22line%22%7D%5D%7D%7D

4. POST方式访问

curl -X POST \
  http://localhost:8081/ \
  -o echart-image.png \
  -d '{
    "width": 800,
    "height": 500,
    "option": {
    	"backgroundColor": "#fff",
        "xAxis": {
            "type": "category",
            "data": [
                "Mon",
                "Tue",
                "Wed",
                "Thu",
                "Fri",
                "Sat",
                "Sun"
            ]
        },
        "yAxis": {
            "type": "value"
        },
        "series": [
            {
                "data": [
                    820,
                    932,
                    901,
                    934,
                    1290,
                    1330,
                    1320
                ],
                "type": "line"
            }
        ]
    }
}'