stormpython/heatmap

Upper boundary missing

Closed this issue · 1 comments

In this attached pic, the upper boundary is 100 but it's not shown, so appears to be unbounded.

screen shot 2016-03-15 at 16 09 48 pm

Can this be added in?

@markwalkom you are absolutely right. I forgot to add the upper limit.

Bug is here. Should be:

.datum([0].concat(colorScale.quantiles()).concat(colorScale.domain()[1]))

I will also need to modify the code in the legend here to handle the last bucket.

Something to the extent of:

if (i !== data.length - 1) {
  return Math.round(d) + ' - ' + Math.round(data[i + 1]);
}

But, there is an issue of an extra rect being added that will need to be removed when implementing these changes.

This can be handled by removing the last item in the data array and saving it as a variable. For example:

var upperLimit = data.pop();

Now, the data binding will create the appropriate number of g elements. And here, I can add:

return (i === data.length - 1) ? Math.round(d) + ' - ' Math.round(upperLimit) : Math.round(d) + ' - ' + Math.round(data[i + 1]);