lt.monarch.chart.chart2D.axis
Class Axis2DY

java.lang.Object
  extended by lt.monarch.chart.engine.AbstractChartObject<AxisPaintTags>
      extended by lt.monarch.chart.mapper.Axis
          extended by lt.monarch.chart.chart2D.axis.Axis2D
              extended by lt.monarch.chart.chart2D.axis.Axis2DY
All Implemented Interfaces:
java.io.Serializable, ChartObject, StyleEditorEntity

public class Axis2DY
extends Axis2D

Graphical representation of the Y coordinate axis of the 2D chart. Scrollable graphical representation of the Y coordinate axis of the 2D chart. Default implementation handles mouse dragging. A simple mouse click and drag is translated into an axis scroll. Ctrl + mouse drag select position of the axis for zooming. While Ctrl + mouse click unzooms the axis. These are the default event modifiers. The actual modifiers are specified in the stylesheet and "scrollModifiers" keys.

See Also:
Serialized Form

Nested Class Summary
Modifier and Type Class and Description
 
Nested classes/interfaces inherited from class lt.monarch.chart.chart2D.axis.Axis2D
Axis2D.AxisLabelEntity
 
Field Summary
Modifier and Type Field and Description
protected  double labelWidth
          Preferred width for the labels
protected  double maxLabelWidth
          Width of the longest rotated label projection.
protected  double preferredWidth
          Preferred width for the axis
protected  double totalLabelWidth
          Width of the total label width.
protected  AbstractAxisLabel[] visibleLabels
          Storage of label objects that are currently painted on the screen.
 
Fields inherited from class lt.monarch.chart.chart2D.axis.Axis2D
arrowPolygon, arrowPolygon2, arrowSettings, axisAlign, axisOrientation, dataModel, dragFrom, dragTo, finestVisibleScale, isMoreZoomAvailable, isScrollable, isVisible, isZooming, isZoomingEnabled, labelSettings, mappedAxis, mappedValue, mappedValueCoord, metaModel, mouseClick, mouseListener, mouseMotionListener, pt2D1, pt2D2, range, rangeListener, tickSettings
 
Fields inherited from class lt.monarch.chart.mapper.Axis
isInvertedMapper, mapper, textStyle
 
Fields inherited from class lt.monarch.chart.engine.AbstractChartObject
AXIS_SORT_POSITION, BREAK_LINE_POSITION, DEFAULT_SORT_POSITION, GRID_SORT_POSITION, MARKER_SERIES_SORT_POSITION, MARKERS_SORT_POSITION, paintStyle, SERIES_SORT_POSITION, sortPosition, style
 
Constructor Summary
Constructor and Description
Axis2DY(AxisMapper mapper)
          Constructs a new graphical representation of the Y coordinate axis of the 2D chart with the specified axis mapper.
Axis2DY(AxisMapper mapper, MetaDataModel metaModel, DataModel dataModel)
          Constructs a new graphical representation of the Y coordinate axis of the 2D chart with the specified axis mapper.
 
Method Summary
Modifier and Type Method and Description
protected  void drawAxis(AbstractGraphics g)
          Draws axis line
 void drawLabels(AbstractGraphics g, LinearLabelLayouter layouter)
          Draws the labels of the axis in the specified Graphics context.
protected  void drawTicksLabels(AbstractGraphics g, LinearLabelLayouter layouter)
          Prepares labels for drawing
protected  void drawTitle(AbstractGraphics g, LinearLabelLayouter layouter, AxisTitle axisTitle)
          Draws the title of the axis and updates label layouter that is used to layout the axis labels.
protected  Rectangle2D getActiveArea()
          Get area where is chart with y axis.
 java.awt.Insets getPreferredInsets()
          Queries preferred insets for the axis.
 Axis2DY getStackAxis2DY()
          Returns the base Y axis.
 int getTitleWidth(AbstractGraphics g)
          Returns horizontal amount of space needed to draw axis title.
 AbstractAxisLabel[] getVisibleLabels()
          Returns objects of visible labels.
 double getWidth()
          Returns the width of area required to draw the axis.
protected  Axis2D[] getZoomableAxes()
          Gets all zoomable axes for the specified orientation
 void prepare(AbstractGraphics g)
          Prepares this axis for rendering.
 void setStackAxis2DY(Axis2DY baseAxis)
          Stacks this Y axis on top of the base Y axis.
static void setStackedYAxisMargin(Chart<Projector2D> chart, float margin)
          Deprecated. use lt.monarch.chart.chart2D.Chart2D.setStackedYAxisMargin(float)
 void setTitle(int titleNr, AxisTitle title)
           
 
Methods inherited from class lt.monarch.chart.chart2D.axis.Axis2D
activate, createAxisLabel, deactivate, digitizePosition, draw, drawArrow, drawSecondArrow, drawZoomRectangle, getArrowPolygon, getArrowSettings, getAxisAlign, getAxisAlignment, getBounds, getChartObjectBounds, getFinestScale, getLabelSettings, getMappedAxis, getMappedValue, getMappedValueCoord, getMetaDataModel, getProjector, getStyle, getTickLength, getTickSettings, isScrollable, isVisible, isZoomingEnabled, setAxisAlign, setAxisPosition, setBounds, setMappedValueCoord, setScrollable, setVisible, setZoomingEnabled
 
Methods inherited from class lt.monarch.chart.mapper.Axis
getFont, getMapper, getSortPosition, getTextStyle, getTitle, getTitles, getTitleSettings, setTitle
 
Methods inherited from class lt.monarch.chart.engine.AbstractChartObject
chart, copy, dispose, finalize, getChart, getPaintStyle, getParent, getStyle, invalidate, layout, repaint, repaint, setChart
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

preferredWidth

protected double preferredWidth
Preferred width for the axis


labelWidth

protected double labelWidth
Preferred width for the labels


visibleLabels

protected AbstractAxisLabel[] visibleLabels
Storage of label objects that are currently painted on the screen.


maxLabelWidth

protected double maxLabelWidth
Width of the longest rotated label projection.


totalLabelWidth

protected double totalLabelWidth
Width of the total label width.

Constructor Detail

Axis2DY

public Axis2DY(AxisMapper mapper)
Constructs a new graphical representation of the Y coordinate axis of the 2D chart with the specified axis mapper.

Parameters:
mapper - the axis mapper

Axis2DY

public Axis2DY(AxisMapper mapper,
               MetaDataModel metaModel,
               DataModel dataModel)
Constructs a new graphical representation of the Y coordinate axis of the 2D chart with the specified axis mapper.

Parameters:
mapper - the axis mapper
metaModel - meta data model
dataModel - data model
Method Detail

prepare

public void prepare(AbstractGraphics g)
Prepares this axis for rendering.

Specified by:
prepare in class Axis2D
Parameters:
g - the Graphics context in which the axis will be painted

getWidth

public double getWidth()
Returns the width of area required to draw the axis.

Returns:
the axis width

getPreferredInsets

public java.awt.Insets getPreferredInsets()
Description copied from class: Axis2D
Queries preferred insets for the axis. Chart2D shrinks the chart area based on the inset information, collected from all axis objects, to make sure axis have enough space around the chart to draw all their labels correctly.

Overrides:
getPreferredInsets in class Axis2D
Returns:
Insets space, required between axis bounds and chart bounds.

drawTicksLabels

protected void drawTicksLabels(AbstractGraphics g,
                               LinearLabelLayouter layouter)
Prepares labels for drawing

Specified by:
drawTicksLabels in class Axis2D
Parameters:
g - graphics context

drawLabels

public void drawLabels(AbstractGraphics g,
                       LinearLabelLayouter layouter)
Description copied from class: Axis2D
Draws the labels of the axis in the specified Graphics context.

Specified by:
drawLabels in class Axis2D
Parameters:
g - the Graphics context in which the axis labels to paint
layouter - the Layouter used to layout axis labels

drawAxis

protected void drawAxis(AbstractGraphics g)
Description copied from class: Axis2D
Draws axis line

Specified by:
drawAxis in class Axis2D
Parameters:
g - graphics context

setTitle

public void setTitle(int titleNr,
                     AxisTitle title)
Overrides:
setTitle in class Axis

drawTitle

protected void drawTitle(AbstractGraphics g,
                         LinearLabelLayouter layouter,
                         AxisTitle axisTitle)
Description copied from class: Axis2D
Draws the title of the axis and updates label layouter that is used to layout the axis labels. The layouter is updated by setting its visible range.

Specified by:
drawTitle in class Axis2D
Parameters:
g - the Graphics context in which the axis title to paint
layouter - the label layouter used to layout axis labels
axisTitle - the axis title to draw

setStackedYAxisMargin

@Deprecated
public static void setStackedYAxisMargin(Chart<Projector2D> chart,
                                                    float margin)
Deprecated. use lt.monarch.chart.chart2D.Chart2D.setStackedYAxisMargin(float)

Sets margin between stacked y axes. Where margin : 0 - no margins, 1 - no axis.

Parameters:
chart - Chart for which stacked axis margin is specified
margin - relative size in range [0,1]

setStackAxis2DY

public void setStackAxis2DY(Axis2DY baseAxis)
Stacks this Y axis on top of the base Y axis.

Parameters:
baseAxis - Y axis, to be used as the base for the axis

getStackAxis2DY

public Axis2DY getStackAxis2DY()
Returns the base Y axis.

Returns:
Y axis, to be used as the base for the axis

getVisibleLabels

public AbstractAxisLabel[] getVisibleLabels()
Description copied from class: Axis2D
Returns objects of visible labels.

Specified by:
getVisibleLabels in class Axis2D
Returns:
array of visible labels

getZoomableAxes

protected Axis2D[] getZoomableAxes()
Description copied from class: Axis2D
Gets all zoomable axes for the specified orientation

Specified by:
getZoomableAxes in class Axis2D
Returns:
array of zoomable axes

getActiveArea

protected Rectangle2D getActiveArea()
Get area where is chart with y axis.

Specified by:
getActiveArea in class Axis2D
Returns:
active area

getTitleWidth

public int getTitleWidth(AbstractGraphics g)
Returns horizontal amount of space needed to draw axis title.

Parameters:
g - the Graphics context in which to paint axis
Returns:
title width in pixels