com.ijchart.xychart.plot.combine
Class AbstractCombineCategoryPlot

java.lang.Object
  extended by com.ijchart.xychart.plot.AbstractPlot
      extended by com.ijchart.xychart.plot.AbstractAxisPlot
          extended by com.ijchart.xychart.plot.CategoryPlot
              extended by com.ijchart.xychart.plot.combine.AbstractCombineCategoryPlot
All Implemented Interfaces:
IAxisChangeListener, IDatasetChangeListener, IRenderChangeListener, IZoomable, java.io.Serializable, java.lang.Cloneable, java.util.EventListener
Direct Known Subclasses:
CombineCategoryAxisCategoryPlot, CombineValueAxisCategoryPlot

public abstract class AbstractCombineCategoryPlot
extends CategoryPlot
implements java.lang.Cloneable, java.io.Serializable

Title: IJChart

Description: a chart library for the Java(tm) platform.

A abstract class for combined category plot where the axis is shared.

Copyright: Copyright (c) 2013

Company:

Version:
1.0
Author:
zhang feng min,shanghai china. Contract me by email.
See Also:
Serialized Form

Field Summary
static double DEFAULT_PLOT_GAP
           The default gap between plots.
protected  double plotGap
           The gap between plots.
protected  java.util.List subPlots
           Storage for the subplot.
protected  java.util.List subPlotWight
           The wight of sub plots.
 
Fields inherited from class com.ijchart.xychart.plot.CategoryPlot
DEFAULT_CATEGORY_CROSSHAIR_LOCKED_ON_DATA, DEFAULT_CATEGORY_CROSSHAIR_VISIBLE
 
Fields inherited from class com.ijchart.xychart.plot.AbstractAxisPlot
DEFAULT_CHART_ORIENTATION, DEFAULT_CROSSHAIR_PAINT, DEFAULT_CROSSHAIR_STROKE, DEFAULT_DOMAIN_CROSSHAIR_LOCKED_ON_DATA, DEFAULT_DOMAIN_CROSSHAIR_VISIBLE, DEFAULT_DOMAIN_GRIDLINE_VISIBLE, DEFAULT_DOMAIN_ZERO_BASELINE_VISIBLE, DEFAULT_GRIDLINE_PAINT, DEFAULT_GRIDLINE_STROKE, DEFAULT_VALUE_CROSSHAIR_LOCKED_ON_DATA, DEFAULT_VALUE_CROSSHAIR_VISIBLE, DEFAULT_VALUE_GRIDLINE_VISIBLE, domainAxes, renderToDomainAxis, renderToValueAxis, valueAxes
 
Fields inherited from class com.ijchart.xychart.plot.AbstractPlot
dataArea, DEFAULT_BACKGROUND_ALPHA, DEFAULT_BACKGROUND_IMAGE_ALIGNMENT, DEFAULT_BACKGROUND_PAINT, DEFAULT_BORDER_PAINT, DEFAULT_BORDER_STROKE, DEFAULT_BORDER_VISIBLE, DEFAULT_DRAW_NO_DATA_MESSAGE, DEFAULT_DRAWINT_SUPPLIER, DEFAULT_FOREGROUND_ALPHA, DEFAULT_INSETS, DEFAULT_MINIMUM_HEIGHT_TO_DRAW, DEFAULT_MINIMUM_WIDTH_TO_DRAW, DEFAULT_NO_DATA_MESSAGE, DEFAULT_NO_DATA_MESSAGE_FONT, DEFAULT_NO_DATA_MESSAGE_PAINT, DEFAULT_RENDER_CALL_ORDER, drawNoDataMessage, plotShapes, renderingOrder, renderShapesList
 
Constructor Summary
AbstractCombineCategoryPlot()
           A constructor.
 
Method Summary
 void addSubPlot(CategoryPlot plot)
           Add a sub plot and sends a PlotChangeEvent to all registered listeners.
 void addSubPlot(CategoryPlot plot, double wight)
           Add a sub plot and sends a PlotChangeEvent to all registered listeners.
 void clearSubPlots()
           Removes all sub plots.
 java.lang.Object clone()
           Returns a clone of the plot.
 boolean drawCrosshair(java.awt.geom.Point2D mouseClickPoint)
           Draws the crosshair.
 boolean equals(java.lang.Object obj)
           Tests the plot for equality with an arbitrary object.
protected  int getAxisCountByPosition(CategoryPlot plot, ChartOrientation orientation, RectangleEdge edge)
           Calculate the axis count for the specified position.
 double getPlotGap()
           Returns the gap between plots.
 double getPlotWight(CategoryPlot plot)
           Returns the wight for the specified plot.
 java.util.Collection getRenders()
           Returns the collection of renders,and this collection is unmodifiable.
 java.util.Collection getSubPlots()
           Returns all sub plots.
 int hashCode()
           Returns a hash code for this object.
 void removeSubPlot(CategoryPlot plot)
           Remove a sub plot and sends a PlotChangeEvent to all registered listeners.
 void setDomainCrosshairLockedOnData(boolean flag)
           Sets the flag indicating whether or not the domain crosshair should "lock-on" to actual data values.
 void setDomainCrosshairPaint(java.awt.Paint paint)
           Sets the paint used to draw the crosshairs (if visible) and sends a PlotChangeEvent to all registered listeners.
 void setDomainCrosshairStroke(java.awt.Stroke stroke)
           Sets the Stroke used to draw the crosshairs (if visible) and notifies registered listeners that the axis has been modified.
 void setDomainCrosshairVisible(boolean flag)
           Sets the flag indicating whether or not the domain crosshair is visible and, if the flag changes, sends a PlotChangeEvent to all registered listeners.
 void setPlotGap(double gap)
           Sets the gap between plots and sends a PlotChangeEvent to all registered listeners.
 void setPlotWight(CategoryPlot plot, double wight)
           Sets the wight for the specified plot and sends a PlotChangeEvent to all registered listeners.
 void setValueCrosshairLockedOnData(boolean flag)
           Sets the flag indicating whether or not the value crosshair should "lock-on" to actual data values.
 void setValueCrosshairPaint(java.awt.Paint paint)
           Sets the paint used to draw the crosshairs (if visible) and sends a PlotChangeEvent to all registered listeners.
 void setValueCrosshairStroke(java.awt.Stroke stroke)
           Sets the Stroke used to draw the crosshairs (if visible) and notifies registered listeners that the axis has been modified.
 void setValueCrosshairVisible(boolean flag)
           Sets the flag indicating whether or not the value crosshair is visible and, if the flag changes, sends a PlotChangeEvent to all registered listeners.
 void zoomValueAxes(java.awt.geom.Rectangle2D selectArea, java.awt.geom.Rectangle2D dataArea, java.awt.geom.Point2D source)
           Zoom value axes.
 
Methods inherited from class com.ijchart.xychart.plot.CategoryPlot
draw, drawAxes, getCategoryAxis, getCategoryAxis, getCategoryAxisByRenderIndex, getCategoryAxisCount, getCategoryAxisEdge, getCategoryAxisEdge, getCategoryAxisIndex, getCategoryAxisLocation, getCategoryAxisLocation, getNotNullCategoryAxis, getNotNullValueAxis, getNotNullValueAxisEdge, getPlotType, getRender, getRender, getRenderIndex, isDomainZoomable, setCategoryAxes, setCategoryAxes, setCategoryAxis, setCategoryAxis, setCategoryAxis, setCategoryAxisLocation, setCategoryAxisLocation, setRender, setRender, setRender, setRender, setRenders, toString
 
Methods inherited from class com.ijchart.xychart.plot.AbstractAxisPlot
allocateRenderShapesList, clearDomainAxes, clearValueAxes, drawValueGridlines, getAxisOffset, getCrosshairPoint, getDomainCrosshairPaint, getDomainCrosshairStroke, getDomainGridlinePaint, getDomainGridlineStroke, getOrientation, getRenderIndexForValueAxis, getRenderShapeCollection, getValueAxis, getValueAxis, getValueAxisByRenderIndex, getValueAxisCount, getValueAxisEdge, getValueAxisEdge, getValueAxisIndex, getValueAxisLocation, getValueAxisLocation, getValueCrosshairPaint, getValueCrosshairStroke, getValueGridlinePaint, getValueGridlineStroke, isDomainCrosshairLockedOnData, isDomainCrosshairVisible, isDomainGridlineVisible, isValueCrosshairLockedOnData, isValueCrosshairVisible, isValueGridlineVisible, mapRenderToDomainAxis, mapRenderToValueAxis, mapValueAxisToRender, setAxisOffset, setDomainGridlinePaint, setDomainGridlineStroke, setDomainGridlineVisible, setOrientation, setValueAxes, setValueAxes, setValueAxis, setValueAxis, setValueAxis, setValueAxisLocation, setValueAxisLocation, setValueAxisLocation, setValueAxisLocation, setValueGridlinePaint, setValueGridlineStroke, setValueGridlineVisible, translateMarkerShapes
 
Methods inherited from class com.ijchart.xychart.plot.AbstractPlot
addChangeListener, axisChanged, datasetChanged, drawBackground, drawBackgroundImage, drawBorder, drawNoDataMessage, firePlotChanged, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundImageAlpha, getBackgroundPaint, getBorderPaint, getBorderStroke, getDataArea, getDrawingSupplier, getForegroundAlpha, getInsets, getNoDataMessage, getNoDataMessageFont, getNoDataMessagePaint, getRenderDrawOrder, getRenderShapesList, handleClick, isBorderVisible, isDrawNoDataMessage, isValueZoomable, notifyListeners, removeChangeListener, renderChanged, resolveDomainAxisLocation, resolveValueAxisLocation, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundImageAlpha, setBackgroundPaint, setBorderPaint, setBorderStroke, setBorderVisible, setDrawingSupplier, setDrawNoDataMessage, setForegroundAlpha, setInsets, setListObject, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setRenderDrawOrder, zoomDomainAxes
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ijchart.xychart.listener.IRenderChangeListener
renderChanged
 

Field Detail

DEFAULT_PLOT_GAP

public static final double DEFAULT_PLOT_GAP
The default gap between plots.

See Also:
Constant Field Values

subPlots

protected java.util.List subPlots
Storage for the subplot.


subPlotWight

protected java.util.List subPlotWight
The wight of sub plots.


plotGap

protected double plotGap
The gap between plots.

Constructor Detail

AbstractCombineCategoryPlot

public AbstractCombineCategoryPlot()
A constructor.

Method Detail

addSubPlot

public void addSubPlot(CategoryPlot plot)
Add a sub plot and sends a PlotChangeEvent to all registered listeners.

Parameters:
plot - CategoryPlot The CategoryPlot object (null not permitted).

addSubPlot

public void addSubPlot(CategoryPlot plot,
                       double wight)
Add a sub plot and sends a PlotChangeEvent to all registered listeners.

Parameters:
plot - CategoryPlot The CategoryPlot object (null not permitted).
wight - double The widght,must be >0.

removeSubPlot

public void removeSubPlot(CategoryPlot plot)
Remove a sub plot and sends a PlotChangeEvent to all registered listeners.

Parameters:
plot - CategoryPlot The CategoryPlot object (null not permitted).

getSubPlots

public java.util.Collection getSubPlots()
Returns all sub plots.

Overrides:
getSubPlots in class AbstractPlot
Returns:
Collection The collection of sub plots (unmodifiable).

clearSubPlots

public void clearSubPlots()
Removes all sub plots.


getPlotWight

public double getPlotWight(CategoryPlot plot)
Returns the wight for the specified plot.

Parameters:
plot - CategoryPlot The CategoryPlot object (null not permitted).
Returns:
double The wight,-1 if not found.

setPlotWight

public void setPlotWight(CategoryPlot plot,
                         double wight)
Sets the wight for the specified plot and sends a PlotChangeEvent to all registered listeners.

Parameters:
plot - CategoryPlot The CategoryPlot object (null not permitted).
wight - double The widght,must be >0.

getPlotGap

public double getPlotGap()
Returns the gap between plots.

Returns:
double The gap.

setPlotGap

public void setPlotGap(double gap)
Sets the gap between plots and sends a PlotChangeEvent to all registered listeners.

Parameters:
gap - double

getRenders

public java.util.Collection getRenders()
Returns the collection of renders,and this collection is unmodifiable.

Overrides:
getRenders in class CategoryPlot
Returns:
Collection The collection of renders.

setDomainCrosshairVisible

public void setDomainCrosshairVisible(boolean flag)
Sets the flag indicating whether or not the domain crosshair is visible and, if the flag changes, sends a PlotChangeEvent to all registered listeners.

Overrides:
setDomainCrosshairVisible in class AbstractAxisPlot
Parameters:
flag - boolean The new value of the flag.

setDomainCrosshairLockedOnData

public void setDomainCrosshairLockedOnData(boolean flag)
Sets the flag indicating whether or not the domain crosshair should "lock-on" to actual data values. If the flag value changes, this method sends a PlotChangeEvent to all registered listeners.

Overrides:
setDomainCrosshairLockedOnData in class AbstractAxisPlot
Parameters:
flag - boolean The flag.

setDomainCrosshairStroke

public void setDomainCrosshairStroke(java.awt.Stroke stroke)
Sets the Stroke used to draw the crosshairs (if visible) and notifies registered listeners that the axis has been modified.

Overrides:
setDomainCrosshairStroke in class AbstractAxisPlot
Parameters:
stroke - Stroke The new crosshair stroke (null not permitted).

setDomainCrosshairPaint

public void setDomainCrosshairPaint(java.awt.Paint paint)
Sets the paint used to draw the crosshairs (if visible) and sends a PlotChangeEvent to all registered listeners.

Overrides:
setDomainCrosshairPaint in class AbstractAxisPlot
Parameters:
paint - Paint The new crosshair paint (null not permitted).

setValueCrosshairVisible

public void setValueCrosshairVisible(boolean flag)
Sets the flag indicating whether or not the value crosshair is visible and, if the flag changes, sends a PlotChangeEvent to all registered listeners.

Overrides:
setValueCrosshairVisible in class AbstractAxisPlot
Parameters:
flag - boolean The new value of the flag.

setValueCrosshairLockedOnData

public void setValueCrosshairLockedOnData(boolean flag)
Sets the flag indicating whether or not the value crosshair should "lock-on" to actual data values. If the flag value changes, this method sends a PlotChangeEvent to all registered listeners.

Overrides:
setValueCrosshairLockedOnData in class AbstractAxisPlot
Parameters:
flag - boolean The flag.

setValueCrosshairStroke

public void setValueCrosshairStroke(java.awt.Stroke stroke)
Sets the Stroke used to draw the crosshairs (if visible) and notifies registered listeners that the axis has been modified.

Overrides:
setValueCrosshairStroke in class AbstractAxisPlot
Parameters:
stroke - Stroke The new crosshair stroke (null not permitted).

setValueCrosshairPaint

public void setValueCrosshairPaint(java.awt.Paint paint)
Sets the paint used to draw the crosshairs (if visible) and sends a PlotChangeEvent to all registered listeners.

Overrides:
setValueCrosshairPaint in class AbstractAxisPlot
Parameters:
paint - Paint The new crosshair paint (null not permitted).

drawCrosshair

public boolean drawCrosshair(java.awt.geom.Point2D mouseClickPoint)
Draws the crosshair.

Overrides:
drawCrosshair in class AbstractAxisPlot
Parameters:
mouseClickPoint - Point2D The mouse click point (null permitted).
Returns:
boolean Returns whether or not crosshair is changed.

zoomValueAxes

public void zoomValueAxes(java.awt.geom.Rectangle2D selectArea,
                          java.awt.geom.Rectangle2D dataArea,
                          java.awt.geom.Point2D source)
Zoom value axes.

Specified by:
zoomValueAxes in interface IZoomable
Overrides:
zoomValueAxes in class AbstractAxisPlot
Parameters:
selectArea - Rectangle2D The selected area,null to restore chart.
dataArea - Rectangle2D The data area,null to restore chart.
source - Point2D The source mouse point (null not permitted).

getAxisCountByPosition

protected int getAxisCountByPosition(CategoryPlot plot,
                                     ChartOrientation orientation,
                                     RectangleEdge edge)
Calculate the axis count for the specified position.

Parameters:
plot - CategoryPlot The CategoryPlot object.
orientation - ChartOrientation The direction of chart.
edge - RectangleEdge The position.
Returns:
int The axis count.

equals

public boolean equals(java.lang.Object obj)
Tests the plot for equality with an arbitrary object.

Overrides:
equals in class CategoryPlot
Parameters:
obj - The object to test against (null permitted).
Returns:
A boolean.

hashCode

public int hashCode()
Returns a hash code for this object.

Overrides:
hashCode in class CategoryPlot
Returns:
A hash code.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of the plot.

Overrides:
clone in class CategoryPlot
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - if the cloning is not supported.