Class VisualizationRunner

java.lang.Object
neqsim.mcp.runners.VisualizationRunner

public final class VisualizationRunner extends Object
Generates inline visual content (SVG charts, Mermaid diagrams, HTML tables) that can be rendered directly in chat interfaces supporting rich content.

Output types:

  • Phase envelope SVG — PT diagram with phase boundaries
  • Process flowsheet — Mermaid diagram of equipment connections
  • Compressor map SVG — performance curves with operating point
  • Property comparison — styled HTML table comparing multi-case results
Version:
1.0
Author:
Even Solbraa
  • Field Details

    • GSON

      private static final com.google.gson.Gson GSON
  • Constructor Details

    • VisualizationRunner

      private VisualizationRunner()
      Private constructor — all methods are static.
  • Method Details

    • run

      public static String run(String json)
      Main entry point for visualization generation.
      Parameters:
      json - JSON with visualization type and data
      Returns:
      JSON with rendered content (SVG, Mermaid, HTML)
    • generatePhaseEnvelopeSVG

      private static String generatePhaseEnvelopeSVG(com.google.gson.JsonObject input)
      Generates an SVG phase envelope (PT diagram) for a fluid composition.
      Parameters:
      input - JSON with components and model
      Returns:
      JSON with SVG string and data points
    • generateFlowsheetDiagram

      private static String generateFlowsheetDiagram(com.google.gson.JsonObject input)
      Generates a Mermaid flowsheet diagram from process simulation results.
      Parameters:
      input - JSON with equipment list and connections
      Returns:
      JSON with Mermaid diagram string
    • generateBarChartSVG

      private static String generateBarChartSVG(com.google.gson.JsonObject input)
      Generates an SVG bar chart for comparing values.
      Parameters:
      input - JSON with labels and values
      Returns:
      JSON with SVG string
    • generateCompressorMapSVG

      private static String generateCompressorMapSVG(com.google.gson.JsonObject input)
      Generates a compressor performance map SVG.
      Parameters:
      input - JSON with compressor data and operating point
      Returns:
      JSON with SVG and data
    • generateStyledTable

      private static String generateStyledTable(com.google.gson.JsonObject input)
      Generates a styled HTML table for property comparisons.
      Parameters:
      input - JSON with headers and rows
      Returns:
      JSON with HTML table string
    • getEquipmentShape

      private static String getEquipmentShape(String type)
      Maps equipment type to Mermaid shape syntax.
      Parameters:
      type - the equipment type
      Returns:
      the Mermaid shape string with NAME placeholder
    • escapeXml

      private static String escapeXml(String text)
      Escapes XML special characters.
      Parameters:
      text - the text to escape
      Returns:
      escaped text
    • escapeHtml

      private static String escapeHtml(String text)
      Escapes HTML special characters.
      Parameters:
      text - the text to escape
      Returns:
      escaped text
    • errorJson

      private static String errorJson(String message)
      Creates a standard error JSON response.
      Parameters:
      message - the error message
      Returns:
      the JSON string
    • generatePieChartSVG

      private static String generatePieChartSVG(com.google.gson.JsonObject input)
      Generates an SVG pie chart showing proportions.
      Parameters:
      input - JSON with categories and values arrays
      Returns:
      JSON with SVG string
    • generateLineChartSVG

      private static String generateLineChartSVG(com.google.gson.JsonObject input)
      Generates an SVG line chart for trend/time-series data.
      Parameters:
      input - JSON with xValues, yValues arrays, labels, and optional series
      Returns:
      JSON with SVG string