@adecore/charts 0.49.6 → 0.49.7
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/timeline-layout.js +12 -5
- package/package.json +3 -3
- package/src/timeline-layout.ts +14 -5
package/dist/timeline-layout.js
CHANGED
|
@@ -32,9 +32,11 @@ export function timelineTree(spans) {
|
|
|
32
32
|
};
|
|
33
33
|
visit(children.get(null) ?? [], []);
|
|
34
34
|
// Spans of a parent cycle reach no root; each that is left starts a tree of its own.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
if (placed.size < known.size) {
|
|
36
|
+
for (const span of spans.filter(span => !placed.has(span.id)).toSorted(byStart)) {
|
|
37
|
+
if (!placed.has(span.id)) {
|
|
38
|
+
visit([span], []);
|
|
39
|
+
}
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
return rows;
|
|
@@ -55,8 +57,13 @@ export function timelineExtent(spans, fixedEnd) {
|
|
|
55
57
|
total: 1
|
|
56
58
|
};
|
|
57
59
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
let origin = Infinity;
|
|
61
|
+
let latest = -Infinity;
|
|
62
|
+
for (const span of spans) {
|
|
63
|
+
origin = Math.min(origin, span.start);
|
|
64
|
+
latest = Math.max(latest, span.start + span.duration);
|
|
65
|
+
}
|
|
66
|
+
const end = fixedEnd ?? latest;
|
|
60
67
|
return {
|
|
61
68
|
origin,
|
|
62
69
|
total: Math.max(end - origin, 0.001)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/charts",
|
|
3
|
-
"version": "0.49.
|
|
3
|
+
"version": "0.49.7",
|
|
4
4
|
"description": "Series charts, scatters, heatmaps, trace timelines and sparklines in the theme of @adecore/ui, readable by keyboard and screen reader.",
|
|
5
5
|
"license": "FSL-1.1-MIT",
|
|
6
6
|
"author": "Bas Milius",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"lucide-react": "^1.65.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@adecore/ui": "^0.49.
|
|
46
|
+
"@adecore/ui": "^0.49.7",
|
|
47
47
|
"i18next": "^26.4.2",
|
|
48
48
|
"react": "^19.3.0",
|
|
49
49
|
"react-dom": "^19.3.0",
|
|
50
50
|
"react-i18next": "^17.0.15"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@adecore/ui": "0.49.
|
|
53
|
+
"@adecore/ui": "0.49.7",
|
|
54
54
|
"@types/bun": "^1.4.4",
|
|
55
55
|
"@types/react": "^19.3.0",
|
|
56
56
|
"@types/react-dom": "^19.3.0",
|
package/src/timeline-layout.ts
CHANGED
|
@@ -71,9 +71,11 @@ export function timelineTree<Span extends TimelineSpan>(spans: readonly Span[]):
|
|
|
71
71
|
visit(children.get(null) ?? [], []);
|
|
72
72
|
|
|
73
73
|
// Spans of a parent cycle reach no root; each that is left starts a tree of its own.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
if (placed.size < known.size) {
|
|
75
|
+
for (const span of spans.filter((span) => !placed.has(span.id)).toSorted(byStart)) {
|
|
76
|
+
if (!placed.has(span.id)) {
|
|
77
|
+
visit([span], []);
|
|
78
|
+
}
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
|
|
@@ -96,8 +98,15 @@ export function timelineExtent(spans: readonly TimelineSpan[], fixedEnd?: number
|
|
|
96
98
|
return { origin: 0, total: 1 };
|
|
97
99
|
}
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
let origin = Infinity;
|
|
102
|
+
let latest = -Infinity;
|
|
103
|
+
|
|
104
|
+
for (const span of spans) {
|
|
105
|
+
origin = Math.min(origin, span.start);
|
|
106
|
+
latest = Math.max(latest, span.start + span.duration);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const end = fixedEnd ?? latest;
|
|
101
110
|
|
|
102
111
|
return { origin, total: Math.max(end - origin, 0.001) };
|
|
103
112
|
}
|