lt.monarch.chart.spc
Class SPCLineStrategy<ChartProjector extends Projector>

java.lang.Object
  extended by lt.monarch.chart.chart2D.series.AbstractLineStrategy<ChartProjector>
      extended by lt.monarch.chart.spc.SPCLineStrategy<ChartProjector>
All Implemented Interfaces:
java.io.Serializable, AbstractStrategy

public class SPCLineStrategy<ChartProjector extends Projector>
extends AbstractLineStrategy<ChartProjector>

Direct line series strategy.

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
protected  Polygon2D[] bottomPolygon
          bottom line polygon.
protected  double[] firstX
          First x coordinates
protected  boolean isSortedSeries
          If true series is sorted
protected  double[] lastX
          Last x coordinates
protected  Orientation lineOrientation
          Specifies if the line direction is vertical
protected  Polygon2D[] polygon
          Line series polygon array, new polygon if null values are present
protected  PseudoArrayDataModel pseudoModel
          Data pseudo model
 
Fields inherited from class lt.monarch.chart.chart2D.series.AbstractLineStrategy
baseValue, cachingEnabled, dirty, isConnected, mapper, metaModel, minMaxValues, model, paintMode, planePoint, projector, showNullValues, style, tempPoint, xMapper, yMapper, zoomMultiplier
 
Constructor Summary
Constructor and Description
SPCLineStrategy()
          Line strategy constructor
 
Method Summary
Modifier and Type Method and Description
protected  int binarySearch(java.lang.Object value)
          Deprecated. 
protected  Polygon2D cacheLines(java.util.List<java.lang.Double> x, java.util.List<java.lang.Double> y, int n)
          Forms a polygon which has to be drawn.
protected  void determineLineDirection()
          Determines the direction of the line
 void dispose()
          Disposes the object
 void draw(AbstractGraphics g, ChartProjector projector, PlaneMapper mapper, HotSpotMap hotMap, boolean showNullValues, Style style, java.lang.Object baseValue, AbstractLineSeries<ChartProjector> series)
          Draws the series in the chart area.
protected  void drawLine(AbstractGraphics g, AbstractLineSeries<ChartProjector> series)
          Paints the connected series line in the specified Graphics context.
protected  int formNewPolygon(Polygon2D[] polygon, double[] firstX, double[] lastX, Polygon2D[] bottomPolygon, int pi)
          Forms a new polygon if previous polygon contains at least one point
protected  double getDataValueMappingHeight(java.lang.Object value, int index)
          Gets value of data height
protected  int getEndIndex()
          Gets the x value of visible range start
 Point2D getLinePointByX(double x)
          Calculates line Point2D value for a given x coordinate.
protected  Point2D getPointPosition(int markerIndex)
          Computes the marker's specified by the index position.
protected  int getStartIndex()
          Gets the x value of the visible range end
protected  java.lang.Object getValue(int index)
          Gets the value
protected  void initDrawing()
          Initializes polygon arrays and other arrays.
protected  boolean isDataInverted()
          Checks if the data of the line is inverted
protected  boolean isStacked()
          Checks if the data model is stacked
protected  boolean showNullPoints()
          Checks and returns if user has set nullLineColor or nullFillColor objects.
 
Methods inherited from class lt.monarch.chart.chart2D.series.AbstractLineStrategy
calculateSelection, getMinMaxValues, getModel, getX, getY, projectPoint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lineOrientation

protected Orientation lineOrientation
Specifies if the line direction is vertical


isSortedSeries

protected boolean isSortedSeries
If true series is sorted


firstX

protected double[] firstX
First x coordinates


lastX

protected double[] lastX
Last x coordinates


polygon

protected Polygon2D[] polygon
Line series polygon array, new polygon if null values are present


bottomPolygon

protected Polygon2D[] bottomPolygon
bottom line polygon. If no stacked lines than only 1 in the array.


pseudoModel

protected PseudoArrayDataModel pseudoModel
Data pseudo model

Constructor Detail

SPCLineStrategy

public SPCLineStrategy()
Line strategy constructor

Method Detail

dispose

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

Specified by:
dispose in class AbstractLineStrategy<ChartProjector extends Projector>

draw

public void draw(AbstractGraphics g,
                 ChartProjector projector,
                 PlaneMapper mapper,
                 HotSpotMap hotMap,
                 boolean showNullValues,
                 Style style,
                 java.lang.Object baseValue,
                 AbstractLineSeries<ChartProjector> series)
Description copied from class: AbstractLineStrategy
Draws the series in the chart area.

Overrides:
draw in class AbstractLineStrategy<ChartProjector extends Projector>
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
baseValue - base value
series - scatter series instance

getLinePointByX

public Point2D getLinePointByX(double x)
Description copied from class: AbstractLineStrategy
Calculates line Point2D value for a given x coordinate.

Overrides:
getLinePointByX in class AbstractLineStrategy<ChartProjector extends Projector>
Parameters:
x - coordinate for which the corresponding line point must be calculated.
Returns:
y calculated line value

determineLineDirection

protected void determineLineDirection()
Determines the direction of the line


isDataInverted

protected boolean isDataInverted()
Checks if the data of the line is inverted

Returns:
True if inverted

drawLine

protected void drawLine(AbstractGraphics g,
                        AbstractLineSeries<ChartProjector> series)
Paints the connected series line in the specified Graphics context.

Parameters:
g - the Graphics context in which to paint the series line. NOTE: setShowNullValues(boolean) works a little different here. When set to true, the line is broken and started from the next non-null point value. When set to false, the null values are simply ignored: the line connects all non-null value points.
series - Chart series to which this strategy belongs
See Also:
AbstractChartSeries.setShowNullValues(boolean)

cacheLines

protected Polygon2D cacheLines(java.util.List<java.lang.Double> x,
                               java.util.List<java.lang.Double> y,
                               int n)
Forms a polygon which has to be drawn. Throws away not needed lines.

Parameters:
x - x point array
y - y point array
n - number of points
Returns:
new polygon

initDrawing

protected void initDrawing()
Initializes polygon arrays and other arrays. Also determines line direction


getStartIndex

protected int getStartIndex()
Gets the x value of the visible range end

Returns:
index of x value

getEndIndex

protected int getEndIndex()
Gets the x value of visible range start

Returns:
index of x value

binarySearch

@Deprecated
protected int binarySearch(java.lang.Object value)
Deprecated. 


getValue

protected java.lang.Object getValue(int index)
Gets the value

Returns:
index of x or y value

getPointPosition

protected Point2D getPointPosition(int markerIndex)
Computes the marker's specified by the index position.

Parameters:
markerIndex - index of the marker to compute position for

formNewPolygon

protected int formNewPolygon(Polygon2D[] polygon,
                             double[] firstX,
                             double[] lastX,
                             Polygon2D[] bottomPolygon,
                             int pi)
Forms a new polygon if previous polygon contains at least one point

Parameters:
polygon - Line polygon array
firstX - First point array
lastX - Last point array
bottomPolygon - Bottom line polygon array
pi - Count of the polygons currently in polygon array
Returns:
Returns count of current line polygon

getDataValueMappingHeight

protected double getDataValueMappingHeight(java.lang.Object value,
                                           int index)
Gets value of data height

Parameters:
value - value of Object
index - number in array of object
Returns:
double value of data height

isStacked

protected boolean isStacked()
Checks if the data model is stacked

Returns:
true if data model is stacked on something

showNullPoints

protected boolean showNullPoints()
Checks and returns if user has set nullLineColor or nullFillColor objects. This means that user would like to see the probable values instead of nulls (if it is possible).

Returns:
boolean showing that null values should be drawn.