expressive-charts 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -25,6 +25,29 @@ From 0.1.0:
25
25
 
26
26
  Everything else can still change in a minor release while the library is 0.x: the motion core (`motion`, `createMotion`, the clocks, `tween`, `animated`, `playback`, and the types the list doesn't name), the charts, the adapters, the built-in effects and the controls. Those changes are listed here too. [docs/effects-guide.md](https://github.com/Deaversbp/expressive-charts/blob/main/docs/effects-guide.md) is the guide to the author API.
27
27
 
28
+ ## 0.8.0 (2 November 2026)
29
+
30
+ Time zones by name on a line chart's date axis, and a word for a missing value; charts that measure their text again when it changes size, so spacing a viewer adds after load lays them out again; every bar recoloured at once on `update({ colors })`, and a line chart's decorations drawn below its points; a bar chart's labels fading as they thin, and its bars taking the room of the value labels it hides; and `link()` linking an x with every value missing. Nothing in the effect-author API changes. Every change is outside the promise, and none needs anything written instead.
31
+
32
+ ### Added
33
+
34
+ - **`timeZone` on `lineChart` takes a zone's name** as `Intl` knows it, such as `"Europe/London"`, beside `"UTC"` and `"local"`. Ticks fall on the zone's own midnights, months, years, hours and minutes through summer time, so a day can be 23 or 25 hours, and a midnight the clocks skip is the first time after it, as in local time. Page Up and Page Down go a calendar month in the zone. Names, the tooltip, the table and the announcements say times in it with no zone's name. The zone is read through `Intl.DateTimeFormat`, so no zone data ships. A name it won't take throws a `TypeError`, whose message now says a zone's name is allowed, and `update()` rejects it. `"UTC"` and `"local"` draw as before.
35
+ - **`missing` on `lineChart`:** the word for a missing value, in the table's cell, and after the series' label in the x's name, the tooltip and `markLabel`'s default text ("3: goals no data, 3.6 xg"). Default `"missing"`, so a chart without it reads as before, byte for byte. A string that's empty or only spaces, or anything that isn't a string, throws a `TypeError`, and `update()` rejects it. `update({ missing })` words them again. The bar and donut charts have no missing values, so they don't take it.
36
+
37
+ ### Changed
38
+
39
+ - **A line chart's decorations draw below its points.** The overlay where runs draw is above the lines, their end dots and end labels, and below the points, so nothing an effect draws covers a point being read: on the line page, week 12's hovered goals point shows above the red run. An end dot is part of its line, so a decoration still draws over it. Effects draw as before, and no other chart's overlay moves. In the `<svg>`, the points are in a second `.ec-marks` after the overlay, and `hover: "point"`'s stops come after the x's.
40
+ - **A bar chart's labels fade as an update thins them.** A category or value label the new layout leaves out fades out over the change's first half, and one it draws fades in over its second, as a chart switch fades its unmatched marks. Until now they switched on the change's first frame, and stood on each other while the bars passed. A label drawn on both sides is as before. With motion off, in Analysis, and on a resize or web fonts loading, they switch at once.
41
+ - **A bar chart whose value labels are all hidden lays its bars out longer.** When thinning hides every value label, the layout makes its frame again without their room: past a bar's tip, on the left with negative bars, above the columns and below negative ones. `room` and the ticks' half widths stay, and the names are thinned again on the new frame. A chart whose value labels show lays out as before, and a change between shown and hidden moves the frame as any change does.
42
+
43
+ ### Fixed
44
+
45
+ - **A chart measures its text again when the text changes size.** The bar, donut and line charts measured each text once, as they drew, and again only once web fonts loaded. So spacing a viewer adds after load (WCAG 1.4.12's), or a font or size set on the page, widened the text without a new layout: on Windows, a bar chart's names ran together. Now each chart keeps a hidden line of text, with no class, watched with a `ResizeObserver`. When its width changes, the chart measures again and lays out at once, as when fonts load: a bar chart thins its names again, and its margins fit its text. Until text changes size, every chart draws as before.
46
+ - **`update({ colors })` recolours every bar on the change's first frame.** A bar the change left in place kept its old colour until the change landed. With motion off, and with `colors` alone, it's at once, as before.
47
+ - **Overlays drawn in a stack's later part's colour follow it.** A path drawn in a part's colour (`Paint.part`), as `drawIn` draws a stack's, kept its old colour when a part other than the first changed colour: on our bar chart, and on `expressive()`'s marks when they're read again.
48
+ - **A time that comes twice where the clocks go back reads differently each time.** In local time, and in a zone by its name, each of the two says the zone's short name, as `Intl` words it in the page's locale ("Nov 1, 2026, 1:00 AM EDT" and "Nov 1, 2026, 1:00 AM EST" in `en-US`, "25 Oct 2026, 01:00 BST" and "25 Oct 2026, 01:00 GMT" in `en-GB`), in their names, the tooltip, the table and the announcements. Before, the two read the same. A name that says no time, and the ticks, still name no zone.
49
+ - **`link()` links a line chart's x with every value missing.** It has no point, so its hover told its link nothing, and linked charts ended theirs. Now the link reads a stand-in for a point there: keyed by the x, with the x's row and a sample at the x, whose `value` is `NaN`. So the default linking value and a `by` that reads the row both find it. Hovering or focusing the x hovers the linked charts' marks there, and their hover shows the line chart's crosshair at that x, with no tooltip, as no linked hover has one. No effect runs and no event fires on the line chart for it, as before, and an x with some values links by its points, as before.
50
+
28
51
  ## 0.7.0 (1 November 2026)
29
52
 
30
53
  A new effect, `drawIn`, that draws a mark in along its walk as it enters, a stack part by part, each in its own colour; `morph` pairing two lines by x, so their corners and gaps hold on every frame; a chart switch that draws a line's end dot and a point's ring, and keeps its tab stop on the week; and room above a line chart's plot. In the effect-author API, the one change is `part` on `Paint`, an addition. The other changes are outside the promise, and none needs anything written instead.
package/README.md CHANGED
@@ -15,7 +15,7 @@ Composable motion and expressive effects for web charts. Hover, update and morph
15
15
 
16
16
  Each picture plays once and stops where its effect ends. **[The demo site](https://deaversbp.github.io/expressive-charts/)** has every effect to try, on the library's charts and on D3, Vega-Lite and hand-written ones, with the motion modes and reduced motion.
17
17
 
18
- > **Status: 0.7.0 (November 2026).** The effect-author API is under [the 0.x promise](#the-0x-promise); the charts, adapters, built-in effects and motion core can still change in a minor release. [CHANGELOG.md](https://github.com/Deaversbp/expressive-charts/blob/main/CHANGELOG.md#070-1-november-2026) lists what's new and what changed since 0.6.0.
18
+ > **Status: 0.8.0 (November 2026).** The effect-author API is under [the 0.x promise](#the-0x-promise); the charts, adapters, built-in effects and motion core can still change in a minor release. [CHANGELOG.md](https://github.com/Deaversbp/expressive-charts/blob/main/CHANGELOG.md#080-2-november-2026) lists what's new and what changed since 0.7.0.
19
19
 
20
20
  - **Effects first.** The mark effects `travel`, `flash`, `wiggle`, `pulse`, `trace`, `drawIn` and the data effects `threshold`, `delta` and `label`, put together with `sequence`, `parallel`, `only` and `stagger`; and the transition effect `morph`, which `chartSwitch` plays to turn each mark of one chart into its mark in the next (a transition can't go into a combinator). An effect reads only a shared description of the mark, so one effect works on every chart, and effects of your own work everywhere the built-in ones do.
21
21
  - **Charts and adapters.** Bar, donut and line charts, a switch that morphs one into another, adapters that bring the same effects to SVG marks drawn by other code, and hover linked across them.
@@ -28,13 +28,13 @@ Each picture plays once and stops where its effect ends. **[The demo site](https
28
28
  npm install expressive-charts
29
29
  ```
30
30
 
31
- It has no runtime dependencies. It's an ES module and CommonJS, each with its own types, and its JavaScript has no side effects, so a bundler keeps only what a page imports: a bar chart is about 31 KB gzipped, and everything 87 KB.
31
+ It has no runtime dependencies. It's an ES module and CommonJS, each with its own types, and its JavaScript has no side effects, so a bundler keeps only what a page imports: a bar chart is about 32 KB gzipped, and everything 88 KB.
32
32
 
33
33
  On a page with no bundler, the script-tag bundle defines one global, `ExpressiveCharts`, holding the main entry:
34
34
 
35
35
  ```html
36
36
  <div id="sales"></div>
37
- <script src="https://cdn.jsdelivr.net/npm/expressive-charts@0.7/dist/expressive-charts.global.js"></script>
37
+ <script src="https://cdn.jsdelivr.net/npm/expressive-charts@0.8/dist/expressive-charts.global.js"></script>
38
38
  <script>
39
39
  const { barChart } = ExpressiveCharts;
40
40
  barChart("#sales", {
@@ -124,10 +124,10 @@ playButton("#play", season, { labels: { play: "Play season" } });
124
124
 
125
125
  [docs/api.md](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md) documents every export, with its options, their defaults and what it returns.
126
126
 
127
- - **Charts.** [`barChart`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#barchart) draws bars or columns, plain or stacked; [`donutChart`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#donutchart) shares of a total; [`lineChart`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#linechart) a line per series, straight or, with `curve: "monotone"`, curved through every value without going past it, on a number axis or, when `x` gives `Date`s, a time axis in UTC (or `timeZone: "local"`) worded in the page's locale, with a gap wherever a value is `null` or `undefined`, hovering every series at an x with a crosshair or, with `hover: "point"`, the one point nearest the pointer, the other lines dimmed. Each sizes itself to its container, follows the light or dark theme, and has a tooltip, a legend, a data table and keyboard focus. Its handle has `update()`, which animates a change by the motion mode, and `update({ on })` swaps its effects in place; `focus(key)`; `leave()`, which ends its hover; and `labels()`. `table.series` heads a series' column in the data table.
127
+ - **Charts.** [`barChart`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#barchart) draws bars or columns, plain or stacked; [`donutChart`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#donutchart) shares of a total; [`lineChart`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#linechart) a line per series, straight or, with `curve: "monotone"`, curved through every value without going past it, on a number axis or, when `x` gives `Date`s, a time axis in UTC (or `timeZone: "local"`, or a zone's name such as `"Europe/London"`) worded in the page's locale, with a gap wherever a value is `null` or `undefined`, which its names, tooltip and table say is `missing` ("missing" by default), hovering every series at an x with a crosshair or, with `hover: "point"`, the one point nearest the pointer, the other lines dimmed. Each sizes itself to its container, follows the light or dark theme, and has a tooltip, a legend, a data table and keyboard focus. Its handle has `update()`, which animates a change by the motion mode, and `update({ on })` swaps its effects in place; `focus(key)`; `leave()`, which ends its hover; and `labels()`. `table.series` heads a series' column in the data table.
128
128
  - **Switching.** [`chartSwitch`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#chartswitch) shows views of the same data one at a time, and turns each mark into its own mark in the next with [`morph()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#morph): a donut becoming columns, a line chart's points growing into columns keyed as they are, or one line chart's lines becoming another's, and back from wherever it is. Each mark keeps its view's colour, a line its end dot and a point its ring, and focus follows the x, or the tab stop does when focus is on a toggle. Its `on()`, `marks()` and `leave()` are the view on show's, and it can be linked like a chart.
129
129
  - **Adapters.** [`expressive()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#expressive) reads keys, rows and geometry from SVG marks drawn by D3, Observable Plot or by hand, with only a key: rects as bars, circles as points, a pie's or a donut's paths as slices, clockwise from 12 o'clock, and other paths, lines, polylines, polygons, ellipses and turned rects as shapes, through their transforms, a non-scaling stroke at its width on screen. It draws on an overlay, leaving the host's styling alone; `watch: true` follows the host's own transitions. A curve, or a line drawn with d3's `.defined()`, is read from its own path data, with its gaps, and no effect draws inside them; `geometry` describes anything else, or a mark as you'd rather have it. Observable Plot binds each rect or dot to its row's index, so pass `datum: (el) => rows[el.__data__]`; Plot draws a new `<svg>` each time, so pass `refresh()` the new one's marks. The Plot accessors are tested against Plot 0.6.17. [`fromVegaView()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#fromvegaview) does the same for a Vega or Vega-Lite View rendered as SVG, and follows its renders; a line breaks where Vega-Lite leaves out a missing value, and a curve is read from the path Vega draws. Both change their effects in place with `update({ on })`, as a chart does, and `leave()` ends their hover.
130
- - **Linked hover.** [`link()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#link) links hover across charts, chart switches and attachments by a value their marks share, such as a column's matchweek and the line's x there: hovering one hovers the others' marks with that value, with their emphasis, dimming and hover effects, as `source: "linked"`. Linked charts show no tooltip and take no focus.
130
+ - **Linked hover.** [`link()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#link) links hover across charts, chart switches and attachments by a value their marks share, such as a column's matchweek and the line's x there: hovering one hovers the others' marks with that value, with their emphasis, dimming and hover effects, as `source: "linked"`. Linked charts show no tooltip and take no focus. A line chart's x with every value missing links by its x, and a link's hover there shows the line's crosshair.
131
131
  - **Effects.** [`travel`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#travel) carries an icon along a mark; [`flash`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#flash), [`wiggle`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#wiggle) and [`pulse`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#pulse) draw attention without changing a value; [`trace`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#trace) draws a highlighter stroke along a mark and leaves it there; [`drawIn`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#drawin) draws a mark in along its walk as it enters, a stack part by part in its colours; [`threshold`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#threshold) colours the parts of a mark below or above a reference; [`delta`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#delta) labels a mark's change since the last update ("+2"), and [`label`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#label) any text worked out from its data, past the mark's own labels and clear of other effects' text. Each goes in an effect slot (`hover`, `enter`, `update`, `exit`, `decorate`), as an effect or a preset's name (`"wiggle"`).
132
132
  - **Controls.** [`motionSwitch()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#motionswitch) is the viewer's own choice of mode. [`playback()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#playback) plays a value through a range, and [`playButton()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#playbutton) is its Play/Pause button.
133
133
  - **The motion core.** [`motion`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#motion), [`tween()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#tween) and [`animated()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#animated), for animations of your own that follow the same modes.