com.odesys.chart.barchart
Class BarChartView

java.lang.Object
  |
  +--com.odesys.chart.ChartView
        |
        +--com.odesys.chart.barchart.BarChartView

public class BarChartView
extends ChartView

BarChartView draws a Bar Chart in the Graphics context provided by its parent Chart Component. A normal or a stacked Bar Chart can be drawn depending on the currently set mode. The orientation determines if the Bar Chart is horizontal or vertical.


Field Summary
static int HORIZONTAL
           
static int NORMAL
           
static int STACKED
           
static int VERTICAL
           
 
Fields inherited from class com.odesys.chart.ChartView
m_chart
 
Constructor Summary
BarChartView(Chart parent)
          Creates a new BarChartView instance for the specified Chart.
 
Method Summary
 BarData barDataFromPoint(java.awt.Point point)
          Determines the BarData instance associated with the specified Point.
 Axis getAxisU()
          The U axis is the axis of the Categories.
 Axis getAxisV()
          The V axis is the axis of the Values.
 float getBarGap()
          Gets the gap between the Bars.
 float getCategoryGap()
          Gets the gap between the Categories.
 Grid getGrid()
          Gets the Grid instance used by this BarChartView.
 float getMaxSum()
          Gets the maximum sum of the values of a single Category in this BarChartView's data model.
 float getMaxValue()
          Gets the maximum value in this BarChartView's data model.
 float getMinSum()
          Gets the minimum sum of the values of a single Category in this BarChartView's data model.
 float getMinValue()
          Gets the minimum value in this BarChartView's data model.
 int getMode()
          Gets the mode of this BarChartView.
 BarChartModel getModel()
           
 int getOrientation()
          Gets the orientation of this BarChartView.
 int getPos(float value)
          Calculates the position of the specified value along the V axis of the Chart Grid rectangle.
 java.awt.Point getUVVector(java.awt.Point xyVector)
          Converts a radius-vector in XY coordinates to its corresponding radius-vector in UV coordinates.
 java.awt.Point getXYPoint(java.awt.Point uvPoint)
          Converts a Point in UV coordinates to its corresponding Point in XY coordinates.
 java.awt.Rectangle getXYRect(java.awt.Rectangle uvRect)
          Converts a Rectangle in UV coordinates to its corresponding Rectangle in XY coordinates.
 float getZVectorX()
          Gets the X component of the depth vector.
 float getZVectorY()
          Gets the Y component of the depth vector.
 boolean isSeriesReversed()
          Checks whether the Bars within a Category are drawn in reverse order.
 void paint(java.awt.Graphics g)
          Draws the Bar Chart in the specified Graphics context.
 void setBarGap(float gap)
          Sets the gap between the Bars.
 void setCategoryGap(float gap)
          Sets the gap between the Categories.
 void setMode(int mode)
          Sets the mode of this BarChartView.
 void setModel(ChartModel model)
          Sets the data Model of this ChartView.
 void setOrientation(int orientation)
          Sets the orientation of the bar chart in this BarChartView.
 void setSeriesReversed(boolean reversed)
          Determines the order in which the Bars for the differen Series show up within the Category.
 void setZVectorX(float x)
          Sets the X component of the depth vector.
 void setZVectorY(float y)
          Sets the Y component of the depth vector.
 void toXY(LabelHelper label)
          Converts the specified label in UV coordinates to its corresponding label in XY coordinates.
 void updateAggregates()
          Recalculates the Min, Max, MinSum and MaxSum values.
 void updateDrawables()
          Used internally to update the DrawableCategories of this BarChartView.
 
Methods inherited from class com.odesys.chart.ChartView
getBackground, getFont, getForeground, getPreferredSize, isAutoScaleToFit, isContoursVisible, isLabelsVisible, location, repaint, reshape, setAutoScaleToFit, setBackground, setContoursVisible, setFont, setForeground, setLabelsVisible, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HORIZONTAL

public static final int HORIZONTAL

VERTICAL

public static final int VERTICAL

NORMAL

public static final int NORMAL

STACKED

public static final int STACKED
Constructor Detail

BarChartView

public BarChartView(Chart parent)
Creates a new BarChartView instance for the specified Chart.
Method Detail

paint

public void paint(java.awt.Graphics g)
Draws the Bar Chart in the specified Graphics context.
Overrides:
paint in class ChartView

getAxisU

public Axis getAxisU()
The U axis is the axis of the Categories.

getAxisV

public Axis getAxisV()
The V axis is the axis of the Values.

getXYPoint

public java.awt.Point getXYPoint(java.awt.Point uvPoint)
Converts a Point in UV coordinates to its corresponding Point in XY coordinates.

getXYRect

public java.awt.Rectangle getXYRect(java.awt.Rectangle uvRect)
Converts a Rectangle in UV coordinates to its corresponding Rectangle in XY coordinates.

getUVVector

public java.awt.Point getUVVector(java.awt.Point xyVector)
Converts a radius-vector in XY coordinates to its corresponding radius-vector in UV coordinates.

toXY

public void toXY(LabelHelper label)
Converts the specified label in UV coordinates to its corresponding label in XY coordinates. The text of the labels remains horizontal.

getPos

public int getPos(float value)
Calculates the position of the specified value along the V axis of the Chart Grid rectangle.

getGrid

public Grid getGrid()
Gets the Grid instance used by this BarChartView.
Returns:
The Grid instance used by this BarChartView.

updateDrawables

public void updateDrawables()
Used internally to update the DrawableCategories of this BarChartView.
Overrides:
updateDrawables in class ChartView

setModel

public void setModel(ChartModel model)
              throws java.lang.IllegalArgumentException
Description copied from class: ChartView
Sets the data Model of this ChartView. Throws IllegalArgumentException if the ChartModel passed as a parameter is not appropriate for this ChartView instance.
Overrides:
setModel in class ChartView

getModel

public BarChartModel getModel()

setCategoryGap

public void setCategoryGap(float gap)
Sets the gap between the Categories.
Parameters:
gap - The gap between the Categories.

getCategoryGap

public float getCategoryGap()
Gets the gap between the Categories.
Returns:
The gap between the Categories.

setBarGap

public void setBarGap(float gap)
Sets the gap between the Bars.
Parameters:
gap - The gap between the Bars.

getBarGap

public float getBarGap()
Gets the gap between the Bars.
Returns:
The gap between the Bars.

setZVectorX

public void setZVectorX(float x)
Sets the X component of the depth vector.

getZVectorX

public float getZVectorX()
Gets the X component of the depth vector.

setZVectorY

public void setZVectorY(float y)
Sets the Y component of the depth vector.

getZVectorY

public float getZVectorY()
Gets the Y component of the depth vector.

setOrientation

public void setOrientation(int orientation)
Sets the orientation of the bar chart in this BarChartView.
Parameters:
orientation - The orientation of the bar chart in this BarChartView (BarChartView.HORIZONTAL or BarChartView.VERTICAL).

getOrientation

public int getOrientation()
Gets the orientation of this BarChartView.
Returns:
The orientation of this BarChartView.

setSeriesReversed

public void setSeriesReversed(boolean reversed)
Determines the order in which the Bars for the differen Series show up within the Category.
Parameters:
reversed - The order of the bars within the Category.

isSeriesReversed

public boolean isSeriesReversed()
Checks whether the Bars within a Category are drawn in reverse order.

setMode

public void setMode(int mode)
Sets the mode of this BarChartView. The possible modes are BarChartView.NORMAL and BarChartView.STACKED.
Parameters:
mode - The mode of this BarChartView.

getMode

public int getMode()
Gets the mode of this BarChartView.

barDataFromPoint

public BarData barDataFromPoint(java.awt.Point point)
Determines the BarData instance associated with the specified Point.
Returns:
The BarData instance associated with the specified Point.

getMaxValue

public float getMaxValue()
Gets the maximum value in this BarChartView's data model.

getMinValue

public float getMinValue()
Gets the minimum value in this BarChartView's data model.

getMaxSum

public float getMaxSum()
Gets the maximum sum of the values of a single Category in this BarChartView's data model.

getMinSum

public float getMinSum()
Gets the minimum sum of the values of a single Category in this BarChartView's data model.

updateAggregates

public void updateAggregates()
Recalculates the Min, Max, MinSum and MaxSum values.
Overrides:
updateAggregates in class ChartView