|
KavaChart 5.2.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ve.kavachart.chart.Gc
This is a general purpose graphics class for drawing functionality and for storing graphical attributes. Most other KavaChart classes contain at least one Gc instance, which is used for storing things like line color and fill color, as well as drawing methods. Internally, KavaChart uses a "lower left" origin, which is more natural to most chart styles than Java's "top left" origin. The Gc class converts all incoming coordinates into KavaChart's "lower left" origin.
RotateString
,
Globals
,
Serialized FormField Summary | |
protected static java.awt.Color[] |
colors
|
static int |
COMMA_FORMAT
American style numbers with commas and a decimal period (e.g. |
static int |
DEFAULT_FORMAT
default number format |
static java.awt.Font |
defaultFont
|
static int |
EURO_FORMAT
European style numbers with periods and a comma at the decimal point (e.g. |
static int |
FILL_GRADIENT
|
static int |
FILL_SOLID
|
static int |
FILL_TEXTURE
|
protected java.awt.Color |
fillColor
|
protected int |
fillStyle
|
protected Globals |
globals
|
protected java.awt.Image |
image
|
static int |
keepABOVE
string above given point |
static int |
keepBELOW
string below given point |
static int |
keepLEFT
string to the left of given point |
static int |
keepRIGHT
string to the right of given point |
static java.lang.String |
LINE_BREAK
|
static int |
LINE_DASH
|
static int |
LINE_DOT
|
static int |
LINE_DOT_DASH
|
static int |
LINE_SOLID
|
protected java.awt.Color |
lineColor
|
protected int |
lineStyle
|
protected int |
lineWidth
|
protected int |
markerSize
|
protected int |
markerStyle
|
static int |
MK_CIRCLE
|
static int |
MK_DIAMOND
|
static int |
MK_NONE
|
static int |
MK_SQUARE
|
static int |
MK_TRIANGLE
|
protected boolean |
outlineFills
|
static java.awt.Color |
TRANSPARENT
A utility color - Gc.TRANSPARENT items will not be drawn |
Constructor Summary | |
Gc(boolean unique,
Globals g,
boolean isPie)
Sets the fill, marker, and line to a unique color. |
|
Gc(java.awt.Color clr,
Globals g)
Sets the fill, marker, and line color to a user specified color. |
|
Gc(Globals g)
Sets the fill, marker, and line color to black. |
|
Gc(int datasetNumber,
Globals g)
Sets the fill, marker, and line color based on the dataset index number. |
Method Summary | |
static java.awt.Color |
darker(Globals g,
java.awt.Color c)
A platform-neutral static method for getting a darker color. |
void |
drawArc(java.awt.Graphics g,
java.awt.Point center,
java.awt.Point heightWidth,
int startAngle,
int endAngle)
Draws an arc using the current fill color and KavaChart's coordinates. |
void |
drawImage(java.awt.Graphics g,
java.awt.Point pt)
Draw an image centered at a given point using Javachart's coordinate system. |
void |
drawLine(java.awt.Graphics g,
int startx,
int starty,
int endx,
int endy)
A drawLine that uses KavaChart's coordinate system. |
void |
drawLine(java.awt.Graphics g,
java.awt.Point start,
java.awt.Point end)
Draws a line in the current line color using KavaChart's coordinates |
protected static void |
drawMarker(java.awt.Graphics g,
int x,
int y,
int type,
int size)
Draws a marker in the specified size and type at the specified location |
void |
drawPolygon(java.awt.Graphics g,
java.awt.Point[] pts)
Fills a polygon using the current fillColor, using an array of points in KavaChart's coordinate system. |
void |
drawPolyline(java.awt.Graphics g,
java.awt.Point[] pts)
Draws a polyline using the current lineColor. |
void |
drawPolymarker(java.awt.Graphics g,
java.awt.Point[] pts)
Draws markers in the current markerSize and markerType and fillColor |
void |
drawSmartString(java.awt.Graphics g,
int startx,
int starty,
int alignment,
int angle,
java.awt.FontMetrics fm,
java.lang.String str)
Draws a string in the current color and Font at the specified location, position, and angle. |
void |
drawString(java.awt.Graphics g,
int startx,
int starty,
java.lang.String str)
A drawString that uses KavaChart's coordinate system. |
void |
fillArc(java.awt.Graphics g,
java.awt.Point center,
java.awt.Point heightWidth,
int startAngle,
int endAngle,
boolean lastSlice)
Fills an Arc in the current fill color from a center point |
void |
fillRect(java.awt.Graphics g,
java.awt.Point ll,
java.awt.Point ur)
Fills a rectangle with the current fill color |
java.awt.Color |
getFillColor()
Returns the current fillColor. |
int |
getFillStyle()
|
Globals |
getGlobals()
|
int |
getGradient()
|
GcHelper |
getHelper()
Returns this Gc's helper class. |
java.awt.Image |
getImage()
Returns the Image used with this Gc. |
java.awt.Color |
getLineColor()
Returns the current lineColor. |
int |
getLineStyle()
Returns the current lineStyle. |
int |
getLineWidth()
Returns the current lineWidth This integer value is the number of pixels wide this Gc will draw lines. |
int |
getMarkerSize()
Returns the marker size. |
int |
getMarkerStyle()
Returns the marker style. |
boolean |
getOutlineFills()
Returns true if this Gc is set up to outline polygons |
java.awt.Color |
getSecondaryFillColor()
|
protected static int |
getStringHeight(java.awt.FontMetrics fm,
java.lang.String str)
Returns the height of a label taking line breaks into account |
protected static int |
getStringWidth(java.awt.FontMetrics fm,
java.lang.String str)
Returns the width of a label taking line breaks into account |
int |
getTexture()
|
void |
setFillColor(java.awt.Color c)
Sets the current fillColor. |
void |
setFillStyle(int style)
|
void |
setGlobals(Globals g)
|
void |
setGradient(int grad)
|
void |
setImage(java.awt.Image i)
Assigns an Image for use with this Gc. |
void |
setLineColor(java.awt.Color c)
Sets the current lineColor. |
void |
setLineStyle(int i)
Sets the current lineStyle. |
void |
setLineWidth(int i)
Sets the current lineWidth Sets the number of pixels wide for this Gc's lines and polylines. |
void |
setMarkerSize(int i)
Sets the marker size in pixels |
void |
setMarkerStyle(int i)
Sets the marker style For example setMarkerStyle(Gc.MK_CIRCLE) |
void |
setOutlineFills(boolean outline)
Determines whether polygons and rectangles will be outlined with lineColor |
void |
setSecondaryFillColor(java.awt.Color c)
Sets a secondary fill color on this Gc's Helper class. |
void |
setTexture(int texture)
Installs a GcHelper if none exists, sets the fillStyle to FILL_TEXTURE, and sets the predefined pattern on the GcHelper. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.awt.Color fillColor
protected transient java.awt.Image image
protected Globals globals
protected java.awt.Color lineColor
protected int lineStyle
protected int lineWidth
protected boolean outlineFills
protected static java.awt.Color[] colors
public static java.awt.Color TRANSPARENT
public static final int DEFAULT_FORMAT
public static final int COMMA_FORMAT
public static final int EURO_FORMAT
public static final int keepBELOW
public static final int keepLEFT
public static final int keepABOVE
public static final int keepRIGHT
public static java.awt.Font defaultFont
public static final int MK_NONE
public static final int MK_SQUARE
public static final int MK_DIAMOND
public static final int MK_CIRCLE
public static final int MK_TRIANGLE
protected int markerSize
protected int markerStyle
public static final int FILL_SOLID
public static final int FILL_GRADIENT
public static final int FILL_TEXTURE
protected int fillStyle
public static final int LINE_SOLID
public static final int LINE_DASH
public static final int LINE_DOT
public static final int LINE_DOT_DASH
public static final java.lang.String LINE_BREAK
Constructor Detail |
public Gc(int datasetNumber, Globals g)
g
- This chart's Globals classpublic Gc(java.awt.Color clr, Globals g)
clr
- User's colorg
- This chart's Globals classpublic Gc(Globals g)
g
- This chart's Globals classpublic Gc(boolean unique, Globals g, boolean isPie)
unique
- True if color should be uniqueg
- This chart's Globals classMethod Detail |
public void drawArc(java.awt.Graphics g, java.awt.Point center, java.awt.Point heightWidth, int startAngle, int endAngle)
g
- The affected Graphics classcenter
- Center pointheightWidth
- Size of arcstartAngle
- Starting angleendAngle
- Ending anglepublic void drawImage(java.awt.Graphics g, java.awt.Point pt)
g
- The affected Graphicspt
- Center of imagepublic void drawLine(java.awt.Graphics g, int startx, int starty, int endx, int endy)
g
- The affected Graphics classstartx
- X coordinate of starting pointstarty
- Y coordinate of starting pointendx
- X coordinate of end pointendy
- Y coordinate of end pointpublic void drawLine(java.awt.Graphics g, java.awt.Point start, java.awt.Point end)
g
- Graphics class to drawstart
- Start pointend
- End pointprotected static void drawMarker(java.awt.Graphics g, int x, int y, int type, int size)
x
- inty
- inttype
- intsize
- intpublic static java.awt.Color darker(Globals g, java.awt.Color c)
public void drawPolygon(java.awt.Graphics g, java.awt.Point[] pts)
g
- The affected graphicspts
- Array of polygon's pointspublic void drawPolyline(java.awt.Graphics g, java.awt.Point[] pts)
g
- The affected graphicspts
- Array of polyline's pointspublic void drawPolymarker(java.awt.Graphics g, java.awt.Point[] pts)
g
- The affected graphicspts
- Array of marker pointspublic void drawSmartString(java.awt.Graphics g, int startx, int starty, int alignment, int angle, java.awt.FontMetrics fm, java.lang.String str)
g
- Graphics affectedstartx
- X position of stringstarty
- Y position of stringalignment
- keepABOVE, keepBELOW, etc.angle
- Rotation angle in degreesfm
- A FontMetrics class for the unrotated stringstr
- The String to drawpublic void drawString(java.awt.Graphics g, int startx, int starty, java.lang.String str)
g
- The affected Graphicsstartx
- X coordinate of starting pointstarty
- Y coordinate of starting pointstr
- The string to be drawnpublic void fillArc(java.awt.Graphics g, java.awt.Point center, java.awt.Point heightWidth, int startAngle, int endAngle, boolean lastSlice)
g
- The affected Graphicscenter
- Center pointheightWidth
- Size of arcstartAngle
- Starting angleendAngle
- Ending anglelastSlice
- outline both sides of the last slice only, or if a pie slice is explodedpublic void fillRect(java.awt.Graphics g, java.awt.Point ll, java.awt.Point ur)
g
- Graphics class to drawll
- lower left corner of rectangleur
- upper right corner of rectanglepublic java.awt.Color getFillColor()
public java.awt.Image getImage()
public java.awt.Color getLineColor()
public int getLineStyle()
public int getLineWidth()
public int getMarkerSize()
public int getMarkerStyle()
public boolean getOutlineFills()
protected static int getStringWidth(java.awt.FontMetrics fm, java.lang.String str)
fm
- a font metrics class initialized for this labelstr
- the label string
protected static int getStringHeight(java.awt.FontMetrics fm, java.lang.String str)
fm
- a font metrics class initialized for this labelstr
- the label string
public void setFillColor(java.awt.Color c)
c
- Fill colorpublic void setImage(java.awt.Image i)
i
- Marker imagepublic void setLineColor(java.awt.Color c)
c
- Line colorpublic void setLineStyle(int i)
i
- Line stylepublic void setLineWidth(int i)
i
- Line widthpublic void setMarkerSize(int i)
i
- Marker sizepublic void setMarkerStyle(int i)
i
- Marker stylepublic void setOutlineFills(boolean outline)
outline
- booleanpublic void setGradient(int grad)
public int getGradient()
public GcHelper getHelper()
public void setSecondaryFillColor(java.awt.Color c)
c
- java.awt.Colorpublic java.awt.Color getSecondaryFillColor()
public void setTexture(int texture)
public int getTexture()
public void setFillStyle(int style)
public int getFillStyle()
public void setGlobals(Globals g)
public Globals getGlobals()
|
KavaChart 5.2.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |