How to create charts using NodeJS?

2019-03-14 10:57发布

Is it possible to create charts, e.g. bars and pies with custom icons using NodeJS?

3条回答
一纸荒年 Trace。
2楼-- · 2019-03-14 11:30

using highcharts

you have to install

npm install -g node-highcharts

refer the following link

https://github.com/davidpadbury/node-highcharts

查看更多
放我归山
3楼-- · 2019-03-14 11:38

You can use any charts library, basically. For example:

On your server template code, you might want to output the data using server variable. Example below using swig template engine, ExpressJS and Chartist library

<div class="ct-chart ct-perfect-fourth"></div>
<script>
    new Chartist.Line('.ct-chart', {
        labels: {{ chartLabel | raw }}, 
        series : [{{ charts | raw}}]
    }, {
        axisY: {
            onlyInteger: true
        }
    });
</script>

Find out more about other charts library here

查看更多
4楼-- · 2019-03-14 11:54

d3 is probably your best bet. It can generate nearly any type of chart imaginable.

You can generate the charts directly in the browser, or if you really need an image file, you can use the module in node and convert the output to an image.

查看更多
登录 后发表回答