This article starts level 2 of the series on silverpoint: building a panel with its own style and interaction. Before styling a panel you have to decide which charts it holds, and the catalog has 60.

You do not need to know them all. silverpoint classifies them with two questions, and with them the list shrinks to two or three candidates. This article explains those two questions, walks through the nine families of the catalog and applies them to the first three pieces of data of the operations panel.

The method: two questions

The first question is what shape the rows have. The second, what the reader has to see in them. The order matters: the shape of the data rules out most charts, and the intent chooses among the ones left.

Step 1: the shape of the data

Every chart declares the shape of the data it draws. There are twelve:

ShapeThe rows holdFor example
seriesOne row per point along an ordered axis (time, sequence)Hits per hour
categoriesOne row per category, with one or more valuesRevenue by region
partsThe parts of one totalTraffic by channel
matrixA value for each pair of categoriesErrors by day and hour
hierarchyOne row per node, with its id and its parentA budget by department
linksRows with a source, a target and a valueThe steps of a sign-up
pointsTwo or more numeric measures per rowPrice against rating
distributionMany observations of the same measureResponse times
intervalsA start and an end per rowA task schedule
eventsDated occurrences, or marks along a cycleCommits per day
singleOne figure, perhaps with a targetThis month's revenue
fieldA measure or a vector over a planeA wind field

The shape is read in the rows, not in the topic. Hits per hour are a series because each row is a point along an ordered axis. The same numbers grouped by weekday and time block are a matrix.

Step 2: what the reader has to see

The intent is what the chart has to make evident. silverpoint uses fourteen:

IntentThe reader has to see
trendWhere a value is heading
changeHow much it changed between two moments
compareWhich value is larger
rankThe order of the categories
part-to-wholeHow much each part weighs in the total
distributionHow the observations spread
correlationWhether two measures move together
flowWhere a volume goes
hierarchyWhat contains what
uncertaintyHow much margin an estimate has
progressHow far a target is
scheduleWhen each thing happens
kpiA figure and its trend, at a glance
networkWho connects to whom

One shape admits several intents. With categories, compare leads to a bar chart, change to a dumbbell chart and progress to a bullet chart.

The nine families

The 60 charts are grouped into nine families, by how they draw:

FamilyChartsSome of themUsual shapes
lines4line-chart, step-chart, sparkline-rows, kpi-cardseries, single
bars8bar-chart, stacked-bar-chart, waterfall-chart, funnel-chartcategories
areas3area-chart, range-band-chart, stream-chartseries, intervals
points-grids5scatter-chart, heatmap-chart, activity-gridpoints, matrix, events
radial11donut-chart, radar-chart, gauge-arcparts, categories, single
flows2sankey-chart, chord-ringlinks
distributions-comparisons14histogram-chart, box-plot-chart, dumbbell-chartdistribution, categories, intervals
hierarchies-dimensions8squarified-treemap, sunburst-chart, waffle-charthierarchy, parts, matrix
fields-networks5network-chart, contour-chart, vector-field-chartpoints, links, field

The family is useful to search the documentation and the gallery, but not to choose: a radial chart and a bar chart can answer the same question. To choose, you use the shape and the intent.

The recommendation table

silverpoint keeps a hand-reviewed table that crosses each shape with each intent and scores the candidates from 0 to 1. These are the most frequent pairs in a panel:

ShapeIntentThe firstThe alternatives
seriestrendline-chart (0.9)area-chart (0.8), step-chart (0.6)
serieskpisparkline-rows (0.85)kpi-card (0.75)
categoriescomparebar-chart (0.9)lollipop-chart (0.75), radar-chart (0.5)
categorieschangedumbbell-chart (0.9)slope-chart (0.85), waterfall-chart (0.75)
partspart-to-wholedonut-chart (0.9)waffle-chart (0.85), treemap-chart (0.7)
matrixcompareheatmap-chart (0.9)marimekko-chart (0.7)
distributioncomparebox-plot-chart (0.9)violin-chart (0.85), ridgeline-chart (0.8)
intervalsuncertaintyerror-bar-chart (0.9)range-band-chart (0.85)
linksflowsankey-chart (0.9)chord-ring (0.75)
hierarchypart-to-wholesquarified-treemap (0.9)sunburst-chart (0.85)

The table also takes the volume into account. With more than six parts, the donut loses 0.3 points, because a ring does not read well with that many sectors. With more than twelve categories, the lollipop chart gains 0.2, and the radar, the polar bars and the coxcomb lose 0.3. With more than 500 points, the density bin chart beats the scatter chart.

Applied to the operations panel

The series' panel has three pieces of data to start with. Each one goes through the two questions.

Hits per hour. One row per hour, in order: the shape is series. The reader has to see how traffic evolves during the day: the intent is trend. The first in the table is line-chart, the chart of articles 03 to 07.

Errors by day and time block. Each row is a weekday with six values, one per four-hour block: the shape is matrix. The reader has to compare blocks and days to find where the errors gather: the intent is compare. The first is heatmap-chart.

Sales by channel. Four channels that add up to a total: the shape is parts. The reader has to see how much each channel contributes: the intent is part-to-whole. The first is donut-chart, and with four parts it does not get the six-sector penalty.

The panel's three charts: hits per hour, errors by day and block, sales by channel

The bar chart would be the alternative for sales if the question changed. To compare the channels with each other, or this month with the last one, the data stop being parts of a total and become categories with the intent compare, and there the first is bar-chart. The question decides the chart, not the numbers.

The code in React

The data, in src/panel.ts:

export type HourlyTraffic = { hour: string; hits: number };
export type DailyErrors = { day: string; values: number[] };
export type ChannelSales = { channel: string; sales: number };

export const traffic: HourlyTraffic[] = [
  { hour: '00', hits: 18 }, { hour: '01', hits: 14 }, { hour: '02', hits: 11 },
  { hour: '03', hits: 9 }, { hour: '04', hits: 11 }, { hour: '05', hits: 16 },
  { hour: '06', hits: 24 }, { hour: '07', hits: 33 }, { hour: '08', hits: 42 },
  { hour: '09', hits: 51 }, { hour: '10', hits: 58 }, { hour: '11', hits: 62 },
  { hour: '12', hits: 64 }, { hour: '13', hits: 61 }, { hour: '14', hits: 59 },
  { hour: '15', hits: 58 }, { hour: '16', hits: 57 }, { hour: '17', hits: 52 },
  { hour: '18', hits: 47 }, { hour: '19', hits: 41 }, { hour: '20', hits: 30 },
  { hour: '21', hits: 26 }, { hour: '22', hits: 22 }, { hour: '23', hits: 20 },
];

export const errors: DailyErrors[] = [
  { day: 'Mon', values: [3, 5, 31, 38, 22, 8] },
  { day: 'Tue', values: [2, 6, 28, 35, 20, 7] },
  { day: 'Wed', values: [4, 7, 34, 40, 25, 9] },
  { day: 'Thu', values: [3, 5, 29, 36, 21, 8] },
  { day: 'Fri', values: [2, 6, 26, 30, 18, 10] },
  { day: 'Sat', values: [1, 2, 9, 12, 10, 6] },
  { day: 'Sun', values: [1, 1, 7, 10, 8, 5] },
];

export const blocks = ['00-04', '04-08', '08-12', '12-16', '16-20', '20-24'];

export const sales: ChannelSales[] = [
  { channel: 'Web', sales: 46 },
  { channel: 'App', sales: 31 },
  { channel: 'Partners', sales: 15 },
  { channel: 'Phone', sales: 8 },
];

The three charts, in src/App.tsx:

import { DonutChart } from '@silverpoint/react/donut-chart';
import { HeatmapChart } from '@silverpoint/react/heatmap-chart';
import { LineChart } from '@silverpoint/react/line-chart';
import { blocks, errors, sales, traffic } from './panel';

export default function App() {
  return (
    <main className="panel">
      <LineChart
        data={traffic}
        xKey="hour"
        valueKey="hits"
        title="Hits per hour"
        footerLeft="Last 24 hours, in thousands"
      />
      <HeatmapChart
        data={errors}
        labelKey="day"
        valuesKey="values"
        columnLabels={blocks}
        scaleMax={40}
        title="Errors by day and time"
      />
      <DonutChart
        data={sales}
        nameKey="channel"
        valueKey="sales"
        centerLabel="thousand EUR"
        title="Sales by channel"
      />
    </main>
  );
}

And a grid to place them, in src/index.css:

body {
  margin: 0;
  padding: 32px;
  background: #f4f1ea;
}

.panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

Each chart has its own accessors, which depend on its shape:

ChartAccessorsOther props
LineChartxKey, valueKeysecondaryKey for a second, dotted series
HeatmapChartlabelKey, valuesKeycolumnLabels, the names of the columns; scaleMax, the value of the darkest tone
DonutChartnameKey, valueKeycenterValue and centerLabel, the centre of the ring; legend

Two details of this version:

  • The heatmap's scaleMax is 100 by default. The errors do not go past 40, so with the default every cell would stay in the light tones. With scaleMax={40}, the cell holding 40 gets the densest hatching.
  • The centre of the donut shows the total. Without centerValue, the ring writes the sum of the parts, 100, and the legend gives each channel's percentage.

The code in Reflex

The data, in ops_panel/panel.py:

TRAFFIC = [
    {"hour": "00", "hits": 18}, {"hour": "01", "hits": 14}, {"hour": "02", "hits": 11},
    {"hour": "03", "hits": 9}, {"hour": "04", "hits": 11}, {"hour": "05", "hits": 16},
    {"hour": "06", "hits": 24}, {"hour": "07", "hits": 33}, {"hour": "08", "hits": 42},
    {"hour": "09", "hits": 51}, {"hour": "10", "hits": 58}, {"hour": "11", "hits": 62},
    {"hour": "12", "hits": 64}, {"hour": "13", "hits": 61}, {"hour": "14", "hits": 59},
    {"hour": "15", "hits": 58}, {"hour": "16", "hits": 57}, {"hour": "17", "hits": 52},
    {"hour": "18", "hits": 47}, {"hour": "19", "hits": 41}, {"hour": "20", "hits": 30},
    {"hour": "21", "hits": 26}, {"hour": "22", "hits": 22}, {"hour": "23", "hits": 20},
]

ERRORS = [
    {"day": "Mon", "values": [3, 5, 31, 38, 22, 8]},
    {"day": "Tue", "values": [2, 6, 28, 35, 20, 7]},
    {"day": "Wed", "values": [4, 7, 34, 40, 25, 9]},
    {"day": "Thu", "values": [3, 5, 29, 36, 21, 8]},
    {"day": "Fri", "values": [2, 6, 26, 30, 18, 10]},
    {"day": "Sat", "values": [1, 2, 9, 12, 10, 6]},
    {"day": "Sun", "values": [1, 1, 7, 10, 8, 5]},
]

BLOCKS = ["00-04", "04-08", "08-12", "12-16", "16-20", "20-24"]

SALES = [
    {"channel": "Web", "sales": 46},
    {"channel": "App", "sales": 31},
    {"channel": "Partners", "sales": 15},
    {"channel": "Phone", "sales": 8},
]

The page, in ops_panel/ops_panel.py:

import reflex as rx
from reflex_silverpoint_react import donut_chart, heatmap_chart, line_chart

from .panel import BLOCKS, ERRORS, SALES, TRAFFIC


def index() -> rx.Component:
    return rx.grid(
        line_chart(
            data=TRAFFIC,
            x_key="hour",
            value_key="hits",
            title="Hits per hour",
            footer_left="Last 24 hours, in thousands",
        ),
        heatmap_chart(
            data=ERRORS,
            label_key="day",
            values_key="values",
            column_labels=BLOCKS,
            scale_max=40,
            title="Errors by day and time",
        ),
        donut_chart(
            data=SALES,
            name_key="channel",
            value_key="sales",
            center_label="thousand EUR",
            title="Sales by channel",
        ),
        columns="3",
        gap="16px",
        padding="32px",
    )


app = rx.App()
app.add_page(index)

rx.grid splits the width into three columns, and each chart takes the width of its own.

In Vue and in Angular

The same three charts, with each adapter's names:

ChartVueAngular
LineSpLineChart, from @silverpoint/vue/line-chart<sp-line-chart>, from @silverpoint/angular/line-chart
HeatmapSpHeatmapChart, from @silverpoint/vue/heatmap-chart<sp-heatmap-chart>, from @silverpoint/angular/heatmap-chart
DonutSpDonutChart, from @silverpoint/vue/donut-chart<sp-donut-chart>, from @silverpoint/angular/donut-chart

The props are the same, with the syntax of article 07: :column-labels="blocks" and :scale-max="40" in Vue, [columnLabels]="blocks" and [scaleMax]="40" in Angular.

The same table, for an AI assistant

The recommendation table is not a model: it is a reviewed list, and the silverpoint MCP server exposes it with the recommend_chart tool. With the shape parts, the intent part-to-whole and four rows, it answers the same as this article: donut-chart with 0.9, waffle-chart with 0.85 and treemap-chart with 0.7. The MCP server has its own article, 28.

What comes next

You now have the panel's first three charts and a method to choose the next ones. Article 09 gives them a common style: the grounds, the substrates and the provider that sets the style of the whole application in one place.

The 60 charts can be seen live in the gallery.