Package net.i2p.rrd4j

Class SimpleSVGImageWorker

java.lang.Object
org.rrd4j.graph.ImageWorker
net.i2p.rrd4j.SimpleSVGImageWorker

public class SimpleSVGImageWorker extends ImageWorker
rrd4j adapter for SimpleSVGGraphics2D Requires: rrd4j 3.10 or higher Ref: https://github.com/rrd4j/rrd4j/issues/165 Usage: No ImageIO/BufferedImage/ImageWriter required!
      RRDGraph graph = new RrdGraph(graphdef, new SimpleSVGImageWorker(width, height));
      outputstream.write(graph.getRrdGraphInfo().getBytes());
License: Apache 2.0 (same as rrd4j)
Since:
0.9.64
Author:
zzz
  • Constructor Details

    • SimpleSVGImageWorker

      public SimpleSVGImageWorker(int width, int height)
  • Method Details

    • resize

      protected void resize(int width, int height)
      Specified by:
      resize in class ImageWorker
    • reset

      protected void reset(Graphics2D g2d)
      Description copied from class: ImageWorker
      reset the dimensions of the Graphics2D
      Specified by:
      reset in class ImageWorker
    • makeImage

      protected void makeImage(OutputStream os) throws IOException
      Specified by:
      makeImage in class ImageWorker
      Throws:
      IOException
    • drawString

      protected void drawString(String text, int x, int y, Font font, Paint paint)
      Overridden because the SVG format essentially strips leading/trailing spaces, causing alignment issues in ValueAxis with the %x.y number formatting. Consecutive spaces within text are also probably collapsed, that is not addressed here.
      Overrides:
      drawString in class ImageWorker
    • getStringWidth

      protected double getStringWidth(String text, Font font)
      Overridden because the SVG format essentially strips leading/trailing spaces, causing alignment issues in ValueAxis with the %x.y number formatting. Consecutive spaces within text are also probably collapsed, that is not addressed here.
      Overrides:
      getStringWidth in class ImageWorker