看來,在一個階梯xaxis正常的「showLastLabel」doesn't work。就我而言,我只是每十年展示一次;但如果我想在任何情況下看到最新的一年,這是行不通的。 Here is a fiddle。如何強制Highcharts在xAxis上顯示最後一個標籤?
$(function() {
var chart = new Highcharts.Chart(
{
chart:
{
renderTo: "container",
type: "line"
},
title:
{
text: "Emissions of CO2 - from Fossil Fuels - Total (CDIAC)"
},
xAxis:
{
categories: ['1961','1962','1963','1964','1965','1966','1967','1968','1969','1970','1971','1972','1973','1974','1975','1976','1977','1978','1979','1980','1981','1982','1983','1984','1985','1986','1987','1988','1989','1990','1991','1992','1993','1994','1995','1996','1997','1998','1999','2000','2001','2002','2003','2004','2005','2006','2007','2008','2009','2010'],
labels:
{
step: 10
},
showLastLabel: true,
endOnTick: true
},
yAxis:
{
min: 0
},
series:
[ {
data: [836290,884698,947139,970623,961804,953139,937905,986489,1053841,1027857,1039329,1043832,1088357,1065419,1005220,1094115,1055965,1082764,1121897,1104068,1052479,1019684,1015786,1037513,1048350,1051961,1036999,1033773,1017926,1014450,930734,892705,878363,866267,864817,890342,862982,856064,823133,830657,854361,829449,834088,826572,807363,809521,784657,784000,732848,745994],
name: "Germany"
}]
});
});
感謝您的任何提示!
您沒有2011年的數據。如果您添加2011年的數據,它將顯示標籤。 – Dmitry 2014-10-20 14:09:30
但我希望它顯示2010年的xaxis標籤,因爲這是最後一年。 – luftikus143 2014-10-20 14:29:16