Skip to main content

Overview

Veydra’s chart system is driven by a configuration file (config/outputs.json) in each model’s directory. This file controls which variables are returned from simulations and how they are grouped into charts for visualization.

Configuration File Structure

The outputs.json file has four main sections:

Stocks and Flows

Define which simulation variables are returned to the frontend:
All stocks and flows are calculated internally during simulation. Only those listed here are included in the results sent to the frontend.

Auxiliaries

Auxiliaries are derived metrics computed post-simulation from stocks and flows. Define them in outputs.json and implement the calculation in your model’s _calculate_auxiliaries method.
Example auxiliary calculation (ratio of two population groups):
  • Input: health.s_healthy_well, health.s_healthy_ill, health.s_sickly_well, health.s_sickly_ill
  • Output: (healthy_well + healthy_ill) / (sickly_well + sickly_ill)

Chart Configuration

Basic Chart Definition

Each chart groups one or more series together:

Chart Properties

Series Properties

Chart Examples

Single Series with Comparison

Shows baseline (dashed gray) vs scenario (solid color) for one variable:

Multiple Series with Dual Y-Axis

Combine variables with different scales using left and right axes:

Multiple Series without Comparison

When comparison: false, only the current scenario is shown (no baseline lines):
Use comparison: false for charts with many series to avoid visual clutter. With comparison enabled, each series generates two lines (baseline + scenario).

Coverage by Subpopulation

Break down aggregate metrics into component parts:

UI Configuration

Phase Plot

Control whether the phase plot (stock vs stock scatter plot) is displayed:
Set to true to enable the interactive phase plot selector, which requires at least 2 stocks.

Time Units

The X-axis label automatically pulls units from the simulation.duration parameter definition in your model. For example, if your model defines:
The chart will display “Time (years)” on the X-axis.

Fallback Behavior

If no charts array is defined, the system falls back to displaying one chart per stock in the stocks array. This provides backward compatibility with models that haven’t been configured with grouped charts.

Best Practices

Only use the right Y-axis when scales differ significantly (e.g., people vs dollars). Too many dual-axis charts can confuse users.
Set comparison: false for charts with 3+ series to keep them readable. Reserve comparison: true for key analytical charts.
Use consistent color coding across charts (e.g., green for healthy, red for sickly). Material Design colors work well: #4CAF50 (green), #F44336 (red), #2196F3 (blue).

Next Steps

Stock-Flow Diagrams

Learn about model structure visualization

Model Development

Build models that output these variables