suiss/ui · Chart
Line Chart Forecast
A solid line for actual values that continues as a dashed forecast over a shaded future range.
Line Chart Forecast is an open-source chart from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
Actual values drawn as a solid line that continues as a dashed forecast over a shaded future period. Use it whenever you show projections next to history and need readers to tell them apart.
Installation
CLI
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Manual
- Install the dependencies:
-
Copy the source into
components/charts/line-chart-forecast.tsx:
- Update the import paths to match your project.
Usage
Fill the actual and forecast arrays; the forecast should start with the last actual value so the two lines meet. Move the shaded period by changing x1 and x2 on the reference area to match your first and last forecast labels. Both series share one color in chartConfig.
Notes
Since actual and forecast use the same color, the dash pattern and shading carry the distinction; the tooltip also names each series. At the handover point the tooltip lists both values.

Two series share one axis: actual fills the first nine months and forecast continues from September, drawn with strokeDasharray. A ReferenceArea shades September to December to mark the forecast period. Missing values are null, so each line stops where its data ends.
Installation
The CLI also adds what it builds on: Card, Chart.
Manual
-
Target iOS 17 or later.
-
Copy the theme files every view uses:
- Copy the source and every file it uses:
- Add the files to your app target.
- Set
minSdkto 24 or higher and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Replace the actual and forecast arrays; the forecast starts at the index set in chartData. Move the ReferenceArea x1 and x2 to match your forecast range. The component takes no props.
