Skip to content
silverpoint
Documentation menu

Hosts

silverpoint in Plone

Two add-ons, one per Plone front end. volto-silverpoint is a Volto block that draws a chart from a table, server-rendered and hydrated. collective.silverpoint is a Chart content type with a Classic UI view and a browser view for templates. A Classic Chart's spec, serialised by plone.restapi, is one the Volto block can draw.

At a glance

IntegrationPackageRegistryKindThroughStatus
Plone Voltovolto-silverpointnpmcmsreactreleased
Plone Classic UIcollective.silverpointpypicmspythonreleased

Draws with volto-silverpoint: @silverpoint/react and @silverpoint/embed 0.11.2; collective.silverpoint: the silverpoint Python package 0.11.0.post1.

Requirement
Volto18 or 19 (tested on 18.36.0 and 19.8.1); Node 22+, pnpm 10
Plone backend6.x with plone.volto and plone.restapi; the Volto block needs no backend package
Classic UIPlone 6.0, 6.1 or 6.2 on Python 3.10–3.13

Volto: the Silverpoint chart block

shell
pnpm add volto-silverpoint
js
// volto.config.js
module.exports = { addons: ['volto-silverpoint'] };
  1. Add a Silverpoint chart block (group Common, allowed in every content type).
  2. Give it a table: paste CSV (comma-, semicolon- or tab-separated) or JSON ([{"col": value}] or {"columns": […], "values": [[…]]}), upload a .csv or .json, or choose a Table file: a File item, fetched each time the block renders.
  3. Choose the chart, map its roles to columns (a role is preselected when exactly one column fits), then set the options, the appearance and the view fields.

A table to paste for a bar chart:

csv
team;wins
A;12
B;9
C;15

The block saves plain JSON, never rendered markup, and plone.restapi returns it unchanged:

json
{
  "@type": "silverpointChart",
  "chart": "bar-chart",
  "table": { "columns": ["team", "wins"], "rows": [{ "team": "A", "wins": 12 }] },
  "role_x": "team",
  "role_value": "wins",
  "opt_orientation": "rows",
  "ground": "cyanotype",
  "title": "Wins per team"
}
Note
Pasted and uploaded tables are stored in the block, up to 2,000 rows; a larger table is refused and the editor asks for a File item, which is referenced rather than copied. The editor shows why a table does not bind; the public view shows only the title and description.

Classic UI: the Chart content type

text
# requirements.txt (or your buildout's eggs)
collective.silverpoint

Restart, then activate collective.silverpoint under Site Setup → Add-ons (it also installs plone.restapi). Add a Chart: the chart, the data (a CSV or JSON Table file, or the Table as text), the Role mapping and the Options as JSON, and the appearance.

text
Chart         Bar chart
Table as text team,wins
              A,12
              B,9
              C,15
Role mapping  {"x": "team", "value": "wins"}
Options       {"orientation": "rows"}

The add and edit forms validate the chart with the silverpoint package and show its message on the field at fault (an unknown column on the role mapping, an unknown option on the options). A Chart is content: workflow, permissions, versioning and search like any other item. The Silverpoint charts control panel holds the ground, substrate, mode and palette a chart takes when it sets none.

To draw a chart in any template, call the @@silverpoint-chart view:

html
<!-- a Chart item by UID -->
<div tal:replace="structure python: context.restrictedTraverse('@@silverpoint-chart')(uid=chart_uid)" />

<!-- or a spec built in the template -->
<div tal:replace="structure python: context.restrictedTraverse('@@silverpoint-chart')(
       spec={'chart': 'bar-chart', 'data': rows, 'props': {'xKey': 'team', 'valueKey': 'wins'}})" />

The view writes a <silverpoint-chart shadow> with the spec and, inside it, the title, the description and the data as an HTML table, which is what a reader without script and a search engine get. The script is served by the site at @@silverpoint-script.js?v=<version> with its integrity, only on pages holding a chart, and the markup has no inline script: it works under Plone's default Content-Security-Policy.

See also