@ruckc/truss-chart 1.5.1 → 1.6.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/dist/BarChart.svelte +1 -1
- package/dist/LineChart.svelte +1 -1
- package/dist/types.d.ts +6 -0
- package/package.json +1 -1
package/dist/BarChart.svelte
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
type Tip = { x: number; y: number; cat: string; name: string; value: number; color: string; share?: number };
|
|
36
36
|
let tip = $state<Tip | null>(null);
|
|
37
37
|
|
|
38
|
-
const all = $derived(series.slice(0, MAX_SERIES).map((s, i) => ({ ...s, i, color: seriesColor(i) })));
|
|
38
|
+
const all = $derived(series.slice(0, MAX_SERIES).map((s, i) => ({ ...s, i, color: s.color ?? seriesColor(i) })));
|
|
39
39
|
const vis = $derived(all.filter((s) => !hidden.includes(s.name)));
|
|
40
40
|
const items = $derived(all.map((s) => ({ name: s.name, color: s.color, hidden: hidden.includes(s.name) })));
|
|
41
41
|
const toggle = (n: string) => (hidden = hidden.includes(n) ? hidden.filter((h) => h !== n) : [...hidden, n]);
|
package/dist/LineChart.svelte
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
let hidden = $state<string[]>([]);
|
|
36
36
|
let hover = $state<number | null>(null);
|
|
37
37
|
|
|
38
|
-
const all = $derived(series.slice(0, MAX_SERIES).map((s, i) => ({ ...s, i, color: seriesColor(i) })));
|
|
38
|
+
const all = $derived(series.slice(0, MAX_SERIES).map((s, i) => ({ ...s, i, color: s.color ?? seriesColor(i) })));
|
|
39
39
|
const vis = $derived(all.filter((s) => !hidden.includes(s.name)));
|
|
40
40
|
const isDate = $derived(x[0] instanceof Date);
|
|
41
41
|
const xs = $derived(x.map((v) => +v));
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export type Series = {
|
|
2
2
|
name: string;
|
|
3
3
|
values: (number | null)[];
|
|
4
|
+
/**
|
|
5
|
+
* Overrides the series' palette slot. Any CSS colour or `var(--…)`, used for its line, area, bars,
|
|
6
|
+
* legend swatch and tooltip swatch. Custom colours bypass the validated colour-blind-safe palette,
|
|
7
|
+
* so you are responsible for contrast and for keeping series distinguishable from each other.
|
|
8
|
+
*/
|
|
9
|
+
color?: string;
|
|
4
10
|
};
|
|
5
11
|
export type LegendItem = {
|
|
6
12
|
name: string;
|