humangeo / leaflet-dvf

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

RadialMeterMarker overwrites options with backgroundStyle options? #96

Open trillerpfeife opened 8 years ago

trillerpfeife commented 8 years ago

L.RadialMeterMarker draws a marker with given options but returns wrong options. For example:

var options = {
   ...
   fillOpacity: 1,
   opacity: 1,
   ...
}
L.RadialMeterMarker(latlng, options);

Returns a marker with following options:

options: {
   ...
   fillOpacity: 0.2
   Opacity: 0.8
   ...
}

I think due to the "Add a background" implementation the option properties will be overwritten, right?

for (var property in this.options.backgroundStyle) {
  options[property] = this.options.backgroundStyle[property];
}

https://github.com/humangeo/leaflet-dvf/blob/1d47d672d0ac2d617a3ddb681a33c657f7fee7a1/src/leaflet.dvf.chartmarkers.js#L924

In issue #7 I made a fiddle to show that it will break the redraw() function

sfairgrieve commented 8 years ago

Thanks for pointing this out. Let me see if I can figure out what's going on. I'll try to push an update soon.

trillerpfeife commented 8 years ago

Thanks for the fast response. I also hat issues with redrawing L.RadialBarChartMarker, after every redraw the size increases.

sfairgrieve commented 8 years ago

Pushed a potential fix to this branch: https://github.com/humangeo/leaflet-dvf/tree/feature/chartmarkerfix

Can you give this a try when you get a chance and let me know if that fixes things for you?

sfairgrieve commented 7 years ago

@trillerpfeife Did that fix work for you?

trillerpfeife commented 7 years ago

Thanks @sfairgrieve for the fix. I ended up making my own pie chart marker based on https://github.com/iatkin/leaflet-svgicon due to extend it in various ways.