Skip to content

Commit 21c5cff

Browse files
committed
Fix transition events sample
1 parent cb0fae0 commit 21c5cff

File tree

1 file changed

+41
-24
lines changed

1 file changed

+41
-24
lines changed

docs/features/Transition-Events.mdx

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,48 @@ By default, the <TypeLink type="ProcessMining" /> component provides bluish tran
2121

2222
<Playground
2323
code={`
24-
function App () {
25-
const [ showTransitionEvents, setShowTransitionEvents ] = useState(true)
26-
const [ timestamp, setTimestamp ] = useState(5)
27-
const maxCaseId = 100
24+
function App() {
25+
const [showTransitionEvents, setShowTransitionEvents] = useState(true);
26+
const [timestamp, setTimestamp] = useState(5);
27+
const maxCaseId = 100;
28+
29+
return (
30+
<ProcessMining
31+
eventLog={data}
32+
timestamp={timestamp}
33+
showTransitionEvents={showTransitionEvents}
34+
transitionEventStyling={(previousEvent, _) => ({
35+
size: 15,
36+
hue: (parseInt(previousEvent.caseId as string) / maxCaseId) * 360,
37+
})}
38+
showHeatmap={false}
39+
>
40+
<div className="options">
41+
<div>
42+
<span>Timestamp</span>
43+
<input
44+
type="range"
45+
min={0}
46+
max={30}
47+
onInput={(e) => {
48+
setTimestamp(parseFloat((e.target as HTMLInputElement).value));
49+
}}
50+
value={timestamp}
51+
/>
52+
</div>
53+
<div>
54+
<input
55+
type="checkbox"
56+
onChange={(event) => setShowTransitionEvents(event.target.checked)}
57+
checked={showTransitionEvents}
58+
/>
59+
<span>Hide Transition Events</span>
60+
</div>
61+
</div>
62+
</ProcessMining>
63+
);
64+
}
2865
29-
return (
30-
<ProcessMining
31-
eventLog={data}
32-
timestamp={timestamp}
33-
showTransitionEvents={showTransitionEvents}
34-
transitionEvent={(previousEvent, _) => ({ size: 15, hue: (previousEvent.caseId / maxCaseId) * 360 })}
35-
showHeatmap={false}>
36-
<div className="options">
37-
<div>
38-
<span>Timestamp</span>
39-
<input type="range" min={0} max={30} onInput={e => { setTimestamp(parseFloat((e.target as HTMLInputElement).value)) }} value={timestamp}/ >
40-
</div>
41-
<div>
42-
<input type="checkbox" onChange={(event) => setShowTransitionEvents(event.target.checked)} checked={showTransitionEvents}/ >
43-
<span>Hide Transition Events</span>
44-
</div>
45-
</div>
46-
</ProcessMining>
47-
)
48-
}
4966
`}
5067
data={`[
5168
{ caseId: 0, activity: 'Start', timestamp: 8.383561495922297, duration: 0.0006804154279300233 },

0 commit comments

Comments
 (0)