Lütfen y-ekseni etiketinin ayarlanma yolunu tartışmak için Highcharts text labels for y-axis'a bakınız.Highcharts TypeScript, y ekseni etiketi
TypeScript tanımımda https://github.com/borisyankov/DefinitelyTyped/blob/master/highcharts/highcharts.d.ts kullandım, ancak y ekseni biçimlendiricisini tanımlamanın bir yolunu bulamadım.
Daha önce hiç denemiş olan var mı?
- Güncelleme -
My Origianl JavaScript kodu Her çubuk olan bir this.value sahip kod
var yearChartOptions = {
yAxis: {
plotLines: [{
label: {
formatter: function() {
return '$' + Highcharts.numberFormat(this.value/1000, 0) +'k ';
}
},
}]
},
};
// Create the chart
var yearChart = new Highcharts.Chart(yearChartOptions);
olan değeri (I çubuk grafik kullanılır). TypeScript'te (henüz diziyi kaldırmak için değiştirmedim).
var yearChartOptions: HighchartsOptions = {};
yearChartOptions.chart = {};
yearChartOptions.yAxis = [];
yearChartOptions.yAxis[0] = {};
yearChartOptions.yAxis[0].plotLines = {};
yearChartOptions.yAxis[0].plotLines.label = {};
yearChartOptions.yAxis[0].plotLines.label.style.formatter(() => "$" + Highcharts.numberFormat(this.value/1000, 0) + "k ");
// Create the chart
var yearChart = new Highcharts.Chart(yearChartOptions);
çıkış
/*
Compile Error.
See error list for details
D:/MyProject/Scripts/test.ts(36,56): The property 'formatter' does not exist on value of type 'HighchartsCSSObject'
D:/MyProject/Scripts/test.ts(36,107): The property 'value' does not exist on value of type 'Dashboard'
*/
olduğunu Ve derlemek olmaz.
olası yinelenen http://stackoverflow.com/questions/4987457/highcharts-text-labels-for-y-:
Tam çalışma örnek, koduna göre eksen) –
Bunun bir kopya olduğunu sanmıyorum. Poster bu cevapta olduğu gibi kod kullanmaya çalışıyor ancak TypeScript derleyicisi bunu reddediyor. – Fenton
@hardywang güncellenmiş tanımı sorununuzu çözdü mü? – Fenton