Package org.faceless.graph2.tag
Class PNGEmbedder
- java.lang.Object
-
- org.faceless.graph2.tag.Embedder
-
- org.faceless.graph2.tag.PNGEmbedder
-
public class PNGEmbedder extends Embedder
An Embedder that creates a bitmap image of the specified graph, and returns it as a PNG to the browser. This class handles rollovers on the data (for piegraph and barseries) or series (for lineseries) tags.
For customers wishing to return their own type of bitmap to the browser, or wishing to handle rollovers in a different way, extending this class is a good place to start. Typically the methods that would need overriding are
getMIMEType()
andwriteBitmap()
if a format other thatn PNG is to be returned,createHTML()
if the JavaScript and image map are to be created differently, and maybefixActionString()
andaddSeriesToScript()
if the JavaScript is to be completely redone.- Since:
- 2.4
-
-
Constructor Summary
Constructors Constructor Description PNGEmbedder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
convert()
Convert the object returned byEmbedder.getGraph()
to an appropriate binary form, write it toEmbedder.getImageOutputStream()
and write the HTML required to embed it toEmbedder.getPageWriter()
, referencing the image atEmbedder.getImagePath()
.ImageOutput
getImageOutput()
Return theImageOutput
created by the PNGEmbedderString
getMIMEType()
Get the MIME type for the image that will be written by this Embedder toEmbedder.getImageOutputStream()
-
Methods inherited from class org.faceless.graph2.tag.Embedder
getAttribute, getAttributes, getForeignXML, getGraph, getHeight, getId, getResourceProvider, getWidth
-
-
-
-
Method Detail
-
getMIMEType
public String getMIMEType()
Description copied from class:Embedder
Get the MIME type for the image that will be written by this Embedder toEmbedder.getImageOutputStream()
- Specified by:
getMIMEType
in classEmbedder
-
getImageOutput
public ImageOutput getImageOutput()
Return theImageOutput
created by the PNGEmbedder
-
convert
public void convert() throws IOException
Description copied from class:Embedder
Convert the object returned byEmbedder.getGraph()
to an appropriate binary form, write it toEmbedder.getImageOutputStream()
and write the HTML required to embed it toEmbedder.getPageWriter()
, referencing the image atEmbedder.getImagePath()
. At it's very minimum it could look something like this:ImageOutput output = new ImageOutput(); getGraph().draw(output); output.writePNG(getImageOutputStream(), 0); getPageWriter().write("<img src='"+getImagePath()+"' />");
which is suitable for embedding an image with no mouse interaction.- Specified by:
convert
in classEmbedder
- Throws:
IOException
-
-