aframe-babia-components 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/components/filters/babia-selector.js +256 -79
  2. package/components/filters/babia-treebuilder.js +1 -2
  3. package/components/geometries/babia-cyl.js +180 -0
  4. package/components/others/assets/tooltip.png +0 -0
  5. package/components/others/babia-camera.js +195 -0
  6. package/components/others/babia-controls.js +56 -31
  7. package/components/others/babia-navigator.js +55 -49
  8. package/components/others/babia-range-selector.js +208 -0
  9. package/components/others/babia-slider.js +36 -8
  10. package/components/others/babia-ui.js +246 -73
  11. package/components/others/common.js +60 -73
  12. package/components/queriers/babia-querycsv.js +96 -0
  13. package/components/queriers/babia-queryes.js +203 -132
  14. package/components/visualizers/babia-bars.js +4 -35
  15. package/components/visualizers/babia-barsmap.js +2 -30
  16. package/components/visualizers/babia-boats.js +92 -100
  17. package/components/visualizers/babia-bubbles.js +9 -26
  18. package/components/visualizers/babia-cyls.js +197 -201
  19. package/components/visualizers/babia-cylsmap.js +171 -241
  20. package/components/visualizers/babia-doughnut.js +2 -28
  21. package/components/visualizers/babia-network.js +191 -124
  22. package/components/visualizers/babia-pie.js +2 -30
  23. package/dist/aframe-babia-components.js +21678 -19529
  24. package/dist/aframe-babia-components.min.js +7 -1
  25. package/dist/aframe-babia-components.min.js.map +1 -1
  26. package/docs/APIs/CHARTS.md +10 -4
  27. package/docs/APIs/DATAMANAGEMENT.md +7 -0
  28. package/docs/APIs/OTHERS.md +27 -0
  29. package/docs/APIs/QUERIERS.md +16 -0
  30. package/docs/RELEASE_NOTES.md +32 -21
  31. package/docs/Tutorials/multiuser.md +47 -2
  32. package/examples/assets/door/New Bitmap Image.jpg +0 -0
  33. package/examples/assets/door/door.mtl +26 -0
  34. package/examples/assets/door/door.obj +6927 -0
  35. package/examples/assets/popups/0.png +0 -0
  36. package/examples/assets/popups/1.png +0 -0
  37. package/examples/assets/popups/10.png +0 -0
  38. package/examples/assets/popups/2.png +0 -0
  39. package/examples/assets/popups/3.png +0 -0
  40. package/examples/assets/popups/4.png +0 -0
  41. package/examples/assets/popups/5.png +0 -0
  42. package/examples/assets/popups/6.png +0 -0
  43. package/examples/assets/popups/7.png +0 -0
  44. package/examples/assets/popups/8.png +0 -0
  45. package/examples/assets/popups/9.png +0 -0
  46. package/examples/assets/popups/close.jpg +0 -0
  47. package/examples/assets/popups/info.jpg +0 -0
  48. package/examples/assets/textures/brownwall.png +0 -0
  49. package/examples/assets/textures/concrete.png +0 -0
  50. package/examples/assets/textures/white-wall-texture.jpg +0 -0
  51. package/examples/charts/cyls/index.html +13 -4
  52. package/examples/charts/cyls/primitive.html +76 -0
  53. package/examples/charts/cylsmap/index.html +14 -5
  54. package/examples/charts_querier/bars_querier/data.csv +10 -0
  55. package/examples/charts_querier/bars_querier/index_csv.html +80 -0
  56. package/examples/dashboard/chaoss-dashboards.html +259 -0
  57. package/examples/dashboard/chaoss-issues.html +248 -0
  58. package/examples/dashboard/chaoss-pr.html +248 -0
  59. package/examples/dashboard/index.html +247 -0
  60. package/examples/dashboard/issues_queries/80-percent-open-time.json +123 -0
  61. package/examples/dashboard/issues_queries/issues-by-organization.json +107 -0
  62. package/examples/dashboard/issues_queries/issues.json +117 -0
  63. package/examples/dashboard/issues_queries/median-open-time.json +123 -0
  64. package/examples/dashboard/issues_queries/organizations.json +130 -0
  65. package/examples/dashboard/issues_queries/projects.json +130 -0
  66. package/examples/dashboard/issues_queries/repositories.json +130 -0
  67. package/examples/dashboard/issues_queries/status.json +107 -0
  68. package/examples/dashboard/issues_queries/submitter.json +125 -0
  69. package/examples/dashboard/issues_queries/submitters.json +113 -0
  70. package/examples/dashboard/pullrequests_queries/80-percent-open-time.json +123 -0
  71. package/examples/dashboard/pullrequests_queries/median-open-time.json +123 -0
  72. package/examples/dashboard/pullrequests_queries/organizations.json +130 -0
  73. package/examples/dashboard/pullrequests_queries/projects.json +130 -0
  74. package/examples/dashboard/pullrequests_queries/pull-requests-by-organization.json +107 -0
  75. package/examples/dashboard/pullrequests_queries/pull-requests.json +117 -0
  76. package/examples/dashboard/pullrequests_queries/repositories.json +130 -0
  77. package/examples/dashboard/pullrequests_queries/status.json +107 -0
  78. package/examples/dashboard/pullrequests_queries/submitter.json +125 -0
  79. package/examples/dashboard/pullrequests_queries/submitters.json +113 -0
  80. package/examples/dashboard/range.html +88 -0
  81. package/examples/dashboard/template.html +136 -0
  82. package/examples/demos/1.0.11/index_multiuser_ui.html +1 -1
  83. package/examples/multi_bars/data.json +14 -0
  84. package/examples/multi_bars/data2.json +15 -0
  85. package/examples/multi_bars/data3.json +23 -0
  86. package/examples/multi_bars/easyrtc.js +11984 -0
  87. package/examples/multi_bars/index.html +97 -0
  88. package/examples/multi_bars/index1.html +111 -0
  89. package/examples/multi_bars/index2.html +102 -0
  90. package/examples/multi_bars/index3.html +104 -0
  91. package/examples/multi_boats/data3.json +174 -0
  92. package/examples/multi_boats/data4.json +192 -0
  93. package/examples/multi_boats/{index.html → index_multi_boats.html} +50 -55
  94. package/examples/multi_boats/jetuml.html +124 -115
  95. package/examples/multi_boats/jetuml_evolution_experiment.html +419 -0
  96. package/examples/multi_boats/only_queryjson.html +132 -0
  97. package/examples/multi_boats/only_queryjson2.html +167 -0
  98. package/examples/multi_boats/only_queryjson3.html +165 -0
  99. package/examples/multi_boats/queryjson_treebuilder.html +132 -0
  100. package/examples/multi_boats/with_selector.html +121 -111
  101. package/examples/multiuser/choose_avatar/index.html +18 -8
  102. package/examples/selector_boats/jetuml_from_3_2_to_1_0.json +62382 -0
  103. package/examples/ui/network/data.json +123 -0
  104. package/examples/ui/network/links.json +13 -0
  105. package/examples/ui/network/network.html +75 -0
  106. package/examples/ui/network/network_nodes_links.html +82 -0
  107. package/examples/ui/network/nodes.json +12 -0
  108. package/index.html +69 -3
  109. package/index.js +6 -1
  110. package/package.json +4 -3
  111. package/tests/screenshots/other_snapshots.js/chaoss-issues.png +0 -0
  112. package/tests/screenshots/other_snapshots.js/chaoss-pr.png +0 -0
  113. package/tests/screenshots/other_snapshots.js/template.png +0 -0
  114. package/tests/ui.js +7 -0
  115. package/webpack.common.js +1 -1
  116. package/webpack.devnossl.js +16 -0
  117. package/.idea/vcs.xml +0 -6
  118. package/.idea/workspace.xml +0 -79
@@ -26,6 +26,7 @@ SOFTWARE.
26
26
 
27
27
  let findProdComponent = require('../others/common').findProdComponent;
28
28
  let parseJson = require('../others/common').parseJson;
29
+ const NotiBuffer = require("../../common/noti-buffer").NotiBuffer;
29
30
 
30
31
  /* global AFRAME */
31
32
 
@@ -187,7 +188,19 @@ AFRAME.registerComponent('babia-network', {
187
188
  return this;
188
189
  },
189
190
 
191
+ /**
192
+ * List of visualization properties
193
+ */
194
+ visProperties: { 'nodes': ['nodeId'],
195
+ 'links0': ['linkId'],
196
+ 'links1': ['linkSource', 'linkTarget']},
197
+
190
198
  init: function () {
199
+ this.isFirstTimeNodes = true;
200
+ this.isFirstTimeLinks = true;
201
+
202
+ this.notiBuffer = new NotiBuffer();
203
+
191
204
  let state = this.state = {}; // Internal state
192
205
 
193
206
  // Get camera dom element and attach fixed view elements to camera
@@ -283,16 +296,22 @@ AFRAME.registerComponent('babia-network', {
283
296
  this.notiBufferId = this.linksProdComponent.notiBuffer
284
297
  .register(this.processLinks.bind(this))
285
298
  }
286
- }
299
+ }
287
300
 
288
301
  // If changed whatever, re-print with the current data
289
- if (elData !== oldData) {
290
- if (elData.data){
291
- let _data = parseJson(elData.data);
292
- this.processData(_data)
293
- } else if (elData.nodes){
294
- let _nodes = parseJson(elData.nodes);
295
- this.processNodes(_nodes)
302
+ else if (elData !== oldData) {
303
+ if (this.newData){
304
+ let _data = parseJson(this.newData);
305
+ this.processData(_data, true)
306
+ } else if (this.newNodes){
307
+ if (elData.linkSource != oldData.linkSource || elData.linkTarget != oldData.linkTarget) {
308
+ let _links = parseJson(this.newLinks);
309
+ this.processLinks(_links, true)
310
+ } else {
311
+ let _nodes = parseJson(this.newNodes);
312
+ this.processNodes(_nodes, true)
313
+ }
314
+
296
315
  }
297
316
  }
298
317
  }
@@ -368,11 +387,26 @@ AFRAME.registerComponent('babia-network', {
368
387
  * Where the data is gonna be stored
369
388
  */
370
389
  newData: undefined,
390
+ newNodes: undefined,
391
+ newLinks: undefined,
392
+
393
+
394
+ /**
395
+ * Boolean to know if it's first time for getting the ui fields
396
+ */
397
+ isFirstTimeNodes: undefined,
398
+ isFirstTimeLinks: undefined,
399
+
400
+ /**
401
+ * Store the fields that we need to show in the ui and not the rest
402
+ */
403
+ nodeFields: undefined,
404
+ linkFields: undefined,
371
405
 
372
406
  /**
373
407
  * Where the current data is stored
374
408
  */
375
- currentData: undefined,
409
+ currentData: undefined,
376
410
 
377
411
  /**
378
412
  * Where the metadata is gonna be stored
@@ -386,8 +420,16 @@ AFRAME.registerComponent('babia-network', {
386
420
  /*
387
421
  * Update chart
388
422
  */
389
- updateChart: function (elData, self) {
423
+ updateChart: function (nodes_links, self) {
390
424
  if (self.currentData){
425
+ let elData = [];
426
+ for (let attr in this.data){
427
+ elData[attr] = this.data[attr]
428
+ }
429
+
430
+ elData.nodes = nodes_links.nodes;
431
+ elData.links = nodes_links.links;
432
+
391
433
  let diff = AFRAME.utils.diff(elData, self.currentData);
392
434
  let fgProps = [
393
435
  'jsonUrl',
@@ -459,79 +501,74 @@ AFRAME.registerComponent('babia-network', {
459
501
  /*
460
502
  * Process data obtained from producer
461
503
  */
462
- processData: function (_data) {
504
+ processData: function (_data, newData) {
463
505
  console.log("processData", this);
464
- let elData = this.data
465
- elData.data = _data;
466
- elData = this.elDataFromData(elData);
467
- this.data = elData
506
+ if (this.newData != _data || newData){
507
+ this.newData = _data;
508
+ let nodes_links = this.elDataFromData(_data);
468
509
  this.babiaMetadata = { id: this.babiaMetadata.id++ };
469
510
  console.log("Generating network...")
470
- this.updateChart(elData, this)
511
+ this.updateChart(nodes_links, this)
512
+ this.notiBuffer.set(_data)
513
+ }
471
514
  },
472
515
 
473
- processNodes: function (nodes){
516
+ processNodes: function (nodes, forceProcess){
474
517
  console.log("processNodes", this);
475
- let elData = this.data
476
- elData.nodes = nodes
477
- this.data.nodes = elData.nodes
478
- elData = this.elDataFromNodesAndLinks(elData)
479
-
480
- if (!elData){
481
- if (this.data.links) {
482
- let _links = parseJson(this.data.links);
483
- this.processLinks(_links)
484
- } else if (this.data.linksFrom){
518
+ if (this.newNodes != nodes || forceProcess){
519
+ this.newNodes = nodes;
520
+ let nodes_links = this.elDataFromNodesAndLinks(nodes, this.newLinks)
521
+
522
+ if (!nodes_links){
523
+ if (this.data.links) {
524
+ let _links = parseJson(this.data.links);
525
+ this.processLinks(_links)
526
+ } else if (this.data.linksFrom){
527
+ this.babiaMetadata = { id: this.babiaMetadata.id++ }
528
+ console.log("Generating network...")
529
+ }
530
+ } else {
485
531
  this.babiaMetadata = { id: this.babiaMetadata.id++ }
486
532
  console.log("Generating network...")
533
+ this.updateChart(nodes_links, this)
534
+ this.notiBuffer.set({'nodes': nodes_links.nodes, 'links': nodes_links.links})
487
535
  }
488
- } else {
489
- this.data = elData
490
- this.babiaMetadata = { id: this.babiaMetadata.id++ }
491
- console.log("Generating network...")
492
- this.updateChart(elData, this)
493
536
  }
494
-
495
537
  },
496
538
 
497
- processLinks: function (links){
539
+ processLinks: function (_links, forceProcess){
498
540
  console.log("processLinks", this);
499
- let elData = this.data
500
- if (typeof(links) === 'string' || links instanceof String) {
501
- elData.links = JSON.parse(links);
502
- } else {
503
- elData.links = links;
504
- };
505
- this.data.links = elData.links
506
- elData = this.elDataFromNodesAndLinks(elData)
507
-
508
- if (!elData){
509
- if (this.data.nodes) {
510
- let _nodes = parseJson(this.data.nodes);
511
- this.processLinks(_nodes)
512
- } else if (this.data.nodesFrom){
541
+ let links = parseJson(_links);
542
+ if (this.newLinks != links || forceProcess){
543
+ this.newLinks = links;
544
+ let nodes_links = this.elDataFromNodesAndLinks(this.newNodes, links)
545
+ if (!nodes_links){
546
+ if (this.data.nodes) {
547
+ let _nodes = parseJson(this.data.nodes);
548
+ this.processNodes(_nodes)
549
+ } else if (this.data.nodesFrom){
550
+ this.babiaMetadata = { id: this.babiaMetadata.id++ }
551
+ console.log("Generating network...")
552
+ }
553
+ } else {
513
554
  this.babiaMetadata = { id: this.babiaMetadata.id++ }
514
555
  console.log("Generating network...")
556
+ this.updateChart(nodes_links, this)
557
+ this.notiBuffer.set({'nodes': nodes_links.nodes, 'links': nodes_links.links})
515
558
  }
516
- } else {
517
- this.data = elData
518
- this.babiaMetadata = { id: this.babiaMetadata.id++ }
519
- console.log("Generating network...")
520
- this.updateChart(elData, this)
521
559
  }
522
560
  },
523
561
  // Format from data to nodes and links
524
- elDataFromData: function(elData){
562
+ elDataFromData: function(data){
525
563
  let nodes = [];
526
564
  let links = [];
527
-
528
- const data = elData.data;
529
- const nodeId = elData.nodeId;
530
- const linkId = elData.linkId;
531
- const nodeVal = elData.nodeVal;
532
- const source = elData.linkSource;
533
- const target = elData.linkTarget;
534
- const linkLabel = elData.linkLabel;
565
+
566
+ const nodeId = this.data.nodeId;
567
+ const linkId = this.data.linkId;
568
+ const nodeVal = this.data.nodeVal;
569
+ const source = this.data.linkSource;
570
+ const target = this.data.linkTarget;
571
+ const linkLabel = this.data.linkLabel;
535
572
 
536
573
  data.forEach(element => {
537
574
  let node = {};
@@ -539,9 +576,11 @@ AFRAME.registerComponent('babia-network', {
539
576
  Object.keys(element).forEach(function (k) {
540
577
  if (k === nodeId) {
541
578
  node[nodeId] = element[k];
542
- } else if (k === linkId) {
579
+ }
580
+ if (k === linkId) {
543
581
  node.linkId = element[k];
544
- } else if (k === nodeVal) {
582
+ }
583
+ if (k === nodeVal) {
545
584
  node[nodeVal] = element[k];
546
585
  }
547
586
  });
@@ -561,6 +600,7 @@ AFRAME.registerComponent('babia-network', {
561
600
  })
562
601
  if (!linkExists) {
563
602
  let newLink = {}
603
+ //newLink[linkId] = firstNode[linkId]
564
604
  newLink[linkLabel] = firstNode[linkLabel]
565
605
  newLink[source] = firstNode[nodeId]
566
606
  newLink[target] = secondNode[nodeId]
@@ -568,6 +608,7 @@ AFRAME.registerComponent('babia-network', {
568
608
  }
569
609
  } else {
570
610
  let newLink = {}
611
+ //newLink[linkId] = firstNode[linkId]
571
612
  newLink[linkLabel] = firstNode[linkLabel]
572
613
  newLink[source] = firstNode[nodeId]
573
614
  newLink[target] = secondNode[nodeId]
@@ -578,48 +619,67 @@ AFRAME.registerComponent('babia-network', {
578
619
  })
579
620
  });
580
621
 
581
- elData.nodes = nodes;
582
- elData.links = links;
583
-
584
- return elData;
622
+ return {nodes: nodes, links: links};
585
623
  },
586
624
 
587
625
  // Format nodes and links
588
626
 
589
- elDataFromNodesAndLinks: function(elData) {
590
- let nodes = elData.nodes;
591
- let links = elData.links;
592
- const nodeId = elData.nodeId;
593
- const nodeVal = elData.nodeVal;
594
- const source = elData.linkSource;
595
- const target = elData.linkTarget;
596
-
627
+ elDataFromNodesAndLinks: function(nodes, links) {
597
628
  if (!Array.isArray(nodes) || !Array.isArray(links)) {
598
629
  // Either nodes or links are not ready yet
599
630
  return false
600
631
  }
601
- nodes.forEach(node => {
602
- Object.keys(node).forEach(function (k) {
603
- if (k === nodeId) {
604
- node[nodeId] = node[k];
605
- } else if (k === nodeVal) {
606
- node[nodeVal] = node[k];
632
+
633
+ if (this.isFirstTimeNodes){
634
+ this.nodeFields = []
635
+ Object.keys(nodes[0]).forEach((k) => {
636
+ this.nodeFields.push(k)
637
+ })
638
+ this.isFirstTimeNodes = false;
639
+ }
640
+ if (this.isFirstTimeLinks){
641
+ this.linkFields = []
642
+ Object.keys(links[0]).forEach((k) => {
643
+ this.linkFields.push(k)
644
+ })
645
+ this.isFirstTimeLinks = false;
646
+ }
647
+
648
+ if (typeof(links[0].source) === 'object') {
649
+ links.forEach ((link) => {
650
+ link.source = link.source[this.data.nodeId];
651
+ link.target = link.target[this.data.nodeId];
652
+ })
653
+ }
654
+
655
+ let _nodes = [];
656
+ nodes.forEach((node) => {
657
+ let _node = {};
658
+ Object.keys(node).forEach((k) => {
659
+ for (let f in this.nodeFields){
660
+ if (k == this.nodeFields[f]){
661
+ _node[k] = node[k]
662
+ }
607
663
  }
608
- });
664
+ })
665
+ _nodes.push(_node)
609
666
  })
610
- links.map(link => {
611
- nodes.forEach(node => {
612
- if (link[source] === node[nodeId]){
613
- link[source] = node[nodeId];
614
- } else if (link[target] === node[nodeId]){
615
- link[target] = node[nodeId];
667
+
668
+ let _links = [];
669
+ links.forEach((link) => {
670
+ let _link = {};
671
+ Object.keys(link).forEach((k) => {
672
+ for (let f in this.linkFields){
673
+ if (k == this.linkFields[f] && k != this.data.linkId){
674
+ _link[k] = link[k]
675
+ }
616
676
  }
617
677
  })
678
+ _links.push(_link)
679
+
618
680
  })
619
- elData.nodes = nodes;
620
- elData.links = links;
621
681
 
622
- return elData;
682
+ return {nodes: _nodes, links: _links};
623
683
  },
624
684
 
625
685
  showLegend: function (nodeThree, node, nodeLabel, scale) {
@@ -628,7 +688,9 @@ AFRAME.registerComponent('babia-network', {
628
688
  let radius = nodeThree.geometry.boundingSphere.radius
629
689
  let sceneEl = document.querySelector('a-scene');
630
690
  this.legend = generateLegend(node, nodeLabel, worldPosition, radius, scale);
631
- sceneEl.appendChild(this.legend);
691
+ if (this.legend){
692
+ sceneEl.appendChild(this.legend);
693
+ }
632
694
  },
633
695
 
634
696
  showLinkLegend: function(linkThree, link, linkLabel, scale) {
@@ -655,7 +717,9 @@ AFRAME.registerComponent('babia-network', {
655
717
 
656
718
  let sceneEl = document.querySelector('a-scene');
657
719
  this.legend = generateLinkLegend(link, linkLabel, worldPosition, radius, scale);
658
- sceneEl.appendChild(this.legend);
720
+ if (this.legend){
721
+ sceneEl.appendChild(this.legend);
722
+ }
659
723
  },
660
724
 
661
725
  removeLegend: function() {
@@ -668,40 +732,42 @@ AFRAME.registerComponent('babia-network', {
668
732
 
669
733
  function generateLegend(node, nodeLabel, nodePosition, radius, scale) {
670
734
  let text = node[nodeLabel];
671
-
672
- let width = 2;
673
- let x = 3;
674
- let y = 3;
675
- let z = 3;
676
- if (text.length > 16)
677
- width = text.length / 8;
678
- if(scale){
679
- x = x * scale.x;
680
- y = y * scale.y;
681
- z = z * scale.z;
682
- radius = (radius + 3) * scale.y;
683
- }
684
-
685
- let entity = document.createElement('a-plane');
686
- entity.setAttribute('position', {x: nodePosition.x, y: nodePosition.y + radius, z: nodePosition.z})
687
- entity.setAttribute('babia-lookat', "[camera]");
688
- entity.setAttribute('width', width);
689
- entity.setAttribute('height', '1');
690
- entity.setAttribute('color', 'white');
691
- entity.setAttribute('scale', {x: x, y: y, z: z})
692
- entity.setAttribute('text', {
693
- 'value': node[nodeLabel],
694
- 'align': 'center',
695
- 'width': 6,
696
- 'color': 'black'
697
- });
698
- entity.classList.add("babiaxrLegend")
699
- return entity;
735
+ if (text) {
736
+ let width = 2;
737
+ let x = 3;
738
+ let y = 3;
739
+ let z = 3;
740
+ if (text.length > 16)
741
+ width = text.length / 8;
742
+ if(scale){
743
+ x = x * scale.x;
744
+ y = y * scale.y;
745
+ z = z * scale.z;
746
+ radius = (radius + 3) * scale.y;
747
+ }
748
+
749
+ let entity = document.createElement('a-plane');
750
+ entity.setAttribute('position', {x: nodePosition.x, y: nodePosition.y + radius, z: nodePosition.z})
751
+ entity.setAttribute('babia-lookat', "[camera]");
752
+ entity.setAttribute('width', width);
753
+ entity.setAttribute('height', '1');
754
+ entity.setAttribute('color', 'white');
755
+ entity.setAttribute('scale', {x: x, y: y, z: z})
756
+ entity.setAttribute('text', {
757
+ 'value': node[nodeLabel],
758
+ 'align': 'center',
759
+ 'width': 6,
760
+ 'color': 'black'
761
+ });
762
+ entity.classList.add("babiaxrLegend")
763
+ return entity;
764
+ }
700
765
  }
701
766
 
702
767
  function generateLinkLegend(link, linkLabel, linkPosition, radius, scale) {
703
768
  let text = link[linkLabel];
704
- let width = 2;
769
+ if (text){
770
+ let width = 2;
705
771
  let x = 3;
706
772
  let y = 3;
707
773
  let z = 3;
@@ -729,6 +795,7 @@ function generateLinkLegend(link, linkLabel, linkPosition, radius, scale) {
729
795
  });
730
796
  entity.classList.add("babiaxrLegend")
731
797
  return entity;
798
+ }
732
799
  }
733
800
 
734
801
  function setCursor() {
@@ -1,7 +1,6 @@
1
- let findProdComponent = require('../others/common').findProdComponent;
2
1
  let updateTitle = require('../others/common').updateTitle;
3
- let parseJson = require('../others/common').parseJson;
4
2
  const colors = require('../others/common').colors;
3
+ let updateFunction = require('../others/common').updateFunction;
5
4
 
6
5
  const NotiBuffer = require("../../common/noti-buffer").NotiBuffer;
7
6
 
@@ -50,34 +49,7 @@ AFRAME.registerComponent('babia-pie', {
50
49
  */
51
50
 
52
51
  update: function (oldData) {
53
- let data = this.data;
54
- let el = this.el;
55
-
56
- /**
57
- * Update or create chart component
58
- */
59
-
60
- if (data.data && oldData.data !== data.data) {
61
- let _data = parseJson(data.data);
62
- this.processData(_data);
63
- } else if (data.from !== oldData.from) {
64
- this.slice_array = []
65
- // Unregister from old producer
66
- if (this.prodComponent) {
67
- this.prodComponent.notiBuffer.unregister(this.notiBufferId)
68
- };
69
- this.prodComponent = findProdComponent (data, el)
70
- if (this.prodComponent.notiBuffer) {
71
- this.notiBufferId = this.prodComponent.notiBuffer
72
- .register(this.processData.bind(this))
73
- }
74
- }
75
- // If changed whatever, re-print with the current data
76
- else if (data !== oldData && this.newData) {
77
- this.slice_array = []
78
- this.processData(this.newData);
79
- }
80
-
52
+ updateFunction(this, oldData)
81
53
  },
82
54
 
83
55
  /**