Ble*_*ill 7 highcharts node.js highmaps .net-core
我想用.Net Core项目在后面渲染地图文件
因此,目的是在Javascript中间件上执行Highmaps库,并将svg文件导出到"node-export-server".
我有一个API从客户端接收一些数据.我想用Highmap库生成SVG映射文件,然后发送到另一个API,它将包含一个中间件来执行PNG/JPG/...导出的节点模块.
将svg文件传递给"node-export-server"模块的方法是什么?我阅读了副文档,但我没有找到方法......(https://github.com/highcharts/node-export-server/blob/master/README.md)
我想通过此示例传递我的SVG文件.
//Include the exporter module
const exporter = require('highcharts-export-server');
//Export settings
var exportSettings = {
type: 'png',
options: {
title: {
text: 'My Chart'
},
xAxis: {
categories: ["Jan", "Feb", "Mar", "Apr", "Mar", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
},
series: [
{
type: 'line',
data: [1, 3, 2, 4]
},
{
type: 'line',
data: [5, 3, 4, 2]
}
]
}
};
//Set up a pool of PhantomJS workers
exporter.initPool();
//Perform an export
/*
Export settings corresponds to the available CLI arguments described
above.
*/
exporter.export(exportSettings, function (err, res) {
//The export result is now in res.
//If the output is not PDF or SVG, it will be base64 encoded (res.data).
//If the output is a PDF or SVG, it will contain a filename (res.filename).
//Kill the pool when we're done with it, and exit the application
exporter.killPool();
process.exit(1);
});
Run Code Online (Sandbox Code Playgroud)
好吧,这可能不完全是完整的答案,但它可能会引导您走向正确的方向:看看https://github.com/aspnet/JavaScriptServices,它提供了一种将代码传递给 Nodejs 的方法(尽管它是关于服务端渲染,原理类似)。然后,您可以将参数传递给 Nodejs,就像通过 CLI 传递参数一样。
| 归档时间: |
|
| 查看次数: |
550 次 |
| 最近记录: |