terrabrasilis / ams

AMS - Amazon Situation Room
GNU General Public License v3.0
0 stars 2 forks source link

Keep legend with the same number of ticks #63

Closed avancinirodrigo closed 3 years ago

avancinirodrigo commented 3 years ago

Currently, the number of thicks change depending on the min and max values.

avancinirodrigo commented 3 years ago

This code can be useful

            let scale = d3.scaleLinear()
                .domain(this.colorDomain)
                .range(this.colorRange);
            let domain = scale.domain();
            let domainSize = scale.domain().length; 
            let tickStep = (domain[domainSize-1] - scale.domain()[0]) / (this._numberOfTicks - 1);
            let ticks = d3.range(scale.domain()[0], scale.domain()[domainSize-1] + tickStep, tickStep);
            console.log(ticks);
            console.log(scale.domain());
            let legend = scale;