code: function make_color(aggregates, all, leaf_only) {
      let colorRange;
      if (aggregates.length >= 2) {
          colorRange = [Infinity, -Infinity];
          for (let series of all) {
              let colorvals = series["data"];
              for (let i = 1; i < colorvals.length; ++i) {
                  if ((leaf_only && colorvals[i].leaf) || !leaf_only) {
                      colorRange[0] = Math.min(colorRange[0], colorvals[i].colorValue);
                      colorRange[1] = Math.max(colorRange[1], colorvals[i].colorValue);
                  }
              }
              if (colorRange[0] * colorRange[1] < 0) {
                  let cmax = Math.max(Math.abs(colorRange[0]), Math.abs(colorRange[1]));
                  colorRange = [-cmax, cmax];
              }
          }
      }
      return colorRange;
  }
docs: ****************************************************************************
  
  Tree