简体   繁体   中英

dcjs.leaflet from addons The popup in Choropleth doesn't work

In dc.leaflet version 0.2.3 for the Choropleth Chart the popup doesn't work or it doesn't get rendered. Am I wrong or it happens to anybody else? I will be happy to fix that but I would need some help.

  .renderPopup(true)
  .popup(function(d,feature) {
    return feature.properties.name+" : "+d.value;
  });

Anyway, any help would be really appreciated

https://github.com/dc-js/dc.leaflet.js/issues/22

Thanks in advance

The popup in the addons also did not work for me. However, you can apply the same logic to the standard dc_leaflet.markerChart function and achieve the popups.

Here is an example usage that worked:

  var marker = dc_leaflet.markerChart("#demo1 .map", groupname) //map formatting
      .dimension(restaurantNames)
      .group(restaurantsGroup)
      .width(700) //was 600
      .height(500)
      .center([43.733372, -79.354782]) //was 42.69,25.42
      .zoom(11) //was 7s
      .cluster(true) //was true
      .valueAccessor(function(kv) {
            return kv.value.count;
      })
      .locationAccessor(function(kv) {
            return [kv.value.latitude,kv.value.longitude]   ;
      })
      .popup(function(kv,marker) {
            return kv.value.name + " - " + kv.value.stars + " * - "  + 
            kv.value.price_range + "$";
      });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM