Tôi muốn làm cho tập tin bản đồ ở phía sau với một dự án Net LõiHighcharts exportSettings với tập tin svg
Vì vậy, mục đích là để thực hiện thư viện Highmaps trên middleware javascript và xuất file svg để "node-export-server".
Tôi có API nhận được từ khách hàng một số dữ liệu. Tôi muốn tạo tập tin bản đồ SVG với thư viện Highmap và sau đó gửi đến một API khác mà sẽ chứa một phần mềm trung gian để thực thi mô-đun nút gor xuất PNG/JPG/....
Cách để chuyển một tệp svg sang mô-đun "nút-xuất-máy chủ" là gì? Tôi đã đọc tài liệu liên kết nhưng tôi không tìm thấy cách ... (https://github.com/highcharts/node-export-server/blob/master/README.md)
Tôi muốn chuyển tệp SVG của mình bằng mẫu này.
//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);
});
Ý của bạn là gì? Bạn có thể đặt tệp JSON hoặc SVG làm đối số '--infile'. Ngoài ra, tại sao bạn muốn xuất sang tệp SVG và chuyển nó sang nút xuất-máy chủ? Thay vào đó, bạn có thể chuyển tùy chọn biểu đồ dưới dạng JSON. Ví dụ: 'highcharts-export-server --infile chart.json --outfile chart.png'. –
Có, nhưng tôi không muốn sử dụng lệnh CLI. Tôi đã chỉnh sửa câu hỏi của mình, có thể rõ ràng hơn bây giờ .. – Coemgen
Chỉ cần hiểu câu hỏi: bạn muốn tạo svg từ highchart-export-server và sau đó chuyển svg đó sang api khác? –