@deck.gl-community/infovis-layers 9.2.0-beta.6 → 9.2.0-beta.8
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/dist/index.cjs +11 -471
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +0 -6
- package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.d.ts +0 -23
- package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.d.ts.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.js +0 -33
- package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.js.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.d.ts +0 -38
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.d.ts.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.d.ts +0 -3
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.d.ts.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.js +0 -53
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.js.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.js +0 -138
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.js.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.d.ts +0 -3
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.d.ts.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.js +0 -24
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.js.map +0 -1
- package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.d.ts +0 -23
- package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.d.ts.map +0 -1
- package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.js +0 -100
- package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.js.map +0 -1
- package/dist/layers/time-axis-layer.d.ts +0 -56
- package/dist/layers/time-axis-layer.d.ts.map +0 -1
- package/dist/layers/time-axis-layer.js +0 -78
- package/dist/layers/time-axis-layer.js.map +0 -1
- package/dist/layers/vertical-grid-layer.d.ts +0 -41
- package/dist/layers/vertical-grid-layer.d.ts.map +0 -1
- package/dist/layers/vertical-grid-layer.js +0 -43
- package/dist/layers/vertical-grid-layer.js.map +0 -1
- package/dist/utils/tick-utils.d.ts +0 -10
- package/dist/utils/tick-utils.d.ts.map +0 -1
- package/dist/utils/tick-utils.js +0 -32
- package/dist/utils/tick-utils.js.map +0 -1
- package/src/layers/horizon-graph-layer/horizon-graph-layer-uniforms.ts +0 -47
- package/src/layers/horizon-graph-layer/horizon-graph-layer.fs.ts +0 -53
- package/src/layers/horizon-graph-layer/horizon-graph-layer.ts +0 -202
- package/src/layers/horizon-graph-layer/horizon-graph-layer.vs.ts +0 -24
- package/src/layers/horizon-graph-layer/multi-horizon-graph-layer.ts +0 -164
- package/src/layers/time-axis-layer.ts +0 -102
- package/src/layers/vertical-grid-layer.ts +0 -69
- package/src/utils/tick-utils.ts +0 -41
package/dist/index.cjs
CHANGED
|
@@ -25,14 +25,10 @@ var __publicField = (obj, key, value) => {
|
|
|
25
25
|
var dist_exports = {};
|
|
26
26
|
__export(dist_exports, {
|
|
27
27
|
HEADER_VIEW_HEIGHT: () => HEADER_VIEW_HEIGHT,
|
|
28
|
-
HorizonGraphLayer: () => HorizonGraphLayer,
|
|
29
28
|
LEGEND_VIEW_WIDTH: () => LEGEND_VIEW_WIDTH,
|
|
30
|
-
MultiHorizonGraphLayer: () => MultiHorizonGraphLayer,
|
|
31
29
|
SYNCHRONIZED_VIEWS: () => SYNCHRONIZED_VIEWS,
|
|
32
30
|
SYNCHRONIZED_VIEW_STATE_CONSTRAINTS: () => SYNCHRONIZED_VIEW_STATE_CONSTRAINTS,
|
|
33
|
-
TimeAxisLayer: () => TimeAxisLayer,
|
|
34
31
|
TimeDeltaLayer: () => TimeDeltaLayer,
|
|
35
|
-
VerticalGridLayer: () => VerticalGridLayer,
|
|
36
32
|
fitBoundsOrthographic: () => fitBoundsOrthographic,
|
|
37
33
|
fitSynchronizedViewStatesToBounds: () => fitSynchronizedViewStatesToBounds,
|
|
38
34
|
formatTimeMs: () => formatTimeMs,
|
|
@@ -44,7 +40,7 @@ __export(dist_exports, {
|
|
|
44
40
|
});
|
|
45
41
|
module.exports = __toCommonJS(dist_exports);
|
|
46
42
|
|
|
47
|
-
// dist/layers/time-
|
|
43
|
+
// dist/layers/time-delta-layer.js
|
|
48
44
|
var import_core = require("@deck.gl/core");
|
|
49
45
|
var import_layers = require("@deck.gl/layers");
|
|
50
46
|
|
|
@@ -93,136 +89,8 @@ function floatToStr(f, roundDigits = 5) {
|
|
|
93
89
|
return f.toPrecision(roundDigits);
|
|
94
90
|
}
|
|
95
91
|
|
|
96
|
-
// dist/utils/tick-utils.js
|
|
97
|
-
function getZoomedRange(startTime, endTime, bounds) {
|
|
98
|
-
const [startTimeZoomed, , endTimeZoomed] = bounds;
|
|
99
|
-
return [Math.max(startTime, startTimeZoomed), Math.min(endTime, endTimeZoomed)];
|
|
100
|
-
}
|
|
101
|
-
function getPrettyTicks(startTime, endTime, tickCount = 5) {
|
|
102
|
-
const range = endTime - startTime;
|
|
103
|
-
const roughStep = range / (tickCount - 1);
|
|
104
|
-
const exponent = Math.floor(Math.log10(roughStep));
|
|
105
|
-
const base = Math.pow(10, exponent);
|
|
106
|
-
const multiples = [1, 2, 5, 10];
|
|
107
|
-
const niceStep = multiples.find((m) => base * m >= roughStep) * base;
|
|
108
|
-
const niceStart = Math.ceil(startTime / niceStep) * niceStep;
|
|
109
|
-
const niceEnd = Math.floor(endTime / niceStep) * niceStep;
|
|
110
|
-
const ticks = [];
|
|
111
|
-
for (let t = niceStart; t <= niceEnd; t += niceStep) {
|
|
112
|
-
ticks.push(t);
|
|
113
|
-
}
|
|
114
|
-
return ticks;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// dist/layers/time-axis-layer.js
|
|
118
|
-
var TimeAxisLayer = class extends import_core.CompositeLayer {
|
|
119
|
-
// Called whenever props/data/viewports change
|
|
120
|
-
shouldUpdateState(params) {
|
|
121
|
-
return params.changeFlags.viewportChanged || super.shouldUpdateState(params);
|
|
122
|
-
}
|
|
123
|
-
renderLayers() {
|
|
124
|
-
const { startTimeMs, endTimeMs, tickCount = 10, y = 0, color = [0, 0, 0, 255] } = this.props;
|
|
125
|
-
let bounds;
|
|
126
|
-
try {
|
|
127
|
-
bounds = this.context.viewport.getBounds();
|
|
128
|
-
} catch (error) {
|
|
129
|
-
console.log("Error getting bounds from viewport:", error);
|
|
130
|
-
throw error;
|
|
131
|
-
}
|
|
132
|
-
const [startTimeZoomed, endTimeZoomed] = getZoomedRange(startTimeMs, endTimeMs, bounds);
|
|
133
|
-
const ticks = getPrettyTicks(startTimeZoomed, endTimeZoomed, tickCount);
|
|
134
|
-
const tickLines = ticks.map((x) => ({
|
|
135
|
-
sourcePosition: [x, y - 5],
|
|
136
|
-
targetPosition: [x, y + 5]
|
|
137
|
-
}));
|
|
138
|
-
const tickLabels = ticks.map((x) => ({
|
|
139
|
-
position: [x, y - 10],
|
|
140
|
-
text: this.props.unit === "timestamp" ? new Date(x).toLocaleTimeString() : formatTimeMs(x, false)
|
|
141
|
-
}));
|
|
142
|
-
return [
|
|
143
|
-
// Axis line
|
|
144
|
-
new import_layers.LineLayer({
|
|
145
|
-
id: "axis-line",
|
|
146
|
-
data: [{ sourcePosition: [startTimeZoomed, y], targetPosition: [endTimeZoomed, y] }],
|
|
147
|
-
getSourcePosition: (d) => d.sourcePosition,
|
|
148
|
-
getTargetPosition: (d) => d.targetPosition,
|
|
149
|
-
getColor: color,
|
|
150
|
-
getWidth: 2
|
|
151
|
-
}),
|
|
152
|
-
// Tick marks
|
|
153
|
-
new import_layers.LineLayer({
|
|
154
|
-
id: "tick-marks",
|
|
155
|
-
data: tickLines,
|
|
156
|
-
getSourcePosition: (d) => d.sourcePosition,
|
|
157
|
-
getTargetPosition: (d) => d.targetPosition,
|
|
158
|
-
getColor: color,
|
|
159
|
-
getWidth: 1
|
|
160
|
-
}),
|
|
161
|
-
// Tick labels
|
|
162
|
-
new import_layers.TextLayer({
|
|
163
|
-
id: "tick-labels",
|
|
164
|
-
data: tickLabels,
|
|
165
|
-
getPosition: (d) => d.position,
|
|
166
|
-
getText: (d) => d.text,
|
|
167
|
-
getSize: 12,
|
|
168
|
-
getColor: color,
|
|
169
|
-
getTextAnchor: "middle",
|
|
170
|
-
getAlignmentBaseline: "top"
|
|
171
|
-
})
|
|
172
|
-
];
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
__publicField(TimeAxisLayer, "layerName", "TimeAxisLayer");
|
|
176
|
-
__publicField(TimeAxisLayer, "defaultProps", {
|
|
177
|
-
startTimeMs: 0,
|
|
178
|
-
endTimeMs: 100,
|
|
179
|
-
tickCount: 5,
|
|
180
|
-
y: 0,
|
|
181
|
-
color: [0, 0, 0, 255],
|
|
182
|
-
unit: "timestamp",
|
|
183
|
-
bounds: void 0
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
// dist/layers/vertical-grid-layer.js
|
|
187
|
-
var import_core2 = require("@deck.gl/core");
|
|
188
|
-
var import_layers2 = require("@deck.gl/layers");
|
|
189
|
-
var VerticalGridLayer = class extends import_core2.CompositeLayer {
|
|
190
|
-
shouldUpdateState(params) {
|
|
191
|
-
return params.changeFlags.viewportChanged || super.shouldUpdateState(params);
|
|
192
|
-
}
|
|
193
|
-
renderLayers() {
|
|
194
|
-
const { xMin, xMax, tickCount = 5, yMin, yMax, color } = this.props;
|
|
195
|
-
const viewport = this.context.viewport;
|
|
196
|
-
const bounds = viewport.getBounds();
|
|
197
|
-
const [startTimeZoomed, endTimeZoomed] = getZoomedRange(xMin, xMax, bounds);
|
|
198
|
-
const tickPositions = getPrettyTicks(startTimeZoomed, endTimeZoomed, tickCount);
|
|
199
|
-
const gridLines = tickPositions.map((x) => ({
|
|
200
|
-
sourcePosition: [x, yMin],
|
|
201
|
-
targetPosition: [x, yMax]
|
|
202
|
-
}));
|
|
203
|
-
return new import_layers2.LineLayer({
|
|
204
|
-
id: `${this.props.id}-lines`,
|
|
205
|
-
data: gridLines,
|
|
206
|
-
getSourcePosition: (d) => d.sourcePosition,
|
|
207
|
-
getTargetPosition: (d) => d.targetPosition,
|
|
208
|
-
getColor: color,
|
|
209
|
-
getWidth: 1
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
__publicField(VerticalGridLayer, "layerName", "VerticalGridLayer");
|
|
214
|
-
__publicField(VerticalGridLayer, "defaultProps", {
|
|
215
|
-
yMin: -1e6,
|
|
216
|
-
yMax: 1e6,
|
|
217
|
-
tickCount: 5,
|
|
218
|
-
width: 1,
|
|
219
|
-
color: [200, 200, 200, 255]
|
|
220
|
-
});
|
|
221
|
-
|
|
222
92
|
// dist/layers/time-delta-layer.js
|
|
223
|
-
var
|
|
224
|
-
var import_layers3 = require("@deck.gl/layers");
|
|
225
|
-
var TimeDeltaLayer = class extends import_core3.CompositeLayer {
|
|
93
|
+
var TimeDeltaLayer = class extends import_core.CompositeLayer {
|
|
226
94
|
renderLayers() {
|
|
227
95
|
const { startTimeMs, endTimeMs, color = [0, 0, 0, 255], yMin, yMax } = this.props;
|
|
228
96
|
const timeDeltaPosition = [(startTimeMs + endTimeMs) / 2, 10];
|
|
@@ -241,7 +109,7 @@ var TimeDeltaLayer = class extends import_core3.CompositeLayer {
|
|
|
241
109
|
];
|
|
242
110
|
return [
|
|
243
111
|
// Interval end lines
|
|
244
|
-
new
|
|
112
|
+
new import_layers.LineLayer({
|
|
245
113
|
id: "time-delta-side-bars",
|
|
246
114
|
data: timeLines2,
|
|
247
115
|
getSourcePosition: (d) => d.sourcePosition,
|
|
@@ -265,7 +133,7 @@ var TimeDeltaLayer = class extends import_core3.CompositeLayer {
|
|
|
265
133
|
];
|
|
266
134
|
return [
|
|
267
135
|
// Interval end lines
|
|
268
|
-
new
|
|
136
|
+
new import_layers.LineLayer({
|
|
269
137
|
id: "header-time-delta-side-bars",
|
|
270
138
|
data: timeLines,
|
|
271
139
|
getSourcePosition: (d) => d.sourcePosition,
|
|
@@ -275,7 +143,7 @@ var TimeDeltaLayer = class extends import_core3.CompositeLayer {
|
|
|
275
143
|
widthUnits: "pixels"
|
|
276
144
|
}),
|
|
277
145
|
// Interval center
|
|
278
|
-
new
|
|
146
|
+
new import_layers.LineLayer({
|
|
279
147
|
id: "header-time-delta-dotted-line",
|
|
280
148
|
data: [
|
|
281
149
|
{
|
|
@@ -290,7 +158,7 @@ var TimeDeltaLayer = class extends import_core3.CompositeLayer {
|
|
|
290
158
|
widthUnits: "pixels"
|
|
291
159
|
}),
|
|
292
160
|
// Label
|
|
293
|
-
new
|
|
161
|
+
new import_layers.TextLayer({
|
|
294
162
|
id: "header-time-delta-label",
|
|
295
163
|
data: [{ position: timeDeltaPosition, text: timeDeltaLabel }],
|
|
296
164
|
getPosition: (d) => d.position,
|
|
@@ -324,334 +192,6 @@ __publicField(TimeDeltaLayer, "defaultProps", {
|
|
|
324
192
|
// Should cover full viewport height in most cases
|
|
325
193
|
});
|
|
326
194
|
|
|
327
|
-
// dist/layers/horizon-graph-layer/horizon-graph-layer.js
|
|
328
|
-
var import_core4 = require("@deck.gl/core");
|
|
329
|
-
var import_engine = require("@luma.gl/engine");
|
|
330
|
-
|
|
331
|
-
// dist/layers/horizon-graph-layer/horizon-graph-layer.vs.js
|
|
332
|
-
var horizon_graph_layer_vs_default = `#version 300 es
|
|
333
|
-
#define SHADER_NAME horizon-graph-layer-vertex-shader
|
|
334
|
-
|
|
335
|
-
in vec3 positions;
|
|
336
|
-
in vec2 uv;
|
|
337
|
-
|
|
338
|
-
out vec2 v_uv;
|
|
339
|
-
|
|
340
|
-
void main(void) {
|
|
341
|
-
geometry.worldPosition = positions;
|
|
342
|
-
|
|
343
|
-
vec4 position_commonspace = project_position(vec4(positions.xy, 0.0, 1.0));
|
|
344
|
-
gl_Position = project_common_position_to_clipspace(position_commonspace);
|
|
345
|
-
geometry.position = position_commonspace;
|
|
346
|
-
|
|
347
|
-
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
|
348
|
-
|
|
349
|
-
v_uv = uv;
|
|
350
|
-
}
|
|
351
|
-
`;
|
|
352
|
-
|
|
353
|
-
// dist/layers/horizon-graph-layer/horizon-graph-layer.fs.js
|
|
354
|
-
var horizon_graph_layer_fs_default = `#version 300 es
|
|
355
|
-
#define SHADER_NAME horizon-graph-layer-fragment-shader
|
|
356
|
-
|
|
357
|
-
precision highp float;
|
|
358
|
-
precision highp int;
|
|
359
|
-
|
|
360
|
-
/******* UNIFORM *******/
|
|
361
|
-
|
|
362
|
-
uniform sampler2D dataTexture;
|
|
363
|
-
|
|
364
|
-
/******* IN *******/
|
|
365
|
-
|
|
366
|
-
in vec2 v_uv;
|
|
367
|
-
|
|
368
|
-
/******* OUT *******/
|
|
369
|
-
|
|
370
|
-
out vec4 fragColor;
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
/******* MAIN *******/
|
|
374
|
-
|
|
375
|
-
void main(void) {
|
|
376
|
-
// horizontal position to sample index
|
|
377
|
-
float idx = v_uv.x * horizonLayer.dataTextureCount;
|
|
378
|
-
// idx = clamp(idx, 0.0, horizonLayer.dataTextureCount - 1.0); // NEEDED???
|
|
379
|
-
|
|
380
|
-
// fetch single data point & normalize (-1,+1)
|
|
381
|
-
float fy = floor(idx * horizonLayer.dataTextureSizeInv);
|
|
382
|
-
float fx = idx - fy * horizonLayer.dataTextureSize;
|
|
383
|
-
float val = texelFetch(dataTexture, ivec2(int(fx), int(fy)), 0).r;
|
|
384
|
-
val *= horizonLayer.yAxisScaleInv;
|
|
385
|
-
|
|
386
|
-
// band layering
|
|
387
|
-
float fband = abs(val) * horizonLayer.bands;
|
|
388
|
-
float bandIdx = clamp(floor(fband), 0.0, horizonLayer.bands - 1.0);
|
|
389
|
-
float bandFrac = fract(fband);
|
|
390
|
-
|
|
391
|
-
// calc our position value and find out color (using mix+step instead of if...else)
|
|
392
|
-
float positive = step(0.0, val); // 1 if pos, else 0
|
|
393
|
-
vec3 baseCol = mix(horizonLayer.negativeColor, horizonLayer.positiveColor, positive);
|
|
394
|
-
float curPos = mix(v_uv.y, 1.0 - v_uv.y, positive);
|
|
395
|
-
float addOne = step(curPos, bandFrac);
|
|
396
|
-
|
|
397
|
-
float band = bandIdx + addOne;
|
|
398
|
-
float whiten = 1.0 - band * horizonLayer.bandsInv;
|
|
399
|
-
|
|
400
|
-
fragColor = vec4(mix(baseCol, vec3(1.0), whiten), 1.0);
|
|
401
|
-
}
|
|
402
|
-
`;
|
|
403
|
-
|
|
404
|
-
// dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.js
|
|
405
|
-
var uniformBlock = `layout(std140) uniform horizonLayerUniforms {
|
|
406
|
-
float dataTextureSize; // width = height of the POT texture
|
|
407
|
-
float dataTextureSizeInv;
|
|
408
|
-
float dataTextureCount; // actual number of data points
|
|
409
|
-
|
|
410
|
-
float bands;
|
|
411
|
-
float bandsInv;
|
|
412
|
-
float yAxisScaleInv;
|
|
413
|
-
|
|
414
|
-
vec3 positiveColor;
|
|
415
|
-
vec3 negativeColor;
|
|
416
|
-
} horizonLayer;
|
|
417
|
-
`;
|
|
418
|
-
var horizonLayerUniforms = {
|
|
419
|
-
name: "horizonLayer",
|
|
420
|
-
vs: uniformBlock,
|
|
421
|
-
fs: uniformBlock,
|
|
422
|
-
uniformTypes: {
|
|
423
|
-
dataTextureSize: "f32",
|
|
424
|
-
dataTextureSizeInv: "f32",
|
|
425
|
-
dataTextureCount: "f32",
|
|
426
|
-
bands: "f32",
|
|
427
|
-
bandsInv: "f32",
|
|
428
|
-
yAxisScaleInv: "f32",
|
|
429
|
-
positiveColor: "vec3<f32>",
|
|
430
|
-
negativeColor: "vec3<f32>"
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
// dist/layers/horizon-graph-layer/horizon-graph-layer.js
|
|
435
|
-
var defaultProps = {
|
|
436
|
-
yAxisScale: { type: "number", value: 1e3 },
|
|
437
|
-
bands: { type: "number", value: 2 },
|
|
438
|
-
positiveColor: { type: "color", value: [0, 128, 0] },
|
|
439
|
-
negativeColor: { type: "color", value: [0, 0, 255] },
|
|
440
|
-
x: { type: "number", value: 0 },
|
|
441
|
-
y: { type: "number", value: 0 },
|
|
442
|
-
width: { type: "number", value: 800 },
|
|
443
|
-
height: { type: "number", value: 300 }
|
|
444
|
-
};
|
|
445
|
-
var HorizonGraphLayer = class extends import_core4.Layer {
|
|
446
|
-
state = {};
|
|
447
|
-
initializeState() {
|
|
448
|
-
this.state = {};
|
|
449
|
-
}
|
|
450
|
-
getShaders() {
|
|
451
|
-
return super.getShaders({
|
|
452
|
-
vs: horizon_graph_layer_vs_default,
|
|
453
|
-
fs: horizon_graph_layer_fs_default,
|
|
454
|
-
modules: [import_core4.project32, horizonLayerUniforms]
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
_createDataTexture(seriesData) {
|
|
458
|
-
const _data = seriesData instanceof Float32Array ? seriesData : new Float32Array(seriesData);
|
|
459
|
-
const { device } = this.context;
|
|
460
|
-
const count = _data.length;
|
|
461
|
-
let dataTextureSize = 32;
|
|
462
|
-
while (count > dataTextureSize * dataTextureSize) {
|
|
463
|
-
dataTextureSize *= 2;
|
|
464
|
-
}
|
|
465
|
-
const data = new Float32Array(dataTextureSize * dataTextureSize);
|
|
466
|
-
data.set(_data, 0);
|
|
467
|
-
return {
|
|
468
|
-
dataTexture: device.createTexture({
|
|
469
|
-
data,
|
|
470
|
-
format: "r32float",
|
|
471
|
-
dimension: "2d",
|
|
472
|
-
width: dataTextureSize,
|
|
473
|
-
height: dataTextureSize,
|
|
474
|
-
sampler: {
|
|
475
|
-
minFilter: "nearest",
|
|
476
|
-
magFilter: "nearest",
|
|
477
|
-
addressModeU: "clamp-to-edge",
|
|
478
|
-
addressModeV: "clamp-to-edge"
|
|
479
|
-
}
|
|
480
|
-
}),
|
|
481
|
-
dataTextureSize,
|
|
482
|
-
dataTextureCount: count
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
_createModel() {
|
|
486
|
-
const { x, y, width, height } = this.props;
|
|
487
|
-
const positions = [
|
|
488
|
-
x,
|
|
489
|
-
y,
|
|
490
|
-
0,
|
|
491
|
-
x + width,
|
|
492
|
-
y,
|
|
493
|
-
0,
|
|
494
|
-
x,
|
|
495
|
-
y + height,
|
|
496
|
-
0,
|
|
497
|
-
x + width,
|
|
498
|
-
y + height,
|
|
499
|
-
0
|
|
500
|
-
];
|
|
501
|
-
const uv = [0, 0, 1, 0, 0, 1, 1, 1];
|
|
502
|
-
const geometry = new import_engine.Geometry({
|
|
503
|
-
topology: "triangle-strip",
|
|
504
|
-
attributes: {
|
|
505
|
-
positions: { value: new Float32Array(positions), size: 3 },
|
|
506
|
-
uv: { value: new Float32Array(uv), size: 2 }
|
|
507
|
-
}
|
|
508
|
-
});
|
|
509
|
-
return new import_engine.Model(this.context.device, {
|
|
510
|
-
...this.getShaders(),
|
|
511
|
-
geometry,
|
|
512
|
-
bufferLayout: this.getAttributeManager().getBufferLayouts()
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
updateState(params) {
|
|
516
|
-
var _a, _b;
|
|
517
|
-
super.updateState(params);
|
|
518
|
-
const { changeFlags } = params;
|
|
519
|
-
if (changeFlags.dataChanged) {
|
|
520
|
-
(_a = this.state.dataTexture) == null ? void 0 : _a.destroy();
|
|
521
|
-
this.setState(this._createDataTexture(this.props.data));
|
|
522
|
-
}
|
|
523
|
-
if (changeFlags.extensionsChanged || changeFlags.propsChanged) {
|
|
524
|
-
(_b = this.state.model) == null ? void 0 : _b.destroy();
|
|
525
|
-
this.setState({ model: this._createModel() });
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
draw() {
|
|
529
|
-
const { model, dataTexture } = this.state;
|
|
530
|
-
if (!model) {
|
|
531
|
-
this.setState({ model: this._createModel() });
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
if (!dataTexture) {
|
|
535
|
-
this.setState(this._createDataTexture(this.props.data));
|
|
536
|
-
return;
|
|
537
|
-
}
|
|
538
|
-
const { bands, yAxisScale, positiveColor, negativeColor } = this.props;
|
|
539
|
-
model.shaderInputs.setProps({
|
|
540
|
-
horizonLayer: {
|
|
541
|
-
dataTexture: this.state.dataTexture,
|
|
542
|
-
dataTextureSize: this.state.dataTextureSize,
|
|
543
|
-
dataTextureSizeInv: 1 / this.state.dataTextureSize,
|
|
544
|
-
dataTextureCount: this.state.dataTextureCount,
|
|
545
|
-
bands,
|
|
546
|
-
bandsInv: 1 / bands,
|
|
547
|
-
yAxisScaleInv: 1 / yAxisScale,
|
|
548
|
-
positiveColor: positiveColor.map((c) => c / 255),
|
|
549
|
-
negativeColor: negativeColor.map((c) => c / 255)
|
|
550
|
-
}
|
|
551
|
-
});
|
|
552
|
-
model.draw(this.context.renderPass);
|
|
553
|
-
}
|
|
554
|
-
finalizeState(context) {
|
|
555
|
-
var _a, _b;
|
|
556
|
-
(_a = this.state.model) == null ? void 0 : _a.destroy();
|
|
557
|
-
(_b = this.state.dataTexture) == null ? void 0 : _b.destroy();
|
|
558
|
-
super.finalizeState(context);
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
__publicField(HorizonGraphLayer, "layerName", "HorizonGraphLayer");
|
|
562
|
-
__publicField(HorizonGraphLayer, "defaultProps", defaultProps);
|
|
563
|
-
|
|
564
|
-
// dist/layers/horizon-graph-layer/multi-horizon-graph-layer.js
|
|
565
|
-
var import_core5 = require("@deck.gl/core");
|
|
566
|
-
var import_layers4 = require("@deck.gl/layers");
|
|
567
|
-
var defaultProps2 = {
|
|
568
|
-
getSeries: { type: "accessor", value: (series) => series.values },
|
|
569
|
-
getScale: { type: "accessor", value: (series) => series.scale },
|
|
570
|
-
bands: { type: "number", value: 2 },
|
|
571
|
-
positiveColor: { type: "color", value: [0, 128, 0] },
|
|
572
|
-
negativeColor: { type: "color", value: [0, 0, 255] },
|
|
573
|
-
dividerColor: { type: "color", value: [0, 0, 0] },
|
|
574
|
-
dividerWidth: { type: "number", value: 2 },
|
|
575
|
-
x: { type: "number", value: 0 },
|
|
576
|
-
y: { type: "number", value: 0 },
|
|
577
|
-
width: { type: "number", value: 800 },
|
|
578
|
-
height: { type: "number", value: 300 }
|
|
579
|
-
};
|
|
580
|
-
var MultiHorizonGraphLayer = class extends import_core5.CompositeLayer {
|
|
581
|
-
renderLayers() {
|
|
582
|
-
const { data, getSeries, getScale, bands, positiveColor, negativeColor, dividerColor, dividerWidth, x, y, width, height } = this.props;
|
|
583
|
-
const seriesCount = data.length;
|
|
584
|
-
if (!seriesCount) {
|
|
585
|
-
return [];
|
|
586
|
-
}
|
|
587
|
-
const totalDividerSpace = dividerWidth * (seriesCount + 1);
|
|
588
|
-
const availableHeight = height - totalDividerSpace;
|
|
589
|
-
const seriesHeight = availableHeight / seriesCount;
|
|
590
|
-
const layers = [];
|
|
591
|
-
if (dividerWidth > 0) {
|
|
592
|
-
const dividerData = [];
|
|
593
|
-
dividerData.push({
|
|
594
|
-
polygon: [
|
|
595
|
-
[x, y],
|
|
596
|
-
[x + width, y],
|
|
597
|
-
[x + width, y + dividerWidth],
|
|
598
|
-
[x, y + dividerWidth]
|
|
599
|
-
]
|
|
600
|
-
});
|
|
601
|
-
for (let i = 0; i < seriesCount - 1; i++) {
|
|
602
|
-
const dividerY = y + dividerWidth + (i + 1) * seriesHeight + i * dividerWidth;
|
|
603
|
-
dividerData.push({
|
|
604
|
-
polygon: [
|
|
605
|
-
[x, dividerY],
|
|
606
|
-
[x + width, dividerY],
|
|
607
|
-
[x + width, dividerY + dividerWidth],
|
|
608
|
-
[x, dividerY + dividerWidth]
|
|
609
|
-
]
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
const bottomDividerY = y + height - dividerWidth;
|
|
613
|
-
dividerData.push({
|
|
614
|
-
polygon: [
|
|
615
|
-
[x, bottomDividerY],
|
|
616
|
-
[x + width, bottomDividerY],
|
|
617
|
-
[x + width, y + height],
|
|
618
|
-
[x, y + height]
|
|
619
|
-
]
|
|
620
|
-
});
|
|
621
|
-
layers.push(new import_layers4.SolidPolygonLayer({
|
|
622
|
-
id: `${this.props.id}-dividers`,
|
|
623
|
-
data: dividerData,
|
|
624
|
-
getPolygon: (d) => d.polygon,
|
|
625
|
-
getFillColor: dividerColor,
|
|
626
|
-
pickable: false
|
|
627
|
-
}));
|
|
628
|
-
}
|
|
629
|
-
data.forEach((series, index) => {
|
|
630
|
-
const seriesData = getSeries(series);
|
|
631
|
-
if (!seriesData || seriesData.length === 0) {
|
|
632
|
-
return;
|
|
633
|
-
}
|
|
634
|
-
const seriesY = y + dividerWidth + index * (seriesHeight + dividerWidth);
|
|
635
|
-
const yAxisScale = getScale(series);
|
|
636
|
-
layers.push(new HorizonGraphLayer({
|
|
637
|
-
id: `${this.props.id}-series-${index}`,
|
|
638
|
-
data: seriesData,
|
|
639
|
-
yAxisScale,
|
|
640
|
-
bands,
|
|
641
|
-
positiveColor,
|
|
642
|
-
negativeColor,
|
|
643
|
-
x,
|
|
644
|
-
y: seriesY,
|
|
645
|
-
width,
|
|
646
|
-
height: seriesHeight
|
|
647
|
-
}));
|
|
648
|
-
});
|
|
649
|
-
return layers;
|
|
650
|
-
}
|
|
651
|
-
};
|
|
652
|
-
__publicField(MultiHorizonGraphLayer, "layerName", "MultiHorizonGraphLayer");
|
|
653
|
-
__publicField(MultiHorizonGraphLayer, "defaultProps", defaultProps2);
|
|
654
|
-
|
|
655
195
|
// dist/views/orthographic-utils.js
|
|
656
196
|
function fitBoundsOrthographic(width, height, bounds, zoomMode = "per-axis") {
|
|
657
197
|
const [[minX, minY], [maxX, maxY]] = bounds;
|
|
@@ -734,11 +274,11 @@ function makeLayerFilter(filters) {
|
|
|
734
274
|
}
|
|
735
275
|
|
|
736
276
|
// dist/synchronized-views/synchronized-views.js
|
|
737
|
-
var
|
|
277
|
+
var import_core2 = require("@deck.gl/core");
|
|
738
278
|
var HEADER_VIEW_HEIGHT = 50;
|
|
739
279
|
var LEGEND_VIEW_WIDTH = 150;
|
|
740
280
|
var SYNCHRONIZED_VIEWS = [
|
|
741
|
-
new
|
|
281
|
+
new import_core2.OrthographicView({
|
|
742
282
|
id: "main",
|
|
743
283
|
flipY: false,
|
|
744
284
|
clear: true,
|
|
@@ -748,14 +288,14 @@ var SYNCHRONIZED_VIEWS = [
|
|
|
748
288
|
y: HEADER_VIEW_HEIGHT,
|
|
749
289
|
height: `calc(100% - ${HEADER_VIEW_HEIGHT}px)`,
|
|
750
290
|
controller: {
|
|
751
|
-
type:
|
|
291
|
+
type: import_core2.OrthographicController,
|
|
752
292
|
// @ts-expect-error Specific to OrthographicController
|
|
753
293
|
zoomAxis: "X",
|
|
754
294
|
inertia: false,
|
|
755
295
|
scrollZoom: true
|
|
756
296
|
}
|
|
757
297
|
}),
|
|
758
|
-
new
|
|
298
|
+
new import_core2.OrthographicView({
|
|
759
299
|
id: "header",
|
|
760
300
|
flipY: false,
|
|
761
301
|
clear: true,
|
|
@@ -765,7 +305,7 @@ var SYNCHRONIZED_VIEWS = [
|
|
|
765
305
|
height: 50,
|
|
766
306
|
controller: false
|
|
767
307
|
}),
|
|
768
|
-
new
|
|
308
|
+
new import_core2.OrthographicView({
|
|
769
309
|
id: "legend",
|
|
770
310
|
flipY: false,
|
|
771
311
|
clear: true,
|