我想呈現的地圖文件中使用.NET的核心項目Highcharts出口圖表exportSettings與SVG文件
所以後面,目的是爲了在一個Javascript中間件執行Highmaps庫,以及SVG文件導出到「節點導出服務器」。
我有一個從客戶端接收一些數據的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);
});
你是什麼意思?您可以將JSON或SVG文件設置爲'--infile'參數。另外,爲什麼要導出到SVG文件並將其傳遞到節點導出服務器?您可以使用JSON形式傳遞圖表選項。例如:'highcharts-export-server --infile chart.json --outfile chart.png'。 –
是的,但我不想使用CLI命令。我編輯了我的問題,現在可能更清楚了.. – Coemgen
只是爲了理解這個問題:您想從highchart-export-server生成svg,然後將該svg傳遞給另一個api? –