lt.monarch.chart.chart2D
Class Chart2D

java.lang.Object
  extended by lt.monarch.chart.AbstractView<PaintTags>
      extended by lt.monarch.chart.AbstractChart<PaintTags,GeneralProjector>
          extended by lt.monarch.chart.MultiSeriesChartBase<ChartPaintTags,Projector2D>
              extended by lt.monarch.chart.chart2D.Chart2D
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Chart<Projector2D>, ChartEntity, StyleEditorEntity, View
Direct Known Subclasses:
EmptyChart, SpcChart

public class Chart2D
extends MultiSeriesChartBase<ChartPaintTags,Projector2D>

Manages 2-dimensional chart objects

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
protected  Projector projector
          a projector used to map Point2D objects into the chart area
 
Fields inherited from class lt.monarch.chart.AbstractChart
draftMode, locale, plugins
 
Fields inherited from class lt.monarch.chart.AbstractView
layoutInvalid, paintStyle, style
 
Constructor Summary
Constructor and Description
Chart2D()
          Constructs a new Chart2D.
Chart2D(Projector2D projector)
          Constructs a new Chart2D with the specified projector.
 
Method Summary
Modifier and Type Method and Description
 void addBottomXAxis(Axis2DX ax)
          Deprecated. use addXAxis (Axis2DX, Alignment)
 void addLeftYAxis(Axis2DY ay)
          Deprecated. use addYAxis (Axis2DY, Alignment)
 void addRightYAxis(Axis2DY ay)
          Deprecated. use addYAxis (Axis2DY, Alignment)
 void addTopXAxis(Axis2DX ax)
          Deprecated. use addXAxis (Axis2DX, Alignment)
 void addXAxis(Axis2DX ax, Alignment axisPosition)
          Add one more X axis, which should appear at the specified side of the chart.
 void addYAxis(Axis2DY ay, Alignment axisPosition)
          Add one more Y axis, which should appear at the specified side of the chart.
 void dispose()
          Cleans this chart object.
protected  void finalize()
          Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
 ChartBreakLine getBreakLine()
          Returns chart break line.
 double getChartAreaMargin(Alignment alignment)
          Gets chart area margin.
 double getMinAxisWidth(Alignment alignment)
          Gets minimum axis width.
 Projector2D getProjector()
          Returns a projector used to map Point2D objects into the chart area.
 float getStackedXAxisMargin()
          Gets margin between stacked x axis.
 float getStackedYAxisMargin()
          Gets margin between stacked y axis.
 Axis2D[] getXAxes()
          Returns all x axes that are added to the chart
 Axis2D[] getYAxes()
          Returns all y axes that are added to the chart
protected  void layout(AbstractGraphics g)
          Layouts chart objects
protected  void paintChart(AbstractGraphics g)
          Paints the chart.
 Projector2D projector()
          Deprecated. use getProjector()
 void removeBottomXAxis(Axis ax)
          Deprecated. use removeXAxis (Axis2DY, Alignment)
 void removeLeftYAxis(Axis ay)
          Deprecated. use removeYAxis (Axis2DY, Alignment)
 void removeRightYAxis(Axis ay)
          Deprecated. use removeYAxis (Axis2DY, Alignment)
 void removeTopXAxis(Axis ax)
          Deprecated. use removeXAxis (Axis2DY, Alignment)
 void removeXAxis(Axis2DX ax, Alignment axisPosition)
          Removes X axis on the specified side of the chart.
 void removeYAxis(Axis2DY ay, Alignment axisPosition)
          Removes Y axis on the specified side of the chart.
 void setBottomXAxis(Axis2DX ax)
          Deprecated. use setXAxis (Axis2DX, Alignment)
 void setBreakLine(ChartBreakLine breakLine_)
          Sets chart break line.
 void setChartAreaMargin(double width, Alignment alignment)
          Sets chart area margin.
 void setLeftYAxis(Axis2DY ay)
          Deprecated. use setYAxis (Axis2DY, Alignment)
 void setMinAxisWidth(double width, Alignment alignment)
          Sets minimum axis width.
 void setRightYAxis(Axis2DY ay)
          Deprecated. use setYAxis (Axis2DY, Alignment)
 void setStackedBottomXAxisProportion(double[] stackedBottomXAxisProportion)
          Deprecated. use setStackedXAxisProportion (double[], Alignment)
 void setStackedLeftYAxisProportion(double[] stackedLeftYAxisProportion)
          Deprecated. use setStackedYAxisProportion (double[], Alignment)
 void setStackedRightYAxisProportion(double[] stackedRightYAxisProportion)
          Deprecated. use setStackedYAxisProportion (double[], Alignment)
 void setStackedTopXAxisProportion(double[] stackedTopXAxisProportion)
          Deprecated. use setStackedXAxisProportion (double[], Alignment)
 void setStackedXAxisMargin(float margin)
          Sets margin between stacked x axis.
 void setStackedXAxisProportion(double[] stackedXAxisProportion, Alignment axisPosition)
          Sets the value how much of the area will take each stacked axis on the specified side of the chart
 void setStackedYAxisMargin(float margin)
          Sets margin between stacked y axis.
 void setStackedYAxisProportion(double[] stackedYAxisProportion, Alignment axisPosition)
          Sets the value how much of the area will take each stacked axis on the specified side of the chart
 void setTopXAxis(Axis2DX ax)
          Deprecated. use setXAxis (Axis2DX, Alignment)
 void setXAxis(Axis2DX ax)
          Sets the X axis, which should appear at the bottom of the chart.
 void setXAxis(Axis2DX ax, Alignment axisPosition)
          Sets the X axis, which should appear at the specified side of the chart.
 void setYAxis(Axis2DY ay)
          Sets the Y axis on the left side of the chart.
 void setYAxis(Axis2DY ay, Alignment axisPosition)
          Sets the Y axis, which should appear at the specified side of the chart.
 
Methods inherited from class lt.monarch.chart.MultiSeriesChartBase
activate, addObject, createLegendEntries, deactivate, findObject, getContainingObjects, getObjects, layoutObjects, removeObject, replaceObject, reset, setObjects, shiftObjects
 
Methods inherited from class lt.monarch.chart.AbstractChart
addPlugin, disableDrafMode, enableDraftMode, fillEntitySheet, getDescription, getLocale, getParentEntity, getPlugins, getShortDescription, invalidate, isDraftMode, paint, removePlugin, removePlugins, setDraftMode, setLocale
 
Methods inherited from class lt.monarch.chart.AbstractView
addViewListener, clone, container, getAlignmentX, getAlignmentY, getBounds, getChartObjectBounds, getContainer, getGraphicsType, getHeight, getMaximumSize, getMinimumSize, getPaintMode, getPaintStyle, getParent, getPreferredSize, getSize, getSize, getStyle, getStyle, getWidth, getX, getY, isLayoutValid, removeViewListener, render, repaint, repaint, setAlignmentX, setAlignmentY, setBounds, setBounds, setContainer, setLocation, setMaximumSize, setMinimumSize, setPaintMode, setPreferredSize, setSize, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface lt.monarch.chart.engine.View
addViewListener, clone, container, getAlignmentX, getAlignmentY, getBounds, getGraphicsType, getHeight, getMaximumSize, getMinimumSize, getPreferredSize, getSize, getSize, getStyle, getWidth, getX, getY, removeViewListener, render, repaint, repaint, setAlignmentX, setAlignmentY, setBounds, setBounds, setContainer, setLocation, setMaximumSize, setMinimumSize, setPreferredSize, setSize, validate
 

Field Detail

projector

protected final Projector projector
a projector used to map Point2D objects into the chart area

Constructor Detail

Chart2D

public Chart2D(Projector2D projector)
Constructs a new Chart2D with the specified projector.

Parameters:
projector - the projector

Chart2D

public Chart2D()
Constructs a new Chart2D. A new lt.monarch.chart.chart2D.SimpleProjector2D is used as chart projector.

Method Detail

projector

@Deprecated
public Projector2D projector()
Deprecated. use getProjector()

Returns a projector used to map Point2D objects into the chart area.

Returns:
a projector used to map Point2D objects into the chart area

getProjector

public Projector2D getProjector()
Returns a projector used to map Point2D objects into the chart area.

Returns:
a projector used to map Point2D objects into the chart area

setYAxis

public void setYAxis(Axis2DY ay)
Sets the Y axis on the left side of the chart. This method is an alias for setYAxis

Parameters:
ay - y axis

setLeftYAxis

@Deprecated
public void setLeftYAxis(Axis2DY ay)
Deprecated. use setYAxis (Axis2DY, Alignment)

Sets the Y axis, which should appear on the left side of the chart.

Parameters:
ay - y axis

setRightYAxis

@Deprecated
public void setRightYAxis(Axis2DY ay)
Deprecated. use setYAxis (Axis2DY, Alignment)

Sets the Y axis, which should appear on the right side of the chart.

Parameters:
ay - y axis

setMinAxisWidth

public void setMinAxisWidth(double width,
                            Alignment alignment)
Sets minimum axis width.

Parameters:
width - minimum width relative size in range [0,1]
alignment - axis side

getMinAxisWidth

public double getMinAxisWidth(Alignment alignment)
Gets minimum axis width.

Parameters:
alignment - axis side
Returns:
minimum axis width

setChartAreaMargin

public void setChartAreaMargin(double width,
                               Alignment alignment)
Sets chart area margin.

Parameters:
width - relative size in range [0,1]
alignment - axis side

getChartAreaMargin

public double getChartAreaMargin(Alignment alignment)
Gets chart area margin.

Parameters:
alignment - axis side
Returns:
relative margin size

setYAxis

public void setYAxis(Axis2DY ay,
                     Alignment axisPosition)
Sets the Y axis, which should appear at the specified side of the chart.

Parameters:
ay - y axis
axisPosition - axis position on the chart: left or right

setXAxis

public void setXAxis(Axis2DX ax)
Sets the X axis, which should appear at the bottom of the chart.

Parameters:
ax - x axis

setBottomXAxis

@Deprecated
public void setBottomXAxis(Axis2DX ax)
Deprecated. use setXAxis (Axis2DX, Alignment)

Sets the X axis, which should appear at the bottom of the chart.

Parameters:
ax - x axis

setTopXAxis

@Deprecated
public void setTopXAxis(Axis2DX ax)
Deprecated. use setXAxis (Axis2DX, Alignment)

Sets the X axis, which should appear at the top of the chart.

Parameters:
ax - x axis

setXAxis

public void setXAxis(Axis2DX ax,
                     Alignment axisPosition)
Sets the X axis, which should appear at the specified side of the chart.

Parameters:
ax - x axis
axisPosition - axis position on the chart: top or bottom

addTopXAxis

@Deprecated
public void addTopXAxis(Axis2DX ax)
Deprecated. use addXAxis (Axis2DX, Alignment)

Add one more axis, which should appear on the top of the chart.

Parameters:
ax - x axis

addBottomXAxis

@Deprecated
public void addBottomXAxis(Axis2DX ax)
Deprecated. use addXAxis (Axis2DX, Alignment)

Add one more X axis, which should appear on the bottom of the chart.

Parameters:
ax - x axis

addXAxis

public void addXAxis(Axis2DX ax,
                     Alignment axisPosition)
Add one more X axis, which should appear at the specified side of the chart.

Parameters:
ax - x axis
axisPosition - axis position on the chart: top or bottom

setStackedYAxisMargin

public void setStackedYAxisMargin(float margin)
Sets margin between stacked y axis. Where margin : 0 - no margins, 1 - no axis.

Parameters:
margin - relative size in range [0,1]

getStackedYAxisMargin

public float getStackedYAxisMargin()
Gets margin between stacked y axis. Where margin : 0 - no margins, 1 - no axis.

Returns:
margin relative size in range [0,1]

addLeftYAxis

@Deprecated
public void addLeftYAxis(Axis2DY ay)
Deprecated. use addYAxis (Axis2DY, Alignment)

Adds one more Y axis, which should appear on the left side of the chart.

Parameters:
ay - y axis

addRightYAxis

@Deprecated
public void addRightYAxis(Axis2DY ay)
Deprecated. use addYAxis (Axis2DY, Alignment)

Add one more Y axis, which should appear on the right side of the chart.

Parameters:
ay - y axis

addYAxis

public void addYAxis(Axis2DY ay,
                     Alignment axisPosition)
Add one more Y axis, which should appear at the specified side of the chart.

Parameters:
ay - y axis
axisPosition - axis position on the chart: left or right

removeLeftYAxis

@Deprecated
public void removeLeftYAxis(Axis ay)
Deprecated. use removeYAxis (Axis2DY, Alignment)

Removes Y axis on the left side of the chart.

Parameters:
ay - y axis

removeRightYAxis

@Deprecated
public void removeRightYAxis(Axis ay)
Deprecated. use removeYAxis (Axis2DY, Alignment)

Removes Y axis on the right side of the chart.

Parameters:
ay - y axis

removeYAxis

public void removeYAxis(Axis2DY ay,
                        Alignment axisPosition)
Removes Y axis on the specified side of the chart.

Parameters:
ay - y axis
axisPosition - axis position on the chart: left or right

removeTopXAxis

@Deprecated
public void removeTopXAxis(Axis ax)
Deprecated. use removeXAxis (Axis2DY, Alignment)

Removes X axis on the top of the chart.

Parameters:
ax - x axis

removeBottomXAxis

@Deprecated
public void removeBottomXAxis(Axis ax)
Deprecated. use removeXAxis (Axis2DY, Alignment)

Removes X axis on the bottom of the chart.

Parameters:
ax - x axis

removeXAxis

public void removeXAxis(Axis2DX ax,
                        Alignment axisPosition)
Removes X axis on the specified side of the chart.

Parameters:
ax - x axis
axisPosition - axis position on the chart: top or bottom

getYAxes

public Axis2D[] getYAxes()
Returns all y axes that are added to the chart

Returns:
array of y axes

getXAxes

public Axis2D[] getXAxes()
Returns all x axes that are added to the chart

Returns:
array of x axes

layout

protected void layout(AbstractGraphics g)
Layouts chart objects

Overrides:
layout in class MultiSeriesChartBase<ChartPaintTags,Projector2D>
Parameters:
g - Graphics context

paintChart

protected void paintChart(AbstractGraphics g)
Description copied from class: MultiSeriesChartBase
Paints the chart. Static layout methods for AbstractBarSeries are called. Layout method itself is not static, but bar and series spacing access methods are static. All chart objects are drawn.

Overrides:
paintChart in class MultiSeriesChartBase<ChartPaintTags,Projector2D>
Parameters:
g - the Graphics context in which chart will be painted
See Also:
AbstractBarSeries.layout(int, int)

dispose

public void dispose()
Cleans this chart object. After this chart object is unusable and can be garbage collected.

Specified by:
dispose in interface View
Overrides:
dispose in class MultiSeriesChartBase<ChartPaintTags,Projector2D>

finalize

protected void finalize()
                 throws java.lang.Throwable
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. Calls cleanup method if it isn't called yet.

Overrides:
finalize in class MultiSeriesChartBase<ChartPaintTags,Projector2D>
Throws:
java.lang.Throwable - the Exception raised by this method

setStackedLeftYAxisProportion

@Deprecated
public void setStackedLeftYAxisProportion(double[] stackedLeftYAxisProportion)
                                   throws java.lang.IllegalArgumentException
Deprecated. use setStackedYAxisProportion (double[], Alignment)

Sets the value how much of the area will take each stacked axis on the left of the chart

Parameters:
stackedLeftYAxisProportion - Covered area by the each stacked y axis. Double value from 0 to 1
Throws:
java.lang.IllegalArgumentException - if any of arguments in array is less than 0 or greater than 1.

setStackedRightYAxisProportion

@Deprecated
public void setStackedRightYAxisProportion(double[] stackedRightYAxisProportion)
                                    throws java.lang.IllegalArgumentException
Deprecated. use setStackedYAxisProportion (double[], Alignment)

Sets the value how much of the area will take each stacked axis on the right of the chart

Parameters:
stackedRightYAxisProportion - Covered area by the each stacked y axis. Double value from 0 to 1
Throws:
java.lang.IllegalArgumentException - if any of arguments in array is less than 0 or greater than 1.

setStackedYAxisProportion

public void setStackedYAxisProportion(double[] stackedYAxisProportion,
                                      Alignment axisPosition)
                               throws java.lang.IllegalArgumentException
Sets the value how much of the area will take each stacked axis on the specified side of the chart

Parameters:
stackedYAxisProportion - Covered area by the each stacked y axis. Double value from 0 to 1
axisPosition - axis position on the chart: left or right
Throws:
java.lang.IllegalArgumentException - if any of arguments in array is less than 0 or greater than 1.

setStackedTopXAxisProportion

@Deprecated
public void setStackedTopXAxisProportion(double[] stackedTopXAxisProportion)
                                  throws java.lang.IllegalArgumentException
Deprecated. use setStackedXAxisProportion (double[], Alignment)

Sets the value how much of the area will take each stacked axis on the left of the chart

Parameters:
stackedTopXAxisProportion - Covered area by the each stacked x axis. Double value from 0 to 1
Throws:
java.lang.IllegalArgumentException - if any of arguments in array is less than 0 or greater than 1.

setStackedBottomXAxisProportion

@Deprecated
public void setStackedBottomXAxisProportion(double[] stackedBottomXAxisProportion)
                                     throws java.lang.IllegalArgumentException
Deprecated. use setStackedXAxisProportion (double[], Alignment)

Sets the value how much of the area will take each stacked x axis on the bottom of the chart

Parameters:
stackedBottomXAxisProportion - Covered area by the each stacked x axis. Double value from 0 to 1
Throws:
java.lang.IllegalArgumentException - if any of arguments in array is less than 0 or greater than 1.

setStackedXAxisProportion

public void setStackedXAxisProportion(double[] stackedXAxisProportion,
                                      Alignment axisPosition)
                               throws java.lang.IllegalArgumentException
Sets the value how much of the area will take each stacked axis on the specified side of the chart

Parameters:
stackedXAxisProportion - Covered area by the each stacked x axis. Double value from 0 to 1
axisPosition - axis position on the chart: top or bottom
Throws:
java.lang.IllegalArgumentException - if any of arguments in array is less than 0 or greater than 1.

setStackedXAxisMargin

public void setStackedXAxisMargin(float margin)
Sets margin between stacked x axis. Where margin : 0 - no margins, 1 - no axis.

Parameters:
margin - relative size in range [0,1]

getStackedXAxisMargin

public float getStackedXAxisMargin()
Gets margin between stacked x axis. Where margin : 0 - no margins, 1 - no axis.

Returns:
margin relative size in range [0,1]

setBreakLine

public void setBreakLine(ChartBreakLine breakLine_)
                  throws InvalidParameterException
Sets chart break line.

Parameters:
breakLine_ - chart creak line
Throws:
InvalidParameterException - when chart can't contain breakline

getBreakLine

public ChartBreakLine getBreakLine()
Returns chart break line.

Returns:
chart creak line