com.ijchart.xychart.render.xy
Class XYStackedBarRender

java.lang.Object
  extended by com.ijchart.xychart.render.AbstractRender
      extended by com.ijchart.xychart.render.AbstractWithAxisRender
          extended by com.ijchart.xychart.render.xy.AbstractXYRender
              extended by com.ijchart.xychart.render.xy.XYStackedBarRender
All Implemented Interfaces:
IDatasetChangeListener, IRender, IRenderWithAxis, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class XYStackedBarRender
extends AbstractXYRender
implements java.lang.Cloneable, java.io.Serializable

Title: IJChart

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

Draw xy stacked bar shapes.

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 boolean DEFAULT_ALLOW_DUPLICATE_X_VALUE
           A default flag that controls whether or not duplicate x-values are allowed.
static boolean DEFAULT_AUTO_WIDTH
           A flag to indicate whether the width should be calculated automatically.
static double DEFAULT_BAR_MARGIN
           The default percentage margin (to reduce the width of bars).
static double DEFAULT_FIXED_INTERVAL_WIDTH
           The fixed interval width.
static double DEFAULT_INTERVAL_POSITION_FACTOR
           The default value between 0.0 and 1.0 that indicates the position of the x-value within the interval.
 
Fields inherited from class com.ijchart.xychart.render.AbstractRender
borderPaints, borderStrokes, DEFAULT_AUTO_SELECT_BORDER_PAINT, DEFAULT_AUTO_SELECT_BORDER_STROKE, DEFAULT_AUTO_SELECT_FILL_PAINT, DEFAULT_BACKGROUND_IMAGE_ALIGNMENT, DEFAULT_BACKGROUND_PAINT, DEFAULT_BASE_BORDER_PAINT, DEFAULT_BASE_BORDER_STROKE, DEFAULT_BASE_ITEM_FILL, DEFAULT_BASE_ITEM_FILL_PAINT, DEFAULT_BASE_ITEM_FILL_PAINT_TRANSFORMER, DEFAULT_BASE_ITEM_LABEL_FONT, DEFAULT_BASE_ITEM_LABEL_HORIZONTAL_ALIGNMENT, DEFAULT_BASE_ITEM_LABEL_PAINT, DEFAULT_BASE_ITEM_LABEL_VERTICAL_ALIGNMENT, DEFAULT_BASE_ITEM_LABEL_VISIBLE, DEFAULT_BORDER_PAINT, DEFAULT_BORDER_STROKE, DEFAULT_DRAW_BORDER, DEFAULT_DRAWINT_SUPPLIER, DEFAULT_GENERATOR_TOOLTIP, DEFAULT_GENERATOR_URL, DEFAULT_LABEL_GENERATOR, DEFAULT_RENDER_AREA_BORDER_VISIBLE, DEFAULT_TOOLTIP_GENERATOR, fillPaints
 
Constructor Summary
XYStackedBarRender(IMatrixDataset dataset)
           constructor.
XYStackedBarRender(IMatrixDataset dataset, boolean renderAsPercentages)
           constructor.
 
Method Summary
 java.lang.Object clone()
           Creates and returns a copy of this object.
 void drawAllItems(AbstractValueAxis xAxis, RectangleEdge xAxisEdge, AbstractValueAxis yAxis, RectangleEdge yAxisEdge, java.awt.geom.Rectangle2D dataArea, ChartOrientation orientation, RenderShapeCollection renderShapes, float alpha)
           Draws all data items.
 boolean equals(java.lang.Object obj)
           Indicates if some other object is "equal to" this one.
 double getFixedIntervalWidth()
           Returns the fixed interval width.
 double getIntervalPositionFactor()
           Returns the value that indicates the position of the x-value within the interval.
 double getIntervalWidth()
           Returns the interval width.
 LegendType getLegendType()
           Return the legend type.
 double getMargin()
           Returns the margin which is a percentage amount by which the bars are trimmed.
 int hashCode()
           Returns a hash code value for the object.
 boolean isAllowDuplicateXValues()
           Returns the flag that controls whether or not duplicate x-values are allowed.
 boolean isAutoWidth()
           Returns whether or not the width should be calculated automatically.
 boolean isRenderAsPercentages()
           Returns true if the render displays each item value as a percentage (so that the stacked bars add to 100%), and false otherwise.
 void setAllowDuplicateXValues(boolean flag)
           Sets the flag that controls whether or not duplicate x-values are allowed and sends a RenderChangeEvent to all registered listeners.
 void setAutoWidth(boolean autoWidth)
           Sets the flag to indicate whether the width should be calculated automatically,and sends a RenderChangeEvent to all registered listeners.
 void setFixedIntervalWidth(double fixedIntervalWidth)
           Sets the fixed interval width,and sends a RenderChangeEvent to all registered listeners.
 void setIntervalPositionFactor(double factor)
           Sets the value that indicates the position of the x-value within the interval,and sends a RenderChangeEvent to all registered listeners.
 void setMargin(double margin)
           Sets the percentage amount by which the bars are trimmed and sends a RenderChangeEvent to all registered listeners.
 void setRenderAsPercentages(boolean asPercentages)
           Sets the flag that controls whether the render displays each item value as a percentage (so that the stacked bars add to 100%), and sends a RenderChangeEvent to all registered listeners.
 java.lang.String toString()
           Returns a string representation of the object.
 
Methods inherited from class com.ijchart.xychart.render.xy.AbstractXYRender
addAnnotation, drawAllAnnotation, getAllAnnotations, removeAllAnnotation
 
Methods inherited from class com.ijchart.xychart.render.AbstractWithAxisRender
createItemShape, createValueMarkerShape, drawIntervalValueMarker, drawValueMarker, getValueAxisOffsetType
 
Methods inherited from class com.ijchart.xychart.render.AbstractRender
add3DShapes, addChangeListener, calculateLegendItemShapes, createItemShapeOnly, datasetChanged, drawBackground, drawBackgroundImage, drawDrawAreaBorder, fireRenderChanged, getBackgroundImage, getBackgroundImageAlignment, getBackgroundImageAlpha, getBackgroundPaint, getBaseItemBorderPaint, getBaseItemBorderStroke, getBaseItemFillPaint, getBaseItemFillPaintTransformer, getBaseItemLabelDirection, getBaseItemLabelFont, getBaseItemLabelHorizontalAlignment, getBaseItemLabelPaint, getBaseItemLabelPosition, getBaseItemLabelVerticalAlignment, getBaseItemLabelVisible, getBorderPaints, getBorderStrokes, getChartArea, getColumnItemBorderPaint, getColumnItemBorderStroke, getColumnItemFillPaint, getColumnItemFillPaintTransformer, getColumnItemLabelDirection, getColumnItemLabelFont, getColumnItemLabelHorizontalAlignment, getColumnItemLabelPaint, getColumnItemLabelPosition, getColumnItemLabelVerticalAlignment, getDataset, getDrawingSupplier, getFillPaints, getItemBorderPaint, getItemBorderStroke, getItemFillPaint, getItemFillPaintHelper, getItemFillPaintTransformer, getItemLabelDirection, getItemLabelFont, getItemLabelHorizontalAlignment, getItemLabelPaint, getItemLabelPosition, getItemLabelVerticalAlignment, getLabelGenerator, getLegendItemCount, getLegendItemLabels, getLegendItemLabelsByColumn, getLegendItemLabelsByRow, getLegendItemShapes, getLegendPositon, getNegativeItemLabelHorizontalAlignment, getNegativeItemLabelVerticalAlignment, getPositiveItemLabelHorizontalAlignment, getPositiveItemLabelVerticalAlignment, getRenderAreaBorderPaint, getRenderAreaBorderStroke, getRowItemBorderPaint, getRowItemBorderStroke, getRowItemFillPaint, getRowItemFillPaintTransformer, getRowItemLabelDirection, getRowItemLabelFont, getRowItemLabelHorizontalAlignment, getRowItemLabelPaint, getRowItemLabelPosition, getRowItemLabelVerticalAlignment, getToolTipGenerator, hasListener, isAutoSelectBorderPaint, isAutoSelectBorderStroke, isAutoSelectFillPaint, isBaseItemDrawBorder, isBaseItemFill, isColumnItemDrawBorder, isColumnItemFill, isColumnItemLabelVisible, isColumnItemVisible, isGeneratorTooltip, isGeneratorUrl, isItemDrawBorder, isItemFill, isItemLabelVisible, isItemVisible, isRenderAreaBorderVisible, isRowItemDrawBorder, isRowItemFill, isRowItemLabelVisible, isRowItemVisible, notifyListeners, removeAllChangeListener, removeChangeListener, setAutoSelectBorderPaint, setAutoSelectBorderStroke, setAutoSelectFillPaint, setBackgroundImage, setBackgroundImageAlignment, setBackgroundImageAlpha, setBackgroundPaint, setBaseItemBorderPaint, setBaseItemBorderStroke, setBaseItemDrawBorder, setBaseItemFill, setBaseItemFillPaint, setBaseItemFillPaintTransformer, setBaseItemLabelDirection, setBaseItemLabelFont, setBaseItemLabelHorizontalAlignment, setBaseItemLabelPaint, setBaseItemLabelPosition, setBaseItemLabelVerticalAlignment, setBaseItemLabelVisible, setChartArea, setColumnItemBorderPaint, setColumnItemBorderStroke, setColumnItemDrawBorder, setColumnItemFill, setColumnItemFillPaint, setColumnItemFillPaintTransformer, setColumnItemLabelDirection, setColumnItemLabelFont, setColumnItemLabelHorizontalAlignment, setColumnItemLabelPaint, setColumnItemLabelPosition, setColumnItemLabelVerticalAlignment, setColumnItemLabelVisible, setColumnItemVisible, setCustomLegendType, setDataset, setDrawingSupplier, setDrawingSupplier, setGeneratorTooltip, setGeneratorUrl, setItemBorderPaint, setItemBorderStroke, setItemDrawBorder, setItemFill, setItemFillPaint, setItemFillPaintTransformer, setItemLabelDirection, setItemLabelFont, setItemLabelHorizontalAlignment, setItemLabelPaint, setItemLabelPosition, setItemLabelVerticalAlignment, setItemLabelVisible, setItemVisible, setLabelGenerator, setLegendPositon, setNegativeItemLabelHorizontalAlignment, setNegativeItemLabelVerticalAlignment, setPositiveItemLabelHorizontalAlignment, setPositiveItemLabelVerticalAlignment, setRenderAreaBorderPaint, setRenderAreaBorderStroke, setRenderAreaBorderVisible, setRowItemBorderPaint, setRowItemBorderStroke, setRowItemDrawBorder, setRowItemFill, setRowItemFillPaint, setRowItemFillPaintTransformer, setRowItemLabelDirection, setRowItemLabelFont, setRowItemLabelHorizontalAlignment, setRowItemLabelPaint, setRowItemLabelPosition, setRowItemLabelVerticalAlignment, setRowItemLabelVisible, setRowItemVisible, setToolTipGenerator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ijchart.xychart.render.IRender
addChangeListener, drawBackground, drawBackgroundImage, drawDrawAreaBorder, getBaseItemBorderPaint, getBaseItemBorderStroke, getBaseItemFillPaint, getBaseItemFillPaintTransformer, getBaseItemLabelFont, getBaseItemLabelHorizontalAlignment, getBaseItemLabelPaint, getBaseItemLabelPosition, getBaseItemLabelVerticalAlignment, getBaseItemLabelVisible, getColumnItemBorderPaint, getColumnItemBorderStroke, getColumnItemFillPaint, getColumnItemFillPaintTransformer, getColumnItemLabelFont, getColumnItemLabelHorizontalAlignment, getColumnItemLabelPaint, getColumnItemLabelPosition, getColumnItemLabelVerticalAlignment, getItemBorderPaint, getItemBorderStroke, getItemFillPaint, getItemFillPaintTransformer, getItemLabelFont, getItemLabelHorizontalAlignment, getItemLabelPaint, getItemLabelPosition, getItemLabelVerticalAlignment, getLabelGenerator, getNegativeItemLabelHorizontalAlignment, getNegativeItemLabelVerticalAlignment, getPositiveItemLabelHorizontalAlignment, getPositiveItemLabelVerticalAlignment, getRowItemBorderPaint, getRowItemBorderStroke, getRowItemFillPaint, getRowItemFillPaintTransformer, getRowItemLabelFont, getRowItemLabelHorizontalAlignment, getRowItemLabelPaint, getRowItemLabelPosition, getRowItemLabelVerticalAlignment, getToolTipGenerator, isBaseItemDrawBorder, isBaseItemFill, isColumnItemDrawBorder, isColumnItemFill, isColumnItemLabelVisible, isColumnItemVisible, isItemDrawBorder, isItemFill, isItemLabelVisible, isItemVisible, isRowItemDrawBorder, isRowItemFill, isRowItemLabelVisible, isRowItemVisible, removeAllChangeListener, removeChangeListener, setBaseItemBorderPaint, setBaseItemBorderStroke, setBaseItemDrawBorder, setBaseItemFill, setBaseItemFillPaint, setBaseItemFillPaintTransformer, setBaseItemLabelFont, setBaseItemLabelHorizontalAlignment, setBaseItemLabelPaint, setBaseItemLabelPosition, setBaseItemLabelVerticalAlignment, setBaseItemLabelVisible, setColumnItemBorderPaint, setColumnItemBorderStroke, setColumnItemDrawBorder, setColumnItemFill, setColumnItemFillPaint, setColumnItemFillPaintTransformer, setColumnItemLabelFont, setColumnItemLabelHorizontalAlignment, setColumnItemLabelPaint, setColumnItemLabelPosition, setColumnItemLabelVerticalAlignment, setColumnItemLabelVisible, setColumnItemVisible, setCustomLegendType, setItemBorderPaint, setItemBorderStroke, setItemDrawBorder, setItemFill, setItemFillPaint, setItemFillPaintTransformer, setItemLabelFont, setItemLabelHorizontalAlignment, setItemLabelPaint, setItemLabelPosition, setItemLabelVerticalAlignment, setItemLabelVisible, setItemVisible, setLabelGenerator, setNegativeItemLabelHorizontalAlignment, setNegativeItemLabelVerticalAlignment, setPositiveItemLabelHorizontalAlignment, setPositiveItemLabelVerticalAlignment, setRowItemBorderPaint, setRowItemBorderStroke, setRowItemDrawBorder, setRowItemFill, setRowItemFillPaint, setRowItemFillPaintTransformer, setRowItemLabelFont, setRowItemLabelHorizontalAlignment, setRowItemLabelPaint, setRowItemLabelPosition, setRowItemLabelVerticalAlignment, setRowItemLabelVisible, setRowItemVisible, setToolTipGenerator
 

Field Detail

DEFAULT_AUTO_WIDTH

public static final boolean DEFAULT_AUTO_WIDTH
A flag to indicate whether the width should be calculated automatically.

See Also:
Constant Field Values

DEFAULT_INTERVAL_POSITION_FACTOR

public static final double DEFAULT_INTERVAL_POSITION_FACTOR
The default value between 0.0 and 1.0 that indicates the position of the x-value within the interval.

See Also:
Constant Field Values

DEFAULT_FIXED_INTERVAL_WIDTH

public static final double DEFAULT_FIXED_INTERVAL_WIDTH
The fixed interval width.

See Also:
Constant Field Values

DEFAULT_BAR_MARGIN

public static final double DEFAULT_BAR_MARGIN
The default percentage margin (to reduce the width of bars).

See Also:
Constant Field Values

DEFAULT_ALLOW_DUPLICATE_X_VALUE

public static final boolean DEFAULT_ALLOW_DUPLICATE_X_VALUE
A default flag that controls whether or not duplicate x-values are allowed.

See Also:
Constant Field Values
Constructor Detail

XYStackedBarRender

public XYStackedBarRender(IMatrixDataset dataset)
constructor.

Parameters:
dataset - IMatrixDataset The dataset (null not permitted).

XYStackedBarRender

public XYStackedBarRender(IMatrixDataset dataset,
                          boolean renderAsPercentages)
constructor.

Parameters:
dataset - IMatrixDataset The dataset (null not permitted).
renderAsPercentages - boolean A flag that controls whether the data values are rendered as percentages.
Method Detail

isRenderAsPercentages

public boolean isRenderAsPercentages()
Returns true if the render displays each item value as a percentage (so that the stacked bars add to 100%), and false otherwise.

Returns:
A boolean. A boolean.

setRenderAsPercentages

public void setRenderAsPercentages(boolean asPercentages)
Sets the flag that controls whether the render displays each item value as a percentage (so that the stacked bars add to 100%), and sends a RenderChangeEvent to all registered listeners.

Parameters:
asPercentages - The flag.

isAutoWidth

public boolean isAutoWidth()
Returns whether or not the width should be calculated automatically.

Returns:
boolean A boolean.

setAutoWidth

public void setAutoWidth(boolean autoWidth)
Sets the flag to indicate whether the width should be calculated automatically,and sends a RenderChangeEvent to all registered listeners.

Parameters:
autoWidth - boolean A boolean.

getIntervalPositionFactor

public double getIntervalPositionFactor()
Returns the value that indicates the position of the x-value within the interval.

Returns:
double The factor.

setIntervalPositionFactor

public void setIntervalPositionFactor(double factor)
Sets the value that indicates the position of the x-value within the interval,and sends a RenderChangeEvent to all registered listeners.

Parameters:
factor - double The factor,must be in interval [0.0,1.0].

getFixedIntervalWidth

public double getFixedIntervalWidth()
Returns the fixed interval width.

Returns:
double The width.

setFixedIntervalWidth

public void setFixedIntervalWidth(double fixedIntervalWidth)
Sets the fixed interval width,and sends a RenderChangeEvent to all registered listeners.

Parameters:
fixedIntervalWidth - double The width,must be greater than 0.

getIntervalWidth

public double getIntervalWidth()
Returns the interval width.

Returns:
double The width.

getMargin

public double getMargin()
Returns the margin which is a percentage amount by which the bars are trimmed.

Returns:
double The margin.

setMargin

public void setMargin(double margin)
Sets the percentage amount by which the bars are trimmed and sends a RenderChangeEvent to all registered listeners.

Parameters:
margin - double The new margin,this value should belong to the interval [0.0,1.0).

isAllowDuplicateXValues

public boolean isAllowDuplicateXValues()
Returns the flag that controls whether or not duplicate x-values are allowed.

Returns:
boolean A boolean.

setAllowDuplicateXValues

public void setAllowDuplicateXValues(boolean flag)
Sets the flag that controls whether or not duplicate x-values are allowed and sends a RenderChangeEvent to all registered listeners.

Parameters:
flag - boolean A boolean.

drawAllItems

public void drawAllItems(AbstractValueAxis xAxis,
                         RectangleEdge xAxisEdge,
                         AbstractValueAxis yAxis,
                         RectangleEdge yAxisEdge,
                         java.awt.geom.Rectangle2D dataArea,
                         ChartOrientation orientation,
                         RenderShapeCollection renderShapes,
                         float alpha)
Draws all data items.

Specified by:
drawAllItems in class AbstractXYRender
Parameters:
xAxis - AbstractValueAxis The x value axis (null not permitted).
xAxisEdge - RectangleEdge The x axis edge.
yAxis - AbstractValueAxis The y value axis (null not permitted).
yAxisEdge - RectangleEdge The y axis edge (null not permitted).
dataArea - Rectangle2D The chart data area (null not permitted).
orientation - ChartOrientation The chart orientation (null not permitted).
renderShapes - RenderShapeCollection Collects information about the render (null not permitted).
alpha - float The alpha transparency (in the range 0.0f to 1.0f, where 0.0f is fully transparent, and 1.0f is fully opaque).

getLegendType

public LegendType getLegendType()
Return the legend type.

Specified by:
getLegendType in interface IRender
Overrides:
getLegendType in class AbstractRender
Returns:
LegendType The legend type.

equals

public boolean equals(java.lang.Object obj)
Indicates if some other object is "equal to" this one.

Overrides:
equals in class AbstractXYRender
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

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

Overrides:
hashCode in class AbstractXYRender
Returns:
int A hash code value for this object.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates and returns a copy of this object.

Overrides:
clone in class AbstractXYRender
Returns:
object a clone of this instance.
Throws:
java.lang.CloneNotSupportedException - if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class AbstractXYRender
Returns:
a string representation of the object.