Class GNUPlotTemplate

java.lang.Object
atessera.templ.GNUPlotTemplate

public final class GNUPlotTemplate extends Object
Velocity template for generating GNUPlot chart source.

This class populates the gnuplot.vm template with the plot commands, producing an executable GNUPlot script. The resulting script can be compiled with GNUPlot.

Typical usage:


 GNUPlotTemplate t = new GNUPlotTemplate(factory);
 t.setText(gnuplotCommands);
 List<String> gpSource = t.renderToStringList();
 
See Also:
  • Constructor Details

    • GNUPlotTemplate

      public GNUPlotTemplate(EngineFactory engineFactory)
      Constructs a new GNUPlot template.
      Parameters:
      engineFactory - the factory for obtaining a Velocity engine; must not be null
      Throws:
      org.apache.velocity.exception.ResourceNotFoundException - if gnuplot.vm cannot be loaded
  • Method Details

    • setText

      public GNUPlotTemplate setText(List<String> text)
      Sets the GNUPlot commands.
      Parameters:
      text - the GNUPlot script lines; may be null or empty
      Returns:
      this template (for fluent chaining)
    • render

      public void render(Writer wr)
      Merges the context into the template and writes the result to the given writer.
      Parameters:
      wr - the writer to receive the rendered output; must not be null
    • renderToStringList

      public List<String> renderToStringList()
      Renders the template and returns the result split into lines.
      Returns:
      the rendered output as a list of lines (trailing empty lines are preserved)