org.jfree.chart.plot

Class ColorPalette

public abstract class ColorPalette extends Object implements Cloneable, Serializable

Deprecated: This class is no longer supported (as of version 1.0.4). If you are creating contour plots, please try to use XYPlot and XYBlockRenderer.

Defines palette used by ContourPlot.
Field Summary
protected int[]b
Blue components.
protected int[]g
Green components.
protected booleaninverse
Inverse palette (ie, min and max colors are reversed).
protected static doublelog10
Constant for converting loge to log10.
protected booleanlogscale
Logscale?
protected doublemaxZ
The max z-axis value.
protected doubleminZ
The min z-axis value.
protected StringpaletteName
The palette name.
protected int[]r
Red components.
protected booleanstepped
Controls whether palette colors are stepped (not continuous).
protected double[]tickValues
Tick values are stored for use with stepped palette.
Constructor Summary
ColorPalette()
Default contructor.
Method Summary
Objectclone()
Returns a clone of the palette.
booleanequals(Object o)
Tests an object for equality with this instance.
PaintgetColor(double value)
Returns the color associated with a value.
ColorgetColor(int izV)
Returns a color.
ColorgetColorLinear(double value)
Returns Color by mapping a given value to a linear palette.
ColorgetColorLog(double value)
Returns Color by mapping a given value to a common log palette.
doublegetMaxZ()
Returns the maximum Z value.
doublegetMinZ()
Returns the minimum Z value.
PaintgetPaint(double value)
Returns Paint by mapping a given value to a either a linear or common log palette as controlled by the value logscale.
StringgetPaletteName()
Returns the palette name.
double[]getTickValues()
Returns the tick values.
inthashCode()
Returns a hash code.
abstract voidinitialize()
Called to initialize the palette's color indexes
voidinvertPalette()
Inverts Palette
booleanisInverse()
Returns the inverse flag.
booleanisLogscale()
Returns the log-scale flag.
booleanisStepped()
Returns the 'is-stepped' flag.
voidsetInverse(boolean inverse)
Sets the inverse flag.
voidsetLogscale(boolean logscale)
Sets the 'log-scale' flag.
voidsetMaxZ(double newMaxZ)
Sets the maximum Z value.
voidsetMinZ(double newMinZ)
Sets the minimum Z value.
voidsetPaletteName(String paletteName)
Sets the palette name.
voidsetStepped(boolean stepped)
Sets the stepped flag.
voidsetTickValues(double[] newTickValues)
Sets the tick values.
voidsetTickValues(List ticks)
Store ticks.

Field Detail

b

protected int[] b
Blue components.

g

protected int[] g
Green components.

inverse

protected boolean inverse
Inverse palette (ie, min and max colors are reversed).

log10

protected static final double log10
Constant for converting loge to log10.

logscale

protected boolean logscale
Logscale?

maxZ

protected double maxZ
The max z-axis value.

minZ

protected double minZ
The min z-axis value.

paletteName

protected String paletteName
The palette name.

r

protected int[] r
Red components.

stepped

protected boolean stepped
Controls whether palette colors are stepped (not continuous).

tickValues

protected double[] tickValues
Tick values are stored for use with stepped palette.

Constructor Detail

ColorPalette

public ColorPalette()
Default contructor.

Method Detail

clone

public Object clone()
Returns a clone of the palette.

Returns: A clone.

Throws: CloneNotSupportedException never.

equals

public boolean equals(Object o)
Tests an object for equality with this instance.

Parameters: o the object to test.

Returns: A boolean.

getColor

public Paint getColor(double value)
Returns the color associated with a value.

Parameters: value the value.

Returns: The color.

getColor

public Color getColor(int izV)
Returns a color.

Parameters: izV the index into the palette (zero based).

Returns: The color.

getColorLinear

public Color getColorLinear(double value)
Returns Color by mapping a given value to a linear palette.

Parameters: value the value.

Returns: The color.

getColorLog

public Color getColorLog(double value)
Returns Color by mapping a given value to a common log palette.

Parameters: value the value.

Returns: The color.

getMaxZ

public double getMaxZ()
Returns the maximum Z value.

Returns: The value.

getMinZ

public double getMinZ()
Returns the minimum Z value.

Returns: The value.

getPaint

public Paint getPaint(double value)
Returns Paint by mapping a given value to a either a linear or common log palette as controlled by the value logscale.

Parameters: value the value.

Returns: The paint.

getPaletteName

public String getPaletteName()
Returns the palette name.

Returns: The palette name.

getTickValues

public double[] getTickValues()
Returns the tick values.

Returns: The tick values.

hashCode

public int hashCode()
Returns a hash code.

Returns: A hash code.

initialize

public abstract void initialize()
Called to initialize the palette's color indexes

invertPalette

public void invertPalette()
Inverts Palette

isInverse

public boolean isInverse()
Returns the inverse flag.

Returns: The flag.

isLogscale

public boolean isLogscale()
Returns the log-scale flag.

Returns: The flag.

isStepped

public boolean isStepped()
Returns the 'is-stepped' flag.

Returns: The flag.

setInverse

public void setInverse(boolean inverse)
Sets the inverse flag.

Parameters: inverse the new value.

setLogscale

public void setLogscale(boolean logscale)
Sets the 'log-scale' flag.

Parameters: logscale the new value.

setMaxZ

public void setMaxZ(double newMaxZ)
Sets the maximum Z value.

Parameters: newMaxZ the new value.

setMinZ

public void setMinZ(double newMinZ)
Sets the minimum Z value.

Parameters: newMinZ the new value.

setPaletteName

public void setPaletteName(String paletteName)
Sets the palette name.

Parameters: paletteName the name.

setStepped

public void setStepped(boolean stepped)
Sets the stepped flag.

Parameters: stepped the flag.

setTickValues

public void setTickValues(double[] newTickValues)
Sets the tick values.

Parameters: newTickValues the tick values.

setTickValues

public void setTickValues(List ticks)
Store ticks. Required when doing stepped axis

Parameters: ticks the ticks.