Dashboards recipe

Source: 07_Dashboard/ · a small dashboard that composes the three pieces every real Curiosity dashboard uses.

How it looks

Stat cards across the top, a chart in the middle, and a leaderboard on the side. The recipe draws its charts with Tesserae's built-in LineChart and BarChart; the runnable Tesserae preview below shows the same layout with static data.

The three pieces

  1. Stat cards — one number per important KPI, across the top.
  2. Charts — time-series, bars, sparklines, with Tesserae's built-in charting components (LineChart(), AreaChart(), BarChart(), Sparkline(...)), which is what the workspace's own dashboards use. They follow the theme in light and dark mode.
  3. A leaderboard — top categories / users / facet values, on the side.

How the data flows

The view calls RecipeEndpoints.GetDashboardSeriesAsync() and RecipeEndpoints.GetTopCategoriesAsync() from inside a Defer(async () => ...) block, so the network calls only run when the tab is mounted.

Both methods currently return hard-coded values from src/API/Endpoints.cs. Each one has the production-style call commented out — uncomment it (and delete the canned return) once the matching workspace endpoint exists:

return await Mosaik.API.Endpoints.CallAsync<DashboardSeriesResponse>("recipes/dashboard-series");

The DTOs live next door in src/Schema/DTOs.cs. They are [ObjectLiteral] so they round-trip cleanly through the JSON layer.

Chart tips

  • A chart fills its container: give it a height (.H(220)) and .WS() for the width.
  • .Series(name, values) adds a named series and .XAxis(labels) sets the categories; .Tooltips() and .Legend() turn those on.
  • For data that changes, bind a series to an observable (.Series(IObservable<double[]>)) instead of rebuilding the chart.
Tesserae.UI.LineChart()
   .XAxis(x)
   .Series("Opened",   opened)
   .Series("Resolved", resolved)
   .Points()
   .Tooltips()
   .Legend()
   .H(220)
   .WS();

See also