使用highcharts,您可以使用内置按钮下载当前图表(例如:http://www.highcharts.com/demo/ ,此按钮:
).您可以将其保存为PNG,JPEG,PDF或SVG.
我想要做的是创建一个链接,将图像保存在服务器上,而不是下载它.我怎么能这样做?
我想我必须修改exportChartexports.src.js文件中的函数.它看起来像这样(但我不知道javascript足以做到这一点):
exportChart: function (options, chartOptions) {
var form,
chart = this,
svg = chart.getSVG(chartOptions);
// merge the options
options = merge(chart.options.exporting, options);
// create the form
form = createElement('form', {
method: 'post',
action: options.url
}, {
display: NONE
}, doc.body);
// add the values
each(['filename', 'type', 'width', 'svg'], function (name) {
createElement('input', {
type: HIDDEN,
name: name,
value: {
filename: options.filename || 'chart',
type: options.type,
width: options.width,
svg: svg
}[name] …Run Code Online (Sandbox Code Playgroud)