|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.comrom.chart.Chart
Main class . The Chart class calculates the position and size of all the components and calls the draw method of them as required. Example of use: // data double[] d1={1,2,3,4,5,4,2}; BarDataSerie data1= new BarDataSerie(d1,new FillStyle(GraphicsProvider.getColor(ChartColor.CYAN))); data1.border=new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL); //data1.borderType=BarDataSerie.BORDER_RAISED; data1.border=new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL); data1.valueFont=GraphicsProvider.getFont("Arial",ChartFont.BOLD,10); double[] d2={-2,3,4,4.2,6.4,4.5,6.1}; BarDataSerie data2= new BarDataSerie(d2,new FillStyle(GraphicsProvider.getColor(ChartColor.GREEN))); data2.valueFont=GraphicsProvider.getFont("Arial",ChartFont.BOLD,10); data2.border=new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL); data2.negativeStyle=new FillStyle(GraphicsProvider.getColor(ChartColor.RED)); Legend l=new Legend(); l.border=new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL); l.addItem("Company A",new FillStyle(GraphicsProvider.getColor(ChartColor.CYAN))); l.addItem("Company B",new FillStyle(GraphicsProvider.getColor(ChartColor.GREEN))); // create title Title title=new Title("Benefits companies A & B"); // create axis Axis XAxis=new Axis(Axis.HORIZONTAL,new Scale()); Axis YAxis=new Axis(Axis.VERTICAL,new Scale()); XAxis.tickAtBase=true; // draw also first tick XAxis.scale.min=-3; XAxis.scale.max=7; YAxis.scale.min=0; YAxis.scale.max=7; YAxis.IntegerScale=true; YAxis.scaleTickInterval=1; XAxis.scaleTickInterval=1; XAxis.gridStyle=new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.WHITE),LineStyle.LINE_DOTS); YAxis.gridStyle=new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.WHITE),LineStyle.LINE_DOTS); String[] lbls={"1998","1999","2000","2001","2002","2003","2004","2005"}; YAxis.tickLabels=lbls; HAxisLabel XLabel= new HAxisLabel("million $",GraphicsProvider.getColor(ChartColor.BLACK),GraphicsProvider.getFont("Arial",ChartFont.BOLD,12)); VAxisLabel YLabel= new VAxisLabel("Year",GraphicsProvider.getColor(ChartColor.BLACK),GraphicsProvider.getFont("Arial",ChartFont.BOLD,12)); // plotter BarPlotter plot=new BarPlotter(); plot.verticalBars=false; plot.interBarSpace=0; // create chart Chart chart=new Chart(title,plot,XAxis,YAxis); chart.XLabel=XLabel; chart.YLabel=YLabel; chart.legend=l; chart.addSerie(data2); chart.addSerie(data1); chart.back=new FillStyle(GraphicsProvider.getColor(ChartColor.LIGHTGRAY)); chart.saveToFile("chart.gif","GIF");
| Field Summary | |
boolean |
activateSelection
if true the selectedSerie and selectedSeriePoint will get a value of the point, bar or item the cursor is on |
boolean |
autoRebuild
|
boolean |
autoSize
if true (default) the position and size of the components will be calculated automatically |
double |
axisMargin
|
FillStyle |
back
background of the chart. |
ChartImage |
backImage
|
LineStyle |
border
border of the chart. |
double |
bottomMargin
area reserved for the x axis. |
double |
currentValueX
position of the cursor. |
double |
currentValueY
position of the cursor. |
double |
currentValueY2
position of the cursor. |
int |
currentX
position of the cursor. |
int |
currentY
position of the cursor. |
static int |
dnum
|
boolean |
doubleBuffering
use double buffering for creating the chart? |
boolean |
fullXAxis
|
java.lang.String |
htmlLinkTarget
target of the html links when creating a html image map |
int |
layout
position of the legend in the chart. |
static int |
LAYOUT_LEGEND_BOTTOM
|
static int |
LAYOUT_LEGEND_RIGHT
|
static int |
LAYOUT_LEGEND_TOP
|
double |
leftMargin
area reserved for the y axis. |
Legend |
legend
legend of the chart |
double |
legendMargin
area reserved for the legend. |
ChartLoader |
loader
|
long |
msecs
|
static java.lang.String |
numberLocale
locale used for decimal number formatting |
int |
offsetX
used by th chart viewer only for scroll functions |
int |
offsetY
used by th chart viewer only for scroll functions |
Plotter[] |
plotters
array of plotter |
java.lang.String |
reloadFrom
url where the chart should be reloaded from |
boolean |
repaintAll
force the paint to be repainted |
boolean |
repaintAlways
|
double |
rightMargin
empty area to the right side of the chrta if the legend is on the top or the bottom |
double |
secondYAxisMargin
|
ChartLabel |
selectedLabel
holds the selected chartlabel |
DataSerie |
selectedSerie
holds the DataSerie of the selected point |
int |
selectedSeriePoint
|
boolean |
showPosition
show position of cursor (only if used inside an applet) |
boolean |
showTips
show tips |
Title |
title
title of the chart |
double |
topMargin
area reserved for the title. |
int |
virtualHeight
height of the chart (in pixels). |
int |
virtualWidth
Width of the chart (in pixels). |
boolean |
withScroll
|
Axis |
XAxis
X axis of the chart |
HAxisLabel |
XLabel
X axis of the chart |
Axis |
Y2Axis
|
VAxisLabel |
Y2Label
|
Axis |
YAxis
|
VAxisLabel |
YLabel
|
| Constructor Summary | |
Chart(Title t,
Plotter p,
Axis X,
Axis Y)
|
|
| Method Summary | |
void |
addChartListener(ChartListener cl)
|
void |
addNote(java.lang.String note)
|
void |
addPlotter(Plotter p)
|
void |
addSerie(DataSerie s)
|
void |
addTargetZone(TargetZone zone)
|
void |
dispose()
|
int |
getHeight()
|
java.lang.String |
getHTMLImageMap(java.lang.String name)
|
TargetZone[] |
getTargetZones()
|
int |
getWidth()
|
void |
mouseClick()
|
void |
mouseMoved(int eX,
int eY)
|
void |
paint(ChartGraphics pg)
|
void |
removeAllChartListener()
|
void |
removeChartListener(ChartListener cl)
|
void |
removeNotes()
|
void |
removePlotters()
|
void |
removeTargetZones()
|
void |
saveToFile(java.io.OutputStream os,
java.lang.String psFormat)
|
void |
saveToFile(java.lang.String psFile,
java.lang.String psFormat)
|
void |
setHeight(int h)
|
void |
setMinimumSize(int w,
int h)
|
void |
setSize(int w,
int h)
|
void |
setWidth(int w)
|
void |
setY2Scale(Axis a)
|
void |
startUpdater()
|
void |
stopUpdater()
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int LAYOUT_LEGEND_RIGHT
public static final int LAYOUT_LEGEND_TOP
public static final int LAYOUT_LEGEND_BOTTOM
public static final int dnum
public static java.lang.String numberLocale
public VAxisLabel YLabel
public VAxisLabel Y2Label
public HAxisLabel XLabel
public Legend legend
public Axis XAxis
public Axis YAxis
public Axis Y2Axis
public Title title
public double bottomMargin
public double topMargin
public double secondYAxisMargin
public double leftMargin
public double rightMargin
public double legendMargin
public double axisMargin
public boolean autoSize
public Plotter[] plotters
public int layout
public FillStyle back
public LineStyle border
public int offsetX
public int offsetY
public ChartImage backImage
public boolean doubleBuffering
public int virtualWidth
public int virtualHeight
public boolean withScroll
public boolean repaintAll
public boolean repaintAlways
public boolean fullXAxis
public ChartLabel selectedLabel
public DataSerie selectedSerie
public int selectedSeriePoint
public boolean activateSelection
public int currentX
public int currentY
public double currentValueX
public double currentValueY
public double currentValueY2
public java.lang.String htmlLinkTarget
public boolean showTips
public boolean showPosition
public ChartLoader loader
public long msecs
public java.lang.String reloadFrom
public boolean autoRebuild
| Constructor Detail |
public Chart(Title t,
Plotter p,
Axis X,
Axis Y)
t - p - X - Y - | Method Detail |
public int getWidth()
public int getHeight()
public void setMinimumSize(int w,
int h)
public void setSize(int w,
int h)
public void addTargetZone(TargetZone zone)
public void removeTargetZones()
public void addNote(java.lang.String note)
public void removeNotes()
public TargetZone[] getTargetZones()
public void setWidth(int w)
public void setHeight(int h)
public void addChartListener(ChartListener cl)
public void removeChartListener(ChartListener cl)
public void removeAllChartListener()
public void addPlotter(Plotter p)
public void removePlotters()
public void setY2Scale(Axis a)
public void paint(ChartGraphics pg)
public void addSerie(DataSerie s)
s - public void dispose()
public void saveToFile(java.io.OutputStream os,
java.lang.String psFormat)
throws java.lang.Exception
java.lang.Exception
public void saveToFile(java.lang.String psFile,
java.lang.String psFormat)
throws java.lang.Exception
java.lang.Exceptionpublic void mouseClick()
public void mouseMoved(int eX,
int eY)
public void startUpdater()
public void stopUpdater()
public java.lang.String getHTMLImageMap(java.lang.String name)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||