public class RingRenderer extends Object
| Modifier and Type | Class and Description |
|---|---|
static class | RingRenderer.RingSectionA section of a multi-section ring with a proportion and color class. |
| Modifier and Type | Field and Description |
|---|---|
(package private) static double | ANOMALY_GREEN_BANDGreen anomaly band threshold |
(package private) static double | ANOMALY_YELLOW_BANDYellow anomaly band threshold |
static String | MODE_ACTIVITYMODE_ACTIVITY. |
static String | MODE_ANOMALYMode: anomaly — color by deviation from the router's own baseline, not an absolute cap |
static String | MODE_HEALTHMode: health (green/yellow/red), activity (blue/cyan) |
static String | MODE_LATENCYMODE_LATENCY. |
static String | MODE_NEUTRALMode: neutral (green/yellow/gray, never red — for uptime, metrics that aren't inherently bad) |
static String | MODE_RATIOMode: dual-arc ratio (green + red arcs showing a proportion) |
static String | PLOT_BARSPlot type: mini bars at the bottom of the ring |
static String | PLOT_LINEPlot type: line chart clipped to the inner circle area |
| Constructor and Description |
|---|
RingRenderer() |
| Modifier and Type | Method and Description |
|---|---|
(package private) static String | getColorClass(double score,
boolean collecting,
String mode)Determine the CSS color class based on score, collecting state, and mode. |
static String | renderRing(double score,
String label,
String value)Render a single SVG ring chart. |
static String | renderRing(double score,
String label,
String value,
String mode)Render a single SVG ring chart with a specified color mode. |
static String | renderRing(double score,
String label,
String value,
String mode,
double[] history)Render a single SVG ring chart with sparkline history. |
static String | renderRing(double score,
String label,
String value,
String mode,
double[] history,
String plotType)Render a single SVG ring chart with sparkline history and configurable plot type. |
static String | renderRing(double score,
String label,
String value,
String mode,
double[] history,
String plotType,
String forcedColor)Render a ring with an explicit color class override. |
static String | renderRing(RingRenderer.RingSection[] sections,
String value,
String label)Render a multi-section ring SVG with proportional colored arcs. |
static String | renderRingCell(double score,
String label,
String value,
String[] details)Render a ring cell (ring + optional tooltip) for use inside a grid. |
static String | renderRingCell(double score,
String label,
String value,
String[] details,
String mode)Render a ring cell with a specified color mode. |
static String | renderRingCell(double score,
String label,
String value,
String[] details,
String mode,
double[] history)Render a ring cell with sparkline history bars. |
static String | renderRingCell(double score,
String label,
String value,
String[] details,
String mode,
double[] history,
String forcedColor)Render a ring cell with an explicit color class override. |
static String | renderRingCell(RingRenderer.RingSection[] sections,
String value,
String label,
String[] details)Render a multi-section ring cell. |
static final double ANOMALY_GREEN_BAND
static final double ANOMALY_YELLOW_BAND
public static final String MODE_ACTIVITY
public static final String MODE_ANOMALY
public static final String MODE_HEALTH
public static final String MODE_LATENCY
public static final String MODE_NEUTRAL
public static final String MODE_RATIO
public static final String PLOT_BARS
public static final String PLOT_LINE
static String getColorClass(double score, boolean collecting, String mode)
score - 0.0–1.0 (never negative here)collecting - true if data is still being gatheredmode - color modepublic static String renderRing(double score, String label, String value)
score - 0.0–1.0 fill level, or < 0 for "collecting" (gray)label - short label displayed below the percentagevalue - value string displayed in the center (e.g. "93%", "12", "1.2s")public static String renderRing(double score, String label, String value, String mode)
score - 0.0–1.0 fill level, or < 0 for "collecting" (gray)label - short label displayed below the percentagevalue - value string displayed in the centermode - color mode (MODE_HEALTH, MODE_ACTIVITY, MODE_LATENCY)public static String renderRing(double score, String label, String value, String mode, double[] history)
score - 0.0–1.0 fill level, or < 0 for "collecting" (gray)label - short label displayed below the percentagevalue - value string displayed in the centermode - color mode (MODE_HEALTH, MODE_ACTIVITY, MODE_LATENCY)history - recent data points for sparkline, or null to omitpublic static String renderRing(double score, String label, String value, String mode, double[] history, String plotType)
score - 0.0–1.0 fill level, or < 0 for "collecting" (gray)label - short label displayed below the percentagevalue - value string displayed in the centermode - color mode (MODE_HEALTH, MODE_ACTIVITY, MODE_LATENCY)history - recent data points for sparkline, or null to omitplotType - PLOT_BARS or PLOT_LINE (defaults to PLOT_LINE when null)public static String renderRing(double score, String label, String value, String mode, double[] history, String plotType, String forcedColor)
forcedColor is non-null it is used for the arc/text/plot color
instead of the score-derived class (used by MODE_ANOMALY, where color reflects
deviation from baseline rather than the raw fill level).forcedColor - explicit CSS class ("green"/"yellow"/"red"/"gray"), or nullpublic static String renderRing(RingRenderer.RingSection[] sections, String value, String label)
sections - array of sections (values normalized to sum 1.0)value - center text (e.g. "70%")label - label below the center textpublic static String renderRingCell(double score, String label, String value, String[] details)
score - 0.0–1.0 fill levellabel - short labelvalue - value string in the centerdetails - tooltip lines, or null/empty for no tooltippublic static String renderRingCell(double score, String label, String value, String[] details, String mode)
score - 0.0–1.0 fill levellabel - short labelvalue - value string in the centerdetails - tooltip lines, or null/empty for no tooltipmode - color mode (MODE_HEALTH, MODE_ACTIVITY, MODE_LATENCY)public static String renderRingCell(double score, String label, String value, String[] details, String mode, double[] history)
score - 0.0–1.0 fill levellabel - short labelvalue - value string in the centerdetails - tooltip lines, or null/empty for no tooltipmode - color mode (MODE_HEALTH, MODE_ACTIVITY, MODE_LATENCY)history - recent data points for sparkline, or null to omitpublic static String renderRingCell(double score, String label, String value, String[] details, String mode, double[] history, String forcedColor)
forcedColor is non-null it is used for the arc/text/plot color
instead of the score-derived class (used by MODE_ANOMALY).forcedColor - explicit CSS class ("green"/"yellow"/"red"/"gray"), or nullpublic static String renderRingCell(RingRenderer.RingSection[] sections, String value, String label, String[] details)
sections - array of sections (values normalized to sum 1.0)value - center textlabel - label below the center textdetails - tooltip lines, or null/empty to omit