gladly-plot 0.0.8 → 0.0.10
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/package.json +1 -1
- package/src/core/Plot.js +17 -28
package/package.json
CHANGED
package/src/core/Plot.js
CHANGED
|
@@ -98,29 +98,18 @@ function buildPlotSchema(data, config) {
|
|
|
98
98
|
},
|
|
99
99
|
axes: {
|
|
100
100
|
type: "object",
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
type: "object",
|
|
105
|
-
properties: {
|
|
106
|
-
quantity_kind: { type: "string" },
|
|
107
|
-
min: { type: "number" },
|
|
108
|
-
max: { type: "number" },
|
|
109
|
-
label: { type: "string" },
|
|
110
|
-
scale: { type: "string", enum: ["linear", "log"] },
|
|
111
|
-
...(isXAxis ? { rotate: { type: "boolean" } } : {})
|
|
112
|
-
}
|
|
113
|
-
}]
|
|
114
|
-
})),
|
|
101
|
+
// All axes (spatial, color, filter) are populated by getConfig() after the first render.
|
|
102
|
+
// Using only additionalProperties means no hardcoded axis list appears in the schema;
|
|
103
|
+
// the config editor shows exactly the axes declared by active layers.
|
|
115
104
|
additionalProperties: {
|
|
116
|
-
// Color/filter/quantity-kind axes.
|
|
117
|
-
// All fields from the quantity kind registration are valid here and override the registration.
|
|
118
105
|
type: "object",
|
|
119
106
|
properties: {
|
|
107
|
+
quantity_kind: { type: "string" },
|
|
120
108
|
min: { type: "number" },
|
|
121
109
|
max: { type: "number" },
|
|
122
110
|
label: { type: "string" },
|
|
123
111
|
scale: { type: "string", enum: ["linear", "log"] },
|
|
112
|
+
rotate: { type: "boolean" },
|
|
124
113
|
colorscale: {
|
|
125
114
|
type: "string",
|
|
126
115
|
enum: [
|
|
@@ -233,18 +222,18 @@ export class Plot extends GlBase {
|
|
|
233
222
|
const plotWidth = width - this.margin.left - this.margin.right
|
|
234
223
|
const plotHeight = height - this.margin.top - this.margin.bottom
|
|
235
224
|
|
|
236
|
-
//
|
|
237
|
-
//
|
|
238
|
-
//
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
this.canvas.width = width
|
|
242
|
-
this.canvas.height = height
|
|
243
|
-
|
|
244
|
-
this.width = width
|
|
245
|
-
this.height = height
|
|
246
|
-
this.plotWidth = plotWidth
|
|
247
|
-
this.plotHeight = plotHeight
|
|
225
|
+
// Clamp to at least 1×1 so _initialize() always runs and getConfig() stays
|
|
226
|
+
// accurate even when the container is hidden or too small to fit the margins.
|
|
227
|
+
// The canvas backing store and WebGL context update synchronously; the D3
|
|
228
|
+
// axis pixel ranges will be corrected when the ResizeObserver fires on
|
|
229
|
+
// becoming visible.
|
|
230
|
+
this.canvas.width = Math.max(1, width)
|
|
231
|
+
this.canvas.height = Math.max(1, height)
|
|
232
|
+
|
|
233
|
+
this.width = Math.max(1, width)
|
|
234
|
+
this.height = Math.max(1, height)
|
|
235
|
+
this.plotWidth = Math.max(1, plotWidth)
|
|
236
|
+
this.plotHeight = Math.max(1, plotHeight)
|
|
248
237
|
|
|
249
238
|
this._warnedMissingDomains = false
|
|
250
239
|
await this._initialize()
|