sgds-data-visualisation
Use this skill when users ask about data visualisation, charts, graphs, or dashboards in an SGDS application. Covers ECharts setup and applying the SGDS colour palette to charts.
How do I install this agent skill?
npx skills add https://github.com/govtechsg/sgds-web-component --skill sgds-data-visualisationIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides guidelines and code snippets for integrating Apache ECharts into applications using the Singapore Design System (SGDS). It follows standard development practices, including recommending the installation of well-known libraries and providing static configuration examples.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
SGDS Data Visualisation Pattern
SGDS does not bundle a charting library. For data visualisation, use Apache ECharts and apply the SGDS colour palette so charts remain visually consistent with your design system.
Prerequisites
- Complete base project setup per sgds-getting-started.
- Install and configure ECharts independently — see https://echarts.apache.org/.
Installing ECharts
ECharts is not included in @govtechsg/sgds-web-component. Install it separately:
npm install echarts
Then import and initialise per the ECharts getting started guide:
import * as echarts from "echarts";
const chart = echarts.init(document.getElementById("chart"));
chart.setOption(option);
SGDS Colour Palette for ECharts
Apply the SGDS palette by setting the color array in your chart option. The values below are the raw hex values of the SGDS data-visualisation primitive tokens:
| Token | Hex |
|---|---|
--sgds-purple-600 | #ac1cdb |
--sgds-cyan-600 | #00758d |
--sgds-green-600 | #0e7c3d |
--sgds-blue-600 | #0269d0 |
--sgds-yellow-600 | #7e6917 |
Per-chart (recommended)
Set color directly in the chart option. ECharts cycles through the colours sequentially across series:
const option = {
color: ["#ac1cdb", "#00758d", "#0e7c3d", "#0269d0", "#7e6917"],
// ... rest of chart option
};
Global theme (all charts on the page)
Register a named theme once at app startup, then pass the theme name when initialising each chart:
import * as echarts from "echarts";
echarts.registerTheme("sgds", {
color: ["#ac1cdb", "#00758d", "#0e7c3d", "#0269d0", "#7e6917"],
});
const chart = echarts.init(document.getElementById("chart"), "sgds");
For AI Agents
- ECharts is not provided by SGDS — always tell users to install it separately from https://echarts.apache.org/.
- The five SGDS palette colours are fixed hex values taken from the primitive tokens. Do not reference CSS variables inside the ECharts
colorarray — ECharts does not resolve CSS custom properties. - For a single chart, set
colorin the option object. For multiple charts sharing the same palette, useecharts.registerTheme()once at app startup. - Palette order: purple → cyan → green → blue → yellow. ECharts cycles through them automatically across series.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/govtechsg/sgds-web-component/sgds-data-visualisation">View sgds-data-visualisation on skillZs</a>