@deck.gl-community/infovis-layers 9.1.0-beta.8 → 9.2.0-beta.2
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/LICENSE +1 -1
- package/dist/index.cjs +815 -0
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.d.ts +23 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.d.ts.map +1 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.js +33 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.js.map +1 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.d.ts +38 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.d.ts.map +1 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.d.ts +3 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.d.ts.map +1 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.js +53 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.js.map +1 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.js +138 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.js.map +1 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.d.ts +3 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.d.ts.map +1 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.js +24 -0
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.js.map +1 -0
- package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.d.ts +23 -0
- package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.d.ts.map +1 -0
- package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.js +100 -0
- package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.js.map +1 -0
- package/dist/layers/time-axis-layer.d.ts +56 -0
- package/dist/layers/time-axis-layer.d.ts.map +1 -0
- package/dist/layers/time-axis-layer.js +78 -0
- package/dist/layers/time-axis-layer.js.map +1 -0
- package/dist/layers/time-delta-layer.d.ts +74 -0
- package/dist/layers/time-delta-layer.d.ts.map +1 -0
- package/dist/layers/time-delta-layer.js +136 -0
- package/dist/layers/time-delta-layer.js.map +1 -0
- package/dist/layers/vertical-grid-layer.d.ts +41 -0
- package/dist/layers/vertical-grid-layer.d.ts.map +1 -0
- package/dist/layers/vertical-grid-layer.js +43 -0
- package/dist/layers/vertical-grid-layer.js.map +1 -0
- package/dist/synchronized-views/synchronized-views.d.ts +39 -0
- package/dist/synchronized-views/synchronized-views.d.ts.map +1 -0
- package/dist/synchronized-views/synchronized-views.js +85 -0
- package/dist/synchronized-views/synchronized-views.js.map +1 -0
- package/dist/utils/format-utils.d.ts +7 -0
- package/dist/utils/format-utils.d.ts.map +1 -0
- package/dist/utils/format-utils.js +75 -0
- package/dist/utils/format-utils.js.map +1 -0
- package/dist/utils/tick-utils.d.ts +10 -0
- package/dist/utils/tick-utils.d.ts.map +1 -0
- package/dist/utils/tick-utils.js +32 -0
- package/dist/utils/tick-utils.js.map +1 -0
- package/dist/views/layer-filter.d.ts +8 -0
- package/dist/views/layer-filter.d.ts.map +1 -0
- package/dist/views/layer-filter.js +40 -0
- package/dist/views/layer-filter.js.map +1 -0
- package/dist/views/orthographic-utils.d.ts +11 -0
- package/dist/views/orthographic-utils.d.ts.map +1 -0
- package/dist/views/orthographic-utils.js +41 -0
- package/dist/views/orthographic-utils.js.map +1 -0
- package/dist/views/view-state-utils.d.ts +8 -0
- package/dist/views/view-state-utils.d.ts.map +1 -0
- package/dist/views/view-state-utils.js +41 -0
- package/dist/views/view-state-utils.js.map +1 -0
- package/package.json +11 -18
- package/src/index.ts +4 -0
- package/src/layers/horizon-graph-layer/horizon-graph-layer-uniforms.ts +47 -0
- package/src/layers/horizon-graph-layer/horizon-graph-layer.fs.ts +53 -0
- package/src/layers/horizon-graph-layer/horizon-graph-layer.ts +202 -0
- package/src/layers/horizon-graph-layer/horizon-graph-layer.vs.ts +24 -0
- package/src/layers/horizon-graph-layer/multi-horizon-graph-layer.ts +164 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { CompositeLayer } from '@deck.gl/core';
|
|
5
|
+
import { SolidPolygonLayer } from '@deck.gl/layers';
|
|
6
|
+
import { HorizonGraphLayer } from "./horizon-graph-layer.js";
|
|
7
|
+
const defaultProps = {
|
|
8
|
+
getSeries: { type: 'accessor', value: (series) => series.values },
|
|
9
|
+
getScale: { type: 'accessor', value: (series) => series.scale },
|
|
10
|
+
bands: { type: 'number', value: 2 },
|
|
11
|
+
positiveColor: { type: 'color', value: [0, 128, 0] },
|
|
12
|
+
negativeColor: { type: 'color', value: [0, 0, 255] },
|
|
13
|
+
dividerColor: { type: 'color', value: [0, 0, 0] },
|
|
14
|
+
dividerWidth: { type: 'number', value: 2 },
|
|
15
|
+
x: { type: 'number', value: 0 },
|
|
16
|
+
y: { type: 'number', value: 0 },
|
|
17
|
+
width: { type: 'number', value: 800 },
|
|
18
|
+
height: { type: 'number', value: 300 }
|
|
19
|
+
};
|
|
20
|
+
export class MultiHorizonGraphLayer extends CompositeLayer {
|
|
21
|
+
static layerName = 'MultiHorizonGraphLayer';
|
|
22
|
+
static defaultProps = defaultProps;
|
|
23
|
+
renderLayers() {
|
|
24
|
+
const { data, getSeries, getScale, bands, positiveColor, negativeColor, dividerColor, dividerWidth, x, y, width, height } = this.props;
|
|
25
|
+
const seriesCount = data.length;
|
|
26
|
+
if (!seriesCount) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
// Calculate layout dimensions
|
|
30
|
+
const totalDividerSpace = dividerWidth * (seriesCount + 1);
|
|
31
|
+
const availableHeight = height - totalDividerSpace;
|
|
32
|
+
const seriesHeight = availableHeight / seriesCount;
|
|
33
|
+
const layers = [];
|
|
34
|
+
// Create divider rectangles
|
|
35
|
+
if (dividerWidth > 0) {
|
|
36
|
+
const dividerData = [];
|
|
37
|
+
// Top divider
|
|
38
|
+
dividerData.push({
|
|
39
|
+
polygon: [
|
|
40
|
+
[x, y],
|
|
41
|
+
[x + width, y],
|
|
42
|
+
[x + width, y + dividerWidth],
|
|
43
|
+
[x, y + dividerWidth]
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
// Dividers between series
|
|
47
|
+
for (let i = 0; i < seriesCount - 1; i++) {
|
|
48
|
+
const dividerY = y + dividerWidth + (i + 1) * seriesHeight + i * dividerWidth;
|
|
49
|
+
dividerData.push({
|
|
50
|
+
polygon: [
|
|
51
|
+
[x, dividerY],
|
|
52
|
+
[x + width, dividerY],
|
|
53
|
+
[x + width, dividerY + dividerWidth],
|
|
54
|
+
[x, dividerY + dividerWidth]
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
// Bottom divider
|
|
59
|
+
const bottomDividerY = y + height - dividerWidth;
|
|
60
|
+
dividerData.push({
|
|
61
|
+
polygon: [
|
|
62
|
+
[x, bottomDividerY],
|
|
63
|
+
[x + width, bottomDividerY],
|
|
64
|
+
[x + width, y + height],
|
|
65
|
+
[x, y + height]
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
layers.push(new SolidPolygonLayer({
|
|
69
|
+
id: `${this.props.id}-dividers`,
|
|
70
|
+
data: dividerData,
|
|
71
|
+
getPolygon: (d) => d.polygon,
|
|
72
|
+
getFillColor: dividerColor,
|
|
73
|
+
pickable: false
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
// Create horizon graph layers for each series
|
|
77
|
+
data.forEach((series, index) => {
|
|
78
|
+
const seriesData = getSeries(series);
|
|
79
|
+
if (!seriesData || seriesData.length === 0) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const seriesY = y + dividerWidth + index * (seriesHeight + dividerWidth);
|
|
83
|
+
const yAxisScale = getScale(series);
|
|
84
|
+
layers.push(new HorizonGraphLayer({
|
|
85
|
+
id: `${this.props.id}-series-${index}`,
|
|
86
|
+
data: seriesData,
|
|
87
|
+
yAxisScale,
|
|
88
|
+
bands,
|
|
89
|
+
positiveColor,
|
|
90
|
+
negativeColor,
|
|
91
|
+
x,
|
|
92
|
+
y: seriesY,
|
|
93
|
+
width,
|
|
94
|
+
height: seriesHeight
|
|
95
|
+
}));
|
|
96
|
+
});
|
|
97
|
+
return layers;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=multi-horizon-graph-layer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-horizon-graph-layer.js","sourceRoot":"","sources":["../../../src/layers/horizon-graph-layer/multi-horizon-graph-layer.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,iBAAiB,EAAC,iCAA8B;AAwBxD,MAAM,YAAY,GAA8C;IAC9D,SAAS,EAAE,EAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,MAAW,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAC;IACpE,QAAQ,EAAE,EAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,MAAW,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAC;IAElE,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAC;IAEjC,aAAa,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,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,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;iBAChB;aACF,CAAC,CAAC;YAEH,MAAM,CAAC,IAAI,CACT,IAAI,iBAAiB,CAAC;gBACpB,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,WAAW;gBAC/B,IAAI,EAAE,WAAW;gBACjB,UAAU,EAAE,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO;gBACjC,YAAY,EAAE,YAAY;gBAC1B,QAAQ,EAAE,KAAK;aAChB,CAAC,CACH,CAAC;QACJ,CAAC;QAED,8CAA8C;QAC7C,IAAY,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACtC,MAAM,UAAU,GAAI,SAAiB,CAAC,MAAM,CAAC,CAAC;YAE9C,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC3C,OAAO;YACT,CAAC;YAED,MAAM,OAAO,GAAG,CAAC,GAAG,YAAY,GAAG,KAAK,GAAG,CAAC,YAAY,GAAG,YAAY,CAAC,CAAC;YAEzE,MAAM,UAAU,GAAI,QAAgB,CAAC,MAAM,CAAC,CAAC;YAE7C,MAAM,CAAC,IAAI,CACT,IAAI,iBAAiB,CAAC;gBACpB,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,WAAW,KAAK,EAAE;gBACtC,IAAI,EAAE,UAAU;gBAChB,UAAU;gBACV,KAAK;gBACL,aAAa;gBACb,aAAa;gBACb,CAAC;gBACD,CAAC,EAAE,OAAO;gBACV,KAAK;gBACL,MAAM,EAAE,YAAY;aACrB,CAAC,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { CompositeLayer, type CompositeLayerProps, type UpdateParameters } from '@deck.gl/core';
|
|
2
|
+
import { LineLayer, TextLayer } from '@deck.gl/layers';
|
|
3
|
+
export type TimeAxisLayerProps = CompositeLayerProps & {
|
|
4
|
+
unit: 'timestamp' | 'milliseconds';
|
|
5
|
+
/** Start time in milliseconds since epoch */
|
|
6
|
+
startTimeMs: number;
|
|
7
|
+
/** End time in milliseconds since epoch */
|
|
8
|
+
endTimeMs: number;
|
|
9
|
+
/** Optional: Number of tick marks (default: 5) */
|
|
10
|
+
tickCount?: number;
|
|
11
|
+
/** Optional: Y-coordinate for the axis line (default: 0) */
|
|
12
|
+
y?: number;
|
|
13
|
+
/** Optional: RGBA color for axis and ticks (default: [0, 0, 0, 255]) */
|
|
14
|
+
color?: [number, number, number, number];
|
|
15
|
+
/** Optional: Bounds for the axis line (default: viewport bounds) */
|
|
16
|
+
bounds?: [number, number, number, number];
|
|
17
|
+
};
|
|
18
|
+
export declare class TimeAxisLayer extends CompositeLayer<TimeAxisLayerProps> {
|
|
19
|
+
static layerName: string;
|
|
20
|
+
static defaultProps: Required<Omit<TimeAxisLayerProps, keyof CompositeLayerProps>>;
|
|
21
|
+
shouldUpdateState(params: UpdateParameters<TimeAxisLayer>): boolean;
|
|
22
|
+
renderLayers(): (LineLayer<any, {
|
|
23
|
+
id: "axis-line";
|
|
24
|
+
data: {
|
|
25
|
+
sourcePosition: number[];
|
|
26
|
+
targetPosition: number[];
|
|
27
|
+
}[];
|
|
28
|
+
getSourcePosition: (d: any) => any;
|
|
29
|
+
getTargetPosition: (d: any) => any;
|
|
30
|
+
getColor: [number, number, number, number];
|
|
31
|
+
getWidth: 2;
|
|
32
|
+
}> | LineLayer<any, {
|
|
33
|
+
id: "tick-marks";
|
|
34
|
+
data: {
|
|
35
|
+
sourcePosition: any[];
|
|
36
|
+
targetPosition: any[];
|
|
37
|
+
}[];
|
|
38
|
+
getSourcePosition: (d: any) => any;
|
|
39
|
+
getTargetPosition: (d: any) => any;
|
|
40
|
+
getColor: [number, number, number, number];
|
|
41
|
+
getWidth: 1;
|
|
42
|
+
}> | TextLayer<any, {
|
|
43
|
+
id: "tick-labels";
|
|
44
|
+
data: {
|
|
45
|
+
position: any[];
|
|
46
|
+
text: string;
|
|
47
|
+
}[];
|
|
48
|
+
getPosition: (d: any) => any;
|
|
49
|
+
getText: (d: any) => any;
|
|
50
|
+
getSize: 12;
|
|
51
|
+
getColor: [number, number, number, number];
|
|
52
|
+
getTextAnchor: "middle";
|
|
53
|
+
getAlignmentBaseline: "top";
|
|
54
|
+
}>)[];
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=time-axis-layer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-axis-layer.d.ts","sourceRoot":"","sources":["../../src/layers/time-axis-layer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,EAAE,KAAK,mBAAmB,EAAE,KAAK,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAKrD,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG;IACrD,IAAI,EAAE,WAAW,GAAG,cAAc,CAAC;IACnC,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,wEAAwE;IACxE,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C,CAAC;AAEF,qBAAa,aAAc,SAAQ,cAAc,CAAC,kBAAkB,CAAC;IACnE,OAAgB,SAAS,SAAmB;IAC5C,OAAgB,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,kBAAkB,EAAE,MAAM,mBAAmB,CAAC,CAAC,CAQzF;IAGO,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,CAAC,aAAa,CAAC,GAAG,OAAO;IAInE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DtB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { CompositeLayer } from '@deck.gl/core';
|
|
5
|
+
import { LineLayer, TextLayer } from '@deck.gl/layers';
|
|
6
|
+
import { formatTimeMs } from "../utils/format-utils.js";
|
|
7
|
+
import { getPrettyTicks, getZoomedRange } from "../utils/tick-utils.js";
|
|
8
|
+
export class TimeAxisLayer extends CompositeLayer {
|
|
9
|
+
static layerName = 'TimeAxisLayer';
|
|
10
|
+
static defaultProps = {
|
|
11
|
+
startTimeMs: 0,
|
|
12
|
+
endTimeMs: 100,
|
|
13
|
+
tickCount: 5,
|
|
14
|
+
y: 0,
|
|
15
|
+
color: [0, 0, 0, 255],
|
|
16
|
+
unit: 'timestamp',
|
|
17
|
+
bounds: undefined
|
|
18
|
+
};
|
|
19
|
+
// Called whenever props/data/viewports change
|
|
20
|
+
shouldUpdateState(params) {
|
|
21
|
+
return params.changeFlags.viewportChanged || super.shouldUpdateState(params);
|
|
22
|
+
}
|
|
23
|
+
renderLayers() {
|
|
24
|
+
const { startTimeMs, endTimeMs, tickCount = 10, y = 0, color = [0, 0, 0, 255] } = this.props;
|
|
25
|
+
let bounds;
|
|
26
|
+
try {
|
|
27
|
+
bounds = this.context.viewport.getBounds();
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
31
|
+
console.log('Error getting bounds from viewport:', error);
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
const [startTimeZoomed, endTimeZoomed] = getZoomedRange(startTimeMs, endTimeMs, bounds);
|
|
35
|
+
// Generate tick positions and labels
|
|
36
|
+
const ticks = getPrettyTicks(startTimeZoomed, endTimeZoomed, tickCount);
|
|
37
|
+
const tickLines = ticks.map((x) => ({
|
|
38
|
+
sourcePosition: [x, y - 5],
|
|
39
|
+
targetPosition: [x, y + 5]
|
|
40
|
+
}));
|
|
41
|
+
const tickLabels = ticks.map((x) => ({
|
|
42
|
+
position: [x, y - 10],
|
|
43
|
+
text: this.props.unit === 'timestamp' ? new Date(x).toLocaleTimeString() : formatTimeMs(x, false)
|
|
44
|
+
}));
|
|
45
|
+
return [
|
|
46
|
+
// Axis line
|
|
47
|
+
new LineLayer({
|
|
48
|
+
id: 'axis-line',
|
|
49
|
+
data: [{ sourcePosition: [startTimeZoomed, y], targetPosition: [endTimeZoomed, y] }],
|
|
50
|
+
getSourcePosition: (d) => d.sourcePosition,
|
|
51
|
+
getTargetPosition: (d) => d.targetPosition,
|
|
52
|
+
getColor: color,
|
|
53
|
+
getWidth: 2
|
|
54
|
+
}),
|
|
55
|
+
// Tick marks
|
|
56
|
+
new LineLayer({
|
|
57
|
+
id: 'tick-marks',
|
|
58
|
+
data: tickLines,
|
|
59
|
+
getSourcePosition: (d) => d.sourcePosition,
|
|
60
|
+
getTargetPosition: (d) => d.targetPosition,
|
|
61
|
+
getColor: color,
|
|
62
|
+
getWidth: 1
|
|
63
|
+
}),
|
|
64
|
+
// Tick labels
|
|
65
|
+
new TextLayer({
|
|
66
|
+
id: 'tick-labels',
|
|
67
|
+
data: tickLabels,
|
|
68
|
+
getPosition: (d) => d.position,
|
|
69
|
+
getText: (d) => d.text,
|
|
70
|
+
getSize: 12,
|
|
71
|
+
getColor: color,
|
|
72
|
+
getTextAnchor: 'middle',
|
|
73
|
+
getAlignmentBaseline: 'top'
|
|
74
|
+
})
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=time-axis-layer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-axis-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;YACF,aAAa;YACb,IAAI,SAAS,CAAC;gBACZ,EAAE,EAAE,YAAY;gBAChB,IAAI,EAAE,SAAS;gBACf,iBAAiB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc;gBAC1C,iBAAiB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc;gBAC1C,QAAQ,EAAE,KAAK;gBACf,QAAQ,EAAE,CAAC;aACZ,CAAC;YACF,cAAc;YACd,IAAI,SAAS,CAAC;gBACZ,EAAE,EAAE,aAAa;gBACjB,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ;gBAC9B,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI;gBACtB,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,KAAK;gBACf,aAAa,EAAE,QAAQ;gBACvB,oBAAoB,EAAE,KAAK;aAC5B,CAAC;SACH,CAAC;IACJ,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { CompositeLayer, type LayerProps } from '@deck.gl/core';
|
|
2
|
+
import { LineLayer, TextLayer } from '@deck.gl/layers';
|
|
3
|
+
export type TimeDeltaLayerProps = LayerProps & {
|
|
4
|
+
unit: 'timestamp' | 'milliseconds';
|
|
5
|
+
minTimeMs: number;
|
|
6
|
+
maxTimeMs: number;
|
|
7
|
+
/** Start time in milliseconds since epoch */
|
|
8
|
+
startTimeMs: number;
|
|
9
|
+
/** End time in milliseconds since epoch */
|
|
10
|
+
endTimeMs: number;
|
|
11
|
+
/** Optional: Y-coordinate for the axis line (default: 0) */
|
|
12
|
+
y?: number;
|
|
13
|
+
header: boolean;
|
|
14
|
+
/** Optional: RGBA color for axis and ticks (default: [0, 0, 0, 255]) */
|
|
15
|
+
color?: [number, number, number, number];
|
|
16
|
+
/** Minimum Y-coordinate for grid lines. @todo (ib) Remve and calculate from viewport? */
|
|
17
|
+
yMin?: number;
|
|
18
|
+
/** Maximum Y-coordinate for grid lines. @todo (ib) Remve and calculate from viewport? */
|
|
19
|
+
yMax?: number;
|
|
20
|
+
};
|
|
21
|
+
export declare class TimeDeltaLayer extends CompositeLayer<TimeDeltaLayerProps> {
|
|
22
|
+
static layerName: string;
|
|
23
|
+
static defaultProps: Required<Omit<TimeDeltaLayerProps, keyof LayerProps>>;
|
|
24
|
+
renderLayers(): LineLayer<any, {
|
|
25
|
+
id: "time-delta-side-bars";
|
|
26
|
+
data: {
|
|
27
|
+
sourcePosition: number[];
|
|
28
|
+
targetPosition: number[];
|
|
29
|
+
}[];
|
|
30
|
+
getSourcePosition: (d: any) => any;
|
|
31
|
+
getTargetPosition: (d: any) => any;
|
|
32
|
+
getColor: [number, number, number, number];
|
|
33
|
+
getWidth: 4;
|
|
34
|
+
widthUnits: "pixels";
|
|
35
|
+
}>[] | (LineLayer<any, {
|
|
36
|
+
id: "header-time-delta-side-bars";
|
|
37
|
+
data: {
|
|
38
|
+
sourcePosition: number[];
|
|
39
|
+
targetPosition: number[];
|
|
40
|
+
}[];
|
|
41
|
+
getSourcePosition: (d: any) => any;
|
|
42
|
+
getTargetPosition: (d: any) => any;
|
|
43
|
+
getColor: [number, number, number, number];
|
|
44
|
+
getWidth: 4;
|
|
45
|
+
widthUnits: "pixels";
|
|
46
|
+
}> | LineLayer<any, {
|
|
47
|
+
id: "header-time-delta-dotted-line";
|
|
48
|
+
data: {
|
|
49
|
+
sourcePosition: number[];
|
|
50
|
+
targetPosition: number[];
|
|
51
|
+
}[];
|
|
52
|
+
getSourcePosition: (d: any) => any;
|
|
53
|
+
getTargetPosition: (d: any) => any;
|
|
54
|
+
getColor: [number, number, number, number];
|
|
55
|
+
getWidth: 1;
|
|
56
|
+
widthUnits: "pixels";
|
|
57
|
+
}> | TextLayer<any, {
|
|
58
|
+
id: "header-time-delta-label";
|
|
59
|
+
data: {
|
|
60
|
+
position: number[];
|
|
61
|
+
text: string;
|
|
62
|
+
}[];
|
|
63
|
+
getPosition: (d: any) => any;
|
|
64
|
+
getText: (d: any) => any;
|
|
65
|
+
getSize: 12;
|
|
66
|
+
getColor: [number, number, number, number];
|
|
67
|
+
getTextAnchor: "middle";
|
|
68
|
+
getAlignmentBaseline: "top";
|
|
69
|
+
background: true;
|
|
70
|
+
getBackgroundColor: [number, number, number, number];
|
|
71
|
+
backgroundPadding: [number, number];
|
|
72
|
+
}>)[];
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=time-delta-layer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-delta-layer.d.ts","sourceRoot":"","sources":["../../src/layers/time-delta-layer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,EAAE,KAAK,UAAU,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAMrD,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG;IAC7C,IAAI,EAAE,WAAW,GAAG,cAAc,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;IAEhB,wEAAwE;IACxE,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAAa,cAAe,SAAQ,cAAc,CAAC,mBAAmB,CAAC;IACrE,OAAgB,SAAS,SAAoB;IAC7C,OAAgB,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,mBAAmB,EAAE,MAAM,UAAU,CAAC,CAAC,CAWjF;IAEO,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2HtB"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { CompositeLayer } from '@deck.gl/core';
|
|
5
|
+
import { LineLayer, TextLayer } from '@deck.gl/layers';
|
|
6
|
+
// import {PathStyleExtension} from '@deck.gl/extensions';
|
|
7
|
+
import { formatTimeMs } from "../utils/format-utils.js";
|
|
8
|
+
export class TimeDeltaLayer extends CompositeLayer {
|
|
9
|
+
static layerName = 'TimeDeltaLayer';
|
|
10
|
+
static defaultProps = {
|
|
11
|
+
header: false,
|
|
12
|
+
minTimeMs: 0,
|
|
13
|
+
maxTimeMs: 100,
|
|
14
|
+
startTimeMs: 0,
|
|
15
|
+
endTimeMs: 100,
|
|
16
|
+
y: 0,
|
|
17
|
+
color: [0, 0, 0, 255],
|
|
18
|
+
unit: 'timestamp',
|
|
19
|
+
yMin: -1e6, // Should cover full viewport height in most cases
|
|
20
|
+
yMax: 1e6 // Should cover full viewport height in most cases
|
|
21
|
+
};
|
|
22
|
+
renderLayers() {
|
|
23
|
+
const { startTimeMs, endTimeMs, color = [0, 0, 0, 255], yMin, yMax } = this.props;
|
|
24
|
+
const timeDeltaPosition = [(startTimeMs + endTimeMs) / 2, 10];
|
|
25
|
+
const timeDeltaMs = Math.abs(endTimeMs - startTimeMs);
|
|
26
|
+
const timeDeltaLabel = formatTimeMs(timeDeltaMs, false);
|
|
27
|
+
if (!this.props.header) {
|
|
28
|
+
const timeLines = [
|
|
29
|
+
{
|
|
30
|
+
sourcePosition: [startTimeMs, yMin],
|
|
31
|
+
targetPosition: [startTimeMs, yMax]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
sourcePosition: [endTimeMs, yMin],
|
|
35
|
+
targetPosition: [endTimeMs, yMax]
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
return [
|
|
39
|
+
// Interval end lines
|
|
40
|
+
new LineLayer({
|
|
41
|
+
id: 'time-delta-side-bars',
|
|
42
|
+
data: timeLines,
|
|
43
|
+
getSourcePosition: (d) => d.sourcePosition,
|
|
44
|
+
getTargetPosition: (d) => d.targetPosition,
|
|
45
|
+
getColor: color,
|
|
46
|
+
getWidth: 4,
|
|
47
|
+
widthUnits: 'pixels'
|
|
48
|
+
})
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
// // Tick marks
|
|
52
|
+
// new LineLayer({
|
|
53
|
+
// id: 'time-delta-marks',
|
|
54
|
+
// data: tickLines,
|
|
55
|
+
// getSourcePosition: (d) => d.sourcePosition,
|
|
56
|
+
// getTargetPosition: (d) => d.targetPosition,
|
|
57
|
+
// getColor: color,
|
|
58
|
+
// getWidth: 1,
|
|
59
|
+
// }),
|
|
60
|
+
// TODO - triggers an update of monorepo root files
|
|
61
|
+
// new PathLayer({
|
|
62
|
+
// id: 'dotted-path',
|
|
63
|
+
// data: route,
|
|
64
|
+
// getPath: d => d.path,
|
|
65
|
+
// getWidth: 4,
|
|
66
|
+
// getColor: [255, 0, 0],
|
|
67
|
+
// // Enable rounded caps on each dash
|
|
68
|
+
// rounded: true,
|
|
69
|
+
// // Add the dash extension
|
|
70
|
+
// extensions: [
|
|
71
|
+
// new PathStyleExtension({
|
|
72
|
+
// dash: true,
|
|
73
|
+
// // highPrecisionDash: true, // uncomment for finer control at low zoom
|
|
74
|
+
// capRounded: true // draw dash ends as semicircles
|
|
75
|
+
// })
|
|
76
|
+
// ],
|
|
77
|
+
// // [dashLength, gapLength] in pixels
|
|
78
|
+
// // small dash + equal or larger gap = dotted effect
|
|
79
|
+
// getDashArray: () => [2, 6]
|
|
80
|
+
// })
|
|
81
|
+
// ]
|
|
82
|
+
const HEADER_Y = 12;
|
|
83
|
+
const timeLines = [
|
|
84
|
+
{
|
|
85
|
+
sourcePosition: [startTimeMs, -100],
|
|
86
|
+
targetPosition: [startTimeMs, HEADER_Y]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
sourcePosition: [endTimeMs, -100],
|
|
90
|
+
targetPosition: [endTimeMs, HEADER_Y]
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
return [
|
|
94
|
+
// Interval end lines
|
|
95
|
+
new LineLayer({
|
|
96
|
+
id: 'header-time-delta-side-bars',
|
|
97
|
+
data: timeLines,
|
|
98
|
+
getSourcePosition: (d) => d.sourcePosition,
|
|
99
|
+
getTargetPosition: (d) => d.targetPosition,
|
|
100
|
+
getColor: color,
|
|
101
|
+
getWidth: 4,
|
|
102
|
+
widthUnits: 'pixels'
|
|
103
|
+
}),
|
|
104
|
+
// Interval center
|
|
105
|
+
new LineLayer({
|
|
106
|
+
id: 'header-time-delta-dotted-line',
|
|
107
|
+
data: [
|
|
108
|
+
{
|
|
109
|
+
sourcePosition: [startTimeMs, HEADER_Y - 7],
|
|
110
|
+
targetPosition: [endTimeMs, HEADER_Y - 7]
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
getSourcePosition: (d) => d.sourcePosition,
|
|
114
|
+
getTargetPosition: (d) => d.targetPosition,
|
|
115
|
+
getColor: color,
|
|
116
|
+
getWidth: 1,
|
|
117
|
+
widthUnits: 'pixels'
|
|
118
|
+
}),
|
|
119
|
+
// Label
|
|
120
|
+
new TextLayer({
|
|
121
|
+
id: 'header-time-delta-label',
|
|
122
|
+
data: [{ position: timeDeltaPosition, text: timeDeltaLabel }],
|
|
123
|
+
getPosition: (d) => d.position,
|
|
124
|
+
getText: (d) => d.text,
|
|
125
|
+
getSize: 12,
|
|
126
|
+
getColor: color,
|
|
127
|
+
getTextAnchor: 'middle',
|
|
128
|
+
getAlignmentBaseline: 'top',
|
|
129
|
+
background: true,
|
|
130
|
+
getBackgroundColor: [255, 255, 255, 255], // Solid green background
|
|
131
|
+
backgroundPadding: [4, 2] // Horizontal and vertical padding
|
|
132
|
+
})
|
|
133
|
+
];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=time-delta-layer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-delta-layer.js","sourceRoot":"","sources":["../../src/layers/time-delta-layer.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,cAAc,EAAkB,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAErD,0DAA0D;AAE1D,OAAO,EAAC,YAAY,EAAC,iCAA8B;AAsBnD,MAAM,OAAO,cAAe,SAAQ,cAAmC;IACrE,MAAM,CAAU,SAAS,GAAG,gBAAgB,CAAC;IAC7C,MAAM,CAAU,YAAY,GAA0D;QACpF,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,GAAG;QACd,WAAW,EAAE,CAAC;QACd,SAAS,EAAE,GAAG;QACd,CAAC,EAAE,CAAC;QACJ,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;QACrB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,CAAC,GAAG,EAAE,kDAAkD;QAC9D,IAAI,EAAE,GAAG,CAAC,kDAAkD;KAC7D,CAAC;IAEO,YAAY;QACnB,MAAM,EAAC,WAAW,EAAE,SAAS,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QAEhF,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,GAAG,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9D,MAAM,WAAW,GAAG,IAAI,CAAC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EAAC,CAAC;gBAC3D,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ;gBAC9B,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI;gBACtB,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,KAAK;gBACf,aAAa,EAAE,QAAQ;gBACvB,oBAAoB,EAAE,KAAK;gBAC3B,UAAU,EAAE,IAAI;gBAChB,kBAAkB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,yBAAyB;gBACnE,iBAAiB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kCAAkC;aAC7D,CAAC;SACH,CAAC;IACJ,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CompositeLayer, type CompositeLayerProps, type UpdateParameters } from '@deck.gl/core';
|
|
2
|
+
import { LineLayer } from '@deck.gl/layers';
|
|
3
|
+
export type VerticalGridLayerProps = CompositeLayerProps & {
|
|
4
|
+
/** Start time in milliseconds since epoch */
|
|
5
|
+
xMin: number;
|
|
6
|
+
/** End time in milliseconds since epoch */
|
|
7
|
+
xMax: number;
|
|
8
|
+
/** Optional: Number of tick marks (default: 5) */
|
|
9
|
+
tickCount?: number;
|
|
10
|
+
/** Minimum Y-coordinate for grid lines */
|
|
11
|
+
yMin?: number;
|
|
12
|
+
/** Maximum Y-coordinate for grid lines */
|
|
13
|
+
yMax?: number;
|
|
14
|
+
/** Optional: Width of the grid lines (default: 1) */
|
|
15
|
+
width?: number;
|
|
16
|
+
/** Optional: RGBA color for grid lines (default: [200, 200, 200, 255]) */
|
|
17
|
+
color?: [number, number, number, number];
|
|
18
|
+
};
|
|
19
|
+
export declare class VerticalGridLayer extends CompositeLayer<VerticalGridLayerProps> {
|
|
20
|
+
static layerName: string;
|
|
21
|
+
static defaultProps: {
|
|
22
|
+
yMin: number;
|
|
23
|
+
yMax: number;
|
|
24
|
+
tickCount: number;
|
|
25
|
+
width: number;
|
|
26
|
+
color: number[];
|
|
27
|
+
};
|
|
28
|
+
shouldUpdateState(params: UpdateParameters<VerticalGridLayer>): boolean;
|
|
29
|
+
renderLayers(): LineLayer<any, {
|
|
30
|
+
id: `${string}-lines`;
|
|
31
|
+
data: {
|
|
32
|
+
sourcePosition: any[];
|
|
33
|
+
targetPosition: any[];
|
|
34
|
+
}[];
|
|
35
|
+
getSourcePosition: (d: any) => any;
|
|
36
|
+
getTargetPosition: (d: any) => any;
|
|
37
|
+
getColor: [number, number, number, number];
|
|
38
|
+
getWidth: 1;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=vertical-grid-layer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertical-grid-layer.d.ts","sourceRoot":"","sources":["../../src/layers/vertical-grid-layer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,EAAE,KAAK,mBAAmB,EAAE,KAAK,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAI1C,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,GAAG;IACzD,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,sBAAsB,CAAC;IAC3E,OAAgB,SAAS,SAAuB;IAChD,OAAgB,YAAY;;;;;;MAM1B;IAEO,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,OAAO;IAIvE,YAAY;;;;;;;;;;;CA4BtB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { CompositeLayer } from '@deck.gl/core';
|
|
5
|
+
import { LineLayer } from '@deck.gl/layers';
|
|
6
|
+
import { getPrettyTicks, getZoomedRange } from "../utils/tick-utils.js";
|
|
7
|
+
export class VerticalGridLayer extends CompositeLayer {
|
|
8
|
+
static layerName = 'VerticalGridLayer';
|
|
9
|
+
static defaultProps = {
|
|
10
|
+
yMin: -1e6,
|
|
11
|
+
yMax: 1e6,
|
|
12
|
+
tickCount: 5,
|
|
13
|
+
width: 1,
|
|
14
|
+
color: [200, 200, 200, 255]
|
|
15
|
+
};
|
|
16
|
+
shouldUpdateState(params) {
|
|
17
|
+
return params.changeFlags.viewportChanged || super.shouldUpdateState(params);
|
|
18
|
+
}
|
|
19
|
+
renderLayers() {
|
|
20
|
+
const { xMin, xMax, tickCount = 5, yMin, yMax, color } = this.props;
|
|
21
|
+
// Access the current viewport
|
|
22
|
+
const viewport = this.context.viewport;
|
|
23
|
+
const bounds = viewport.getBounds(); // Returns [minX, minY, maxX, maxY]
|
|
24
|
+
// Calculate the visible time range based on the viewport bounds
|
|
25
|
+
const [startTimeZoomed, endTimeZoomed] = getZoomedRange(xMin, xMax, bounds);
|
|
26
|
+
// Generate tick positions
|
|
27
|
+
const tickPositions = getPrettyTicks(startTimeZoomed, endTimeZoomed, tickCount);
|
|
28
|
+
// Create vertical grid lines at each tick position
|
|
29
|
+
const gridLines = tickPositions.map((x) => ({
|
|
30
|
+
sourcePosition: [x, yMin],
|
|
31
|
+
targetPosition: [x, yMax]
|
|
32
|
+
}));
|
|
33
|
+
return new LineLayer({
|
|
34
|
+
id: `${this.props.id}-lines`,
|
|
35
|
+
data: gridLines,
|
|
36
|
+
getSourcePosition: (d) => d.sourcePosition,
|
|
37
|
+
getTargetPosition: (d) => d.targetPosition,
|
|
38
|
+
getColor: color,
|
|
39
|
+
getWidth: 1
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=vertical-grid-layer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertical-grid-layer.js","sourceRoot":"","sources":["../../src/layers/vertical-grid-layer.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,cAAc,EAAkD,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAC,cAAc,EAAE,cAAc,EAAC,+BAA4B;AAmBnE,MAAM,OAAO,iBAAkB,SAAQ,cAAsC;IAC3E,MAAM,CAAU,SAAS,GAAG,mBAAmB,CAAC;IAChD,MAAM,CAAU,YAAY,GAAG;QAC7B,IAAI,EAAE,CAAC,GAAG;QACV,IAAI,EAAE,GAAG;QACT,SAAS,EAAE,CAAC;QACZ,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;KAC5B,CAAC;IAEO,iBAAiB,CAAC,MAA2C;QACpE,OAAO,MAAM,CAAC,WAAW,CAAC,eAAe,IAAI,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC/E,CAAC;IAEQ,YAAY;QACnB,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QAElE,8BAA8B;QAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QACvC,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,mCAAmC;QAExE,gEAAgE;QAChE,MAAM,CAAC,eAAe,EAAE,aAAa,CAAC,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAE5E,0BAA0B;QAC1B,MAAM,aAAa,GAAG,cAAc,CAAC,eAAe,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;QAEhF,mDAAmD;QACnD,MAAM,SAAS,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC1C,cAAc,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC;YACzB,cAAc,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC;SAC1B,CAAC,CAAC,CAAC;QAEJ,OAAO,IAAI,SAAS,CAAC;YACnB,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,QAAQ;YAC5B,IAAI,EAAE,SAAS;YACf,iBAAiB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc;YAC1C,iBAAiB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc;YAC1C,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,CAAC;SACZ,CAAC,CAAC;IACL,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { OrthographicView } from '@deck.gl/core';
|
|
2
|
+
import type { OrthographicViewState } from '@deck.gl/core';
|
|
3
|
+
export declare const HEADER_VIEW_HEIGHT = 50;
|
|
4
|
+
export declare const LEGEND_VIEW_WIDTH = 150;
|
|
5
|
+
export declare const SYNCHRONIZED_VIEWS: OrthographicView[];
|
|
6
|
+
export declare const SYNCHRONIZED_VIEW_STATE_CONSTRAINTS: {
|
|
7
|
+
header: {
|
|
8
|
+
target: [any, number];
|
|
9
|
+
zoom: [any, number];
|
|
10
|
+
};
|
|
11
|
+
legend: {
|
|
12
|
+
target: [number, any];
|
|
13
|
+
zoom: [number, any];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare function getSynchronizedViewStates(viewState: OrthographicViewState): {
|
|
17
|
+
header: OrthographicViewState;
|
|
18
|
+
legend: OrthographicViewState;
|
|
19
|
+
main: OrthographicViewState;
|
|
20
|
+
};
|
|
21
|
+
export declare function fitSynchronizedViewStatesToBounds(props: {
|
|
22
|
+
viewState: {
|
|
23
|
+
header: OrthographicViewState;
|
|
24
|
+
legend: OrthographicViewState;
|
|
25
|
+
main: OrthographicViewState;
|
|
26
|
+
};
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
bounds: [[xMin: number, yMin: number], [xMax: number, yMax: number]];
|
|
30
|
+
/** App should set to true on first call */
|
|
31
|
+
initialize: boolean;
|
|
32
|
+
headerHeight?: number;
|
|
33
|
+
legendWidth?: number;
|
|
34
|
+
}): {
|
|
35
|
+
header: OrthographicViewState;
|
|
36
|
+
legend: OrthographicViewState;
|
|
37
|
+
main: OrthographicViewState;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=synchronized-views.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synchronized-views.d.ts","sourceRoot":"","sources":["../../src/synchronized-views/synchronized-views.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyB,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAMvE,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,eAAe,CAAC;AAEzD,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,eAAO,MAAM,kBAAkB,oBAoC9B,CAAC;AAEF,eAAO,MAAM,mCAAmC;;;;;;;;;CAG/C,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,qBAAqB;;;;EAMzE;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE;IACvD,SAAS,EAAE;QACT,MAAM,EAAE,qBAAqB,CAAC;QAC9B,MAAM,EAAE,qBAAqB,CAAC;QAC9B,IAAI,EAAE,qBAAqB,CAAC;KAC7B,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IACrE,2CAA2C;IAC3C,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG;IACF,MAAM,EAAE,qBAAqB,CAAC;IAC9B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,IAAI,EAAE,qBAAqB,CAAC;CAC7B,CA6BA"}
|