?
?
?
在使用highcharts作为web图表的显示插件时,因为highcharts是老外开发的,所以按钮内容当然也是英文了。
不过,highcharts 的api也为我们汉化提供了汉化的属性设置,
highcharts lang属性就是设置这些按钮汉化的地方
lang: { decimalPoint: "." downloadJPEG: "Download JPEG image" downloadPDF: "Download PDF document" downloadPNG: "Download PNG image" downloadSVG: "Download SVG vector image" exportButtonTitle: "Export to raster or vector image" loading: Loading... months: ['January' 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], numericSymbols: ['k', 'M', 'G', 'T', 'P', 'E'] printButtonTitle: "Print the chart" resetZoom: Reset zoom resetZoomTitle: Reset zoom level 1:1 shortMonths: ['Jan' 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], thousandsSep: "", weekdays: ['Sunday' 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] }
其中这些属性对应的 内容可以改为汉语就行了 ,不用去再改源码了。
downloadJPEG: "下载JPEG 图片"
downloadPDF: "下载PDF文档"
downloadPNG: "下载PNG 图片"
downloadSVG: "下载SVG 矢量图"
exportButtonTitle: "导出图片"
示例代码:
$(function () { var chart = new Highcharts.Chart({ chart: { renderTo: 'container' }, lang{ downloadJPEG: "下载JPEG 图片" downloadPDF: "下载PDF文档" downloadPNG: "下载PNG 图片" downloadSVG: "下载SVG 矢量图" exportButtonTitle: "导出图片" }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, subtitle: { text: 'The subtitle', style: { color: '#FF00FF', fontWeight: 'bold' } }, 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] }] }); });
?