ChartCat 1.2

li.netcat.chart.data
Class StaticScaleModel

java.lang.Object
  extended byli.netcat.chart.data.AbstractChartModelAdapter
      extended byli.netcat.chart.data.StaticScaleModel
All Implemented Interfaces:
ChartModelAdapter, NumericScaleModel, ScaleModel

public class StaticScaleModel
extends AbstractChartModelAdapter
implements NumericScaleModel

Implementation of a NumericScaleModel that uses a linear scale. This scale has an arbitrary number of static marks.

Author:
Arthur Marxer

Constructor Summary
StaticScaleModel(double[] marks)
          Construcs a new instance of a StaticScaleModel with the given marks.
 
Method Summary
 float getLength()
          Returns the length of the scale
 int getMarkCount()
          Returns the number of marks of this scale.
 double[] getMarks()
          Returns a clone of the marks of this scale.
 float getPosition(int markIndex)
          Returns the position of the mark at the given index.
 java.lang.String getText(int markIndex)
          Returns the text of the mark at the given index.
 double getValue(int markIndex)
          Returns the value of the mark at the given index.
 void invalidate()
          Invoked when the underlying model changes.
 boolean isCentered()
          Returns the centered flag.
 void setLength(float length)
          Sets the length of the scale.
 void setMarks(double[] marks)
          Sets the static marks to this scale.
 void setRange(double min, double max, boolean relative)
          Sets the range for this scale.
 float toPosition(double value)
          Calculates the position of an arbitrary value.
 
Methods inherited from class li.netcat.chart.data.AbstractChartModelAdapter
getChartModel, setChartModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface li.netcat.chart.data.ChartModelAdapter
getChartModel, setChartModel
 

Constructor Detail

StaticScaleModel

public StaticScaleModel(double[] marks)
Construcs a new instance of a StaticScaleModel with the given marks.

Parameters:
marks - The marks of the scale. It must be at least 2 elements long and marks[i] < marks[i+1] must be true for all valid i.
Method Detail

setMarks

public void setMarks(double[] marks)
Sets the static marks to this scale.

Parameters:
marks - The marks of the scale. It must be at least 2 elements long and marks[i] < marks[i+1] must be true for all valid i.

getMarks

public double[] getMarks()
Returns a clone of the marks of this scale.

Returns:
A clone of the marks of this scale.

setRange

public void setRange(double min,
                     double max,
                     boolean relative)
Description copied from interface: NumericScaleModel
Sets the range for this scale.

Specified by:
setRange in interface NumericScaleModel
Parameters:
min - The minimum value, it is <= max.
max - The maximum value, it is >= min.
relative - Flag that indicates that the values are in percent. The value 1.0 refers to 100%.

getLength

public float getLength()
Description copied from interface: ScaleModel
Returns the length of the scale

Specified by:
getLength in interface ScaleModel
Returns:
The length of the scale. This value is always > 0.0f.

setLength

public void setLength(float length)
Description copied from interface: ScaleModel
Sets the length of the scale.

Specified by:
setLength in interface ScaleModel
Parameters:
length - The length of the scale, must be > 0.0f.

getMarkCount

public int getMarkCount()
Description copied from interface: ScaleModel
Returns the number of marks of this scale.

Specified by:
getMarkCount in interface ScaleModel
Returns:
The number of marks.

getPosition

public float getPosition(int markIndex)
Description copied from interface: ScaleModel
Returns the position of the mark at the given index.

Specified by:
getPosition in interface ScaleModel
Parameters:
markIndex - The index of the mark. It must be >= 0 and < getMarkCount().

getValue

public double getValue(int markIndex)
Description copied from interface: ScaleModel
Returns the value of the mark at the given index.

Specified by:
getValue in interface ScaleModel
Parameters:
markIndex - The index of the mark. It must be >= 0 and < getMarkCount().

getText

public java.lang.String getText(int markIndex)
Description copied from interface: ScaleModel
Returns the text of the mark at the given index.

Specified by:
getText in interface ScaleModel
Parameters:
markIndex - The index of the mark. It must be >= 0 and < getMarkCount().

toPosition

public float toPosition(double value)
Description copied from interface: ScaleModel
Calculates the position of an arbitrary value.

Specified by:
toPosition in interface ScaleModel
Parameters:
value - An arbitrary value.
Returns:
The position of the value in this scale.

isCentered

public boolean isCentered()
Description copied from interface: ScaleModel
Returns the centered flag.

Specified by:
isCentered in interface ScaleModel
Returns:
The centered flag.

invalidate

public void invalidate()
Description copied from class: AbstractChartModelAdapter
Invoked when the underlying model changes. Subclasses may override this method and discard all buffered data.

Overrides:
invalidate in class AbstractChartModelAdapter

ChartCat 1.2

Copyright © 2003 - 2005 NetCat Inc.. All rights reserved. Feedback

Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print, Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print, Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print