如果yaxis包含null dateTime数据并且useUTC为false,则图表不会呈现并引发脚本错误



我正试图用所有null值在柱形图上的yaxis上绘制日期,因此在useUTC设置为false的情况下,空图表应作为输出。但它会在控制台上显示脚本错误。当我将useUTC设置为true时,它将绘制空图表。提前谢谢。应为:要绘制的空图表。查看下面的小提琴以供参考。https://jsfiddle.net/2ekch139/1/

Highcharts.setOptions({
global: {
useUTC: false
}
});
Highcharts.chart('container', {
"chart": {
"backgroundColor": "rgba(255,255,255,0)",
"plotBackgroundColor": "rgba(255,255,255,0)",
"zoomType": "xy",
"resetZoomButton": {
"theme": {
"visibility": "hidden"
}
},
"alignTicks": true,
"options3d": {
"enabled": false
},
"renderTo": {},
"events": {}
},
"title": {
"text": ".",
"style": {
"color": "rgba(255, 255, 255, 0)",
"fontSize": "1px"
}
},
"tooltip": {
"enabled": true,
"borderWidth": 1,
"borderRadius": 1,
"backgroundColor": "#ffffff",
"style": {
"color": "#000000",
"fontSize": "1rem",
"fontFamily": "Open Sans",
"fontWeight": "normal",
"fontStyle": "normal",
"textDecoration": "none"
},
"useHTML": true,
"shared": false,
"crosshairs": [false, false],
"followPointer": true
},
"plotOptions": {
"series": {
"animation": {
"duration": 700
},
"cursor": "pointer",
"allowPointSelect": true,
"showInLegend": true,
"turboThreshold": 0,
"stickyTracking": false,
"events": {},
"point": {
"events": {}
},
"pointPadding": 0.1,
"getExtremesFromAll": true
}
},
"legend": {
"enabled": true,
"item": {},
"borderWidth": 0,
"layout": "horizontal",
"backgroundColor": "rgba(255,255,255,0)",
"itemStyle": {
"color": "#000000",
"fontSize": "1rem",
"fontFamily": "Open Sans",
"fontWeight": "normal",
"fontStyle": "normal",
"textDecoration": "none"
},
"align": "center",
"verticalAlign": "bottom",
"margin": 0,
"padding": 5,
"symbolRadius": 0
},
"credits": {
"enabled": false
},
"exporting": {
"enabled": false
},
"lang": {
"noData": ""
},
"xAxis": {
"title": {
"text": "xaxis",
"style": {
"color": "#000000",
"fontFamily": "Open Sans",
"fontSize": "1rem",
"fontStyle": "normal",
"fontWeight": "normal",
"textDecoration": "none",
"opacity": "1"
},
"align": "middle",
"margin": 5
},
"opposite": false,
"axisInternalName": "0",
"labels": {
"enabled": true,
"style": {
"color": "#000000",
"fontFamily": "Open Sans",
"fontSize": "1rem",
"fontStyle": "normal",
"fontWeight": "normal",
"textDecoration": "none"
},
"rotation": 330
},
"lineWidth": 1,
"lineColor": "rgba(174,174,174,1)",
"id": "xAxis0",
"tickWidth": 1,
"categories": ["01/10/2001 00:00:00", "01/12/2001 00:00:00", "01/09/2006 00:00:00", "01/12/2012 00:00:00"],
"tickmarkPlacement": "on",
"gridLineWidth": 0,
"gridLineColor": "#C0C0C0",
"plotLines": [],
"plotBands": [],
"max": null,
"scrollbar": {
"enabled": false
}
},
"yAxis": [{
"title": {
"text": "yaxis",
"style": {
"color": "#000000",
"fontFamily": "Open Sans",
"fontSize": "1rem",
"fontStyle": "normal",
"fontWeight": "normal",
"textDecoration": "none",
"opacity": "1"
},
"align": "middle",
"margin": 5
},
"opposite": false,
"axisInternalName": "0",
"labels": {
"enabled": true,
"style": {
"color": "#000000",
"fontFamily": "Open Sans",
"fontSize": "1rem",
"fontStyle": "normal",
"fontWeight": "normal",
"textDecoration": "none"
},
"rotation": 0,
"align": "center"
},
"lineWidth": 0,
"lineColor": "rgba(174,174,174,1)",
"tickWidth": 0,
"allowDecimals": false,
"reversed": false,
"id": "yAxis0",
"gridLineWidth": 0,
"gridLineColor": "#C0C0C0",
"maxPadding": 0.05,
"minPadding": 0,
"plotLines": [],
"plotBands": [],
"type": "datetime",
"startOnTick": false
}],
"boost": {
"enabled": false,
"seriesThreshold": 2
},
"series": [{
"zIndex": 1,
"internalName": "CustomerSale__Custom_Product__Msr_ORDER_DATE",
"softThreshold": true,
"type": "column",
"yAxis": 0,
"data": [null, null, null, null],
"name": "series name",
"showInLegend": true,
"dataLabels": {
"enabled": false
},
"tooltipBackgroundColor": "#ffffff",
"point": {
"events": {}
},
"boostThreshold": 5001,
"color": "rgba(0,41,170,1)",
"borderColor": "rgba(0,41,170,1)",
"fillColor": "rgba(0,41,170,1)",
"depth": 40,
"states": {
"select": {
"color": null
}
},
"borderWidth": 0,
"maxPointWidth": "70",
"id": "series0"
}]
});

它在控制台上抛出脚本错误作为-

highcharts.src.js:10151 Uncaught TypeError: Cannot read property 'toString' of undefined
at Time.getTimezoneOffset (highcharts.src.js:10151)
at Time.getTimeTicks (highcharts.src.js:10411)
at Axis.q.getTimeTicks (stock.src.js:3771)
at Axis.setTickPositions (highcharts.src.js:15873)

这看起来像是一个回归。我在Highcharts Github问题频道上报道了这一点,这个帖子将在那里继续。

https://github.com/highcharts/highcharts/issues/14746

最新更新