@sipemu/ggplot-rs 0.0.0-stage → 0.35.1
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-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +154 -2
- package/dist/ggplot_rs.d.ts +318 -0
- package/dist/ggplot_rs.js +640 -0
- package/dist/ggplot_rs_bg.wasm +0 -0
- package/dist/ggplot_rs_bg.wasm.d.ts +30 -0
- package/package.json +62 -4
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
/* @ts-self-types="./ggplot_rs.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Axes/gridlines frame for a WebGL scatter overlay: the SVG (no marks) plus the
|
|
5
|
+
* panel rect in pixels and the expanded data domain that maps to the panel edges.
|
|
6
|
+
*/
|
|
7
|
+
export class Frame {
|
|
8
|
+
static __wrap(ptr) {
|
|
9
|
+
ptr = ptr >>> 0;
|
|
10
|
+
const obj = Object.create(Frame.prototype);
|
|
11
|
+
obj.__wbg_ptr = ptr;
|
|
12
|
+
FrameFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
__destroy_into_raw() {
|
|
16
|
+
const ptr = this.__wbg_ptr;
|
|
17
|
+
this.__wbg_ptr = 0;
|
|
18
|
+
FrameFinalization.unregister(this);
|
|
19
|
+
return ptr;
|
|
20
|
+
}
|
|
21
|
+
free() {
|
|
22
|
+
const ptr = this.__destroy_into_raw();
|
|
23
|
+
wasm.__wbg_frame_free(ptr, 0);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Panel rect `[x, y, width, height]` in pixels.
|
|
27
|
+
* @returns {Float64Array}
|
|
28
|
+
*/
|
|
29
|
+
get plot() {
|
|
30
|
+
const ret = wasm.frame_plot(this.__wbg_ptr);
|
|
31
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
32
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
33
|
+
return v1;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @returns {string}
|
|
37
|
+
*/
|
|
38
|
+
get svg() {
|
|
39
|
+
let deferred1_0;
|
|
40
|
+
let deferred1_1;
|
|
41
|
+
try {
|
|
42
|
+
const ret = wasm.frame_svg(this.__wbg_ptr);
|
|
43
|
+
deferred1_0 = ret[0];
|
|
44
|
+
deferred1_1 = ret[1];
|
|
45
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
46
|
+
} finally {
|
|
47
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Expanded x range `[min, max]` mapping to the panel's left/right edge.
|
|
52
|
+
* @returns {Float64Array}
|
|
53
|
+
*/
|
|
54
|
+
get xdom() {
|
|
55
|
+
const ret = wasm.frame_xdom(this.__wbg_ptr);
|
|
56
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
57
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
58
|
+
return v1;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @returns {Float64Array}
|
|
62
|
+
*/
|
|
63
|
+
get ydom() {
|
|
64
|
+
const ret = wasm.frame_ydom(this.__wbg_ptr);
|
|
65
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
66
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
67
|
+
return v1;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (Symbol.dispose) Frame.prototype[Symbol.dispose] = Frame.prototype.free;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* An SVG plus the build warnings (rows dropped for non-finite values, layers
|
|
74
|
+
* whose stat produced no data, …).
|
|
75
|
+
*/
|
|
76
|
+
export class RenderResult {
|
|
77
|
+
static __wrap(ptr) {
|
|
78
|
+
ptr = ptr >>> 0;
|
|
79
|
+
const obj = Object.create(RenderResult.prototype);
|
|
80
|
+
obj.__wbg_ptr = ptr;
|
|
81
|
+
RenderResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
82
|
+
return obj;
|
|
83
|
+
}
|
|
84
|
+
__destroy_into_raw() {
|
|
85
|
+
const ptr = this.__wbg_ptr;
|
|
86
|
+
this.__wbg_ptr = 0;
|
|
87
|
+
RenderResultFinalization.unregister(this);
|
|
88
|
+
return ptr;
|
|
89
|
+
}
|
|
90
|
+
free() {
|
|
91
|
+
const ptr = this.__destroy_into_raw();
|
|
92
|
+
wasm.__wbg_renderresult_free(ptr, 0);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* @returns {string}
|
|
96
|
+
*/
|
|
97
|
+
get svg() {
|
|
98
|
+
let deferred1_0;
|
|
99
|
+
let deferred1_1;
|
|
100
|
+
try {
|
|
101
|
+
const ret = wasm.renderresult_svg(this.__wbg_ptr);
|
|
102
|
+
deferred1_0 = ret[0];
|
|
103
|
+
deferred1_1 = ret[1];
|
|
104
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
105
|
+
} finally {
|
|
106
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @returns {string[]}
|
|
111
|
+
*/
|
|
112
|
+
get warnings() {
|
|
113
|
+
const ret = wasm.renderresult_warnings(this.__wbg_ptr);
|
|
114
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
115
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
116
|
+
return v1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (Symbol.dispose) RenderResult.prototype[Symbol.dispose] = RenderResult.prototype.free;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Bounding box `[minx, miny, maxx, maxy]` of a spec's `geometry` (WKT array) —
|
|
123
|
+
* so JS can initialise a pan/zoom (roam) window and zoom around the cursor.
|
|
124
|
+
* @param {string} spec_json
|
|
125
|
+
* @returns {Float64Array}
|
|
126
|
+
*/
|
|
127
|
+
export function geo_bounds(spec_json) {
|
|
128
|
+
const ptr0 = passStringToWasm0(spec_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
129
|
+
const len0 = WASM_VECTOR_LEN;
|
|
130
|
+
const ret = wasm.geo_bounds(ptr0, len0);
|
|
131
|
+
if (ret[3]) {
|
|
132
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
133
|
+
}
|
|
134
|
+
var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
135
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
136
|
+
return v2;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The geom names {@link render} accepts.
|
|
141
|
+
* @returns {string[]}
|
|
142
|
+
*/
|
|
143
|
+
export function geoms() {
|
|
144
|
+
const ret = wasm.geoms();
|
|
145
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
146
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
147
|
+
return v1;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Render a layered plot spec (a {@link PlotSpec} object or its JSON text) to
|
|
152
|
+
* an SVG document. Throws an `Error` naming the offending field — unknown
|
|
153
|
+
* columns list the available ones.
|
|
154
|
+
* @param {PlotSpec | string} spec
|
|
155
|
+
* @returns {string}
|
|
156
|
+
*/
|
|
157
|
+
export function render(spec) {
|
|
158
|
+
let deferred2_0;
|
|
159
|
+
let deferred2_1;
|
|
160
|
+
try {
|
|
161
|
+
const ret = wasm.render(spec);
|
|
162
|
+
var ptr1 = ret[0];
|
|
163
|
+
var len1 = ret[1];
|
|
164
|
+
if (ret[3]) {
|
|
165
|
+
ptr1 = 0; len1 = 0;
|
|
166
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
167
|
+
}
|
|
168
|
+
deferred2_0 = ptr1;
|
|
169
|
+
deferred2_1 = len1;
|
|
170
|
+
return getStringFromWasm0(ptr1, len1);
|
|
171
|
+
} finally {
|
|
172
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Like {@link render}, but also returns the build warnings.
|
|
178
|
+
* @param {PlotSpec | string} spec
|
|
179
|
+
* @returns {RenderResult}
|
|
180
|
+
*/
|
|
181
|
+
export function renderWithWarnings(spec) {
|
|
182
|
+
const ret = wasm.renderWithWarnings(spec);
|
|
183
|
+
if (ret[2]) {
|
|
184
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
185
|
+
}
|
|
186
|
+
return RenderResult.__wrap(ret[0]);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Render a bar chart (SVG, hover tooltips) from `{ category: [String],
|
|
191
|
+
* value: [Number], width?, height?, title? }`. Bars are coloured by category
|
|
192
|
+
* with the Set1 palette — matching the scatter's groups for linked views.
|
|
193
|
+
* @param {string} spec_json
|
|
194
|
+
* @returns {string}
|
|
195
|
+
*/
|
|
196
|
+
export function render_bar(spec_json) {
|
|
197
|
+
let deferred3_0;
|
|
198
|
+
let deferred3_1;
|
|
199
|
+
try {
|
|
200
|
+
const ptr0 = passStringToWasm0(spec_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
201
|
+
const len0 = WASM_VECTOR_LEN;
|
|
202
|
+
const ret = wasm.render_bar(ptr0, len0);
|
|
203
|
+
var ptr2 = ret[0];
|
|
204
|
+
var len2 = ret[1];
|
|
205
|
+
if (ret[3]) {
|
|
206
|
+
ptr2 = 0; len2 = 0;
|
|
207
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
208
|
+
}
|
|
209
|
+
deferred3_0 = ptr2;
|
|
210
|
+
deferred3_1 = len2;
|
|
211
|
+
return getStringFromWasm0(ptr2, len2);
|
|
212
|
+
} finally {
|
|
213
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Render a `geom_sf` map from a JSON spec, returning an SVG document.
|
|
219
|
+
*
|
|
220
|
+
* Spec fields:
|
|
221
|
+
* - `geometry`: `[String]` — WKT (required)
|
|
222
|
+
* - `fill`: `[Number]` — choropleth values (optional)
|
|
223
|
+
* - `label`: `[String]` — hover labels (optional)
|
|
224
|
+
* - `fill_name`, `title`: `String` (optional)
|
|
225
|
+
* - `width`, `height`: `Number` (default 800×600)
|
|
226
|
+
* - `projection`: `"mercator"` | `"platecarree"` (default) | `"equal-earth"` |
|
|
227
|
+
* `"albers-usa"` | `"albers-europe"` | `"utm:<zone>"` / `"utm:<zone>s"` (south,
|
|
228
|
+
* zone 1-60)
|
|
229
|
+
* @param {string} spec_json
|
|
230
|
+
* @returns {string}
|
|
231
|
+
*/
|
|
232
|
+
export function render_geo(spec_json) {
|
|
233
|
+
let deferred3_0;
|
|
234
|
+
let deferred3_1;
|
|
235
|
+
try {
|
|
236
|
+
const ptr0 = passStringToWasm0(spec_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
237
|
+
const len0 = WASM_VECTOR_LEN;
|
|
238
|
+
const ret = wasm.render_geo(ptr0, len0);
|
|
239
|
+
var ptr2 = ret[0];
|
|
240
|
+
var len2 = ret[1];
|
|
241
|
+
if (ret[3]) {
|
|
242
|
+
ptr2 = 0; len2 = 0;
|
|
243
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
244
|
+
}
|
|
245
|
+
deferred3_0 = ptr2;
|
|
246
|
+
deferred3_1 = len2;
|
|
247
|
+
return getStringFromWasm0(ptr2, len2);
|
|
248
|
+
} finally {
|
|
249
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Render a histogram (SVG) from a numeric array; `bins` sets the bin count —
|
|
255
|
+
* drive it from a slider for an interactive histogram. Feature `wasm`.
|
|
256
|
+
* @param {Float64Array} values
|
|
257
|
+
* @param {number} bins
|
|
258
|
+
* @param {number} width
|
|
259
|
+
* @param {number} height
|
|
260
|
+
* @param {string} title
|
|
261
|
+
* @returns {string}
|
|
262
|
+
*/
|
|
263
|
+
export function render_hist(values, bins, width, height, title) {
|
|
264
|
+
let deferred4_0;
|
|
265
|
+
let deferred4_1;
|
|
266
|
+
try {
|
|
267
|
+
const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
|
|
268
|
+
const len0 = WASM_VECTOR_LEN;
|
|
269
|
+
const ptr1 = passStringToWasm0(title, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
270
|
+
const len1 = WASM_VECTOR_LEN;
|
|
271
|
+
const ret = wasm.render_hist(ptr0, len0, bins, width, height, ptr1, len1);
|
|
272
|
+
var ptr3 = ret[0];
|
|
273
|
+
var len3 = ret[1];
|
|
274
|
+
if (ret[3]) {
|
|
275
|
+
ptr3 = 0; len3 = 0;
|
|
276
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
277
|
+
}
|
|
278
|
+
deferred4_0 = ptr3;
|
|
279
|
+
deferred4_1 = len3;
|
|
280
|
+
return getStringFromWasm0(ptr3, len3);
|
|
281
|
+
} finally {
|
|
282
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* General grammar-of-graphics renderer — expose most geoms to JS via a spec:
|
|
288
|
+
* `{ data: {col:[...]}, geom, aes:{x,y,color,fill,group,size}, title, width,
|
|
289
|
+
* height, flip, log_x, log_y, palette, bins, smooth:"lm"|"loess" }`. Returns an
|
|
290
|
+
* SVG document (with hover tooltips where the geom emits them).
|
|
291
|
+
* @param {string} spec_json
|
|
292
|
+
* @returns {string}
|
|
293
|
+
*/
|
|
294
|
+
export function render_plot(spec_json) {
|
|
295
|
+
let deferred3_0;
|
|
296
|
+
let deferred3_1;
|
|
297
|
+
try {
|
|
298
|
+
const ptr0 = passStringToWasm0(spec_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
299
|
+
const len0 = WASM_VECTOR_LEN;
|
|
300
|
+
const ret = wasm.render_plot(ptr0, len0);
|
|
301
|
+
var ptr2 = ret[0];
|
|
302
|
+
var len2 = ret[1];
|
|
303
|
+
if (ret[3]) {
|
|
304
|
+
ptr2 = 0; len2 = 0;
|
|
305
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
306
|
+
}
|
|
307
|
+
deferred3_0 = ptr2;
|
|
308
|
+
deferred3_1 = len2;
|
|
309
|
+
return getStringFromWasm0(ptr2, len2);
|
|
310
|
+
} finally {
|
|
311
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Render just the axes/gridlines (no marks, via `geom_blank`) for the given
|
|
317
|
+
* data ranges, returning the SVG plus the panel rect and expanded domain — the
|
|
318
|
+
* frame a WebGL/canvas layer draws points onto.
|
|
319
|
+
* @param {number} xmin
|
|
320
|
+
* @param {number} xmax
|
|
321
|
+
* @param {number} ymin
|
|
322
|
+
* @param {number} ymax
|
|
323
|
+
* @param {number} width
|
|
324
|
+
* @param {number} height
|
|
325
|
+
* @param {string} title
|
|
326
|
+
* @returns {Frame}
|
|
327
|
+
*/
|
|
328
|
+
export function scatter_frame(xmin, xmax, ymin, ymax, width, height, title) {
|
|
329
|
+
const ptr0 = passStringToWasm0(title, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
330
|
+
const len0 = WASM_VECTOR_LEN;
|
|
331
|
+
const ret = wasm.scatter_frame(xmin, xmax, ymin, ymax, width, height, ptr0, len0);
|
|
332
|
+
if (ret[2]) {
|
|
333
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
334
|
+
}
|
|
335
|
+
return Frame.__wrap(ret[0]);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* The ggplot-rs version this package was built from.
|
|
340
|
+
* @returns {string}
|
|
341
|
+
*/
|
|
342
|
+
export function version() {
|
|
343
|
+
let deferred1_0;
|
|
344
|
+
let deferred1_1;
|
|
345
|
+
try {
|
|
346
|
+
const ret = wasm.version();
|
|
347
|
+
deferred1_0 = ret[0];
|
|
348
|
+
deferred1_1 = ret[1];
|
|
349
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
350
|
+
} finally {
|
|
351
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
function __wbg_get_imports() {
|
|
356
|
+
const import0 = {
|
|
357
|
+
__proto__: null,
|
|
358
|
+
__wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
|
|
359
|
+
const obj = arg1;
|
|
360
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
361
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
362
|
+
var len1 = WASM_VECTOR_LEN;
|
|
363
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
364
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
365
|
+
},
|
|
366
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
367
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
368
|
+
},
|
|
369
|
+
__wbg_new_72b49615380db768: function(arg0, arg1) {
|
|
370
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
371
|
+
return ret;
|
|
372
|
+
},
|
|
373
|
+
__wbg_stringify_8d1cc6ff383e8bae: function() { return handleError(function (arg0) {
|
|
374
|
+
const ret = JSON.stringify(arg0);
|
|
375
|
+
return ret;
|
|
376
|
+
}, arguments); },
|
|
377
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
378
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
379
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
380
|
+
return ret;
|
|
381
|
+
},
|
|
382
|
+
__wbindgen_init_externref_table: function() {
|
|
383
|
+
const table = wasm.__wbindgen_externrefs;
|
|
384
|
+
const offset = table.grow(4);
|
|
385
|
+
table.set(0, undefined);
|
|
386
|
+
table.set(offset + 0, undefined);
|
|
387
|
+
table.set(offset + 1, null);
|
|
388
|
+
table.set(offset + 2, true);
|
|
389
|
+
table.set(offset + 3, false);
|
|
390
|
+
},
|
|
391
|
+
};
|
|
392
|
+
return {
|
|
393
|
+
__proto__: null,
|
|
394
|
+
"./ggplot_rs_bg.js": import0,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const FrameFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
399
|
+
? { register: () => {}, unregister: () => {} }
|
|
400
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_frame_free(ptr >>> 0, 1));
|
|
401
|
+
const RenderResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
402
|
+
? { register: () => {}, unregister: () => {} }
|
|
403
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_renderresult_free(ptr >>> 0, 1));
|
|
404
|
+
|
|
405
|
+
function addToExternrefTable0(obj) {
|
|
406
|
+
const idx = wasm.__externref_table_alloc();
|
|
407
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
408
|
+
return idx;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
function getArrayF64FromWasm0(ptr, len) {
|
|
412
|
+
ptr = ptr >>> 0;
|
|
413
|
+
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
417
|
+
ptr = ptr >>> 0;
|
|
418
|
+
const mem = getDataViewMemory0();
|
|
419
|
+
const result = [];
|
|
420
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
421
|
+
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
422
|
+
}
|
|
423
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
424
|
+
return result;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
let cachedDataViewMemory0 = null;
|
|
428
|
+
function getDataViewMemory0() {
|
|
429
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
430
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
431
|
+
}
|
|
432
|
+
return cachedDataViewMemory0;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
let cachedFloat64ArrayMemory0 = null;
|
|
436
|
+
function getFloat64ArrayMemory0() {
|
|
437
|
+
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
438
|
+
cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
|
|
439
|
+
}
|
|
440
|
+
return cachedFloat64ArrayMemory0;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function getStringFromWasm0(ptr, len) {
|
|
444
|
+
ptr = ptr >>> 0;
|
|
445
|
+
return decodeText(ptr, len);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
let cachedUint8ArrayMemory0 = null;
|
|
449
|
+
function getUint8ArrayMemory0() {
|
|
450
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
451
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
452
|
+
}
|
|
453
|
+
return cachedUint8ArrayMemory0;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function handleError(f, args) {
|
|
457
|
+
try {
|
|
458
|
+
return f.apply(this, args);
|
|
459
|
+
} catch (e) {
|
|
460
|
+
const idx = addToExternrefTable0(e);
|
|
461
|
+
wasm.__wbindgen_exn_store(idx);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
function isLikeNone(x) {
|
|
466
|
+
return x === undefined || x === null;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function passArrayF64ToWasm0(arg, malloc) {
|
|
470
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
471
|
+
getFloat64ArrayMemory0().set(arg, ptr / 8);
|
|
472
|
+
WASM_VECTOR_LEN = arg.length;
|
|
473
|
+
return ptr;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
477
|
+
if (realloc === undefined) {
|
|
478
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
479
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
480
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
481
|
+
WASM_VECTOR_LEN = buf.length;
|
|
482
|
+
return ptr;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
let len = arg.length;
|
|
486
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
487
|
+
|
|
488
|
+
const mem = getUint8ArrayMemory0();
|
|
489
|
+
|
|
490
|
+
let offset = 0;
|
|
491
|
+
|
|
492
|
+
for (; offset < len; offset++) {
|
|
493
|
+
const code = arg.charCodeAt(offset);
|
|
494
|
+
if (code > 0x7F) break;
|
|
495
|
+
mem[ptr + offset] = code;
|
|
496
|
+
}
|
|
497
|
+
if (offset !== len) {
|
|
498
|
+
if (offset !== 0) {
|
|
499
|
+
arg = arg.slice(offset);
|
|
500
|
+
}
|
|
501
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
502
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
503
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
504
|
+
|
|
505
|
+
offset += ret.written;
|
|
506
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
WASM_VECTOR_LEN = offset;
|
|
510
|
+
return ptr;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function takeFromExternrefTable0(idx) {
|
|
514
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
515
|
+
wasm.__externref_table_dealloc(idx);
|
|
516
|
+
return value;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
520
|
+
cachedTextDecoder.decode();
|
|
521
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
522
|
+
let numBytesDecoded = 0;
|
|
523
|
+
function decodeText(ptr, len) {
|
|
524
|
+
numBytesDecoded += len;
|
|
525
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
526
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
527
|
+
cachedTextDecoder.decode();
|
|
528
|
+
numBytesDecoded = len;
|
|
529
|
+
}
|
|
530
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
const cachedTextEncoder = new TextEncoder();
|
|
534
|
+
|
|
535
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
536
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
537
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
538
|
+
view.set(buf);
|
|
539
|
+
return {
|
|
540
|
+
read: arg.length,
|
|
541
|
+
written: buf.length
|
|
542
|
+
};
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
let WASM_VECTOR_LEN = 0;
|
|
547
|
+
|
|
548
|
+
let wasmModule, wasm;
|
|
549
|
+
function __wbg_finalize_init(instance, module) {
|
|
550
|
+
wasm = instance.exports;
|
|
551
|
+
wasmModule = module;
|
|
552
|
+
cachedDataViewMemory0 = null;
|
|
553
|
+
cachedFloat64ArrayMemory0 = null;
|
|
554
|
+
cachedUint8ArrayMemory0 = null;
|
|
555
|
+
wasm.__wbindgen_start();
|
|
556
|
+
return wasm;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
async function __wbg_load(module, imports) {
|
|
560
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
561
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
562
|
+
try {
|
|
563
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
564
|
+
} catch (e) {
|
|
565
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
566
|
+
|
|
567
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
568
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
569
|
+
|
|
570
|
+
} else { throw e; }
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
const bytes = await module.arrayBuffer();
|
|
575
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
576
|
+
} else {
|
|
577
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
578
|
+
|
|
579
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
580
|
+
return { instance, module };
|
|
581
|
+
} else {
|
|
582
|
+
return instance;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
function expectedResponseType(type) {
|
|
587
|
+
switch (type) {
|
|
588
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
589
|
+
}
|
|
590
|
+
return false;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
function initSync(module) {
|
|
595
|
+
if (wasm !== undefined) return wasm;
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
if (module !== undefined) {
|
|
599
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
600
|
+
({module} = module)
|
|
601
|
+
} else {
|
|
602
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
const imports = __wbg_get_imports();
|
|
607
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
608
|
+
module = new WebAssembly.Module(module);
|
|
609
|
+
}
|
|
610
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
611
|
+
return __wbg_finalize_init(instance, module);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
async function __wbg_init(module_or_path) {
|
|
615
|
+
if (wasm !== undefined) return wasm;
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
if (module_or_path !== undefined) {
|
|
619
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
620
|
+
({module_or_path} = module_or_path)
|
|
621
|
+
} else {
|
|
622
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
if (module_or_path === undefined) {
|
|
627
|
+
module_or_path = new URL('ggplot_rs_bg.wasm', import.meta.url);
|
|
628
|
+
}
|
|
629
|
+
const imports = __wbg_get_imports();
|
|
630
|
+
|
|
631
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
632
|
+
module_or_path = fetch(module_or_path);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
636
|
+
|
|
637
|
+
return __wbg_finalize_init(instance, module);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_frame_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_renderresult_free: (a: number, b: number) => void;
|
|
6
|
+
export const frame_plot: (a: number) => [number, number];
|
|
7
|
+
export const frame_svg: (a: number) => [number, number];
|
|
8
|
+
export const frame_xdom: (a: number) => [number, number];
|
|
9
|
+
export const frame_ydom: (a: number) => [number, number];
|
|
10
|
+
export const geo_bounds: (a: number, b: number) => [number, number, number, number];
|
|
11
|
+
export const geoms: () => [number, number];
|
|
12
|
+
export const render: (a: any) => [number, number, number, number];
|
|
13
|
+
export const renderWithWarnings: (a: any) => [number, number, number];
|
|
14
|
+
export const render_bar: (a: number, b: number) => [number, number, number, number];
|
|
15
|
+
export const render_geo: (a: number, b: number) => [number, number, number, number];
|
|
16
|
+
export const render_hist: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
|
|
17
|
+
export const render_plot: (a: number, b: number) => [number, number, number, number];
|
|
18
|
+
export const renderresult_svg: (a: number) => [number, number];
|
|
19
|
+
export const renderresult_warnings: (a: number) => [number, number];
|
|
20
|
+
export const scatter_frame: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
21
|
+
export const version: () => [number, number];
|
|
22
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
23
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
24
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
25
|
+
export const __externref_table_alloc: () => number;
|
|
26
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
27
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
28
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
29
|
+
export const __externref_drop_slice: (a: number, b: number) => void;
|
|
30
|
+
export const __wbindgen_start: () => void;
|