Skip to content

Commit

Permalink
Update Colorlegend
Browse files Browse the repository at this point in the history
  • Loading branch information
rabbl committed May 4, 2017
1 parent 7373ece commit 0411745
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/model/ColorLegend.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,17 @@ export default class ColorLegend {

calculateLegend(decimals=0) {

const factor = Math.pow(10, decimals);
if ((this._max - this._min) === 0) {
let legend = [];
legend.unshift({
color: this._spectrum[0],
value: 0
});

return legend;
}

const factor = Math.pow(10, decimals);
const nrOfColors = this._spectrum.length;
const delta = (this._max - this._min) / nrOfColors;

Expand Down

0 comments on commit 0411745

Please sign in to comment.