com.davisor.graphics.chart
Class SVGChart

java.lang.Object
  extended bycom.davisor.graphics.chart.AbstractChart
      extended bycom.davisor.graphics.chart.ImageChart
          extended bycom.davisor.graphics.chart.SVGChart
All Implemented Interfaces:
Chart, java.io.Serializable

public class SVGChart
extends ImageChart

SVGChart represents a chart generated by a chart factory as a SVG XML document. The result contains a XML document that is the chart itself, a reference to the graphics' context that generated the document, a reference to the factory that generated the chart and a copy of the factory settings that the chart was generated with. The data that the chart was generated with is not included.

Since:
JDK1.2
See Also:
BufferedChart, ChartAttributes, ChartFactory, Serialized Form

Field Summary
static java.lang.String SVG_FONT_PARAMETER
          Image parameter 'svgFont' for controlling SVG fonts.
static java.lang.String TEXT_ANTIALIAS_OFF
          Text antialising parameter value 'on'
static java.lang.String TEXT_ANTIALIAS_ON
          Text antialising parameter value 'on'
static java.lang.String TEXT_ANTIALIAS_PARAMETER
          Image parameter 'text-antialias' for controlling text antialiasing.
static java.lang.String TEXT_RENDERING_PARAMETER
          Image parameter 'text' for controlling text rendering strategy.
static java.lang.String TEXT_RENDERING_SHAPE
          Text rendering parameter value 'shape' for SVG text shape rendering.
static java.lang.String TEXT_RENDERING_SVG
          Text rendering parameter value 'svg' for using SVG text.
 
Fields inherited from class com.davisor.graphics.chart.ImageChart
M_backArea, M_graphics, M_image, M_imageParams, M_plotArea
 
Fields inherited from class com.davisor.graphics.chart.AbstractChart
M_annotatedShapes, M_contentType, M_height, M_resolution, M_width
 
Constructor Summary
  SVGChart(ChartAttributes attr)
          Creates a SVGChart out of the given factory and attributes.
protected SVGChart(java.lang.Number width, java.lang.Number height, java.lang.Number resolution, java.util.List annotatedShapes)
          Creates a new SVG chart.
protected SVGChart(java.lang.Number width, java.lang.Number height, java.lang.Number resolution, java.util.List annotatedShapes, java.lang.String imageParams)
          Creates a new SVG chart.
  SVGChart(SVGChart svgc)
          Shallow copy constructor.
 
Method Summary
 java.awt.Image getImage()
          Transcodes the chart into an image.
 void putImage(java.io.OutputStream stream, java.lang.String mime)
          Writes the chart image into a stream.
 
Methods inherited from class com.davisor.graphics.chart.ImageChart
getAnnotatedShapes, getBackArea, getGraphics, getImageParams, getPlotArea, putContent, putImage, putImage, putImage, setAntialiasDefaults, setAntialiasMode, setAntialiasMode, writeReplace
 
Methods inherited from class com.davisor.graphics.chart.AbstractChart
addAnnotatedShape, getContentType, getHeight, getHeightInMillimeters, getResolution, getSizeInMillimeters, getWidth, getWidthInMillimeters, putChart, putChart, setContentType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEXT_ANTIALIAS_PARAMETER

public static final java.lang.String TEXT_ANTIALIAS_PARAMETER
Image parameter 'text-antialias' for controlling text antialiasing.

See Also:
Constant Field Values

TEXT_ANTIALIAS_ON

public static final java.lang.String TEXT_ANTIALIAS_ON
Text antialising parameter value 'on'

See Also:
Constant Field Values

TEXT_ANTIALIAS_OFF

public static final java.lang.String TEXT_ANTIALIAS_OFF
Text antialising parameter value 'on'

See Also:
Constant Field Values

TEXT_RENDERING_PARAMETER

public static final java.lang.String TEXT_RENDERING_PARAMETER
Image parameter 'text' for controlling text rendering strategy.

See Also:
Constant Field Values

TEXT_RENDERING_SVG

public static final java.lang.String TEXT_RENDERING_SVG
Text rendering parameter value 'svg' for using SVG text.

See Also:
Constant Field Values

TEXT_RENDERING_SHAPE

public static final java.lang.String TEXT_RENDERING_SHAPE
Text rendering parameter value 'shape' for SVG text shape rendering.

See Also:
Constant Field Values

SVG_FONT_PARAMETER

public static final java.lang.String SVG_FONT_PARAMETER
Image parameter 'svgFont' for controlling SVG fonts.

See Also:
Constant Field Values
Constructor Detail

SVGChart

protected SVGChart(java.lang.Number width,
                   java.lang.Number height,
                   java.lang.Number resolution,
                   java.util.List annotatedShapes)
Creates a new SVG chart.

Parameters:
width - chart width, in millimeters (may be null)
height - chart height, in millimeters (may be null)
resolution - resolution, in pixels-per-millimeters (may be null)
annotatedShapes - list of annotated shapes (may be null)

SVGChart

protected SVGChart(java.lang.Number width,
                   java.lang.Number height,
                   java.lang.Number resolution,
                   java.util.List annotatedShapes,
                   java.lang.String imageParams)
Creates a new SVG chart.

Parameters:
width - chart width, in millimeters (may be null)
height - chart height, in millimeters (may be null)
resolution - resolution, in pixels-per-millimeters (may be null)
annotatedShapes - list of annotated shapes (may be null)
imageParams - image encoding parameters (may be null)

SVGChart

public SVGChart(SVGChart svgc)
Shallow copy constructor.


SVGChart

public SVGChart(ChartAttributes attr)
Creates a SVGChart out of the given factory and attributes. The chart does not contain an image, but only a graphics context that will provide the SVG representation of the chart.

After the creation, the graphics will first be filled with the chart background color. If the chart render attributes also define a stroke, a borderline of the given color is drawn around the chart. If the color is not set, black color is used as default.

After the graphics context has been created, a rectangle object is created to record the inner bounds of the drawable area of the image. If a borderline was drawn around the image, the border area is reduced from the bounds.

If a borderline was drawn around the image, an initial translation is added to the context, so that the context origo coincides with the left upper corner of the drawable area inside the border line. The context rendering hints are configured as described by the chart attributes.

Parameters:
attr - chart attributes that tell the chart image's size and type, among other things
See Also:
ImageChart.getBackArea(), ImageChart.getGraphics(), ImageChart.getPlotArea(), ImageChart.setAntialiasMode(ChartAttributes)
Method Detail

getImage

public java.awt.Image getImage()
Transcodes the chart into an image. This method is provided only to fulfill the Chart interface specification, and it is a very expensive operation, because the SVG document has to be transcoded into a raster image.

Overrides:
getImage in class ImageChart
Returns:
transcoded image, or null if the transcoding fails.
See Also:
ImageChart.getGraphics()

putImage

public void putImage(java.io.OutputStream stream,
                     java.lang.String mime)
              throws java.io.IOException
Writes the chart image into a stream. The specified MIME type is ignored.

Overrides:
putImage in class ImageChart
Parameters:
stream - output stream
mime - ignored output MIME type
Throws:
java.io.IOException
See Also:
ImageChart.putImage(OutputStream)


Copyright © 2001-2004 Davisor Oy. All Rights Reserved.