Package uk.ac.starlink.ttools.plot
Class BarStyle
java.lang.Object
uk.ac.starlink.ttools.plot.DefaultStyle
uk.ac.starlink.ttools.plot.BarStyle
Defines a style for plotting a bar in a histogram.
- Since:
- 16 Nov 2005
- Author:
- Mark Taylor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Describes the form of a bar style, that is what each bar looks like.static class
Describes bar placement, that is how multiple bars covering the same data range are to be arranged. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BarStyle.Form
Bar form using filled rectangles.static final BarStyle.Form
Bar form using filled 3d rectangles.static final BarStyle.Form
Bar form using open rectangles.static final BarStyle.Form
Bar form with an outline and a transparent inside.static final BarStyle.Form
Bar form with steps and a transparent inside.static final BarStyle.Form
Bar form using 1-d spikes.static final BarStyle.Form
Bar form drawing only the tops of the bars.static final BarStyle.Placement
Placement which puts bars next to each other.static final BarStyle.Placement
Placement which puts bars in the same X region. -
Constructor Summary
ConstructorsConstructorDescriptionBarStyle
(Color color, BarStyle.Form form, BarStyle.Placement placement) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Draws a bar for inclusion in a histogram.void
Draws the edge of a bar.getForm()
Returns the form of this style.int
int
Returns an icon suitable for displaying in a legend for this style.Returns the placement of this style.void
Methods inherited from class uk.ac.starlink.ttools.plot.DefaultStyle
equals, getColor, getDash, getLineWidth, getOtherAtts, getStroke, getStroke, hashCode, setColor, setDash, setLineWidth, toString
-
Field Details
-
FORM_OPEN
Bar form using open rectangles. -
FORM_FILLED
Bar form using filled rectangles. -
FORM_FILLED3D
Bar form using filled 3d rectangles. -
FORM_TOP
Bar form drawing only the tops of the bars. -
FORM_SPIKE
Bar form using 1-d spikes. -
FORM_SEMIFILLED
Bar form with an outline and a transparent inside. -
FORM_SEMITOP
Bar form with steps and a transparent inside. -
PLACE_ADJACENT
Placement which puts bars next to each other. -
PLACE_OVER
Placement which puts bars in the same X region.
-
-
Constructor Details
-
BarStyle
Constructor.- Parameters:
color
- initial colourform
- bar formplacement
- bar placement
-
-
Method Details
-
drawBar
Draws a bar for inclusion in a histogram.- Parameters:
g
- graphics contextxlo
- lower bound in X directionxhi
- upper bound in X directionylo
- lower bound in Y directionyhi
- upper bound in Y directioniseq
- index of the set being plottednseq
- number of sets being plotted for this bar
-
drawEdge
Draws the edge of a bar. This can be invoked to draw the boundary between one bar and its immediate neighbour; the edge described by the call's parameters is not the edge of the block representing the bar's data, but the edge between the current bar and its neighbour on one side or the other, so it may go up or down from the Y value. For many bar styles this will be a no-op.- Parameters:
g
- graphics contextx
- x position of the edgey1
- one y value for the edgey2
- other y value for the edgeiseq
- index of the set being plottednseq
- number of sets being plotted for this bar
-
getForm
Returns the form of this style.- Returns:
- bar form
-
getPlacement
Returns the placement of this style.- Returns:
- bar placement
-
getLegendIcon
Description copied from interface:Style
Returns an icon suitable for displaying in a legend for this style.- Specified by:
getLegendIcon
in interfaceStyle
-
getIconHeight
public int getIconHeight()- Specified by:
getIconHeight
in interfaceIcon
-
getIconWidth
public int getIconWidth()- Specified by:
getIconWidth
in interfaceIcon
-
paintIcon
-