public class JLAxis
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static int |
AUTO_FORMAT
Use default compiler format to display double
|
static int |
BININT_FORMAT
Display integer using binary format
|
static int |
DATE_FORMAT
Display value as date
|
static int |
DECINT_FORMAT
Display integer using decimal format
|
static java.lang.String |
FR_DATE_FORMAT
French date format to format labels as dates
|
static int |
HEXINT_FORMAT
Display integer using haxadecimal format
|
static int |
HORIZONTAL_DOWN
Horizontal axis at bottom of the chart
|
static int |
HORIZONTAL_ORG1
Horizontal axis at 0 position (on Y1)
|
static int |
HORIZONTAL_ORG2
Horizontal axis at 0 position (on Y2)
|
static int |
HORIZONTAL_UP
Horizontal axis at top of the chart
|
static int |
LINEAR_SCALE
Use linear scale for this axis
|
static int |
LOG_SCALE
Use logarithmic scale for this axis
|
static int |
SCIENTIFIC_FORMAT
Display value using exponential representation (x.xxEyy)
|
static int |
SCIENTIFICINT_FORMAT
Display value using exponential representation (xEyy)
|
static int |
TIME_ANNO
Draw time annotation for x axis.
|
static int |
TIME_FORMAT
Display number of second as HH:MM:SS
|
static java.lang.String |
US_DATE_FORMAT
US date format to format labels as dates
|
static int |
VALUE_ANNO
Draw formated annotation
|
static int |
VERTICAL_LEFT
Vertical left axis
|
static int |
VERTICAL_ORG
Vertical axis at X=0
|
static int |
VERTICAL_RIGHT
Vertical right axis
|
Constructor and Description |
---|
JLAxis(javax.swing.JComponent parent,
int orientation)
Axis constructor (Expert usage).
|
Modifier and Type | Method and Description |
---|---|
void |
addDataView(JLDataView v)
Displays a DataView on this axis.
|
void |
addDataViewAt(int index,
JLDataView v)
Add the given dataView at the specifed index.
|
void |
applyConfiguration(java.lang.String prefix,
CfFileReader f)
Apply axis configuration.
|
boolean |
canApplyTimeSpan(int x1,
int x2) |
boolean |
checkRemoveDataView(JLDataView v)
Removes dataview from this axis and returns true if the dataview has been found for this Axis
|
void |
clearDataView()
Clear all dataview from this axis
|
java.awt.Color |
computeMediumColor(java.awt.Color c1,
java.awt.Color c2)
Compute the medium color of c1,c2
|
void |
computeXScale(java.util.Vector views)
Expert usage.
|
void |
directZoom(double min,
double max)
Enter zoom mode and set min and max
|
void |
drawFast(java.awt.Graphics g,
java.awt.Point lp,
java.awt.Point p,
JLDataView v)
Expert Usage.
|
static void |
drawSampleLine(java.awt.Graphics g,
int x,
int y,
JLDataView v)
Expert usage.
|
static java.lang.String |
formatTimeValue(double vt)
Returns a representation of the double in time format "EEE, d MMM yyyy HH:mm:ss".
|
java.lang.String |
formatValue(double vt,
double prec)
Returns a representation of the double acording to the format
|
int |
getAnnotation()
Returns the annotation method
|
java.lang.String |
getAxeName()
Gets the axis label.
|
java.awt.Color |
getAxisColor()
Returns the axis color.
|
java.awt.Rectangle |
getBoundRect()
Returns the bouding rectangle of this axis.
|
java.lang.String |
getConfiguration(java.lang.String prefix)
Builds a configuration string that can be write into a file and is compatible
with CfFileReader.
|
JLDataView |
getDataView(int index)
Get the dataView of this axis at the specified index.
|
java.lang.String |
getDateFormat() |
java.awt.Font |
getFont()
Gets the label font
|
int |
getFontHeight(java.awt.Graphics g)
Deprecated.
Use getLabelFontDimension() instead
|
int |
getFontOverWidth() |
int |
getGridStyle()
Returns the current grid style.
|
static java.lang.String |
getHelpString() |
int |
getLabelFontDimension(java.awt.font.FontRenderContext frc)
Expert usage.
|
int |
getLabelFormat()
Returns the axis label format.
|
int |
getLength()
Expert usage.
|
double |
getMax()
Expert usage.
|
double |
getMaximum()
Gets maximum axis value
|
double |
getMin()
Expert usage.
|
double |
getMinimum()
Gets minimum axis value
|
java.lang.String |
getName()
Gets the axis label.
|
int |
getOrientation()
Returns the orientation of this axis.
|
double |
getPercentScrollback()
Gets the percent scrollback
|
int |
getScale()
Gets the scale mdoe for this axis.
|
int |
getThickness()
Expert usage.
|
int |
getTick()
Deprecated.
Use getTickSpacing
|
int |
getTickLength()
Returns the tick length (in pixel).
|
double |
getTickSpacing()
Returns the current minimum tick spacing (in pixel).
|
int |
getTimeAnnoSubTickInterval()
Returns the number of sub tick interval in TIME_ANNO
|
int |
getViewNumber()
Returns the number if dataview in this axis.
|
java.util.Vector<JLDataView> |
getViews()
Gets all dataViews displayed on this axis.
|
int |
getVLabelWidth()
Returns the vertical label width
|
boolean |
isAutoScale()
Determines whether the axis is autoscaled.
|
boolean |
isDrawOpposite()
Determines whether the axis at the opposite side is visible
|
boolean |
isFitXAxisToDisplayDuration()
Return true if the x axis fit to display duration.
|
boolean |
isGridVisible()
Determines whether the axis is showing the grid
|
boolean |
isInverted()
Returns true if this axis is inverted.
|
boolean |
isSubGridVisible()
Determines whether the axis is showing the sub grid
|
boolean |
isVisible()
Returns true if the axis is visble, false otherwise
|
boolean |
isXY()
Determines whether the axis is in XY mode.
|
boolean |
isZeroAlwaysVisible()
Allaws user to know if the 0 value will always be visible in case of auto scale
|
boolean |
isZoomed()
Determines whether the axis is zoomed.
|
void |
measureAxis(java.awt.font.FontRenderContext frc,
int desiredWidth,
int desiredHeight)
Expert usage.
|
void |
paintAxisDirect(java.awt.Graphics g,
java.awt.font.FontRenderContext frc,
int x0,
int y0,
java.awt.Color back,
int tr,
int la)
Paint this axis.
|
void |
paintAxisOpposite(java.awt.Graphics g,
java.awt.font.FontRenderContext frc,
int x0,
int y0,
java.awt.Color back,
int tr,
int la) |
void |
paintAxisOppositeDouble(java.awt.Graphics g,
java.awt.font.FontRenderContext frc,
int x0,
int y0,
java.awt.Color back,
int tr,
int la) |
static void |
paintMarker(java.awt.Graphics g,
int mType,
int mSize,
int x,
int y)
Expert usage.
|
void |
removeDataView(JLDataView v)
Removes dataview from this axis
|
SearchInfo |
searchNearest(int x,
int y,
JLAxis xAxis)
Search the nearest point in the dataViews.
|
SearchInfo |
searchNearestNormal(int x,
int y,
JLAxis xAxis)
Expert usage.
|
SearchInfo |
searchNearestXY(int x,
int y,
JLAxis xAxis)
Expert usage.
|
void |
setAnnotation(int a)
Set the annotation method
|
void |
setAutoScale(boolean b)
Sets the autoscale mode for this axis.
|
void |
setAxeName(java.lang.String s)
Sets the axis name.
|
void |
setAxisColor(java.awt.Color c)
Sets the axis color.
|
void |
setAxisDuration(double d)
Expert usage.
|
void |
setDateFormat(java.lang.String dateFormat)
Sets date format chen chosen label format is DATE_FORMAT
|
void |
setDrawOpposite(boolean b)
Draw a second axis at the opposite side.
|
void |
setFitXAxisToDisplayDuration(boolean b)
Fit the x axis to display duration (Horizontal axis only).
|
void |
setFont(java.awt.Font f)
Sets the label font
|
void |
setGridStyle(int s)
Sets the grid style.
|
void |
setGridVisible(boolean b)
Shows the grid.
|
void |
setInverted(boolean i)
Invert this axis.
|
void |
setLabelFormat(int l)
Sets the axis label format.
|
void |
setLabels(java.lang.String[] labels,
double[] labelPos)
Customize axis labels.
|
void |
setMaximum(double d)
Sets maximum axis value.
|
void |
setMinimum(double d)
Sets minimum axis value.
|
void |
setName(java.lang.String s)
Sets the axis label.
|
void |
setOrientation(int orientation)
Sets the axis orientation and reset position.
|
void |
setPercentScrollback(double d)
Sets the percent scrollback.
|
void |
setPosition(int o)
Sets the axis position
|
void |
setScale(int s)
Sets scale mode
|
void |
setSubGridVisible(boolean b)
Shows the sub grid.
|
void |
setTick(int s)
Deprecated.
Use setTickSpacing
|
void |
setTickLength(int lgth)
Sets the tick length (in pixel).
|
void |
setTickSpacing(double spacing)
Sets the minimum tick spacing (in pixel).
|
void |
setTimeAnnoSubTickInterval(int nb)
Sets the number of sub tick interval in TIME_ANNO
|
void |
setVisible(boolean b)
Display or hide the axis.
|
void |
setVLabelWidth(int width)
Overrides the calculated vertical label width
Use this to align several charts vertically
|
void |
setZeroAlwaysVisible(boolean zeroAlwaysVisible)
Sets if 0 must always be visible in case of auto scale or not
|
java.lang.String |
toScientific(double d)
Return a scientific (exponential) representation of the double.
|
java.lang.String |
toScientificInt(double d) |
java.awt.Point |
transform(double x,
double y,
JLAxis xAxis)
Expert usage.
|
void |
translate(int x)
Translatet axis.
|
void |
unzoom()
Unzoom the axis and restores last state.
|
void |
zoom(double r)
Zoom axis.
|
void |
zoom(int x1,
int x2)
Zoom axis.
|
public static final int HORIZONTAL_DOWN
public static final int HORIZONTAL_UP
public static final int HORIZONTAL_ORG1
public static final int HORIZONTAL_ORG2
public static final int VERTICAL_RIGHT
public static final int VERTICAL_LEFT
public static final int VERTICAL_ORG
public static final int TIME_ANNO
public static final int VALUE_ANNO
public static final int LINEAR_SCALE
public static final int LOG_SCALE
public static final int AUTO_FORMAT
public static final int SCIENTIFIC_FORMAT
public static final int TIME_FORMAT
public static final int DECINT_FORMAT
public static final int HEXINT_FORMAT
public static final int BININT_FORMAT
public static final int SCIENTIFICINT_FORMAT
public static final int DATE_FORMAT
public static final java.lang.String US_DATE_FORMAT
public static final java.lang.String FR_DATE_FORMAT
public JLAxis(javax.swing.JComponent parent, int orientation)
orientation
- Default Axis placement (cannot be ..._ORG).parent
- (deprecated, not used).HORIZONTAL_DOWN
,
HORIZONTAL_UP
,
VERTICAL_LEFT
,
VERTICAL_RIGHT
,
setPosition(int)
public static java.lang.String getHelpString()
public void setPercentScrollback(double d)
JLChart.addData
and TIME_ANNO mode for the horizontal axis this property allows to avoid a full graph repaint
for every new data entered.d
- Scrollback percent [0..100]public double getPercentScrollback()
public void setAxisColor(java.awt.Color c)
c
- Axis colorgetAxisColor()
public java.awt.Color getAxisColor()
setAxisColor(java.awt.Color)
public void setLabelFormat(int l)
l
- Format of values displayed on axis and in tooltips.AUTO_FORMAT
,
SCIENTIFIC_FORMAT
,
TIME_FORMAT
,
DECINT_FORMAT
,
HEXINT_FORMAT
,
BININT_FORMAT
,
SCIENTIFICINT_FORMAT
,
DATE_FORMAT
,
getLabelFormat()
public int getLabelFormat()
setLabelFormat(int)
public void setGridVisible(boolean b)
b
- true to make the grid visible; false to hide itisGridVisible()
public void setFitXAxisToDisplayDuration(boolean b)
b
- true to fit x axis false otherwisepublic boolean isFitXAxisToDisplayDuration()
public boolean isGridVisible()
setGridVisible(boolean)
public void setDrawOpposite(boolean b)
b
- true to enable the opposite axis.public boolean isDrawOpposite()
setDrawOpposite(boolean)
public void setSubGridVisible(boolean b)
b
- true to make the subgrid visible; false to hide itisSubGridVisible()
public boolean isSubGridVisible()
setSubGridVisible(boolean)
public void setGridStyle(int s)
s
- Style of the grid. Can be one of the following:JLDataView.STYLE_SOLID
,
JLDataView.STYLE_DOT
,
JLDataView.STYLE_DASH
,
JLDataView.STYLE_LONG_DASH
,
JLDataView.STYLE_DASH_DOT
,
getGridStyle()
public int getGridStyle()
setGridStyle(int)
public void setFont(java.awt.Font f)
f
- Sets the font for this componentsgetFont()
public java.awt.Font getFont()
setFont(java.awt.Font)
public void setAnnotation(int a)
a
- Annotation for this axisTIME_ANNO
,
VALUE_ANNO
public int getAnnotation()
setAnnotation(int)
public void setVisible(boolean b)
b
- True to make the axis visible.public boolean isVisible()
public boolean isZoomed()
zoom(int, int)
public boolean isXY()
addDataView(fr.esrf.tangoatk.widget.util.chart.JLDataView)
public void setMinimum(double d)
d
- Minimum value for this axis. Must be strictly positive for LOG_SCALE.getMinimum()
public double getMinimum()
setMinimum(double)
public void setMaximum(double d)
d
- Maximum value for this axis. Must be strictly positive for LOG_SCALE.getMaximum()
public double getMaximum()
setMaximum(double)
public double getMin()
public double getMax()
public boolean isAutoScale()
setAutoScale(boolean)
public void setAutoScale(boolean b)
b
- true if the axis is autoscaled, false otherwiseisAutoScale()
public int getScale()
setScale(int)
public void setScale(int s)
s
- Scale mode for this axisLINEAR_SCALE
,
LOG_SCALE
,
getScale()
public void setOrientation(int orientation)
orientation
- Orientation valueHORIZONTAL_DOWN
,
HORIZONTAL_UP
,
VERTICAL_LEFT
,
VERTICAL_RIGHT
,
setPosition(int)
public int getOrientation()
setOrientation(int)
public void setTimeAnnoSubTickInterval(int nb)
nb
- Number of interval (0 to disable)public int getTimeAnnoSubTickInterval()
setTimeAnnoSubTickInterval(int)
public boolean canApplyTimeSpan(int x1, int x2)
public void directZoom(double min, double max)
public void zoom(int x1, int x2)
public void translate(int x)
public int getTick()
getTickSpacing()
public double getTickSpacing()
public void setTickSpacing(double spacing)
spacing
- Minimum tick spacingpublic void setTick(int s)
setTickSpacing(double)
public void setTickLength(int lgth)
lgth
- Lengthpublic int getTickLength()
public java.lang.String getName()
setName(java.lang.String)
public void setName(java.lang.String s)
s
- Name of this axis.getName()
public void setPosition(int o)
o
- Axis positionVERTICAL_LEFT
,
VERTICAL_RIGHT
,
VERTICAL_ORG
,
HORIZONTAL_DOWN
,
HORIZONTAL_UP
,
HORIZONTAL_ORG1
,
HORIZONTAL_ORG2
public java.lang.String getAxeName()
setAxeName(java.lang.String)
public void setAxeName(java.lang.String s)
s
- Name of this axis.getName()
public void addDataView(JLDataView v)
v
- The dataview to map along this axis.removeDataView(fr.esrf.tangoatk.widget.util.chart.JLDataView)
,
clearDataView()
,
getViews()
public void addDataViewAt(int index, JLDataView v)
index
- Insertion positionv
- DataView to addaddDataView(fr.esrf.tangoatk.widget.util.chart.JLDataView)
public JLDataView getDataView(int index)
index
- DataView indexpublic void removeDataView(JLDataView v)
v
- dataView to remove from this axis.addDataView(fr.esrf.tangoatk.widget.util.chart.JLDataView)
,
clearDataView()
,
getViews()
public boolean checkRemoveDataView(JLDataView v)
v
- dataView to remove from this axis.addDataView(fr.esrf.tangoatk.widget.util.chart.JLDataView)
,
clearDataView()
,
getViews()
public void clearDataView()
public java.util.Vector<JLDataView> getViews()
addDataView(fr.esrf.tangoatk.widget.util.chart.JLDataView)
,
removeDataView(fr.esrf.tangoatk.widget.util.chart.JLDataView)
,
clearDataView()
public int getViewNumber()
public void setInverted(boolean i)
i
- true to invert the axispublic boolean isInverted()
public java.awt.Rectangle getBoundRect()
public java.lang.String toScientific(double d)
d
- double to convertpublic java.lang.String toScientificInt(double d)
public static java.lang.String formatTimeValue(double vt)
vt
- number of millisec since epochpublic void setLabels(java.lang.String[] labels, double[] labelPos)
labels
- Label valueslabelPos
- Label positions (in axis coordinates)public void setVLabelWidth(int width)
width
- label widthpublic int getVLabelWidth()
setVLabelWidth(int)
public java.lang.String formatValue(double vt, double prec)
vt
- double to convertprec
- Desired precision (Pass 0 to not perform prec rounding).public void setAxisDuration(double d)
d
- Duration (millisec)public void computeXScale(java.util.Vector views)
views
- All views displayed along all Y axis.public int getFontHeight(java.awt.Graphics g)
public int getLabelFontDimension(java.awt.font.FontRenderContext frc)
public int getFontOverWidth()
public int getThickness()
getLength()
public int getLength()
getThickness()
public void measureAxis(java.awt.font.FontRenderContext frc, int desiredWidth, int desiredHeight)
frc
- Font render contextdesiredWidth
- Desired widthdesiredHeight
- Desired heightpublic java.awt.Point transform(double x, double y, JLAxis xAxis)
x
- The x coordinates (Real space)y
- The y coordinates (Real space)xAxis
- The axis corresponding to x coordinates.public SearchInfo searchNearestNormal(int x, int y, JLAxis xAxis)
x
- The x coordinates (Real space)y
- The y coorsinates (Real space)xAxis
- The axis corresponding to x coordinates.searchNearestXY(int, int, fr.esrf.tangoatk.widget.util.chart.JLAxis)
public SearchInfo searchNearestXY(int x, int y, JLAxis xAxis)
x
- The x coordinates (Real space)y
- The y coorsinates (Real space)xAxis
- The axis corresponding to x coordinates.searchNearestNormal(int, int, fr.esrf.tangoatk.widget.util.chart.JLAxis)
public SearchInfo searchNearest(int x, int y, JLAxis xAxis)
x
- The x coordinates (Real space)y
- The y coordinates (Real space)xAxis
- The axis corresponding to x coordinates.public void drawFast(java.awt.Graphics g, java.awt.Point lp, java.awt.Point p, JLDataView v)
g
- Graphics objectlp
- last pointp
- new pointv
- view containing the lp and p.public static void paintMarker(java.awt.Graphics g, int mType, int mSize, int x, int y)
g
- Graphics objectmType
- Marker typemSize
- Marker sizex
- x coordinates (pixel space)y
- y coordinates (pixel space)public static void drawSampleLine(java.awt.Graphics g, int x, int y, JLDataView v)
g
- Graphics objectx
- x coordinates (pixel space)y
- y coordinates (pixel space)v
- dataviewpublic java.awt.Color computeMediumColor(java.awt.Color c1, java.awt.Color c2)
c1
- Color 1c2
- Color 2public void paintAxisDirect(java.awt.Graphics g, java.awt.font.FontRenderContext frc, int x0, int y0, java.awt.Color back, int tr, int la)
g
- Graphics contextfrc
- Font render contextx0
- Axis positiony0
- Axis positionback
- background Color (used to compute subTick color)tr
- Translation from x0 to axis.la
- Translation to opposite axis (used by grid).public void paintAxisOpposite(java.awt.Graphics g, java.awt.font.FontRenderContext frc, int x0, int y0, java.awt.Color back, int tr, int la)
public void paintAxisOppositeDouble(java.awt.Graphics g, java.awt.font.FontRenderContext frc, int x0, int y0, java.awt.Color back, int tr, int la)
public void applyConfiguration(java.lang.String prefix, CfFileReader f)
prefix
- Axis settings prefixf
- CfFileReader object wich contains axis paramettersJLChart.applyConfiguration(fr.esrf.tangoatk.widget.util.chart.CfFileReader)
,
JLDataView.applyConfiguration(java.lang.String, fr.esrf.tangoatk.widget.util.chart.CfFileReader)
public java.lang.String getConfiguration(java.lang.String prefix)
prefix
- Axis settings prefixapplyConfiguration(java.lang.String, fr.esrf.tangoatk.widget.util.chart.CfFileReader)
,
JLChart.getConfiguration()
,
JLDataView.getConfiguration(java.lang.String)
public boolean isZeroAlwaysVisible()
public void setZeroAlwaysVisible(boolean zeroAlwaysVisible)
zeroAlwaysVisible
- a boolean value. True for always visible, false otherwise.public java.lang.String getDateFormat()
public void setDateFormat(java.lang.String dateFormat)
dateFormat
- US_DATE_FORMAT
,
FR_DATE_FORMAT