uk.ac.starlink.ttools.plot2.layer
Enum Normalisation

java.lang.Object
  extended by java.lang.Enum<Normalisation>
      extended by uk.ac.starlink.ttools.plot2.layer.Normalisation
All Implemented Interfaces:
Serializable, Comparable<Normalisation>

@Equality
public enum Normalisation
extends Enum<Normalisation>

Defines normalisation modes for histogram-like plots.

Since:
19 Feb 2015
Author:
Mark Taylor

Enum Constant Summary
AREA
          The total area of histogram bars is normalised to unity.
HEIGHT
          The total height of histogram bars is normalised to unity.
MAXIMUM
          Height of the tallest histogram bar is normalised to unity.
NONE
          No normalisation is performed.
 
Method Summary
 String getDescription()
          Returns a short description of this mode.
abstract  double getScaleFactor(double sum, double max, double binWidth, boolean isCumulative)
          Returns the value by which all bins should be scaled to achieve normalisation for a given data set.
static Normalisation valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Normalisation[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NONE

public static final Normalisation NONE
No normalisation is performed.


AREA

public static final Normalisation AREA
The total area of histogram bars is normalised to unity.


MAXIMUM

public static final Normalisation MAXIMUM
Height of the tallest histogram bar is normalised to unity.


HEIGHT

public static final Normalisation HEIGHT
The total height of histogram bars is normalised to unity.

Method Detail

values

public static final Normalisation[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(Normalisation c : Normalisation.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static Normalisation valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name

getDescription

public String getDescription()
Returns a short description of this mode.

Returns:
description

getScaleFactor

public abstract double getScaleFactor(double sum,
                                      double max,
                                      double binWidth,
                                      boolean isCumulative)
Returns the value by which all bins should be scaled to achieve normalisation for a given data set.

The binWidth should at least make sense in terms of screen area. For linear X axis, it can be in data units, but for logarithmic X axis it may have to be in log(data units). The binWidth is only used by AREA mode.

For cumulative plots, all the modes except NONE behave the same, normalising the total value to unity.

Parameters:
sum - total height of all histogram bars
max - height of tallest histogram bar
binWidth - constant linear width of histogram bars, or NaN
isCumulative - true iff the plot is cumulative


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.