@internetstiftelsen/charts 0.13.3 → 0.14.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/README.md +4 -1
- package/dist/area.js +2 -1
- package/dist/bar.js +8 -4
- package/dist/base-chart.d.ts +1 -0
- package/dist/base-chart.js +2 -0
- package/dist/donut-chart.d.ts +19 -3
- package/dist/donut-chart.js +129 -25
- package/dist/easing.d.ts +1 -0
- package/dist/easing.js +30 -0
- package/dist/gauge-chart.d.ts +7 -2
- package/dist/gauge-chart.js +43 -18
- package/dist/line.js +2 -1
- package/dist/pie-chart.d.ts +19 -3
- package/dist/pie-chart.js +160 -59
- package/dist/radial-animation.d.ts +69 -0
- package/dist/radial-animation.js +416 -0
- package/dist/radial-chart-base.d.ts +24 -1
- package/dist/radial-chart-base.js +181 -0
- package/dist/scatter.js +2 -1
- package/dist/theme.d.ts +15 -0
- package/dist/theme.js +90 -4
- package/dist/types.d.ts +1 -0
- package/dist/xy-motion/config.js +3 -0
- package/dist/xy-motion/types.d.ts +1 -1
- package/docs/donut-chart.md +57 -14
- package/docs/gauge-chart.md +14 -0
- package/docs/pie-chart.md +58 -16
- package/docs/theming.md +17 -12
- package/docs/xy-chart.md +10 -0
- package/package.json +26 -26
package/docs/theming.md
CHANGED
|
@@ -18,7 +18,7 @@ const chart = new XYChart({
|
|
|
18
18
|
bottom: 40,
|
|
19
19
|
left: 60,
|
|
20
20
|
},
|
|
21
|
-
colorPalette: ['#
|
|
21
|
+
colorPalette: ['#ff4069', '#c51f46', '#ff7f99', '#ffb3c2'],
|
|
22
22
|
grid: {
|
|
23
23
|
color: '#e0e0e0',
|
|
24
24
|
opacity: 0.5,
|
|
@@ -42,9 +42,14 @@ const chart = new XYChart({
|
|
|
42
42
|
Built-in theme presets are exported from `@internetstiftelsen/charts/theme`:
|
|
43
43
|
|
|
44
44
|
```javascript
|
|
45
|
-
import { defaultTheme,
|
|
45
|
+
import { defaultTheme, rubyTheme, themes } from '@internetstiftelsen/charts/theme';
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
`defaultTheme` uses a mixed Internetstiftelsen palette. Accent presets are available as
|
|
49
|
+
`rubyTheme`, `peacockTheme`, `jadeTheme`, `lemonTheme`, and `oceanTheme`, and
|
|
50
|
+
through the `themes` map as `themes.default`, `themes.ruby`,
|
|
51
|
+
`themes.peacock`, `themes.jade`, `themes.lemon`, and `themes.ocean`.
|
|
52
|
+
|
|
48
53
|
## Theme Options
|
|
49
54
|
|
|
50
55
|
| Option | Type | Default | Description |
|
|
@@ -75,10 +80,10 @@ The color palette is used for automatic color assignment. Series without explici
|
|
|
75
80
|
```javascript
|
|
76
81
|
theme: {
|
|
77
82
|
colorPalette: [
|
|
78
|
-
'#
|
|
79
|
-
'#
|
|
80
|
-
'#
|
|
81
|
-
'#
|
|
83
|
+
'#ff4069', // First series
|
|
84
|
+
'#c51f46', // Second series
|
|
85
|
+
'#ff7f99', // Third series
|
|
86
|
+
'#ffb3c2', // Fourth series
|
|
82
87
|
// ... continues cycling
|
|
83
88
|
],
|
|
84
89
|
}
|
|
@@ -92,20 +97,20 @@ Override auto-colors by specifying colors directly on series:
|
|
|
92
97
|
|
|
93
98
|
```javascript
|
|
94
99
|
// Lines
|
|
95
|
-
chart.addChild(new Line({ dataKey: 'revenue', stroke: '#
|
|
96
|
-
chart.addChild(new Line({ dataKey: 'expenses', stroke: '#
|
|
100
|
+
chart.addChild(new Line({ dataKey: 'revenue', stroke: '#ff4069' }));
|
|
101
|
+
chart.addChild(new Line({ dataKey: 'expenses', stroke: '#c51f46' }));
|
|
97
102
|
|
|
98
103
|
// Bars
|
|
99
|
-
chart.addChild(new Bar({ dataKey: 'sales', fill: '#
|
|
104
|
+
chart.addChild(new Bar({ dataKey: 'sales', fill: '#ff4069' }));
|
|
100
105
|
```
|
|
101
106
|
|
|
102
107
|
For DonutChart, specify colors in the data:
|
|
103
108
|
|
|
104
109
|
```javascript
|
|
105
110
|
const data = [
|
|
106
|
-
{ name: 'Desktop', value: 450, color: '#
|
|
107
|
-
{ name: 'Mobile', value: 320, color: '#
|
|
108
|
-
{ name: 'Tablet', value: 130, color: '#
|
|
111
|
+
{ name: 'Desktop', value: 450, color: '#ff4069' },
|
|
112
|
+
{ name: 'Mobile', value: 320, color: '#c51f46' },
|
|
113
|
+
{ name: 'Tablet', value: 130, color: '#ff7f99' },
|
|
109
114
|
];
|
|
110
115
|
```
|
|
111
116
|
|
package/docs/xy-chart.md
CHANGED
|
@@ -252,6 +252,7 @@ animate: boolean | {
|
|
|
252
252
|
| 'ease-in-out'
|
|
253
253
|
| 'bounce-out'
|
|
254
254
|
| 'elastic-out'
|
|
255
|
+
| 'spring-out'
|
|
255
256
|
| `linear(...)`
|
|
256
257
|
| ((t: number) => number),
|
|
257
258
|
}
|
|
@@ -261,6 +262,7 @@ Notes:
|
|
|
261
262
|
|
|
262
263
|
- Animation is off by default.
|
|
263
264
|
- Animates XY series marks only. Axes, legends, tooltips, and value labels remain static.
|
|
265
|
+
- `spring-out` is a duration-based cubic-bezier preset.
|
|
264
266
|
- Visual exports always render the final static state, even when the live chart is animated.
|
|
265
267
|
|
|
266
268
|
## Validation
|
|
@@ -344,6 +346,7 @@ new Line({
|
|
|
344
346
|
}, // Data point visibility (default: 'always')
|
|
345
347
|
valueLabel?: {
|
|
346
348
|
show?: boolean,
|
|
349
|
+
forceVisible?: boolean,
|
|
347
350
|
formatter?: (dataKey, value, data) => string
|
|
348
351
|
} // Point value badges
|
|
349
352
|
})
|
|
@@ -386,6 +389,7 @@ new Scatter({
|
|
|
386
389
|
pointSize?: number, // Point radius in pixels (default: theme.line.point.size)
|
|
387
390
|
valueLabel?: {
|
|
388
391
|
show?: boolean,
|
|
392
|
+
forceVisible?: boolean,
|
|
389
393
|
formatter?: (dataKey, value, data) => string
|
|
390
394
|
} // Point value badges
|
|
391
395
|
})
|
|
@@ -414,6 +418,7 @@ new Bar({
|
|
|
414
418
|
show?: boolean,
|
|
415
419
|
position?: 'inside' | 'outside',
|
|
416
420
|
insidePosition?: 'top' | 'middle' | 'bottom',
|
|
421
|
+
forceVisible?: boolean,
|
|
417
422
|
formatter?: (dataKey, value, data) => string
|
|
418
423
|
}
|
|
419
424
|
})
|
|
@@ -543,6 +548,7 @@ new Area({
|
|
|
543
548
|
showPoints?: boolean, // Show points on top line (default: false)
|
|
544
549
|
valueLabel?: {
|
|
545
550
|
show?: boolean,
|
|
551
|
+
forceVisible?: boolean,
|
|
546
552
|
formatter?: (dataKey, value, data) => string
|
|
547
553
|
} // Point value badges
|
|
548
554
|
})
|
|
@@ -567,6 +573,10 @@ For `Line`, `Scatter`, `Bar`, and `Area`, `valueLabel.formatter` receives
|
|
|
567
573
|
`(dataKey, value, data)`, where `value` is the parsed numeric series value used
|
|
568
574
|
for rendering that label.
|
|
569
575
|
|
|
576
|
+
Set `valueLabel.forceVisible: true` to render labels even when automatic fit
|
|
577
|
+
checks would normally hide them, such as tiny stacked bar segments or point
|
|
578
|
+
labels that cannot fit above or below the point.
|
|
579
|
+
|
|
570
580
|
### Area Stacking
|
|
571
581
|
|
|
572
582
|
Area charts support stacking when series share the same `stackId`:
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.14.0",
|
|
3
3
|
"name": "@internetstiftelsen/charts",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
@@ -42,45 +42,45 @@
|
|
|
42
42
|
"xlsx": "^0.18.5"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@eslint/js": "^
|
|
46
|
-
"@handsontable/react-wrapper": "^
|
|
47
|
-
"@internetstiftelsen/styleguide": "^5.1.
|
|
45
|
+
"@eslint/js": "^10.0.1",
|
|
46
|
+
"@handsontable/react-wrapper": "^17.1.0",
|
|
47
|
+
"@internetstiftelsen/styleguide": "^5.1.27",
|
|
48
48
|
"@radix-ui/react-label": "^2.1.8",
|
|
49
49
|
"@radix-ui/react-select": "^2.2.6",
|
|
50
50
|
"@radix-ui/react-switch": "^1.2.6",
|
|
51
51
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
52
52
|
"@speed-highlight/core": "^1.2.15",
|
|
53
|
-
"@tailwindcss/vite": "^4.
|
|
53
|
+
"@tailwindcss/vite": "^4.3.0",
|
|
54
54
|
"@testing-library/dom": "^10.4.1",
|
|
55
55
|
"@testing-library/jest-dom": "^6.9.1",
|
|
56
56
|
"@testing-library/react": "^16.3.2",
|
|
57
57
|
"@types/d3": "^7.4.3",
|
|
58
58
|
"@types/d3-cloud": "^1.2.9",
|
|
59
|
-
"@types/node": "^
|
|
60
|
-
"@types/react": "^19.2.
|
|
59
|
+
"@types/node": "^25.9.1",
|
|
60
|
+
"@types/react": "^19.2.15",
|
|
61
61
|
"@types/react-dom": "^19.2.3",
|
|
62
|
-
"@vitejs/plugin-react-swc": "^4.3.
|
|
62
|
+
"@vitejs/plugin-react-swc": "^4.3.1",
|
|
63
63
|
"class-variance-authority": "^0.7.1",
|
|
64
64
|
"clsx": "^2.1.1",
|
|
65
|
-
"eslint": "^
|
|
66
|
-
"eslint-plugin-react-hooks": "^7.
|
|
67
|
-
"eslint-plugin-react-refresh": "^0.
|
|
68
|
-
"globals": "^
|
|
69
|
-
"handsontable": "^
|
|
70
|
-
"jsdom": "^
|
|
71
|
-
"lucide-react": "^
|
|
72
|
-
"prettier": "3.
|
|
65
|
+
"eslint": "^10.4.0",
|
|
66
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
67
|
+
"eslint-plugin-react-refresh": "^0.5.2",
|
|
68
|
+
"globals": "^17.6.0",
|
|
69
|
+
"handsontable": "^17.1.0",
|
|
70
|
+
"jsdom": "^29.1.1",
|
|
71
|
+
"lucide-react": "^1.16.0",
|
|
72
|
+
"prettier": "3.8.3",
|
|
73
73
|
"radix-ui": "^1.4.3",
|
|
74
|
-
"react": "^19.2.
|
|
75
|
-
"react-dom": "^19.2.
|
|
76
|
-
"sass": "^1.
|
|
77
|
-
"tailwind-merge": "^3.
|
|
78
|
-
"tailwindcss": "^4.
|
|
79
|
-
"tsc-alias": "^1.8.
|
|
74
|
+
"react": "^19.2.6",
|
|
75
|
+
"react-dom": "^19.2.6",
|
|
76
|
+
"sass": "^1.100.0",
|
|
77
|
+
"tailwind-merge": "^3.6.0",
|
|
78
|
+
"tailwindcss": "^4.3.0",
|
|
79
|
+
"tsc-alias": "^1.8.17",
|
|
80
80
|
"tw-animate-css": "^1.4.0",
|
|
81
|
-
"typescript": "~
|
|
82
|
-
"typescript-eslint": "^8.
|
|
83
|
-
"vite": "^
|
|
84
|
-
"vitest": "^4.1.
|
|
81
|
+
"typescript": "~6.0.3",
|
|
82
|
+
"typescript-eslint": "^8.59.4",
|
|
83
|
+
"vite": "^8.0.14",
|
|
84
|
+
"vitest": "^4.1.7"
|
|
85
85
|
}
|
|
86
86
|
}
|