简体   繁体   中英

How to change exporting filename in highcharts

I want to change the filename of files downloaded from Highcharts 2.3.5 export but I am not able to do so. I have tried to change it but wasn't successful. fiddle link

I have tried to change to chart_new_name but it only downloads a file named chart.[required extension (png,jpeg,pdf,svg)].

exportChart: function (a, b) {
        var c = this.options.exporting,
            d = this.getSVGSH(l(c.chartOptions, b)),
            a = l(c, a);
        e.post(a.url, {
            filename: a.filename || "chart"+_newname,
            type: a.type,
            width: a.width,
            scale: a.scale || 2,
            svg: d
        })

Downloads only chart.[png ,jpg,pdf] but I need it to download chart_newname.[png,jpg,pdf]

You should use exporting.filename option for this:

exporting: {
    filename: 'custom-file-name'
}

Live example: jsFiddle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM