Solve the problem of highcharts export function in Chinese

Source: Internet
Author: User

Transferred from: http://www.cnblogs.com/jyh317/p/4191841.html

This article takes the example of Highcharts Chinese online as a prototype to deal with the problem of solving the highcharts export function in English.

We use Highcharts of course we want all the hints or text to be in Chinese, but the default language for Highcharts is English, for example.

  

So how to change the image to export the function of the hint into Chinese?

This paper uses Highcharts's online test platform to solve this problem.

Just add a global setting to solve this problem.

  

  Highcharts.setoptions ({            lang: {               printchart: "Print chart",                  downloadjpeg: "Download jpeg picture",                   downloadpdf: " Download PDF Document "  ,                  downloadpng:" Download png image "  ,                  downloadsvg:" Download svg vector ",                   exportbuttontitle:" Export picture "             }        });

$ (function () {highcharts.setoptions ({lang: {printchart: "Print chart", Downloa                  Djpeg: "Download JPEG image", downloadpdf: "Download PDF document", Downloadpng: "Download png image",    Downloadsvg: "Download svg vector graph", Exportbuttontitle: "Export Picture"}); Set up the chart var chart = new Highcharts.chart ({chart: {renderto: ' container ', Typ                E: ' column ', margin:75, Options3d: {enabled:true, alpha:15,            Beta:15, depth:50, viewdistance:25}}, Title: { Text: ' Chart rotation demo '}, subtitle: {text: ' Test options by dragging the sliders below            '}, Plotoptions: {column: {depth:25}}, series: [{ Data: [29.9, 71.5, 106.4, 129.2,144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]});        Activate the Sliders $ (' #R0 '). On (' Change ', function () {chart.options.chart.options3d.alpha = This.value;        ShowValues ();    Chart.redraw (FALSE);    });        $ (' #R1 '). On (' Change ', function () {Chart.options.chart.options3d.beta = This.value;        ShowValues ();    Chart.redraw (FALSE);    });        function ShowValues () {$ (' #R0-value '). HTML (Chart.options.chart.options3d.alpha);    $ (' #R1-value '). HTML (Chart.options.chart.options3d.beta);                 } showvalues ();});

Final effect:

  

In fact, Highcharts is not mysterious, as long as you think of what you want, you can consult the Highcharts API to achieve your goal.

For example, we need to change the English in the export function to Chinese. There are two ways to solve this problem.

1. Query the settings of the export function from the API.

Look at the above list, we did not find the language settings, of course, we can modify exporting.js to achieve our goal, but it is best not to move the Highcharts JS, can be set by the implementation of the function is not modified (destroy its encapsulation).

2, the setting language is mostly related to Lang, then we look through the API in the global settings of Lang

  

In the global configuration of Lang, we found that we need to change the English hint, then how to modify its default value?

Check API ...

How Lang is set up:

  

Highcharts.setoptions ({    lang: {        months: [' janvier ', ' février ', ' Mars ', ' Avril ', ' Mai ', ' Juin ',  ' Juillet ', ' Ao?t ', ' septembre ', ' octobre ', ' novembre ', ' décembre ',        weekdays: [' dimanche ', ' Lundi ', ' Mardi ', ' mercredi ', ' Jeudi ', ' vendredi ', ' samedi ']    }});

As on the analysis of ideas, we agreed through the API into the world of Highcharts, highcharts style is very beautiful, interactive very good, very vivid, very dynamic performance of your data chart, it is worth a try.

Solve the problem of highcharts export function in Chinese

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.