2016-11-16 48 views

回答

0

您将需要三个阵列添加到您的数据:平均值,最小值和最大值。首先绘制平均值,然后分钟和最大值。使用fill: 'tonexty',这是让阴影。

var plotDiv = document.getElementById('plot'); 
 
var traces = [ 
 
    {name: 'avg', x: [1,2,3], y: [1,3,2], marker:{color: 'blue'}}, 
 
\t {name: 'min', x: [1,2,3], y: [0.5,2,1], marker:{color: 'lightblue'}}, 
 
\t {name: 'max', x: [1,2,3], y: [3,6,2.5], fill: 'tonexty', marker:{color: 'lightblue'}} 
 
]; 
 

 

 
Plotly.newPlot(plotDiv, traces)
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script> 
 
<div id='plot'> 
 

 
</div>