File: index.html

package info (click to toggle)
gr-framework 0.73.14%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 11,600 kB
  • sloc: ansic: 87,413; cpp: 45,348; objc: 3,057; javascript: 2,647; makefile: 1,129; python: 1,000; sh: 991; yacc: 855; pascal: 554; fortran: 228
file content (44 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <title>barplot example using gr.js and JSTerm</title>
</head>

<body>
  <div id="grm-1"></div>
  <div id="grm-2"></div>
  <script src="gr.js"></script>
  <script>
    GR.ready(function() {
      let x = [1.0, 2.0, 3.0];
      let y = [4.0, 5.0, 8.0];

      let jsterm = new JSTerm();
      let grm = jsterm.grmInstance();

      // set the anchor for next new plot widget
      jsterm.nextWidgetAnchor("grm-2");
      let args = grm.args_new();
      grm.args_push(args, "kind", "s", "barplot");
      grm.args_push(args, "y", "D", y);
      // switch to plot context with id 1
      grm.switch(1);
      grm.plot(args);
      grm.args_delete(args);

      jsterm.nextWidgetAnchor("grm-1");
      args = grm.args_new();
      grm.args_push(args, "kind", "s", "line");
      grm.args_push(args, "x", "D", x);
      grm.args_push(args, "y", "D", y);
      // switch to plot context with id 2
      grm.switch(2);
      grm.plot(args);
      grm.args_delete(args);
    });
  </script>
</body>

</html>