public class DataColorScale extends Legend
back, DEFAULT_STROKE, font, fore, preferredSize, SPACE_SIZE
Constructor and Description |
---|
DataColorScale(EnhancementFunction function,
Palette palette,
java.lang.String name,
java.lang.String units)
Creates a data color scale with the specified parameters.
|
DataColorScale(EnhancementFunction function,
Palette palette,
java.lang.String name,
java.lang.String units,
java.awt.Dimension dim,
java.awt.Font font,
java.awt.Color fore,
java.awt.Color back)
Creates a data color scale from the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
static double |
getLinearTickInterval(double min,
double max,
int desired)
Gets an appropriate tick mark interval given the tick
specifications.
|
static java.lang.String[] |
getLinearTickLabels(double min,
double max,
int desired)
Gets an appropriate set of tick mark labels given the tick
specifications.
|
static java.lang.String[] |
getLogTickLabels(double min,
double max)
Gets an appropriate set of tick mark labels given the tick
specifications.
|
java.awt.Dimension |
getSize(java.awt.Graphics2D g)
Gets the actual required legend size.
|
void |
render(java.awt.Graphics2D g,
int x,
int y)
Renders the legend at the specified coordinates in the graphics
device.
|
void |
setTickLabels(java.lang.String[] labels)
Sets the tick labels.
|
setBackground, setFont, setForeground, setPreferredSize
public DataColorScale(EnhancementFunction function, Palette palette, java.lang.String name, java.lang.String units)
function
- the enhancement function for translating between
data values and normalized values. The scale is drawn for
normalized values in the range [0..1].palette
- the palette to use for scale colors.name
- the data variable name.units
- the data variable units.public DataColorScale(EnhancementFunction function, Palette palette, java.lang.String name, java.lang.String units, java.awt.Dimension dim, java.awt.Font font, java.awt.Color fore, java.awt.Color back)
function
- the enhancement function for translating between
data values and normalized values. The scale is drawn for
normalized values in the range [0..1].palette
- the palette to use for scale colors.name
- the data variable name.units
- the data variable units.dim
- the preferred scale dimensions, or null for none.font
- the font for variable name, units, and scale values, or
null for the default font face, plain style, 12 point.fore
- the foreground color for legend lines and annotations.back
- the background color, or null for none.public void setTickLabels(java.lang.String[] labels)
labels
- the new tick labels to use. Each label is
a number formatted to a string value/.public void render(java.awt.Graphics2D g, int x, int y)
Legend
public java.awt.Dimension getSize(java.awt.Graphics2D g)
Legend
public static java.lang.String[] getLogTickLabels(double min, double max)
min
- the data value minimum.max
- the data value maximum.public static double getLinearTickInterval(double min, double max, int desired)
min
- the data value minimum.max
- the data value maximum.desired
- the approximate number of desired ticks.public static java.lang.String[] getLinearTickLabels(double min, double max, int desired)
min
- the data value minimum.max
- the data value maximum.desired
- the approximate number of desired ticks.