Files
JiboSDK/lib/robot-info-tab/views/streaming-graph.js
2026-03-22 03:21:45 +02:00

1 line
1.4 KiB
JavaScript

"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=function(){function t(t,e){for(var n in e){var i=e[n];i.configurable=!0,i.value&&(i.writable=!0)}Object.defineProperties(t,e)}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),n=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},i=t(require("../../../node_modules/vis/dist/vis.js")),o=function(){function t(e,o,a){n(this,t),this.container=e,this.groups=new i.DataSet;for(var s in o)this.setGroup(s,o[s].content,o[s].style,o[s].options);this.dataset=new i.DataSet,this.options={start:-30,end:1e3,timeAxis:{scale:"second",step:1},width:"100%",height:"100%",dataAxis:{left:{range:{min:-8,max:8},title:{text:a}}},legend:{left:{position:"bottom-left"}},drawPoints:!1,shaded:{orientation:"bottom"},zoomMax:5e4,zoomMin:1e4},this.graph2d=new i.Graph2d(this.container,this.dataset,this.groups,this.options)}return e(t,{setGroup:{value:function(t,e,n,i){this.groups.add({id:t,content:e,style:n,options:i})}},renderStep:{value:function(){var t=i.moment(),e=this.graph2d.getWindow(),n=e.end-e.start;this.graph2d.setWindow(t-n,t,{animation:!1})}},addDataPoint:{value:function(t,e){var n=i.moment();this.dataset.add({x:n,y:e,group:t});var o=this.graph2d.getWindow(),a=o.end-o.start,s=this.dataset.getIds({filter:function(t){return t.x<o.start-a}});this.dataset.remove(s)}}}),t}();module.exports=o;