d3plus / d3plus-viz

Abstract ES6 class that drives d3plus visualizations.
MIT License
7 stars 2 forks source link

colorScalePosition false not disabling colorScale #153

Closed davelandry closed 3 years ago

davelandry commented 3 years ago

LOL this example is lying: http://d3plus.org/examples/d3plus-geomap/hiding-colorscale/

Here's the line causing the bug: https://github.com/d3plus/d3plus-viz/blob/master/src/_drawColorScale.js#L13

ffigueroal commented 3 years ago

@davelandry Looking on this bug I found that || bottom condition on suggested code line was the one causing this issue. Removing it and keeping only const position = this._colorScalePosition.bind(this)(this.config()); seems to be the solution. In this example i set colorScalePosition = false; as default value and then from top to right counter clockwise returning to false.

geomap-colorScalePosition

I also have a question related to colorScalePosition = undefined behavior. If i set it as default value i got a non colored map as the next image. I don't know if it is related with this issue or is the expected behavior. image

ffigueroal commented 3 years ago

I also tested if you don't define a colorScalePosition which i think is defined by the following code.

_this18._colorScalePosition = function () {
    return _this18._width > _this18._height ? "right" : "bottom";
};

geomap-resize-colorscaleposition

Here i setted height = 400 and width = 1520 as default behavior and then changed to width = 300 and you can see how color scale changes its position.

davelandry commented 3 years ago

Great analysis and testing @ffigueroal 🍻

I left some comments in the PR