我目前在我的代码中有一个 Highcharts,我使用 JavaScript 通过创建 JSON 对象来处理数据,代码片段看起来像
var yearChartOptions = {
chart: {
renderTo: 'YearChartContainer',
type: 'column',
margin: [ 50, 50, 50, 50]
},
title: {
text: ''
},
xAxis: {
categories: [],
labels: {
rotation: -90,
align: 'right'
}
},
yAxis: {
title: {
text: ''
},
plotLines: [{
color: '#FF0000',
width: 2,
label: {
style: {
color: 'blue',
fontWeight: 'bold',
zIndex: -1
},
formatter: function () {
return '$' + Highcharts.numberFormat(this.value/1000, 0) +'k ';
}
},
zIndex: 10
}]
},
};
// Create the chart
var yearChart = new Highcharts.Chart(yearChartOptions);
如何在 TypeScript 中编写以获得相同的 JavaScript 结果?