public class SVGOutput extends Output
Outputwhich allows the finished Graph to be rendered to SVG. At it's simplest, something like this would generally do:
Graph graph = makeMyGraph(); SVGOutput out = new SVGOutput(100,100); graph.draw(out); out.writeSVG(new OutputStreamWriter(new FileOutputStream("Graph.svg"), "UTF-8"), true);
|Constructor and Description|
Create a new SVGOutput
Create a new SVGOutput
|Modifier and Type||Method and Description|
Return the path taken by the specified line series.
Add additional XML to the XVG object and/or additional attributes to the
Write the SVG data to the specified writer.
public SVGOutput(int width, int height)
width- the width of the image in user units
height- the height of the image in user units
public SVGOutput(int width, int height, Paint background)
width- the width of the image
height- the height of the image
background- the background color of the SVG, or
nullfor no background
<svg>tag. Additional XML is specified with the
extraxmlparameter, and is added immediately after the
<svg>tag. Additional attributes for the
<svg>tag are specified with the
svgattsparameter. Both parameters may be null. As an example, calling
setXMLExtras("<script xlink:href=\"myscript.js\" />", "xmlns:xlink=\"http://www.w3.org/1999/xlink\"");would result in SVG that looks something like this (features set by this call in bold):
<svg width="300" height="300" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"< <script xlink:href="myscript.js" /> <g><polygon ...
extraxml- the XML which should be inserted immediately after the <svg> tag. May be null.
svgatts- any additional attributes for the <svg> tag. May be null.
public void writeSVG(Writer writer, boolean header) throws IOException
Write the SVG data to the specified writer. For standalone SVG documents,
header flag should be set to true to generate the
<?xml version="1.0"... header, and
the DOCTYPE line defining the output as an SVG document.
Note that when writing to an
the encoding of the XML header will be set to match the encoding of that Writer.
This implies that if you want to control the encoding of the XML, make sure you
set the encoding explicitly when creating the
new OutputStreamWriter(stream, "UTF-8") instead of
Writerto write the finished SVG to.
header- whether to include the "<?xml"... header and the DOCTYPE.
Output.getAreas()method - given a line series called "Prices", passing in the string "trace.graph.series.Prices" will return a String containing a list of comma-separated points which define the path taken by that series. There is no reason for end users to call this method.
Copyright © 2001-2016 Big Faceless Organization