fr.esrf.tangoatk.widget.util.chart
Class JLDataView

java.lang.Object
  extended by fr.esrf.tangoatk.widget.util.chart.JLDataView
All Implemented Interfaces:
java.io.Serializable

public class JLDataView
extends java.lang.Object
implements java.io.Serializable

A class to handle data view. It handles data and all graphics stuff related to a serie of data.

See Also:
Serialized Form

Field Summary
static int FILL_STYLE_DOT_PATTERN_1
          Hatch fill style
static int FILL_STYLE_DOT_PATTERN_2
          Hatch fill style
static int FILL_STYLE_DOT_PATTERN_3
          Hatch fill style
static int FILL_STYLE_LARGE_CROSS_HATCH
          Hatch fill style
static int FILL_STYLE_LARGE_LEFT_HATCH
          Hatch fill style
static int FILL_STYLE_LARGE_RIGHT_HATCH
          Hatch fill style
static int FILL_STYLE_NONE
          No filling
static int FILL_STYLE_SMALL_CROSS_HATCH
          Hatch fill style
static int FILL_STYLE_SMALL_LEFT_HATCH
          Hatch fill style
static int FILL_STYLE_SMALL_RIGHT_HATCH
          Hatch fill style
static int FILL_STYLE_SOLID
          Solid fill style
static int INTERPOLATE_COSINE
          Cosine interpolation method
static int INTERPOLATE_CUBIC
           
static int INTERPOLATE_HERMITE
           
static int INTERPOLATE_LINEAR
          Linear interpolation method
static int INTERPOLATE_NONE
          No interpolation
static int MARKER_BOX
          Display a box for each point of the view
static int MARKER_CIRCLE
          Display a circle for each point of the view
static int MARKER_CROSS
          Display a cross for each point of the view
static int MARKER_DIAMOND
          Display a diamond for each point of the view
static int MARKER_DOT
          Display a dot for each point of the view
static int MARKER_HORIZ_LINE
          Display an horizontal line for each point of the view
static int MARKER_NONE
          No marker displayed
static int MARKER_SQUARE
          Display a square for each point of the view
static int MARKER_STAR
          Display a start for each point of the view
static int MARKER_TRIANGLE
          Display a triangle for each point of the view
static int MARKER_VERT_LINE
          Display a vertical line for each point of the view
static int MATH_DERIVATIVE
          Derivative operation
static int MATH_FFT_MODULUS
          FFT (modulus) operation
static int MATH_FFT_PHASE
          FFT (phase) operation
static int MATH_INTEGRAL
          Integral operation
static int MATH_NONE
          No mathematical operation
static int METHOD_FILL_FROM_BOTTOM
          Fill curve and bar from the bottom of the graph
static int METHOD_FILL_FROM_TOP
          Fill curve and bar from the top of the graph
static int METHOD_FILL_FROM_ZERO
          Fill curve and bar from zero position (on Yaxis)
static double NAN_FOR_NEGATIVE_INFINITY
          NaN value used with y to represent a negative infinity value
static double NAN_FOR_NULL
          NaN value used with y to represent a null value
static double NAN_FOR_POSITIVE_INFINITY
          NaN value used with y to represent a positive infinity value
static int SMOOTH_EXT_FLAT
          flat smoothing extrapolation (duplicate last and end value)
static int SMOOTH_EXT_LINEAR
          Linear smoothing extrapolation (linear extrapolation)
static int SMOOTH_EXT_NONE
          No smoothing extrapolation
static int SMOOTH_FLAT
          Flat smoothing (Flat shape)
static int SMOOTH_GAUSSIAN
          Gaussian smoothing (Gaussian shape)
static int SMOOTH_NONE
          No smoothing
static int SMOOTH_TRIANGULAR
          Linear smoothing (Triangular shape)
static int STYLE_DASH
          Dash line style
static int STYLE_DASH_DOT
          Dash + Dot line style
static int STYLE_DOT
          Dot line style
static int STYLE_LONG_DASH
          Long Dash line style
static int STYLE_SOLID
          Solid line style
static int TYPE_BAR
          BarGraph style
static int TYPE_LINE
          Line style
protected  boolean xDataSorted
           
 
Constructor Summary
JLDataView()
          DataView constructor.
 
Method Summary
 void add(double x, double y)
          Add datum to the dataview.
 void add(double x, double y, boolean updateFilter)
          Add datum to the dataview.
 void add(java.awt.geom.Point2D.Double p)
          Add datum to the dataview.
 void applyConfiguration(java.lang.String prefix, CfFileReader f)
          Apply dataview configuration.
 void commitChange()
          Commit change when some data has been in modified in the DataList (via getData())
 void computeDataBounds()
          Computes and stores min and max on x and y
 double computePositiveMin()
          Compute minimun of positive value.
 double[] computeTransformedMinMax()
          Expert usage.
 java.lang.String formatValue(double v)
          Format the given value according the userFormat or to the Axis format.
 void garbagePointLimit(int garbageLimit)
          Garbage old data according to data length.
 int garbagePointTime(double garbageLimit)
          Garbage old data according to time.
 double getA0()
          Gets the A0 transformation coeficient.
 double getA1()
          Gets the A1 transformation coeficient.
 double getA2()
          Gets the A2 transformation coeficient.
 JLAxis getAxis()
          Expert usage.
 int getBarWidth()
          Gets the bar width.
 java.awt.Color getColor()
          Gets the curve color.
 java.lang.String getConfiguration(java.lang.String prefix)
          Build a configuration string that can be write into a file and is compatible with CfFileReader.
 DataList getData()
          Return a handle on the data.
 int getDataLength()
          Gets the number of data in this view.
 double[][] getDataSortedByTimes()
           
 double[][] getDataSortedByValues()
           
 java.lang.String getExtendedName()
          Gets the extended name.
 java.awt.Color getFillColor()
          Gets the filling color.
 int getFillMethod()
          Gets the current filling style.
 int getFillStyle()
          Gets the current filling style.
static java.lang.String getHelpString()
          Returns a string containing the configuration file help.
 double getHermiteBias()
          Set the Hermite interpolation bias coefficient.
 double getHermiteTension()
          Get the Hermite interpolation tension coefficient
 int getInterpolationMethod()
          Return current interpolation mode.
 int getInterpolationStep()
          Returns the interpolation step.
 java.awt.Color getLabelColor()
           
 DataList getLastValue()
          Get last value.
 int getLineWidth()
          Gets the line width.
 int getMarker()
          Gets the marker type.
 java.awt.Color getMarkerColor()
          Gets the marker color.
 int getMarkerSize()
          Gets the marker size.
 int getMathFunction()
          Returns the current math function.
 double getMaximum()
          Expert usage.
 double getMaxTime()
          Expert usage.
 double getMaxXValue()
          Expert usage.
 double getMinimum()
          Expert usage.
 double getMinTime()
          Expert usage.
 double getMinXValue()
          Expert usage.
 java.lang.String getName()
          Gets the view name.
 double getPositiveMinTime()
          Expert usage.
 double getPositiveMinXValue()
          Expert usage.
 int getSmoothingExtrapolation()
          Returns the extrapolation method used in smoothing operation.
 double getSmoothingGaussSigma()
          Return the standard deviation of the gaussian (Smoothing filter).
 int getSmoothingMethod()
          Return the smoothing method.
 int getSmoothingNeighbors()
          Sets number of neighbors for smoothing
 double[] getSortedTimes()
           
 double[] getSortedValues()
           
 int getStyle()
          Gets the line style.
 double getTransformedValue(double x)
          Compute transformed value of x.
 java.lang.String getUnit()
          Gets the dataView unit.
 java.lang.String getUserFormat()
          Returns the current user format (null when none).
 int getViewType()
          Gets view type.
 double getXValueByIndex(int idx)
          Returns X value according to index.
 double getYValueByIndex(int idx)
          Returns Y value according to index.
 boolean hasFilter()
          Determines wether this view is affected by a transform.
 boolean hasTransform()
          Determines wether this views has a transformation.
 boolean isClickable()
          Returns the clickable state.
 boolean isFill()
          Provided for backward compatibility.
 boolean isLabelVisible()
          Returns true when the label is visible.
 boolean isValidFormat(java.lang.String format)
          Tests whether a given format is valid or not
 boolean isXDataSorted()
          Returns whether data is supposed to be sorted on x or not
static void mergeSort(double[] array, double[] associated)
          Applies merge sort on an array of double.
 void reset()
          Clear all data in this view.
 void setA0(double d)
          Set A0 transformation coeficient.
 void setA1(double d)
          Set A1 transformation coeficient.
 void setA2(double d)
          Set A2 transformation coeficient.
 void setAxis(JLAxis a)
          Expert usage.
 void setBarWidth(int w)
          Sets the width of the bar in pixel (Bar graph mode).
 void setClickable(boolean b)
          Sets this view clickable or not.
 void setColor(java.awt.Color c)
          Sets the color of the curve.
 void setData(double[] x, double[] y)
          Set data of this dataview.
 void setFill(boolean b)
          Provided for backward compatibility.
 void setFillColor(java.awt.Color c)
          Sets the filling color of this dataView.
 void setFillMethod(int m)
          Sets the filling method for this view.
 void setFillStyle(int b)
          Sets the filling style of this view.
 void setHermiteBias(double bias)
          Set the Hermite interpolation bias coefficient.
 void setHermiteTension(double tension)
          Set the Hermite interpolation tension coefficient
 void setInterpolationMethod(int method)
          Set an interpolation on this dataview using the specified method.
 void setInterpolationStep(int step)
          Sets the interpolation step
 void setLabelColor(java.awt.Color labelColor)
           
 void setLabelVisible(boolean b)
          Display the label of this view when true.
 void setLineWidth(int c)
          Sets the line width (pixel).
 void setMarker(int m)
          Sets the marker type.
 void setMarkerColor(java.awt.Color c)
          Sets the marker color.
 void setMarkerSize(int c)
          Sets the marker size (pixel).
 void setMathFunction(int function)
          Sets a mathematical function
 void setName(java.lang.String s)
          Sets the view name.
 void setSmoothingExtrapolation(int extMode)
          Sets the extrapolation method used in smoothing operation
 void setSmoothingGaussSigma(double sigma)
          Sets the standard deviation of the gaussian (Smoothing filter).
 void setSmoothingMethod(int method)
          Sets the smoothing method (Convolution product).
 void setSmoothingNeighbors(int n)
          Sets number of neighbors for smoothing
 void setStyle(int c)
          Set the plot line style.
 void setUnit(java.lang.String s)
          Set the dataView unit.
 void setUnorderedData(double[] x, double[] y)
          Set data of this dataview and order value according to the x value
 void setUserFormat(java.lang.String format)
          Sets the format property for this dataview (C format).
 void setViewType(int s)
          Sets the graph type (Line or BarGraph).
 void setXDataSorted(boolean dataSorted)
          Set whether data is supposed to be sorted on x or not.
 void updateFilters()
          Update filter calulation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MARKER_NONE

public static final int MARKER_NONE
No marker displayed

See Also:
Constant Field Values

MARKER_DOT

public static final int MARKER_DOT
Display a dot for each point of the view

See Also:
Constant Field Values

MARKER_BOX

public static final int MARKER_BOX
Display a box for each point of the view

See Also:
Constant Field Values

MARKER_TRIANGLE

public static final int MARKER_TRIANGLE
Display a triangle for each point of the view

See Also:
Constant Field Values

MARKER_DIAMOND

public static final int MARKER_DIAMOND
Display a diamond for each point of the view

See Also:
Constant Field Values

MARKER_STAR

public static final int MARKER_STAR
Display a start for each point of the view

See Also:
Constant Field Values

MARKER_VERT_LINE

public static final int MARKER_VERT_LINE
Display a vertical line for each point of the view

See Also:
Constant Field Values

MARKER_HORIZ_LINE

public static final int MARKER_HORIZ_LINE
Display an horizontal line for each point of the view

See Also:
Constant Field Values

MARKER_CROSS

public static final int MARKER_CROSS
Display a cross for each point of the view

See Also:
Constant Field Values

MARKER_CIRCLE

public static final int MARKER_CIRCLE
Display a circle for each point of the view

See Also:
Constant Field Values

MARKER_SQUARE

public static final int MARKER_SQUARE
Display a square for each point of the view

See Also:
Constant Field Values

STYLE_SOLID

public static final int STYLE_SOLID
Solid line style

See Also:
Constant Field Values

STYLE_DOT

public static final int STYLE_DOT
Dot line style

See Also:
Constant Field Values

STYLE_DASH

public static final int STYLE_DASH
Dash line style

See Also:
Constant Field Values

STYLE_LONG_DASH

public static final int STYLE_LONG_DASH
Long Dash line style

See Also:
Constant Field Values

STYLE_DASH_DOT

public static final int STYLE_DASH_DOT
Dash + Dot line style

See Also:
Constant Field Values

TYPE_LINE

public static final int TYPE_LINE
Line style

See Also:
Constant Field Values

TYPE_BAR

public static final int TYPE_BAR
BarGraph style

See Also:
Constant Field Values

METHOD_FILL_FROM_TOP

public static final int METHOD_FILL_FROM_TOP
Fill curve and bar from the top of the graph

See Also:
Constant Field Values

METHOD_FILL_FROM_ZERO

public static final int METHOD_FILL_FROM_ZERO
Fill curve and bar from zero position (on Yaxis)

See Also:
Constant Field Values

METHOD_FILL_FROM_BOTTOM

public static final int METHOD_FILL_FROM_BOTTOM
Fill curve and bar from the bottom of the graph

See Also:
Constant Field Values

FILL_STYLE_NONE

public static final int FILL_STYLE_NONE
No filling

See Also:
Constant Field Values

FILL_STYLE_SOLID

public static final int FILL_STYLE_SOLID
Solid fill style

See Also:
Constant Field Values

FILL_STYLE_LARGE_RIGHT_HATCH

public static final int FILL_STYLE_LARGE_RIGHT_HATCH
Hatch fill style

See Also:
Constant Field Values

FILL_STYLE_LARGE_LEFT_HATCH

public static final int FILL_STYLE_LARGE_LEFT_HATCH
Hatch fill style

See Also:
Constant Field Values

FILL_STYLE_LARGE_CROSS_HATCH

public static final int FILL_STYLE_LARGE_CROSS_HATCH
Hatch fill style

See Also:
Constant Field Values

FILL_STYLE_SMALL_RIGHT_HATCH

public static final int FILL_STYLE_SMALL_RIGHT_HATCH
Hatch fill style

See Also:
Constant Field Values

FILL_STYLE_SMALL_LEFT_HATCH

public static final int FILL_STYLE_SMALL_LEFT_HATCH
Hatch fill style

See Also:
Constant Field Values

FILL_STYLE_SMALL_CROSS_HATCH

public static final int FILL_STYLE_SMALL_CROSS_HATCH
Hatch fill style

See Also:
Constant Field Values

FILL_STYLE_DOT_PATTERN_1

public static final int FILL_STYLE_DOT_PATTERN_1
Hatch fill style

See Also:
Constant Field Values

FILL_STYLE_DOT_PATTERN_2

public static final int FILL_STYLE_DOT_PATTERN_2
Hatch fill style

See Also:
Constant Field Values

FILL_STYLE_DOT_PATTERN_3

public static final int FILL_STYLE_DOT_PATTERN_3
Hatch fill style

See Also:
Constant Field Values

NAN_FOR_NULL

public static final double NAN_FOR_NULL
NaN value used with y to represent a null value


NAN_FOR_POSITIVE_INFINITY

public static final double NAN_FOR_POSITIVE_INFINITY
NaN value used with y to represent a positive infinity value


NAN_FOR_NEGATIVE_INFINITY

public static final double NAN_FOR_NEGATIVE_INFINITY
NaN value used with y to represent a negative infinity value


INTERPOLATE_NONE

public static final int INTERPOLATE_NONE
No interpolation

See Also:
Constant Field Values

INTERPOLATE_LINEAR

public static final int INTERPOLATE_LINEAR
Linear interpolation method

See Also:
Constant Field Values

INTERPOLATE_COSINE

public static final int INTERPOLATE_COSINE
Cosine interpolation method

See Also:
Constant Field Values

INTERPOLATE_CUBIC

public static final int INTERPOLATE_CUBIC
See Also:
Constant Field Values

INTERPOLATE_HERMITE

public static final int INTERPOLATE_HERMITE
See Also:
Constant Field Values

SMOOTH_NONE

public static final int SMOOTH_NONE
No smoothing

See Also:
Constant Field Values

SMOOTH_FLAT

public static final int SMOOTH_FLAT
Flat smoothing (Flat shape)

See Also:
Constant Field Values

SMOOTH_TRIANGULAR

public static final int SMOOTH_TRIANGULAR
Linear smoothing (Triangular shape)

See Also:
Constant Field Values

SMOOTH_GAUSSIAN

public static final int SMOOTH_GAUSSIAN
Gaussian smoothing (Gaussian shape)

See Also:
Constant Field Values

SMOOTH_EXT_NONE

public static final int SMOOTH_EXT_NONE
No smoothing extrapolation

See Also:
Constant Field Values

SMOOTH_EXT_FLAT

public static final int SMOOTH_EXT_FLAT
flat smoothing extrapolation (duplicate last and end value)

See Also:
Constant Field Values

SMOOTH_EXT_LINEAR

public static final int SMOOTH_EXT_LINEAR
Linear smoothing extrapolation (linear extrapolation)

See Also:
Constant Field Values

MATH_NONE

public static final int MATH_NONE
No mathematical operation

See Also:
Constant Field Values

MATH_DERIVATIVE

public static final int MATH_DERIVATIVE
Derivative operation

See Also:
Constant Field Values

MATH_INTEGRAL

public static final int MATH_INTEGRAL
Integral operation

See Also:
Constant Field Values

MATH_FFT_MODULUS

public static final int MATH_FFT_MODULUS
FFT (modulus) operation

See Also:
Constant Field Values

MATH_FFT_PHASE

public static final int MATH_FFT_PHASE
FFT (phase) operation

See Also:
Constant Field Values

xDataSorted

protected boolean xDataSorted
Constructor Detail

JLDataView

public JLDataView()
DataView constructor.

Method Detail

getHelpString

public static java.lang.String getHelpString()
Returns a string containing the configuration file help.


setViewType

public void setViewType(int s)
Sets the graph type (Line or BarGraph).

Parameters:
s - Type of graph
See Also:
TYPE_LINE, TYPE_BAR

getViewType

public int getViewType()
Gets view type.

Returns:
View type
See Also:
setViewType(int)

setFillStyle

public void setFillStyle(int b)
Sets the filling style of this view.

Parameters:
b - Filling style
See Also:
FILL_STYLE_NONE, FILL_STYLE_SOLID, FILL_STYLE_LARGE_RIGHT_HATCH, FILL_STYLE_LARGE_LEFT_HATCH, FILL_STYLE_LARGE_CROSS_HATCH, FILL_STYLE_SMALL_RIGHT_HATCH, FILL_STYLE_SMALL_LEFT_HATCH, FILL_STYLE_SMALL_CROSS_HATCH, FILL_STYLE_DOT_PATTERN_1, FILL_STYLE_DOT_PATTERN_2, FILL_STYLE_DOT_PATTERN_3

getFillStyle

public int getFillStyle()
Gets the current filling style.

Returns:
Filling style
See Also:
setFillStyle(int)

setFillMethod

public void setFillMethod(int m)
Sets the filling method for this view.

Parameters:
m - Filling method
See Also:
METHOD_FILL_FROM_TOP, METHOD_FILL_FROM_ZERO, METHOD_FILL_FROM_BOTTOM

getFillMethod

public int getFillMethod()
Gets the current filling style.

Returns:
Filling method
See Also:
setFillMethod(int)

setFillColor

public void setFillColor(java.awt.Color c)
Sets the filling color of this dataView.

Parameters:
c - Filling color
See Also:
getFillColor()

getFillColor

public java.awt.Color getFillColor()
Gets the filling color.

Returns:
Filling color
See Also:
setFillColor(java.awt.Color)

setColor

public void setColor(java.awt.Color c)
Sets the color of the curve.

Parameters:
c - Curve color
See Also:
getColor()

getColor

public java.awt.Color getColor()
Gets the curve color.

Returns:
Curve color
See Also:
setColor(java.awt.Color)

isFill

public boolean isFill()
Provided for backward compatibility.

Returns:
true if the view is filled, false otherwise
See Also:
setFillStyle(int)

setFill

public void setFill(boolean b)
Provided for backward compatibility.

Parameters:
b - true if the view is filled, false otherwise
See Also:
setFillStyle(int)

setClickable

public void setClickable(boolean b)
Sets this view clickable or not. When set to false, this view is excluded from the search that occurs when the user click on the chart. Default is true.

Parameters:
b - Clickable state

isClickable

public boolean isClickable()
Returns the clickable state.

See Also:
setClickable(boolean)

setLabelVisible

public void setLabelVisible(boolean b)
Display the label of this view when true. This has effects only if the parent chart has visible labels.

Parameters:
b - visible state
See Also:
JLChart.setLabelVisible(boolean)

isLabelVisible

public boolean isLabelVisible()
Returns true when the label is visible.

See Also:
setLabelVisible(boolean)

getLabelColor

public java.awt.Color getLabelColor()

setLabelColor

public void setLabelColor(java.awt.Color labelColor)

setInterpolationMethod

public void setInterpolationMethod(int method)
Set an interpolation on this dataview using the specified method. (Cubic interpolation requires constant x interval)

Parameters:
method - Interpolation method
See Also:
INTERPOLATE_NONE, INTERPOLATE_LINEAR, INTERPOLATE_COSINE, INTERPOLATE_CUBIC, INTERPOLATE_HERMITE

getInterpolationMethod

public int getInterpolationMethod()
Return current interpolation mode.

See Also:
setInterpolationMethod(int)

setInterpolationStep

public void setInterpolationStep(int step)
Sets the interpolation step

Parameters:
step - Interpolation step (must be >=2)
See Also:
setInterpolationMethod(int)

getInterpolationStep

public int getInterpolationStep()
Returns the interpolation step.

See Also:
setInterpolationStep(int)

setHermiteTension

public void setHermiteTension(double tension)
Set the Hermite interpolation tension coefficient

Parameters:
tension - Hermite interpolation tension coefficient (1=>high, 0=>normal, -1=>low)

getHermiteTension

public double getHermiteTension()
Get the Hermite interpolation tension coefficient

See Also:
setHermiteTension(double)

setHermiteBias

public void setHermiteBias(double bias)
Set the Hermite interpolation bias coefficient. 0 for no bias, positive value towards first segment, negative value towards the others.

Parameters:
bias - Hermite interpolation bias coefficient

getHermiteBias

public double getHermiteBias()
Set the Hermite interpolation bias coefficient.


setSmoothingMethod

public void setSmoothingMethod(int method)
Sets the smoothing method (Convolution product). Requires constant x intervals.

Parameters:
method - Smoothing filer type
See Also:
SMOOTH_NONE, SMOOTH_FLAT, SMOOTH_TRIANGULAR, SMOOTH_GAUSSIAN

getSmoothingMethod

public int getSmoothingMethod()
Return the smoothing method.

See Also:
setSmoothingMethod(int)

setSmoothingNeighbors

public void setSmoothingNeighbors(int n)
Sets number of neighbors for smoothing

Parameters:
n - Number of neighbors (Must be >=2)

getSmoothingNeighbors

public int getSmoothingNeighbors()
Sets number of neighbors for smoothing

See Also:
setSmoothingNeighbors(int)

setSmoothingGaussSigma

public void setSmoothingGaussSigma(double sigma)
Sets the standard deviation of the gaussian (Smoothing filter).

Parameters:
sigma - Standard deviation
See Also:
setSmoothingMethod(int)

getSmoothingGaussSigma

public double getSmoothingGaussSigma()
Return the standard deviation of the gaussian (Smoothing filter).

See Also:
setSmoothingMethod(int)

setSmoothingExtrapolation

public void setSmoothingExtrapolation(int extMode)
Sets the extrapolation method used in smoothing operation

Parameters:
extMode - Extrapolation mode
See Also:
SMOOTH_EXT_NONE, SMOOTH_EXT_FLAT, SMOOTH_EXT_LINEAR

getSmoothingExtrapolation

public int getSmoothingExtrapolation()
Returns the extrapolation method used in smoothing operation.

See Also:
setSmoothingExtrapolation(int)

setMathFunction

public void setMathFunction(int function)
Sets a mathematical function

Parameters:
function - Function
See Also:
MATH_NONE, MATH_DERIVATIVE, MATH_INTEGRAL, MATH_FFT_MODULUS, MATH_FFT_PHASE

getMathFunction

public int getMathFunction()
Returns the current math function.

See Also:
setMathFunction(int)

setBarWidth

public void setBarWidth(int w)
Sets the width of the bar in pixel (Bar graph mode). Pass 0 to have bar auto scaling.

Parameters:
w - Bar width (pixel)
See Also:
getBarWidth()

getBarWidth

public int getBarWidth()
Gets the bar width.

Returns:
Bar width (pixel)
See Also:
setBarWidth(int)

setMarkerColor

public void setMarkerColor(java.awt.Color c)
Sets the marker color.

Parameters:
c - Marker color
See Also:
getMarkerColor()

getMarkerColor

public java.awt.Color getMarkerColor()
Gets the marker color.

Returns:
Marker color
See Also:
setMarkerColor(java.awt.Color)

setStyle

public void setStyle(int c)
Set the plot line style.

Parameters:
c - Line style
See Also:
STYLE_SOLID, STYLE_DOT, STYLE_DASH, STYLE_LONG_DASH, STYLE_DASH_DOT, getStyle()

getMarkerSize

public int getMarkerSize()
Gets the marker size.

Returns:
Marker size (pixel)
See Also:
setMarkerSize(int)

setMarkerSize

public void setMarkerSize(int c)
Sets the marker size (pixel).

Parameters:
c - Marker size (pixel)
See Also:
getMarkerSize()

getStyle

public int getStyle()
Gets the line style.

Returns:
Line style
See Also:
setStyle(int)

getLineWidth

public int getLineWidth()
Gets the line width.

Returns:
Line width
See Also:
setLineWidth(int)

setLineWidth

public void setLineWidth(int c)
Sets the line width (pixel).

Parameters:
c - Line width (pixel)
See Also:
getLineWidth()

setName

public void setName(java.lang.String s)
Sets the view name.

Parameters:
s - Name of this view
See Also:
getName()

getName

public java.lang.String getName()
Gets the view name.

Returns:
Dataview name
See Also:
setName(java.lang.String)

setUnit

public void setUnit(java.lang.String s)
Set the dataView unit. (Used only for display)

Parameters:
s - Dataview unit.
See Also:
getUnit()

getUnit

public java.lang.String getUnit()
Gets the dataView unit.

Returns:
Dataview unit
See Also:
setUnit(java.lang.String)

getExtendedName

public java.lang.String getExtendedName()
Gets the extended name. (including transform description when used)

Returns:
Extended name of this view.

getMarker

public int getMarker()
Gets the marker type.

Returns:
Marker type
See Also:
setMarker(int)

setMarker

public void setMarker(int m)
Sets the marker type.

Parameters:
m - Marker type
See Also:
MARKER_NONE, MARKER_DOT, MARKER_BOX, MARKER_TRIANGLE, MARKER_DIAMOND, MARKER_STAR, MARKER_VERT_LINE, MARKER_HORIZ_LINE, MARKER_CROSS, MARKER_CIRCLE, MARKER_SQUARE

getA0

public double getA0()
Gets the A0 transformation coeficient.

Returns:
A0 value
See Also:
setA0(double)

getA1

public double getA1()
Gets the A1 transformation coeficient.

Returns:
A1 value
See Also:
setA1(double)

getA2

public double getA2()
Gets the A2 transformation coeficient.

Returns:
A2 value
See Also:
setA2(double)

setA0

public void setA0(double d)
Set A0 transformation coeficient. The transformation computes new value = A0 + A1*v + A2*v*v. Transformation is disabled when A0=A2=0 and A1=1.

Parameters:
d - A0 value

setA1

public void setA1(double d)
Set A1 transformation coeficient. The transformation computes new value = A0 + A1*v + A2*v*v. Transformation is disabled when A0=A2=0 and A1=1.

Parameters:
d - A1 value

setA2

public void setA2(double d)
Set A2 transformation coeficient. The transformation computes new value = A0 + A1*v + A2*v*v. Transformation is disabled when A0=A2=0 and A1=1.

Parameters:
d - A2 value

hasTransform

public boolean hasTransform()
Determines wether this views has a transformation.

Returns:
false when A0=A2=0 and A1=1, true otherwise

hasFilter

public boolean hasFilter()
Determines wether this view is affected by a transform.

Returns:
false when no filtering true otherwise.
See Also:
setInterpolationMethod(int), setSmoothingMethod(int), setMathFunction(int)

setAxis

public void setAxis(JLAxis a)
Expert usage. Sets the parent axis. ( Used by JLAxis.addDataView() )

Parameters:
a - Parent axis

getAxis

public JLAxis getAxis()
Expert usage. Gets the parent axis.

Returns:
Parent axis

getMinimum

public double getMinimum()
Expert usage. Gets the minimum (Y axis).

Returns:
Minimum value

getMaximum

public double getMaximum()
Expert usage. Gets the maximum (Y axis).

Returns:
Maximun value

getMinTime

public double getMinTime()
Expert usage. Gets the minimun on X axis (with TIME_ANNO).

Returns:
Minimum time

getMinXValue

public double getMinXValue()
Expert usage. Gets the minimum on X axis.

Returns:
Minimum x value

getPositiveMinXValue

public double getPositiveMinXValue()
Expert usage. Get the positive minimum on X axis.

Returns:
Minimum value strictly positive

getPositiveMinTime

public double getPositiveMinTime()
Expert usage. Get the positive minimum on X axis.

Returns:
Minimum value strictly positive

getMaxXValue

public double getMaxXValue()
Expert usage. Get the maximum on X axis

Returns:
Maximum x value

getMaxTime

public double getMaxTime()
Expert usage. Get the maxinmun on X axis (with TIME_ANNO)

Returns:
Maximum value

getDataLength

public int getDataLength()
Gets the number of data in this view.

Returns:
Data length

getData

public DataList getData()
Return a handle on the data. If you modify data, call commitChange() after the update. Expert usage.

Returns:
A handle to the data.
See Also:
commitChange()

commitChange

public void commitChange()
Commit change when some data has been in modified in the DataList (via getData())

See Also:
getData()

add

public void add(double x,
                double y)
Add datum to the dataview. If you call this routine directly the graph will be updated only after a repaint and your data won't be garbaged (if a display duration is specified). You should use JLChart.addData instead.

Parameters:
x - x coordinates (real space)
y - y coordinates (real space)
See Also:
JLChart.addData(fr.esrf.tangoatk.widget.util.chart.JLDataView, double, double), JLChart.setDisplayDuration(double)

add

public void add(double x,
                double y,
                boolean updateFilter)
Add datum to the dataview. If you call this routine directly the graph will be updated only after a repaint and your data won't be garbaged (if a display duration is specified). You should use JLChart.addData instead.

Parameters:
x - x coordinates (real space)
y - y coordinates (real space)
updateFilter - update filter flag.
See Also:
JLChart.addData(fr.esrf.tangoatk.widget.util.chart.JLDataView, double, double), JLChart.setDisplayDuration(double)

setData

public void setData(double[] x,
                    double[] y)
Set data of this dataview.

Parameters:
x - x values
y - y values
See Also:
add(double, double)

setUnorderedData

public void setUnorderedData(double[] x,
                             double[] y)
Set data of this dataview and order value according to the x value

Parameters:
x - x values
y - y values
See Also:
add(double, double)

add

public void add(java.awt.geom.Point2D.Double p)
Add datum to the dataview. If you call this routine directly the graph will be updated only after a repaint and your data won't be garbaged (if a display duration is specified). You should use JLChart.addData instead.

Parameters:
p - point (real space)
See Also:
JLChart.addData(fr.esrf.tangoatk.widget.util.chart.JLDataView, double, double), JLChart.setDisplayDuration(double)

garbagePointTime

public int garbagePointTime(double garbageLimit)
Garbage old data according to time.

Parameters:
garbageLimit - Limit time (in millisec)
Returns:
Number of deleted point.

garbagePointLimit

public void garbagePointLimit(int garbageLimit)
Garbage old data according to data length. It will remove the (dataLength-garbageLimit) first points.

Parameters:
garbageLimit - Index limit

computeDataBounds

public void computeDataBounds()
Computes and stores min and max on x and y


computeTransformedMinMax

public double[] computeTransformedMinMax()
Expert usage. Compute transformed min and max.

Returns:
Transformed min and max

computePositiveMin

public double computePositiveMin()
Compute minimun of positive value.

Returns:
Double.MAX_VALUE when no positive value are found

getTransformedValue

public double getTransformedValue(double x)
Compute transformed value of x.

Parameters:
x - Value to transform
Returns:
transformed value (through A0,A1,A2 transformation)

getLastValue

public DataList getLastValue()
Get last value.

Returns:
Last value

reset

public void reset()
Clear all data in this view.


applyConfiguration

public void applyConfiguration(java.lang.String prefix,
                               CfFileReader f)
Apply dataview configuration.

Parameters:
prefix - settings prefix
f - CfFileReader object wich contains dataview parametters
See Also:
JLChart.applyConfiguration(fr.esrf.tangoatk.widget.util.chart.CfFileReader), JLAxis.applyConfiguration(java.lang.String, fr.esrf.tangoatk.widget.util.chart.CfFileReader)

getConfiguration

public java.lang.String getConfiguration(java.lang.String prefix)
Build a configuration string that can be write into a file and is compatible with CfFileReader.

Parameters:
prefix - DataView prefix
Returns:
A string containing param.
See Also:
applyConfiguration(java.lang.String, fr.esrf.tangoatk.widget.util.chart.CfFileReader)

getYValueByIndex

public double getYValueByIndex(int idx)
Returns Y value according to index.

Parameters:
idx - Value index
Returns:
Y value

getXValueByIndex

public double getXValueByIndex(int idx)
Returns X value according to index.

Parameters:
idx - Value index
Returns:
X value

setUserFormat

public void setUserFormat(java.lang.String format)
Sets the format property for this dataview (C format). By default, it uses the Axis format.

Parameters:
format - Format (C style)

isValidFormat

public boolean isValidFormat(java.lang.String format)
Tests whether a given format is valid or not

Parameters:
format - the format to tests
Returns:
a boolean value : true if the format is valid, false otherwise.

getUserFormat

public java.lang.String getUserFormat()
Returns the current user format (null when none).


formatValue

public java.lang.String formatValue(double v)
Format the given value according the userFormat or to the Axis format.

Parameters:
v - Value to be formated

isXDataSorted

public boolean isXDataSorted()
Returns whether data is supposed to be sorted on x or not

Returns:
a boolean value

setXDataSorted

public void setXDataSorted(boolean dataSorted)
Set whether data is supposed to be sorted on x or not. false by default

Parameters:
dataSorted - a boolean value

getSortedTimes

public double[] getSortedTimes()

getSortedValues

public double[] getSortedValues()

getDataSortedByTimes

public double[][] getDataSortedByTimes()

getDataSortedByValues

public double[][] getDataSortedByValues()

mergeSort

public static void mergeSort(double[] array,
                             double[] associated)
Applies merge sort on an array of double. If an associated array is given, its elements are moved the same way as the array to sort.

Parameters:
array - The array to sort
associated - The associated array. Must be null or of the same length of array

updateFilters

public void updateFilters()
Update filter calulation. Call this function if you're using the add(x,y,false) mehtod.