您好基于这个传单教程http://leafletjs.com/examples/choropleth.html我正在尝试创建20个按钮,以便我可以更改行:fillColor:getColor(feature.properties.density)到不同(例如通过按btn#1 fillColor:getColor(feature.properties.btn1),btn#2 fillColor:getColor(feature.properties.btn1)等
function style(feature) {
return {
fillColor: getColor(feature.properties.density),
weight: 2,
opacity: 1,
color: 'white',
dashArray: '3',
fillOpacity: 0.7
};
}
L.geoJson(statesData, {style: style}).addTo(map);
Run Code Online (Sandbox Code Playgroud)
我想要的只是按下一个按钮,显示一个不同的geojson属性.