2016-11-16 68 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>