com.davisor.graphics.chart
Class ScaleLegendFactory.ScaleLegendMetrics

java.lang.Object
  extended bycom.davisor.graphics.chart.ChartFactory.ChartMetrics
      extended bycom.davisor.graphics.chart.ScaleLegendFactory.ScaleLegendMetrics
Enclosing class:
ScaleLegendFactory

public class ScaleLegendFactory.ScaleLegendMetrics
extends ChartFactory.ChartMetrics

Legend metrics contain the legend sizing information. Scale legends are divided into several sections as shown in the following diagram.

 ---------------------lbw-----------------   bp = border padding
 |          bp                           |  hlg = horizontal label gap  
 |  |---------------------------------|  |  hlo = horizontal label offset
 |  |  |         vlo*              |  |  |  hsg = horizontal shape gap 
 |  |  -----------------------------  |  |  lbw = legend border width  
 |  |  |  |  | vsg/2 |  |  |       |  |  |  vlo = vertical label offset  
 |  |h |h |h ---------h |h |       |h |  |  vsg = vertical shape gap     
 |  |l |l |s |       |s |l |       |l |  |  
 |  |o |g |g | shape |g |g | label |o |  l
 |  |* |/ |/ |       |/ |/ |       |  |  b
 |  |  |2 |2 ---------2 |2 |       |  |  w
 |  |  |  |  | vsg/2 |  |  |       |  |  |
 |  |  |----------------------------  |  |
 |  |  |         vlo               |  |  |
 |  |---------------------------------|  |
 |                                       |
 -----------------------------------------
 

The gaps are given as percents from the shape's dimensions. Therefore, the gaps are scaled automatically when the shape is scaled.

The shape and label can switch places when the entries in the legend are drawn. The switch does not affect the sizing of the legend.

The horizontal and vertical label offsets that are marked with an asterisk (*), are added to the left and top sides of the legend.


Field Summary
 int borderPadding
           
 int horizontalLabelOffset
           
 boolean isDrawable
           
 boolean[] isFirstValueNull
           
 boolean isHorizontal
           
 java.util.List[] labelHeights
           
 java.util.List[] labelWidths
           
 float legendBorderWidth
           
 float[] maximumEntryHeight
           
 float[] maximumLabelHeight
           
 float[] maximumLabelWidth
           
 float[] maximumShapeHeight
           
 float[] maximumShapeWidth
           
 java.util.List[] shapeHeights
           
 java.util.List[] shapeWidths
           
 int verticalLabelOffset
           
 int verticalShapeGap
           
 float xPositioning
           
 float yPositioning
           
 
Fields inherited from class com.davisor.graphics.chart.ChartFactory.ChartMetrics
M_height, M_width
 
Constructor Summary
ScaleLegendFactory.ScaleLegendMetrics(float width, float height, int borderPadding, int horizontalLabelOffset, boolean[] isFirstValueNull, boolean isHorizontal, java.util.List[] labelHeights, java.util.List[] labelWidths, float legendBorderWidth, float[] maximumEntryHeight, float[] maximumLabelHeight, float[] maximumLabelWidth, float[] maximumShapeHeight, float[] maximumShapeWidth, java.util.List[] shapeHeights, java.util.List[] shapeWidths, int verticalLabelOffset, int verticalShapeGap, float xPositioning, float yPositioning)
          Creates new scale legend chart metrics.
 
Method Summary
 void scale(float xFactor, float yFactor)
          Scales all metrics components.
 void scale(int dim, float factor)
          Scales the image in given dimension.
 void scaleToSize(java.lang.Number width, java.lang.Number height)
          Scales the image to the given width and height.
 void setHeight(float height)
          Sets height of the chart.
 void setSize(float width, float height)
          Set size of the image.
 void setSize(int dim, float size)
          Set size in the given dim.
 void setWidth(float width)
          Sets width of the chart.
 
Methods inherited from class com.davisor.graphics.chart.ChartFactory.ChartMetrics
add, getHeight, getSize, getWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

borderPadding

public int borderPadding

horizontalLabelOffset

public int horizontalLabelOffset

isDrawable

public boolean isDrawable

isFirstValueNull

public boolean[] isFirstValueNull

isHorizontal

public boolean isHorizontal

labelHeights

public java.util.List[] labelHeights

labelWidths

public java.util.List[] labelWidths

legendBorderWidth

public float legendBorderWidth

maximumEntryHeight

public float[] maximumEntryHeight

maximumLabelHeight

public float[] maximumLabelHeight

maximumLabelWidth

public float[] maximumLabelWidth

maximumShapeHeight

public float[] maximumShapeHeight

maximumShapeWidth

public float[] maximumShapeWidth

shapeHeights

public java.util.List[] shapeHeights

shapeWidths

public java.util.List[] shapeWidths

verticalLabelOffset

public int verticalLabelOffset

verticalShapeGap

public int verticalShapeGap

xPositioning

public float xPositioning

yPositioning

public float yPositioning
Constructor Detail

ScaleLegendFactory.ScaleLegendMetrics

public ScaleLegendFactory.ScaleLegendMetrics(float width,
                                             float height,
                                             int borderPadding,
                                             int horizontalLabelOffset,
                                             boolean[] isFirstValueNull,
                                             boolean isHorizontal,
                                             java.util.List[] labelHeights,
                                             java.util.List[] labelWidths,
                                             float legendBorderWidth,
                                             float[] maximumEntryHeight,
                                             float[] maximumLabelHeight,
                                             float[] maximumLabelWidth,
                                             float[] maximumShapeHeight,
                                             float[] maximumShapeWidth,
                                             java.util.List[] shapeHeights,
                                             java.util.List[] shapeWidths,
                                             int verticalLabelOffset,
                                             int verticalShapeGap,
                                             float xPositioning,
                                             float yPositioning)
Creates new scale legend chart metrics.

Parameters:
width - chart width
height - chart height
borderPadding - padding between entries and borders
horizontalLabelOffset - horizontal offset between entries/series
isFirstValueNull - is the value of the smallest position null
isHorizontal - is the legend positioned in horizontal way
labelHeights - label heights
labelWidths - label widths
legendBorderWidth - legend border width
maximumEntryHeight - maximum height of an entry
maximumLabelHeight - maximum height of a label
maximumLabelWidth - maximum width of a label
maximumShapeHeight - maximum height of a shape
maximumShapeWidth - maximum width of a shape
shapeHeights - shape heights
shapeWidths - shape widths
verticalLabelOffset - vertical offset between entries/series
verticalShapeGap - vertical gap of shape
xPositioning - position of legend edge in X-direction
yPositioning - position of legend edge in Y-direction
Method Detail

scale

public void scale(int dim,
                  float factor)
Scales the image in given dimension. If scaling is impossible to do, then its is possible that the resulting metrics is non drawable.

Overrides:
scale in class ChartFactory.ChartMetrics
Parameters:
dim - to be scaled
factor - of scaling
See Also:
ChartFactory.ChartMetrics.add(int,float)

scaleToSize

public void scaleToSize(java.lang.Number width,
                        java.lang.Number height)
Scales the image to the given width and height. If null size is given, that size is not scaled.

Overrides:
scaleToSize in class ChartFactory.ChartMetrics
Parameters:
width -
height -
See Also:
ChartFactory.ChartMetrics.getSize(int)

scale

public void scale(float xFactor,
                  float yFactor)
Scales all metrics components. If scaling is impossible, end result will become undrawable. All the scaling attemps after this event are in vain.

Overrides:
scale in class ChartFactory.ChartMetrics
Parameters:
xFactor - horizontal scaling factor
yFactor - vertical scaling factor

setWidth

public void setWidth(float width)
Sets width of the chart.

Overrides:
setWidth in class ChartFactory.ChartMetrics
Parameters:
width - strictly positive witdth
See Also:
ChartFactory.ChartMetrics.getWidth()

setHeight

public void setHeight(float height)
Sets height of the chart.

Overrides:
setHeight in class ChartFactory.ChartMetrics
Parameters:
height - strictly positive height
See Also:
ChartFactory.ChartMetrics.getHeight()

setSize

public void setSize(int dim,
                    float size)
Set size in the given dim.

Overrides:
setSize in class ChartFactory.ChartMetrics
Parameters:
dim - X or Y
size - strictly positive
See Also:
ChartFactory.ChartMetrics.getSize(int)

setSize

public void setSize(float width,
                    float height)
Set size of the image. If width or height is negative or zero, the operation is ignored.

Parameters:
width - strictly positive
height - strictly positive


Copyright © 2001-2004 Davisor Oy. All Rights Reserved.