rahdune.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* hello I think you are cute
  2. */
  3. // this should already be a Highcharts::chart
  4. if('undefined' == typeof(chart)) throw new Error("rahdune.js needs someone, probably graph.php to define a variable that contains a Highcharts.chart called chart, okay bye");
  5. /* theGraph.series[] contains the various series objects, each identified to
  6. * highcharts using theGraph.series[objN.id ..]
  7. *
  8. * theGraph.series is actually associated with theGraph when it is instantiated
  9. * as a property of options, seen here:
  10. * const chart = Highcharts.chart('container', options);
  11. *
  12. * I am sure that we can manipulate options, but unsure if references are
  13. * maintained after instantiating, or maybe Highcharts::chart has a nice API
  14. * for what we want, which is to group control groups of series
  15. */
  16. // some buttons that know what is what
  17. var defaultButton = document.createElement("button");
  18. let buttons = [];
  19. // make a toggle button to turn off all radon measurements
  20. var rahdunBtn = defaultButton.cloneNode();
  21. rahdunBtn.appendChild(document.createTextNode("rAhDuN3"));
  22. //buttons.push(rahdunBtn);
  23. // attach buttons
  24. buttons.forEach(function(el, i, ar) { document.body.appendChild(el); });
  25. // when users click the radon button it should turn off all the radon readins
  26. rahdunBtn.onclick = function() {};
  27. // add series to HighCharts, this requires a predefined variable called 'series'
  28. series.forEach(function(el, i, ar) {
  29. /* el properties:
  30. * + data - Highcharts Series Options Structure
  31. * + em - Emma id for sensors, A, B, C, D, ..., Z
  32. * + type - what kind of sensor is this
  33. * one el will be provided per sensor, it is possible for a single
  34. * el.em to be provided multiple times, if a sensor has multiple sensors.
  35. * If that does not make sense, lol. We call a group of sensors a sensor,
  36. * and sensors can move, so we really have to stick with Emma id.
  37. */
  38. let ser = chart.addSeries(el.data, /*redraw*/false);
  39. //document.body.appendChild(el);
  40. //chart.addSeries(
  41. });
  42. // render once all data has been added
  43. chart.redraw();