intellipharm-pty-ltd / dc-addons

dc.js chart addons
http://intellipharm.github.io/dc-addons/
MIT License
67 stars 27 forks source link

dc.leafletMarkerChart - access to popup properties #13

Closed PBrockmann closed 8 years ago

PBrockmann commented 8 years ago

How do you access to popup properties ? I would like to set the marker._popup.options.closeButton to false but cannot access to marker._popup

mapChart  = dc.leafletMarkerChart("#chart-map");

mapChart
      .width(1000)
      .height(300)
      .dimension(mapDim)
      .group(mapGroup)
...
      .popup(function(d,marker) {
        console.log(marker);
        //marker._popup.options.closeButton = false;   // not possible
        id = d.key[2] -1;
        return  "Id: " + data[id].Id;
      })
Tim-Intellipharm commented 8 years ago

Take a look at http://leafletjs.com/reference.html#marker-bindpopup. You can create a popup object and return that and it should work.

PBrockmann commented 8 years ago

Indeed, I didn't capture how simple it was. So for information, code looks like this:

mapChart  = dc.leafletMarkerChart("#chart-map");
mapChart
      .width(1000)
      .height(300)
      .dimension(mapDim)
      .group(mapGroup)
...
      .popup(function(d,marker) {
        id = d.key[2] -1;
        popup = L.popup({autoPan: false, closeButton: false});
        popup.setContent("Id: " + data[id].Id);
        return popup;
      })

Thanks