@automattic/charts 4.2.0 → 4.4.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/index.cjs +533 -127
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +27 -2
  5. package/dist/index.d.ts +27 -2
  6. package/dist/index.js +535 -129
  7. package/dist/index.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/charts/area-chart/area-chart.tsx +42 -10
  10. package/src/charts/area-chart/private/validate-data.ts +2 -3
  11. package/src/charts/area-chart/test/area-chart.test.tsx +72 -1
  12. package/src/charts/bar-chart/bar-chart.tsx +135 -96
  13. package/src/charts/bar-chart/index.ts +1 -1
  14. package/src/charts/bar-chart/private/band-highlight.tsx +3 -1
  15. package/src/charts/bar-chart/private/band-tooltip.tsx +1 -1
  16. package/src/charts/bar-chart/private/classified-bar-series.tsx +85 -0
  17. package/src/charts/bar-chart/private/comparison-bars-geometry.ts +3 -6
  18. package/src/charts/bar-chart/private/index.ts +2 -0
  19. package/src/charts/bar-chart/private/test/band-highlight.test.tsx +28 -2
  20. package/src/charts/bar-chart/private/test/comparison-bars-geometry.test.ts +2 -3
  21. package/src/charts/bar-chart/private/test/value-domain.test.ts +100 -0
  22. package/src/charts/bar-chart/private/use-bar-chart-options.ts +12 -39
  23. package/src/charts/bar-chart/private/value-domain.ts +90 -0
  24. package/src/charts/bar-chart/test/bar-chart.test.tsx +614 -10
  25. package/src/charts/bar-chart/types.ts +43 -0
  26. package/src/charts/line-chart/line-chart.tsx +148 -35
  27. package/src/charts/line-chart/private/index.ts +1 -0
  28. package/src/charts/line-chart/private/line-chart-glyph.tsx +17 -3
  29. package/src/charts/line-chart/private/nearest-pointer-events.tsx +155 -0
  30. package/src/charts/line-chart/test/line-chart.test.tsx +604 -9
  31. package/src/charts/line-chart/types.ts +2 -1
  32. package/src/charts/private/readings.ts +34 -0
  33. package/src/charts/private/test/readings.test.ts +29 -0
  34. package/src/charts/private/test/whole-number-ticks.test.tsx +57 -0
  35. package/src/charts/private/whole-number-ticks.tsx +79 -0
  36. package/src/components/legend/hooks/test/use-chart-legend-items.test.tsx +124 -0
  37. package/src/components/legend/hooks/use-chart-legend-items.ts +60 -2
  38. package/src/components/legend/private/base-legend.tsx +36 -21
  39. package/src/components/legend/test/legend.test.tsx +84 -0
  40. package/src/components/legend/types.ts +2 -0
  41. package/src/components/legend/utils/index.ts +0 -1
  42. package/src/components/tooltip/accessible-tooltip.tsx +1 -1
  43. package/src/hooks/test/use-chart-margin.test.tsx +35 -0
  44. package/src/hooks/use-chart-margin.tsx +7 -2
  45. package/src/providers/chart-context/global-charts-provider.tsx +1 -1
  46. package/src/providers/chart-context/test/chart-context.test.tsx +4 -4
  47. package/src/types.ts +8 -0
  48. package/src/components/legend/utils/label-transform-factory.ts +0 -24
package/CHANGELOG.md CHANGED
@@ -5,6 +5,32 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [4.4.0] - 2026-09-23
9
+ ### Added
10
+ - Bar chart: Add per-datum bar classes and tooltip box style overrides. [#52547]
11
+
12
+ ### Fixed
13
+ - Bar chart: Fix the comparison shadow baseline on horizontal charts whose domain excludes zero. [#52547]
14
+
15
+ ## [4.3.0] - 2026-09-23
16
+ ### Added
17
+ - Add required key and index fields to BandHighlightSelection for identifying the selected series and rendered data point. [#52544]
18
+ - Legend: Add a comparisonItem option that appends a static Comparison period item, and let a legend item opt out of interactivity. Keep comparison items visible when their labels match a metric. [#52423]
19
+
20
+ ### Changed
21
+ - Bar chart: Start the value axis at zero by default; pass `zero: false` on the value scale to fit it to the data. [#52597]
22
+
23
+ ### Fixed
24
+ - Bar chart: Draw a gap for a period with no data instead of refusing to render the chart. [#52522]
25
+ - Bar chart: Give a flat or single-bucket series a value axis with height, so its bars are visible. [#52522]
26
+ - Bar chart: Translate the "No data available" and "Invalid data" messages. [#52522]
27
+ - Line, bar and area charts: Draw gridlines at the ticks set by each axis's `numTicks` and `tickValues`, matching the axis labels. [#52588]
28
+ - Line, bar and area charts: Label the value axis only at whole numbers when every value is a whole number. [#52588]
29
+ - Line chart: Break the line at a period with no data instead of refusing to render the chart. [#52580]
30
+ - LineChart: Round the top of a zero-based value axis from zero, so the line no longer runs into the top edge. [#52601]
31
+ - Line chart: Start the value axis at zero for a flat series, so its line is not drawn halfway up the plot. [#52580]
32
+ - Line chart: Translate the "No data available" and "Invalid data" messages. [#52580]
33
+
8
34
  ## [4.2.0] - 2026-09-18
9
35
  ### Added
10
36
  - Bar chart: Add a beside tooltip placement that flips only horizontally. [#52234]
@@ -1089,6 +1115,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1089
1115
  - Fixed lints following ESLint rule changes for TS [#40584]
1090
1116
  - Fixing a bug in Chart storybook data. [#40640]
1091
1117
 
1118
+ [4.4.0]: https://github.com/Automattic/charts/compare/v4.3.0...v4.4.0
1119
+ [4.3.0]: https://github.com/Automattic/charts/compare/v4.2.0...v4.3.0
1092
1120
  [4.2.0]: https://github.com/Automattic/charts/compare/v4.1.1...v4.2.0
1093
1121
  [4.1.1]: https://github.com/Automattic/charts/compare/v4.1.0...v4.1.1
1094
1122
  [4.1.0]: https://github.com/Automattic/charts/compare/v4.0.0...v4.1.0