Lucky
Lucky

Reputation: 575

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]

Upvotes: 0

Views: 2575

Answers (1)

Emre Bolat
Emre Bolat

Reputation: 4552

You should use exporting.filename option for this:

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

Live example: jsFiddle

Upvotes: 2

Related Questions