如何使用 NodeJS 创建图表?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15477008/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 13:53:56  来源:igfitidea点击:

How to create charts using NodeJS?

node.jsgraphcharts

提问by Riz

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

是否可以使用 NodeJS 创建图表,例如带有自定义图标的条形图和饼图?

回答by josh3736

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

d3可能是你最好的选择。它可以生成几乎任何类型的可以想象的图表。

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.

您可以直接在浏览器中生成图表,或者如果您确实需要一个图像文件,您可以使用 node 中的模块并将输出转换为图像

回答by gnowlak

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

在您的服务器模板代码中,您可能希望使用服务器变量输出数据。下面使用 swig 模板引擎、ExpressJS 和 Chartist 库的示例

<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

在此处了解有关其他图表库的更多信息

回答by AmirtharajCVijay

using highcharts

使用highcharts

you have to install

你必须安装

npm install -g node-highcharts

refer the following link

请参考以下链接

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

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