Skip to content

About

Build SVG charts from JSON input

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

Chart Builder

Created by the Milanfon Media team, lead by Milan Horínek. All drived work must remain open source.

This whole README section is still under WIP and is beign completed gradually

Please acknowledge that this project might be sometimes a mess because most fixed and features are done under time pressure, so the least time consuming path for a solution is usually taken.

Prerequisities

Required software to run this project:

  • Bun JS runtime
  • Inkscape

Currently this software was tested and developed under MacOS, for which compatibility is guaranteed. It should also work under Linux and WSL 2. Native Windows support might require some adjustments.

Usage

Examples

input/examples/ contains self-contained real-project examples for all chart types, with local reports, CSV/text data, and product images. Render the complete set with:

bun app.js -m batch -i examples -e png

For regression testing, see the folder's README for provenance, coverage, and visual regression review instructions. To force re-render, add -f argument. You can also choose to render svg only when changing the export argument to -e svg.

General

For the header, the software is by default looking for these 3 values and they are placed in the header in this particular order:

{
    "driver": "512.56",
    "version": "4.04",
    "settings": "High",
    ...
}

This comes from the fact that the main purpose of the software is to render gaming benchmarks. But if some of those are not defined, then it looks next to the info parameter, which is an array of lenght 3, containing these pairs:

{
    "name": "Frekvenční charakteristika",
    "info": [
        {"title": "Frekvence", "value": "20 .. 20 000 Hz"},
        {"title": "Měřící zařízení", "value": "MiniDSP E.A.R.S."},
        {"title": "Sluchátka", "value": "JBL Tour One M3"}
    ],
    "type": "line",
    ...
}

If value of one of this header parameter is not defined, then no title is shown.

Text

Text can be either a string

"Hey, I'm a text value"

or object with defined text and size

{
    "text": "Hey, I'm a text object!",
    "size": 18
}

[ ] More parameters are intended to be added to the text object

File paths

Spoorted are both relative and absolute paths. Root of the relative paths is the current input directory that is beign processed.

Bar chart

Bar charts compare multiple items across one or more measured values.

Common options

Option Description
type Must be bars.
name Chart title.
units Unit label shown in the footer.
bars Array of legend labels for each bar in val.
better Footer hint, supported values are higher and lower.
values Array of compared items.
sort Optional sorting direction, supported values are asc and desc.
sortIndex Optional index inside val used for sorting (default: 0).
legendBy Optional color palette group, defaults to general.
legendSpacing Optional spacing between legend items.
barsX Optional horizontal start position of the bar area.
barsFontSize Optional array of font sizes for bar labels.

Value item options

Option Description
name Item name shown on the left.
val Array of values rendered as bars. Length should match bars.
dnf Optional, true labels every bar in the item as DNF, or an array of booleans flags individual bars in val.
dnr Optional, true labels every bar in the item as DNR, or an array of booleans flags individual bars in val.
variant Optional row color variant, defaults to general.
model Optional secondary text shown below the item name.
date Optional date text shown next to the name block.
icon Optional icon name from assets/icons without .png.
show Optional, if false the item is skipped.

If units is min or hrs, string values like MM:SS are converted for sorting and scaling.

For tests that did not finish, keep the placeholder values as 0 and set dnf. The flag only changes the displayed label to DNF; values remain numeric for sorting and scaling. Unflagged zeros still display 0. DNF placeholder bars are wide enough to fit the label.

Use dnf: true when the entire test did not finish, or an array matching val to flag individual measurements:

{
    "name": "GPU A",
    "val": [0, 0],
    "dnf": true
}
{
    "name": "GPU B",
    "val": [120, 0],
    "dnf": [false, true]
}

For tests that did not run, use dnr in the same way. Keep 0 as the placeholder value; flagged bars display DNR and have enough room for the label. If both dnf and dnr flag the same bar, DNF takes precedence.

{
    "name": "GPU C",
    "val": [0, 0],
    "dnr": true
}

To flag just one measurement, use "dnr": [false, true] alongside "val": [120, 0].

{
    "name": "Gaming performance",
    "type": "bars",
    "units": "fps",
    "better": "higher",
    "bars": ["Average", "1% Low"],
    "sort": "desc",
    "sortIndex": 0,
    "values": [
        {
            "name": "VGA A",
            "model": "16 GB",
            "val": [120, 92],
            "variant": "general"
        },
        {
            "name": "VGA B",
            "date": "04/26",
            "val": [108, 84],
            "icon": "nvidia"
        }
    ]
}

Line chart

Line charts support multiple parsers:

  • hwi - HWiNFO
  • rew - For plotting audio
  • mangohud - Results from MangoHUD (uses CSV parser with fixed headerLine: 2)
  • csv - General CSV file
  • direct - Inline data defined directly in JSON

If parser is omitted for line chart, direct parser is used by default.

Common options

Top-level line chart options:

Option Description
type Must be line.
parser One of direct, csv, rew, hwi, mangohud (optional, default is direct).
sourceFile Default input file (required for file-based parsers, not used by direct).
xKey Optional CSV column name used for x coordinates (csv parser only). X-axis bounds are calculated from this column across all input files.
encoding Optional file encoding override (default: utf8).
units Text shown in line chart footer as x-axis units.
grid Optional, if true renders major horizontal and vertical gridlines behind the series. Horizontal lines follow the first left axis, or the first right axis when no left axis exists.
values Array of axis definitions.

Axis definition (values[]) options:

Option Description
position left or right.
bounds [min, max] y-axis bounds for all series on this axis.
width Optional custom width for this axis.
series Array of line series on this axis.
show Optional, if false the whole axis block is skipped.

Series options (used across parsers):

Option Description
key Data key/column name used by parser.
name Legend name.
unit Legend unit label.
color Line color in hex (without #).
invert Optional, if true y values are inverted.
index Optional column occurrence selector for duplicate column names.
file Optional per-series file override (supported by csv, required by rew).
legendWidth Optional custom width used for spacing this series in the line chart legend.

Line chart legend spacing is estimated automatically from the series name. If the automatic spacing is not suitable, set legendWidth on the affected series:

{
    "key": "FPS",
    "name": "RTX 4070 Ti SUPER",
    "unit": "fps",
    "color": "28a745",
    "legendWidth": 240
}

Direct

The direct parser defines data directly in JSON, without sourceFile.

Each series must define a non-empty val parameter. Supported formats are:

  • val: [1, 2, 3] (implicit x-axis based on index)
  • val: [[0, 1], [2, 3], [4, 2]] (explicit [x, y] pairs)

All values must be numeric.

{
    "name": "Direct line",
    "type": "line",
    "units": "s",
    "grid": true,
    "values": [
        {
            "bounds": [0, 100],
            "position": "left",
            "series": [
                {
                    "key": "Series A",
                    "name": "Series A",
                    "unit": "ms",
                    "color": "28a745",
                    "val": [10, 20, 15, 25]
                },
                {
                    "key": "Series B",
                    "name": "Series B",
                    "unit": "ms",
                    "color": "dc3545",
                    "val": [[0, 12], [2, 18], [4, 14]]
                }
            ]
        }
    ]
}

CSV

The csv parser uses sourceFile as the default CSV input for all series.

Set the top-level xKey option to the name of the CSV column containing x coordinates, for example "xKey": "Time". Values must be non-empty, finite numbers. Each series uses the x coordinates from its own file, and the x-axis bounds cover the minimum and maximum values across all input files. The selected column must exist in every file used by the chart.

If xKey is omitted, points use zero-based sample indexes as x coordinates, and x-axis bounds are read from the first column of the first input file.

You can combine multiple CSV files in one line chart by setting optional file on selected series. When file is defined, that series is loaded from that file instead of sourceFile.

This is useful when multiple files contain the same column name (for example FPS) and you want to plot them together.

{
    "name": "Frame rate comparison",
    "type": "line",
    "parser": "csv",
    "sourceFile": "gpu-a.csv",
    "xKey": "Time",
    "units": "s",
    "values": [
        {
            "bounds": [0, 200],
            "position": "left",
            "series": [
                {
                    "key": "FPS",
                    "name": "VGA A",
                    "unit": "fps",
                    "color": "28a745"
                },
                {
                    "key": "FPS",
                    "name": "VGA B",
                    "unit": "fps",
                    "color": "dc3545",
                    "file": "gpu-b.csv"
                }
            ]
        }
    ]
}

file follows the same relative/absolute path rules as sourceFile.

For example, xKey is useful when measurements are recorded at uneven time intervals. The chart configuration above can use these files:

gpu-a.csv:

Time,FPS
0,120
0.5,118
2,95
5,110

gpu-b.csv:

Time,FPS
0,130
1,125
3,105
6,115

With "xKey": "Time", each point is placed at its actual timestamp, and the shared x-axis spans 0–6 seconds. For example, the third points are plotted at 2 seconds for VGA A and 3 seconds for VGA B. Without xKey, both third points would be plotted at sample index 2, hiding the difference in measurement timing.

REW

The rew parser is for REW TXT exports. It does not parse .mdat directly.

For rew, each series should define file (for example left and right channel exports).

{
    "name": "Response",
    "type": "line",
    "units": "Hz",
    "parser": "rew",
    "values": [
        {
            "bounds": [0, 100],
            "position": "left",
            "series": [
                {
                    "key": "SPL(dB)",
                    "name": "SPL - Left",
                    "unit": "dB",
                    "color": "28a745",
                    "file": "Left.txt"
                },
                {
                    "key": "SPL(dB)",
                    "name": "SPL - Right",
                    "unit": "dB",
                    "color": "dc3545",
                    "file": "Right.txt"
                }
            ]
        }
    ]
}

HWiNFO

The hwi parser reads HWiNFO CSV exports from sourceFile.

Optional limit is supported:

  • number: end index
  • array: [startIndex, endIndex]
{
    "name": "CPU stats",
    "type": "line",
    "parser": "hwi",
    "sourceFile": "hwinfo.csv",
    "limit": [1, 200],
    "values": [
        {
            "bounds": [0, 100],
            "position": "left",
            "series": [
                {
                    "key": "CPU Package [°C]",
                    "name": "CPU Package",
                    "unit": "°C",
                    "color": "dc3545"
                }
            ]
        }
    ]
}

MangoHUD

The mangohud parser reads MangoHUD CSV exports from sourceFile.

Behavior is CSV-based with fixed headerLine: 2.

{
    "name": "Frame time",
    "type": "line",
    "parser": "mangohud",
    "sourceFile": "mangohud.csv",
    "values": [
        {
            "bounds": [0, 30],
            "position": "left",
            "series": [
                {
                    "key": "frametime",
                    "name": "Frame time",
                    "unit": "ms",
                    "color": "28a745"
                }
            ]
        }
    ]
}

XY chart

Use type: "xy" for connected, labeled measurements with independent numeric X/Y coordinates. It reuses the line chart header, axes, grid and footer, and adds square point markers. Single-point series are supported.

{
    "name": "Noise vs. temperature",
    "type": "xy",
    "grid": true,
    "xAxis": {"name": "Temperature", "unit": "°C", "bounds": [40, 60]},
    "yAxis": {"name": "Noise", "unit": "dB(A)", "bounds": [0, 40]},
    "values": [
        {
            "name": "Cooler A",
            "color": "d55e00",
            "val": [
                {"x": 43, "y": 30, "label": "Full Speed"},
                {"x": 48, "y": 20, "label": "Quiet"}
            ]
        }
    ]
}

Axis bounds are optional and otherwise include automatic padding (including constant-value series). Points require finite numeric x and y. Lines connect points from left to right in ascending X order; equal-X points retain their input order and connect vertically. Only the path is sorted: input data, markers and plotLabel.point indexes are unchanged. Set series connect: false to draw markers only. Series color is six-digit hex without #. Series and points support show: false. Point label is optional; labelDx, labelDy (SVG pixels), and labelAnchor (start, middle, end) allow manual label placement. Set top-level labels: false to hide all point labels. Series legendWidth overrides the usual line-legend spacing.

Set series icon to a name from assets/icons without .png (for example "icon": "noctua") to replace its square markers with centered 36-pixel brand icons. Icons are embedded in the SVG so exports are self-contained. Labels default to wider offsets for icon markers; explicit point offsets still take precedence. Series without an icon retain square markers.

Real-data example: input/noctua-aio/xy-avg-standard-temp.json. Missing cooler modes are not interpolated or fabricated.

To label coolers directly inside the plot, set plotLabel on each series and top-level legend: false to hide the footer legend (the X-unit box remains). These name labels are independent of point/mode labels and top-level labels: false. Names use the usual foreground color; mode labels retain their series colors.

{
    "name": "Noctua NL-LC-36",
    "plotLabel": {"point": 1, "dx": 0, "dy": 90, "anchor": "middle"},
    "icon": "noctua",
    "color": "d55e00",
    "val": [
        {"x": 43.0, "y": 11.2, "label": "Full Speed"},
        {"x": 43.2, "y": 7.4, "label": "Balanced"},
        {"x": 44.1, "y": 7.8, "label": "Quiet"}
    ]
}

plotLabel: true uses the first visible point, with offsets dx: 26, dy: -65 and anchor: "start". The object form chooses a zero-based visible point index, pixel offsets (dy positive is down), and text alignment (start, middle, end). Each series gets one name label; adjust offsets manually to avoid nearby measurements. Omit plotLabel to keep existing behavior. The legend is shown unless explicitly disabled.

Table

Right now tables are called 'SPECS'

Table cells can be both text format or object that specifies both the text and it's size.

{
    "name": "SPECIFIKACE",
    "type": "specs",
    "parameters": [
        "SoC",
        "Velikost displeje",
        "Displej",
        "Rozlišení displeje",
        "Hlavní kamera",
        "Ultrawide kamera",
        "Telephoto kamera",
        "Přední kamera",
        "Velikost baterie",
        "Rychlost nabíjení",
        "Bezdrátové nabíjení",
        "Cena k 12/24"
    ],
    "values": [
        {
            "name": "Pixel 9 Pro",
            "pic": {
                "path": "pixel-9-pro.png"
            },
            "val": [
                "Tensor G4",
                "6.3\"",
                {
                    "text": "OLED, HDR 2000 (3000) nit, 120 Hz",
                    "size": 22
                },
                "1280x2856 px",
                "50 MP, f/1.7, 25mm, OIS",
                "48 MP, f/2.2, 126°",
                "48 MP, f/2.8, 113mm",
                "42 MP, f/2.2, 17mm",
                "4700 mAh",
                "27W, PD 3.0",
                "21W (12W) + Reverse",
                "22 990,-"
            ]
        },
        {
            "name": "Pixel 10 Pro",
            "pic": {
                "path": "pixel-10-pro.png"
            },
            "val": [
                "Tensor G5",
                "6.3\"",
                {
                    "text": "LTPO OLED, HDR 2200 (3300) nit, 120 Hz",
                    "size": 19
                },
                "1280x2856 px",
                "50 MP, f/1.68, OIS",
                "48 MP, f/1.7, 123°, AF",
                "48 MP, f/2.8, 5x, OIS",
                "42 MP, f/2.2, 103°",
                "4870 mAh",
                "30W, USB-C PPS",
                "15W (Qi2)",
                "27 990,-"
            ]
        }
    ]
}

DisplayCAL measurement report

Use type: "display-report" to create one slide from one DisplayCAL Measurement Report HTML file. The report's embedded reference and measured RGB/Lab/XYZ data are parsed directly; no browser or report JavaScript is needed.

The normal header is followed by four sections:

Left column Middle column (full height) Right column (full height)
Patch accuracy (ΔE2000), above grayscale response, brightness and contrast Enlarged chromaticity chart (CIE 1976 u′v′) Vertical reference/measured color pairs

The color strip uses one shared REF/MEAS legend. Patch numbers and per-preview ΔE labels are omitted; errors appear in the patch accuracy chart.

{
    "name": "AG276QSG2 – Default preset / Pre-cal",
    "type": "display-report",
    "sourceFile": "Default Preset - Pre-cal.html",
    "info": [
        {"title": "Monitor", "value": "AG276QSG2"},
        {"title": "Režim", "value": "Default / Pre-cal"},
        {"title": "Cíl", "value": "sRGB"}
    ]
}

sourceFile uses the usual relative/absolute path rules. If info is omitted, the header shows the display name, patch count and measurement date from the report.

Optional settings:

  • deltaEMax: positive fixed upper bound for the error chart, at least the largest measured error. Useful for matching scales across separate slides; otherwise the scale is automatic.
  • previewPatches: array of 1–12 sample IDs to show as color pairs. By default, the slide selects full-intensity primary/secondary colors and muted colors when available, with other color patches as fallback.

Example input: input/display-test/displaycal-report.json.

bun app.js -m single -i display-test/displaycal-report.json -e svg
bun app.js -m single -i display-test/displaycal-report.json -e png

Outputs are written to output/display-test/displaycal-report.svg or .png. To render another report, change sourceFile and the title, or create another JSON file.

ΔE2000 is calculated from embedded, white-relative Lab values with unit weighting factors. These errors do not include the full whitepoint deviation from D65; the chromaticity chart uses raw measured XYZ to show that deviation. Its reference triangle uses embedded reference primary Lab adapted from D50 to D65. Triangles represent sampled primaries, not gamut coverage/volume. Grayscale compares measured relative XYZ Y against the embedded reference Lab luminance curve, so it follows the report's reference rather than assuming a gamma curve. Contrast uses recorded absolute white Y / black Y.

Color previews convert D50 Lab through Bradford adaptation to D65 and then sRGB. Out-of-gamut previews are clipped; errors are calculated before clipping. The dashed ΔE00 = 2 line is a visual guide. Uniformity reports use the separate brightness type below.

OSRTT response-time report

Use type: "osrtt" to render an OSRTT summary CSV export (measurements followed by JSON metadata). RGB5 and RGB10 tolerance exports are supported; the initial/perceived timing columns are identified by their labels. Select the run-named summary CSV, rather than the RAW-OSRTT or FULL-OSRTT waveform files.

{
    "name": "Odezva – AOC AG276QSG2",
    "type": "osrtt",
    "sourceFile": "003-RT-AG276QSG2-360-DP-100/003-RT-AG276QSG2-360-DP-100.csv"
}

The slide uses the standard logo/title header with resolution, refresh rate, and overdrive taken from the export. Set info to override those three header rows. name is optional and defaults to the monitor name prefixed by “Odezva”. sourceFile follows the usual relative/absolute path rules; optional note replaces the footer text.

Three heatmaps show perceived response time (ms), overshoot (RGB), and visual response rating. Rows are starting RGB levels; columns are ending RGB levels. Below them are response-time statistics, overshoot/rating summaries, and three color keys. Color thresholds match the sample report: response time 1/5/10 ms, overshoot 5/15/20 RGB, and rating 50/70/90.

Missing, non-finite, negative, and all-zero export results are shown as N/A and excluded separately for each metric. Overshoot is excluded when perceived time or rating is missing. Genuine zero overshoot is retained. Rise/fall averages use increasing/decreasing RGB levels. Refresh-window compliance uses perceived time ≤ 1000 / refresh rate; the 0–255–0 cycle requires both transitions to be valid. These exclusions can produce different averages from OSRTT screenshots that count failed measurements as zero.

bun app.js -m single -i display-test/osrtt-report.json -e svg
bun app.js -m single -i display-test/osrtt-report.json -e png

A self-contained regression example is available in input/examples/osrtt.json.

Brightness

Plotting of display uniformity from DisplayCAL is also supported.

{
    "name": "Uniformita podsvícení - HDR",
    "type": "brightness",
    "sourceFile": "/Users/milan/Projekty/Videos/TCL Monitor/testy/Samsung/HDR/Uniformity Check 3.8.9.3 — Odyssey G50SF @ 0, 0, 2560x1440 — 2026-04-02 13-09.html",
    "info": [
        {
            "title": "Monitor",
            "value": {
                "text": "Samsung Odyssey OLED G5 G50SF",
                "size": 14
            }
        },
        {
            "title": "Měřící zažízení",
            "value": "ColorCheckter Plus"
        }
    ]
}

About

Build SVG charts from JSON input

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages