问题描述
我已经创建了带有高图的样条图,它对多个数据运行良好。但是当我有一个系列记录时,它不会在图表上绘制任何内容。
请检查下面的 jsfiddle,其中包含多个工作正常的数据。 https://jsfiddle.net/6ntu7Ls1/1/
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px; width: 95%"></div>
Highcharts.chart('container',{
chart: {
type: 'areaspline',marginTop: 4,plotBackgroundColor: '#f2f2f2',backgroundColor: '#f2f2f2',zoomType: '',resetZoomButton: {
theme: {
r: 20
},position: {
x: -5,y: 5
}
},},title:{text:''},xAxis: {
type: 'datetime',dateTimeLabelFormats: {
millisecond: '%b-%d-%Y',second: '%b-%d-%Y',minute: '%b-%d-%Y',hour: '%b-%d-%Y',day:'%b-%d-%Y',week: '%b-%d-%Y',month: '%b-%d-%Y',year: '%Y'
},min: 1618444800000,max: 1618531200000,tickPixelInterval: 150,minTickInterval: undefined,tickInterval: null,gridlinewidth: 0,linewidth: 0,yAxis: {
title: (function () {
return {
text:'(PD%)',align: 'high',margin: -18,offset: 20,y: -100,x: 10,rotation: 0,style: {
fontSize: '11px'
}
};
})(),min: 0,max: 4.8017044515217,labels: {
},showFirstLabel: true,showLastLabel: true,opposite: false,tickInterval: undefined,tickAmount: 5,gridlinewidth:0,minorGridlinewidth :0,lineColor: 'transparent',startOnTick:false,endOnTick:true,plotBands:
{
from: 4.8017044515217,to:100,color: '#fbb189',}
},tooltip: {
enabled: false
},credits: {
enabled: false
},plotOptions: {
areaspline: {
fillOpacity: 1,zoneAxis: 'x',linewidth:0,zones:[],minorGridlinewidth: 0,series: {
marker: {
enabled: false
},states: {
hover: {
enabled: false
}
},dataLabels: {
enabled: false,inside: false,style: {
fontWeight: "bold",events: {
legendItemClick() {
return false;
}
},enableMouseTracking: false,tooltip: {
enabled: false
},series: [
{
color: '#fbb189',name: 'Deteriorating',showInLegend: false,data: [{x: 1618444800000,y: 4.8017044515217},{x: 1618531200000,y: 4.8017044515217}],legendindex: 3
},{
color: '#fff2d0',name: 'Stable',y: 1.5426857827908},y: 1.5389919557792}],legendindex: 2
},{
color: '#c2e0b7',name: 'Improving',data: [{x: 1618444800000,y: 0.5853383784494},y: 0.5819433217592}],legendindex: 1
},{
name: '',type: 'spline',y: 0.6352655741304001},y: 0.6339928215217}],legendindex: 0,color: 'red'
}
]
});
以下是运行jsfiddle的截图:
请检查下面的 jsfiddle 是否有不工作的单个数据。 https://jsfiddle.net/g3m0x25d/
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px; width: 95%"></div>
Highcharts.chart('container',}
},y: 1.5426857827908}],y: 0.5853383784494}],y: 0.6352655741304001}],color: 'red'
}
]
});
以下是无法正常工作的小提琴的屏幕截图:
解决方法
我认为一切正常,将 plotOptions.series.marker.enabled
设置为 false 以隐藏点。