Package org.faceless.graph2
Class DialGraph
- java.lang.Object
-
- org.faceless.graph2.Graph
-
- org.faceless.graph2.DialGraph
-
-
Field Summary
Fields Modifier and Type Field Description static int
ARROW_LARGE
Constant that can be passed intoaddNeedle()
to draw a large arrow.static int
ARROW_MEDIUM
Constant that can be passed intoaddNeedle()
to draw a medium arrow.static int
ARROW_NONE
Constant that can be passed intoaddNeedle()
to draw no arrow at all.static int
ARROW_SMALL
Constant that can be passed intoaddNeedle()
to draw a small arrow.
-
Constructor Summary
Constructors Constructor Description DialGraph()
Create a new DialGraph
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLabel(AbstractMarker label, double angle, double distance)
Add a marker to one of the slices of the DialGraph.void
addLabels(double startangle, double endangle, double anglestep, double distance, boolean rotate, TextStyle style, NumberFormat format, double startvalue, double endvalue)
Add numerical labels around the edge of the dial graph.void
addNeedle(double angle, double start, double startwidth, double waist, double waistwidth, double end, double endwidth, Style style, int arrow)
Add a "needle" the graph.void
addSegment(double start, double end, double inner, double outer, Style style)
Add a colored "segment" to the graph.void
addTick(double angle, double start, double end, Style style)
Add a tick to the graphvoid
addTicks(double startangle, double endangle, double anglestep, double start, double end, Style style)
Add several ticks at equally spaced intervals around the graphvoid
setSliceSize(double size)
Set the number of degrees each straight line makes up in a DialGraph.-
Methods inherited from class org.faceless.graph2.Graph
addKey, addKey, addText, draw, getActualOffset, getActualZoom, getLocale, interrupt, isInterrupted, isOverlapping, setAutoColors, setColorOrdering, setDefaultColors, setFixedAspectRatio, setFixedSize, setLicenseKey, setLightLevel, setLightVector, setLocale, setMetaData, setOption, setXRotation, setYRotation, setZRotation
-
-
-
-
Field Detail
-
ARROW_NONE
public static final int ARROW_NONE
Constant that can be passed intoaddNeedle()
to draw no arrow at all.- See Also:
- Constant Field Values
-
ARROW_SMALL
public static final int ARROW_SMALL
Constant that can be passed intoaddNeedle()
to draw a small arrow.- See Also:
- Constant Field Values
-
ARROW_MEDIUM
public static final int ARROW_MEDIUM
Constant that can be passed intoaddNeedle()
to draw a medium arrow.- See Also:
- Constant Field Values
-
ARROW_LARGE
public static final int ARROW_LARGE
Constant that can be passed intoaddNeedle()
to draw a large arrow.- See Also:
- Constant Field Values
-
-
Method Detail
-
addSegment
public void addSegment(double start, double end, double inner, double outer, Style style)
Add a colored "segment" to the graph.- Parameters:
start
- the start angle of the segment, in degrees clockwise from 12 o'clockend
- the end angle of the segment, in degrees clockwise from 12 o'clockinner
- the distance from the center of the graph to the inner edge of the range - 0 means the center of the graph, 100 is the outside edge.outer
- the distance from the center of the graph to the outer edge of the range - 0 means the center of the graph, 100 is the outside edge.style
- the Style to draw the slice in.
-
addNeedle
public void addNeedle(double angle, double start, double startwidth, double waist, double waistwidth, double end, double endwidth, Style style, int arrow)
Add a "needle" the graph. A needle is drawn between two points, one of which is typically (but not necessarily) the center of the graph. It also may have a "waist", which allows the needle to bulge out slightly at the center. A typical value for the widths would be in the range 0 to 10.- Parameters:
angle
- the angle of the needle, in degrees clockwise from 12 o'clockstart
- the distance from the center, with 0 being the center and 100 being the radiusstartwidth
- the width of the needle at the startwaist
- The distance from the start to the waist - between 0 and 100, orDouble.NaN
to draw no waist. Must be greater than "start".waistwidth
- the width at the waistend
- The distance from the center of the graph to the end of the needle, with 0 being the center and 100 being the radius. Must be greater than "start" and "waist".endwidth
- the width of the needle at the endstyle
- the Style to paint the needle in.arrow
- one ofARROW_NONE
,ARROW_SMALL
,ARROW_MEDIUM
orARROW_LARGE
-
setSliceSize
public void setSliceSize(double size)
Set the number of degrees each straight line makes up in a DialGraph. Smaller values give rounder pies and smoother shading, but will a) take longer to render and b) for vector files like PDF or SVG, result in larger files (although this may be minimized by compression in PDF). The minimal value is 0.5 and the maximum is 5.
-
addLabel
public void addLabel(AbstractMarker label, double angle, double distance)
Add a marker to one of the slices of the DialGraph.- Parameters:
label
- the marker to displayangle
- the angle to draw the marker at, in degrees clockwise from 12 o'clockdistance
- the distance from the center of the graph to draw the marker, with 0 being the center of the graph and 100 the radius. Values > 100 position the marker outside the graph.
-
addLabels
public void addLabels(double startangle, double endangle, double anglestep, double distance, boolean rotate, TextStyle style, NumberFormat format, double startvalue, double endvalue)
Add numerical labels around the edge of the dial graph. This method creates a number of appropriateText
objects and passes them intoaddLabel()
, which we recommend doing if this method doesn't do exactly what you want.- Parameters:
startangle
- the angle of the first label, in degrees clockwise from 12 o'clockendangle
- the angle of the last label, in degrees clockwise from 12 o'clockanglestep
- the increment between valuesdistance
- the distance from the center of the graph to the labelrotate
- whether to rotate the labels to match the graphstyle
- the style in which the labels are to be renderedformat
- the format to use for the labelsstartvalue
- the value of the first labelendvalue
- the value of the last label
-
addTick
public void addTick(double angle, double start, double end, Style style)
Add a tick to the graph- Parameters:
angle
- the angle of the tick, in degrees clockwise from 12 o'clockstart
- the distance from the center of the graph to the start of the tick, with 100 being the outer edgeend
- the distance from the center of the graph to the end of the tick, with 100 being the outer edgestyle
- the style of the tick, ornull
for a simple black line
-
addTicks
public void addTicks(double startangle, double endangle, double anglestep, double start, double end, Style style)
Add several ticks at equally spaced intervals around the graph- Parameters:
startangle
- the angle in degrees at which to start drawing the ticks, in degrees clockwise from 12 o'clockendangle
- the angle in degrees at which to stop drawing the ticks, in degrees clockwise from 12 o'clockanglestep
- how many degrees should be between each tick.start
- the distance from the center of the graph to the start of the tick, with 100 being the outer edgeend
- the distance from the center of the graph to the end of the tick, with 100 being the outer edgestyle
- the style of the ticks, ornull
for a simple black line
-
-