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.
- package/components/filters/babia-selector.js +256 -79
- package/components/filters/babia-treebuilder.js +1 -2
- package/components/geometries/babia-cyl.js +180 -0
- package/components/others/assets/tooltip.png +0 -0
- package/components/others/babia-camera.js +195 -0
- package/components/others/babia-controls.js +56 -31
- package/components/others/babia-navigator.js +55 -49
- package/components/others/babia-range-selector.js +208 -0
- package/components/others/babia-slider.js +36 -8
- package/components/others/babia-ui.js +246 -73
- package/components/others/common.js +60 -73
- package/components/queriers/babia-querycsv.js +96 -0
- package/components/queriers/babia-queryes.js +203 -132
- package/components/visualizers/babia-bars.js +4 -35
- package/components/visualizers/babia-barsmap.js +2 -30
- package/components/visualizers/babia-boats.js +92 -100
- package/components/visualizers/babia-bubbles.js +9 -26
- package/components/visualizers/babia-cyls.js +197 -201
- package/components/visualizers/babia-cylsmap.js +171 -241
- package/components/visualizers/babia-doughnut.js +2 -28
- package/components/visualizers/babia-network.js +191 -124
- package/components/visualizers/babia-pie.js +2 -30
- package/dist/aframe-babia-components.js +21678 -19529
- package/dist/aframe-babia-components.min.js +7 -1
- package/dist/aframe-babia-components.min.js.map +1 -1
- package/docs/APIs/CHARTS.md +10 -4
- package/docs/APIs/DATAMANAGEMENT.md +7 -0
- package/docs/APIs/OTHERS.md +27 -0
- package/docs/APIs/QUERIERS.md +16 -0
- package/docs/RELEASE_NOTES.md +32 -21
- package/docs/Tutorials/multiuser.md +47 -2
- package/examples/assets/door/New Bitmap Image.jpg +0 -0
- package/examples/assets/door/door.mtl +26 -0
- package/examples/assets/door/door.obj +6927 -0
- package/examples/assets/popups/0.png +0 -0
- package/examples/assets/popups/1.png +0 -0
- package/examples/assets/popups/10.png +0 -0
- package/examples/assets/popups/2.png +0 -0
- package/examples/assets/popups/3.png +0 -0
- package/examples/assets/popups/4.png +0 -0
- package/examples/assets/popups/5.png +0 -0
- package/examples/assets/popups/6.png +0 -0
- package/examples/assets/popups/7.png +0 -0
- package/examples/assets/popups/8.png +0 -0
- package/examples/assets/popups/9.png +0 -0
- package/examples/assets/popups/close.jpg +0 -0
- package/examples/assets/popups/info.jpg +0 -0
- package/examples/assets/textures/brownwall.png +0 -0
- package/examples/assets/textures/concrete.png +0 -0
- package/examples/assets/textures/white-wall-texture.jpg +0 -0
- package/examples/charts/cyls/index.html +13 -4
- package/examples/charts/cyls/primitive.html +76 -0
- package/examples/charts/cylsmap/index.html +14 -5
- package/examples/charts_querier/bars_querier/data.csv +10 -0
- package/examples/charts_querier/bars_querier/index_csv.html +80 -0
- package/examples/dashboard/chaoss-dashboards.html +259 -0
- package/examples/dashboard/chaoss-issues.html +248 -0
- package/examples/dashboard/chaoss-pr.html +248 -0
- package/examples/dashboard/index.html +247 -0
- package/examples/dashboard/issues_queries/80-percent-open-time.json +123 -0
- package/examples/dashboard/issues_queries/issues-by-organization.json +107 -0
- package/examples/dashboard/issues_queries/issues.json +117 -0
- package/examples/dashboard/issues_queries/median-open-time.json +123 -0
- package/examples/dashboard/issues_queries/organizations.json +130 -0
- package/examples/dashboard/issues_queries/projects.json +130 -0
- package/examples/dashboard/issues_queries/repositories.json +130 -0
- package/examples/dashboard/issues_queries/status.json +107 -0
- package/examples/dashboard/issues_queries/submitter.json +125 -0
- package/examples/dashboard/issues_queries/submitters.json +113 -0
- package/examples/dashboard/pullrequests_queries/80-percent-open-time.json +123 -0
- package/examples/dashboard/pullrequests_queries/median-open-time.json +123 -0
- package/examples/dashboard/pullrequests_queries/organizations.json +130 -0
- package/examples/dashboard/pullrequests_queries/projects.json +130 -0
- package/examples/dashboard/pullrequests_queries/pull-requests-by-organization.json +107 -0
- package/examples/dashboard/pullrequests_queries/pull-requests.json +117 -0
- package/examples/dashboard/pullrequests_queries/repositories.json +130 -0
- package/examples/dashboard/pullrequests_queries/status.json +107 -0
- package/examples/dashboard/pullrequests_queries/submitter.json +125 -0
- package/examples/dashboard/pullrequests_queries/submitters.json +113 -0
- package/examples/dashboard/range.html +88 -0
- package/examples/dashboard/template.html +136 -0
- package/examples/demos/1.0.11/index_multiuser_ui.html +1 -1
- package/examples/multi_bars/data.json +14 -0
- package/examples/multi_bars/data2.json +15 -0
- package/examples/multi_bars/data3.json +23 -0
- package/examples/multi_bars/easyrtc.js +11984 -0
- package/examples/multi_bars/index.html +97 -0
- package/examples/multi_bars/index1.html +111 -0
- package/examples/multi_bars/index2.html +102 -0
- package/examples/multi_bars/index3.html +104 -0
- package/examples/multi_boats/data3.json +174 -0
- package/examples/multi_boats/data4.json +192 -0
- package/examples/multi_boats/{index.html → index_multi_boats.html} +50 -55
- package/examples/multi_boats/jetuml.html +124 -115
- package/examples/multi_boats/jetuml_evolution_experiment.html +419 -0
- package/examples/multi_boats/only_queryjson.html +132 -0
- package/examples/multi_boats/only_queryjson2.html +167 -0
- package/examples/multi_boats/only_queryjson3.html +165 -0
- package/examples/multi_boats/queryjson_treebuilder.html +132 -0
- package/examples/multi_boats/with_selector.html +121 -111
- package/examples/multiuser/choose_avatar/index.html +18 -8
- package/examples/selector_boats/jetuml_from_3_2_to_1_0.json +62382 -0
- package/examples/ui/network/data.json +123 -0
- package/examples/ui/network/links.json +13 -0
- package/examples/ui/network/network.html +75 -0
- package/examples/ui/network/network_nodes_links.html +82 -0
- package/examples/ui/network/nodes.json +12 -0
- package/index.html +69 -3
- package/index.js +6 -1
- package/package.json +4 -3
- package/tests/screenshots/other_snapshots.js/chaoss-issues.png +0 -0
- package/tests/screenshots/other_snapshots.js/chaoss-pr.png +0 -0
- package/tests/screenshots/other_snapshots.js/template.png +0 -0
- package/tests/ui.js +7 -0
- package/webpack.common.js +1 -1
- package/webpack.devnossl.js +16 -0
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -79
|
@@ -1,7 +1,7 @@
|
|
|
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;
|
|
4
|
+
let createCylinder = require('./babia-cyls').createCylinder;
|
|
5
5
|
|
|
6
6
|
const NotiBuffer = require("../../common/noti-buffer").NotiBuffer;
|
|
7
7
|
|
|
@@ -33,7 +33,11 @@ AFRAME.registerComponent('babia-cylsmap', {
|
|
|
33
33
|
titlePosition: { type: 'string', default: "0 0 0" },
|
|
34
34
|
scale: { type: 'number' },
|
|
35
35
|
heightMax: { type: 'number' },
|
|
36
|
-
radiusMax: { type: 'number' },
|
|
36
|
+
radiusMax: { type: 'number', default: 2 },
|
|
37
|
+
// Height of the chart
|
|
38
|
+
chartHeight: { type: 'number', default: 10 },
|
|
39
|
+
// Keep height when updating data
|
|
40
|
+
keepHeight: { type: 'boolean', default: true},
|
|
37
41
|
},
|
|
38
42
|
|
|
39
43
|
/**
|
|
@@ -50,36 +54,22 @@ AFRAME.registerComponent('babia-cylsmap', {
|
|
|
50
54
|
*/
|
|
51
55
|
init: function () {
|
|
52
56
|
this.notiBuffer = new NotiBuffer();
|
|
57
|
+
|
|
58
|
+
// Build chartEl
|
|
59
|
+
this.chartEl = document.createElement('a-entity');
|
|
60
|
+
this.chartEl.classList.add('babiaxrChart')
|
|
61
|
+
this.el.appendChild(this.chartEl);
|
|
62
|
+
|
|
63
|
+
// Build titleEl
|
|
64
|
+
this.updateTitle()
|
|
65
|
+
this.el.appendChild(this.titleEl);
|
|
53
66
|
},
|
|
54
67
|
/**
|
|
55
68
|
* Called when component is attached and when component data changes.
|
|
56
69
|
* Generally modifies the entity based on the data.
|
|
57
70
|
*/
|
|
58
71
|
update: function (oldData) {
|
|
59
|
-
|
|
60
|
-
let el = this.el;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Update or create chart component
|
|
64
|
-
*/
|
|
65
|
-
if (data.data && oldData.data !== data.data) {
|
|
66
|
-
let _data = parseJson(data.data);
|
|
67
|
-
this.processData(_data);
|
|
68
|
-
} else if (data.from !== oldData.from) {
|
|
69
|
-
// Unregister from old producer
|
|
70
|
-
if (this.prodComponent) {
|
|
71
|
-
this.prodComponent.notiBuffer.unregister(this.notiBufferId)
|
|
72
|
-
};
|
|
73
|
-
this.prodComponent = findProdComponent (data, el)
|
|
74
|
-
if (this.prodComponent.notiBuffer) {
|
|
75
|
-
this.notiBufferId = this.prodComponent.notiBuffer
|
|
76
|
-
.register(this.processData.bind(this))
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
// If changed whatever, re-print with the current data
|
|
80
|
-
else if (data !== oldData && this.newData) {
|
|
81
|
-
this.processData(this.newData)
|
|
82
|
-
}
|
|
72
|
+
updateFunction(this, oldData)
|
|
83
73
|
},
|
|
84
74
|
|
|
85
75
|
/**
|
|
@@ -109,8 +99,7 @@ AFRAME.registerComponent('babia-cylsmap', {
|
|
|
109
99
|
*/
|
|
110
100
|
updateTitle: function(){
|
|
111
101
|
const titleRotation = { x: 0, y: 0, z: 0 }
|
|
112
|
-
|
|
113
|
-
this.el.appendChild(titleEl);
|
|
102
|
+
this.titleEl = updateTitle(this.data, titleRotation);
|
|
114
103
|
},
|
|
115
104
|
|
|
116
105
|
/*
|
|
@@ -119,127 +108,123 @@ AFRAME.registerComponent('babia-cylsmap', {
|
|
|
119
108
|
|
|
120
109
|
updateChart: function () {
|
|
121
110
|
const dataToPrint = this.newData;
|
|
122
|
-
console.log("Data babia-cylsmap:", dataToPrint)
|
|
123
|
-
|
|
124
111
|
const data = this.data;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const animation = data.animation
|
|
128
|
-
const palette = data.palette
|
|
129
|
-
const scale = data.scale
|
|
130
|
-
|
|
131
|
-
let heightMax = data.heightMax
|
|
132
|
-
let radiusMax = data.radiusMax
|
|
133
|
-
|
|
112
|
+
|
|
134
113
|
let xLabels = [];
|
|
135
|
-
let xTicks = [];
|
|
136
114
|
let zLabels = [];
|
|
115
|
+
let map = new Array();
|
|
116
|
+
let colorId = 0
|
|
117
|
+
let xTicks = [];
|
|
137
118
|
let zTicks = [];
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (!radiusMax) {
|
|
160
|
-
radiusMax = maxRadius
|
|
119
|
+
|
|
120
|
+
// Generate map, xLabels and zLabels
|
|
121
|
+
for (i= 0; i < dataToPrint.length; i++) {
|
|
122
|
+
let xLabel = dataToPrint[i][data.x_axis];
|
|
123
|
+
let zLabel = dataToPrint[i][data.z_axis];
|
|
124
|
+
if (!xLabels.includes(xLabel)){
|
|
125
|
+
xLabels.push(xLabel);
|
|
126
|
+
}
|
|
127
|
+
if (!zLabels.includes(zLabel)){
|
|
128
|
+
zLabels.push(zLabel);
|
|
129
|
+
}
|
|
130
|
+
let stepX = xLabels.indexOf(xLabel);
|
|
131
|
+
let stepZ = zLabels.indexOf(zLabel);
|
|
132
|
+
if (map[stepX]){
|
|
133
|
+
map[stepX][stepZ] = dataToPrint[i][data.radius];
|
|
134
|
+
} else {
|
|
135
|
+
let innermap = new Array();
|
|
136
|
+
innermap[stepZ] = dataToPrint[i][data.radius];
|
|
137
|
+
map[stepX] = innermap;
|
|
138
|
+
}
|
|
161
139
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
this.chartEl = document.createElement('a-entity');
|
|
165
|
-
this.chartEl.classList.add('babiaxrChart')
|
|
166
|
-
el.appendChild(this.chartEl)
|
|
140
|
+
//console.log('MAP =>', map)
|
|
167
141
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
142
|
+
// Height Chart
|
|
143
|
+
let valueMax = Math.max.apply(Math, dataToPrint.map(function (o) { return o[data.height]; }))
|
|
144
|
+
if (!this.lengthY) {
|
|
145
|
+
this.lengthY = data.chartHeight;
|
|
146
|
+
} else if (!data.keepHeight) {
|
|
147
|
+
this.lengthY = this.lengthY * this.maxValue / this.maxValue;
|
|
148
|
+
};
|
|
149
|
+
this.maxValue = valueMax;
|
|
150
|
+
|
|
175
151
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
let height = cylinder[data.height]
|
|
180
|
-
let radius = cylinder[data.radius]
|
|
152
|
+
// Proportion of the radius
|
|
153
|
+
let maxRadius = Math.max.apply(Math, dataToPrint.map(function (o) { return o[data.radius]; }))
|
|
154
|
+
this.radius_scale = data.radiusMax / maxRadius;
|
|
181
155
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
156
|
+
// Generate xticks and zticks (to assign cyls positions later)
|
|
157
|
+
for (i= 0; i < xLabels.length; i++) {
|
|
158
|
+
let rad_0 = Math.max.apply(Math, map[i].filter(function (o) { if( o != '' ) { return o ; }}));
|
|
159
|
+
if (i == 0){
|
|
160
|
+
xTicks.push(rad_0 * this.radius_scale);
|
|
186
161
|
} else {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
} else {
|
|
190
|
-
stepX += 2 * maxRadius * radius_scale + 0.5
|
|
191
|
-
}
|
|
192
|
-
colorId = maxColorId
|
|
193
|
-
//Save in used
|
|
194
|
-
keys_used[xLabel] = {
|
|
195
|
-
"posX": stepX,
|
|
196
|
-
"colorId": colorId
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
xLabels.push(xLabel)
|
|
200
|
-
xTicks.push(stepX)
|
|
201
|
-
maxColorId++
|
|
162
|
+
let rad_1 = Math.max.apply(Math, map[i-1].filter(function (o) { if( o != '' ) { return o ; }}));
|
|
163
|
+
xTicks.push(xTicks[i-1] + rad_0 * this.radius_scale + 0.5 + rad_1 * this.radius_scale);
|
|
202
164
|
}
|
|
165
|
+
};
|
|
166
|
+
//console.log('xticks: ', xTicks)
|
|
203
167
|
|
|
204
|
-
|
|
205
|
-
|
|
168
|
+
for (j= 0; j < zLabels.length; j++) {
|
|
169
|
+
rad_0 = maxRadiusZ(map, xLabels.length, j);
|
|
170
|
+
if (j == 0){
|
|
171
|
+
zTicks.push(rad_0 * this.radius_scale);
|
|
206
172
|
} else {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
let
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if (
|
|
233
|
-
|
|
173
|
+
rad_1 = maxRadiusZ(map, xLabels.length, j-1);
|
|
174
|
+
zTicks.push(zTicks[j-1] + rad_1 * this.radius_scale + 0.5 + rad_0 * this.radius_scale);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
//console.log('zticks: ', zTicks)
|
|
178
|
+
|
|
179
|
+
// List current cylinders
|
|
180
|
+
let chartEl = this.chartEl;
|
|
181
|
+
let cyls = chartEl.querySelectorAll('a-entity[babia-cyl]');
|
|
182
|
+
let currentCyls = {};
|
|
183
|
+
for (let cyl of cyls) {
|
|
184
|
+
let cylName = cyl.getAttribute('babia-name');
|
|
185
|
+
currentCyls[cylName] = {'el': cyl, 'found': false};
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// Add or modify cyls for new data
|
|
189
|
+
for (let i = 0; i < dataToPrint.length; i++) {
|
|
190
|
+
let item = dataToPrint[i]
|
|
191
|
+
|
|
192
|
+
let xLabel = item[data.x_axis];
|
|
193
|
+
let zLabel = item[data.z_axis];
|
|
194
|
+
let cylEl;
|
|
195
|
+
let id = xLabel + '-' + zLabel;
|
|
196
|
+
let posX = xTicks[xLabels.indexOf(xLabel)];
|
|
197
|
+
let posZ = zTicks[zLabels.indexOf(zLabel)];
|
|
198
|
+
if ( currentCyls[id] && !item['_not'] ) {
|
|
199
|
+
cylEl = currentCyls[id].el;
|
|
200
|
+
currentCyls[id].found = true;
|
|
201
|
+
} else {
|
|
202
|
+
cylEl = document.createElement('a-entity');
|
|
203
|
+
cylEl.setAttribute('babia-name', id);
|
|
204
|
+
cylEl.id = id;
|
|
205
|
+
cylEl.object3D.position.x = posX;
|
|
206
|
+
cylEl.object3D.position.z = posZ;
|
|
207
|
+
this.chartEl.appendChild(cylEl);
|
|
234
208
|
}
|
|
209
|
+
colorId = xLabels.indexOf(xLabel);
|
|
210
|
+
createCylinder(this, cylEl, data, item, colorId, xLabel, posX, posZ, zLabel);
|
|
235
211
|
}
|
|
236
212
|
|
|
213
|
+
// Remove old cyls (not in new data)
|
|
214
|
+
for (let name in currentCyls) {
|
|
215
|
+
if ( !currentCyls[name].found ) {
|
|
216
|
+
currentCyls[name].el.remove();
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
|
|
237
220
|
//Print axis
|
|
238
221
|
if (data.axis) {
|
|
239
|
-
|
|
240
|
-
const
|
|
241
|
-
const
|
|
242
|
-
|
|
222
|
+
let lastRadX = Math.max.apply(Math, map[xLabels.length-1].filter(function (o) { if( o != '' ) { return o ; }}));
|
|
223
|
+
const lengthX = xTicks[xTicks.length-1] + lastRadX * this.radius_scale + 0.5;
|
|
224
|
+
const lengthZ = zTicks[zTicks.length-1] + maxRadiusZ(map, xLabels.length, zLabels.length-1) * this.radius_scale + 0.5;
|
|
225
|
+
xTicks = xTicks + 0.25;
|
|
226
|
+
zTicks = zTicks + 0.25;
|
|
227
|
+
this.updateAxis(xLabels, xTicks, lengthX, valueMax, zLabels, zTicks, lengthZ);
|
|
243
228
|
}
|
|
244
229
|
|
|
245
230
|
//Print Title
|
|
@@ -248,25 +233,49 @@ AFRAME.registerComponent('babia-cylsmap', {
|
|
|
248
233
|
/*
|
|
249
234
|
* Update axis
|
|
250
235
|
*/
|
|
251
|
-
updateAxis: function(xLabels, xTicks, lengthX, zLabels, zTicks, lengthZ
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
zAxisEl.setAttribute('babia-axis-z',
|
|
236
|
+
updateAxis: function(xLabels, xTicks, lengthX, maxValue, zLabels, zTicks, lengthZ) {
|
|
237
|
+
const data = this.data;
|
|
238
|
+
if (data.axis) {
|
|
239
|
+
if (!this.xAxisEl) {
|
|
240
|
+
this.xAxisEl = document.createElement('a-entity');
|
|
241
|
+
this.chartEl.appendChild(this.xAxisEl);
|
|
242
|
+
};
|
|
243
|
+
this.xAxisEl.setAttribute('babia-axis-x',
|
|
244
|
+
{'labels': xLabels, 'ticks': xTicks, 'length': lengthX,
|
|
245
|
+
'palette': data.palette, 'align': 'behind'});
|
|
246
|
+
this.xAxisEl.setAttribute('position', {
|
|
247
|
+
x: -0.25, y: 0, z: -0.25
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
if (!this.zAxisEl) {
|
|
251
|
+
this.zAxisEl = document.createElement('a-entity');
|
|
252
|
+
this.chartEl.appendChild(this.zAxisEl);
|
|
253
|
+
};
|
|
254
|
+
this.zAxisEl.setAttribute('babia-axis-z',
|
|
255
|
+
{'labels': zLabels, 'ticks': zTicks, 'length': lengthZ,
|
|
256
|
+
'palette': data.palette, 'align': 'left'});
|
|
257
|
+
this.zAxisEl.setAttribute('position', {
|
|
258
|
+
x: -0.25, y: 0, z: -0.25
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
if (!this.yAxisEl) {
|
|
262
|
+
this.yAxisEl = document.createElement('a-entity');
|
|
263
|
+
this.chartEl.appendChild(this.yAxisEl);
|
|
264
|
+
};
|
|
265
|
+
this.yAxisEl.setAttribute('babia-axis-y',
|
|
266
|
+
{'maxValue': maxValue, 'length': this.lengthY});
|
|
267
|
+
this.yAxisEl.setAttribute('position', {
|
|
268
|
+
x: -0.25, y: 0, z: -0.25
|
|
269
|
+
});
|
|
270
|
+
if (data.axis_name){
|
|
271
|
+
if (data.index =! "x_axis") {
|
|
272
|
+
this.xAxisEl.setAttribute('babia-axis-x', 'name', data.index);
|
|
273
|
+
} else {
|
|
274
|
+
this.xAxisEl.setAttribute('babia-axis-x', 'name', data.x_axis);
|
|
275
|
+
}
|
|
276
|
+
this.yAxisEl.setAttribute('babia-axis-y', 'name', data.height);
|
|
277
|
+
this.zAxisEl.setAttribute('babia-axis-z', 'name', data.z_axis);
|
|
278
|
+
}
|
|
270
279
|
}
|
|
271
280
|
},
|
|
272
281
|
|
|
@@ -277,99 +286,20 @@ AFRAME.registerComponent('babia-cylsmap', {
|
|
|
277
286
|
console.log("processData", this);
|
|
278
287
|
this.newData = data;
|
|
279
288
|
this.babiaMetadata = { id: this.babiaMetadata.id++ };
|
|
280
|
-
while (this.el.firstChild)
|
|
281
|
-
this.el.firstChild.remove()
|
|
289
|
+
/*while (this.el.firstChild)
|
|
290
|
+
this.el.firstChild.remove();*/
|
|
282
291
|
console.log("Generating cylsmap...")
|
|
283
292
|
this.updateChart()
|
|
284
293
|
this.notiBuffer.set(this.newData)
|
|
285
294
|
}
|
|
286
295
|
})
|
|
287
296
|
|
|
288
|
-
|
|
289
|
-
let
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
radius = radius / scale
|
|
294
|
-
} else if (proportion || radius_scale) {
|
|
295
|
-
if (proportion) {
|
|
296
|
-
height = proportion * height
|
|
297
|
-
}
|
|
298
|
-
if (radius_scale) {
|
|
299
|
-
radius = radius_scale * radius
|
|
297
|
+
let maxRadiusZ = (map, length, j) => {
|
|
298
|
+
let rad = 0
|
|
299
|
+
for (i= 0; i < length; i++) {
|
|
300
|
+
if (map[i][j] && rad < map[i][j]){
|
|
301
|
+
rad = map[i][j];
|
|
300
302
|
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
entity.setAttribute('radius', radius);
|
|
305
|
-
// Add animation
|
|
306
|
-
if (animation) {
|
|
307
|
-
var duration = 4000
|
|
308
|
-
var increment = 20 * height / duration
|
|
309
|
-
var size = 0
|
|
310
|
-
var id = setInterval(animation, 1);
|
|
311
|
-
function animation() {
|
|
312
|
-
if (size >= height) {
|
|
313
|
-
clearInterval(id);
|
|
314
|
-
} else {
|
|
315
|
-
size += increment;
|
|
316
|
-
entity.setAttribute('height', size);
|
|
317
|
-
entity.setAttribute('position', { x: positionX, y: size / 2, z: positionZ });
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
} else {
|
|
321
|
-
entity.setAttribute('height', height);
|
|
322
|
-
entity.setAttribute('position', { x: positionX, y: height / 2, z: positionZ });
|
|
323
|
-
}
|
|
324
|
-
return entity;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
function showLegend(data, cylinderEntity, cylinder, el) {
|
|
328
|
-
cylinderEntity.addEventListener('mouseenter', function () {
|
|
329
|
-
this.setAttribute('scale', { x: 1.1, y: 1.1, z: 1.1 });
|
|
330
|
-
legend = generateLegend(data, cylinder, cylinderEntity, el.getAttribute("scale"));
|
|
331
|
-
el.appendChild(legend);
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
cylinderEntity.addEventListener('mouseleave', function () {
|
|
335
|
-
this.setAttribute('scale', { x: 1, y: 1, z: 1 });
|
|
336
|
-
el.removeChild(legend);
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
function generateLegend(data, cylinder, cylinderEntity, scale) {
|
|
341
|
-
let text = ''
|
|
342
|
-
let lines = []
|
|
343
|
-
lines.push(cylinder[data.x_axis] + ' ' + cylinder[data.z_axis] + '\n');
|
|
344
|
-
lines.push('Height: ' + cylinder[data.height] + '\n');
|
|
345
|
-
lines.push('Radius: ' + cylinder[data.radius])
|
|
346
|
-
let width = 5;
|
|
347
|
-
for (let line of lines) {
|
|
348
|
-
if ((line.length > 10) && (width < line.length / 2)) {
|
|
349
|
-
width = line.length / 2;
|
|
350
|
-
}
|
|
351
|
-
text += line
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
let cylinderPosition = cylinderEntity.getAttribute('position')
|
|
355
|
-
let entity = document.createElement('a-plane');
|
|
356
|
-
let z = cylinderPosition.z;
|
|
357
|
-
if (scale)
|
|
358
|
-
z = z + (cylinder[data.radius] / 2) * scale.z;
|
|
359
|
-
else
|
|
360
|
-
z = z + (cylinder[data.radius] / 2);
|
|
361
|
-
entity.setAttribute('position', {x: cylinderPosition.x, y: 2 * cylinderPosition.y + 3, z: z});
|
|
362
|
-
entity.setAttribute('rotation', { x: 0, y: 0, z: 0 });
|
|
363
|
-
entity.setAttribute('height', '4');
|
|
364
|
-
entity.setAttribute('width', width);
|
|
365
|
-
entity.setAttribute('color', 'white');
|
|
366
|
-
entity.setAttribute('text', {
|
|
367
|
-
'value': text,
|
|
368
|
-
'align': 'center',
|
|
369
|
-
'width': 20,
|
|
370
|
-
'color': 'black'
|
|
371
|
-
});
|
|
372
|
-
entity.classList.add("babiaxrLegend")
|
|
373
|
-
return entity;
|
|
374
|
-
}
|
|
375
|
-
|
|
303
|
+
};
|
|
304
|
+
return rad;
|
|
305
|
+
}
|
|
@@ -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
|
|
|
@@ -49,32 +48,7 @@ AFRAME.registerComponent('babia-doughnut', {
|
|
|
49
48
|
*/
|
|
50
49
|
|
|
51
50
|
update: function (oldData) {
|
|
52
|
-
|
|
53
|
-
let el = this.el;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Update or create chart component
|
|
57
|
-
*/
|
|
58
|
-
if (data.data && oldData.data !== data.data) {
|
|
59
|
-
let _data = parseJson(data.data)
|
|
60
|
-
this.processData(_data)
|
|
61
|
-
} else if (data.from !== oldData.from) {
|
|
62
|
-
this.slice_array = []
|
|
63
|
-
// Unregister from old producer
|
|
64
|
-
if (this.prodComponent) {
|
|
65
|
-
this.prodComponent.notiBuffer.unregister(this.notiBufferId)
|
|
66
|
-
};
|
|
67
|
-
this.prodComponent = findProdComponent (data, el)
|
|
68
|
-
if (this.prodComponent.notiBuffer) {
|
|
69
|
-
this.notiBufferId = this.prodComponent.notiBuffer
|
|
70
|
-
.register(this.processData.bind(this))
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
// If changed whatever, re-print with the current data
|
|
74
|
-
else if (data !== oldData && this.newData) {
|
|
75
|
-
this.slice_array = []
|
|
76
|
-
this.processData(this.newData)
|
|
77
|
-
}
|
|
51
|
+
updateFunction(this, oldData)
|
|
78
52
|
},
|
|
79
53
|
|
|
80
54
|
/**
|