public class XYPlot extends java.lang.Object implements IXYGraphLibAdapter, IXYPlot, IXYPlotEvent
IXYPlotEvent.KeyEvent| Modifier and Type | Field and Description |
|---|---|
static int |
CMD_LAST_DATA |
static int |
CMD_MOVE_LEFT |
static int |
CMD_MOVE_RIGHT |
static int |
CMD_NEXT_DATA |
static int |
CMD_SHOW_ALL |
static int |
CMD_ZOOM_IN |
static int |
CMD_ZOOM_OUT |
static boolean |
SUPPORT_PARTIAL_DRAW |
| Modifier | Constructor and Description |
|---|---|
protected |
XYPlot(IXYGraphLib graphLib) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addDataHandler(XYPlotData dh)
Add an already existing data set
|
static XYPlotData |
createDataHandler(int max,
IXYGraphLib.RGB color)
Create a new data set to be displayed in the XY plot.
|
static IXYPlot |
createXYPlot(IXYGraphLib graphLib)
Static method to create an XYPlot instance
|
boolean |
evalKey(int key)
Method to be called by the owner of the plot to inform about a key stroke.
|
boolean |
evalMouseEvent(IXYGraphLib.MouseEvent event,
int x,
int y)
Method to be called by the owner of the plot to inform about mouse click
events.
|
java.util.ArrayList<XYPlotData> |
getDataHandlers()
Get list of used data handlers
|
long |
getDelayRepaint()
Get the delay of the repaint operation (see
setUpdateDelay(long) |
IXYGraphLib.Rect |
getRedrawArea()
Get the area which needs to be redrawn.
|
java.lang.String |
getXAxisText()
Get the text for the X axis
|
double |
getXMax()
Get the maximum X value
|
double |
getXMin()
Get the minimum X value
|
java.lang.String |
getXUnitText()
Get the text for the X axis unit
|
int |
getZoomBoxLacyUpdateDelay()
Returns the current value of the zoom box delay.
|
int |
height()
Get height of plot are
|
void |
initXRange(double xmin,
double xmax)
Same as setXRange but is always executed independent of the graphs current
paused state.
|
boolean |
isAllowPauseOnDataClick()
Returns the current state of the flag.
|
boolean |
isLegendExpanded()
Status, expanded (true) ore collapsed (false), of the legend box
|
boolean |
isOutdated()
Returns true if the graph needs to be repainted.
|
boolean |
moveByPixels(int pixelNum)
Move visible data to the right
|
void |
moveLeft()
Move visible data to the left
|
void |
moveRight()
Move visible data to the right
|
void |
onEvent(IXYPlotEvent.KeyEvent event)
This is the default handler for button events send from the plot to its
owner.
|
void |
paintCursor()
Paint the cursor into the plot
|
void |
paintGraph()
Paint the plot to the internal image
|
void |
registerEventHandler(IXYPlotEvent h)
Register a handler to receive clicks on the start/stop, pause keys.
|
boolean |
removeDataHandler(XYPlotData dh)
Remove data set
|
void |
removeDataHandlers()
Remove all data sets
|
void |
setAllowPauseOnDataClick(boolean allowPauseOnDataClick)
Allow that a click into the graph switches the state to pause mode.
|
void |
setAxisColor(int r,
int g,
int b)
Set color of axis
|
void |
setAxisLabels(boolean value)
Turn on/off of axis labels and legend.
|
void |
setBgColor(int r,
int g,
int b)
Set color of global background
|
void |
setBounds(IXYGraphLib.Rect bounds)
Set the boundaries of the component in absolute coordinates of the canvas
|
void |
setClearButtonVisible(boolean value)
Set the delete plot button to visible or invisible.
|
void |
setCursorBgColor(int r,
int g,
int b)
Set color of cursor box background
|
void |
setCursorColor(int r,
int g,
int b)
Set color of cursor
|
void |
setDataHandlers(XYPlotData[] dhs)
Add a set of data handlers to the graph.
|
void |
setDrawAreaBgColor(int r,
int g,
int b)
Set color of curve draw area background
|
void |
setFontSize(int labelFontSize,
int titleFontSize)
Set size of font for labels and title
|
void |
setFontSize(java.lang.String fontName,
int labelFontSize,
int titleFontSize)
Set name and size of font for labels and title
|
void |
setLegendBgColor(int r,
int g,
int b)
Set background color of the legend area.
|
void |
setLegendExpanded(boolean value)
Expand (true) ore collapse (false) the legend box
|
void |
setLegendSelectBgColor(int r,
int g,
int b)
Set background color of selected data in legend.
|
void |
setLegendVisible(boolean value)
Set the legend box to visible.
|
protected void |
setNeedsRedraw()
Set redraw flag
|
void |
setOptimizedLineDrawing(boolean optimizedDraw)
Large data sets consume a lot of time for drawing the lines.
|
void |
setPaused(boolean paused)
Set graph in paused mode.
|
void |
setSaveButtonVisible(boolean value)
Set the save button to visible or invisible.
|
void |
setSmoothScroll(boolean smoothScroll)
Set smooth scrolling.
|
void |
setStartButtonVisible(boolean value)
Set the run/pause button to visible or invisible.
|
void |
setUpdateDelay(long delay)
Set the delay of the repaint operation.
|
void |
setXAxisText(java.lang.String s)
Set the text for the X axis unit
|
void |
setXRange(double xmin,
double xmax)
Set the range for the X axis.
|
void |
setXUnitText(java.lang.String s)
Set the text for the X axis unit
|
void |
setYRange(XYPlotData data,
double ymin,
double ymax)
Set the range for the Y axis.
|
void |
setZoomBoxLacyUpdateDelay(int zoomBoxLacyUpdateDelay)
This value in [ms] is used to delay the update of the zoom box when changing
the size.
|
boolean |
showsCursor()
Check status of cursor
|
int |
width()
Get width of plot are
|
boolean |
zoomAt(int position,
double factor)
Zoom x-Axis at given position by a factor
|
void |
zoomIn()
Zoom x-Axis around cursor position
|
public static final int CMD_MOVE_LEFT
public static final int CMD_MOVE_RIGHT
public static final int CMD_LAST_DATA
public static final int CMD_NEXT_DATA
public static final int CMD_ZOOM_IN
public static final int CMD_ZOOM_OUT
public static final int CMD_SHOW_ALL
public static final boolean SUPPORT_PARTIAL_DRAW
protected XYPlot(IXYGraphLib graphLib)
public static IXYPlot createXYPlot(IXYGraphLib graphLib)
graphLib - Interface to the graphic librarypublic void registerEventHandler(IXYPlotEvent h)
registerEventHandler in interface IXYPloth - Receiver object for the eventspublic static XYPlotData createDataHandler(int max, IXYGraphLib.RGB color)
max - Maximum number of XY values to be stored in the setcolor - Color of the data to be displayed in the plotpublic java.util.ArrayList<XYPlotData> getDataHandlers()
IXYPlotgetDataHandlers in interface IXYPlotpublic void setDataHandlers(XYPlotData[] dhs)
IXYPlotsetDataHandlers in interface IXYPlotpublic boolean addDataHandler(XYPlotData dh)
IXYPlotaddDataHandler in interface IXYPlotpublic boolean removeDataHandler(XYPlotData dh)
IXYPlotremoveDataHandler in interface IXYPlotpublic void removeDataHandlers()
IXYPlotremoveDataHandlers in interface IXYPlotpublic void onEvent(IXYPlotEvent.KeyEvent event)
onEvent in interface IXYPlotEventpublic boolean showsCursor()
showsCursor in interface IXYGraphLibAdapterprotected void setNeedsRedraw()
public boolean isOutdated()
isOutdated in interface IXYPlotpublic long getDelayRepaint()
setUpdateDelay(long)public void setUpdateDelay(long delay)
IXYPlotsetUpdateDelay in interface IXYPlotdelay - Value in [ms]public void setBgColor(int r,
int g,
int b)
IXYPlotsetBgColor in interface IXYPlotr - R value of RGBg - G value of RGBb - B value of RGBpublic void setDrawAreaBgColor(int r,
int g,
int b)
IXYPlotsetDrawAreaBgColor in interface IXYPlotr - R value of RGBg - G value of RGBb - B value of RGBpublic void setAxisColor(int r,
int g,
int b)
IXYPlotsetAxisColor in interface IXYPlotr - R value of RGBg - G value of RGBb - B value of RGBpublic void setCursorColor(int r,
int g,
int b)
IXYPlotsetCursorColor in interface IXYPlotr - R value of RGBg - G value of RGBb - B value of RGBpublic void setLegendBgColor(int r,
int g,
int b)
IXYPlotsetLegendBgColor in interface IXYPlotr - R value of RGBg - G value of RGBb - B value of RGBpublic void setLegendSelectBgColor(int r,
int g,
int b)
IXYPlotsetLegendSelectBgColor in interface IXYPlotr - R value of RGBg - G value of RGBb - B value of RGBpublic void setCursorBgColor(int r,
int g,
int b)
IXYPlotsetCursorBgColor in interface IXYPlotr - R value of RGBg - G value of RGBb - B value of RGBpublic void setFontSize(int labelFontSize,
int titleFontSize)
IXYPlotsetFontSize in interface IXYPlotpublic void setFontSize(java.lang.String fontName,
int labelFontSize,
int titleFontSize)
IXYPlotsetFontSize in interface IXYPlotpublic void setOptimizedLineDrawing(boolean optimizedDraw)
IXYPlotsetOptimizedLineDrawing in interface IXYPlotoptimizedDraw - True to optimize drawingpublic boolean evalKey(int key)
public boolean evalMouseEvent(IXYGraphLib.MouseEvent event, int x, int y)
evalMouseEvent in interface IXYPlotx - x coordinate of the mouse down clicky - y coordinate of the mouse down clickpublic void moveLeft()
IXYPlotpublic void moveRight()
IXYPlotpublic boolean moveByPixels(int pixelNum)
IXYPlotmoveByPixels in interface IXYPlotpublic void zoomIn()
IXYPlotpublic boolean zoomAt(int position,
double factor)
IXYPlotpublic java.lang.String getXUnitText()
IXYPlotgetXUnitText in interface IXYPlotpublic void setXUnitText(java.lang.String s)
IXYPlotsetXUnitText in interface IXYPlots - Unit text i.e. "s" for seconds. Do not add brackets [] herepublic java.lang.String getXAxisText()
IXYPlotgetXAxisText in interface IXYPlotpublic void setXAxisText(java.lang.String s)
IXYPlotsetXAxisText in interface IXYPlots - Unit text i.e. "s" for seconds. Do not use brackets [] here, they
are added automaticallypublic void setBounds(IXYGraphLib.Rect bounds)
setBounds in interface IXYGraphLibAdaptersetBounds in interface IXYPlotbounds - Outer rectangle defining the plotting arepublic IXYGraphLib.Rect getRedrawArea()
getRedrawArea in interface IXYPlotpublic int width()
public int height()
public void setYRange(XYPlotData data, double ymin, double ymax)
ymin - Minimum y value to be displayedymax - Maximum y value to be displayedpublic void setXRange(double xmin,
double xmax)
IXYPlotpublic void initXRange(double xmin,
double xmax)
IXYPlotinitXRange in interface IXYPlotxmin - Minimum x value to be displayedxmax - Maximum x value to be displayedpublic double getXMin()
IXYPlotpublic double getXMax()
IXYPlotpublic void paintGraph()
paintGraph in interface IXYGraphLibAdapterpublic void paintCursor()
paintCursor in interface IXYGraphLibAdapterpublic int getZoomBoxLacyUpdateDelay()
getZoomBoxLacyUpdateDelay in interface IXYPlotpublic void setZoomBoxLacyUpdateDelay(int zoomBoxLacyUpdateDelay)
setZoomBoxLacyUpdateDelay in interface IXYPlotzoomBoxLacyUpdateDelay - New value for update delaypublic boolean isAllowPauseOnDataClick()
isAllowPauseOnDataClick in interface IXYPlotpublic void setAllowPauseOnDataClick(boolean allowPauseOnDataClick)
setAllowPauseOnDataClick in interface IXYPlotallowPauseOnDataClick - True to pause graph if clickedpublic void setLegendExpanded(boolean value)
setLegendExpanded in interface IXYPlotvalue - New value for legend expand statepublic boolean isLegendExpanded()
isLegendExpanded in interface IXYPlotpublic void setSmoothScroll(boolean smoothScroll)
IXYPlotsetSmoothScroll in interface IXYPlotsmoothScroll - True to scroll smoothlypublic void setSaveButtonVisible(boolean value)
IXYPlotsetSaveButtonVisible in interface IXYPlotvalue - true/falsepublic void setStartButtonVisible(boolean value)
IXYPlotsetStartButtonVisible in interface IXYPlotvalue - true/falsepublic void setClearButtonVisible(boolean value)
IXYPlotsetClearButtonVisible in interface IXYPlotvalue - true/falsepublic void setLegendVisible(boolean value)
setLegendVisible in interface IXYPlotvalue - New value for visible statepublic void setPaused(boolean paused)
public void setAxisLabels(boolean value)
IXYPlotsetAxisLabels in interface IXYPlotvalue - true (default) or false