code: private Color getCellColour(double data, double min, double max) {
      double range = max - min;
      double position = data - min;
  
      // What proportion of the way through the possible values is that.
      double percentPosition = position / range;
  
      // Which colour group does that put us in.
      // int colourPosition = getColourPosition(percentPosition);
  
      int r = (int) (255 * red(percentPosition * 2 - 1));
      int g = (int) (255 * green(percentPosition * 2 - 1));
      int b = (int) (255 * blue(percentPosition * 2 - 1));
  
      // int r = lowValueColour.getRed();
      // int g = lowValueColour.getGreen();
      // int b = lowValueColour.getBlue();
      //
      // // Make n shifts of the colour, where n is the colourPosition.
      // for (int i = 0; i < colourPosition; i++) {
      // int rDistance = r - highValueColour.getRed();
      // int gDistance = g - highValueColour.getGreen();
      // int bDistance = b - highValueColour.getBlue();
      //
      // if ((Math.abs(rDistance) >= Math.abs(gDistance))
      // && (Math.abs(rDistance) >= Math.abs(bDistance))) {
      // // Red must be the largest.
      // r = changeColourValue(r, rDistance);
      // }
      // else if (Math.abs(gDistance) >= Math.abs(bDistance)) {
      // // Green must be the largest.
      // g = changeColourValue(g, gDistance);
      // }
      // else {
      // // Blue must be the largest.
      // b = changeColourValue(b, bDistance);
      // }
      // }
  
      return new Color(r, g, b);
    }
docs: /*
  Determines what colour a heat map cell should be based upon the cell values.