Reading-eScience-Centre / leaflet-coverage

A Leaflet plugin for visualizing coverages
https://covjson.org/playground/
Other
9 stars 6 forks source link

Custom palettes #6

Open fsvieira opened 8 years ago

fsvieira commented 8 years ago

Hi,

I think it would be a great addition to leaflet-coverage if users are able to change or make a custom palette, the palette could have custom ranges values and colors.

Also it would be cool to have predefined palettes that would paint any map, using percentage instead of values, percentages would be calculated based on min max values of the map.

letmaik commented 8 years ago

Inspiration for implementation: http://matplotlib.org/users/colormapnorms.html

pzaborowski commented 6 months ago

There is now option to provide pallet in this way.

var _palette = {
    red:    [0,167,116,71,38,18,255],
    green:  [0,233,229,229,229,229,0],
    blue:   [255,213,165,57,39,20,0],
    steps: 7,
    paletteExtent:[0,2],
    interpolation: 'linear'
    }
...
layer = C.dataLayer(cov, {parameter: p.key, palette: _palette})

not as the one provided in separate link, but looked into the implementation and many todos. Actually it implements only linear palette where I needed to use Poisson visualisation I needed to generate looong one with all the 100 values.