net.quies.math.plot
Class RenderUtils

java.lang.Object
  extended by net.quies.math.plot.RenderUtils

public final class RenderUtils
extends Object

A collection of utility methods. All methods are relative to the current render.

Since:
1.2
Author:
Pascal S. de Kloe
See Also:
Graph.setDomain(GraphDomain)

Method Summary
static String getXFormatted(Graph graph, Point2D position)
          Gets the formatted x-coordinate from a graphical position.
static BigDecimal getXValue(Graph graph, Point2D position)
          Gets the x-coordinate from a graphical position.
static String getYFormatted(Graph graph, Point2D position)
          Gets the formatted y-coordinate from a graphical position.
static BigDecimal getYValue(Graph graph, Point2D position)
          Gets the y-coordinate from a graphical position.
static boolean print(Graph graph)
          Runs a dialog to print the graph.
static void writeAsCSV(Graph graph, Writer target)
          Streams the coordinates as comma-separated values.
static void writeAsSVG(Graph graph, Writer target)
          Streams the graph to a SVG.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getXValue

public static BigDecimal getXValue(Graph graph,
                                   Point2D position)
Gets the x-coordinate from a graphical position.

Since:
1.2
See Also:
MouseEvent.getPoint()

getYValue

public static BigDecimal getYValue(Graph graph,
                                   Point2D position)
Gets the y-coordinate from a graphical position.

Since:
1.2
See Also:
MouseEvent.getPoint()

getXFormatted

public static String getXFormatted(Graph graph,
                                   Point2D position)
Gets the formatted x-coordinate from a graphical position.

Since:
1.2

getYFormatted

public static String getYFormatted(Graph graph,
                                   Point2D position)
Gets the formatted y-coordinate from a graphical position.

Since:
1.2

writeAsSVG

public static void writeAsSVG(Graph graph,
                              Writer target)
                       throws IOException
Streams the graph to a SVG. This method requires Apache Batik.

Throws:
IOException
Since:
1.5

writeAsCSV

public static void writeAsCSV(Graph graph,
                              Writer target)
                       throws IOException
Streams the coordinates as comma-separated values. The first field is the argument and the following are all the values for each function. The functions appear in the same order as they where added to the graph. This method requires QN CSV.

Throws:
IOException
Since:
1.3

print

public static boolean print(Graph graph)
Runs a dialog to print the graph.

Returns:
whether the graph was printed.
Since:
1.2