mourner / simpleheat

A tiny JavaScript library for drawing heatmaps with Canvas
http://mourner.github.io/simpleheat/demo
BSD 2-Clause "Simplified" License
932 stars 185 forks source link

Values larger than the maximum are visualized incorrectly #26

Closed marcelhohn closed 7 years ago

marcelhohn commented 7 years ago

Values that are larger than the maximum specified for the heatmap are not colorized correctly. This happens because a ctx.globalAlpha greater than 1 is ignored, so the color of the previously drawn circle is used again. Values that are larger than the maximum value should be drawn in the same colour as the maximum value.

This picture demonstrates the current behaviour: simpleheat_current

This picture demonstrates the expected behaviour (at least what I would expect): simpleheat_expected

steps to reproduce this issue:

var data = [[20, 20, 2], [120, 120, 3], [220, 220, 1], [320, 320, 3]];

I also opened a pull request with a fix for this issue.

marcelhohn commented 7 years ago

Pull request for this issue: #27

mourner commented 7 years ago

Fixed in #27