简体   繁体   中英

Highcharts, how to localize language when exporting

I'm exporting a chart through an API call to export.highcharts.com with a JSON blob. In JavaScript localization is set on the global HighCharts object, and that works fine while exporting because the Highcharts library calls the server with an SVG blob that contains the localization. But when I try to call the API with my JSON blob I can't find a way to add localization langauge. The API is called from my backend (Scala, not JavaScript).

Does anyone know how to call the export server for Highcharts (with a JSON blob) and get localized language?

A bit of a workaround is to use the callback POST parameter to Highcharts.setOptions and chart.redraw for the changes be visible.

For example ( Russian JSFiddle example ):

Highcharts.post("http://export.highcharts.com/", {
    filename: "chart",
    type: "image/png",
    callback: "function(chart) { Highcharts.setOptions({ lang:{ /* my lang */ } }); chart.redraw(); }",
    options: "{ /* my options */ };"
});

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