java.lang.Object
org.rrd4j.graph.ValueScaler

class ValueScalerextends Object
Utility class for scaling values with appropriate units in RRD graphs. Handles automatic unit selection and value scaling for optimal display.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static class 
    Represents a scaled value with its corresponding unit.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final double
    Values are scaled to multiples of this.
    private double
    The scale factor applied, -1 before the first scaling.
    private String
    Unit suffix chosen by the scaling.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ValueScaler(double base)
    Creates a new value scaler with the specified base.
  • Method Summary

    Private Methods
    Modifier and Type
    Method
    Description
    rescale(double value)
    Picks a scale that keeps the value readable.
    (package private) ValueScaler.Scaled
    scale(double value, boolean mustRescale)
    Scales a value with appropriate unit selection.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • base

      private final double base
      Values are scaled to multiples of this.
    • magfact

      private double magfact
      The scale factor applied, -1 before the first scaling.
    • unit

      private String unit
      Unit suffix chosen by the scaling.
  • Constructor Details

    • ValueScaler

      ValueScaler(double base)
      Creates a new value scaler with the specified base.
      Parameters:
      base - the base for unit scaling (typically 1000 for SI units)
  • Method Details

    • scale

      ValueScaler.Scaled scale(double value, boolean mustRescale)
      Scales a value with appropriate unit selection.
      Parameters:
      value - the value to scale
      mustRescale - if true, forces recalculation of scaling factors
      Returns:
      scaled value with unit
    • rescale

      private ValueScaler.Scaled rescale(double value)
      Picks a scale that keeps the value readable.
      Parameters:
      value - the value to scale
      Returns:
      the scaled value and its unit