Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions dataviz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Re-include files the repo root ignores (*.js, *.css, *.d.ts).
!*.css
!*.mjs
!.storybook/*.js
!.storybook/*.ts
node_modules
dist
storybook-static
16 changes: 16 additions & 0 deletions dataviz/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type {StorybookConfig} from '@storybook/web-components-vite';
import remarkGfm from 'remark-gfm';

const config: StorybookConfig = {
stories: ['../src/stories/**/*.mdx', '../src/stories/**/*.stories.ts'],
addons: [
{
name: '@storybook/addon-docs',
// GitHub-flavoured markdown (tables) in MDX pages.
options: {mdxPluginOptions: {mdxCompileOptions: {remarkPlugins: [remarkGfm]}}},
},
],
framework: {name: '@storybook/web-components-vite', options: {}},
docs: {defaultName: 'Docs'},
};
export default config;
7 changes: 7 additions & 0 deletions dataviz/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap">
<style>
/* Baseline light only. Stories render on md.sys.color.surface. */
body { background: #fef7ff; color: #1d1b20; font-family: Roboto, system-ui, sans-serif; }
.sbdocs.sbdocs-wrapper { background: #fef7ff; }
</style>
14 changes: 14 additions & 0 deletions dataviz/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type {Preview} from '@storybook/web-components-vite';

const preview: Preview = {
tags: ['autodocs'],
parameters: {
layout: 'padded',
controls: {expanded: true},
backgrounds: {disable: true},
options: {
storySort: {order: ['Introduction', 'Foundations', ['Colour palette', 'Tokens', 'Theming'], 'Charts']},
},
},
};
export default preview;
40 changes: 40 additions & 0 deletions dataviz/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# m3-charts

Material 3 data visualization components, built with Lit and `@material/web`. The chart types follow
[Carbon Charts](https://charts.carbondesignsystem.com/). This is a separate package inside the
material-web repo, and is excluded from the root build and publish.

- **Charts:** bar (simple, grouped, stacked; vertical or horizontal), line, area, stacked area,
histogram, scatter, bubble, pie, donut and gauge.
- **Theme:** M3 baseline light only, with no dark mode. Every colour is a token reference that falls back
through `--m3-chart-*` → `--md-sys-color-*` / `--m3-ext-*` → the baseline value.
- **Chart controls:** `md-filter-chip` legend, `md-icon-button` + `md-menu` toolbar, `md-dialog` data table.
- **Data:** carbon format, `{group, key | date, value}`.

## Scripts

| Command | What it does |
|---|---|
| `npm run storybook` | Storybook dev server on :6006 (component docs and demos) |
| `npm run build-storybook` | Static Storybook in `storybook-static/` |
| `npm run palette` | Regenerate and validate the extended palette (`src/tokens/extended-colors.ts`) |
| `npm run palette -- --seed '#hex'` | Validate the series palette against a themed scheme (no write) |
| `npm run typecheck` / `npm run build` | Type-check / compile the library to `dist/` |

## Layout

```
src/
tokens/ tokens.ts (chart token layer), extended-colors.ts (generated)
internal/ base-chart.ts (shell, legend, tooltip, keyboard, toolbar), cartesian-chart.ts (scales, axes)
charts/ bar, line/area, histogram, scatter/bubble, pie/donut, gauge
stories/ Storybook stories and docs
scripts/ generate-palette.mjs, color-check.mjs (contrast and colour-blindness checks)
```

## Palette

The series order is primary, teal, amber, blue, pink, green, sky, tertiary. Series 2–7 are extended
colours harmonized to the primary. Each passes 3:1 contrast against `surface`, and the closest pair is at
least ΔE 8 apart under deuteranopia and protanopia simulation. If you theme with a new seed, re-run
`npm run palette -- --seed`, because a seed near an extended hue (for example teal) collides with that series.
Loading