public class BarsView extends TiledView
For example, to view sampled functions x2 = f(x1) and x2 = g(x1), one might construct two plot segments by specifying an array of two arrays of x1 coordinates and a corresponding array of two arrays of x2 coordinates.
Note that some attributes remain constant across all plot segments, including: bar width, bar stacking, line style, bar alignment, and axis orientation.
Modifier and Type | Class and Description |
---|---|
static class |
BarsView.Alignment
The bar alignment relative to the tick.
|
static class |
BarsView.Line
The style of line plotted between consecutive points (x1,x2).
|
static class |
BarsView.Orientation
Orientation of axes x1 and x2.
|
Constructor and Description |
---|
BarsView(float[] x2)
Constructs a view of bars with specified x2 quantities.
|
BarsView(float[][] x2)
Constructs a view of bars for x2.length data sets.
|
BarsView(float[][] x1,
float[][] x2)
Constructs a view of bars with multiple plot segments.
|
BarsView(float[] x1,
float[] x2)
Constructs a view of bars with a single plot segment.
|
BarsView(Sampling s1,
float[] x2)
Constructs a view of bars for a sampled function x2(x1).
|
BarsView(Sampling s1,
float[][] x2)
Constructs a view of bars with multiple plot segments.
|
Modifier and Type | Method and Description |
---|---|
BarsView.Orientation |
getOrientation()
Gets the orientation of (x1,x2) axes.
|
void |
paint(java.awt.Graphics2D g2d)
Paints this tiled view.
|
void |
set(float[][] x1,
float[][] x2)
Sets array of arrays of (x1,x2) coordinates for multiple plot segments.
|
void |
set(float[] x1,
float[] x2)
Sets array of (x1,x2) coordinates for a plot segment.
|
void |
set(Sampling s1,
float[] x2)
Sets (x1,x2) coordinates for a sampled function x2(x1).
|
void |
setAlignment(BarsView.Alignment alignment)
Sets the alignment of the bars.
|
void |
setBarWidth(float width)
Sets the bar width.
|
void |
setColorMap(ColorMap colorMap)
Sets a color map for all bar sets.
|
void |
setColorMap(int i,
ColorMap colorMap)
Sets a color map for a specific bar set.
|
void |
setColorModel(java.awt.image.IndexColorModel colorModel)
Sets a color model for all bar sets.
|
void |
setColorModel(int i,
java.awt.image.IndexColorModel colorModel)
Sets a color model for a specific bar set.
|
void |
setFillColor(java.awt.Color color)
Sets the fill color for all bar sets.
|
void |
setFillColor(int i,
java.awt.Color color)
Sets the fill color for a set of bars.
|
void |
setLineColor(java.awt.Color color)
Sets the line color for all sets of bars.
|
void |
setLineColor(int ibar,
java.awt.Color color)
Sets the line color for a set of bars.
|
void |
setLineStyle(BarsView.Line style)
Sets the line style.
|
void |
setLineWidth(float width)
Sets the line width.
|
void |
setOrientation(BarsView.Orientation orientation)
Sets the orientation of (x1,x2) axes.
|
void |
setStackBars(boolean stack)
Sets the stacking behavior of the bars.
|
void |
setStyle(java.lang.String style)
Sets the color, line style, and mark style from a style string.
|
void |
setTextFormat(java.lang.String format)
Sets the format used for text labels.
|
getBestHorizontalProjector, getBestVerticalProjector, getHorizontalProjector, getLineWidth, getTile, getTranscaler, getVerticalProjector, repaint, setBestProjectors
public BarsView(float[] x2)
x2
- array of x2 coordinates.public BarsView(Sampling s1, float[] x2)
s1
- the sampling of x1 coordinates.x2
- array of x2 values.public BarsView(float[][] x2)
x2
- array of values containing x2.length separate sets.public BarsView(Sampling s1, float[][] x2)
s1
- the sampling of x1 coordinates.x2
- array of x2 values, containing x2.length plot segments.public BarsView(float[][] x1, float[][] x2)
x1
- array of x1 coordinates.x2
- array of x2 coordinates.public BarsView(float[] x1, float[] x2)
x1
- array of x1 coordinates.x2
- array of x2 coordinates.public void set(Sampling s1, float[] x2)
s1
- the sampling of x1 coordinates.x2
- array of x2 coordinates.public void set(float[] x1, float[] x2)
x1
- array of x1 values.x2
- array of x2 coordinates.public void set(float[][] x1, float[][] x2)
x1
- array of arrays of x1 values.x2
- array of arrays of x2 coordinates.public void setOrientation(BarsView.Orientation orientation)
orientation
- the orientation.public BarsView.Orientation getOrientation()
public void setStyle(java.lang.String style)
To specify a color, the style string may contain one of "r" for red, "g" for green, "b" for blue, "c" for cyan, "m" for magenta, "y" for yellow, "k" for black, or "w" for white. If the style string contains none of these colors, then the default color is used.
To specify a line style, the style string may contain one of "-" for solid lines, "--" for dashed lines, "-." for dotted lines, or "--." for dash-dotted lines. If the style string contains none of these line styles, then no lines are painted.
To specify a mark style, the style string may contain one of "." for point, "+" for plus, "x" for cross, "o" for hollow circle", "O" for filled circle, "s" for hollow square, or "S" for filled square. If the style string contains none of these mark styles, then no marks are painted.
style
- the style string.public void setBarWidth(float width)
width
- the bar width in range [0.0 - 1.0]public void setFillColor(java.awt.Color color)
color
- the bar color.public void setColorModel(java.awt.image.IndexColorModel colorModel)
colorModel
- a color model.public void setColorModel(int i, java.awt.image.IndexColorModel colorModel)
i
- index of a bar set.colorModel
- a color model.public void setColorMap(ColorMap colorMap)
colorMap
- a color map.public void setColorMap(int i, ColorMap colorMap)
i
- index of a bar set.colorMap
- a color map.public void setFillColor(int i, java.awt.Color color)
i
- the index of a bar set.color
- the bar color.public void setAlignment(BarsView.Alignment alignment)
alignment
- the bar alignment.public void setStackBars(boolean stack)
stack
- true, if stacking bars; false, otherwise.public void setLineStyle(BarsView.Line style)
style
- the line style.public void setLineWidth(float width)
width
- the line width.public void setLineColor(java.awt.Color color)
color
- the line color; null, for tile foreground color.public void setLineColor(int ibar, java.awt.Color color)
ibar
- the index of the set of bars.color
- the line color; null, for tile foreground color.public void setTextFormat(java.lang.String format)
format
- the text format.public void paint(java.awt.Graphics2D g2d)
TiledView
Tiled views should not replace (set) entirely the transform in the specified graphics context. This transform may already have been set by the tile or its mosaic. Therefore, tiled views should modify this transform only by specifying additional scaling, translation, etc.