ValyroUI Русская версия

Scenario Simulator

Assumption sliders update the forecast, uncertainty band and KPIs. Pro · Charts and analytics › Analysis and scenarios

What-if forecasting: move the assumptions (or pick a named scenario) and the forecast, its uncertainty band and the KPIs update together, each compared with the base scenario. The model is yours and pure; the component shows its units, ranges and method so a result can be reproduced.

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add scenario-simulator
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { ScenarioSimulator } from 'valyro-ui-pro';

Props

PropTypeDefault
inputs *ScenarioInput[]Assumptions the reader can move: range, step, unit and the base value.
simulate *(values: Record<string, number>) => ScenarioResultThe model: values in, forecast series and KPIs (with optional low / high bounds) out. Keep it pure and fast.
scenariosScenarioPreset[]Named scenarios ("Pessimistic", "Base", "Optimistic") that set several inputs at once.
valuesRecord<string, number>Current values by input id.
defaultValuesRecord<string, number>Initial values when uncontrolled. Default: every input's defaultValue.
onValuesChange(values: Record<string, number>) => voidCalled with all values when the reader moves an input or picks a scenario.
baselineRecord<string, number>Values the forecast is compared with (dashed line, KPI deltas). Default: the inputs' defaults.
precisionnumberFraction digits of KPI values that set no digits.
seriesFormatValueFormatHow forecast values read on the axis and in the data table. Default: like the first KPI.
currencystringISO 4217 code for format: 'currency' values.
methodReactNodeThe model's method in words — formulas and sources, so results can be reproduced.
chartHeightnumber220Chart height in px. Default 220.
loadingbooleanfalseThe model is loading: skeleton.
errorReactNodeLoading failed: shown instead of the simulator.
titleReactNodeHeading. Default: labels.title.
headingLevel2 | 3 | 4 | 53Level of the heading (default 3).
localestringBCP 47 locale for numbers; defaults to the ThemeProvider's.
labelsPartial<ScenarioSimulatorLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

Previous: Analytics Filter Bar · Next: Variance Explainer · All Charts and analytics