j3w1 / theme

j3w1 / theme4.0.0

j3w1 / command

  • SPEC Overview
  • SPEC Foundations
  • SPEC Components
  • SPEC Patterns
  • SPEC Tokens
  • SPEC Tools
  • SPEC Workbench
  • SPEC Form builder
  • SPEC Task kit
  • SPEC Recipes
  • SPEC Figma bridge
  • SPEC Report an issue
  • SPEC Implement
  • SPEC For agents
  • SPEC Ports
  • SPEC Releases
  • SPEC Specification
  • DEMO Vue application demo

Chart

A one-series numeric chart with an always-visible complete data table.

stable · light DOM · 4.0.0. Light DOM retains static content, native semantics, label relationships and host composition without duplicating controls.

Live variants

default

Completed tasks by week
Completed tasks
WeekTasks
Week 124
Week 236
Week 348
Markup
<j3w1-chart id="example-chart-default"><figure class="chart"><figcaption>Completed tasks by week</figcaption><svg viewBox="0 0 300 120" role="img" aria-label="Week 1: 24; Week 2: 36; Week 3: 48"><g class="chart-series"><rect x="20" y="62" width="50" height="48"></rect><rect x="120" y="38" width="50" height="72"></rect><rect x="220" y="14" width="50" height="96"></rect></g></svg><table><caption>Completed tasks</caption><thead><tr><th scope="col">Week</th><th scope="col">Tasks</th></tr></thead><tbody><tr><th scope="row">Week 1</th><td>24</td></tr><tr><th scope="row">Week 2</th><td>36</td></tr><tr><th scope="row">Week 3</th><td>48</td></tr></tbody></table><p data-chart-empty="" hidden="">No data available.</p></figure></j3w1-chart>

Install and register

Use the exact version. If npm publication is pending, install the release tarball from the installation guide.

npm install --save-exact @j3w1/ui@4.0.0
import '@j3w1/ui/tokens.css';
import '@j3w1/ui/styles/chart.css';
import '@j3w1/ui/register/chart';

Insert the maintained markup above after loading these imports. Its native children provide accessible names and form behavior; the empty custom tag alone does not create a control.

Vue SFC, React, Astro and plain HTML integration →

Copy the complete implementation

npx --package=@j3w1/ui@4.0.0 j3w1-ui copy chart --out ./vendor/j3w1/chart

The CLI verifies every file before writing and refuses overwrites. Serve the output over HTTP and open index.html. Keep its modules, CSS, tokens and licence notices together.

Public API

attributes

NameType / signatureMeaning
disabledCustomEventDisable the native controls owned by this instance.
loadingCustomEventMark the primary control busy and prevent duplicate activation.

properties

NameType / signatureMeaning
disabledbooleanDelegates disabled state to native children.
namestringNative control name; application form keys remain explicit.
dataArray<{ label: string; value: number }>Finite non-negative one-series data; at most 200 rows.

methods

NameType / signatureMeaning
refresh(): voidReconnect behavior after replacing native child structure.
focus(options?: FocusOptions): voidFocus the first usable native control.

events

NameType / signatureMeaning

Dependencies and verification

Registered components: none. Style dependencies: none.

Package presence establishes an available implementation. Actual passes depend on the tested artifact and environment. Read specification execution evidence; read packed-consumer evidence; inspect the complete state matrix.

Full implementation manifest, API and token dependency closure

Canonical specification

Chart chart

  • Family: Information display
  • Maturity: stable
  • Priority: R2
  • Since: 1.0.0
  • Native control: Native figure, accessible SVG and table
  • specified
  • demonstrated

A one-series numeric chart with an always-visible complete data table.

Report an issue with this component

Tokens

Focus a role to inspect its values; follow its link for persistent usage and source details.

PartRoleValueUse
root.bgcolor.surface.defaultapproveduse#0d0707D-041 surface.default: color.primitive.modern.panel.
root.textcolor.text.defaultapproveduse#e99499D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
root.bordercolor.border.controlapproveduse#c81a1aD-041 owner correction: red control and floating-frame borders, distinct from rose text.
heading.textcolor.text.brightapproveduse#ffa2a7D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
secondary.textcolor.text.mutedapproveduse#d4868bD-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
control.bgcolor.surface.inputapproveduse#000000Form-control fill.
control.focuscolor.interaction.focus.ringobserveduse#e539351px dashed focus ring on controls and rows.
dependency.role-border-width-defaultborder.width.defaultobserveduse1pxEvery border is 1px.
dependency.role-color-chart-axiscolor.chart.axisobserveduse#9e231fAxis lines.
dependency.role-color-chart-gridcolor.chart.gridobserveduse#2b0e0dGrid lines.
dependency.role-color-chart-labelcolor.chart.labelapproveduse#d4868bD-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
dependency.role-focus-offsetfocus.offsetobserveduse-2pxoutline-offset for controls.
series.primarycolor.chart.series-2observeduse#f73f35Second series.
header.textcolor.text.brightapproveduse#ffa2a7D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
row.textcolor.text.defaultapproveduse#e99499D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
dependency.role-radius-noneradius.noneobserveduse0pxThe only radius. Nothing is rounded.
dependency.role-space-12space.12observeduse12px
dependency.role-space-8space.8observeduse8px

State matrix

Every declared state and combination, statically rendered; the default cell is live. Sizes: compact, comfortable (switch with the density control above).

StateDefault
default
Completed tasks by week
Completed tasks
WeekTasks
Week 124
Week 236
Week 348
empty
loading

Purpose

One bounded numeric series, plotted beside the complete data table that carries its meaning.

Anatomy

Parts as listed in the anatomy; each SVG bar has a text label.

States

StateVisualNon-colour channel
defaultRed primary series (color.chart.series-2), with canonical axis and label roles.Complete labelled data table.
emptyPlot and rows are absent.Explicit No data available text.
loadingExisting data remains readable under a busy indicator.aria-busy with named loading text from the host.

Keyboard

As in the key table.

Accessibility

The table stays visible without JavaScript and is never replaced by tooltips or colour-only legends. Text keeps its rose roles; only the series is red. A loading status distinguishes old data from a completed refresh. Column headers use color.text.bright; row labels and values use color.text.default, while row headers stay native th scope="row". Do not give every th the column-header colour.

Portability

Follows the shared component defaults in spec/portability.md (section “Shared component defaults”).

Non-examples

Unlabelled controls, colour-only status, drag-only operations, hidden required instructions, stolen focus or an invented service success.

Contrast report

5 declared pairs measured on resolved sRGB values with the WCAG 2.x formula; 0 waived (decorative only), 0 failing. A pass is a design target for the named role, not an application-wide conformance claim.

PairStateKindForegroundBackgroundRatioMinResult
chart default textdefaulttextcolor.text.default #e99499color.surface.default #0d07078.724.5pass
chart default borderdefaultuicolor.border.control #c81a1acolor.surface.default #0d07073.443pass
Primary content—textcolor.text.default #e99499color.surface.default #0d07078.724.5pass
Supporting content—textcolor.text.muted #d4868bcolor.surface.default #0d07077.224.5pass
Control boundary—uicolor.border.control #c81a1acolor.surface.default #0d07073.443pass

Keys

KeyAction
TabVisit any scrollable data region. Points do not add unnecessary tab stops.

For agents

Component JSON ·Implementation brief ·Build a task kit ·

Stress fixtures: FX-320 FX-360 FX-ZOOM-200 FX-I18N FX-RTL FX-RM FX-HC FX-TOUCH FX-DENSITY FX-STATE-MATRIX