code: function buildScales() {
              let yMax = d3Array.max(data.map(getValue));
  
              if (isHorizontal) {
                  xScale = d3Scale.scaleLinear()
                      .domain([0, yMax])
                      .rangeRound([0, chartWidth - 1]);
                  // 1 pix for edge tick
  
                  yScale = d3Scale.scaleBand()
                      .domain(data.map(getName))
                      .rangeRound([chartHeight, 0])
                      .padding(0.1);
  
                  yScale2 = d3Scale.scaleBand()
                      .domain(data.map(getGroup))
                      .rangeRound([yScale.bandwidth(), 0])
                      .padding(0.1);
              } else {
                  xScale = d3Scale.scaleBand()
                      .domain(data.map(getName))
                      .rangeRound([0, chartWidth])
                      .padding(0.1);
                  xScale2 = d3Scale.scaleBand()
                      .domain(data.map(getGroup))
                      .rangeRound([0, xScale.bandwidth()])
                      .padding(0.1);
  
                  yScale = d3Scale.scaleLinear()
                      .domain([0, yMax])
                      .rangeRound([chartHeight, 0])
                      .nice();
              }
  
              colorScale = d3Scale.scaleOrdinal()
                  .range(colorSchema)
                  .domain(data.map(getGroup));
  
              categoryColorMap = colorScale
                  .domain(data.map(getName)).domain()
                  .reduce((memo, item) => {
                      data.forEach(function (v) {
                          if (getName(v) == item) {
                              memo[v.name] = colorScale(v.group)
                              memo[v.group] = colorScale(v.group)
                              memo[v.group + item] = colorScale(v.group)
                          }
                      })
                      return memo;
                  }, {});
          }
docs: Creates the x, y and color scales of the chart
  @private