我的布局有以下代码:
var layout = {
title:"Energy usage of green electrical appliances",
plot_bgcolor:"#000",
paper_bgcolor:"#000",
showlegend:false,
margin:"{l: 40, b: 40, r: 80, t: 40,}",
xaxis:{
title:"Date/Time",
autoscale:"true",
rangeselector: {
bgcolor:"#555",
},
yaxis:{
title:"Price",
autoscale:"true",
overlaying:"y2",
side:"left",
},
yaxis2: {
title:"Electricity Used",
autoscale:"true",
side:"right"
},
yaxis3:{
title:"AiJ/day",
autoscale:"true",
side:right
}
}
以及我的数据的以下代码:
var tracePrice= {name:"Price",type:"scatter",x:output[0]["datetime"],y:output[0]["price"],line:{color:"orange",width:2},};
var traceElecUsed= {name:"Elec",type:"bar",x:output[0]["datetime"],y:output[0]["Elec"],line:{color:"cyan",width:2},};
var traceAiJ= {name:"aij",type:"scatter",x:output[0]["datetime"],y:output[1]["aijpercent"],yaxis:"y2",marker:{color:"#fff"},line:{color:"#555",width:1}};
return resolve([tracePrice,traceElecUsed,traceAiJ]);
问题是,在我绘制 traceElecUsed 之前一切正常。它使用的单位数以千计,而价格通常低于 5 英镑,而 AiJ 的百分比为 0-100%。我不知道这是否是问题的根源。如果我删除它一切正常。