humangeo / leaflet-dvf

Leaflet Data Visualization Framework
MIT License
689 stars 152 forks source link

Layers derived from ChartDataLayer do not honor the getMarker function in options #82

Open rickj33 opened 8 years ago

rickj33 commented 8 years ago

I am using the code from the 1.0dev branch. I was trying to utilize the BarChartDataLayer and use the getMarker option to provide my own styling, however, my function was not being called. I traced it to the ChartDataLayer in the _getLayer function.

this section if (latLng) { marker = this._getMarker(latLng, options, record); marker.boundaryLayer = boundaryLayer; }

I think it should be the same as the DataLayer._getLayer in that function the code is if (location) { this._markerFunction = this.options.getMarker || this._getMarker; markerLayer = this._markerFunction.call(this, location, options, record); markerLayer.boundaryLayer = boundaryLayer; }

let me know if I am missing something

sfairgrieve commented 8 years ago

I agree. Thanks for pointing this out. I'll make that fix shortly

rickj33 commented 8 years ago

Thanks for being so responsive and open. LeafletDVF is making my life so much easier Let me know if you need any help. I cant say that I understand svg but I am willing to do what i can to help.

FYI, I posted on leaflet gitter about removing events, I found that the mouse events which DVF binds to, never get removed.

"I have a question about removing events. I saw in the L.Map the removeLayer has this piece of code if (layer.getEvents) { this.off(layer.getEvents(), layer); }

It looks like its supposed to remove all the events for the layer, but what I found was, if i make a call to add a new event to the layer, like 'mouseover' those events do not get removed. I wonder if the layer.getEvents should also include the L.Event "this._events" array"

Rick