All Packages Class Hierarchy This Package Previous Next Index
Class COM.ibm.beans.charting.ChartView
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----COM.ibm.desktop.ModelView
|
+----COM.ibm.beans.charting.ChartView
- public class ChartView
- extends ModelView
The ChartView is the parent View class of all the charting beans, and
extends the ModelView class of the CAF framework.
It implements all the view related functionality for the charts.
It uses the data contained in ChartModel for the chart, and maintains the viewing
properties of the chart, like, whether or not the values and labels, the axes labels,
etc. are to be shown on the chart.
It uses double-buffering to draw the chart to an image, whose size is determined
by the size of the frame that this chart is being displayed in, at any time.
-
fAxesShown
- Flag for whether or not the axes should be shown (true for the Bar & Line Charts,
false for the Pie)
-
fAxisLabel1
- String to be drawn for the chart's scale halfway along the data
axis.
-
fAxisLabel2
- String to be drawn for the chart's scale at the end of the data axis.
-
fBorderSize
- Size of the border of white space around the chart - in actuality
the labels for each value, and the X axis label, are drawn in this
border space
-
fChartFont
- The font for labelling the chart.
-
fChartImage
- The Image object that is the off-screen buffer used for drawing the chart
-
fChartWidth
- Flag for whether or not the axes should be shown (true for the Bar & Line Charts,
false for the Pie)
-
fIg
- Graphics object of the off-screen buffer image used for drawing the chart
-
fLabelsShown
- Flag to determine whether or not the labels for each value should be shown.
-
fLegendLabels
- Array of labels to be drawn in the legend.
-
fMaxValue
- Maximum value of all data values - rounded to the nearest tenth.
-
fRatio
- Ratio between data values and pixels
-
fTitleFont
- The font for the title of the chart.
-
fValuesShown
- Flag for whether or not the values for each chart point/bar should be shown.
-
fXAxisLabelShown
- Flag for whether or not the X axis label should be shown.
-
fYAxisLabelShown
- Flag for whether or not the Y axis label should be shown.
-
ChartView()
- Default constructor.
-
getChartFont()
- Returns the font used for the chart's labels.
-
getMaxLegendRowSize()
- Calculates the maximum size of the legend rows, based on what is to be shown
in the legend, i.e., the labels for the different bars/wedges and/or the values
of each bar/wedge.
-
getMinimumSize()
- Returns the minimum size of the chart.
-
getPreferredSize()
- Returns the preferred size of the chart.
-
getTitleFont()
- Returns the font used for the chart's title.
-
handleModelChange(ModelChangeEvent)
- Handles model changes.
-
initialize()
- Initializes the view.
-
isLabelsShown()
- Returns true if the flag for showing the labels for the chart data is
set to true, false otherwise.
-
isValuesShown()
- Returns true if the flag for showing the values of the chart data is
set to true, false otherwise.
-
isXAxisLabelShown()
- Returns true if the flag for showing the X Axis label for the chart data
is set to true, false otherwise.
-
isYAxisLabelShown()
- Returns true if the flag for showing the Y Axis label for the chart data
is set to true, false otherwise.
-
legendFits()
- Checks to see if the legend will fit in the chart's current drawing area.
-
paint(Graphics)
- Creates an off-screen buffer for drawing to match the current size
of the view area, and sets some default graphics properties for the buffer.
-
paintAxes()
- Paints the X and Y axes.
-
paintAxisLabels()
- Paints the label under the X axis (incase of a Vertical Bar Chart & Line Chart)
or above the Y axis (incase of a Horizontal Bar Chart), if one was specified.
-
paintLegend()
- Paints the legend for the chart, based on
a) the type of chart, and
b) what the user wants to see, viz, the labels and/or the values
-
paintScale()
- Paints the scale on the appropriate axis, depending on the orientation of the chart.
-
paintTitle()
- Paints the title of the chart, if one was specified.
-
paintXAxisScale()
- Paints the scale on the X axis.
-
paintYAxisScale()
- Paints the scale on the Y axis.
-
setAxisLabels()
- Set the labels to be used on the axes.
-
setChartFont(Font)
- Sets the font used for the chart's labels to the specified font.
-
setLabelsShown(boolean)
- Sets to true or false, the flag for showing the labels for the chart data.
-
setLegendLabels()
- Set the labels to be used in the legend.
-
setTitleFont(Font)
- Sets the font for the chart's title to the specified font.
-
setValuesShown(boolean)
- Sets to true or false, the flag for showing the values for the chart data
on the chart.
-
setXAxisLabelShown(boolean)
- Sets to true or false, the flag for showing the X Axis label for the
chart data.
-
setYAxisLabelShown(boolean)
- Sets to true or false, the flag for showing the Y Axis label for the
chart data.
-
update(Graphics)
- Updates the view by causing a repaint of the view.
fMaxValue
protected int fMaxValue
- Maximum value of all data values - rounded to the nearest tenth.
fAxisLabel1
protected transient String fAxisLabel1
- String to be drawn for the chart's scale halfway along the data
axis. (based on fMaxValue)
fAxisLabel2
protected transient String fAxisLabel2
- String to be drawn for the chart's scale at the end of the data axis.
(based on fMaxValue)
fRatio
protected double fRatio
- Ratio between data values and pixels
fBorderSize
protected static int fBorderSize
- Size of the border of white space around the chart - in actuality
the labels for each value, and the X axis label, are drawn in this
border space
fIg
protected transient Graphics fIg
- Graphics object of the off-screen buffer image used for drawing the chart
fChartImage
protected transient Image fChartImage
- The Image object that is the off-screen buffer used for drawing the chart
fLabelsShown
protected boolean fLabelsShown
- Flag to determine whether or not the labels for each value should be shown.
fValuesShown
protected boolean fValuesShown
- Flag for whether or not the values for each chart point/bar should be shown.
fXAxisLabelShown
protected boolean fXAxisLabelShown
- Flag for whether or not the X axis label should be shown.
fYAxisLabelShown
protected boolean fYAxisLabelShown
- Flag for whether or not the Y axis label should be shown.
fAxesShown
protected transient boolean fAxesShown
- Flag for whether or not the axes should be shown (true for the Bar & Line Charts,
false for the Pie)
fChartWidth
protected int fChartWidth
- Flag for whether or not the axes should be shown (true for the Bar & Line Charts,
false for the Pie)
fLegendLabels
protected String fLegendLabels[]
- Array of labels to be drawn in the legend.
The strings actually displayed depend on, e.g. what the user wants to see (in a
pie chart, the labels and/or the values, in a bar chart, the labels only)
fTitleFont
protected Font fTitleFont
- The font for the title of the chart.
fChartFont
protected Font fChartFont
- The font for labelling the chart.
ChartView
public ChartView()
- Default constructor.
initialize
public void initialize()
- Initializes the view.
This method is called after the Model, View, and ComponentController
are constructed.
- Overrides:
- initialize in class ModelView
handleModelChange
public void handleModelChange(ModelChangeEvent event)
- Handles model changes.
- Overrides:
- handleModelChange in class ModelView
update
public void update(Graphics g)
- Updates the view by causing a repaint of the view.
- Overrides:
- update in class Component
paint
public void paint(Graphics gr)
- Creates an off-screen buffer for drawing to match the current size
of the view area, and sets some default graphics properties for the buffer.
The background color is set, and the title and axes are drawn..
- Overrides:
- paint in class Container
paintTitle
protected void paintTitle()
- Paints the title of the chart, if one was specified.
paintAxisLabels
protected void paintAxisLabels()
- Paints the label under the X axis (incase of a Vertical Bar Chart & Line Chart)
or above the Y axis (incase of a Horizontal Bar Chart), if one was specified.
paintLegend
public void paintLegend()
- Paints the legend for the chart, based on
a) the type of chart, and
b) what the user wants to see, viz, the labels and/or the values
legendFits
protected boolean legendFits()
- Checks to see if the legend will fit in the chart's current drawing area.
The size of the legend depends on what is to be shown in the legend; the labels
and / or the values in the ChartModel.
setLegendLabels
protected void setLegendLabels()
- Set the labels to be used in the legend. In the case of Bar Charts, these are
the same as the labels and / or the data values in the ChartModel.
getMaxLegendRowSize
protected int getMaxLegendRowSize()
- Calculates the maximum size of the legend rows, based on what is to be shown
in the legend, i.e., the labels for the different bars/wedges and/or the values
of each bar/wedge. This length is used to determine whether or not the legend
can be shown.
paintAxes
protected void paintAxes()
- Paints the X and Y axes.
paintScale
protected void paintScale()
- Paints the scale on the appropriate axis, depending on the orientation of the chart.
setAxisLabels
protected void setAxisLabels()
- Set the labels to be used on the axes.
paintYAxisScale
protected void paintYAxisScale()
- Paints the scale on the Y axis.
paintXAxisScale
protected void paintXAxisScale()
- Paints the scale on the X axis.
getPreferredSize
public Dimension getPreferredSize()
- Returns the preferred size of the chart.
- Overrides:
- getPreferredSize in class Container
getMinimumSize
public Dimension getMinimumSize()
- Returns the minimum size of the chart.
- Overrides:
- getMinimumSize in class Container
getTitleFont
public Font getTitleFont()
- Returns the font used for the chart's title.
setTitleFont
public void setTitleFont(Font font)
- Sets the font for the chart's title to the specified font.
- Parameters:
- font - the font for the chart's title
getChartFont
public Font getChartFont()
- Returns the font used for the chart's labels.
setChartFont
public void setChartFont(Font font)
- Sets the font used for the chart's labels to the specified font.
- Parameters:
- font - the font for the chart's labels
isLabelsShown
public boolean isLabelsShown()
- Returns true if the flag for showing the labels for the chart data is
set to true, false otherwise.
setLabelsShown
public void setLabelsShown(boolean show)
- Sets to true or false, the flag for showing the labels for the chart data.
- Parameters:
- show - if true, the labels for the bars/points are shown,
if false, they are hidden
isValuesShown
public boolean isValuesShown()
- Returns true if the flag for showing the values of the chart data is
set to true, false otherwise.
setValuesShown
public void setValuesShown(boolean show)
- Sets to true or false, the flag for showing the values for the chart data
on the chart.
- Parameters:
- show - if true, the values of the bars/points are shown,
if false, they are hidden
isXAxisLabelShown
public boolean isXAxisLabelShown()
- Returns true if the flag for showing the X Axis label for the chart data
is set to true, false otherwise.
setXAxisLabelShown
public void setXAxisLabelShown(boolean show)
- Sets to true or false, the flag for showing the X Axis label for the
chart data.
- Parameters:
- show - if true, the label under the X axis is shown,
if false, it is hidden
isYAxisLabelShown
public boolean isYAxisLabelShown()
- Returns true if the flag for showing the Y Axis label for the chart data
is set to true, false otherwise.
setYAxisLabelShown
public void setYAxisLabelShown(boolean show)
- Sets to true or false, the flag for showing the Y Axis label for the
chart data.
- Parameters:
- show - if true, the label above the Y axis is shown,
if false, it is hidden
All Packages Class Hierarchy This Package Previous Next Index