Skip to content

Commit cb54e63

Browse files
committed
Add demo with TH3 creation, draw and update
1 parent 1ba608c commit cb54e63

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

demo/th3.htm

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Create, draw and update TH3 object</title>
6+
<script src="../scripts/JSRoot.core.js" type="text/javascript"></script>
7+
</head>
8+
<body>
9+
<div id="object_draw" style="width: 1200px; height: 800px"></div>
10+
11+
<script type='text/javascript'>
12+
let cnt = 0;
13+
let histo = JSROOT.createHistogram("TH3I", 20, 20, 20);
14+
histo.fXaxis.fXmin = -10;
15+
histo.fXaxis.fXmax = 10;
16+
histo.fYaxis.fXmin = -10;
17+
histo.fYaxis.fXmax = 10;
18+
histo.fZaxis.fXmin = -10;
19+
histo.fZaxis.fXmax = 10;
20+
histo.fName = "generated";
21+
histo.fFillColor = 3;
22+
23+
function updateGUI() {
24+
histo.fTitle = "Drawing " + cnt++;
25+
26+
let angle1 = cnt*Math.PI/70, angle2 = cnt*Math.PI/10;
27+
28+
histo.Fill(9*Math.sin(angle1), 9*Math.cos(angle2), 9*Math.sin(angle2));
29+
30+
JSROOT.redraw('object_draw', histo, "box2");
31+
}
32+
33+
updateGUI();
34+
setInterval(updateGUI, 300);
35+
</script>
36+
37+
</body>
38+
</html>
39+

0 commit comments

Comments
 (0)