Package org.faceless.graph2
Class Style
- java.lang.Object
-
- org.faceless.graph2.Style
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Paint
createLinearGradientPaint(double[] values, Color[] colors)
Return a LinearGradientPaint that can be used to paint objects in the PDF.static Paint
createPattern(String name, Color foreground, Color background)
Create aTexturePaint
object from one of several predefined patterns.void
ensureSolidColor()
If this style has a color object that's a GradientPaint or LinearGradientPaint instance then replace it with a solid color instance instead.boolean
equals(Object o)
int
hashCode()
void
setBorderColor(Color color)
Set the border color for this stylevoid
setColor(Paint color)
Set the color of this stylevoid
setLineDash(double[] dash)
Set the line dashing for this style.void
setLineThickness(double thick)
Set the line thickness for this style. 1 is the default, 0.5 is half as thick, and so on.void
setOverflow(boolean overflow)
Set whether any lines or markers in this style should overflow the graph - if this is set, the item it is set on will not contribute to the calculated dimensions of the graph.String
toString()
-
-
-
Method Detail
-
setOverflow
public void setOverflow(boolean overflow)
Set whether any lines or markers in this style should overflow the graph - if this is set, the item it is set on will not contribute to the calculated dimensions of the graph. Usually it should be left to the default value of false.- Since:
- 2.4.7
-
ensureSolidColor
public void ensureSolidColor()
If this style has a color object that's a GradientPaint or LinearGradientPaint instance then replace it with a solid color instance instead.
-
setColor
public void setColor(Paint color)
Set the color of this style- Parameters:
color
- the color to use
-
setBorderColor
public void setBorderColor(Color color)
Set the border color for this style- Parameters:
color
- the color to use to draw borders in this style, ornull
not to draw any borders
-
setLineThickness
public void setLineThickness(double thick)
Set the line thickness for this style. 1 is the default, 0.5 is half as thick, and so on.- Parameters:
thick
- the line thickness of this style. Must be > 0
-
setLineDash
public void setLineDash(double[] dash)
Set the line dashing for this style. The "dash" parameter is an array of 2*n values, where the first in each pair is the length of the dash, the second is the length of the space. So, for example,setLineDash(new double[] { 5, 5 })
would create a regular dash pattern of 5 on, 5 off, andsetLineDash(new double[] { 6, 2, 2, 2 })
would create a dash-dot type pattern. To turn dashing off completely, pass in a zero length array ornull
.- Parameters:
dash
- an array of doubles which must be even in length and have every value > 0- Throws:
IllegalArgumentException
- if the array is odd in length or if it contains any values <= 0
-
createPattern
public static Paint createPattern(String name, Color foreground, Color background)
Create aTexturePaint
object from one of several predefined patterns. These may be used for tiling paints - useful in environments where color is limited to black and white. The available patterns are:
Alternatively the full URL of a PBM format image may be specified.bricks circles crosshatch crosshatch30 crosshatch45 fishscales gray0 gray10 gray15 gray20 gray25 gray30 gray35 gray40 gray45 gray5 gray50 gray55 gray60 gray65 gray70 gray75 gray80 gray85 gray90 gray95 hexagons horizontal horizontalsaw hs_bdiagonal hs_cross hs_diagcross hs_fdiagonal hs_horizontal hs_vertical left30 left45 leftshingle octagons right30 right45 rightshingle scatter1 scatter2 smallfishscales vertical verticalbricks verticalleftshingle verticalrightshingle verticalsaw weave
- Parameters:
name
- the name or URL of the pattern to use.foreground
- the foreground color. May benull
, in which case it defaults to black.background
- the background color. May benull
, in which case it defaults to white.- Since:
- 2.1.1
-
createLinearGradientPaint
public static Paint createLinearGradientPaint(double[] values, Color[] colors)
Return a LinearGradientPaint that can be used to paint objects in the PDF. The advantage of calling this method instead of the LinearGradientPaint constructor is that the values can be specified in units that relate to the values on the graph. For instance, to create a BarSeries that changes color from yellow to red above the value 5, callPaint paint = Style.createLinearGradientPaint(new double[] { 5, 5.001 }, new Color[] { Color.yellow, Color.red }); style.setColor(paint); series.setStyle(style);
Note that thejava.awt.LinearGradientPaint
class is a Java 1.6 class- Since:
- 2.4.2
-
-