com.odesys.chart
Class ChartView

java.lang.Object
  |
  +--com.odesys.chart.ChartView
Direct Known Subclasses:
BarChartView, BubbleChartView, LegendView, LineChartView, PieChartView

public abstract class ChartView
extends java.lang.Object

ChartView is the abstract superclass of all chart views. It is responsible for drawing the chart. It is not a Component, but rather holds all the settings and parameters that determine how the chart is drawn. ChartView paints itself in the Graphics context passed to its paint method. Usually this is the Graphics context of its parent Chart.


Field Summary
protected  Chart m_chart
          The parent Chart of this ChartView
 
Constructor Summary
ChartView(Chart chart)
          Creates a ChartView for the specified parent Chart.
 
Method Summary
 java.awt.Color getBackground()
          Gets the background color of this ChartView
 java.awt.Font getFont()
          Gets the font of this ChartView.
 java.awt.Color getForeground()
          Gets the foreground color of this ChartView
 java.awt.Dimension getPreferredSize()
          Gets the preferred size of this ChartView
 boolean isAutoScaleToFit()
          Checks if this ChartView automatically scales its content to fill the whole available area.
 boolean isContoursVisible()
          Checks whether the contours of the chart elements are visible.
 boolean isLabelsVisible()
          Checks whether the labels of the chart elements are visible.
 java.awt.Point location()
          Gets the location of the upper left corner of this ChartView.
abstract  void paint(java.awt.Graphics g)
          Draws the chart in the specified Graphics context.
 void repaint()
          Repaints this ChartView
 void reshape(int x, int y, int width, int height)
          Sets the size and the location of this ChartView within its parent Chart.
 void setAutoScaleToFit(boolean autoScaleToFit)
          If autoScaleToFit is true the chart is scaled to fill the whole available area of this ChartView, otherwise the size of the chart has to be specified explicitly.
 void setBackground(java.awt.Color color)
          Sets the background color of this ChartView
 void setContoursVisible(boolean contoursVisible)
          Determines whether the contours of the chart elements (e.g.
 void setFont(java.awt.Font font)
          Sets the Font of this ChartView.
 void setForeground(java.awt.Color color)
          Sets the foreground color of this ChartView
 void setLabelsVisible(boolean labelsVisible)
          Sets whether the labels of the chart elements (e.g.
abstract  void setModel(ChartModel model)
          Sets the data Model of this ChartView.
 java.awt.Dimension size()
          Gets the size of this ChartView.
abstract  void updateAggregates()
          Updates the aggregate values for this chart (min or max values etc.).
abstract  void updateDrawables()
          Updates all visible elements of this ChartView.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_chart

protected Chart m_chart
The parent Chart of this ChartView
Constructor Detail

ChartView

public ChartView(Chart chart)
Creates a ChartView for the specified parent Chart.
Method Detail

setModel

public abstract void setModel(ChartModel model)
                       throws java.lang.IllegalArgumentException
Sets the data Model of this ChartView. Throws IllegalArgumentException if the ChartModel passed as a parameter is not appropriate for this ChartView instance.

updateDrawables

public abstract void updateDrawables()
Updates all visible elements of this ChartView. Usually called automatically when the parameters are changed.

updateAggregates

public abstract void updateAggregates()
Updates the aggregate values for this chart (min or max values etc.). Called automatically when a value in the model is changed.

paint

public abstract void paint(java.awt.Graphics g)
Draws the chart in the specified Graphics context.

setAutoScaleToFit

public void setAutoScaleToFit(boolean autoScaleToFit)
If autoScaleToFit is true the chart is scaled to fill the whole available area of this ChartView, otherwise the size of the chart has to be specified explicitly.

isAutoScaleToFit

public boolean isAutoScaleToFit()
Checks if this ChartView automatically scales its content to fill the whole available area.

setLabelsVisible

public void setLabelsVisible(boolean labelsVisible)
Sets whether the labels of the chart elements (e.g. the labels of the slices of the Pie Chart) should be drawn.

isLabelsVisible

public boolean isLabelsVisible()
Checks whether the labels of the chart elements are visible.

setContoursVisible

public void setContoursVisible(boolean contoursVisible)
Determines whether the contours of the chart elements (e.g. the slices of the Pie Chart) should be drawn.

isContoursVisible

public boolean isContoursVisible()
Checks whether the contours of the chart elements are visible.

reshape

public void reshape(int x,
                    int y,
                    int width,
                    int height)
Sets the size and the location of this ChartView within its parent Chart.

size

public java.awt.Dimension size()
Gets the size of this ChartView.

location

public java.awt.Point location()
Gets the location of the upper left corner of this ChartView.

setFont

public void setFont(java.awt.Font font)
Sets the Font of this ChartView.

getFont

public java.awt.Font getFont()
Gets the font of this ChartView. If its font is null the Font of the parent Chart is returned.

setForeground

public void setForeground(java.awt.Color color)
Sets the foreground color of this ChartView

getForeground

public java.awt.Color getForeground()
Gets the foreground color of this ChartView

setBackground

public void setBackground(java.awt.Color color)
Sets the background color of this ChartView

getBackground

public java.awt.Color getBackground()
Gets the background color of this ChartView

getPreferredSize

public java.awt.Dimension getPreferredSize()
Gets the preferred size of this ChartView

repaint

public void repaint()
Repaints this ChartView