Javascript:将变量(对象)导入构造函数/选项设置器
我有一个Highchart构造函数/选项设置器:Javascript:将变量(对象)导入构造函数/选项设置器,javascript,highcharts,Javascript,Highcharts,我有一个Highchart构造函数/选项设置器: function drawChart(chart_lang) { Highcharts.setOptions({ lang: { loading: 'In caricamento...', months: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Lug
function drawChart(chart_lang) {
Highcharts.setOptions({
lang: {
loading: 'In caricamento...',
months: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
weekdays: ['Domenica','Lunedi','Martedi','Mercoledi','Giovedi','Venerdi','Sabato'],
shortMonths: ['Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'],
exportButtonTitle: 'Esporta',
printButtonTitle: 'Stampa',
rangeSelectorFrom: 'Da',
rangeSelectorTo: 'A',
rangeSelectorZoom: 'Zoom',
downloadPNG: 'Download PNG',
downloadJPEG: 'Download JPEG',
downloadPDF: 'Download PDF',
downloadSVG: 'Download SVG',
printChart: 'Stampa',
resetZoom: 'Reset'
}
});
$('div#grow').highcharts({
chart: {
type: 'column'
},
// other stuffs...
}
我回忆起此模式下的此功能:
var chart_lang = {
lang: {
loading: 'In caricamento...',
months: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
weekdays: ['Domenica','Lunedi','Martedi','Mercoledi','Giovedi','Venerdi','Sabato'],
shortMonths: ['Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'],
exportButtonTitle: "Esporta",
printButtonTitle: "Stampa",
rangeSelectorFrom: "Da",
rangeSelectorTo: "A",
rangeSelectorZoom: "Zoom",
downloadPNG: 'Download PNG',
downloadJPEG: 'Download JPEG',
downloadPDF: 'Download PDF',
downloadSVG: 'Download SVG',
printChart: 'Stampa',
resetZoom: 'Reset'
}
};
if ($('div#grow').length>0) {
drawGrowChart(chart_lang);
}
我可以使用chart\u lang
变量//对象代替drawChart()中的重写吗
谢谢你
海图。设置选项(海图)
应该可以用。不是吗?最好用可配置的object@apokryfos它是有效的。。。我的错误是和{}有关。谢谢大家!@RIYAJKHAN你能解释一下吗?谢谢大家!@那么问题解决了吗?如果不是,请提供更多信息。