2017-12-27 179 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