我怀疑这与分组有关,这是图表选项对象。情节线和系列是异步添加的。我的标志系列有 text 参数。知道我可能缺少什么,或者这真的是数据分组的产物吗?
更新:我今天注意到当我将鼠标悬停在标志上时出现“未捕获的类型错误:无法读取未定义的属性‘周’”
chartOptions = {
chart: {
renderTo: 'chart',
backgroundColor:'rgba(255, 255, 255, 0.1)',
borderWidth: 0,
borderColor: "#FFFFFF",
defaultSeriesType: 'spline',
zoomType: 'x'
},
colors: [
'#666666',
'#AA4643',
'#4572A7'
],
rangeSelector: {
buttonSpacing: 5,
buttonTheme: {
style: {
padding: "0 3px"
},
width: null
},
selected: 2,
buttons: [
{
type: 'day',
count: 1,
text: 'Day'
},
{
type: 'month',
count: 1,
text: 'Month'
},
{
type: 'year',
count: 1,
text: 'Year'
},
{
type: 'all',
text: 'All'
}
]
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
day: '%e %b \'%y',
month: '%b \'%y',
year: '%b \'%y'
},
plotLines: []
},
yAxis: {
maxPadding: .05,
minPadding: .05,
title: {
text: 'Demand (kW)'
}
},
navigator: {
enabled: true
},
legend: {
enabled: true,
layout: 'horizontal',
align: 'center',
verticalAlign: 'top',
floating: true,
borderWidth: 0,
y: -5
},
plotOptions: {
series: {
dataGrouping: {
approximation: "average",
groupPixelWidth: 30,
smoothed: true,
unit: [
['minute', [1]],
['hour', [1]],
['day',[1]],
['week',[1]],
['month',[1]],
['year',null]
]
},
events: {
legendItemClick: function(event) {
return !(this.name == 'Baseline');
}
},
connectNulls: false,
marker: {
enabled: false,
states: {
hover: {
enabled: false
}
}
}
},
flags: {
showInLegend: false,
style: {
borderColor: '#cc0000',
color: '#cc0000'
}
}
},
series: []
};