lt.monarch.chart.chart2D.series
Class BarStrategy

java.lang.Object
  extended by lt.monarch.chart.chart2D.series.AbstractBarStrategy
      extended by lt.monarch.chart.chart2D.series.BarStrategy
All Implemented Interfaces:
java.io.Serializable, AbstractStrategy
Direct Known Subclasses:
FloatingBarStrategy, LinePlotStrategy, PercentageAreaBarStrategy, SPCBarStrategy, VersusBarStrategy, WaterfallBarStrategy

public class BarStrategy
extends AbstractBarStrategy

Bar drawing strategy. This strategy draws all bars.

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
protected  Rectangle2D projectionArea
          Projection area
protected  int size
          Data model size
 
Fields inherited from class lt.monarch.chart.chart2D.series.AbstractBarStrategy
avoidLayoutingInvisible, barSpacing, barWidth, baseValue, clipList, colorMapper, dirty, mapper, metaModel, minMaxValues, model, orientation, seriesCount, seriesIndex, seriesSpacing, shape, style, xMapper, yMapper, zoomMultiplier
 
Constructor Summary
Constructor and Description
BarStrategy()
           
 
Method Summary
Modifier and Type Method and Description
 void dispose()
          Disposes the object
 void draw(AbstractGraphics g, Projector projector, PlaneMapper mapper, HotSpotMap hotMap, boolean showNullValues, Style style, int seriesCount, int seriesIndex, java.lang.Object baseValue, float barSpacing, float seriesSpacing, AbstractBarSeries barSeries, IndexedClipList clipList, ColorMapper colorMapper)
          No data painter
protected  void drawNoData(AbstractGraphics g, int index, Projector projector, boolean showNullValues, java.lang.Object x, java.lang.Object y, HotSpotMap hotMap)
          Draws no data bar
 void drawPrimitive(AbstractGraphics g, int index, Projector projector, HotSpotMap hotMap, boolean showNullValues, java.lang.Object baseValue, AbstractBarSeries barSeries)
          Draws one primitive
protected  void finalize()
           
protected static Transformation get90DegRotation()
          Get tTransformation with 90 degree counter clockwise rotation.
 double getBarBottom(int index, java.lang.Object baseValue)
          Gets bottom bar position
protected  Rectangle2D getBarBoundaries(int index, java.lang.Object baseValue)
          Transforms the specified bar.
 double getBarPosition(int index)
          Gets bar position, where the bar should stand.
 double getBarTop(int index)
          Gets bar top position
protected  Transformation getBarTransformation(int size, double barWidth)
          Returns bar transformation matrix
protected  double getBarWidth()
          Returns general bar width for all bars.
 double getBarWidth(int index)
          Gets bar width from the style sheet.
protected  double getBottomBarTop(int index, DataColumnType dataColumn, AxisMapper mapper, java.lang.Object baseValue)
          Determines the bar position
 Shape2D getDefaultShape()
          Returns the default strategy shape
protected  int getLabelCount(AxisMapper mapper)
          Returns label count on the axis
protected  Rectangle2D getShapeBounds()
          Get bounds of bar shape.
protected  Transformation getTransformation(Orientation orientation, double barWidth)
          Gets the transformation for series
protected  double getZeroValue(AxisMapper mapper)
          Gets mapped zero value if possible to map
protected  double getZoomMultiplier(AxisMapper mapper)
          Returns zoom multiplier
protected  boolean isBarInvisible(int size, double val)
          Checks if the bar is visible
 
Methods inherited from class lt.monarch.chart.chart2D.series.AbstractBarStrategy
getMinMaxValues, getModel
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

protected int size
Data model size


projectionArea

protected Rectangle2D projectionArea
Projection area

Constructor Detail

BarStrategy

public BarStrategy()
Method Detail

draw

public void draw(AbstractGraphics g,
                 Projector projector,
                 PlaneMapper mapper,
                 HotSpotMap hotMap,
                 boolean showNullValues,
                 Style style,
                 int seriesCount,
                 int seriesIndex,
                 java.lang.Object baseValue,
                 float barSpacing,
                 float seriesSpacing,
                 AbstractBarSeries barSeries,
                 IndexedClipList clipList,
                 ColorMapper colorMapper)
No data painter

Overrides:
draw in class AbstractBarStrategy
Parameters:
g - graphics context
projector - projector instance
mapper - plane mapper
hotMap - hot spot map
showNullValues - boolean value indicating whether to show the null values
style - style object
seriesCount - series count
seriesIndex - series index
baseValue - base value
barSpacing - bar spacing
seriesSpacing - series spacing
barSeries - bar series instance
clipList - clip list
colorMapper - color mapper, which maps colors according to values

drawPrimitive

public void drawPrimitive(AbstractGraphics g,
                          int index,
                          Projector projector,
                          HotSpotMap hotMap,
                          boolean showNullValues,
                          java.lang.Object baseValue,
                          AbstractBarSeries barSeries)
Description copied from class: AbstractBarStrategy
Draws one primitive

Specified by:
drawPrimitive in class AbstractBarStrategy
Parameters:
g - graphics context
index - data point index
projector - projector
hotMap - hot spot map
showNullValues - if true show null values
baseValue - base line value
barSeries - bar series instance

get90DegRotation

protected static Transformation get90DegRotation()
Get tTransformation with 90 degree counter clockwise rotation.

Returns:
rotation Transformation

getShapeBounds

protected Rectangle2D getShapeBounds()
Get bounds of bar shape.

Returns:
Rectangle2D with bar shape bounds.

getBarBoundaries

protected Rectangle2D getBarBoundaries(int index,
                                       java.lang.Object baseValue)
Transforms the specified bar. Shifts according to transformation and determines it's top and bottom bounds.

Specified by:
getBarBoundaries in class AbstractBarStrategy
Parameters:
index - index of the data point
baseValue - base value
Returns:
returns boundary of the bar

getBarWidth

public double getBarWidth(int index)
Gets bar width from the style sheet. Works only when the mappers and data model have beens set.

Parameters:
index - data point index
Returns:
bar width

getBarPosition

public double getBarPosition(int index)
Description copied from class: AbstractBarStrategy
Gets bar position, where the bar should stand. If vertical then x coordinate, if horizontal y coordinate

Specified by:
getBarPosition in class AbstractBarStrategy
Parameters:
index - data point index
Returns:
bar position

getBarTop

public double getBarTop(int index)
Description copied from class: AbstractBarStrategy
Gets bar top position

Specified by:
getBarTop in class AbstractBarStrategy
Parameters:
index - data point index
Returns:
bar top position

getZeroValue

protected double getZeroValue(AxisMapper mapper)
Gets mapped zero value if possible to map

Parameters:
mapper - mapper
Returns:
zero value

getBarBottom

public double getBarBottom(int index,
                           java.lang.Object baseValue)
Description copied from class: AbstractBarStrategy
Gets bottom bar position

Specified by:
getBarBottom in class AbstractBarStrategy
Parameters:
index - index of data point
baseValue - base line value
Returns:
bar bottom position

drawNoData

protected void drawNoData(AbstractGraphics g,
                          int index,
                          Projector projector,
                          boolean showNullValues,
                          java.lang.Object x,
                          java.lang.Object y,
                          HotSpotMap hotMap)
Draws no data bar

Parameters:
g - graphics context
index - index of the bar
projector - projector
showNullValues - boolean value if to show null values
x - x value
y - y value
hotMap - hot spot map

getBottomBarTop

protected double getBottomBarTop(int index,
                                 DataColumnType dataColumn,
                                 AxisMapper mapper,
                                 java.lang.Object baseValue)
Determines the bar position

Parameters:
index - bar index
dataColumn - data column in the data model
mapper - axis mapper
Returns:
bar position

isBarInvisible

protected boolean isBarInvisible(int size,
                                 double val)
Checks if the bar is visible

Parameters:
size - size of the data model
val - value of the bar
Returns:
true if the bar is not visible

getBarTransformation

protected Transformation getBarTransformation(int size,
                                              double barWidth)
Returns bar transformation matrix

Parameters:
size - size of the data model
barWidth - bar width
Returns:
returns bar transformation matrix

getTransformation

protected Transformation getTransformation(Orientation orientation,
                                           double barWidth)
Gets the transformation for series

Returns:
bar transformation

getBarWidth

protected double getBarWidth()
Description copied from class: AbstractBarStrategy
Returns general bar width for all bars. This method works only when mappers have been set.

Specified by:
getBarWidth in class AbstractBarStrategy
Returns:
normalized bar width value

getLabelCount

protected int getLabelCount(AxisMapper mapper)
Returns label count on the axis

Parameters:
mapper - axis mapper
Returns:
returns label count on the mapper

getZoomMultiplier

protected double getZoomMultiplier(AxisMapper mapper)
Returns zoom multiplier

Parameters:
mapper - axis mapper to calculate the zoom
Returns:
zoom multiplier number

dispose

public void dispose()
Description copied from class: AbstractBarStrategy
Disposes the object

Specified by:
dispose in class AbstractBarStrategy

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

getDefaultShape

public Shape2D getDefaultShape()
Description copied from class: AbstractBarStrategy
Returns the default strategy shape

Specified by:
getDefaultShape in class AbstractBarStrategy
Returns:
default strategy shape