LiveGraph
data visualisation and analysis framework

org.LiveGraph.settings
Class GraphSettings

java.lang.Object
  extended by org.LiveGraph.settings.ObservableSettings
      extended by org.LiveGraph.settings.GraphSettings

public class GraphSettings
extends ObservableSettings

Encapsulates settings concerned with the data graphs and the plot canvas.

This product includes software developed by the LiveGraph project and its contributors.
(http://www.live-graph.org)
Copyright (c) 2007 G. Paperin.
All rights reserved.

File: GraphSettings.java

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following terms and conditions are met:

1. Redistributions of source code must retain the above acknowledgement of the LiveGraph project and its web-site, the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above acknowledgement of the LiveGraph project and its web-site, the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software or any derived software must display the following acknowledgement:
This product includes software developed by the LiveGraph project and its contributors.
(http://www.live-graph.org)

4. All advertising materials distributed in form of HTML pages or any other technology permitting active hyper-links that mention features or use of this software or any derived software must display the acknowledgment specified in condition 3 of this agreement, and in addition, include a visible and working hyper-link to the LiveGraph homepage (http://www.live-graph.org).

THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version:
"1.1.1"
Author:
Greg Paperin (http://www.paperin.org)

Nested Class Summary
static class GraphSettings.HGridType
          Possible types for the horizontal grid.
static class GraphSettings.VGridType
          Possible types for the vertical grid.
static class GraphSettings.XAxisType
          Possible types for the x-axis.
 
Field Summary
private static java.util.Properties defaultValues
          Default settings.
static java.lang.String preferredFileExtension
          Standard file extension.
private  java.util.Properties values
          Holds the current graph settings.
 
Constructor Summary
GraphSettings()
          Creates a new graph settings object with the default settings.
GraphSettings(java.lang.String fileName)
          Creates a new graph settings object and loads the settings from the specified file.
 
Method Summary
private  void checkDisableHighlightingForOldJava()
          If the Java version is too old, data point highlighting is disabled.
 java.awt.Color getHGridColour()
          Gets the colour for drawing the horizontal grid bars.
 double getHGridSize()
          Gets the interval between the horizontal grib bars.
 GraphSettings.HGridType getHGridType()
          Gets the horizontal grid type.
 boolean getHighlightDataPoints()
          Gets whether the data points in the vicinity of the mouse cursor should be highlighted.
 double getMaxX()
          Gets the maximum X value for the plot viewport.
 double getMaxY()
          Gets the maximum Y value for the plot viewport.
 double getMinX()
          Gets the minimum X value for the plot viewport.
 double getMinY()
          Gets the minimum Y value for the plot viewport.
 java.awt.Color getVGridColour()
          Gets the colour to use for drawing the vertical grid bars.
 double getVGridSize()
          Gets the interval between the vertical grid bars.
 GraphSettings.VGridType getVGridType()
          Sets the vertical grid type.
 double getXAxisScaleValue()
          Gets the scale parameter to use with the type XAxis_DataValScaledSet for scaling of X values.
 int getXAxisSeriesIndex()
          Gets the index of the data series to use as the x-axis.
 GraphSettings.XAxisType getXAxisType()
          Gets the type for the x-axis.
 boolean load(java.lang.String fileName)
          Loads the settings from the specified file.
 boolean save(java.lang.String fileName)
          Saves the settings to a specified file.
 void setHGridColour(java.awt.Color c)
          Sets the colour for drawing the horizontal grid bars.
 void setHGridSize(double val)
          Sets the interval between the horizontal grib bars.
 void setHGridType(GraphSettings.HGridType v)
          Sets the horizontal grid type.
 void setHighlightDataPoints(boolean v)
          Gets whether the data points in the vicinity of the mouse cursor should be highlighted.
 void setMaxX(double v)
          Sets the maximum X value for the plot viewport.
 void setMaxY(double v)
          Sets the maximum Y value for the plot viewport.
 void setMinX(double v)
          Sets the minimum X value for the plot viewport.
 void setMinY(double v)
          Sets the minimum Y value for the plot viewport.
 void setVGridColour(java.awt.Color c)
          Sets the colour to use for drawing the vertical grid bars.
 void setVGridSize(double val)
          Sets the interval between the vertical grid bars.
 void setVGridType(GraphSettings.VGridType v)
          Gets the vertical grid type.
 void setXAxisScaleValue(double val)
          Sets the scale parameter to use with the type XAxis_DataValScaledSet for scaling of X values.
 void setXAxisSeriesIndex(int val)
          Sets the index of the data series to use as the x-axis.
 void setXAxisType(GraphSettings.XAxisType v)
          Sets the type for the x-axis.
 
Methods inherited from class org.LiveGraph.settings.ObservableSettings
addObserver, countObservers, hasObserver, notifyObservers, notifyObservers, removeObserver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

preferredFileExtension

public static final java.lang.String preferredFileExtension
Standard file extension.

See Also:
Constant Field Values

defaultValues

private static final java.util.Properties defaultValues
Default settings.


values

private java.util.Properties values
Holds the current graph settings.

Constructor Detail

GraphSettings

public GraphSettings()
Creates a new graph settings object with the default settings.


GraphSettings

public GraphSettings(java.lang.String fileName)
Creates a new graph settings object and loads the settings from the specified file.

Parameters:
fileName - File to load the settigs from.
Method Detail

load

public boolean load(java.lang.String fileName)
Loads the settings from the specified file.

Parameters:
fileName - File to load the settigs from.
Returns:
true if the settings were loaded, false if an exception occured.

save

public boolean save(java.lang.String fileName)
Saves the settings to a specified file.

Parameters:
fileName - The file to save the settings to.
Returns:
true if the settings were saved, false if an exception occured.

getMinY

public double getMinY()
Gets the minimum Y value for the plot viewport.

Returns:
The minimum value along the Y axis for the graph view or java.lang.Double.NaN if the current global minimum of all data series should be used instead.

setMinY

public void setMinY(double v)
Sets the minimum Y value for the plot viewport.

Parameters:
v - The minimum value along the Y axis for the graph view or java.lang.Double.NaN if the global minimum of all data series should be used at all times.

getMaxY

public double getMaxY()
Gets the maximum Y value for the plot viewport.

Returns:
The maximum value along the Y axis for the graph view or java.lang.Double.NaN if the current global maximum of all data series should be used instead.

setMaxY

public void setMaxY(double v)
Sets the maximum Y value for the plot viewport.

Parameters:
v - The maximum value along the Y axis for the graph view or java.lang.Double.NaN if the global maximum of all data series should be used at all times.

getMinX

public double getMinX()
Gets the minimum X value for the plot viewport.

Returns:
The minimum value along the X axis for the graph view or java.lang.Double.NaN if the currently smallest X value of all data series should be used instead.

setMinX

public void setMinX(double v)
Sets the minimum X value for the plot viewport.

Parameters:
v - The minimum value along the X axis for the graph view or java.lang.Double.NaN if the smallest X value of all data series should be used at all times.

getMaxX

public double getMaxX()
Gets the maximum X value for the plot viewport.

Returns:
The maximum value along the X axis for the graph view or java.lang.Double.NaN if the currently largest X value of all data series should be used instead.

setMaxX

public void setMaxX(double v)
Sets the maximum X value for the plot viewport.

Parameters:
v - The maximum value along the X axis for the graph view or java.lang.Double.NaN if the largest X value of all data series should be used at all times.

getVGridType

public GraphSettings.VGridType getVGridType()
Sets the vertical grid type.

Returns:
The vertical grid type.

setVGridType

public void setVGridType(GraphSettings.VGridType v)
Gets the vertical grid type.

Parameters:
v - The vertical grid type.

getVGridSize

public double getVGridSize()
Gets the interval between the vertical grid bars.

Returns:
The interval between the vertical grid bars.

setVGridSize

public void setVGridSize(double val)
Sets the interval between the vertical grid bars.

Parameters:
val - The interval between the vertical grid bars.

getVGridColour

public java.awt.Color getVGridColour()
Gets the colour to use for drawing the vertical grid bars.

Returns:
The colour to use for drawing the vertical grid bars.

setVGridColour

public void setVGridColour(java.awt.Color c)
Sets the colour to use for drawing the vertical grid bars.

Parameters:
c - The colour to use for drawing the vertical grid bars.

getHGridType

public GraphSettings.HGridType getHGridType()
Gets the horizontal grid type.

Returns:
The horizontal grid type.

setHGridType

public void setHGridType(GraphSettings.HGridType v)
Sets the horizontal grid type.

Parameters:
v - The horizontal grid type.

getHGridSize

public double getHGridSize()
Gets the interval between the horizontal grib bars.

Returns:
The interval between the horizontal grib bars.

setHGridSize

public void setHGridSize(double val)
Sets the interval between the horizontal grib bars.

Parameters:
val - The interval between the horizontal grib bars.

getHGridColour

public java.awt.Color getHGridColour()
Gets the colour for drawing the horizontal grid bars.

Returns:
The colour for drawing the horizontal grid bars.

setHGridColour

public void setHGridColour(java.awt.Color c)
Sets the colour for drawing the horizontal grid bars.

Parameters:
c - The colour for drawing the horizontal grid bars.

getXAxisType

public GraphSettings.XAxisType getXAxisType()
Gets the type for the x-axis.

Returns:
The type for the x-axis.

setXAxisType

public void setXAxisType(GraphSettings.XAxisType v)
Sets the type for the x-axis.

Parameters:
v - The type for the x-axis.

getXAxisSeriesIndex

public int getXAxisSeriesIndex()
Gets the index of the data series to use as the x-axis.

Returns:
The index of the data series to use as the x-axis.

setXAxisSeriesIndex

public void setXAxisSeriesIndex(int val)
Sets the index of the data series to use as the x-axis.

Parameters:
val - The index of the data series to use as the x-axis.

getXAxisScaleValue

public double getXAxisScaleValue()
Gets the scale parameter to use with the type XAxis_DataValScaledSet for scaling of X values.

Returns:
The scale parameter to use with the type XAxis_DataValScaledSet for scaling of X values.

setXAxisScaleValue

public void setXAxisScaleValue(double val)
Sets the scale parameter to use with the type XAxis_DataValScaledSet for scaling of X values.

Parameters:
val - scale parameter to use with the type XAxis_DataValScaledSet for scaling of X values.

getHighlightDataPoints

public boolean getHighlightDataPoints()
Gets whether the data points in the vicinity of the mouse cursor should be highlighted. (Note, this is a hidden setting and cannot be changes via the GUI.)

Returns:
true if the data points in the vicinity of the mouse cursor should be highlighted, false otherwise.

setHighlightDataPoints

public void setHighlightDataPoints(boolean v)
Gets whether the data points in the vicinity of the mouse cursor should be highlighted. (Note, this is a hidden setting and cannot be changes via the GUI.)

Parameters:
v - true if the data points in the vicinity of the mouse cursor are to be highlighted, false otherwise.

checkDisableHighlightingForOldJava

private void checkDisableHighlightingForOldJava()
If the Java version is too old, data point highlighting is disabled.


LiveGraph
data visualisation and analysis framework