Summ:  Constr. Methods    Details:  Constr. Methods      Class:  Prev Next
com.artfulbits.aiCharts.Base
Class ChartArea

java.lang.Object com.artfulbits.aiCharts.Base.ChartArea

Declaration: public class ChartArea extends Object
implements ILayout.IElement
All Interfaces: ILayout.IElement

 

Represents chart area class. Chart area is an integral part of ChartEngine. It handles series and axes drawing logic. By design, chart passes recursive paint and layout calls to its children. Parent ChartEngine is able to host several areas represented by areas collection. Legend may represent series from separate areas making possible complex layout design depending on desired output (i.e. couple pie charts with legend representing each of them).
 ChartArea chartArea = new ChartArea();
 ChartSeries series1 = new ChartSeries(ChartTypes.FastLine);
 
 double[] data = {32,26,26,29,39,48,45,52,55,50};
 
 for(int i = 0; i < data1.length; i++)
 {
 	series1.getPoints().addXY(i, data[i]);
 }
 
 chartField.getSeries().add(series1);
 
 chartField.getAreas().add(chartArea);
 

 

Since: 1.0
See also: ChartLegendChartAxisChartSeries

 

 

Constructors Summary
ChartArea()
    
Initializes a new instance of ChartArea.
ChartArea(java.lang.String name)
    
Initialize a new instance of ChartArea with specified name.
ChartArea(java.lang.String name, ChartAxis xAxis, ChartAxis yAxis)
    
Initializes a new instance of ChartArea class using axes specified.

 

 

Methods Summary
void draw(Graphics g)
    
Draws area on the provided Graphics context.
ChartCollection getAxes()
    
Gets ChartAxis collection.
Background getBackground()
    
Gets the Background that is used to draw background of area.
Border getBorder()
    
Gets the Border that is used to draw border of area.
XYRect getBounds()
    
Gets area bounding XYRect rectangle.
int getCoordinateSystem()
    
Returns current coordinate system.
ChartAxis getDefaultXAxis()
    
Gets the default X axis.
ChartAxis getDefaultYAxis()
    
Gets the default Y axis.
java.lang.String getName()
    
Gets the name of this area.
XYRect getSeriesBounds()
    
Gets XYRect region occupied by series.
boolean isAutoLayout()
    
Gets value indicating whether layout for this area is handled automatically.
void layout(XYRect inOutBounds)
    
Sets bounds for this element.
void measure(XYDimension inOutSize)
    
Measures the element.
void refresh()
    
Refreshes the area.
void setBackground(Background background)
    
Sets the Background that is used to draw background of area.
void setBorder(Border border)
    
Sets the Border that is used to draw border of area.
void setBounds(XYRect bounds)
    
Sets XYRect bounds for this area.
void setDefaultXAxis(ChartAxis axis)
    
Sets the default X axis.
void setDefaultYAxis(ChartAxis axis)
    
Sets the default Y axis.
void setName(java.lang.String name)
    
Sets the name for area.

 

Methods inherited from class: java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

 

 

 

ChartArea

 

public ChartArea( )

 

Initializes a new instance of ChartArea. Sets default orientation for X and Y axes. Series should be added to area in order to be represented.

 

Since: 1.0
See also: ChartEngine.getAreas()ChartSeries

 

 

 

ChartArea

 

public ChartArea( java.lang.String name)

 

Initialize a new instance of ChartArea with specified name. Sets default orientation for X and Y axes. Series should be added to area in order to be represented.

 

Parameters:
name-
unique chart area name

 

Since: 1.0
See also: ChartEngine.getAreas()ChartSeries

 

 

 

ChartArea

 

public ChartArea( java.lang.String name,
ChartAxis xAxis,
ChartAxis yAxis)

 

Initializes a new instance of ChartArea class using axes specified.

 

Parameters:
name-
unique chart area name
xAxis-
Vertical axis that represents default X axis for area.
yAxis-
Horizontal axis that represents default Y axis for

 

Since: 1.0
See also: ChartArea()ChartAxisChartSeriesChartEngine

 

 

 

 

getName

 

public java.lang.String getName( )

 

Gets the name of this area.

 

Returns:
java.lang.String representation of area' name.

 

Since: 1.0

 

 

 

setName

 

public void setName( java.lang.String name)

 

Sets the name for area.

 

Parameters:
name-
java.lang.String representation of desired name.

 

Since: 1.0

 

 

 

getDefaultXAxis

 

public ChartAxis getDefaultXAxis( )

 

Gets the default X axis.

 

Returns:
instance of ChartAxis used as default X axis.

 

Since: 1.0

 

 

 

setDefaultXAxis

 

public void setDefaultXAxis( ChartAxis axis)

 

Sets the default X axis.

 

Parameters:
axis-
instance of ChartAxis that should be used as default X axis

 

Since: 1.0

 

 

 

getDefaultYAxis

 

public ChartAxis getDefaultYAxis( )

 

Gets the default Y axis.

 

Returns:
instance of ChartAxis used as default X axis.

 

Since: 1.0

 

 

 

setDefaultYAxis

 

public void setDefaultYAxis( ChartAxis axis)

 

Sets the default Y axis.

 

Parameters:
axis-
instance of ChartAxis that should be used as default Y axis

 

Since: 1.0

 

 

 

getAxes

 

public ChartCollection getAxes( )

 

Gets ChartAxis collection.

 

Returns:
instance of ChartCollection filled with axes.

 

Since: 1.0

 

 

 

getBorder

 

public Border getBorder( )

 

Gets the Border that is used to draw border of area.

 

Returns:
instance of Border class.

 

Since: 1.0

 

 

 

setBorder

 

public void setBorder( Border border)

 

Sets the Border that is used to draw border of area.

 

Parameters:
border-
instance of Border class.

 

Since: 1.0

 

 

 

getBackground

 

public Background getBackground( )

 

Gets the Background that is used to draw background of area.

 

Returns:
instance of Background class.

 

Since: 1.0

 

 

 

setBackground

 

public void setBackground( Background background)

 

Sets the Background that is used to draw background of area.

 

Parameters:
background-
instance of Background class.

 

Since: 1.0

 

 

 

isAutoLayout

 

public boolean isAutoLayout( )

 

Gets value indicating whether layout for this area is handled automatically. If bounds for area are set, this value is false.

 

Returns:
true if area's layout is automatic, otherwise false.

 

Since: 1.0

 

 

 

getSeriesBounds

 

public XYRect getSeriesBounds( )

 

Gets XYRect region occupied by series.

 

Returns:
instance of XYRect representing area's series bounds.

 

Since: 1.0

 

 

 

setBounds

 

public void setBounds( XYRect bounds)

 

Sets XYRect bounds for this area.

 

Parameters:
bounds-
instance of XYRect region that should be occupied by this area.

 

Since: 1.0

 

 

 

getBounds

 

public XYRect getBounds( )

 

Gets area bounding XYRect rectangle.

 

Returns:
XYRect representing current area bounds.

 

Since: 1.0

 

 

 

getCoordinateSystem

 

public int getCoordinateSystem( )

 

Returns current coordinate system.

 

Returns:
one of CoordinateSystem's constants. Default coordinate system is CoordinateSystem.CARTESIAN.

 

Since: 1.0

 

 

 

layout

 

public void layout( XYRect inOutBounds)

 

[ description from ILayout.IElement.layout(XYRect) ]
 
Sets bounds for this element.

 

Parameters:
inOutBounds-
instance of XYRect representing bounds for element.

 

Implements: ILayout.IElement.layout(XYRect)

 

 

 

measure

 

public void measure( XYDimension inOutSize)

 

[ description from ILayout.IElement.measure(XYDimension) ]
 
Measures the element.

 

Parameters:
inOutSize-
available size to contains the element. This parameter will be used to return the desired size of element.

 

Implements: ILayout.IElement.measure(XYDimension)

 

 

 

draw

 

public void draw( Graphics g)

 

Draws area on the provided Graphics context.

 

Parameters:
g-
instance of Graphics class.

 

Since: 1.0

 

 

 

refresh

 

public void refresh( )

 

Refreshes the area. Ensures compatible series visibility, recalculates axes range.

 

Since: 1.0

 

 

© 2005 - 2010 ArtfulBits. All rights reserved.