gladly-plot 0.0.3 → 0.0.5
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/README.md +1 -0
- package/package.json +16 -8
- package/src/axes/Axis.js +253 -0
- package/src/{AxisQuantityKindRegistry.js → axes/AxisQuantityKindRegistry.js} +7 -0
- package/src/{AxisRegistry.js → axes/AxisRegistry.js} +48 -0
- package/src/axes/ColorAxisRegistry.js +93 -0
- package/src/{FilterAxisRegistry.js → axes/FilterAxisRegistry.js} +63 -0
- package/src/axes/ZoomController.js +141 -0
- package/src/colorscales/BivariateColorscales.js +205 -0
- package/src/colorscales/ColorscaleRegistry.js +124 -0
- package/src/compute/ComputationRegistry.js +237 -0
- package/src/compute/axisFilter.js +47 -0
- package/src/compute/conv.js +230 -0
- package/src/compute/fft.js +292 -0
- package/src/compute/filter.js +227 -0
- package/src/compute/hist.js +180 -0
- package/src/compute/kde.js +102 -0
- package/src/{Layer.js → core/Layer.js} +4 -3
- package/src/{LayerType.js → core/LayerType.js} +72 -7
- package/src/core/Plot.js +735 -0
- package/src/{Colorbar.js → floats/Colorbar.js} +19 -5
- package/src/floats/Colorbar2d.js +77 -0
- package/src/{Filterbar.js → floats/Filterbar.js} +18 -4
- package/src/{FilterbarFloat.js → floats/Float.js} +17 -30
- package/src/{EpsgUtils.js → geo/EpsgUtils.js} +1 -1
- package/src/index.js +35 -22
- package/src/{ColorbarLayer.js → layers/ColorbarLayer.js} +2 -2
- package/src/layers/ColorbarLayer2d.js +97 -0
- package/src/{FilterbarLayer.js → layers/FilterbarLayer.js} +2 -2
- package/src/layers/HistogramLayer.js +212 -0
- package/src/layers/LinesLayer.js +199 -0
- package/src/layers/PointsLayer.js +114 -0
- package/src/layers/ScatterShared.js +142 -0
- package/src/{TileLayer.js → layers/TileLayer.js} +4 -4
- package/src/Axis.js +0 -48
- package/src/ColorAxisRegistry.js +0 -49
- package/src/ColorscaleRegistry.js +0 -52
- package/src/Float.js +0 -159
- package/src/Plot.js +0 -1068
- package/src/ScatterLayer.js +0 -133
- /package/src/{AxisLink.js → axes/AxisLink.js} +0 -0
- /package/src/{MatplotlibColorscales.js → colorscales/MatplotlibColorscales.js} +0 -0
- /package/src/{Data.js → core/Data.js} +0 -0
- /package/src/{LayerTypeRegistry.js → core/LayerTypeRegistry.js} +0 -0
package/src/ScatterLayer.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { LayerType } from "./LayerType.js"
|
|
2
|
-
import { AXES } from "./AxisRegistry.js"
|
|
3
|
-
import { registerLayerType } from "./LayerTypeRegistry.js"
|
|
4
|
-
import { Data } from "./Data.js"
|
|
5
|
-
|
|
6
|
-
export const scatterLayerType = new LayerType({
|
|
7
|
-
name: "scatter",
|
|
8
|
-
|
|
9
|
-
getAxisConfig: function(parameters, data) {
|
|
10
|
-
const d = Data.wrap(data)
|
|
11
|
-
const { xData, yData, vData, xAxis, yAxis } = parameters
|
|
12
|
-
return {
|
|
13
|
-
xAxis,
|
|
14
|
-
xAxisQuantityKind: d.getQuantityKind(xData) ?? xData,
|
|
15
|
-
yAxis,
|
|
16
|
-
yAxisQuantityKind: d.getQuantityKind(yData) ?? yData,
|
|
17
|
-
colorAxisQuantityKinds: [d.getQuantityKind(vData) ?? vData],
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
vert: `
|
|
22
|
-
precision mediump float;
|
|
23
|
-
attribute float x;
|
|
24
|
-
attribute float y;
|
|
25
|
-
attribute float color_data;
|
|
26
|
-
uniform vec2 xDomain;
|
|
27
|
-
uniform vec2 yDomain;
|
|
28
|
-
uniform float xScaleType;
|
|
29
|
-
uniform float yScaleType;
|
|
30
|
-
varying float value;
|
|
31
|
-
void main() {
|
|
32
|
-
float nx = normalize_axis(x, xDomain, xScaleType);
|
|
33
|
-
float ny = normalize_axis(y, yDomain, yScaleType);
|
|
34
|
-
gl_Position = vec4(nx*2.0-1.0, ny*2.0-1.0, 0, 1);
|
|
35
|
-
gl_PointSize = 4.0;
|
|
36
|
-
value = color_data;
|
|
37
|
-
}
|
|
38
|
-
`,
|
|
39
|
-
frag: `
|
|
40
|
-
precision mediump float;
|
|
41
|
-
uniform int colorscale;
|
|
42
|
-
uniform vec2 color_range;
|
|
43
|
-
uniform float color_scale_type;
|
|
44
|
-
uniform float alphaBlend;
|
|
45
|
-
varying float value;
|
|
46
|
-
void main() {
|
|
47
|
-
gl_FragColor = map_color_s(colorscale, color_range, value, color_scale_type, alphaBlend);
|
|
48
|
-
}
|
|
49
|
-
`,
|
|
50
|
-
schema: (data) => {
|
|
51
|
-
const dataProperties = Data.wrap(data).columns()
|
|
52
|
-
return {
|
|
53
|
-
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
54
|
-
type: "object",
|
|
55
|
-
properties: {
|
|
56
|
-
xData: {
|
|
57
|
-
type: "string",
|
|
58
|
-
enum: dataProperties,
|
|
59
|
-
description: "Property name in data object for x coordinates"
|
|
60
|
-
},
|
|
61
|
-
yData: {
|
|
62
|
-
type: "string",
|
|
63
|
-
enum: dataProperties,
|
|
64
|
-
description: "Property name in data object for y coordinates"
|
|
65
|
-
},
|
|
66
|
-
vData: {
|
|
67
|
-
type: "string",
|
|
68
|
-
enum: dataProperties,
|
|
69
|
-
description: "Property name in data object for color values; also used as the color axis quantity kind"
|
|
70
|
-
},
|
|
71
|
-
xAxis: {
|
|
72
|
-
type: "string",
|
|
73
|
-
enum: AXES.filter(a => a.includes("x")),
|
|
74
|
-
default: "xaxis_bottom",
|
|
75
|
-
description: "Which x-axis to use for this layer"
|
|
76
|
-
},
|
|
77
|
-
yAxis: {
|
|
78
|
-
type: "string",
|
|
79
|
-
enum: AXES.filter(a => a.includes("y")),
|
|
80
|
-
default: "yaxis_left",
|
|
81
|
-
description: "Which y-axis to use for this layer"
|
|
82
|
-
},
|
|
83
|
-
alphaBlend: {
|
|
84
|
-
type: "boolean",
|
|
85
|
-
default: false,
|
|
86
|
-
description: "Map the normalized color value to alpha so low values fade to transparent"
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
required: ["xData", "yData", "vData"]
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
createLayer: function(parameters, data) {
|
|
93
|
-
const d = Data.wrap(data)
|
|
94
|
-
const { xData, yData, vData, alphaBlend = false } = parameters
|
|
95
|
-
|
|
96
|
-
const xQK = d.getQuantityKind(xData) ?? xData
|
|
97
|
-
const yQK = d.getQuantityKind(yData) ?? yData
|
|
98
|
-
const vQK = d.getQuantityKind(vData) ?? vData
|
|
99
|
-
|
|
100
|
-
const x = d.getData(xData)
|
|
101
|
-
const y = d.getData(yData)
|
|
102
|
-
const v = d.getData(vData)
|
|
103
|
-
|
|
104
|
-
if (!x) throw new Error(`Data column '${xData}' not found`)
|
|
105
|
-
if (!y) throw new Error(`Data column '${yData}' not found`)
|
|
106
|
-
if (!v) throw new Error(`Data column '${vData}' not found`)
|
|
107
|
-
|
|
108
|
-
const domains = {}
|
|
109
|
-
const xDomain = d.getDomain(xData)
|
|
110
|
-
const yDomain = d.getDomain(yData)
|
|
111
|
-
const vDomain = d.getDomain(vData)
|
|
112
|
-
if (xDomain) domains[xQK] = xDomain
|
|
113
|
-
if (yDomain) domains[yQK] = yDomain
|
|
114
|
-
if (vDomain) domains[vQK] = vDomain
|
|
115
|
-
|
|
116
|
-
return [{
|
|
117
|
-
attributes: { x, y, [vQK]: v },
|
|
118
|
-
uniforms: { alphaBlend: alphaBlend ? 1.0 : 0.0 },
|
|
119
|
-
domains,
|
|
120
|
-
nameMap: {
|
|
121
|
-
[vQK]: 'color_data',
|
|
122
|
-
[`colorscale_${vQK}`]: 'colorscale',
|
|
123
|
-
[`color_range_${vQK}`]: 'color_range',
|
|
124
|
-
[`color_scale_type_${vQK}`]: 'color_scale_type',
|
|
125
|
-
},
|
|
126
|
-
blend: alphaBlend ? {
|
|
127
|
-
enable: true,
|
|
128
|
-
func: { srcRGB: 'src alpha', dstRGB: 'one minus src alpha', srcAlpha: 0, dstAlpha: 1 },
|
|
129
|
-
} : null,
|
|
130
|
-
}]
|
|
131
|
-
}
|
|
132
|
-
})
|
|
133
|
-
registerLayerType("scatter", scatterLayerType)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|