2017-07-30 34 views

回答

3

您可以使用A(alpha)用於透明度/不透明度的RGBA值更改默認填充顏色。主要Github上page的數據地圖目前該演示代碼,例如:

const opacity = 0.2; 
 
const map = new Datamap({ 
 
    element: document.getElementById('container'), 
 
    fills: { 
 
    defaultFill: 'rgba(255, 0, 0, ' + opacity + ')' 
 
    } 
 
});
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.min.js"></script> 
 
<script src="//cdnjs.cloudflare.com/ajax/libs/topojson/1.6.9/topojson.min.js"></script> 
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/datamaps/0.5.8/datamaps.all.min.js"></script> 
 
<div id="container" style="position: relative; width: 500px; height: 300px;"></div>

相關問題