2017-12-27 311 views

回答

1

該圖例不是Mapbox GL的一部分,只是一個絕對定位在地圖上的HTML/CSS元素。 所以如果你需要一個2D傳奇,你可以簡單地用一個<table>元素替代它:

<table style="position: absolute; bottom: 30px; right: 10px; z-index:1, backgroung-color: white"> 
    <tr> 
    <th></th> 
    <th>Column 1</th> 
    <th>Column 2</th> 
    </tr> 
    <tr> 
    <th>Row 1</th> 
    <td>(1, 1) value </td> 
    <td>(1, 2) value</td> 
    </tr> 
    <tr> 
    <th>Row 2</th> 
    <td>(2, 1) value</td> 
    <td>(2, 2) value</td> 
    </tr> 
</table> 
+0

感謝@MeltedPenguin我想表本身中添加基於顏色的標籤,我該怎麼做呢?至於我到目前爲止,請看這裏:https://files.fm/u/bu2nhbhu。對於我想要它看起來像看到這裏:https://files.fm/u/g6jvbztx。 –

+0

基於顏色的標籤由所有''元素創建。所以你需要做的是用我們的例子中的'Row X'替換爲'' – MeltedPenguin