code: public static String createLabel(final double value, final String unit, final GridLabelFormat format) {
          final double zero = 0.000000001;
          if (format != null) {
              return format.format(value, unit);
          } else {
              if (Math.abs(value - Math.round(value)) < zero) {
                  return String.format("%d %s", Math.round(value), unit);
              } else if ("m".equals(unit)) {
                  // meter: no decimals
                  return String.format("%1.0f %s", value, unit);
              } else if (NonSI.DEGREE_ANGLE.toString().equals(unit)) {
                  // degree: by default 6 decimals
                  return String.format("%1.6f %s", value, unit);
              } else {
                  return String.format("%f %s", value, unit);
              }
          }
      }
docs: Create the label for a grid line.
  
  @param value the value of the line
  @param unit the unit that the value is in