Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected gradient colors #87

Open
sebastian-raubach opened this issue Aug 8, 2017 · 1 comment
Open

Unexpected gradient colors #87

sebastian-raubach opened this issue Aug 8, 2017 · 1 comment

Comments

@sebastian-raubach
Copy link

I'm confused about the gradient parameter and how it affects the look of the heatmap.
In my case the heatmap only seems to be using a very limited range of colors from the ones I've specified.

I've set it up with the options as follows:

{
    radius: 25,
    maxZoom: 12,
    minOpacity: 0.5
    radius: 10,
    max: 1,
    blur: 10,
    gradient: {
        0: "#000000",
        0.2: "#570000",
        0.4: "#ff0000",
        0.6: "#ffc800",
        0.8: "#ffff00",
        1: "#FFFFFF"
    }
}

That's what it looks like:
https://i.imgur.com/GWuxnoM.png

The gradient below the map is what I'd expect from a gradient starting from black (0) and running to white (1). However, the colors the heatmap uses only range from about 0.55 to 0.9 (?).

Can anyone explain this? Do I need to adjust my configuration?

@sanusart
Copy link

sanusart commented Aug 9, 2018

Try:

{
    radius: 25,
    maxZoom: 12,
    minOpacity: 0.5
    radius: 10,
    max: 1,
    blur: 10,
    gradient: {
        0: "#000000",
        0.2: "#570000",
        0.4: "#ff0000",
        0.6: "#ffc800",
        0.8: "#ffff00",
        "1.0": "#FFFFFF" , // note the string of the key
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants