public class JLDataView
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
JLDataView()
DataView constructor.
|
Modifier and Type | Method and Description |
---|---|
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 |
addChangeListener(javax.swing.event.ChangeListener l)
Add a listener to this dataview, triggered when a setting change.
|
void |
applyConfiguration(java.lang.String prefix,
CfFileReader f)
Apply dataview configuration.
|
void |
clearChangeListener() |
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.
|
java.awt.Color |
getBarFillColorAt(int idx)
Return the fill color for the specified index
|
java.util.Vector<ColorItem> |
getBarFillColors()
Gets the filling color vector for a barchart.
|
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 |
isDrawOnNaN() |
boolean |
isFill()
Provided for backward compatibility.
|
boolean |
isLabelVisible()
Returns true when the label is visible.
|
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 |
removeChangeListener(javax.swing.event.ChangeListener l) |
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 |
setBarFillColorAt(int idx,
java.awt.Color fillColor)
Change the default bar filling color for the specified index.
|
void |
setBarFillColors(java.util.Vector<ColorItem> bfColors)
Sets the filling color vector for a barchart.
|
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 |
setDrawOnNaN(boolean drawOnNaN)
In Bar chart mode, draw a bar up to the yAxis maximum on a NaN value
|
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.
|
public static final int MARKER_NONE
public static final int MARKER_DOT
public static final int MARKER_BOX
public static final int MARKER_TRIANGLE
public static final int MARKER_DIAMOND
public static final int MARKER_STAR
public static final int MARKER_VERT_LINE
public static final int MARKER_HORIZ_LINE
public static final int MARKER_CROSS
public static final int MARKER_CIRCLE
public static final int MARKER_SQUARE
public static final int STYLE_SOLID
public static final int STYLE_DOT
public static final int STYLE_DASH
public static final int STYLE_LONG_DASH
public static final int STYLE_DASH_DOT
public static final int TYPE_LINE
public static final int TYPE_BAR
public static final int METHOD_FILL_FROM_TOP
public static final int METHOD_FILL_FROM_ZERO
public static final int METHOD_FILL_FROM_BOTTOM
public static final int FILL_STYLE_NONE
public static final int FILL_STYLE_SOLID
public static final int FILL_STYLE_LARGE_RIGHT_HATCH
public static final int FILL_STYLE_LARGE_LEFT_HATCH
public static final int FILL_STYLE_LARGE_CROSS_HATCH
public static final int FILL_STYLE_SMALL_RIGHT_HATCH
public static final int FILL_STYLE_SMALL_LEFT_HATCH
public static final int FILL_STYLE_SMALL_CROSS_HATCH
public static final int FILL_STYLE_DOT_PATTERN_1
public static final int FILL_STYLE_DOT_PATTERN_2
public static final int FILL_STYLE_DOT_PATTERN_3
public static final double NAN_FOR_NULL
public static final double NAN_FOR_POSITIVE_INFINITY
public static final double NAN_FOR_NEGATIVE_INFINITY
public static final int INTERPOLATE_NONE
public static final int INTERPOLATE_LINEAR
public static final int INTERPOLATE_COSINE
public static final int INTERPOLATE_CUBIC
public static final int INTERPOLATE_HERMITE
public static final int SMOOTH_NONE
public static final int SMOOTH_FLAT
public static final int SMOOTH_TRIANGULAR
public static final int SMOOTH_GAUSSIAN
public static final int SMOOTH_EXT_NONE
public static final int SMOOTH_EXT_FLAT
public static final int SMOOTH_EXT_LINEAR
public static final int MATH_NONE
public static final int MATH_DERIVATIVE
public static final int MATH_INTEGRAL
public static final int MATH_FFT_MODULUS
public static final int MATH_FFT_PHASE
protected boolean xDataSorted
public static java.lang.String getHelpString()
public void setViewType(int s)
public int getViewType()
setViewType(int)
public void setFillStyle(int b)
b
- Filling styleFILL_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
public int getFillStyle()
setFillStyle(int)
public void setFillMethod(int m)
m
- Filling methodMETHOD_FILL_FROM_TOP
,
METHOD_FILL_FROM_ZERO
,
METHOD_FILL_FROM_BOTTOM
public int getFillMethod()
setFillMethod(int)
public void setFillColor(java.awt.Color c)
c
- Filling colorgetFillColor()
public java.awt.Color getFillColor()
setFillColor(java.awt.Color)
public void setBarFillColorAt(int idx, java.awt.Color fillColor)
idx
- Value indexfillColor
- Filling colorpublic java.awt.Color getBarFillColorAt(int idx)
idx
- Value indexpublic void setBarFillColors(java.util.Vector<ColorItem> bfColors)
bfColors
- A vector of Filling colors for barchartgetBarFillColors()
public java.util.Vector<ColorItem> getBarFillColors()
setBarFillColors(java.util.Vector<fr.esrf.tangoatk.widget.util.chart.ColorItem>)
public void setColor(java.awt.Color c)
c
- Curve colorgetColor()
public java.awt.Color getColor()
setColor(java.awt.Color)
public boolean isFill()
setFillStyle(int)
public void setFill(boolean b)
b
- true if the view is filled, false otherwisesetFillStyle(int)
public void setClickable(boolean b)
b
- Clickable statepublic boolean isClickable()
setClickable(boolean)
public void setLabelVisible(boolean b)
b
- visible stateJLChart.setLabelVisible(boolean)
public boolean isLabelVisible()
setLabelVisible(boolean)
public java.awt.Color getLabelColor()
public void setLabelColor(java.awt.Color labelColor)
public void setInterpolationMethod(int method)
method
- Interpolation methodINTERPOLATE_NONE
,
INTERPOLATE_LINEAR
,
INTERPOLATE_COSINE
,
INTERPOLATE_CUBIC
,
INTERPOLATE_HERMITE
public int getInterpolationMethod()
setInterpolationMethod(int)
public void setInterpolationStep(int step)
step
- Interpolation step (must be >=2)setInterpolationMethod(int)
public int getInterpolationStep()
setInterpolationStep(int)
public void setHermiteTension(double tension)
tension
- Hermite interpolation tension coefficient (1=>high, 0=>normal, -1=>low)public double getHermiteTension()
setHermiteTension(double)
public void setHermiteBias(double bias)
bias
- Hermite interpolation bias coefficientpublic double getHermiteBias()
public void setSmoothingMethod(int method)
method
- Smoothing filer typeSMOOTH_NONE
,
SMOOTH_FLAT
,
SMOOTH_TRIANGULAR
,
SMOOTH_GAUSSIAN
public int getSmoothingMethod()
setSmoothingMethod(int)
public void setSmoothingNeighbors(int n)
n
- Number of neighbors (Must be >=2)public int getSmoothingNeighbors()
setSmoothingNeighbors(int)
public void setSmoothingGaussSigma(double sigma)
sigma
- Standard deviationsetSmoothingMethod(int)
public double getSmoothingGaussSigma()
setSmoothingMethod(int)
public void setSmoothingExtrapolation(int extMode)
extMode
- Extrapolation modeSMOOTH_EXT_NONE
,
SMOOTH_EXT_FLAT
,
SMOOTH_EXT_LINEAR
public int getSmoothingExtrapolation()
setSmoothingExtrapolation(int)
public void setMathFunction(int function)
function
- FunctionMATH_NONE
,
MATH_DERIVATIVE
,
MATH_INTEGRAL
,
MATH_FFT_MODULUS
,
MATH_FFT_PHASE
public int getMathFunction()
setMathFunction(int)
public void setBarWidth(int w)
w
- Bar width (pixel)getBarWidth()
public int getBarWidth()
setBarWidth(int)
public void setMarkerColor(java.awt.Color c)
c
- Marker colorgetMarkerColor()
public java.awt.Color getMarkerColor()
setMarkerColor(java.awt.Color)
public void setStyle(int c)
c
- Line styleSTYLE_SOLID
,
STYLE_DOT
,
STYLE_DASH
,
STYLE_LONG_DASH
,
STYLE_DASH_DOT
,
getStyle()
public int getMarkerSize()
setMarkerSize(int)
public void setMarkerSize(int c)
c
- Marker size (pixel)getMarkerSize()
public int getStyle()
setStyle(int)
public int getLineWidth()
setLineWidth(int)
public void setLineWidth(int c)
c
- Line width (pixel)getLineWidth()
public void setName(java.lang.String s)
s
- Name of this viewgetName()
public java.lang.String getName()
setName(java.lang.String)
public void setUnit(java.lang.String s)
s
- Dataview unit.getUnit()
public java.lang.String getUnit()
setUnit(java.lang.String)
public java.lang.String getExtendedName()
public int getMarker()
setMarker(int)
public void setMarker(int m)
m
- Marker typeMARKER_NONE
,
MARKER_DOT
,
MARKER_BOX
,
MARKER_TRIANGLE
,
MARKER_DIAMOND
,
MARKER_STAR
,
MARKER_VERT_LINE
,
MARKER_HORIZ_LINE
,
MARKER_CROSS
,
MARKER_CIRCLE
,
MARKER_SQUARE
public void setDrawOnNaN(boolean drawOnNaN)
drawOnNaN
- public boolean isDrawOnNaN()
public double getA0()
setA0(double)
public double getA1()
setA1(double)
public double getA2()
setA2(double)
public void setA0(double d)
d
- A0 valuepublic void setA1(double d)
d
- A1 valuepublic void setA2(double d)
d
- A2 valuepublic boolean hasTransform()
public boolean hasFilter()
setInterpolationMethod(int)
,
setSmoothingMethod(int)
,
setMathFunction(int)
public void setAxis(JLAxis a)
a
- Parent axispublic JLAxis getAxis()
public double getMinimum()
public double getMaximum()
public double getMinTime()
public double getMinXValue()
public double getPositiveMinXValue()
public double getPositiveMinTime()
public double getMaxXValue()
public double getMaxTime()
public int getDataLength()
public DataList getData()
commitChange()
public void commitChange()
getData()
public void add(double x, double y)
x
- x coordinates (real space)y
- y coordinates (real space)JLChart.addData(fr.esrf.tangoatk.widget.util.chart.JLDataView, double, double)
,
JLChart.setDisplayDuration(double)
public void add(double x, double y, boolean updateFilter)
x
- x coordinates (real space)y
- y coordinates (real space)updateFilter
- update filter flag.JLChart.addData(fr.esrf.tangoatk.widget.util.chart.JLDataView, double, double)
,
JLChart.setDisplayDuration(double)
public void setData(double[] x, double[] y)
x
- x valuesy
- y valuesadd(double, double)
public void setUnorderedData(double[] x, double[] y)
x
- x valuesy
- y valuesadd(double, double)
public void add(java.awt.geom.Point2D.Double p)
p
- point (real space)JLChart.addData(fr.esrf.tangoatk.widget.util.chart.JLDataView, double, double)
,
JLChart.setDisplayDuration(double)
public int garbagePointTime(double garbageLimit)
garbageLimit
- Limit time (in millisec)public void garbagePointLimit(int garbageLimit)
garbageLimit
- Index limitpublic void computeDataBounds()
public double[] computeTransformedMinMax()
public double computePositiveMin()
public double getTransformedValue(double x)
x
- Value to transformpublic DataList getLastValue()
public void reset()
public void applyConfiguration(java.lang.String prefix, CfFileReader f)
prefix
- settings prefixf
- CfFileReader object wich contains dataview paramettersJLChart.applyConfiguration(fr.esrf.tangoatk.widget.util.chart.CfFileReader)
,
JLAxis.applyConfiguration(java.lang.String, fr.esrf.tangoatk.widget.util.chart.CfFileReader)
public java.lang.String getConfiguration(java.lang.String prefix)
prefix
- DataView prefixapplyConfiguration(java.lang.String, fr.esrf.tangoatk.widget.util.chart.CfFileReader)
public double getYValueByIndex(int idx)
idx
- Value indexpublic double getXValueByIndex(int idx)
idx
- Value indexpublic void setUserFormat(java.lang.String format)
format
- Format (C style)public void addChangeListener(javax.swing.event.ChangeListener l)
l
- ChangeListenerpublic void removeChangeListener(javax.swing.event.ChangeListener l)
public void clearChangeListener()
public java.lang.String getUserFormat()
public java.lang.String formatValue(double v)
v
- Value to be formatedpublic boolean isXDataSorted()
public void setXDataSorted(boolean dataSorted)
false
by defaultdataSorted
- a boolean valuepublic double[] getSortedTimes()
public double[] getSortedValues()
public double[][] getDataSortedByTimes()
public double[][] getDataSortedByValues()
public static void mergeSort(double[] array, double[] associated)
array
- The array to sortassociated
- The associated array. Must be null or of the same length of
array
public void updateFilters()