com.java4less.rchart
Class LineStyle

java.lang.Object
  |
  +--com.java4less.rchart.LineStyle

public class LineStyle
extends java.lang.Object


This class draws lines. It contains the description of how a line looks like.

The following code creates the line style for the grid of this chart:


XAxis.gridStyle=new LineStyle(0.2f,java.awt.Color.darkGray,LineStyle.LINE_DASHED);


Field Summary
static int LINE_DASHED
           
static int LINE_DOTS
           
static int LINE_NORMAL
           
 
Constructor Summary
LineStyle(float w, java.awt.Color c, int t)
          Creates a line style with the given width, color and style(line, dashed...).
 
Method Summary
 void draw(java.awt.Graphics g, int x1, int y1, int x2, int y2)
          draws a line between two points.
 void drawArc(java.awt.Graphics g, int x, int y, int w, int h, int a1, int a2)
           
 void drawLineWithStyle(java.awt.Graphics g, int x1, int y1, int x2, int y2)
           
 void drawOpenPolygon(java.awt.Graphics g, int[] x, int[] y, int c)
          draws an open polygon.
 void drawPolygon(java.awt.Graphics g, int[] x, int[] y, int c)
          draws a polygon.
 void drawRect(java.awt.Graphics g, int x1, int y1, int x2, int y2)
           
 void drawSimpleLine(java.awt.Graphics g, int x1, int y1, int x2, int y2)
           
 java.awt.Color getColor()
          returns the color of the line.
 int getType()
          returns the style of the line.
 float getWidth()
          returns the width of the line.
 void setColor(java.awt.Color c)
          sets the color of the line.
 void setType(int t)
          sets the style of the line.
 void setWidth(float f)
          sets the width of the line.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE_NORMAL

public static final int LINE_NORMAL

LINE_DASHED

public static final int LINE_DASHED

LINE_DOTS

public static final int LINE_DOTS
Constructor Detail

LineStyle

public LineStyle(float w,
                 java.awt.Color c,
                 int t)
Creates a line style with the given width, color and style(line, dashed...).
Method Detail

setType

public void setType(int t)
sets the style of the line.

getType

public int getType()
returns the style of the line.

getColor

public java.awt.Color getColor()
returns the color of the line.

setColor

public void setColor(java.awt.Color c)
sets the color of the line.

getWidth

public float getWidth()
returns the width of the line.

setWidth

public void setWidth(float f)
sets the width of the line.

drawArc

public void drawArc(java.awt.Graphics g,
                    int x,
                    int y,
                    int w,
                    int h,
                    int a1,
                    int a2)

drawPolygon

public void drawPolygon(java.awt.Graphics g,
                        int[] x,
                        int[] y,
                        int c)
draws a polygon. X and Y contains the points and c the number of points.

drawOpenPolygon

public void drawOpenPolygon(java.awt.Graphics g,
                            int[] x,
                            int[] y,
                            int c)
draws an open polygon. Does not draw the line to connect first and last points.

drawSimpleLine

public void drawSimpleLine(java.awt.Graphics g,
                           int x1,
                           int y1,
                           int x2,
                           int y2)

drawLineWithStyle

public void drawLineWithStyle(java.awt.Graphics g,
                              int x1,
                              int y1,
                              int x2,
                              int y2)

drawRect

public void drawRect(java.awt.Graphics g,
                     int x1,
                     int y1,
                     int x2,
                     int y2)

draw

public void draw(java.awt.Graphics g,
                 int x1,
                 int y1,
                 int x2,
                 int y2)
draws a line between two points.