Class SvgCharts

java.lang.Object
com.quantfinlib.report.SvgCharts

public final class SvgCharts extends Object
Dependency-free inline SVG charts for HTML reports: equity curves and drawdown charts rendered as self-contained SVG strings (no external assets, no JavaScript).

Why hand-rolled SVG and not a charting library: the report must open identically in a browser, an email client, and an archive viewer ten years from now — inline vector markup with no script and no fetch is the only format with that guarantee, and it keeps the library's zero-dependency promise. SVG is also resolution-independent (a compliance PDF print at 300dpi stays sharp) and diff-able in version control. Locale.US formatting throughout: an SVG coordinate written as "1,5" by a German-locale JVM is the classic silently-blank-chart bug. Output plugs into Report.Builder.addHtmlSection(java.lang.String, java.lang.String) and renders via HtmlReportExporter only.

  • Method Details

    • equityChart

      public static String equityChart(double[] equity)
      Equity curve line chart (720x300).
    • drawdownChart

      public static String drawdownChart(double[] equity)
      Drawdown area chart (720x220): 0 at the top, drawdowns filled below.
    • lineChart

      public static String lineChart(double[] values, int width, int height, String strokeColor)
      Generic line chart of a value series.