svelte-plots-basic 1.1.3 → 1.1.4
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 +2 -3
- package/package.json +22 -33
- package/src/Axes.svelte +23 -11
- package/src/BarSeries.svelte +0 -10
- package/src/Rectangles.svelte +1 -1
- package/src/ScatterSeries.svelte +0 -16
- package/src/Segments.svelte +5 -1
- package/src/TextLabels.svelte +32 -22
- package/dist/index.js +0 -4209
- package/dist/index.mjs +0 -4187
package/dist/index.js
DELETED
|
@@ -1,4209 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PlotsBasic = {}));
|
|
5
|
-
})(this, (function (exports) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function noop() { }
|
|
8
|
-
function assign(tar, src) {
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
for (const k in src)
|
|
11
|
-
tar[k] = src[k];
|
|
12
|
-
return tar;
|
|
13
|
-
}
|
|
14
|
-
function run(fn) {
|
|
15
|
-
return fn();
|
|
16
|
-
}
|
|
17
|
-
function blank_object() {
|
|
18
|
-
return Object.create(null);
|
|
19
|
-
}
|
|
20
|
-
function run_all(fns) {
|
|
21
|
-
fns.forEach(run);
|
|
22
|
-
}
|
|
23
|
-
function is_function(thing) {
|
|
24
|
-
return typeof thing === 'function';
|
|
25
|
-
}
|
|
26
|
-
function safe_not_equal(a, b) {
|
|
27
|
-
return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
|
|
28
|
-
}
|
|
29
|
-
function is_empty(obj) {
|
|
30
|
-
return Object.keys(obj).length === 0;
|
|
31
|
-
}
|
|
32
|
-
function subscribe(store, ...callbacks) {
|
|
33
|
-
if (store == null) {
|
|
34
|
-
return noop;
|
|
35
|
-
}
|
|
36
|
-
const unsub = store.subscribe(...callbacks);
|
|
37
|
-
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
|
|
38
|
-
}
|
|
39
|
-
function component_subscribe(component, store, callback) {
|
|
40
|
-
component.$$.on_destroy.push(subscribe(store, callback));
|
|
41
|
-
}
|
|
42
|
-
function create_slot(definition, ctx, $$scope, fn) {
|
|
43
|
-
if (definition) {
|
|
44
|
-
const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);
|
|
45
|
-
return definition[0](slot_ctx);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function get_slot_context(definition, ctx, $$scope, fn) {
|
|
49
|
-
return definition[1] && fn
|
|
50
|
-
? assign($$scope.ctx.slice(), definition[1](fn(ctx)))
|
|
51
|
-
: $$scope.ctx;
|
|
52
|
-
}
|
|
53
|
-
function get_slot_changes(definition, $$scope, dirty, fn) {
|
|
54
|
-
if (definition[2] && fn) {
|
|
55
|
-
const lets = definition[2](fn(dirty));
|
|
56
|
-
if ($$scope.dirty === undefined) {
|
|
57
|
-
return lets;
|
|
58
|
-
}
|
|
59
|
-
if (typeof lets === 'object') {
|
|
60
|
-
const merged = [];
|
|
61
|
-
const len = Math.max($$scope.dirty.length, lets.length);
|
|
62
|
-
for (let i = 0; i < len; i += 1) {
|
|
63
|
-
merged[i] = $$scope.dirty[i] | lets[i];
|
|
64
|
-
}
|
|
65
|
-
return merged;
|
|
66
|
-
}
|
|
67
|
-
return $$scope.dirty | lets;
|
|
68
|
-
}
|
|
69
|
-
return $$scope.dirty;
|
|
70
|
-
}
|
|
71
|
-
function update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {
|
|
72
|
-
if (slot_changes) {
|
|
73
|
-
const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);
|
|
74
|
-
slot.p(slot_context, slot_changes);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
function get_all_dirty_from_scope($$scope) {
|
|
78
|
-
if ($$scope.ctx.length > 32) {
|
|
79
|
-
const dirty = [];
|
|
80
|
-
const length = $$scope.ctx.length / 32;
|
|
81
|
-
for (let i = 0; i < length; i++) {
|
|
82
|
-
dirty[i] = -1;
|
|
83
|
-
}
|
|
84
|
-
return dirty;
|
|
85
|
-
}
|
|
86
|
-
return -1;
|
|
87
|
-
}
|
|
88
|
-
function append(target, node) {
|
|
89
|
-
target.appendChild(node);
|
|
90
|
-
}
|
|
91
|
-
function append_styles(target, style_sheet_id, styles) {
|
|
92
|
-
const append_styles_to = get_root_for_style(target);
|
|
93
|
-
if (!append_styles_to.getElementById(style_sheet_id)) {
|
|
94
|
-
const style = element('style');
|
|
95
|
-
style.id = style_sheet_id;
|
|
96
|
-
style.textContent = styles;
|
|
97
|
-
append_stylesheet(append_styles_to, style);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function get_root_for_style(node) {
|
|
101
|
-
if (!node)
|
|
102
|
-
return document;
|
|
103
|
-
const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
|
|
104
|
-
if (root && root.host) {
|
|
105
|
-
return root;
|
|
106
|
-
}
|
|
107
|
-
return node.ownerDocument;
|
|
108
|
-
}
|
|
109
|
-
function append_stylesheet(node, style) {
|
|
110
|
-
append(node.head || node, style);
|
|
111
|
-
return style.sheet;
|
|
112
|
-
}
|
|
113
|
-
function insert(target, node, anchor) {
|
|
114
|
-
target.insertBefore(node, anchor || null);
|
|
115
|
-
}
|
|
116
|
-
function detach(node) {
|
|
117
|
-
node.parentNode.removeChild(node);
|
|
118
|
-
}
|
|
119
|
-
function destroy_each(iterations, detaching) {
|
|
120
|
-
for (let i = 0; i < iterations.length; i += 1) {
|
|
121
|
-
if (iterations[i])
|
|
122
|
-
iterations[i].d(detaching);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function element(name) {
|
|
126
|
-
return document.createElement(name);
|
|
127
|
-
}
|
|
128
|
-
function svg_element(name) {
|
|
129
|
-
return document.createElementNS('http://www.w3.org/2000/svg', name);
|
|
130
|
-
}
|
|
131
|
-
function text(data) {
|
|
132
|
-
return document.createTextNode(data);
|
|
133
|
-
}
|
|
134
|
-
function space() {
|
|
135
|
-
return text(' ');
|
|
136
|
-
}
|
|
137
|
-
function empty() {
|
|
138
|
-
return text('');
|
|
139
|
-
}
|
|
140
|
-
function listen(node, event, handler, options) {
|
|
141
|
-
node.addEventListener(event, handler, options);
|
|
142
|
-
return () => node.removeEventListener(event, handler, options);
|
|
143
|
-
}
|
|
144
|
-
function attr(node, attribute, value) {
|
|
145
|
-
if (value == null)
|
|
146
|
-
node.removeAttribute(attribute);
|
|
147
|
-
else if (node.getAttribute(attribute) !== value)
|
|
148
|
-
node.setAttribute(attribute, value);
|
|
149
|
-
}
|
|
150
|
-
function children(element) {
|
|
151
|
-
return Array.from(element.childNodes);
|
|
152
|
-
}
|
|
153
|
-
function set_data(text, data) {
|
|
154
|
-
data = '' + data;
|
|
155
|
-
if (text.wholeText !== data)
|
|
156
|
-
text.data = data;
|
|
157
|
-
}
|
|
158
|
-
function set_style(node, key, value, important) {
|
|
159
|
-
if (value === null) {
|
|
160
|
-
node.style.removeProperty(key);
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
node.style.setProperty(key, value, important ? 'important' : '');
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function toggle_class(element, name, toggle) {
|
|
167
|
-
element.classList[toggle ? 'add' : 'remove'](name);
|
|
168
|
-
}
|
|
169
|
-
function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
|
|
170
|
-
const e = document.createEvent('CustomEvent');
|
|
171
|
-
e.initCustomEvent(type, bubbles, cancelable, detail);
|
|
172
|
-
return e;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
let current_component;
|
|
176
|
-
function set_current_component(component) {
|
|
177
|
-
current_component = component;
|
|
178
|
-
}
|
|
179
|
-
function get_current_component() {
|
|
180
|
-
if (!current_component)
|
|
181
|
-
throw new Error('Function called outside component initialization');
|
|
182
|
-
return current_component;
|
|
183
|
-
}
|
|
184
|
-
function onMount(fn) {
|
|
185
|
-
get_current_component().$$.on_mount.push(fn);
|
|
186
|
-
}
|
|
187
|
-
function onDestroy(fn) {
|
|
188
|
-
get_current_component().$$.on_destroy.push(fn);
|
|
189
|
-
}
|
|
190
|
-
function createEventDispatcher() {
|
|
191
|
-
const component = get_current_component();
|
|
192
|
-
return (type, detail, { cancelable = false } = {}) => {
|
|
193
|
-
const callbacks = component.$$.callbacks[type];
|
|
194
|
-
if (callbacks) {
|
|
195
|
-
// TODO are there situations where events could be dispatched
|
|
196
|
-
// in a server (non-DOM) environment?
|
|
197
|
-
const event = custom_event(type, detail, { cancelable });
|
|
198
|
-
callbacks.slice().forEach(fn => {
|
|
199
|
-
fn.call(component, event);
|
|
200
|
-
});
|
|
201
|
-
return !event.defaultPrevented;
|
|
202
|
-
}
|
|
203
|
-
return true;
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
function setContext(key, context) {
|
|
207
|
-
get_current_component().$$.context.set(key, context);
|
|
208
|
-
return context;
|
|
209
|
-
}
|
|
210
|
-
function getContext(key) {
|
|
211
|
-
return get_current_component().$$.context.get(key);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const dirty_components = [];
|
|
215
|
-
const binding_callbacks = [];
|
|
216
|
-
const render_callbacks = [];
|
|
217
|
-
const flush_callbacks = [];
|
|
218
|
-
const resolved_promise = Promise.resolve();
|
|
219
|
-
let update_scheduled = false;
|
|
220
|
-
function schedule_update() {
|
|
221
|
-
if (!update_scheduled) {
|
|
222
|
-
update_scheduled = true;
|
|
223
|
-
resolved_promise.then(flush);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
function add_render_callback(fn) {
|
|
227
|
-
render_callbacks.push(fn);
|
|
228
|
-
}
|
|
229
|
-
// flush() calls callbacks in this order:
|
|
230
|
-
// 1. All beforeUpdate callbacks, in order: parents before children
|
|
231
|
-
// 2. All bind:this callbacks, in reverse order: children before parents.
|
|
232
|
-
// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT
|
|
233
|
-
// for afterUpdates called during the initial onMount, which are called in
|
|
234
|
-
// reverse order: children before parents.
|
|
235
|
-
// Since callbacks might update component values, which could trigger another
|
|
236
|
-
// call to flush(), the following steps guard against this:
|
|
237
|
-
// 1. During beforeUpdate, any updated components will be added to the
|
|
238
|
-
// dirty_components array and will cause a reentrant call to flush(). Because
|
|
239
|
-
// the flush index is kept outside the function, the reentrant call will pick
|
|
240
|
-
// up where the earlier call left off and go through all dirty components. The
|
|
241
|
-
// current_component value is saved and restored so that the reentrant call will
|
|
242
|
-
// not interfere with the "parent" flush() call.
|
|
243
|
-
// 2. bind:this callbacks cannot trigger new flush() calls.
|
|
244
|
-
// 3. During afterUpdate, any updated components will NOT have their afterUpdate
|
|
245
|
-
// callback called a second time; the seen_callbacks set, outside the flush()
|
|
246
|
-
// function, guarantees this behavior.
|
|
247
|
-
const seen_callbacks = new Set();
|
|
248
|
-
let flushidx = 0; // Do *not* move this inside the flush() function
|
|
249
|
-
function flush() {
|
|
250
|
-
const saved_component = current_component;
|
|
251
|
-
do {
|
|
252
|
-
// first, call beforeUpdate functions
|
|
253
|
-
// and update components
|
|
254
|
-
while (flushidx < dirty_components.length) {
|
|
255
|
-
const component = dirty_components[flushidx];
|
|
256
|
-
flushidx++;
|
|
257
|
-
set_current_component(component);
|
|
258
|
-
update(component.$$);
|
|
259
|
-
}
|
|
260
|
-
set_current_component(null);
|
|
261
|
-
dirty_components.length = 0;
|
|
262
|
-
flushidx = 0;
|
|
263
|
-
while (binding_callbacks.length)
|
|
264
|
-
binding_callbacks.pop()();
|
|
265
|
-
// then, once components are updated, call
|
|
266
|
-
// afterUpdate functions. This may cause
|
|
267
|
-
// subsequent updates...
|
|
268
|
-
for (let i = 0; i < render_callbacks.length; i += 1) {
|
|
269
|
-
const callback = render_callbacks[i];
|
|
270
|
-
if (!seen_callbacks.has(callback)) {
|
|
271
|
-
// ...so guard against infinite loops
|
|
272
|
-
seen_callbacks.add(callback);
|
|
273
|
-
callback();
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
render_callbacks.length = 0;
|
|
277
|
-
} while (dirty_components.length);
|
|
278
|
-
while (flush_callbacks.length) {
|
|
279
|
-
flush_callbacks.pop()();
|
|
280
|
-
}
|
|
281
|
-
update_scheduled = false;
|
|
282
|
-
seen_callbacks.clear();
|
|
283
|
-
set_current_component(saved_component);
|
|
284
|
-
}
|
|
285
|
-
function update($$) {
|
|
286
|
-
if ($$.fragment !== null) {
|
|
287
|
-
$$.update();
|
|
288
|
-
run_all($$.before_update);
|
|
289
|
-
const dirty = $$.dirty;
|
|
290
|
-
$$.dirty = [-1];
|
|
291
|
-
$$.fragment && $$.fragment.p($$.ctx, dirty);
|
|
292
|
-
$$.after_update.forEach(add_render_callback);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
const outroing = new Set();
|
|
296
|
-
let outros;
|
|
297
|
-
function group_outros() {
|
|
298
|
-
outros = {
|
|
299
|
-
r: 0,
|
|
300
|
-
c: [],
|
|
301
|
-
p: outros // parent group
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
function check_outros() {
|
|
305
|
-
if (!outros.r) {
|
|
306
|
-
run_all(outros.c);
|
|
307
|
-
}
|
|
308
|
-
outros = outros.p;
|
|
309
|
-
}
|
|
310
|
-
function transition_in(block, local) {
|
|
311
|
-
if (block && block.i) {
|
|
312
|
-
outroing.delete(block);
|
|
313
|
-
block.i(local);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
function transition_out(block, local, detach, callback) {
|
|
317
|
-
if (block && block.o) {
|
|
318
|
-
if (outroing.has(block))
|
|
319
|
-
return;
|
|
320
|
-
outroing.add(block);
|
|
321
|
-
outros.c.push(() => {
|
|
322
|
-
outroing.delete(block);
|
|
323
|
-
if (callback) {
|
|
324
|
-
if (detach)
|
|
325
|
-
block.d(1);
|
|
326
|
-
callback();
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
block.o(local);
|
|
330
|
-
}
|
|
331
|
-
else if (callback) {
|
|
332
|
-
callback();
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
function create_component(block) {
|
|
336
|
-
block && block.c();
|
|
337
|
-
}
|
|
338
|
-
function mount_component(component, target, anchor, customElement) {
|
|
339
|
-
const { fragment, on_mount, on_destroy, after_update } = component.$$;
|
|
340
|
-
fragment && fragment.m(target, anchor);
|
|
341
|
-
if (!customElement) {
|
|
342
|
-
// onMount happens before the initial afterUpdate
|
|
343
|
-
add_render_callback(() => {
|
|
344
|
-
const new_on_destroy = on_mount.map(run).filter(is_function);
|
|
345
|
-
if (on_destroy) {
|
|
346
|
-
on_destroy.push(...new_on_destroy);
|
|
347
|
-
}
|
|
348
|
-
else {
|
|
349
|
-
// Edge case - component was destroyed immediately,
|
|
350
|
-
// most likely as a result of a binding initialising
|
|
351
|
-
run_all(new_on_destroy);
|
|
352
|
-
}
|
|
353
|
-
component.$$.on_mount = [];
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
after_update.forEach(add_render_callback);
|
|
357
|
-
}
|
|
358
|
-
function destroy_component(component, detaching) {
|
|
359
|
-
const $$ = component.$$;
|
|
360
|
-
if ($$.fragment !== null) {
|
|
361
|
-
run_all($$.on_destroy);
|
|
362
|
-
$$.fragment && $$.fragment.d(detaching);
|
|
363
|
-
// TODO null out other refs, including component.$$ (but need to
|
|
364
|
-
// preserve final state?)
|
|
365
|
-
$$.on_destroy = $$.fragment = null;
|
|
366
|
-
$$.ctx = [];
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
function make_dirty(component, i) {
|
|
370
|
-
if (component.$$.dirty[0] === -1) {
|
|
371
|
-
dirty_components.push(component);
|
|
372
|
-
schedule_update();
|
|
373
|
-
component.$$.dirty.fill(0);
|
|
374
|
-
}
|
|
375
|
-
component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
|
|
376
|
-
}
|
|
377
|
-
function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) {
|
|
378
|
-
const parent_component = current_component;
|
|
379
|
-
set_current_component(component);
|
|
380
|
-
const $$ = component.$$ = {
|
|
381
|
-
fragment: null,
|
|
382
|
-
ctx: null,
|
|
383
|
-
// state
|
|
384
|
-
props,
|
|
385
|
-
update: noop,
|
|
386
|
-
not_equal,
|
|
387
|
-
bound: blank_object(),
|
|
388
|
-
// lifecycle
|
|
389
|
-
on_mount: [],
|
|
390
|
-
on_destroy: [],
|
|
391
|
-
on_disconnect: [],
|
|
392
|
-
before_update: [],
|
|
393
|
-
after_update: [],
|
|
394
|
-
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
|
|
395
|
-
// everything else
|
|
396
|
-
callbacks: blank_object(),
|
|
397
|
-
dirty,
|
|
398
|
-
skip_bound: false,
|
|
399
|
-
root: options.target || parent_component.$$.root
|
|
400
|
-
};
|
|
401
|
-
append_styles && append_styles($$.root);
|
|
402
|
-
let ready = false;
|
|
403
|
-
$$.ctx = instance
|
|
404
|
-
? instance(component, options.props || {}, (i, ret, ...rest) => {
|
|
405
|
-
const value = rest.length ? rest[0] : ret;
|
|
406
|
-
if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
|
|
407
|
-
if (!$$.skip_bound && $$.bound[i])
|
|
408
|
-
$$.bound[i](value);
|
|
409
|
-
if (ready)
|
|
410
|
-
make_dirty(component, i);
|
|
411
|
-
}
|
|
412
|
-
return ret;
|
|
413
|
-
})
|
|
414
|
-
: [];
|
|
415
|
-
$$.update();
|
|
416
|
-
ready = true;
|
|
417
|
-
run_all($$.before_update);
|
|
418
|
-
// `false` as a special case of no DOM component
|
|
419
|
-
$$.fragment = create_fragment ? create_fragment($$.ctx) : false;
|
|
420
|
-
if (options.target) {
|
|
421
|
-
if (options.hydrate) {
|
|
422
|
-
const nodes = children(options.target);
|
|
423
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
424
|
-
$$.fragment && $$.fragment.l(nodes);
|
|
425
|
-
nodes.forEach(detach);
|
|
426
|
-
}
|
|
427
|
-
else {
|
|
428
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
429
|
-
$$.fragment && $$.fragment.c();
|
|
430
|
-
}
|
|
431
|
-
if (options.intro)
|
|
432
|
-
transition_in(component.$$.fragment);
|
|
433
|
-
mount_component(component, options.target, options.anchor, options.customElement);
|
|
434
|
-
flush();
|
|
435
|
-
}
|
|
436
|
-
set_current_component(parent_component);
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Base class for Svelte components. Used when dev=false.
|
|
440
|
-
*/
|
|
441
|
-
class SvelteComponent {
|
|
442
|
-
$destroy() {
|
|
443
|
-
destroy_component(this, 1);
|
|
444
|
-
this.$destroy = noop;
|
|
445
|
-
}
|
|
446
|
-
$on(type, callback) {
|
|
447
|
-
const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
|
|
448
|
-
callbacks.push(callback);
|
|
449
|
-
return () => {
|
|
450
|
-
const index = callbacks.indexOf(callback);
|
|
451
|
-
if (index !== -1)
|
|
452
|
-
callbacks.splice(index, 1);
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
$set($$props) {
|
|
456
|
-
if (this.$$set && !is_empty($$props)) {
|
|
457
|
-
this.$$.skip_bound = true;
|
|
458
|
-
this.$$set($$props);
|
|
459
|
-
this.$$.skip_bound = false;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
const subscriber_queue = [];
|
|
465
|
-
/**
|
|
466
|
-
* Create a `Writable` store that allows both updating and reading by subscription.
|
|
467
|
-
* @param {*=}value initial value
|
|
468
|
-
* @param {StartStopNotifier=}start start and stop notifications for subscriptions
|
|
469
|
-
*/
|
|
470
|
-
function writable(value, start = noop) {
|
|
471
|
-
let stop;
|
|
472
|
-
const subscribers = new Set();
|
|
473
|
-
function set(new_value) {
|
|
474
|
-
if (safe_not_equal(value, new_value)) {
|
|
475
|
-
value = new_value;
|
|
476
|
-
if (stop) { // store is ready
|
|
477
|
-
const run_queue = !subscriber_queue.length;
|
|
478
|
-
for (const subscriber of subscribers) {
|
|
479
|
-
subscriber[1]();
|
|
480
|
-
subscriber_queue.push(subscriber, value);
|
|
481
|
-
}
|
|
482
|
-
if (run_queue) {
|
|
483
|
-
for (let i = 0; i < subscriber_queue.length; i += 2) {
|
|
484
|
-
subscriber_queue[i][0](subscriber_queue[i + 1]);
|
|
485
|
-
}
|
|
486
|
-
subscriber_queue.length = 0;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
function update(fn) {
|
|
492
|
-
set(fn(value));
|
|
493
|
-
}
|
|
494
|
-
function subscribe(run, invalidate = noop) {
|
|
495
|
-
const subscriber = [run, invalidate];
|
|
496
|
-
subscribers.add(subscriber);
|
|
497
|
-
if (subscribers.size === 1) {
|
|
498
|
-
stop = start(set) || noop;
|
|
499
|
-
}
|
|
500
|
-
run(value);
|
|
501
|
-
return () => {
|
|
502
|
-
subscribers.delete(subscriber);
|
|
503
|
-
if (subscribers.size === 0) {
|
|
504
|
-
stop();
|
|
505
|
-
stop = null;
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
return { set, update, subscribe };
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
/* src/Axes.svelte generated by Svelte v3.50.1 */
|
|
513
|
-
|
|
514
|
-
function add_css$3(target) {
|
|
515
|
-
append_styles(target, "svelte-jxlrcp", ".plot{font-family:Arial, Helvetica, sans-serif;display:grid;grid-template-columns:min-content auto;grid-template-rows:min-content auto min-content;grid-template-areas:\". title\"\n \"ylab axes\"\n \". xlab\";box-sizing:border-box;background:#fefefe;min-width:100px;min-height:50px;width:100%;height:100%;padding:0;margin:0}.plot_small{font-size:11px}.plot_medium{font-size:13px}.plot_large{font-size:16px}.plot_error{display:flex}.plot_error > .axes-wrapper{display:none}.message_error{font-size:1.2em;color:crimson;padding:20px;text-align:center}.axes-wrapper.svelte-jxlrcp{grid-area:axes;position:relative;box-sizing:border-box;display:flex;width:100%;height:100%;padding:0;margin:0}.axes{display:block;box-sizing:border-box;position:absolute;padding:0;margin:0;height:100%;width:100%;max-height:100%;max-width:100%;min-height:100%;min-width:100%}.axes-content{padding:0;margin:0;height:100%;width:100%;max-height:100%;max-width:100%;min-height:100%;min-width:100%}.axes__xlabel{grid-area:xlab;font-size:1.0em;font-weight:600;padding:0.25em;text-align:center}.axes__ylabel{grid-area:ylab;font-size:1.0em;font-weight:600;padding:0.25em;text-align:center;vertical-align:middle;display:flex}.axes__ylabel > span{width:1.5em;line-height:1.5em;display:inline-block;writing-mode:vertical-rl;transform:rotate(180deg)}.axes__title{background:transparent;grid-area:title;font-size:1.3em;font-weight:bold;line-height:1.2em;padding:0.5em 0;text-align:center}.axis-labels{fill:#303030;font-size:0.95em}.labels{fill:#606060;font-size:0.90em}.labels{visibility:hidden;transition:visibility 0.25s linear, opacity 0.25s linear;opacity:0}");
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
const get_box_slot_changes = dirty => ({});
|
|
519
|
-
const get_box_slot_context = ctx => ({});
|
|
520
|
-
const get_yaxis_slot_changes = dirty => ({});
|
|
521
|
-
const get_yaxis_slot_context = ctx => ({});
|
|
522
|
-
const get_xaxis_slot_changes = dirty => ({});
|
|
523
|
-
const get_xaxis_slot_context = ctx => ({});
|
|
524
|
-
|
|
525
|
-
// (352:3) {#if title !== ""}
|
|
526
|
-
function create_if_block_3(ctx) {
|
|
527
|
-
let div;
|
|
528
|
-
|
|
529
|
-
return {
|
|
530
|
-
c() {
|
|
531
|
-
div = element("div");
|
|
532
|
-
attr(div, "class", "axes__title");
|
|
533
|
-
},
|
|
534
|
-
m(target, anchor) {
|
|
535
|
-
insert(target, div, anchor);
|
|
536
|
-
div.innerHTML = /*title*/ ctx[0];
|
|
537
|
-
},
|
|
538
|
-
p(ctx, dirty) {
|
|
539
|
-
if (dirty[0] & /*title*/ 1) div.innerHTML = /*title*/ ctx[0]; },
|
|
540
|
-
d(detaching) {
|
|
541
|
-
if (detaching) detach(div);
|
|
542
|
-
}
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
// (353:3) {#if yLabel !== ""}
|
|
547
|
-
function create_if_block_2(ctx) {
|
|
548
|
-
let div;
|
|
549
|
-
let span;
|
|
550
|
-
|
|
551
|
-
return {
|
|
552
|
-
c() {
|
|
553
|
-
div = element("div");
|
|
554
|
-
span = element("span");
|
|
555
|
-
attr(div, "class", "axes__ylabel");
|
|
556
|
-
},
|
|
557
|
-
m(target, anchor) {
|
|
558
|
-
insert(target, div, anchor);
|
|
559
|
-
append(div, span);
|
|
560
|
-
span.innerHTML = /*yLabel*/ ctx[2];
|
|
561
|
-
},
|
|
562
|
-
p(ctx, dirty) {
|
|
563
|
-
if (dirty[0] & /*yLabel*/ 4) span.innerHTML = /*yLabel*/ ctx[2]; },
|
|
564
|
-
d(detaching) {
|
|
565
|
-
if (detaching) detach(div);
|
|
566
|
-
}
|
|
567
|
-
};
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
// (354:3) {#if xLabel !== ""}
|
|
571
|
-
function create_if_block_1(ctx) {
|
|
572
|
-
let div;
|
|
573
|
-
let span;
|
|
574
|
-
|
|
575
|
-
return {
|
|
576
|
-
c() {
|
|
577
|
-
div = element("div");
|
|
578
|
-
span = element("span");
|
|
579
|
-
attr(div, "class", "axes__xlabel");
|
|
580
|
-
},
|
|
581
|
-
m(target, anchor) {
|
|
582
|
-
insert(target, div, anchor);
|
|
583
|
-
append(div, span);
|
|
584
|
-
span.innerHTML = /*xLabel*/ ctx[1];
|
|
585
|
-
},
|
|
586
|
-
p(ctx, dirty) {
|
|
587
|
-
if (dirty[0] & /*xLabel*/ 2) span.innerHTML = /*xLabel*/ ctx[1]; },
|
|
588
|
-
d(detaching) {
|
|
589
|
-
if (detaching) detach(div);
|
|
590
|
-
}
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
// (382:3) {#if !$isOk}
|
|
595
|
-
function create_if_block$9(ctx) {
|
|
596
|
-
let p;
|
|
597
|
-
|
|
598
|
-
return {
|
|
599
|
-
c() {
|
|
600
|
-
p = element("p");
|
|
601
|
-
|
|
602
|
-
p.innerHTML = `Axes component was not properly initialized. <br/>
|
|
603
|
-
Add plot series (check that coordinates are numeric) or define axes limits manually.`;
|
|
604
|
-
|
|
605
|
-
attr(p, "class", "message_error");
|
|
606
|
-
},
|
|
607
|
-
m(target, anchor) {
|
|
608
|
-
insert(target, p, anchor);
|
|
609
|
-
},
|
|
610
|
-
d(detaching) {
|
|
611
|
-
if (detaching) detach(p);
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
function create_fragment$b(ctx) {
|
|
617
|
-
let div1;
|
|
618
|
-
let t0;
|
|
619
|
-
let t1;
|
|
620
|
-
let t2;
|
|
621
|
-
let div0;
|
|
622
|
-
let svg;
|
|
623
|
-
let defs;
|
|
624
|
-
let clipPath;
|
|
625
|
-
let rect;
|
|
626
|
-
let rect_x_value;
|
|
627
|
-
let rect_y_value;
|
|
628
|
-
let rect_width_value;
|
|
629
|
-
let rect_height_value;
|
|
630
|
-
let g;
|
|
631
|
-
let t3;
|
|
632
|
-
let div1_class_value;
|
|
633
|
-
let current;
|
|
634
|
-
let mounted;
|
|
635
|
-
let dispose;
|
|
636
|
-
let if_block0 = /*title*/ ctx[0] !== "" && create_if_block_3(ctx);
|
|
637
|
-
let if_block1 = /*yLabel*/ ctx[2] !== "" && create_if_block_2(ctx);
|
|
638
|
-
let if_block2 = /*xLabel*/ ctx[1] !== "" && create_if_block_1(ctx);
|
|
639
|
-
const xaxis_slot_template = /*#slots*/ ctx[27].xaxis;
|
|
640
|
-
const xaxis_slot = create_slot(xaxis_slot_template, ctx, /*$$scope*/ ctx[26], get_xaxis_slot_context);
|
|
641
|
-
const yaxis_slot_template = /*#slots*/ ctx[27].yaxis;
|
|
642
|
-
const yaxis_slot = create_slot(yaxis_slot_template, ctx, /*$$scope*/ ctx[26], get_yaxis_slot_context);
|
|
643
|
-
const default_slot_template = /*#slots*/ ctx[27].default;
|
|
644
|
-
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[26], null);
|
|
645
|
-
const box_slot_template = /*#slots*/ ctx[27].box;
|
|
646
|
-
const box_slot = create_slot(box_slot_template, ctx, /*$$scope*/ ctx[26], get_box_slot_context);
|
|
647
|
-
let if_block3 = !/*$isOk*/ ctx[3] && create_if_block$9();
|
|
648
|
-
|
|
649
|
-
return {
|
|
650
|
-
c() {
|
|
651
|
-
div1 = element("div");
|
|
652
|
-
if (if_block0) if_block0.c();
|
|
653
|
-
t0 = space();
|
|
654
|
-
if (if_block1) if_block1.c();
|
|
655
|
-
t1 = space();
|
|
656
|
-
if (if_block2) if_block2.c();
|
|
657
|
-
t2 = space();
|
|
658
|
-
div0 = element("div");
|
|
659
|
-
svg = svg_element("svg");
|
|
660
|
-
defs = svg_element("defs");
|
|
661
|
-
clipPath = svg_element("clipPath");
|
|
662
|
-
rect = svg_element("rect");
|
|
663
|
-
if (xaxis_slot) xaxis_slot.c();
|
|
664
|
-
if (yaxis_slot) yaxis_slot.c();
|
|
665
|
-
g = svg_element("g");
|
|
666
|
-
if (default_slot) default_slot.c();
|
|
667
|
-
if (box_slot) box_slot.c();
|
|
668
|
-
t3 = space();
|
|
669
|
-
if (if_block3) if_block3.c();
|
|
670
|
-
set_style(rect, "pointer-events", "none");
|
|
671
|
-
attr(rect, "x", rect_x_value = /*cpx*/ ctx[8][0]);
|
|
672
|
-
attr(rect, "y", rect_y_value = /*cpy*/ ctx[7][1]);
|
|
673
|
-
attr(rect, "width", rect_width_value = /*cpx*/ ctx[8][1] - /*cpx*/ ctx[8][0]);
|
|
674
|
-
attr(rect, "height", rect_height_value = /*cpy*/ ctx[7][0] - /*cpy*/ ctx[7][1]);
|
|
675
|
-
attr(clipPath, "id", /*clipPathID*/ ctx[9]);
|
|
676
|
-
attr(g, "class", "axes-content");
|
|
677
|
-
attr(g, "clip-path", "url(#" + /*clipPathID*/ ctx[9] + ")");
|
|
678
|
-
attr(svg, "preserveAspectRatio", "none");
|
|
679
|
-
attr(svg, "class", "axes");
|
|
680
|
-
attr(div0, "class", "axes-wrapper svelte-jxlrcp");
|
|
681
|
-
attr(div1, "class", div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-jxlrcp");
|
|
682
|
-
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[3]);
|
|
683
|
-
},
|
|
684
|
-
m(target, anchor) {
|
|
685
|
-
insert(target, div1, anchor);
|
|
686
|
-
if (if_block0) if_block0.m(div1, null);
|
|
687
|
-
append(div1, t0);
|
|
688
|
-
if (if_block1) if_block1.m(div1, null);
|
|
689
|
-
append(div1, t1);
|
|
690
|
-
if (if_block2) if_block2.m(div1, null);
|
|
691
|
-
append(div1, t2);
|
|
692
|
-
append(div1, div0);
|
|
693
|
-
append(div0, svg);
|
|
694
|
-
append(svg, defs);
|
|
695
|
-
append(defs, clipPath);
|
|
696
|
-
append(clipPath, rect);
|
|
697
|
-
|
|
698
|
-
if (xaxis_slot) {
|
|
699
|
-
xaxis_slot.m(svg, null);
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
if (yaxis_slot) {
|
|
703
|
-
yaxis_slot.m(svg, null);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
append(svg, g);
|
|
707
|
-
|
|
708
|
-
if (default_slot) {
|
|
709
|
-
default_slot.m(g, null);
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
if (box_slot) {
|
|
713
|
-
box_slot.m(svg, null);
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
/*div0_binding*/ ctx[28](div0);
|
|
717
|
-
append(div1, t3);
|
|
718
|
-
if (if_block3) if_block3.m(div1, null);
|
|
719
|
-
/*div1_binding*/ ctx[29](div1);
|
|
720
|
-
current = true;
|
|
721
|
-
|
|
722
|
-
if (!mounted) {
|
|
723
|
-
dispose = listen(svg, "click", /*handleClick*/ ctx[16]);
|
|
724
|
-
mounted = true;
|
|
725
|
-
}
|
|
726
|
-
},
|
|
727
|
-
p(ctx, dirty) {
|
|
728
|
-
if (/*title*/ ctx[0] !== "") {
|
|
729
|
-
if (if_block0) {
|
|
730
|
-
if_block0.p(ctx, dirty);
|
|
731
|
-
} else {
|
|
732
|
-
if_block0 = create_if_block_3(ctx);
|
|
733
|
-
if_block0.c();
|
|
734
|
-
if_block0.m(div1, t0);
|
|
735
|
-
}
|
|
736
|
-
} else if (if_block0) {
|
|
737
|
-
if_block0.d(1);
|
|
738
|
-
if_block0 = null;
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
if (/*yLabel*/ ctx[2] !== "") {
|
|
742
|
-
if (if_block1) {
|
|
743
|
-
if_block1.p(ctx, dirty);
|
|
744
|
-
} else {
|
|
745
|
-
if_block1 = create_if_block_2(ctx);
|
|
746
|
-
if_block1.c();
|
|
747
|
-
if_block1.m(div1, t1);
|
|
748
|
-
}
|
|
749
|
-
} else if (if_block1) {
|
|
750
|
-
if_block1.d(1);
|
|
751
|
-
if_block1 = null;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
if (/*xLabel*/ ctx[1] !== "") {
|
|
755
|
-
if (if_block2) {
|
|
756
|
-
if_block2.p(ctx, dirty);
|
|
757
|
-
} else {
|
|
758
|
-
if_block2 = create_if_block_1(ctx);
|
|
759
|
-
if_block2.c();
|
|
760
|
-
if_block2.m(div1, t2);
|
|
761
|
-
}
|
|
762
|
-
} else if (if_block2) {
|
|
763
|
-
if_block2.d(1);
|
|
764
|
-
if_block2 = null;
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
if (!current || dirty[0] & /*cpx*/ 256 && rect_x_value !== (rect_x_value = /*cpx*/ ctx[8][0])) {
|
|
768
|
-
attr(rect, "x", rect_x_value);
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
if (!current || dirty[0] & /*cpy*/ 128 && rect_y_value !== (rect_y_value = /*cpy*/ ctx[7][1])) {
|
|
772
|
-
attr(rect, "y", rect_y_value);
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
if (!current || dirty[0] & /*cpx*/ 256 && rect_width_value !== (rect_width_value = /*cpx*/ ctx[8][1] - /*cpx*/ ctx[8][0])) {
|
|
776
|
-
attr(rect, "width", rect_width_value);
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
if (!current || dirty[0] & /*cpy*/ 128 && rect_height_value !== (rect_height_value = /*cpy*/ ctx[7][0] - /*cpy*/ ctx[7][1])) {
|
|
780
|
-
attr(rect, "height", rect_height_value);
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
if (xaxis_slot) {
|
|
784
|
-
if (xaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 67108864)) {
|
|
785
|
-
update_slot_base(
|
|
786
|
-
xaxis_slot,
|
|
787
|
-
xaxis_slot_template,
|
|
788
|
-
ctx,
|
|
789
|
-
/*$$scope*/ ctx[26],
|
|
790
|
-
!current
|
|
791
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[26])
|
|
792
|
-
: get_slot_changes(xaxis_slot_template, /*$$scope*/ ctx[26], dirty, get_xaxis_slot_changes),
|
|
793
|
-
get_xaxis_slot_context
|
|
794
|
-
);
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
if (yaxis_slot) {
|
|
799
|
-
if (yaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 67108864)) {
|
|
800
|
-
update_slot_base(
|
|
801
|
-
yaxis_slot,
|
|
802
|
-
yaxis_slot_template,
|
|
803
|
-
ctx,
|
|
804
|
-
/*$$scope*/ ctx[26],
|
|
805
|
-
!current
|
|
806
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[26])
|
|
807
|
-
: get_slot_changes(yaxis_slot_template, /*$$scope*/ ctx[26], dirty, get_yaxis_slot_changes),
|
|
808
|
-
get_yaxis_slot_context
|
|
809
|
-
);
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
if (default_slot) {
|
|
814
|
-
if (default_slot.p && (!current || dirty[0] & /*$$scope*/ 67108864)) {
|
|
815
|
-
update_slot_base(
|
|
816
|
-
default_slot,
|
|
817
|
-
default_slot_template,
|
|
818
|
-
ctx,
|
|
819
|
-
/*$$scope*/ ctx[26],
|
|
820
|
-
!current
|
|
821
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[26])
|
|
822
|
-
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[26], dirty, null),
|
|
823
|
-
null
|
|
824
|
-
);
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
if (box_slot) {
|
|
829
|
-
if (box_slot.p && (!current || dirty[0] & /*$$scope*/ 67108864)) {
|
|
830
|
-
update_slot_base(
|
|
831
|
-
box_slot,
|
|
832
|
-
box_slot_template,
|
|
833
|
-
ctx,
|
|
834
|
-
/*$$scope*/ ctx[26],
|
|
835
|
-
!current
|
|
836
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[26])
|
|
837
|
-
: get_slot_changes(box_slot_template, /*$$scope*/ ctx[26], dirty, get_box_slot_changes),
|
|
838
|
-
get_box_slot_context
|
|
839
|
-
);
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
if (!/*$isOk*/ ctx[3]) {
|
|
844
|
-
if (if_block3) ; else {
|
|
845
|
-
if_block3 = create_if_block$9();
|
|
846
|
-
if_block3.c();
|
|
847
|
-
if_block3.m(div1, null);
|
|
848
|
-
}
|
|
849
|
-
} else if (if_block3) {
|
|
850
|
-
if_block3.d(1);
|
|
851
|
-
if_block3 = null;
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
if (!current || dirty[0] & /*$scale*/ 16 && div1_class_value !== (div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-jxlrcp")) {
|
|
855
|
-
attr(div1, "class", div1_class_value);
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
if (!current || dirty[0] & /*$scale, $isOk*/ 24) {
|
|
859
|
-
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[3]);
|
|
860
|
-
}
|
|
861
|
-
},
|
|
862
|
-
i(local) {
|
|
863
|
-
if (current) return;
|
|
864
|
-
transition_in(xaxis_slot, local);
|
|
865
|
-
transition_in(yaxis_slot, local);
|
|
866
|
-
transition_in(default_slot, local);
|
|
867
|
-
transition_in(box_slot, local);
|
|
868
|
-
current = true;
|
|
869
|
-
},
|
|
870
|
-
o(local) {
|
|
871
|
-
transition_out(xaxis_slot, local);
|
|
872
|
-
transition_out(yaxis_slot, local);
|
|
873
|
-
transition_out(default_slot, local);
|
|
874
|
-
transition_out(box_slot, local);
|
|
875
|
-
current = false;
|
|
876
|
-
},
|
|
877
|
-
d(detaching) {
|
|
878
|
-
if (detaching) detach(div1);
|
|
879
|
-
if (if_block0) if_block0.d();
|
|
880
|
-
if (if_block1) if_block1.d();
|
|
881
|
-
if (if_block2) if_block2.d();
|
|
882
|
-
if (xaxis_slot) xaxis_slot.d(detaching);
|
|
883
|
-
if (yaxis_slot) yaxis_slot.d(detaching);
|
|
884
|
-
if (default_slot) default_slot.d(detaching);
|
|
885
|
-
if (box_slot) box_slot.d(detaching);
|
|
886
|
-
/*div0_binding*/ ctx[28](null);
|
|
887
|
-
if (if_block3) if_block3.d();
|
|
888
|
-
/*div1_binding*/ ctx[29](null);
|
|
889
|
-
mounted = false;
|
|
890
|
-
dispose();
|
|
891
|
-
}
|
|
892
|
-
};
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
function niceNum(localRange, round) {
|
|
896
|
-
const exponent = Math.floor(Math.log10(localRange));
|
|
897
|
-
const fraction = localRange / Math.pow(10, exponent);
|
|
898
|
-
let niceFraction;
|
|
899
|
-
|
|
900
|
-
if (round) {
|
|
901
|
-
if (fraction < 1.5) niceFraction = 1; else if (fraction < 3) niceFraction = 2; else if (fraction < 7) niceFraction = 5; else niceFraction = 10;
|
|
902
|
-
} else {
|
|
903
|
-
if (fraction <= 1) niceFraction = 1; else if (fraction <= 2) niceFraction = 2; else if (fraction <= 5) niceFraction = 5; else niceFraction = 10;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
return niceFraction * Math.pow(10, exponent);
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
/** Computes a scale level
|
|
910
|
-
* @param {numeric} width - width of plotting area in pixels
|
|
911
|
-
* @param {numeric} height - height of plotting area in pixels
|
|
912
|
-
* @returns {text} the scale level ("small", "medium" or "large")
|
|
913
|
-
*/
|
|
914
|
-
function getScale(width, height) {
|
|
915
|
-
if (height < 300.2 || width < 300.2) return "small";
|
|
916
|
-
if (height < 600.2 || width < 600.2) return "medium";
|
|
917
|
-
return "large";
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
function instance$b($$self, $$props, $$invalidate) {
|
|
921
|
-
let margins;
|
|
922
|
-
let cpx;
|
|
923
|
-
let cpy;
|
|
924
|
-
let $height;
|
|
925
|
-
let $yLim;
|
|
926
|
-
let $isOk;
|
|
927
|
-
let $width;
|
|
928
|
-
let $xLim;
|
|
929
|
-
let $scale;
|
|
930
|
-
let { $$slots: slots = {}, $$scope } = $$props;
|
|
931
|
-
let { limX = [undefined, undefined] } = $$props;
|
|
932
|
-
let { limY = [undefined, undefined] } = $$props;
|
|
933
|
-
let { title = "" } = $$props;
|
|
934
|
-
let { xLabel = "" } = $$props;
|
|
935
|
-
let { yLabel = "" } = $$props;
|
|
936
|
-
let { multiSeries = true } = $$props;
|
|
937
|
-
|
|
938
|
-
// event dispatcher
|
|
939
|
-
const dispatch = createEventDispatcher();
|
|
940
|
-
|
|
941
|
-
// how big are margins (number of pixels in unit margin value) between axis and plot area if axis are shown
|
|
942
|
-
const AXES_MARGIN_FACTORS = { "small": 30, "medium": 40, "large": 50 };
|
|
943
|
-
|
|
944
|
-
// number of ticks along each axis
|
|
945
|
-
const TICK_NUM = { "small": 5, "medium": 8, "large": 12 };
|
|
946
|
-
|
|
947
|
-
// margin between plot series elements and data labels
|
|
948
|
-
const LABELS_MARGIN = { "small": 10, "medium": 15, "large": 20 };
|
|
949
|
-
|
|
950
|
-
// line styles for different scales and types
|
|
951
|
-
const LINE_STYLES = {
|
|
952
|
-
small: ["0", "3,3", "1,1", "3,1"],
|
|
953
|
-
medium: ["0", "5,5", "2,2", "5,2"],
|
|
954
|
-
large: ["0", "7,7", "3,3", "7,3"]
|
|
955
|
-
};
|
|
956
|
-
|
|
957
|
-
// constant to make clip path ID unique
|
|
958
|
-
const clipPathID = "plottingArea" + Math.round(Math.random() * 10000);
|
|
959
|
-
|
|
960
|
-
/* parameters for internal use inside the component */
|
|
961
|
-
let plotElement;
|
|
962
|
-
|
|
963
|
-
let axesElement;
|
|
964
|
-
let axesMargins = [0.034, 0.034, 0.034, 0.034]; // initial margins (will be multiplied to FACTORS)
|
|
965
|
-
|
|
966
|
-
/* reactive parameters to be shared with children via context */
|
|
967
|
-
const width = writable(100); // actual width of plotting area in pixels
|
|
968
|
-
|
|
969
|
-
component_subscribe($$self, width, value => $$invalidate(24, $width = value));
|
|
970
|
-
const height = writable(100); // actual height of plotting area in pixels
|
|
971
|
-
component_subscribe($$self, height, value => $$invalidate(22, $height = value));
|
|
972
|
-
const xLim = writable([undefined, undefined]); // actual limits for x-axis in plot units
|
|
973
|
-
component_subscribe($$self, xLim, value => $$invalidate(25, $xLim = value));
|
|
974
|
-
const yLim = writable([undefined, undefined]); // actual limits for y-axis in plot units
|
|
975
|
-
component_subscribe($$self, yLim, value => $$invalidate(23, $yLim = value));
|
|
976
|
-
const scale = writable("medium"); // scale factor (how big the shown plot is)
|
|
977
|
-
component_subscribe($$self, scale, value => $$invalidate(4, $scale = value));
|
|
978
|
-
const isOk = writable(false); // are axes ready for drawing
|
|
979
|
-
component_subscribe($$self, isOk, value => $$invalidate(3, $isOk = value));
|
|
980
|
-
|
|
981
|
-
/** Adds margins for x-axis (e.g. when x-axis must be shown) */
|
|
982
|
-
const addXAxisMargins = function () {
|
|
983
|
-
$$invalidate(20, axesMargins[0] = 1, axesMargins);
|
|
984
|
-
$$invalidate(20, axesMargins[2] = 0.5, axesMargins);
|
|
985
|
-
$$invalidate(20, axesMargins[1] = axesMargins[1] > 0.5 ? axesMargins[1] : 0.5, axesMargins);
|
|
986
|
-
$$invalidate(20, axesMargins[3] = axesMargins[3] > 0.5 ? axesMargins[3] : 0.5, axesMargins);
|
|
987
|
-
};
|
|
988
|
-
|
|
989
|
-
/** Adds margins for y-axis (e.g. when y-axis must be shown) */
|
|
990
|
-
const addYAxisMargins = function () {
|
|
991
|
-
$$invalidate(20, axesMargins[1] = 1, axesMargins);
|
|
992
|
-
$$invalidate(20, axesMargins[3] = 0.5, axesMargins);
|
|
993
|
-
$$invalidate(20, axesMargins[0] = axesMargins[0] > 0.5 ? axesMargins[0] : 0.5, axesMargins);
|
|
994
|
-
$$invalidate(20, axesMargins[2] = axesMargins[2] > 0.5 ? axesMargins[2] : 0.5, axesMargins);
|
|
995
|
-
};
|
|
996
|
-
|
|
997
|
-
/** Adjusts limits for x-axis (e.g. when new series is added)
|
|
998
|
-
* @param {Array} newLim - vector with new limits (two values)
|
|
999
|
-
*/
|
|
1000
|
-
const adjustXAxisLimits = function (newLim) {
|
|
1001
|
-
if (!limX.some(v => v === undefined)) return;
|
|
1002
|
-
xLim.update(lim => adjustAxisLimits(lim, newLim));
|
|
1003
|
-
};
|
|
1004
|
-
|
|
1005
|
-
/** Adjusts limits for y-axis (e.g. when new series is added)
|
|
1006
|
-
* @param {Array} newLim - vector with new limits (two values)
|
|
1007
|
-
*/
|
|
1008
|
-
const adjustYAxisLimits = function (newLim) {
|
|
1009
|
-
if (!limY.some(v => v === undefined)) return;
|
|
1010
|
-
yLim.update(lim => adjustAxisLimits(lim, newLim));
|
|
1011
|
-
};
|
|
1012
|
-
|
|
1013
|
-
/** Adjusts x- or y- axis limits (e.g. when new elements are added)
|
|
1014
|
-
* @param {Array} lim - vector with limits for current axis (two values)
|
|
1015
|
-
* @param {Array} newLim - vector with new limits (two values)
|
|
1016
|
-
* @returns {Array} vector with rescaled values
|
|
1017
|
-
*
|
|
1018
|
-
* The new limits are set separately for min and max. Either if current value is undefined or
|
|
1019
|
-
* if new value is outside the current limits (smaller than min or larger than max).
|
|
1020
|
-
*/
|
|
1021
|
-
const adjustAxisLimits = function (lim, newLim) {
|
|
1022
|
-
let adjustedLim = [
|
|
1023
|
-
lim[0] !== undefined && multiSeries === true && lim[0] < newLim[0]
|
|
1024
|
-
? lim[0]
|
|
1025
|
-
: newLim[0],
|
|
1026
|
-
lim[1] !== undefined && multiSeries === true && lim[1] > newLim[1]
|
|
1027
|
-
? lim[1]
|
|
1028
|
-
: newLim[1]
|
|
1029
|
-
];
|
|
1030
|
-
|
|
1031
|
-
// special case when both limits are zero
|
|
1032
|
-
if (adjustedLim[0] === 0 && adjustedLim[1] === 0) {
|
|
1033
|
-
adjustedLim = [-0.1, 0.1];
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
// special case when limits are equal (add ±5%)
|
|
1037
|
-
if (adjustedLim[0] === adjustedLim[1]) {
|
|
1038
|
-
adjustedLim = [adjustedLim[0] * 0.95, adjustedLim[0] * 1.05];
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
return adjustedLim;
|
|
1042
|
-
};
|
|
1043
|
-
|
|
1044
|
-
/** Rescales x-values from plot coordinates to screen (SVG) coordinates
|
|
1045
|
-
* @param {Array} x - vector with coordinates (or objects size) in original plot coordinates
|
|
1046
|
-
* @param {Array} xLim - vector with current limits for x-axis in original plot coordinates
|
|
1047
|
-
* @param {number} width - width of coordinate system in pixels
|
|
1048
|
-
* @param {boolean} doSizeScreen - scale size of objects (true) or coordinates
|
|
1049
|
-
* @returns {Array} vector with rescaled values
|
|
1050
|
-
*/
|
|
1051
|
-
const scaleX = function (x, xLim, width, doSizeScale = false) {
|
|
1052
|
-
if (!$isOk || x === undefined || !Array.isArray(x)) return undefined;
|
|
1053
|
-
|
|
1054
|
-
if (doSizeScale) {
|
|
1055
|
-
// scale size of objects instead of coordinates
|
|
1056
|
-
return x.map(v => v / (xLim[1] - xLim[0]) * (width - margins[1] - margins[3]));
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
return x.map(v => (v - xLim[0]) / (xLim[1] - xLim[0]) * (width - margins[1] - margins[3]) + margins[1]);
|
|
1060
|
-
};
|
|
1061
|
-
|
|
1062
|
-
/** Rescales x-values from plot coordinates to screen (SVG) coordinates
|
|
1063
|
-
* @param {Array} x - vector with coordinates (or objects size) in original plot coordinates
|
|
1064
|
-
* @param {Array} xLim - vector with current limits for x-axis in original plot coordinates
|
|
1065
|
-
* @param {number} width - width of coordinate system in pixels
|
|
1066
|
-
* @param {boolean} doSizeScreen - scale size of objects (true) or coordinates
|
|
1067
|
-
* @returns {Array} vector with rescaled values
|
|
1068
|
-
*/
|
|
1069
|
-
const scaleY = function (y, yLim, height, doSizeScale = false) {
|
|
1070
|
-
if (!$isOk || y === undefined || !Array.isArray(y)) return undefined;
|
|
1071
|
-
|
|
1072
|
-
if (doSizeScale) {
|
|
1073
|
-
// scale size of objects instead of coordinates
|
|
1074
|
-
return y.map(v => v / (yLim[1] - yLim[0]) * (height - margins[0] - margins[2]));
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
// for coordinates we also need to invert (flip) the y-axis
|
|
1078
|
-
return y.map(v => (yLim[1] - v) / (yLim[1] - yLim[0]) * (height - margins[0] - margins[2]) + margins[2]);
|
|
1079
|
-
};
|
|
1080
|
-
|
|
1081
|
-
/** Computes nice tick values for axis
|
|
1082
|
-
* @param {Array} ticks - vector with ticks if alredy available (if not, new will be computed)
|
|
1083
|
-
* @param {Array} lim - vector with axis limits tickets must be computed for
|
|
1084
|
-
* @param {number} maxTickNum - maximum number of ticks to compute
|
|
1085
|
-
* @param {boolean} round - round or not the fractions when computing nice numbers for the ticks
|
|
1086
|
-
* @returns {Array} a vector with computed tick positions
|
|
1087
|
-
*/
|
|
1088
|
-
const getAxisTicks = function (ticks, lim, maxTickNum, round = true) {
|
|
1089
|
-
// if ticks are already provided do not recompute them
|
|
1090
|
-
if (ticks !== undefined) return ticks;
|
|
1091
|
-
|
|
1092
|
-
// check if limits are ok
|
|
1093
|
-
if (!Array.isArray(lim) || lim[0] === undefined || lim[1] === undefined) return undefined;
|
|
1094
|
-
|
|
1095
|
-
// get range as a nice number and compute min, max and steps for the tick sequence
|
|
1096
|
-
const range = niceNum(lim[1] - lim[0], round);
|
|
1097
|
-
|
|
1098
|
-
const tickSpacing = niceNum(range / (maxTickNum - 1), round);
|
|
1099
|
-
const tickMin = Math.ceil(lim[0] / tickSpacing) * tickSpacing;
|
|
1100
|
-
const tickMax = Math.floor(lim[1] / tickSpacing) * tickSpacing;
|
|
1101
|
-
|
|
1102
|
-
// recompute maxTickNum
|
|
1103
|
-
maxTickNum = Math.round((tickMax - tickMin + 1) / tickSpacing) + 1;
|
|
1104
|
-
|
|
1105
|
-
// create a sequence and return
|
|
1106
|
-
ticks = [...Array(maxTickNum)].map((x, i) => tickMin + i * tickSpacing);
|
|
1107
|
-
|
|
1108
|
-
// if step is smaller than 1 round values to remove small decimals accidentiall added by JS
|
|
1109
|
-
if (Math.abs(tickSpacing) < 1) {
|
|
1110
|
-
const r = Math.pow(10, 1 + Math.round(-Math.log10(tickSpacing)));
|
|
1111
|
-
ticks = ticks.map(v => Math.round((v + Number.EPSILON) * r) / r);
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
// make sure the ticks are not aligned with axes limits
|
|
1115
|
-
return ticks.filter(x => x >= lim[0] & x <= lim[1]);
|
|
1116
|
-
};
|
|
1117
|
-
|
|
1118
|
-
/* context with Axes constants, properties and methods to share with children */
|
|
1119
|
-
let context = {
|
|
1120
|
-
// methods
|
|
1121
|
-
addXAxisMargins,
|
|
1122
|
-
addYAxisMargins,
|
|
1123
|
-
adjustXAxisLimits,
|
|
1124
|
-
adjustYAxisLimits,
|
|
1125
|
-
getAxisTicks,
|
|
1126
|
-
scaleX,
|
|
1127
|
-
scaleY,
|
|
1128
|
-
// variables
|
|
1129
|
-
isOk,
|
|
1130
|
-
scale,
|
|
1131
|
-
width,
|
|
1132
|
-
height,
|
|
1133
|
-
xLim,
|
|
1134
|
-
yLim,
|
|
1135
|
-
// constants
|
|
1136
|
-
LINE_STYLES,
|
|
1137
|
-
LABELS_MARGIN,
|
|
1138
|
-
TICK_NUM
|
|
1139
|
-
};
|
|
1140
|
-
|
|
1141
|
-
setContext('axes', context);
|
|
1142
|
-
|
|
1143
|
-
// handle click on plot elements and dispatch manual events
|
|
1144
|
-
function dispatchClickEvent(eventName, el) {
|
|
1145
|
-
dispatch(eventName, {
|
|
1146
|
-
seriesTitle: el.parentNode.getAttribute('title'),
|
|
1147
|
-
elementID: el.dataset.id
|
|
1148
|
-
});
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
function handleClick(e) {
|
|
1152
|
-
// scatter plot markers
|
|
1153
|
-
if (e.target.tagName === "text" && e.target.parentNode.classList.contains("series_scatter")) {
|
|
1154
|
-
dispatchClickEvent("markerclick", e.target);
|
|
1155
|
-
return;
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
// bar plot bars
|
|
1159
|
-
if (e.target.tagName === "rect" && e.target.parentNode.classList.contains("series_bar")) {
|
|
1160
|
-
dispatchClickEvent("barclick", e.target);
|
|
1161
|
-
return;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
// outside any plot element
|
|
1165
|
-
dispatch("axesclick");
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
/* observer for the axes area size - to update size of axes */
|
|
1169
|
-
const ro2 = new ResizeObserver(entries => {
|
|
1170
|
-
for (let entry of entries) {
|
|
1171
|
-
const acr = axesElement.getBoundingClientRect();
|
|
1172
|
-
width.update(x => acr.width);
|
|
1173
|
-
height.update(x => acr.height);
|
|
1174
|
-
}
|
|
1175
|
-
});
|
|
1176
|
-
|
|
1177
|
-
/* observer for the plot area size — to update scale */
|
|
1178
|
-
const ro1 = new ResizeObserver(entries => {
|
|
1179
|
-
for (let entry of entries) {
|
|
1180
|
-
const pcr = plotElement.getBoundingClientRect();
|
|
1181
|
-
scale.update(x => getScale(pcr.width, pcr.height));
|
|
1182
|
-
}
|
|
1183
|
-
});
|
|
1184
|
-
|
|
1185
|
-
onMount(() => {
|
|
1186
|
-
ro1.observe(plotElement);
|
|
1187
|
-
ro2.observe(axesElement);
|
|
1188
|
-
});
|
|
1189
|
-
|
|
1190
|
-
onDestroy(() => {
|
|
1191
|
-
ro1.unobserve(plotElement);
|
|
1192
|
-
ro2.unobserve(axesElement);
|
|
1193
|
-
});
|
|
1194
|
-
|
|
1195
|
-
function div0_binding($$value) {
|
|
1196
|
-
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
1197
|
-
axesElement = $$value;
|
|
1198
|
-
$$invalidate(6, axesElement);
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
function div1_binding($$value) {
|
|
1203
|
-
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
1204
|
-
plotElement = $$value;
|
|
1205
|
-
$$invalidate(5, plotElement);
|
|
1206
|
-
});
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
$$self.$$set = $$props => {
|
|
1210
|
-
if ('limX' in $$props) $$invalidate(17, limX = $$props.limX);
|
|
1211
|
-
if ('limY' in $$props) $$invalidate(18, limY = $$props.limY);
|
|
1212
|
-
if ('title' in $$props) $$invalidate(0, title = $$props.title);
|
|
1213
|
-
if ('xLabel' in $$props) $$invalidate(1, xLabel = $$props.xLabel);
|
|
1214
|
-
if ('yLabel' in $$props) $$invalidate(2, yLabel = $$props.yLabel);
|
|
1215
|
-
if ('multiSeries' in $$props) $$invalidate(19, multiSeries = $$props.multiSeries);
|
|
1216
|
-
if ('$$scope' in $$props) $$invalidate(26, $$scope = $$props.$$scope);
|
|
1217
|
-
};
|
|
1218
|
-
|
|
1219
|
-
$$self.$$.update = () => {
|
|
1220
|
-
if ($$self.$$.dirty[0] & /*limX*/ 131072) {
|
|
1221
|
-
// this is reactive in case if limX and limY are interactively changed by parent script
|
|
1222
|
-
if (!limX.some(v => v === undefined)) xLim.update(v => limX);
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
if ($$self.$$.dirty[0] & /*limY*/ 262144) {
|
|
1226
|
-
if (!limY.some(v => v === undefined)) yLim.update(v => limY);
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
if ($$self.$$.dirty[0] & /*axesMargins, $scale*/ 1048592) {
|
|
1230
|
-
// computes real margins in pixels based on current scale
|
|
1231
|
-
$$invalidate(21, margins = axesMargins.map(v => v * AXES_MARGIN_FACTORS[$scale]));
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
if ($$self.$$.dirty[0] & /*$yLim, $xLim, $width, margins, $height*/ 65011712) {
|
|
1235
|
-
// computes status which tells that axes limits look fine and it is safe to draw
|
|
1236
|
-
// the status is based on the axis limits validity
|
|
1237
|
-
isOk.update(v => Array.isArray($yLim) && Array.isArray($xLim) && $xLim.length === 2 && $yLim.length === 2 && !$yLim.some(v => v === undefined) && !$xLim.some(v => v === undefined) && !$yLim.some(v => isNaN(v)) && !$xLim.some(v => isNaN(v)) && $xLim[1] !== $xLim[0] && $yLim[1] !== $yLim[0] && $width > margins[1] + margins[3] && $height > margins[0] + margins[2]);
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/ 50331656) {
|
|
1241
|
-
// computes coordinates for clip path box
|
|
1242
|
-
$$invalidate(8, cpx = $isOk ? scaleX($xLim, $xLim, $width) : [0, 1]);
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
if ($$self.$$.dirty[0] & /*$isOk, $yLim, $height*/ 12582920) {
|
|
1246
|
-
$$invalidate(7, cpy = $isOk ? scaleY($yLim, $yLim, $height) : [1, 0]);
|
|
1247
|
-
}
|
|
1248
|
-
};
|
|
1249
|
-
|
|
1250
|
-
return [
|
|
1251
|
-
title,
|
|
1252
|
-
xLabel,
|
|
1253
|
-
yLabel,
|
|
1254
|
-
$isOk,
|
|
1255
|
-
$scale,
|
|
1256
|
-
plotElement,
|
|
1257
|
-
axesElement,
|
|
1258
|
-
cpy,
|
|
1259
|
-
cpx,
|
|
1260
|
-
clipPathID,
|
|
1261
|
-
width,
|
|
1262
|
-
height,
|
|
1263
|
-
xLim,
|
|
1264
|
-
yLim,
|
|
1265
|
-
scale,
|
|
1266
|
-
isOk,
|
|
1267
|
-
handleClick,
|
|
1268
|
-
limX,
|
|
1269
|
-
limY,
|
|
1270
|
-
multiSeries,
|
|
1271
|
-
axesMargins,
|
|
1272
|
-
margins,
|
|
1273
|
-
$height,
|
|
1274
|
-
$yLim,
|
|
1275
|
-
$width,
|
|
1276
|
-
$xLim,
|
|
1277
|
-
$$scope,
|
|
1278
|
-
slots,
|
|
1279
|
-
div0_binding,
|
|
1280
|
-
div1_binding
|
|
1281
|
-
];
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
class Axes extends SvelteComponent {
|
|
1285
|
-
constructor(options) {
|
|
1286
|
-
super();
|
|
1287
|
-
|
|
1288
|
-
init(
|
|
1289
|
-
this,
|
|
1290
|
-
options,
|
|
1291
|
-
instance$b,
|
|
1292
|
-
create_fragment$b,
|
|
1293
|
-
safe_not_equal,
|
|
1294
|
-
{
|
|
1295
|
-
limX: 17,
|
|
1296
|
-
limY: 18,
|
|
1297
|
-
title: 0,
|
|
1298
|
-
xLabel: 1,
|
|
1299
|
-
yLabel: 2,
|
|
1300
|
-
multiSeries: 19
|
|
1301
|
-
},
|
|
1302
|
-
add_css$3,
|
|
1303
|
-
[-1, -1]
|
|
1304
|
-
);
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
const Colors = {
|
|
1309
|
-
"AXIS_LINE": "#303030",
|
|
1310
|
-
"AXIS_TICK": "#606060",
|
|
1311
|
-
"WHITE": "#fff",
|
|
1312
|
-
"BLACK": "#000",
|
|
1313
|
-
"GRAY": "#909090",
|
|
1314
|
-
"MIDDLEGRAY": "#dadada",
|
|
1315
|
-
"LIGHTGRAY": "#f0f0f0",
|
|
1316
|
-
"DARKGRAY": "#606060",
|
|
1317
|
-
|
|
1318
|
-
"PRIMARY": "#2266ff",
|
|
1319
|
-
"PRIMARY_TEXT": "#333",
|
|
1320
|
-
};
|
|
1321
|
-
|
|
1322
|
-
/* src/XAxis.svelte generated by Svelte v3.50.1 */
|
|
1323
|
-
|
|
1324
|
-
function get_each_context$5(ctx, list, i) {
|
|
1325
|
-
const child_ctx = ctx.slice();
|
|
1326
|
-
child_ctx[26] = list[i];
|
|
1327
|
-
child_ctx[28] = i;
|
|
1328
|
-
return child_ctx;
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
// (57:0) {#if $isOk && x !== undefined && y !== undefined }
|
|
1332
|
-
function create_if_block$8(ctx) {
|
|
1333
|
-
let g;
|
|
1334
|
-
let line;
|
|
1335
|
-
let line_x__value;
|
|
1336
|
-
let line_x__value_1;
|
|
1337
|
-
let line_y__value;
|
|
1338
|
-
let line_y__value_1;
|
|
1339
|
-
let each_value = /*ticksX*/ ctx[4];
|
|
1340
|
-
let each_blocks = [];
|
|
1341
|
-
|
|
1342
|
-
for (let i = 0; i < each_value.length; i += 1) {
|
|
1343
|
-
each_blocks[i] = create_each_block$5(get_each_context$5(ctx, each_value, i));
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
return {
|
|
1347
|
-
c() {
|
|
1348
|
-
g = svg_element("g");
|
|
1349
|
-
|
|
1350
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
1351
|
-
each_blocks[i].c();
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
line = svg_element("line");
|
|
1355
|
-
attr(line, "x1", line_x__value = /*x*/ ctx[5][0]);
|
|
1356
|
-
attr(line, "x2", line_x__value_1 = /*x*/ ctx[5][1]);
|
|
1357
|
-
attr(line, "y1", line_y__value = /*y*/ ctx[2][0]);
|
|
1358
|
-
attr(line, "y2", line_y__value_1 = /*y*/ ctx[2][0]);
|
|
1359
|
-
attr(line, "style", /*axisLineStyleStr*/ ctx[7]);
|
|
1360
|
-
attr(g, "class", "mdaplot__axis mdaplot__xaxis");
|
|
1361
|
-
},
|
|
1362
|
-
m(target, anchor) {
|
|
1363
|
-
insert(target, g, anchor);
|
|
1364
|
-
|
|
1365
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
1366
|
-
each_blocks[i].m(g, null);
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
append(g, line);
|
|
1370
|
-
},
|
|
1371
|
-
p(ctx, dirty) {
|
|
1372
|
-
if (dirty & /*ticksX, ticksY, dy, tickLabels, axisLineStyleStr, y, gridLineStyleStr*/ 415) {
|
|
1373
|
-
each_value = /*ticksX*/ ctx[4];
|
|
1374
|
-
let i;
|
|
1375
|
-
|
|
1376
|
-
for (i = 0; i < each_value.length; i += 1) {
|
|
1377
|
-
const child_ctx = get_each_context$5(ctx, each_value, i);
|
|
1378
|
-
|
|
1379
|
-
if (each_blocks[i]) {
|
|
1380
|
-
each_blocks[i].p(child_ctx, dirty);
|
|
1381
|
-
} else {
|
|
1382
|
-
each_blocks[i] = create_each_block$5(child_ctx);
|
|
1383
|
-
each_blocks[i].c();
|
|
1384
|
-
each_blocks[i].m(g, line);
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
|
|
1388
|
-
for (; i < each_blocks.length; i += 1) {
|
|
1389
|
-
each_blocks[i].d(1);
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
each_blocks.length = each_value.length;
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
if (dirty & /*x*/ 32 && line_x__value !== (line_x__value = /*x*/ ctx[5][0])) {
|
|
1396
|
-
attr(line, "x1", line_x__value);
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
|
-
if (dirty & /*x*/ 32 && line_x__value_1 !== (line_x__value_1 = /*x*/ ctx[5][1])) {
|
|
1400
|
-
attr(line, "x2", line_x__value_1);
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
if (dirty & /*y*/ 4 && line_y__value !== (line_y__value = /*y*/ ctx[2][0])) {
|
|
1404
|
-
attr(line, "y1", line_y__value);
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
if (dirty & /*y*/ 4 && line_y__value_1 !== (line_y__value_1 = /*y*/ ctx[2][0])) {
|
|
1408
|
-
attr(line, "y2", line_y__value_1);
|
|
1409
|
-
}
|
|
1410
|
-
},
|
|
1411
|
-
d(detaching) {
|
|
1412
|
-
if (detaching) detach(g);
|
|
1413
|
-
destroy_each(each_blocks, detaching);
|
|
1414
|
-
}
|
|
1415
|
-
};
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
// (59:3) {#each ticksX as tx, i}
|
|
1419
|
-
function create_each_block$5(ctx) {
|
|
1420
|
-
let line0;
|
|
1421
|
-
let line0_x__value;
|
|
1422
|
-
let line0_x__value_1;
|
|
1423
|
-
let line0_y__value;
|
|
1424
|
-
let line0_y__value_1;
|
|
1425
|
-
let line1;
|
|
1426
|
-
let line1_x__value;
|
|
1427
|
-
let line1_x__value_1;
|
|
1428
|
-
let line1_y__value;
|
|
1429
|
-
let line1_y__value_1;
|
|
1430
|
-
let text_1;
|
|
1431
|
-
let t_value = /*tickLabels*/ ctx[0][/*i*/ ctx[28]] + "";
|
|
1432
|
-
let t;
|
|
1433
|
-
let text_1_x_value;
|
|
1434
|
-
let text_1_y_value;
|
|
1435
|
-
|
|
1436
|
-
return {
|
|
1437
|
-
c() {
|
|
1438
|
-
line0 = svg_element("line");
|
|
1439
|
-
line1 = svg_element("line");
|
|
1440
|
-
text_1 = svg_element("text");
|
|
1441
|
-
t = text(t_value);
|
|
1442
|
-
attr(line0, "x1", line0_x__value = /*tx*/ ctx[26]);
|
|
1443
|
-
attr(line0, "x2", line0_x__value_1 = /*tx*/ ctx[26]);
|
|
1444
|
-
attr(line0, "y1", line0_y__value = /*y*/ ctx[2][0]);
|
|
1445
|
-
attr(line0, "y2", line0_y__value_1 = /*y*/ ctx[2][1]);
|
|
1446
|
-
attr(line0, "style", /*gridLineStyleStr*/ ctx[8]);
|
|
1447
|
-
attr(line1, "x1", line1_x__value = /*tx*/ ctx[26]);
|
|
1448
|
-
attr(line1, "x2", line1_x__value_1 = /*tx*/ ctx[26]);
|
|
1449
|
-
attr(line1, "y1", line1_y__value = /*ticksY*/ ctx[3][0]);
|
|
1450
|
-
attr(line1, "y2", line1_y__value_1 = /*ticksY*/ ctx[3][1]);
|
|
1451
|
-
attr(line1, "style", /*axisLineStyleStr*/ ctx[7]);
|
|
1452
|
-
attr(text_1, "x", text_1_x_value = /*tx*/ ctx[26]);
|
|
1453
|
-
attr(text_1, "y", text_1_y_value = /*ticksY*/ ctx[3][1]);
|
|
1454
|
-
attr(text_1, "dx", "0");
|
|
1455
|
-
attr(text_1, "dy", /*dy*/ ctx[1]);
|
|
1456
|
-
attr(text_1, "class", "mdaplot__axis-labels");
|
|
1457
|
-
attr(text_1, "dominant-baseline", "middle");
|
|
1458
|
-
attr(text_1, "text-anchor", "middle");
|
|
1459
|
-
},
|
|
1460
|
-
m(target, anchor) {
|
|
1461
|
-
insert(target, line0, anchor);
|
|
1462
|
-
insert(target, line1, anchor);
|
|
1463
|
-
insert(target, text_1, anchor);
|
|
1464
|
-
append(text_1, t);
|
|
1465
|
-
},
|
|
1466
|
-
p(ctx, dirty) {
|
|
1467
|
-
if (dirty & /*ticksX*/ 16 && line0_x__value !== (line0_x__value = /*tx*/ ctx[26])) {
|
|
1468
|
-
attr(line0, "x1", line0_x__value);
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
if (dirty & /*ticksX*/ 16 && line0_x__value_1 !== (line0_x__value_1 = /*tx*/ ctx[26])) {
|
|
1472
|
-
attr(line0, "x2", line0_x__value_1);
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
if (dirty & /*y*/ 4 && line0_y__value !== (line0_y__value = /*y*/ ctx[2][0])) {
|
|
1476
|
-
attr(line0, "y1", line0_y__value);
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
if (dirty & /*y*/ 4 && line0_y__value_1 !== (line0_y__value_1 = /*y*/ ctx[2][1])) {
|
|
1480
|
-
attr(line0, "y2", line0_y__value_1);
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
if (dirty & /*ticksX*/ 16 && line1_x__value !== (line1_x__value = /*tx*/ ctx[26])) {
|
|
1484
|
-
attr(line1, "x1", line1_x__value);
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
if (dirty & /*ticksX*/ 16 && line1_x__value_1 !== (line1_x__value_1 = /*tx*/ ctx[26])) {
|
|
1488
|
-
attr(line1, "x2", line1_x__value_1);
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
|
-
if (dirty & /*ticksY*/ 8 && line1_y__value !== (line1_y__value = /*ticksY*/ ctx[3][0])) {
|
|
1492
|
-
attr(line1, "y1", line1_y__value);
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
if (dirty & /*ticksY*/ 8 && line1_y__value_1 !== (line1_y__value_1 = /*ticksY*/ ctx[3][1])) {
|
|
1496
|
-
attr(line1, "y2", line1_y__value_1);
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
if (dirty & /*tickLabels*/ 1 && t_value !== (t_value = /*tickLabels*/ ctx[0][/*i*/ ctx[28]] + "")) set_data(t, t_value);
|
|
1500
|
-
|
|
1501
|
-
if (dirty & /*ticksX*/ 16 && text_1_x_value !== (text_1_x_value = /*tx*/ ctx[26])) {
|
|
1502
|
-
attr(text_1, "x", text_1_x_value);
|
|
1503
|
-
}
|
|
1504
|
-
|
|
1505
|
-
if (dirty & /*ticksY*/ 8 && text_1_y_value !== (text_1_y_value = /*ticksY*/ ctx[3][1])) {
|
|
1506
|
-
attr(text_1, "y", text_1_y_value);
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
if (dirty & /*dy*/ 2) {
|
|
1510
|
-
attr(text_1, "dy", /*dy*/ ctx[1]);
|
|
1511
|
-
}
|
|
1512
|
-
},
|
|
1513
|
-
d(detaching) {
|
|
1514
|
-
if (detaching) detach(line0);
|
|
1515
|
-
if (detaching) detach(line1);
|
|
1516
|
-
if (detaching) detach(text_1);
|
|
1517
|
-
}
|
|
1518
|
-
};
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
function create_fragment$a(ctx) {
|
|
1522
|
-
let if_block_anchor;
|
|
1523
|
-
let if_block = /*$isOk*/ ctx[6] && /*x*/ ctx[5] !== undefined && /*y*/ ctx[2] !== undefined && create_if_block$8(ctx);
|
|
1524
|
-
|
|
1525
|
-
return {
|
|
1526
|
-
c() {
|
|
1527
|
-
if (if_block) if_block.c();
|
|
1528
|
-
if_block_anchor = empty();
|
|
1529
|
-
},
|
|
1530
|
-
m(target, anchor) {
|
|
1531
|
-
if (if_block) if_block.m(target, anchor);
|
|
1532
|
-
insert(target, if_block_anchor, anchor);
|
|
1533
|
-
},
|
|
1534
|
-
p(ctx, [dirty]) {
|
|
1535
|
-
if (/*$isOk*/ ctx[6] && /*x*/ ctx[5] !== undefined && /*y*/ ctx[2] !== undefined) {
|
|
1536
|
-
if (if_block) {
|
|
1537
|
-
if_block.p(ctx, dirty);
|
|
1538
|
-
} else {
|
|
1539
|
-
if_block = create_if_block$8(ctx);
|
|
1540
|
-
if_block.c();
|
|
1541
|
-
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
1542
|
-
}
|
|
1543
|
-
} else if (if_block) {
|
|
1544
|
-
if_block.d(1);
|
|
1545
|
-
if_block = null;
|
|
1546
|
-
}
|
|
1547
|
-
},
|
|
1548
|
-
i: noop,
|
|
1549
|
-
o: noop,
|
|
1550
|
-
d(detaching) {
|
|
1551
|
-
if (if_block) if_block.d(detaching);
|
|
1552
|
-
if (detaching) detach(if_block_anchor);
|
|
1553
|
-
}
|
|
1554
|
-
};
|
|
1555
|
-
}
|
|
1556
|
-
|
|
1557
|
-
function instance$a($$self, $$props, $$invalidate) {
|
|
1558
|
-
let x;
|
|
1559
|
-
let y;
|
|
1560
|
-
let dy;
|
|
1561
|
-
let tickNum;
|
|
1562
|
-
let ticksX;
|
|
1563
|
-
let ticksY;
|
|
1564
|
-
let $axesWidth;
|
|
1565
|
-
let $xLim;
|
|
1566
|
-
let $scale;
|
|
1567
|
-
let $axesHeight;
|
|
1568
|
-
let $yLim;
|
|
1569
|
-
let $isOk;
|
|
1570
|
-
let { slot = "xaxis" } = $$props;
|
|
1571
|
-
let { ticks = undefined } = $$props;
|
|
1572
|
-
let { tickLabels = ticks } = $$props;
|
|
1573
|
-
let { showGrid = false } = $$props;
|
|
1574
|
-
|
|
1575
|
-
// set up tick mode
|
|
1576
|
-
const tickMode = ticks === undefined ? "auto" : "manual";
|
|
1577
|
-
|
|
1578
|
-
/* sanity checks of input parameters */
|
|
1579
|
-
if (slot !== "xaxis") {
|
|
1580
|
-
throw "Component XAxis must have \"slot='xaxis'\" attribute.";
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
if (ticks !== undefined && !Array.isArray(ticks)) {
|
|
1584
|
-
throw "XAxis: 'ticks' must be a vector of numbers.";
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
if (ticks !== undefined && !(Array.isArray(tickLabels) && tickLabels.length == ticks.length)) {
|
|
1588
|
-
throw "XAxis: 'tickLabels' must be a vector of the same size as ticks.";
|
|
1589
|
-
}
|
|
1590
|
-
|
|
1591
|
-
/* styles for axis and grid lines */
|
|
1592
|
-
const axisLineStyleStr = `stroke:${Colors.DARKGRAY};line-width:1px;`;
|
|
1593
|
-
|
|
1594
|
-
const gridLineStyleStr = `stroke:${Colors.MIDDLEGRAY};stroke-opacity:${showGrid ? 1 : 0};stroke-dasharray:2px;`;
|
|
1595
|
-
|
|
1596
|
-
// get axes context and adjust x margins
|
|
1597
|
-
const axes = getContext('axes');
|
|
1598
|
-
|
|
1599
|
-
axes.addXAxisMargins();
|
|
1600
|
-
|
|
1601
|
-
// get reactive variables needed to compute coordinates
|
|
1602
|
-
const xLim = axes.xLim;
|
|
1603
|
-
|
|
1604
|
-
component_subscribe($$self, xLim, value => $$invalidate(20, $xLim = value));
|
|
1605
|
-
const yLim = axes.yLim;
|
|
1606
|
-
component_subscribe($$self, yLim, value => $$invalidate(23, $yLim = value));
|
|
1607
|
-
const axesWidth = axes.width;
|
|
1608
|
-
component_subscribe($$self, axesWidth, value => $$invalidate(19, $axesWidth = value));
|
|
1609
|
-
const axesHeight = axes.height;
|
|
1610
|
-
component_subscribe($$self, axesHeight, value => $$invalidate(22, $axesHeight = value));
|
|
1611
|
-
const scale = axes.scale;
|
|
1612
|
-
component_subscribe($$self, scale, value => $$invalidate(21, $scale = value));
|
|
1613
|
-
const isOk = axes.isOk;
|
|
1614
|
-
component_subscribe($$self, isOk, value => $$invalidate(6, $isOk = value));
|
|
1615
|
-
|
|
1616
|
-
$$self.$$set = $$props => {
|
|
1617
|
-
if ('slot' in $$props) $$invalidate(16, slot = $$props.slot);
|
|
1618
|
-
if ('ticks' in $$props) $$invalidate(15, ticks = $$props.ticks);
|
|
1619
|
-
if ('tickLabels' in $$props) $$invalidate(0, tickLabels = $$props.tickLabels);
|
|
1620
|
-
if ('showGrid' in $$props) $$invalidate(17, showGrid = $$props.showGrid);
|
|
1621
|
-
};
|
|
1622
|
-
|
|
1623
|
-
$$self.$$.update = () => {
|
|
1624
|
-
if ($$self.$$.dirty & /*$xLim, $axesWidth*/ 1572864) {
|
|
1625
|
-
// reactive variables for coordinates of axis lines
|
|
1626
|
-
$$invalidate(5, x = axes.scaleX($xLim, $xLim, $axesWidth));
|
|
1627
|
-
}
|
|
1628
|
-
|
|
1629
|
-
if ($$self.$$.dirty & /*$yLim, $axesHeight*/ 12582912) {
|
|
1630
|
-
$$invalidate(2, y = axes.scaleY($yLim, $yLim, $axesHeight));
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
|
-
if ($$self.$$.dirty & /*$scale*/ 2097152) {
|
|
1634
|
-
// reactive variables for ticks and their coordinates
|
|
1635
|
-
$$invalidate(1, dy = $scale === "small" ? 7 : 10);
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
if ($$self.$$.dirty & /*$scale*/ 2097152) {
|
|
1639
|
-
$$invalidate(18, tickNum = axes.TICK_NUM[$scale]);
|
|
1640
|
-
}
|
|
1641
|
-
|
|
1642
|
-
if ($$self.$$.dirty & /*$xLim, tickNum, ticks*/ 1343488) {
|
|
1643
|
-
$$invalidate(15, ticks = tickMode === "auto"
|
|
1644
|
-
? axes.getAxisTicks(undefined, $xLim, tickNum, true)
|
|
1645
|
-
: ticks);
|
|
1646
|
-
}
|
|
1647
|
-
|
|
1648
|
-
if ($$self.$$.dirty & /*ticks, tickLabels*/ 32769) {
|
|
1649
|
-
$$invalidate(0, tickLabels = tickMode === "auto" ? ticks : tickLabels);
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
|
-
if ($$self.$$.dirty & /*ticks, $xLim, $axesWidth*/ 1605632) {
|
|
1653
|
-
$$invalidate(4, ticksX = axes.scaleX(ticks, $xLim, $axesWidth));
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
if ($$self.$$.dirty & /*y, dy*/ 6) {
|
|
1657
|
-
$$invalidate(3, ticksY = y === undefined ? undefined : [y[0], y[0] + dy]);
|
|
1658
|
-
}
|
|
1659
|
-
};
|
|
1660
|
-
|
|
1661
|
-
return [
|
|
1662
|
-
tickLabels,
|
|
1663
|
-
dy,
|
|
1664
|
-
y,
|
|
1665
|
-
ticksY,
|
|
1666
|
-
ticksX,
|
|
1667
|
-
x,
|
|
1668
|
-
$isOk,
|
|
1669
|
-
axisLineStyleStr,
|
|
1670
|
-
gridLineStyleStr,
|
|
1671
|
-
xLim,
|
|
1672
|
-
yLim,
|
|
1673
|
-
axesWidth,
|
|
1674
|
-
axesHeight,
|
|
1675
|
-
scale,
|
|
1676
|
-
isOk,
|
|
1677
|
-
ticks,
|
|
1678
|
-
slot,
|
|
1679
|
-
showGrid,
|
|
1680
|
-
tickNum,
|
|
1681
|
-
$axesWidth,
|
|
1682
|
-
$xLim,
|
|
1683
|
-
$scale,
|
|
1684
|
-
$axesHeight,
|
|
1685
|
-
$yLim
|
|
1686
|
-
];
|
|
1687
|
-
}
|
|
1688
|
-
|
|
1689
|
-
class XAxis extends SvelteComponent {
|
|
1690
|
-
constructor(options) {
|
|
1691
|
-
super();
|
|
1692
|
-
|
|
1693
|
-
init(this, options, instance$a, create_fragment$a, safe_not_equal, {
|
|
1694
|
-
slot: 16,
|
|
1695
|
-
ticks: 15,
|
|
1696
|
-
tickLabels: 0,
|
|
1697
|
-
showGrid: 17
|
|
1698
|
-
});
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
|
|
1702
|
-
/* src/YAxis.svelte generated by Svelte v3.50.1 */
|
|
1703
|
-
|
|
1704
|
-
function get_each_context$4(ctx, list, i) {
|
|
1705
|
-
const child_ctx = ctx.slice();
|
|
1706
|
-
child_ctx[26] = list[i];
|
|
1707
|
-
child_ctx[28] = i;
|
|
1708
|
-
return child_ctx;
|
|
1709
|
-
}
|
|
1710
|
-
|
|
1711
|
-
// (60:0) {#if x !== undefined && y !== undefined }
|
|
1712
|
-
function create_if_block$7(ctx) {
|
|
1713
|
-
let g;
|
|
1714
|
-
let line;
|
|
1715
|
-
let line_x__value;
|
|
1716
|
-
let line_x__value_1;
|
|
1717
|
-
let line_y__value;
|
|
1718
|
-
let line_y__value_1;
|
|
1719
|
-
let each_value = /*ticksY*/ ctx[4];
|
|
1720
|
-
let each_blocks = [];
|
|
1721
|
-
|
|
1722
|
-
for (let i = 0; i < each_value.length; i += 1) {
|
|
1723
|
-
each_blocks[i] = create_each_block$4(get_each_context$4(ctx, each_value, i));
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1726
|
-
return {
|
|
1727
|
-
c() {
|
|
1728
|
-
g = svg_element("g");
|
|
1729
|
-
|
|
1730
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
1731
|
-
each_blocks[i].c();
|
|
1732
|
-
}
|
|
1733
|
-
|
|
1734
|
-
line = svg_element("line");
|
|
1735
|
-
attr(line, "x1", line_x__value = /*x*/ ctx[1][0]);
|
|
1736
|
-
attr(line, "x2", line_x__value_1 = /*x*/ ctx[1][0]);
|
|
1737
|
-
attr(line, "y1", line_y__value = /*y*/ ctx[5][0]);
|
|
1738
|
-
attr(line, "y2", line_y__value_1 = /*y*/ ctx[5][1]);
|
|
1739
|
-
attr(line, "style", /*axisLineStyleStr*/ ctx[7]);
|
|
1740
|
-
attr(g, "class", "mdaplot__axis mdaplot__yaxis");
|
|
1741
|
-
},
|
|
1742
|
-
m(target, anchor) {
|
|
1743
|
-
insert(target, g, anchor);
|
|
1744
|
-
|
|
1745
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
1746
|
-
each_blocks[i].m(g, null);
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
|
-
append(g, line);
|
|
1750
|
-
},
|
|
1751
|
-
p(ctx, dirty) {
|
|
1752
|
-
if (dirty & /*ticksX, ticksY, dx, transform, tickLabels, axisLineStyleStr, x, gridLineStyleStr*/ 479) {
|
|
1753
|
-
each_value = /*ticksY*/ ctx[4];
|
|
1754
|
-
let i;
|
|
1755
|
-
|
|
1756
|
-
for (i = 0; i < each_value.length; i += 1) {
|
|
1757
|
-
const child_ctx = get_each_context$4(ctx, each_value, i);
|
|
1758
|
-
|
|
1759
|
-
if (each_blocks[i]) {
|
|
1760
|
-
each_blocks[i].p(child_ctx, dirty);
|
|
1761
|
-
} else {
|
|
1762
|
-
each_blocks[i] = create_each_block$4(child_ctx);
|
|
1763
|
-
each_blocks[i].c();
|
|
1764
|
-
each_blocks[i].m(g, line);
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
for (; i < each_blocks.length; i += 1) {
|
|
1769
|
-
each_blocks[i].d(1);
|
|
1770
|
-
}
|
|
1771
|
-
|
|
1772
|
-
each_blocks.length = each_value.length;
|
|
1773
|
-
}
|
|
1774
|
-
|
|
1775
|
-
if (dirty & /*x*/ 2 && line_x__value !== (line_x__value = /*x*/ ctx[1][0])) {
|
|
1776
|
-
attr(line, "x1", line_x__value);
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1779
|
-
if (dirty & /*x*/ 2 && line_x__value_1 !== (line_x__value_1 = /*x*/ ctx[1][0])) {
|
|
1780
|
-
attr(line, "x2", line_x__value_1);
|
|
1781
|
-
}
|
|
1782
|
-
|
|
1783
|
-
if (dirty & /*y*/ 32 && line_y__value !== (line_y__value = /*y*/ ctx[5][0])) {
|
|
1784
|
-
attr(line, "y1", line_y__value);
|
|
1785
|
-
}
|
|
1786
|
-
|
|
1787
|
-
if (dirty & /*y*/ 32 && line_y__value_1 !== (line_y__value_1 = /*y*/ ctx[5][1])) {
|
|
1788
|
-
attr(line, "y2", line_y__value_1);
|
|
1789
|
-
}
|
|
1790
|
-
},
|
|
1791
|
-
d(detaching) {
|
|
1792
|
-
if (detaching) detach(g);
|
|
1793
|
-
destroy_each(each_blocks, detaching);
|
|
1794
|
-
}
|
|
1795
|
-
};
|
|
1796
|
-
}
|
|
1797
|
-
|
|
1798
|
-
// (62:3) {#each ticksY as ty, i}
|
|
1799
|
-
function create_each_block$4(ctx) {
|
|
1800
|
-
let line0;
|
|
1801
|
-
let line0_x__value;
|
|
1802
|
-
let line0_x__value_1;
|
|
1803
|
-
let line0_y__value;
|
|
1804
|
-
let line0_y__value_1;
|
|
1805
|
-
let line1;
|
|
1806
|
-
let line1_x__value;
|
|
1807
|
-
let line1_x__value_1;
|
|
1808
|
-
let line1_y__value;
|
|
1809
|
-
let line1_y__value_1;
|
|
1810
|
-
let text_1;
|
|
1811
|
-
let t_value = /*tickLabels*/ ctx[0][/*i*/ ctx[28]] + "";
|
|
1812
|
-
let t;
|
|
1813
|
-
let text_1_x_value;
|
|
1814
|
-
let text_1_y_value;
|
|
1815
|
-
|
|
1816
|
-
return {
|
|
1817
|
-
c() {
|
|
1818
|
-
line0 = svg_element("line");
|
|
1819
|
-
line1 = svg_element("line");
|
|
1820
|
-
text_1 = svg_element("text");
|
|
1821
|
-
t = text(t_value);
|
|
1822
|
-
attr(line0, "x1", line0_x__value = /*x*/ ctx[1][0]);
|
|
1823
|
-
attr(line0, "x2", line0_x__value_1 = /*x*/ ctx[1][1]);
|
|
1824
|
-
attr(line0, "y1", line0_y__value = /*ty*/ ctx[26]);
|
|
1825
|
-
attr(line0, "y2", line0_y__value_1 = /*ty*/ ctx[26]);
|
|
1826
|
-
attr(line0, "style", /*gridLineStyleStr*/ ctx[8]);
|
|
1827
|
-
attr(line1, "x1", line1_x__value = /*ticksX*/ ctx[3][0]);
|
|
1828
|
-
attr(line1, "x2", line1_x__value_1 = /*ticksX*/ ctx[3][1]);
|
|
1829
|
-
attr(line1, "y1", line1_y__value = /*ty*/ ctx[26]);
|
|
1830
|
-
attr(line1, "y2", line1_y__value_1 = /*ty*/ ctx[26]);
|
|
1831
|
-
attr(line1, "style", /*axisLineStyleStr*/ ctx[7]);
|
|
1832
|
-
attr(text_1, "x", text_1_x_value = /*ticksX*/ ctx[3][0]);
|
|
1833
|
-
attr(text_1, "y", text_1_y_value = /*ty*/ ctx[26]);
|
|
1834
|
-
attr(text_1, "dx", /*dx*/ ctx[2]);
|
|
1835
|
-
attr(text_1, "dy", 0);
|
|
1836
|
-
attr(text_1, "transform", /*transform*/ ctx[6]);
|
|
1837
|
-
set_style(text_1, "background", "red");
|
|
1838
|
-
attr(text_1, "class", "mdaplot__axis-labels");
|
|
1839
|
-
attr(text_1, "dominant-baseline", "middle");
|
|
1840
|
-
attr(text_1, "text-anchor", "end");
|
|
1841
|
-
},
|
|
1842
|
-
m(target, anchor) {
|
|
1843
|
-
insert(target, line0, anchor);
|
|
1844
|
-
insert(target, line1, anchor);
|
|
1845
|
-
insert(target, text_1, anchor);
|
|
1846
|
-
append(text_1, t);
|
|
1847
|
-
},
|
|
1848
|
-
p(ctx, dirty) {
|
|
1849
|
-
if (dirty & /*x*/ 2 && line0_x__value !== (line0_x__value = /*x*/ ctx[1][0])) {
|
|
1850
|
-
attr(line0, "x1", line0_x__value);
|
|
1851
|
-
}
|
|
1852
|
-
|
|
1853
|
-
if (dirty & /*x*/ 2 && line0_x__value_1 !== (line0_x__value_1 = /*x*/ ctx[1][1])) {
|
|
1854
|
-
attr(line0, "x2", line0_x__value_1);
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
if (dirty & /*ticksY*/ 16 && line0_y__value !== (line0_y__value = /*ty*/ ctx[26])) {
|
|
1858
|
-
attr(line0, "y1", line0_y__value);
|
|
1859
|
-
}
|
|
1860
|
-
|
|
1861
|
-
if (dirty & /*ticksY*/ 16 && line0_y__value_1 !== (line0_y__value_1 = /*ty*/ ctx[26])) {
|
|
1862
|
-
attr(line0, "y2", line0_y__value_1);
|
|
1863
|
-
}
|
|
1864
|
-
|
|
1865
|
-
if (dirty & /*ticksX*/ 8 && line1_x__value !== (line1_x__value = /*ticksX*/ ctx[3][0])) {
|
|
1866
|
-
attr(line1, "x1", line1_x__value);
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
if (dirty & /*ticksX*/ 8 && line1_x__value_1 !== (line1_x__value_1 = /*ticksX*/ ctx[3][1])) {
|
|
1870
|
-
attr(line1, "x2", line1_x__value_1);
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
if (dirty & /*ticksY*/ 16 && line1_y__value !== (line1_y__value = /*ty*/ ctx[26])) {
|
|
1874
|
-
attr(line1, "y1", line1_y__value);
|
|
1875
|
-
}
|
|
1876
|
-
|
|
1877
|
-
if (dirty & /*ticksY*/ 16 && line1_y__value_1 !== (line1_y__value_1 = /*ty*/ ctx[26])) {
|
|
1878
|
-
attr(line1, "y2", line1_y__value_1);
|
|
1879
|
-
}
|
|
1880
|
-
|
|
1881
|
-
if (dirty & /*tickLabels*/ 1 && t_value !== (t_value = /*tickLabels*/ ctx[0][/*i*/ ctx[28]] + "")) set_data(t, t_value);
|
|
1882
|
-
|
|
1883
|
-
if (dirty & /*ticksX*/ 8 && text_1_x_value !== (text_1_x_value = /*ticksX*/ ctx[3][0])) {
|
|
1884
|
-
attr(text_1, "x", text_1_x_value);
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
if (dirty & /*ticksY*/ 16 && text_1_y_value !== (text_1_y_value = /*ty*/ ctx[26])) {
|
|
1888
|
-
attr(text_1, "y", text_1_y_value);
|
|
1889
|
-
}
|
|
1890
|
-
|
|
1891
|
-
if (dirty & /*dx*/ 4) {
|
|
1892
|
-
attr(text_1, "dx", /*dx*/ ctx[2]);
|
|
1893
|
-
}
|
|
1894
|
-
},
|
|
1895
|
-
d(detaching) {
|
|
1896
|
-
if (detaching) detach(line0);
|
|
1897
|
-
if (detaching) detach(line1);
|
|
1898
|
-
if (detaching) detach(text_1);
|
|
1899
|
-
}
|
|
1900
|
-
};
|
|
1901
|
-
}
|
|
1902
|
-
|
|
1903
|
-
function create_fragment$9(ctx) {
|
|
1904
|
-
let if_block_anchor;
|
|
1905
|
-
let if_block = /*x*/ ctx[1] !== undefined && /*y*/ ctx[5] !== undefined && create_if_block$7(ctx);
|
|
1906
|
-
|
|
1907
|
-
return {
|
|
1908
|
-
c() {
|
|
1909
|
-
if (if_block) if_block.c();
|
|
1910
|
-
if_block_anchor = empty();
|
|
1911
|
-
},
|
|
1912
|
-
m(target, anchor) {
|
|
1913
|
-
if (if_block) if_block.m(target, anchor);
|
|
1914
|
-
insert(target, if_block_anchor, anchor);
|
|
1915
|
-
},
|
|
1916
|
-
p(ctx, [dirty]) {
|
|
1917
|
-
if (/*x*/ ctx[1] !== undefined && /*y*/ ctx[5] !== undefined) {
|
|
1918
|
-
if (if_block) {
|
|
1919
|
-
if_block.p(ctx, dirty);
|
|
1920
|
-
} else {
|
|
1921
|
-
if_block = create_if_block$7(ctx);
|
|
1922
|
-
if_block.c();
|
|
1923
|
-
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
1924
|
-
}
|
|
1925
|
-
} else if (if_block) {
|
|
1926
|
-
if_block.d(1);
|
|
1927
|
-
if_block = null;
|
|
1928
|
-
}
|
|
1929
|
-
},
|
|
1930
|
-
i: noop,
|
|
1931
|
-
o: noop,
|
|
1932
|
-
d(detaching) {
|
|
1933
|
-
if (if_block) if_block.d(detaching);
|
|
1934
|
-
if (detaching) detach(if_block_anchor);
|
|
1935
|
-
}
|
|
1936
|
-
};
|
|
1937
|
-
}
|
|
1938
|
-
|
|
1939
|
-
function instance$9($$self, $$props, $$invalidate) {
|
|
1940
|
-
let x;
|
|
1941
|
-
let y;
|
|
1942
|
-
let dx;
|
|
1943
|
-
let tickNum;
|
|
1944
|
-
let ticksY;
|
|
1945
|
-
let ticksX;
|
|
1946
|
-
let $axesHeight;
|
|
1947
|
-
let $yLim;
|
|
1948
|
-
let $scale;
|
|
1949
|
-
let $axesWidth;
|
|
1950
|
-
let $xLim;
|
|
1951
|
-
let { slot = "yaxis" } = $$props;
|
|
1952
|
-
let { ticks = undefined } = $$props;
|
|
1953
|
-
let { tickLabels = ticks } = $$props;
|
|
1954
|
-
let { showGrid = false } = $$props;
|
|
1955
|
-
let { las = 1 } = $$props;
|
|
1956
|
-
|
|
1957
|
-
// set up tick mode
|
|
1958
|
-
const tickMode = ticks === undefined ? "auto" : "manual";
|
|
1959
|
-
|
|
1960
|
-
// TODO: set up tick text translation
|
|
1961
|
-
const transform = las > 1 ? "" : "";
|
|
1962
|
-
|
|
1963
|
-
/* sanity checks of input parameters */
|
|
1964
|
-
if (slot !== "yaxis") {
|
|
1965
|
-
throw "Component YAxis must have \"slot='yaxis'\" attribute.";
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
|
-
if (ticks !== undefined && !Array.isArray(ticks)) {
|
|
1969
|
-
throw "YAxis: 'ticks' must be a vector of numbers.";
|
|
1970
|
-
}
|
|
1971
|
-
|
|
1972
|
-
if (ticks !== undefined && !(Array.isArray(tickLabels) && tickLabels.length == ticks.length)) {
|
|
1973
|
-
throw "YAxis: 'tickLabels' must be a vector of the same size as ticks.";
|
|
1974
|
-
}
|
|
1975
|
-
|
|
1976
|
-
/* styles for axis and grid lines */
|
|
1977
|
-
const axisLineStyleStr = `stroke:${Colors.DARKGRAY};line-width:1px;`;
|
|
1978
|
-
|
|
1979
|
-
const gridLineStyleStr = `stroke:${Colors.MIDDLEGRAY};stroke-opacity:${showGrid ? 1 : 0};stroke-dasharray:2px;`;
|
|
1980
|
-
|
|
1981
|
-
// get axes context and adjust x margins
|
|
1982
|
-
const axes = getContext('axes');
|
|
1983
|
-
|
|
1984
|
-
axes.addYAxisMargins();
|
|
1985
|
-
|
|
1986
|
-
// get reactive variables needed to compute coordinates
|
|
1987
|
-
const xLim = axes.xLim;
|
|
1988
|
-
|
|
1989
|
-
component_subscribe($$self, xLim, value => $$invalidate(23, $xLim = value));
|
|
1990
|
-
const yLim = axes.yLim;
|
|
1991
|
-
component_subscribe($$self, yLim, value => $$invalidate(20, $yLim = value));
|
|
1992
|
-
const axesWidth = axes.width;
|
|
1993
|
-
component_subscribe($$self, axesWidth, value => $$invalidate(22, $axesWidth = value));
|
|
1994
|
-
const axesHeight = axes.height;
|
|
1995
|
-
component_subscribe($$self, axesHeight, value => $$invalidate(19, $axesHeight = value));
|
|
1996
|
-
const scale = axes.scale;
|
|
1997
|
-
component_subscribe($$self, scale, value => $$invalidate(21, $scale = value));
|
|
1998
|
-
|
|
1999
|
-
$$self.$$set = $$props => {
|
|
2000
|
-
if ('slot' in $$props) $$invalidate(15, slot = $$props.slot);
|
|
2001
|
-
if ('ticks' in $$props) $$invalidate(14, ticks = $$props.ticks);
|
|
2002
|
-
if ('tickLabels' in $$props) $$invalidate(0, tickLabels = $$props.tickLabels);
|
|
2003
|
-
if ('showGrid' in $$props) $$invalidate(16, showGrid = $$props.showGrid);
|
|
2004
|
-
if ('las' in $$props) $$invalidate(17, las = $$props.las);
|
|
2005
|
-
};
|
|
2006
|
-
|
|
2007
|
-
$$self.$$.update = () => {
|
|
2008
|
-
if ($$self.$$.dirty & /*$xLim, $axesWidth*/ 12582912) {
|
|
2009
|
-
// reactive variables for coordinates of axis lines
|
|
2010
|
-
$$invalidate(1, x = axes.scaleX($xLim, $xLim, $axesWidth));
|
|
2011
|
-
}
|
|
2012
|
-
|
|
2013
|
-
if ($$self.$$.dirty & /*$yLim, $axesHeight*/ 1572864) {
|
|
2014
|
-
$$invalidate(5, y = axes.scaleY($yLim, $yLim, $axesHeight));
|
|
2015
|
-
}
|
|
2016
|
-
|
|
2017
|
-
if ($$self.$$.dirty & /*$scale*/ 2097152) {
|
|
2018
|
-
// reactive variables for ticks and their coordinates
|
|
2019
|
-
$$invalidate(2, dx = $scale === "small" ? -4 : -6);
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
if ($$self.$$.dirty & /*$scale*/ 2097152) {
|
|
2023
|
-
$$invalidate(18, tickNum = axes.TICK_NUM[$scale]);
|
|
2024
|
-
}
|
|
2025
|
-
|
|
2026
|
-
if ($$self.$$.dirty & /*$yLim, tickNum, ticks*/ 1327104) {
|
|
2027
|
-
$$invalidate(14, ticks = tickMode === "auto"
|
|
2028
|
-
? axes.getAxisTicks(undefined, $yLim, tickNum, true)
|
|
2029
|
-
: ticks);
|
|
2030
|
-
}
|
|
2031
|
-
|
|
2032
|
-
if ($$self.$$.dirty & /*ticks, tickLabels*/ 16385) {
|
|
2033
|
-
$$invalidate(0, tickLabels = tickMode === "auto" ? ticks : tickLabels);
|
|
2034
|
-
}
|
|
2035
|
-
|
|
2036
|
-
if ($$self.$$.dirty & /*ticks, $yLim, $axesHeight*/ 1589248) {
|
|
2037
|
-
$$invalidate(4, ticksY = axes.scaleY(ticks, $yLim, $axesHeight));
|
|
2038
|
-
}
|
|
2039
|
-
|
|
2040
|
-
if ($$self.$$.dirty & /*x, dx*/ 6) {
|
|
2041
|
-
$$invalidate(3, ticksX = x === undefined ? undefined : [x[0] + dx, x[0]]);
|
|
2042
|
-
}
|
|
2043
|
-
};
|
|
2044
|
-
|
|
2045
|
-
return [
|
|
2046
|
-
tickLabels,
|
|
2047
|
-
x,
|
|
2048
|
-
dx,
|
|
2049
|
-
ticksX,
|
|
2050
|
-
ticksY,
|
|
2051
|
-
y,
|
|
2052
|
-
transform,
|
|
2053
|
-
axisLineStyleStr,
|
|
2054
|
-
gridLineStyleStr,
|
|
2055
|
-
xLim,
|
|
2056
|
-
yLim,
|
|
2057
|
-
axesWidth,
|
|
2058
|
-
axesHeight,
|
|
2059
|
-
scale,
|
|
2060
|
-
ticks,
|
|
2061
|
-
slot,
|
|
2062
|
-
showGrid,
|
|
2063
|
-
las,
|
|
2064
|
-
tickNum,
|
|
2065
|
-
$axesHeight,
|
|
2066
|
-
$yLim,
|
|
2067
|
-
$scale,
|
|
2068
|
-
$axesWidth,
|
|
2069
|
-
$xLim
|
|
2070
|
-
];
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
|
-
class YAxis extends SvelteComponent {
|
|
2074
|
-
constructor(options) {
|
|
2075
|
-
super();
|
|
2076
|
-
|
|
2077
|
-
init(this, options, instance$9, create_fragment$9, safe_not_equal, {
|
|
2078
|
-
slot: 15,
|
|
2079
|
-
ticks: 14,
|
|
2080
|
-
tickLabels: 0,
|
|
2081
|
-
showGrid: 16,
|
|
2082
|
-
las: 17
|
|
2083
|
-
});
|
|
2084
|
-
}
|
|
2085
|
-
}
|
|
2086
|
-
|
|
2087
|
-
/* src/Rectangles.svelte generated by Svelte v3.50.1 */
|
|
2088
|
-
|
|
2089
|
-
function get_each_context$3(ctx, list, i) {
|
|
2090
|
-
const child_ctx = ctx.slice();
|
|
2091
|
-
child_ctx[25] = list[i];
|
|
2092
|
-
child_ctx[27] = i;
|
|
2093
|
-
return child_ctx;
|
|
2094
|
-
}
|
|
2095
|
-
|
|
2096
|
-
// (55:0) {#if rx !== undefined && ry !== undefined}
|
|
2097
|
-
function create_if_block$6(ctx) {
|
|
2098
|
-
let g;
|
|
2099
|
-
let g_class_value;
|
|
2100
|
-
let each_value = /*left*/ ctx[0];
|
|
2101
|
-
let each_blocks = [];
|
|
2102
|
-
|
|
2103
|
-
for (let i = 0; i < each_value.length; i += 1) {
|
|
2104
|
-
each_blocks[i] = create_each_block$3(get_each_context$3(ctx, each_value, i));
|
|
2105
|
-
}
|
|
2106
|
-
|
|
2107
|
-
return {
|
|
2108
|
-
c() {
|
|
2109
|
-
g = svg_element("g");
|
|
2110
|
-
|
|
2111
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2112
|
-
each_blocks[i].c();
|
|
2113
|
-
}
|
|
2114
|
-
|
|
2115
|
-
attr(g, "class", g_class_value = "series " + /*style*/ ctx[2]);
|
|
2116
|
-
attr(g, "title", /*title*/ ctx[1]);
|
|
2117
|
-
attr(g, "style", /*barsStyleStr*/ ctx[3]);
|
|
2118
|
-
},
|
|
2119
|
-
m(target, anchor) {
|
|
2120
|
-
insert(target, g, anchor);
|
|
2121
|
-
|
|
2122
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2123
|
-
each_blocks[i].m(g, null);
|
|
2124
|
-
}
|
|
2125
|
-
},
|
|
2126
|
-
p(ctx, dirty) {
|
|
2127
|
-
if (dirty & /*rx, ry, rw, rh, left*/ 241) {
|
|
2128
|
-
each_value = /*left*/ ctx[0];
|
|
2129
|
-
let i;
|
|
2130
|
-
|
|
2131
|
-
for (i = 0; i < each_value.length; i += 1) {
|
|
2132
|
-
const child_ctx = get_each_context$3(ctx, each_value, i);
|
|
2133
|
-
|
|
2134
|
-
if (each_blocks[i]) {
|
|
2135
|
-
each_blocks[i].p(child_ctx, dirty);
|
|
2136
|
-
} else {
|
|
2137
|
-
each_blocks[i] = create_each_block$3(child_ctx);
|
|
2138
|
-
each_blocks[i].c();
|
|
2139
|
-
each_blocks[i].m(g, null);
|
|
2140
|
-
}
|
|
2141
|
-
}
|
|
2142
|
-
|
|
2143
|
-
for (; i < each_blocks.length; i += 1) {
|
|
2144
|
-
each_blocks[i].d(1);
|
|
2145
|
-
}
|
|
2146
|
-
|
|
2147
|
-
each_blocks.length = each_value.length;
|
|
2148
|
-
}
|
|
2149
|
-
|
|
2150
|
-
if (dirty & /*style*/ 4 && g_class_value !== (g_class_value = "series " + /*style*/ ctx[2])) {
|
|
2151
|
-
attr(g, "class", g_class_value);
|
|
2152
|
-
}
|
|
2153
|
-
|
|
2154
|
-
if (dirty & /*title*/ 2) {
|
|
2155
|
-
attr(g, "title", /*title*/ ctx[1]);
|
|
2156
|
-
}
|
|
2157
|
-
|
|
2158
|
-
if (dirty & /*barsStyleStr*/ 8) {
|
|
2159
|
-
attr(g, "style", /*barsStyleStr*/ ctx[3]);
|
|
2160
|
-
}
|
|
2161
|
-
},
|
|
2162
|
-
d(detaching) {
|
|
2163
|
-
if (detaching) detach(g);
|
|
2164
|
-
destroy_each(each_blocks, detaching);
|
|
2165
|
-
}
|
|
2166
|
-
};
|
|
2167
|
-
}
|
|
2168
|
-
|
|
2169
|
-
// (57:3) {#each left as v, i}
|
|
2170
|
-
function create_each_block$3(ctx) {
|
|
2171
|
-
let rect;
|
|
2172
|
-
let rect_x_value;
|
|
2173
|
-
let rect_y_value;
|
|
2174
|
-
let rect_width_value;
|
|
2175
|
-
let rect_height_value;
|
|
2176
|
-
|
|
2177
|
-
return {
|
|
2178
|
-
c() {
|
|
2179
|
-
rect = svg_element("rect");
|
|
2180
|
-
attr(rect, "x", rect_x_value = /*rx*/ ctx[7][/*i*/ ctx[27]]);
|
|
2181
|
-
attr(rect, "y", rect_y_value = /*ry*/ ctx[6][/*i*/ ctx[27]]);
|
|
2182
|
-
attr(rect, "width", rect_width_value = /*rw*/ ctx[5][/*i*/ ctx[27]]);
|
|
2183
|
-
attr(rect, "height", rect_height_value = /*rh*/ ctx[4][/*i*/ ctx[27]]);
|
|
2184
|
-
},
|
|
2185
|
-
m(target, anchor) {
|
|
2186
|
-
insert(target, rect, anchor);
|
|
2187
|
-
},
|
|
2188
|
-
p(ctx, dirty) {
|
|
2189
|
-
if (dirty & /*rx*/ 128 && rect_x_value !== (rect_x_value = /*rx*/ ctx[7][/*i*/ ctx[27]])) {
|
|
2190
|
-
attr(rect, "x", rect_x_value);
|
|
2191
|
-
}
|
|
2192
|
-
|
|
2193
|
-
if (dirty & /*ry*/ 64 && rect_y_value !== (rect_y_value = /*ry*/ ctx[6][/*i*/ ctx[27]])) {
|
|
2194
|
-
attr(rect, "y", rect_y_value);
|
|
2195
|
-
}
|
|
2196
|
-
|
|
2197
|
-
if (dirty & /*rw*/ 32 && rect_width_value !== (rect_width_value = /*rw*/ ctx[5][/*i*/ ctx[27]])) {
|
|
2198
|
-
attr(rect, "width", rect_width_value);
|
|
2199
|
-
}
|
|
2200
|
-
|
|
2201
|
-
if (dirty & /*rh*/ 16 && rect_height_value !== (rect_height_value = /*rh*/ ctx[4][/*i*/ ctx[27]])) {
|
|
2202
|
-
attr(rect, "height", rect_height_value);
|
|
2203
|
-
}
|
|
2204
|
-
},
|
|
2205
|
-
d(detaching) {
|
|
2206
|
-
if (detaching) detach(rect);
|
|
2207
|
-
}
|
|
2208
|
-
};
|
|
2209
|
-
}
|
|
2210
|
-
|
|
2211
|
-
function create_fragment$8(ctx) {
|
|
2212
|
-
let if_block_anchor;
|
|
2213
|
-
let if_block = /*rx*/ ctx[7] !== undefined && /*ry*/ ctx[6] !== undefined && create_if_block$6(ctx);
|
|
2214
|
-
|
|
2215
|
-
return {
|
|
2216
|
-
c() {
|
|
2217
|
-
if (if_block) if_block.c();
|
|
2218
|
-
if_block_anchor = empty();
|
|
2219
|
-
},
|
|
2220
|
-
m(target, anchor) {
|
|
2221
|
-
if (if_block) if_block.m(target, anchor);
|
|
2222
|
-
insert(target, if_block_anchor, anchor);
|
|
2223
|
-
},
|
|
2224
|
-
p(ctx, [dirty]) {
|
|
2225
|
-
if (/*rx*/ ctx[7] !== undefined && /*ry*/ ctx[6] !== undefined) {
|
|
2226
|
-
if (if_block) {
|
|
2227
|
-
if_block.p(ctx, dirty);
|
|
2228
|
-
} else {
|
|
2229
|
-
if_block = create_if_block$6(ctx);
|
|
2230
|
-
if_block.c();
|
|
2231
|
-
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
2232
|
-
}
|
|
2233
|
-
} else if (if_block) {
|
|
2234
|
-
if_block.d(1);
|
|
2235
|
-
if_block = null;
|
|
2236
|
-
}
|
|
2237
|
-
},
|
|
2238
|
-
i: noop,
|
|
2239
|
-
o: noop,
|
|
2240
|
-
d(detaching) {
|
|
2241
|
-
if (if_block) if_block.d(detaching);
|
|
2242
|
-
if (detaching) detach(if_block_anchor);
|
|
2243
|
-
}
|
|
2244
|
-
};
|
|
2245
|
-
}
|
|
2246
|
-
|
|
2247
|
-
function instance$8($$self, $$props, $$invalidate) {
|
|
2248
|
-
let rx;
|
|
2249
|
-
let ry;
|
|
2250
|
-
let rw;
|
|
2251
|
-
let rh;
|
|
2252
|
-
let barsStyleStr;
|
|
2253
|
-
let $axesHeight;
|
|
2254
|
-
let $yLim;
|
|
2255
|
-
let $axesWidth;
|
|
2256
|
-
let $xLim;
|
|
2257
|
-
let { left } = $$props;
|
|
2258
|
-
let { top } = $$props;
|
|
2259
|
-
let { width } = $$props;
|
|
2260
|
-
let { height } = $$props;
|
|
2261
|
-
let { labels = undefined } = $$props;
|
|
2262
|
-
let { faceColor = Colors.PRIMARY } = $$props;
|
|
2263
|
-
let { borderColor = faceColor } = $$props;
|
|
2264
|
-
let { lineWidth = 1 } = $$props;
|
|
2265
|
-
let { title = "" } = $$props;
|
|
2266
|
-
let { style = "series_rect" } = $$props;
|
|
2267
|
-
|
|
2268
|
-
// multiply width and height values if needed
|
|
2269
|
-
if (!Array.isArray(left) || !Array.isArray(top) || left.length < 1 || left.length != top.length) {
|
|
2270
|
-
throw "Rectangles: parameters 'left' and 'top' must be vectors of the same size.";
|
|
2271
|
-
}
|
|
2272
|
-
|
|
2273
|
-
// we make this reactive in case if left and right has been changed but not width
|
|
2274
|
-
const n = left.length;
|
|
2275
|
-
|
|
2276
|
-
if (!Array.isArray(height)) height = Array(n).fill(height);
|
|
2277
|
-
if (!Array.isArray(width)) width = Array(n).fill(width);
|
|
2278
|
-
|
|
2279
|
-
/* sanity check for input parameters */
|
|
2280
|
-
if (top.length !== n || width.length !== n || height.length !== n) {
|
|
2281
|
-
throw "Rectangles: x, y, w and h should have the same length (w and h can be single values).";
|
|
2282
|
-
}
|
|
2283
|
-
|
|
2284
|
-
if (labels !== undefined && (!Array.isArray(labels) || labels.length !== n)) {
|
|
2285
|
-
throw "Rectangles: vector with labels should have the same length as vectors with x and y coordinates.";
|
|
2286
|
-
}
|
|
2287
|
-
|
|
2288
|
-
// get axes context and reactive variables needed to compute coordinates
|
|
2289
|
-
const axes = getContext('axes');
|
|
2290
|
-
|
|
2291
|
-
const xLim = axes.xLim;
|
|
2292
|
-
component_subscribe($$self, xLim, value => $$invalidate(22, $xLim = value));
|
|
2293
|
-
const yLim = axes.yLim;
|
|
2294
|
-
component_subscribe($$self, yLim, value => $$invalidate(20, $yLim = value));
|
|
2295
|
-
const axesWidth = axes.width;
|
|
2296
|
-
component_subscribe($$self, axesWidth, value => $$invalidate(21, $axesWidth = value));
|
|
2297
|
-
const axesHeight = axes.height;
|
|
2298
|
-
component_subscribe($$self, axesHeight, value => $$invalidate(19, $axesHeight = value));
|
|
2299
|
-
|
|
2300
|
-
$$self.$$set = $$props => {
|
|
2301
|
-
if ('left' in $$props) $$invalidate(0, left = $$props.left);
|
|
2302
|
-
if ('top' in $$props) $$invalidate(14, top = $$props.top);
|
|
2303
|
-
if ('width' in $$props) $$invalidate(12, width = $$props.width);
|
|
2304
|
-
if ('height' in $$props) $$invalidate(13, height = $$props.height);
|
|
2305
|
-
if ('labels' in $$props) $$invalidate(15, labels = $$props.labels);
|
|
2306
|
-
if ('faceColor' in $$props) $$invalidate(16, faceColor = $$props.faceColor);
|
|
2307
|
-
if ('borderColor' in $$props) $$invalidate(17, borderColor = $$props.borderColor);
|
|
2308
|
-
if ('lineWidth' in $$props) $$invalidate(18, lineWidth = $$props.lineWidth);
|
|
2309
|
-
if ('title' in $$props) $$invalidate(1, title = $$props.title);
|
|
2310
|
-
if ('style' in $$props) $$invalidate(2, style = $$props.style);
|
|
2311
|
-
};
|
|
2312
|
-
|
|
2313
|
-
$$self.$$.update = () => {
|
|
2314
|
-
if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 6291457) {
|
|
2315
|
-
// reactive variables for coordinates of data points in pixels
|
|
2316
|
-
$$invalidate(7, rx = axes.scaleX(left, $xLim, $axesWidth));
|
|
2317
|
-
}
|
|
2318
|
-
|
|
2319
|
-
if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 1589248) {
|
|
2320
|
-
$$invalidate(6, ry = axes.scaleY(top, $yLim, $axesHeight));
|
|
2321
|
-
}
|
|
2322
|
-
|
|
2323
|
-
if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/ 6295552) {
|
|
2324
|
-
$$invalidate(5, rw = axes.scaleX(width, $xLim, $axesWidth, true));
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
|
-
if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/ 1581056) {
|
|
2328
|
-
$$invalidate(4, rh = axes.scaleY(height, $yLim, $axesHeight, true));
|
|
2329
|
-
}
|
|
2330
|
-
|
|
2331
|
-
if ($$self.$$.dirty & /*faceColor, borderColor, lineWidth*/ 458752) {
|
|
2332
|
-
// styles for bars and labels
|
|
2333
|
-
$$invalidate(3, barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`);
|
|
2334
|
-
}
|
|
2335
|
-
};
|
|
2336
|
-
|
|
2337
|
-
return [
|
|
2338
|
-
left,
|
|
2339
|
-
title,
|
|
2340
|
-
style,
|
|
2341
|
-
barsStyleStr,
|
|
2342
|
-
rh,
|
|
2343
|
-
rw,
|
|
2344
|
-
ry,
|
|
2345
|
-
rx,
|
|
2346
|
-
xLim,
|
|
2347
|
-
yLim,
|
|
2348
|
-
axesWidth,
|
|
2349
|
-
axesHeight,
|
|
2350
|
-
width,
|
|
2351
|
-
height,
|
|
2352
|
-
top,
|
|
2353
|
-
labels,
|
|
2354
|
-
faceColor,
|
|
2355
|
-
borderColor,
|
|
2356
|
-
lineWidth,
|
|
2357
|
-
$axesHeight,
|
|
2358
|
-
$yLim,
|
|
2359
|
-
$axesWidth,
|
|
2360
|
-
$xLim
|
|
2361
|
-
];
|
|
2362
|
-
}
|
|
2363
|
-
|
|
2364
|
-
class Rectangles extends SvelteComponent {
|
|
2365
|
-
constructor(options) {
|
|
2366
|
-
super();
|
|
2367
|
-
|
|
2368
|
-
init(this, options, instance$8, create_fragment$8, safe_not_equal, {
|
|
2369
|
-
left: 0,
|
|
2370
|
-
top: 14,
|
|
2371
|
-
width: 12,
|
|
2372
|
-
height: 13,
|
|
2373
|
-
labels: 15,
|
|
2374
|
-
faceColor: 16,
|
|
2375
|
-
borderColor: 17,
|
|
2376
|
-
lineWidth: 18,
|
|
2377
|
-
title: 1,
|
|
2378
|
-
style: 2
|
|
2379
|
-
});
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
|
|
2383
|
-
/* src/Box.svelte generated by Svelte v3.50.1 */
|
|
2384
|
-
|
|
2385
|
-
function create_if_block$5(ctx) {
|
|
2386
|
-
let g;
|
|
2387
|
-
let rectangles;
|
|
2388
|
-
let current;
|
|
2389
|
-
|
|
2390
|
-
rectangles = new Rectangles({
|
|
2391
|
-
props: {
|
|
2392
|
-
left: /*left*/ ctx[3],
|
|
2393
|
-
top: /*top*/ ctx[2],
|
|
2394
|
-
width: /*width*/ ctx[1],
|
|
2395
|
-
height: /*height*/ ctx[0],
|
|
2396
|
-
borderColor: Colors.DARKGRAY,
|
|
2397
|
-
faceColor: "transparent"
|
|
2398
|
-
}
|
|
2399
|
-
});
|
|
2400
|
-
|
|
2401
|
-
return {
|
|
2402
|
-
c() {
|
|
2403
|
-
g = svg_element("g");
|
|
2404
|
-
create_component(rectangles.$$.fragment);
|
|
2405
|
-
set_style(g, "pointer-events", "none");
|
|
2406
|
-
attr(g, "class", "mdaplot__axes-box");
|
|
2407
|
-
},
|
|
2408
|
-
m(target, anchor) {
|
|
2409
|
-
insert(target, g, anchor);
|
|
2410
|
-
mount_component(rectangles, g, null);
|
|
2411
|
-
current = true;
|
|
2412
|
-
},
|
|
2413
|
-
p(ctx, dirty) {
|
|
2414
|
-
const rectangles_changes = {};
|
|
2415
|
-
if (dirty & /*left*/ 8) rectangles_changes.left = /*left*/ ctx[3];
|
|
2416
|
-
if (dirty & /*top*/ 4) rectangles_changes.top = /*top*/ ctx[2];
|
|
2417
|
-
if (dirty & /*width*/ 2) rectangles_changes.width = /*width*/ ctx[1];
|
|
2418
|
-
if (dirty & /*height*/ 1) rectangles_changes.height = /*height*/ ctx[0];
|
|
2419
|
-
rectangles.$set(rectangles_changes);
|
|
2420
|
-
},
|
|
2421
|
-
i(local) {
|
|
2422
|
-
if (current) return;
|
|
2423
|
-
transition_in(rectangles.$$.fragment, local);
|
|
2424
|
-
current = true;
|
|
2425
|
-
},
|
|
2426
|
-
o(local) {
|
|
2427
|
-
transition_out(rectangles.$$.fragment, local);
|
|
2428
|
-
current = false;
|
|
2429
|
-
},
|
|
2430
|
-
d(detaching) {
|
|
2431
|
-
if (detaching) detach(g);
|
|
2432
|
-
destroy_component(rectangles);
|
|
2433
|
-
}
|
|
2434
|
-
};
|
|
2435
|
-
}
|
|
2436
|
-
|
|
2437
|
-
function create_fragment$7(ctx) {
|
|
2438
|
-
let if_block_anchor;
|
|
2439
|
-
let current;
|
|
2440
|
-
let if_block = /*$isOk*/ ctx[4] && create_if_block$5(ctx);
|
|
2441
|
-
|
|
2442
|
-
return {
|
|
2443
|
-
c() {
|
|
2444
|
-
if (if_block) if_block.c();
|
|
2445
|
-
if_block_anchor = empty();
|
|
2446
|
-
},
|
|
2447
|
-
m(target, anchor) {
|
|
2448
|
-
if (if_block) if_block.m(target, anchor);
|
|
2449
|
-
insert(target, if_block_anchor, anchor);
|
|
2450
|
-
current = true;
|
|
2451
|
-
},
|
|
2452
|
-
p(ctx, [dirty]) {
|
|
2453
|
-
if (/*$isOk*/ ctx[4]) {
|
|
2454
|
-
if (if_block) {
|
|
2455
|
-
if_block.p(ctx, dirty);
|
|
2456
|
-
|
|
2457
|
-
if (dirty & /*$isOk*/ 16) {
|
|
2458
|
-
transition_in(if_block, 1);
|
|
2459
|
-
}
|
|
2460
|
-
} else {
|
|
2461
|
-
if_block = create_if_block$5(ctx);
|
|
2462
|
-
if_block.c();
|
|
2463
|
-
transition_in(if_block, 1);
|
|
2464
|
-
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
2465
|
-
}
|
|
2466
|
-
} else if (if_block) {
|
|
2467
|
-
group_outros();
|
|
2468
|
-
|
|
2469
|
-
transition_out(if_block, 1, 1, () => {
|
|
2470
|
-
if_block = null;
|
|
2471
|
-
});
|
|
2472
|
-
|
|
2473
|
-
check_outros();
|
|
2474
|
-
}
|
|
2475
|
-
},
|
|
2476
|
-
i(local) {
|
|
2477
|
-
if (current) return;
|
|
2478
|
-
transition_in(if_block);
|
|
2479
|
-
current = true;
|
|
2480
|
-
},
|
|
2481
|
-
o(local) {
|
|
2482
|
-
transition_out(if_block);
|
|
2483
|
-
current = false;
|
|
2484
|
-
},
|
|
2485
|
-
d(detaching) {
|
|
2486
|
-
if (if_block) if_block.d(detaching);
|
|
2487
|
-
if (detaching) detach(if_block_anchor);
|
|
2488
|
-
}
|
|
2489
|
-
};
|
|
2490
|
-
}
|
|
2491
|
-
|
|
2492
|
-
function instance$7($$self, $$props, $$invalidate) {
|
|
2493
|
-
let left;
|
|
2494
|
-
let top;
|
|
2495
|
-
let width;
|
|
2496
|
-
let height;
|
|
2497
|
-
let $yLim;
|
|
2498
|
-
let $xLim;
|
|
2499
|
-
let $isOk;
|
|
2500
|
-
let { slot } = $$props;
|
|
2501
|
-
|
|
2502
|
-
// check that the box is located in a correct slot
|
|
2503
|
-
if (slot !== "box") {
|
|
2504
|
-
throw "Component Box must have \"slot='box'\" attribute.";
|
|
2505
|
-
}
|
|
2506
|
-
|
|
2507
|
-
// get axes context and reactive variables needed to compute coordinates
|
|
2508
|
-
const axes = getContext('axes');
|
|
2509
|
-
|
|
2510
|
-
const xLim = axes.xLim;
|
|
2511
|
-
component_subscribe($$self, xLim, value => $$invalidate(10, $xLim = value));
|
|
2512
|
-
const yLim = axes.yLim;
|
|
2513
|
-
component_subscribe($$self, yLim, value => $$invalidate(9, $yLim = value));
|
|
2514
|
-
const isOk = axes.isOk;
|
|
2515
|
-
component_subscribe($$self, isOk, value => $$invalidate(4, $isOk = value));
|
|
2516
|
-
|
|
2517
|
-
$$self.$$set = $$props => {
|
|
2518
|
-
if ('slot' in $$props) $$invalidate(8, slot = $$props.slot);
|
|
2519
|
-
};
|
|
2520
|
-
|
|
2521
|
-
$$self.$$.update = () => {
|
|
2522
|
-
if ($$self.$$.dirty & /*$xLim*/ 1024) {
|
|
2523
|
-
// reactive variables for coordinates of box points in pixels
|
|
2524
|
-
$$invalidate(3, left = [$xLim[0]]);
|
|
2525
|
-
}
|
|
2526
|
-
|
|
2527
|
-
if ($$self.$$.dirty & /*$yLim*/ 512) {
|
|
2528
|
-
$$invalidate(2, top = [$yLim[1]]);
|
|
2529
|
-
}
|
|
2530
|
-
|
|
2531
|
-
if ($$self.$$.dirty & /*$xLim*/ 1024) {
|
|
2532
|
-
$$invalidate(1, width = [$xLim[1] - $xLim[0]]);
|
|
2533
|
-
}
|
|
2534
|
-
|
|
2535
|
-
if ($$self.$$.dirty & /*$yLim*/ 512) {
|
|
2536
|
-
$$invalidate(0, height = [$yLim[1] - $yLim[0]]);
|
|
2537
|
-
}
|
|
2538
|
-
};
|
|
2539
|
-
|
|
2540
|
-
return [height, width, top, left, $isOk, xLim, yLim, isOk, slot, $yLim, $xLim];
|
|
2541
|
-
}
|
|
2542
|
-
|
|
2543
|
-
class Box extends SvelteComponent {
|
|
2544
|
-
constructor(options) {
|
|
2545
|
-
super();
|
|
2546
|
-
init(this, options, instance$7, create_fragment$7, safe_not_equal, { slot: 8 });
|
|
2547
|
-
}
|
|
2548
|
-
}
|
|
2549
|
-
|
|
2550
|
-
/* src/Segments.svelte generated by Svelte v3.50.1 */
|
|
2551
|
-
|
|
2552
|
-
function get_each_context$2(ctx, list, i) {
|
|
2553
|
-
const child_ctx = ctx.slice();
|
|
2554
|
-
child_ctx[24] = list[i];
|
|
2555
|
-
child_ctx[26] = i;
|
|
2556
|
-
return child_ctx;
|
|
2557
|
-
}
|
|
2558
|
-
|
|
2559
|
-
// (41:0) {#if x1 !== undefined && y1 !== undefined}
|
|
2560
|
-
function create_if_block$4(ctx) {
|
|
2561
|
-
let each_1_anchor;
|
|
2562
|
-
let each_value = /*x1*/ ctx[4];
|
|
2563
|
-
let each_blocks = [];
|
|
2564
|
-
|
|
2565
|
-
for (let i = 0; i < each_value.length; i += 1) {
|
|
2566
|
-
each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i));
|
|
2567
|
-
}
|
|
2568
|
-
|
|
2569
|
-
return {
|
|
2570
|
-
c() {
|
|
2571
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2572
|
-
each_blocks[i].c();
|
|
2573
|
-
}
|
|
2574
|
-
|
|
2575
|
-
each_1_anchor = empty();
|
|
2576
|
-
},
|
|
2577
|
-
m(target, anchor) {
|
|
2578
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2579
|
-
each_blocks[i].m(target, anchor);
|
|
2580
|
-
}
|
|
2581
|
-
|
|
2582
|
-
insert(target, each_1_anchor, anchor);
|
|
2583
|
-
},
|
|
2584
|
-
p(ctx, dirty) {
|
|
2585
|
-
if (dirty & /*x1, x2, y1, y2, lineStyleStr*/ 31) {
|
|
2586
|
-
each_value = /*x1*/ ctx[4];
|
|
2587
|
-
let i;
|
|
2588
|
-
|
|
2589
|
-
for (i = 0; i < each_value.length; i += 1) {
|
|
2590
|
-
const child_ctx = get_each_context$2(ctx, each_value, i);
|
|
2591
|
-
|
|
2592
|
-
if (each_blocks[i]) {
|
|
2593
|
-
each_blocks[i].p(child_ctx, dirty);
|
|
2594
|
-
} else {
|
|
2595
|
-
each_blocks[i] = create_each_block$2(child_ctx);
|
|
2596
|
-
each_blocks[i].c();
|
|
2597
|
-
each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
|
|
2598
|
-
}
|
|
2599
|
-
}
|
|
2600
|
-
|
|
2601
|
-
for (; i < each_blocks.length; i += 1) {
|
|
2602
|
-
each_blocks[i].d(1);
|
|
2603
|
-
}
|
|
2604
|
-
|
|
2605
|
-
each_blocks.length = each_value.length;
|
|
2606
|
-
}
|
|
2607
|
-
},
|
|
2608
|
-
d(detaching) {
|
|
2609
|
-
destroy_each(each_blocks, detaching);
|
|
2610
|
-
if (detaching) detach(each_1_anchor);
|
|
2611
|
-
}
|
|
2612
|
-
};
|
|
2613
|
-
}
|
|
2614
|
-
|
|
2615
|
-
// (42:3) {#each x1 as v, i}
|
|
2616
|
-
function create_each_block$2(ctx) {
|
|
2617
|
-
let line;
|
|
2618
|
-
let line_x__value;
|
|
2619
|
-
let line_x__value_1;
|
|
2620
|
-
let line_y__value;
|
|
2621
|
-
let line_y__value_1;
|
|
2622
|
-
|
|
2623
|
-
return {
|
|
2624
|
-
c() {
|
|
2625
|
-
line = svg_element("line");
|
|
2626
|
-
attr(line, "x1", line_x__value = /*x1*/ ctx[4][/*i*/ ctx[26]]);
|
|
2627
|
-
attr(line, "x2", line_x__value_1 = /*x2*/ ctx[3][/*i*/ ctx[26]]);
|
|
2628
|
-
attr(line, "y1", line_y__value = /*y1*/ ctx[2][/*i*/ ctx[26]]);
|
|
2629
|
-
attr(line, "y2", line_y__value_1 = /*y2*/ ctx[1][/*i*/ ctx[26]]);
|
|
2630
|
-
attr(line, "style", /*lineStyleStr*/ ctx[0]);
|
|
2631
|
-
},
|
|
2632
|
-
m(target, anchor) {
|
|
2633
|
-
insert(target, line, anchor);
|
|
2634
|
-
},
|
|
2635
|
-
p(ctx, dirty) {
|
|
2636
|
-
if (dirty & /*x1*/ 16 && line_x__value !== (line_x__value = /*x1*/ ctx[4][/*i*/ ctx[26]])) {
|
|
2637
|
-
attr(line, "x1", line_x__value);
|
|
2638
|
-
}
|
|
2639
|
-
|
|
2640
|
-
if (dirty & /*x2*/ 8 && line_x__value_1 !== (line_x__value_1 = /*x2*/ ctx[3][/*i*/ ctx[26]])) {
|
|
2641
|
-
attr(line, "x2", line_x__value_1);
|
|
2642
|
-
}
|
|
2643
|
-
|
|
2644
|
-
if (dirty & /*y1*/ 4 && line_y__value !== (line_y__value = /*y1*/ ctx[2][/*i*/ ctx[26]])) {
|
|
2645
|
-
attr(line, "y1", line_y__value);
|
|
2646
|
-
}
|
|
2647
|
-
|
|
2648
|
-
if (dirty & /*y2*/ 2 && line_y__value_1 !== (line_y__value_1 = /*y2*/ ctx[1][/*i*/ ctx[26]])) {
|
|
2649
|
-
attr(line, "y2", line_y__value_1);
|
|
2650
|
-
}
|
|
2651
|
-
|
|
2652
|
-
if (dirty & /*lineStyleStr*/ 1) {
|
|
2653
|
-
attr(line, "style", /*lineStyleStr*/ ctx[0]);
|
|
2654
|
-
}
|
|
2655
|
-
},
|
|
2656
|
-
d(detaching) {
|
|
2657
|
-
if (detaching) detach(line);
|
|
2658
|
-
}
|
|
2659
|
-
};
|
|
2660
|
-
}
|
|
2661
|
-
|
|
2662
|
-
function create_fragment$6(ctx) {
|
|
2663
|
-
let if_block_anchor;
|
|
2664
|
-
let if_block = /*x1*/ ctx[4] !== undefined && /*y1*/ ctx[2] !== undefined && create_if_block$4(ctx);
|
|
2665
|
-
|
|
2666
|
-
return {
|
|
2667
|
-
c() {
|
|
2668
|
-
if (if_block) if_block.c();
|
|
2669
|
-
if_block_anchor = empty();
|
|
2670
|
-
},
|
|
2671
|
-
m(target, anchor) {
|
|
2672
|
-
if (if_block) if_block.m(target, anchor);
|
|
2673
|
-
insert(target, if_block_anchor, anchor);
|
|
2674
|
-
},
|
|
2675
|
-
p(ctx, [dirty]) {
|
|
2676
|
-
if (/*x1*/ ctx[4] !== undefined && /*y1*/ ctx[2] !== undefined) {
|
|
2677
|
-
if (if_block) {
|
|
2678
|
-
if_block.p(ctx, dirty);
|
|
2679
|
-
} else {
|
|
2680
|
-
if_block = create_if_block$4(ctx);
|
|
2681
|
-
if_block.c();
|
|
2682
|
-
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
2683
|
-
}
|
|
2684
|
-
} else if (if_block) {
|
|
2685
|
-
if_block.d(1);
|
|
2686
|
-
if_block = null;
|
|
2687
|
-
}
|
|
2688
|
-
},
|
|
2689
|
-
i: noop,
|
|
2690
|
-
o: noop,
|
|
2691
|
-
d(detaching) {
|
|
2692
|
-
if (if_block) if_block.d(detaching);
|
|
2693
|
-
if (detaching) detach(if_block_anchor);
|
|
2694
|
-
}
|
|
2695
|
-
};
|
|
2696
|
-
}
|
|
2697
|
-
|
|
2698
|
-
function instance$6($$self, $$props, $$invalidate) {
|
|
2699
|
-
let x1;
|
|
2700
|
-
let x2;
|
|
2701
|
-
let y1;
|
|
2702
|
-
let y2;
|
|
2703
|
-
let lineStyleStr;
|
|
2704
|
-
let $scale;
|
|
2705
|
-
let $axesHeight;
|
|
2706
|
-
let $yLim;
|
|
2707
|
-
let $axesWidth;
|
|
2708
|
-
let $xLim;
|
|
2709
|
-
let { xStart } = $$props;
|
|
2710
|
-
let { xEnd } = $$props;
|
|
2711
|
-
let { yStart } = $$props;
|
|
2712
|
-
let { yEnd } = $$props;
|
|
2713
|
-
let { lineColor = Colors.PRIMARY } = $$props;
|
|
2714
|
-
let { lineType = 1 } = $$props;
|
|
2715
|
-
let { lineWidth = 1 } = $$props;
|
|
2716
|
-
|
|
2717
|
-
/* sanity check for input parameters */
|
|
2718
|
-
if (!Array.isArray(xStart) || !Array.isArray(xEnd) || !Array.isArray(yStart) || !Array.isArray(yEnd)) {
|
|
2719
|
-
throw "Segments: parameters 'xStart', 'yStart', 'xEnd' and 'yEnd' must be vectors.";
|
|
2720
|
-
}
|
|
2721
|
-
|
|
2722
|
-
const n = xStart.length;
|
|
2723
|
-
|
|
2724
|
-
if (xEnd.length !== n || yStart.length !== n || yEnd.length !== n) {
|
|
2725
|
-
throw "Segments: parameters 'xStart', 'yStart', 'xEnd' and 'yEnd' should have the same length.";
|
|
2726
|
-
}
|
|
2727
|
-
|
|
2728
|
-
// get axes context and reactive variables needed to compute coordinates
|
|
2729
|
-
const axes = getContext('axes');
|
|
2730
|
-
|
|
2731
|
-
const xLim = axes.xLim;
|
|
2732
|
-
component_subscribe($$self, xLim, value => $$invalidate(21, $xLim = value));
|
|
2733
|
-
const yLim = axes.yLim;
|
|
2734
|
-
component_subscribe($$self, yLim, value => $$invalidate(19, $yLim = value));
|
|
2735
|
-
const axesWidth = axes.width;
|
|
2736
|
-
component_subscribe($$self, axesWidth, value => $$invalidate(20, $axesWidth = value));
|
|
2737
|
-
const axesHeight = axes.height;
|
|
2738
|
-
component_subscribe($$self, axesHeight, value => $$invalidate(18, $axesHeight = value));
|
|
2739
|
-
const scale = axes.scale;
|
|
2740
|
-
component_subscribe($$self, scale, value => $$invalidate(17, $scale = value));
|
|
2741
|
-
|
|
2742
|
-
$$self.$$set = $$props => {
|
|
2743
|
-
if ('xStart' in $$props) $$invalidate(10, xStart = $$props.xStart);
|
|
2744
|
-
if ('xEnd' in $$props) $$invalidate(11, xEnd = $$props.xEnd);
|
|
2745
|
-
if ('yStart' in $$props) $$invalidate(12, yStart = $$props.yStart);
|
|
2746
|
-
if ('yEnd' in $$props) $$invalidate(13, yEnd = $$props.yEnd);
|
|
2747
|
-
if ('lineColor' in $$props) $$invalidate(14, lineColor = $$props.lineColor);
|
|
2748
|
-
if ('lineType' in $$props) $$invalidate(15, lineType = $$props.lineType);
|
|
2749
|
-
if ('lineWidth' in $$props) $$invalidate(16, lineWidth = $$props.lineWidth);
|
|
2750
|
-
};
|
|
2751
|
-
|
|
2752
|
-
$$self.$$.update = () => {
|
|
2753
|
-
if ($$self.$$.dirty & /*xStart, $xLim, $axesWidth*/ 3146752) {
|
|
2754
|
-
// reactive variables for coordinates of data points in pixels (and line style)
|
|
2755
|
-
$$invalidate(4, x1 = axes.scaleX(xStart, $xLim, $axesWidth));
|
|
2756
|
-
}
|
|
2757
|
-
|
|
2758
|
-
if ($$self.$$.dirty & /*xEnd, $xLim, $axesWidth*/ 3147776) {
|
|
2759
|
-
$$invalidate(3, x2 = axes.scaleX(xEnd, $xLim, $axesWidth));
|
|
2760
|
-
}
|
|
2761
|
-
|
|
2762
|
-
if ($$self.$$.dirty & /*yStart, $yLim, $axesHeight*/ 790528) {
|
|
2763
|
-
$$invalidate(2, y1 = axes.scaleY(yStart, $yLim, $axesHeight));
|
|
2764
|
-
}
|
|
2765
|
-
|
|
2766
|
-
if ($$self.$$.dirty & /*yEnd, $yLim, $axesHeight*/ 794624) {
|
|
2767
|
-
$$invalidate(1, y2 = axes.scaleY(yEnd, $yLim, $axesHeight));
|
|
2768
|
-
}
|
|
2769
|
-
|
|
2770
|
-
if ($$self.$$.dirty & /*lineColor, lineWidth, $scale, lineType*/ 245760) {
|
|
2771
|
-
$$invalidate(0, lineStyleStr = `stroke:${lineColor};stroke-width: ${lineWidth}px;stroke-dasharray:${axes.LINE_STYLES[$scale][lineType - 1]}`);
|
|
2772
|
-
}
|
|
2773
|
-
};
|
|
2774
|
-
|
|
2775
|
-
return [
|
|
2776
|
-
lineStyleStr,
|
|
2777
|
-
y2,
|
|
2778
|
-
y1,
|
|
2779
|
-
x2,
|
|
2780
|
-
x1,
|
|
2781
|
-
xLim,
|
|
2782
|
-
yLim,
|
|
2783
|
-
axesWidth,
|
|
2784
|
-
axesHeight,
|
|
2785
|
-
scale,
|
|
2786
|
-
xStart,
|
|
2787
|
-
xEnd,
|
|
2788
|
-
yStart,
|
|
2789
|
-
yEnd,
|
|
2790
|
-
lineColor,
|
|
2791
|
-
lineType,
|
|
2792
|
-
lineWidth,
|
|
2793
|
-
$scale,
|
|
2794
|
-
$axesHeight,
|
|
2795
|
-
$yLim,
|
|
2796
|
-
$axesWidth,
|
|
2797
|
-
$xLim
|
|
2798
|
-
];
|
|
2799
|
-
}
|
|
2800
|
-
|
|
2801
|
-
class Segments extends SvelteComponent {
|
|
2802
|
-
constructor(options) {
|
|
2803
|
-
super();
|
|
2804
|
-
|
|
2805
|
-
init(this, options, instance$6, create_fragment$6, safe_not_equal, {
|
|
2806
|
-
xStart: 10,
|
|
2807
|
-
xEnd: 11,
|
|
2808
|
-
yStart: 12,
|
|
2809
|
-
yEnd: 13,
|
|
2810
|
-
lineColor: 14,
|
|
2811
|
-
lineType: 15,
|
|
2812
|
-
lineWidth: 16
|
|
2813
|
-
});
|
|
2814
|
-
}
|
|
2815
|
-
}
|
|
2816
|
-
|
|
2817
|
-
/* src/TextLabels.svelte generated by Svelte v3.50.1 */
|
|
2818
|
-
|
|
2819
|
-
function add_css$2(target) {
|
|
2820
|
-
append_styles(target, "svelte-1xvrp9d", "text.svelte-1xvrp9d,text.svelte-1xvrp9d>tspan{dominant-baseline:middle}");
|
|
2821
|
-
}
|
|
2822
|
-
|
|
2823
|
-
function get_each_context$1(ctx, list, i) {
|
|
2824
|
-
const child_ctx = ctx.slice();
|
|
2825
|
-
child_ctx[27] = list[i];
|
|
2826
|
-
child_ctx[29] = i;
|
|
2827
|
-
return child_ctx;
|
|
2828
|
-
}
|
|
2829
|
-
|
|
2830
|
-
// (66:0) {#if x !== undefined && y !== undefined}
|
|
2831
|
-
function create_if_block$3(ctx) {
|
|
2832
|
-
let g;
|
|
2833
|
-
let g_class_value;
|
|
2834
|
-
let each_value = /*x*/ ctx[7];
|
|
2835
|
-
let each_blocks = [];
|
|
2836
|
-
|
|
2837
|
-
for (let i = 0; i < each_value.length; i += 1) {
|
|
2838
|
-
each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i));
|
|
2839
|
-
}
|
|
2840
|
-
|
|
2841
|
-
return {
|
|
2842
|
-
c() {
|
|
2843
|
-
g = svg_element("g");
|
|
2844
|
-
|
|
2845
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2846
|
-
each_blocks[i].c();
|
|
2847
|
-
}
|
|
2848
|
-
|
|
2849
|
-
attr(g, "class", g_class_value = "series " + /*style*/ ctx[1]);
|
|
2850
|
-
attr(g, "title", /*title*/ ctx[2]);
|
|
2851
|
-
attr(g, "style", /*textStyleStr*/ ctx[3]);
|
|
2852
|
-
},
|
|
2853
|
-
m(target, anchor) {
|
|
2854
|
-
insert(target, g, anchor);
|
|
2855
|
-
|
|
2856
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2857
|
-
each_blocks[i].m(g, null);
|
|
2858
|
-
}
|
|
2859
|
-
},
|
|
2860
|
-
p(ctx, dirty) {
|
|
2861
|
-
if (dirty & /*x, y, dx, dy, labels*/ 241) {
|
|
2862
|
-
each_value = /*x*/ ctx[7];
|
|
2863
|
-
let i;
|
|
2864
|
-
|
|
2865
|
-
for (i = 0; i < each_value.length; i += 1) {
|
|
2866
|
-
const child_ctx = get_each_context$1(ctx, each_value, i);
|
|
2867
|
-
|
|
2868
|
-
if (each_blocks[i]) {
|
|
2869
|
-
each_blocks[i].p(child_ctx, dirty);
|
|
2870
|
-
} else {
|
|
2871
|
-
each_blocks[i] = create_each_block$1(child_ctx);
|
|
2872
|
-
each_blocks[i].c();
|
|
2873
|
-
each_blocks[i].m(g, null);
|
|
2874
|
-
}
|
|
2875
|
-
}
|
|
2876
|
-
|
|
2877
|
-
for (; i < each_blocks.length; i += 1) {
|
|
2878
|
-
each_blocks[i].d(1);
|
|
2879
|
-
}
|
|
2880
|
-
|
|
2881
|
-
each_blocks.length = each_value.length;
|
|
2882
|
-
}
|
|
2883
|
-
|
|
2884
|
-
if (dirty & /*style*/ 2 && g_class_value !== (g_class_value = "series " + /*style*/ ctx[1])) {
|
|
2885
|
-
attr(g, "class", g_class_value);
|
|
2886
|
-
}
|
|
2887
|
-
|
|
2888
|
-
if (dirty & /*title*/ 4) {
|
|
2889
|
-
attr(g, "title", /*title*/ ctx[2]);
|
|
2890
|
-
}
|
|
2891
|
-
|
|
2892
|
-
if (dirty & /*textStyleStr*/ 8) {
|
|
2893
|
-
attr(g, "style", /*textStyleStr*/ ctx[3]);
|
|
2894
|
-
}
|
|
2895
|
-
},
|
|
2896
|
-
d(detaching) {
|
|
2897
|
-
if (detaching) detach(g);
|
|
2898
|
-
destroy_each(each_blocks, detaching);
|
|
2899
|
-
}
|
|
2900
|
-
};
|
|
2901
|
-
}
|
|
2902
|
-
|
|
2903
|
-
// (68:3) {#each x as v, i}
|
|
2904
|
-
function create_each_block$1(ctx) {
|
|
2905
|
-
let text_1;
|
|
2906
|
-
let raw_value = /*labels*/ ctx[0][/*i*/ ctx[29]] + "";
|
|
2907
|
-
let text_1_x_value;
|
|
2908
|
-
let text_1_y_value;
|
|
2909
|
-
|
|
2910
|
-
return {
|
|
2911
|
-
c() {
|
|
2912
|
-
text_1 = svg_element("text");
|
|
2913
|
-
attr(text_1, "data-id", /*i*/ ctx[29]);
|
|
2914
|
-
attr(text_1, "x", text_1_x_value = /*x*/ ctx[7][/*i*/ ctx[29]]);
|
|
2915
|
-
attr(text_1, "y", text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]]);
|
|
2916
|
-
attr(text_1, "dx", /*dx*/ ctx[5]);
|
|
2917
|
-
attr(text_1, "dy", /*dy*/ ctx[4]);
|
|
2918
|
-
attr(text_1, "class", "svelte-1xvrp9d");
|
|
2919
|
-
},
|
|
2920
|
-
m(target, anchor) {
|
|
2921
|
-
insert(target, text_1, anchor);
|
|
2922
|
-
text_1.innerHTML = raw_value;
|
|
2923
|
-
},
|
|
2924
|
-
p(ctx, dirty) {
|
|
2925
|
-
if (dirty & /*labels*/ 1 && raw_value !== (raw_value = /*labels*/ ctx[0][/*i*/ ctx[29]] + "")) text_1.innerHTML = raw_value;
|
|
2926
|
-
if (dirty & /*x*/ 128 && text_1_x_value !== (text_1_x_value = /*x*/ ctx[7][/*i*/ ctx[29]])) {
|
|
2927
|
-
attr(text_1, "x", text_1_x_value);
|
|
2928
|
-
}
|
|
2929
|
-
|
|
2930
|
-
if (dirty & /*y*/ 64 && text_1_y_value !== (text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]])) {
|
|
2931
|
-
attr(text_1, "y", text_1_y_value);
|
|
2932
|
-
}
|
|
2933
|
-
|
|
2934
|
-
if (dirty & /*dx*/ 32) {
|
|
2935
|
-
attr(text_1, "dx", /*dx*/ ctx[5]);
|
|
2936
|
-
}
|
|
2937
|
-
|
|
2938
|
-
if (dirty & /*dy*/ 16) {
|
|
2939
|
-
attr(text_1, "dy", /*dy*/ ctx[4]);
|
|
2940
|
-
}
|
|
2941
|
-
},
|
|
2942
|
-
d(detaching) {
|
|
2943
|
-
if (detaching) detach(text_1);
|
|
2944
|
-
}
|
|
2945
|
-
};
|
|
2946
|
-
}
|
|
2947
|
-
|
|
2948
|
-
function create_fragment$5(ctx) {
|
|
2949
|
-
let if_block_anchor;
|
|
2950
|
-
let if_block = /*x*/ ctx[7] !== undefined && /*y*/ ctx[6] !== undefined && create_if_block$3(ctx);
|
|
2951
|
-
|
|
2952
|
-
return {
|
|
2953
|
-
c() {
|
|
2954
|
-
if (if_block) if_block.c();
|
|
2955
|
-
if_block_anchor = empty();
|
|
2956
|
-
},
|
|
2957
|
-
m(target, anchor) {
|
|
2958
|
-
if (if_block) if_block.m(target, anchor);
|
|
2959
|
-
insert(target, if_block_anchor, anchor);
|
|
2960
|
-
},
|
|
2961
|
-
p(ctx, [dirty]) {
|
|
2962
|
-
if (/*x*/ ctx[7] !== undefined && /*y*/ ctx[6] !== undefined) {
|
|
2963
|
-
if (if_block) {
|
|
2964
|
-
if_block.p(ctx, dirty);
|
|
2965
|
-
} else {
|
|
2966
|
-
if_block = create_if_block$3(ctx);
|
|
2967
|
-
if_block.c();
|
|
2968
|
-
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
2969
|
-
}
|
|
2970
|
-
} else if (if_block) {
|
|
2971
|
-
if_block.d(1);
|
|
2972
|
-
if_block = null;
|
|
2973
|
-
}
|
|
2974
|
-
},
|
|
2975
|
-
i: noop,
|
|
2976
|
-
o: noop,
|
|
2977
|
-
d(detaching) {
|
|
2978
|
-
if (if_block) if_block.d(detaching);
|
|
2979
|
-
if (detaching) detach(if_block_anchor);
|
|
2980
|
-
}
|
|
2981
|
-
};
|
|
2982
|
-
}
|
|
2983
|
-
|
|
2984
|
-
function instance$5($$self, $$props, $$invalidate) {
|
|
2985
|
-
let x;
|
|
2986
|
-
let y;
|
|
2987
|
-
let dx;
|
|
2988
|
-
let dy;
|
|
2989
|
-
let textStyleStr;
|
|
2990
|
-
let $scale;
|
|
2991
|
-
let $axesHeight;
|
|
2992
|
-
let $yLim;
|
|
2993
|
-
let $axesWidth;
|
|
2994
|
-
let $xLim;
|
|
2995
|
-
let { xValues } = $$props;
|
|
2996
|
-
let { yValues } = $$props;
|
|
2997
|
-
let { labels } = $$props;
|
|
2998
|
-
let { pos = 0 } = $$props;
|
|
2999
|
-
let { faceColor = Colors.PRIMARY_TEXT } = $$props;
|
|
3000
|
-
let { borderColor = "transparent" } = $$props;
|
|
3001
|
-
let { borderWidth = 0 } = $$props;
|
|
3002
|
-
let { textSize = 1 } = $$props;
|
|
3003
|
-
let { style = "" } = $$props;
|
|
3004
|
-
let { title = "series_text" } = $$props;
|
|
3005
|
-
|
|
3006
|
-
// text-anchor values depending on position
|
|
3007
|
-
const textAnchors = ["middle", "middle", "start", "middle", "end"];
|
|
3008
|
-
|
|
3009
|
-
// sanity check for input parameters
|
|
3010
|
-
if (!Array.isArray(xValues) || !Array.isArray(yValues) || xValues.length !== yValues.length) {
|
|
3011
|
-
throw "TextLabels: parameters 'xValues' and 'yValues' must be vectors of the same length.";
|
|
3012
|
-
}
|
|
3013
|
-
|
|
3014
|
-
// get axes context and reactive variables needed to compute coordinates
|
|
3015
|
-
const axes = getContext('axes');
|
|
3016
|
-
|
|
3017
|
-
const xLim = axes.xLim;
|
|
3018
|
-
component_subscribe($$self, xLim, value => $$invalidate(24, $xLim = value));
|
|
3019
|
-
const yLim = axes.yLim;
|
|
3020
|
-
component_subscribe($$self, yLim, value => $$invalidate(22, $yLim = value));
|
|
3021
|
-
const axesWidth = axes.width;
|
|
3022
|
-
component_subscribe($$self, axesWidth, value => $$invalidate(23, $axesWidth = value));
|
|
3023
|
-
const axesHeight = axes.height;
|
|
3024
|
-
component_subscribe($$self, axesHeight, value => $$invalidate(21, $axesHeight = value));
|
|
3025
|
-
const scale = axes.scale;
|
|
3026
|
-
component_subscribe($$self, scale, value => $$invalidate(20, $scale = value));
|
|
3027
|
-
|
|
3028
|
-
$$self.$$set = $$props => {
|
|
3029
|
-
if ('xValues' in $$props) $$invalidate(13, xValues = $$props.xValues);
|
|
3030
|
-
if ('yValues' in $$props) $$invalidate(14, yValues = $$props.yValues);
|
|
3031
|
-
if ('labels' in $$props) $$invalidate(0, labels = $$props.labels);
|
|
3032
|
-
if ('pos' in $$props) $$invalidate(15, pos = $$props.pos);
|
|
3033
|
-
if ('faceColor' in $$props) $$invalidate(16, faceColor = $$props.faceColor);
|
|
3034
|
-
if ('borderColor' in $$props) $$invalidate(17, borderColor = $$props.borderColor);
|
|
3035
|
-
if ('borderWidth' in $$props) $$invalidate(18, borderWidth = $$props.borderWidth);
|
|
3036
|
-
if ('textSize' in $$props) $$invalidate(19, textSize = $$props.textSize);
|
|
3037
|
-
if ('style' in $$props) $$invalidate(1, style = $$props.style);
|
|
3038
|
-
if ('title' in $$props) $$invalidate(2, title = $$props.title);
|
|
3039
|
-
};
|
|
3040
|
-
|
|
3041
|
-
$$self.$$.update = () => {
|
|
3042
|
-
if ($$self.$$.dirty & /*xValues, labels*/ 8193) {
|
|
3043
|
-
// multiply label values if needed
|
|
3044
|
-
{
|
|
3045
|
-
const n = xValues.length;
|
|
3046
|
-
if (!Array.isArray(labels)) $$invalidate(0, labels = Array(n).fill(labels));
|
|
3047
|
-
|
|
3048
|
-
// workaround for an issue when xValues and yValues are changed in parent app
|
|
3049
|
-
// but array of labels is still the same as in the
|
|
3050
|
-
if (labels.length != n) $$invalidate(0, labels = Array(n).fill(labels[0]));
|
|
3051
|
-
|
|
3052
|
-
// check that the length of labels vector is correct
|
|
3053
|
-
if (labels.length !== n) {
|
|
3054
|
-
throw "TextLabels: parameter 'labels' must be a single text value or a vector of the same size as 'x' and 'y'.";
|
|
3055
|
-
}
|
|
3056
|
-
}
|
|
3057
|
-
}
|
|
3058
|
-
|
|
3059
|
-
if ($$self.$$.dirty & /*xValues, $xLim, $axesWidth*/ 25174016) {
|
|
3060
|
-
// reactive variables for coordinates of data points in pixels
|
|
3061
|
-
$$invalidate(7, x = axes.scaleX(xValues, $xLim, $axesWidth));
|
|
3062
|
-
}
|
|
3063
|
-
|
|
3064
|
-
if ($$self.$$.dirty & /*yValues, $yLim, $axesHeight*/ 6307840) {
|
|
3065
|
-
$$invalidate(6, y = axes.scaleY(yValues, $yLim, $axesHeight));
|
|
3066
|
-
}
|
|
3067
|
-
|
|
3068
|
-
if ($$self.$$.dirty & /*pos, $scale*/ 1081344) {
|
|
3069
|
-
$$invalidate(5, dx = [0, 0, 1, 0, -1][pos] * axes.LABELS_MARGIN[$scale]);
|
|
3070
|
-
}
|
|
3071
|
-
|
|
3072
|
-
if ($$self.$$.dirty & /*pos, $scale*/ 1081344) {
|
|
3073
|
-
$$invalidate(4, dy = [0, 1, 0, -1, 0][pos] * axes.LABELS_MARGIN[$scale]);
|
|
3074
|
-
}
|
|
3075
|
-
|
|
3076
|
-
if ($$self.$$.dirty & /*faceColor, borderWidth, borderColor, textSize, pos*/ 1015808) {
|
|
3077
|
-
// styles for the elements
|
|
3078
|
-
$$invalidate(3, textStyleStr = `fill:${faceColor};stroke-width:${borderWidth}px;stroke:${borderColor};
|
|
3079
|
-
font-size:${textSize}em; text-anchor:${textAnchors[pos]};`);
|
|
3080
|
-
}
|
|
3081
|
-
};
|
|
3082
|
-
|
|
3083
|
-
return [
|
|
3084
|
-
labels,
|
|
3085
|
-
style,
|
|
3086
|
-
title,
|
|
3087
|
-
textStyleStr,
|
|
3088
|
-
dy,
|
|
3089
|
-
dx,
|
|
3090
|
-
y,
|
|
3091
|
-
x,
|
|
3092
|
-
xLim,
|
|
3093
|
-
yLim,
|
|
3094
|
-
axesWidth,
|
|
3095
|
-
axesHeight,
|
|
3096
|
-
scale,
|
|
3097
|
-
xValues,
|
|
3098
|
-
yValues,
|
|
3099
|
-
pos,
|
|
3100
|
-
faceColor,
|
|
3101
|
-
borderColor,
|
|
3102
|
-
borderWidth,
|
|
3103
|
-
textSize,
|
|
3104
|
-
$scale,
|
|
3105
|
-
$axesHeight,
|
|
3106
|
-
$yLim,
|
|
3107
|
-
$axesWidth,
|
|
3108
|
-
$xLim
|
|
3109
|
-
];
|
|
3110
|
-
}
|
|
3111
|
-
|
|
3112
|
-
class TextLabels extends SvelteComponent {
|
|
3113
|
-
constructor(options) {
|
|
3114
|
-
super();
|
|
3115
|
-
|
|
3116
|
-
init(
|
|
3117
|
-
this,
|
|
3118
|
-
options,
|
|
3119
|
-
instance$5,
|
|
3120
|
-
create_fragment$5,
|
|
3121
|
-
safe_not_equal,
|
|
3122
|
-
{
|
|
3123
|
-
xValues: 13,
|
|
3124
|
-
yValues: 14,
|
|
3125
|
-
labels: 0,
|
|
3126
|
-
pos: 15,
|
|
3127
|
-
faceColor: 16,
|
|
3128
|
-
borderColor: 17,
|
|
3129
|
-
borderWidth: 18,
|
|
3130
|
-
textSize: 19,
|
|
3131
|
-
style: 1,
|
|
3132
|
-
title: 2
|
|
3133
|
-
},
|
|
3134
|
-
add_css$2
|
|
3135
|
-
);
|
|
3136
|
-
}
|
|
3137
|
-
}
|
|
3138
|
-
|
|
3139
|
-
/* src/TextLegend.svelte generated by Svelte v3.50.1 */
|
|
3140
|
-
|
|
3141
|
-
function get_each_context(ctx, list, i) {
|
|
3142
|
-
const child_ctx = ctx.slice();
|
|
3143
|
-
child_ctx[22] = list[i];
|
|
3144
|
-
child_ctx[24] = i;
|
|
3145
|
-
return child_ctx;
|
|
3146
|
-
}
|
|
3147
|
-
|
|
3148
|
-
// (32:0) {#if x !== undefined && y !== undefined && elements.length > 0}
|
|
3149
|
-
function create_if_block$2(ctx) {
|
|
3150
|
-
let text_1;
|
|
3151
|
-
let each_value = /*elements*/ ctx[2];
|
|
3152
|
-
let each_blocks = [];
|
|
3153
|
-
|
|
3154
|
-
for (let i = 0; i < each_value.length; i += 1) {
|
|
3155
|
-
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
|
|
3156
|
-
}
|
|
3157
|
-
|
|
3158
|
-
return {
|
|
3159
|
-
c() {
|
|
3160
|
-
text_1 = svg_element("text");
|
|
3161
|
-
|
|
3162
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
3163
|
-
each_blocks[i].c();
|
|
3164
|
-
}
|
|
3165
|
-
|
|
3166
|
-
attr(text_1, "style", /*textStyleStr*/ ctx[3]);
|
|
3167
|
-
attr(text_1, "x", /*x*/ ctx[5]);
|
|
3168
|
-
attr(text_1, "y", /*y*/ ctx[4]);
|
|
3169
|
-
attr(text_1, "dx", /*dx*/ ctx[0]);
|
|
3170
|
-
attr(text_1, "dy", /*dy*/ ctx[1]);
|
|
3171
|
-
attr(text_1, "dominant-baseline", "middle");
|
|
3172
|
-
attr(text_1, "text-anchor", "start");
|
|
3173
|
-
},
|
|
3174
|
-
m(target, anchor) {
|
|
3175
|
-
insert(target, text_1, anchor);
|
|
3176
|
-
|
|
3177
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
3178
|
-
each_blocks[i].m(text_1, null);
|
|
3179
|
-
}
|
|
3180
|
-
},
|
|
3181
|
-
p(ctx, dirty) {
|
|
3182
|
-
if (dirty & /*x, dx, dy, elements*/ 39) {
|
|
3183
|
-
each_value = /*elements*/ ctx[2];
|
|
3184
|
-
let i;
|
|
3185
|
-
|
|
3186
|
-
for (i = 0; i < each_value.length; i += 1) {
|
|
3187
|
-
const child_ctx = get_each_context(ctx, each_value, i);
|
|
3188
|
-
|
|
3189
|
-
if (each_blocks[i]) {
|
|
3190
|
-
each_blocks[i].p(child_ctx, dirty);
|
|
3191
|
-
} else {
|
|
3192
|
-
each_blocks[i] = create_each_block(child_ctx);
|
|
3193
|
-
each_blocks[i].c();
|
|
3194
|
-
each_blocks[i].m(text_1, null);
|
|
3195
|
-
}
|
|
3196
|
-
}
|
|
3197
|
-
|
|
3198
|
-
for (; i < each_blocks.length; i += 1) {
|
|
3199
|
-
each_blocks[i].d(1);
|
|
3200
|
-
}
|
|
3201
|
-
|
|
3202
|
-
each_blocks.length = each_value.length;
|
|
3203
|
-
}
|
|
3204
|
-
|
|
3205
|
-
if (dirty & /*textStyleStr*/ 8) {
|
|
3206
|
-
attr(text_1, "style", /*textStyleStr*/ ctx[3]);
|
|
3207
|
-
}
|
|
3208
|
-
|
|
3209
|
-
if (dirty & /*x*/ 32) {
|
|
3210
|
-
attr(text_1, "x", /*x*/ ctx[5]);
|
|
3211
|
-
}
|
|
3212
|
-
|
|
3213
|
-
if (dirty & /*y*/ 16) {
|
|
3214
|
-
attr(text_1, "y", /*y*/ ctx[4]);
|
|
3215
|
-
}
|
|
3216
|
-
|
|
3217
|
-
if (dirty & /*dx*/ 1) {
|
|
3218
|
-
attr(text_1, "dx", /*dx*/ ctx[0]);
|
|
3219
|
-
}
|
|
3220
|
-
|
|
3221
|
-
if (dirty & /*dy*/ 2) {
|
|
3222
|
-
attr(text_1, "dy", /*dy*/ ctx[1]);
|
|
3223
|
-
}
|
|
3224
|
-
},
|
|
3225
|
-
d(detaching) {
|
|
3226
|
-
if (detaching) detach(text_1);
|
|
3227
|
-
destroy_each(each_blocks, detaching);
|
|
3228
|
-
}
|
|
3229
|
-
};
|
|
3230
|
-
}
|
|
3231
|
-
|
|
3232
|
-
// (34:6) {#each elements as el, i}
|
|
3233
|
-
function create_each_block(ctx) {
|
|
3234
|
-
let tspan;
|
|
3235
|
-
let raw_value = /*el*/ ctx[22] + "";
|
|
3236
|
-
let tspan_dy_value;
|
|
3237
|
-
|
|
3238
|
-
return {
|
|
3239
|
-
c() {
|
|
3240
|
-
tspan = svg_element("tspan");
|
|
3241
|
-
attr(tspan, "x", /*x*/ ctx[5]);
|
|
3242
|
-
attr(tspan, "dx", /*dx*/ ctx[0]);
|
|
3243
|
-
attr(tspan, "dy", tspan_dy_value = /*i*/ ctx[24] === 0 ? 0 : /*dy*/ ctx[1]);
|
|
3244
|
-
},
|
|
3245
|
-
m(target, anchor) {
|
|
3246
|
-
insert(target, tspan, anchor);
|
|
3247
|
-
tspan.innerHTML = raw_value;
|
|
3248
|
-
},
|
|
3249
|
-
p(ctx, dirty) {
|
|
3250
|
-
if (dirty & /*elements*/ 4 && raw_value !== (raw_value = /*el*/ ctx[22] + "")) tspan.innerHTML = raw_value;
|
|
3251
|
-
if (dirty & /*x*/ 32) {
|
|
3252
|
-
attr(tspan, "x", /*x*/ ctx[5]);
|
|
3253
|
-
}
|
|
3254
|
-
|
|
3255
|
-
if (dirty & /*dx*/ 1) {
|
|
3256
|
-
attr(tspan, "dx", /*dx*/ ctx[0]);
|
|
3257
|
-
}
|
|
3258
|
-
|
|
3259
|
-
if (dirty & /*dy*/ 2 && tspan_dy_value !== (tspan_dy_value = /*i*/ ctx[24] === 0 ? 0 : /*dy*/ ctx[1])) {
|
|
3260
|
-
attr(tspan, "dy", tspan_dy_value);
|
|
3261
|
-
}
|
|
3262
|
-
},
|
|
3263
|
-
d(detaching) {
|
|
3264
|
-
if (detaching) detach(tspan);
|
|
3265
|
-
}
|
|
3266
|
-
};
|
|
3267
|
-
}
|
|
3268
|
-
|
|
3269
|
-
function create_fragment$4(ctx) {
|
|
3270
|
-
let if_block_anchor;
|
|
3271
|
-
let if_block = /*x*/ ctx[5] !== undefined && /*y*/ ctx[4] !== undefined && /*elements*/ ctx[2].length > 0 && create_if_block$2(ctx);
|
|
3272
|
-
|
|
3273
|
-
return {
|
|
3274
|
-
c() {
|
|
3275
|
-
if (if_block) if_block.c();
|
|
3276
|
-
if_block_anchor = empty();
|
|
3277
|
-
},
|
|
3278
|
-
m(target, anchor) {
|
|
3279
|
-
if (if_block) if_block.m(target, anchor);
|
|
3280
|
-
insert(target, if_block_anchor, anchor);
|
|
3281
|
-
},
|
|
3282
|
-
p(ctx, [dirty]) {
|
|
3283
|
-
if (/*x*/ ctx[5] !== undefined && /*y*/ ctx[4] !== undefined && /*elements*/ ctx[2].length > 0) {
|
|
3284
|
-
if (if_block) {
|
|
3285
|
-
if_block.p(ctx, dirty);
|
|
3286
|
-
} else {
|
|
3287
|
-
if_block = create_if_block$2(ctx);
|
|
3288
|
-
if_block.c();
|
|
3289
|
-
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
3290
|
-
}
|
|
3291
|
-
} else if (if_block) {
|
|
3292
|
-
if_block.d(1);
|
|
3293
|
-
if_block = null;
|
|
3294
|
-
}
|
|
3295
|
-
},
|
|
3296
|
-
i: noop,
|
|
3297
|
-
o: noop,
|
|
3298
|
-
d(detaching) {
|
|
3299
|
-
if (if_block) if_block.d(detaching);
|
|
3300
|
-
if (detaching) detach(if_block_anchor);
|
|
3301
|
-
}
|
|
3302
|
-
};
|
|
3303
|
-
}
|
|
3304
|
-
|
|
3305
|
-
function instance$4($$self, $$props, $$invalidate) {
|
|
3306
|
-
let x;
|
|
3307
|
-
let y;
|
|
3308
|
-
let textStyleStr;
|
|
3309
|
-
let $axesHeight;
|
|
3310
|
-
let $yLim;
|
|
3311
|
-
let $axesWidth;
|
|
3312
|
-
let $xLim;
|
|
3313
|
-
let { left } = $$props;
|
|
3314
|
-
let { top } = $$props;
|
|
3315
|
-
let { dx = "0" } = $$props;
|
|
3316
|
-
let { dy = "1.25em" } = $$props;
|
|
3317
|
-
let { elements } = $$props;
|
|
3318
|
-
let { faceColor = Colors.PRIMARY_TEXT } = $$props;
|
|
3319
|
-
let { borderColor = "transparent" } = $$props;
|
|
3320
|
-
let { borderWidth = 0 } = $$props;
|
|
3321
|
-
let { textSize = 1 } = $$props;
|
|
3322
|
-
|
|
3323
|
-
// get axes context and reactive variables needed to compute coordinates
|
|
3324
|
-
const axes = getContext('axes');
|
|
3325
|
-
|
|
3326
|
-
const xLim = axes.xLim;
|
|
3327
|
-
component_subscribe($$self, xLim, value => $$invalidate(19, $xLim = value));
|
|
3328
|
-
const yLim = axes.yLim;
|
|
3329
|
-
component_subscribe($$self, yLim, value => $$invalidate(17, $yLim = value));
|
|
3330
|
-
const axesWidth = axes.width;
|
|
3331
|
-
component_subscribe($$self, axesWidth, value => $$invalidate(18, $axesWidth = value));
|
|
3332
|
-
const axesHeight = axes.height;
|
|
3333
|
-
component_subscribe($$self, axesHeight, value => $$invalidate(16, $axesHeight = value));
|
|
3334
|
-
axes.scale;
|
|
3335
|
-
|
|
3336
|
-
$$self.$$set = $$props => {
|
|
3337
|
-
if ('left' in $$props) $$invalidate(10, left = $$props.left);
|
|
3338
|
-
if ('top' in $$props) $$invalidate(11, top = $$props.top);
|
|
3339
|
-
if ('dx' in $$props) $$invalidate(0, dx = $$props.dx);
|
|
3340
|
-
if ('dy' in $$props) $$invalidate(1, dy = $$props.dy);
|
|
3341
|
-
if ('elements' in $$props) $$invalidate(2, elements = $$props.elements);
|
|
3342
|
-
if ('faceColor' in $$props) $$invalidate(12, faceColor = $$props.faceColor);
|
|
3343
|
-
if ('borderColor' in $$props) $$invalidate(13, borderColor = $$props.borderColor);
|
|
3344
|
-
if ('borderWidth' in $$props) $$invalidate(14, borderWidth = $$props.borderWidth);
|
|
3345
|
-
if ('textSize' in $$props) $$invalidate(15, textSize = $$props.textSize);
|
|
3346
|
-
};
|
|
3347
|
-
|
|
3348
|
-
$$self.$$.update = () => {
|
|
3349
|
-
if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 787456) {
|
|
3350
|
-
// reactive variables for coordinates of data points in pixels
|
|
3351
|
-
$$invalidate(5, x = axes.scaleX([left], $xLim, $axesWidth));
|
|
3352
|
-
}
|
|
3353
|
-
|
|
3354
|
-
if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 198656) {
|
|
3355
|
-
$$invalidate(4, y = axes.scaleY([top], $yLim, $axesHeight));
|
|
3356
|
-
}
|
|
3357
|
-
|
|
3358
|
-
if ($$self.$$.dirty & /*faceColor, borderWidth, borderColor, textSize*/ 61440) {
|
|
3359
|
-
// styles for bars and labels
|
|
3360
|
-
$$invalidate(3, textStyleStr = `fill:${faceColor};stroke-width:${borderWidth}px;stroke:${borderColor};font-size:${textSize}em;`);
|
|
3361
|
-
}
|
|
3362
|
-
};
|
|
3363
|
-
|
|
3364
|
-
return [
|
|
3365
|
-
dx,
|
|
3366
|
-
dy,
|
|
3367
|
-
elements,
|
|
3368
|
-
textStyleStr,
|
|
3369
|
-
y,
|
|
3370
|
-
x,
|
|
3371
|
-
xLim,
|
|
3372
|
-
yLim,
|
|
3373
|
-
axesWidth,
|
|
3374
|
-
axesHeight,
|
|
3375
|
-
left,
|
|
3376
|
-
top,
|
|
3377
|
-
faceColor,
|
|
3378
|
-
borderColor,
|
|
3379
|
-
borderWidth,
|
|
3380
|
-
textSize,
|
|
3381
|
-
$axesHeight,
|
|
3382
|
-
$yLim,
|
|
3383
|
-
$axesWidth,
|
|
3384
|
-
$xLim
|
|
3385
|
-
];
|
|
3386
|
-
}
|
|
3387
|
-
|
|
3388
|
-
class TextLegend extends SvelteComponent {
|
|
3389
|
-
constructor(options) {
|
|
3390
|
-
super();
|
|
3391
|
-
|
|
3392
|
-
init(this, options, instance$4, create_fragment$4, safe_not_equal, {
|
|
3393
|
-
left: 10,
|
|
3394
|
-
top: 11,
|
|
3395
|
-
dx: 0,
|
|
3396
|
-
dy: 1,
|
|
3397
|
-
elements: 2,
|
|
3398
|
-
faceColor: 12,
|
|
3399
|
-
borderColor: 13,
|
|
3400
|
-
borderWidth: 14,
|
|
3401
|
-
textSize: 15
|
|
3402
|
-
});
|
|
3403
|
-
}
|
|
3404
|
-
}
|
|
3405
|
-
|
|
3406
|
-
/**********************************************
|
|
3407
|
-
* Functions for statistical tests and models *
|
|
3408
|
-
**********************************************/
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
/**
|
|
3412
|
-
* Finds smallest value in a vector
|
|
3413
|
-
* @param {number[]} x - vector with values
|
|
3414
|
-
* @returns {number}
|
|
3415
|
-
*/
|
|
3416
|
-
function min(x) {
|
|
3417
|
-
let n = x.length;
|
|
3418
|
-
let min = Number.POSITIVE_INFINITY;
|
|
3419
|
-
|
|
3420
|
-
while (n--) min = x[n] < min ? x[n] : min;
|
|
3421
|
-
return min;
|
|
3422
|
-
}
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
/**
|
|
3426
|
-
* Finds largest value in a vector
|
|
3427
|
-
* @param {number[]} x - vector with values
|
|
3428
|
-
* @returns {number}
|
|
3429
|
-
*/
|
|
3430
|
-
function max(x) {
|
|
3431
|
-
let n = x.length;
|
|
3432
|
-
let max = Number.NEGATIVE_INFINITY;
|
|
3433
|
-
|
|
3434
|
-
while (n--) max = x[n] > max ? x[n] : max;
|
|
3435
|
-
return max;
|
|
3436
|
-
}
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
/**
|
|
3440
|
-
* Computes a range of values in a vector with a margin
|
|
3441
|
-
* @param {number[]} x - vector with values
|
|
3442
|
-
* @param {number} margin - margin in parts of one (e.g. 0.1 for 10% or 2 for 200%)
|
|
3443
|
-
* @returns{number[]} array with marginal range boundaries
|
|
3444
|
-
*/
|
|
3445
|
-
function mrange(x, margin = 0.05) {
|
|
3446
|
-
const mn = min(x);
|
|
3447
|
-
const mx = max(x);
|
|
3448
|
-
const d = mx - mn;
|
|
3449
|
-
|
|
3450
|
-
return [mn - d * margin, max(x) + d * margin];
|
|
3451
|
-
}
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
/**
|
|
3455
|
-
* Computes difference between all adjacent values in a vector
|
|
3456
|
-
* @param {number[]} x - vector with values
|
|
3457
|
-
* @returns {number[]} vector with the differences
|
|
3458
|
-
*/
|
|
3459
|
-
function diff(x) {
|
|
3460
|
-
return x.slice(1).map( (y, i) => (y - x[i]));
|
|
3461
|
-
}
|
|
3462
|
-
|
|
3463
|
-
/* src/BarSeries.svelte generated by Svelte v3.50.1 */
|
|
3464
|
-
|
|
3465
|
-
function add_css$1(target) {
|
|
3466
|
-
append_styles(target, "svelte-kw726w", ".series_bar > rect{stroke-width:1px}.series_bar > rect:hover{opacity:90%}");
|
|
3467
|
-
}
|
|
3468
|
-
|
|
3469
|
-
function create_fragment$3(ctx) {
|
|
3470
|
-
let rectangles;
|
|
3471
|
-
let current;
|
|
3472
|
-
|
|
3473
|
-
rectangles = new Rectangles({
|
|
3474
|
-
props: {
|
|
3475
|
-
style: "series_bar",
|
|
3476
|
-
left: /*left*/ ctx[4],
|
|
3477
|
-
top: /*top*/ ctx[5],
|
|
3478
|
-
width: /*width*/ ctx[3],
|
|
3479
|
-
height: /*height*/ ctx[6],
|
|
3480
|
-
borderColor: /*borderColor*/ ctx[2],
|
|
3481
|
-
faceColor: /*faceColor*/ ctx[1],
|
|
3482
|
-
title: /*title*/ ctx[0]
|
|
3483
|
-
}
|
|
3484
|
-
});
|
|
3485
|
-
|
|
3486
|
-
return {
|
|
3487
|
-
c() {
|
|
3488
|
-
create_component(rectangles.$$.fragment);
|
|
3489
|
-
},
|
|
3490
|
-
m(target, anchor) {
|
|
3491
|
-
mount_component(rectangles, target, anchor);
|
|
3492
|
-
current = true;
|
|
3493
|
-
},
|
|
3494
|
-
p(ctx, [dirty]) {
|
|
3495
|
-
const rectangles_changes = {};
|
|
3496
|
-
if (dirty & /*left*/ 16) rectangles_changes.left = /*left*/ ctx[4];
|
|
3497
|
-
if (dirty & /*top*/ 32) rectangles_changes.top = /*top*/ ctx[5];
|
|
3498
|
-
if (dirty & /*width*/ 8) rectangles_changes.width = /*width*/ ctx[3];
|
|
3499
|
-
if (dirty & /*height*/ 64) rectangles_changes.height = /*height*/ ctx[6];
|
|
3500
|
-
if (dirty & /*borderColor*/ 4) rectangles_changes.borderColor = /*borderColor*/ ctx[2];
|
|
3501
|
-
if (dirty & /*faceColor*/ 2) rectangles_changes.faceColor = /*faceColor*/ ctx[1];
|
|
3502
|
-
if (dirty & /*title*/ 1) rectangles_changes.title = /*title*/ ctx[0];
|
|
3503
|
-
rectangles.$set(rectangles_changes);
|
|
3504
|
-
},
|
|
3505
|
-
i(local) {
|
|
3506
|
-
if (current) return;
|
|
3507
|
-
transition_in(rectangles.$$.fragment, local);
|
|
3508
|
-
current = true;
|
|
3509
|
-
},
|
|
3510
|
-
o(local) {
|
|
3511
|
-
transition_out(rectangles.$$.fragment, local);
|
|
3512
|
-
current = false;
|
|
3513
|
-
},
|
|
3514
|
-
d(detaching) {
|
|
3515
|
-
destroy_component(rectangles, detaching);
|
|
3516
|
-
}
|
|
3517
|
-
};
|
|
3518
|
-
}
|
|
3519
|
-
|
|
3520
|
-
function instance$3($$self, $$props, $$invalidate) {
|
|
3521
|
-
let { xValues } = $$props;
|
|
3522
|
-
let { yValues } = $$props;
|
|
3523
|
-
let { barWidth = 0.8 } = $$props;
|
|
3524
|
-
let { title = "" } = $$props;
|
|
3525
|
-
let { faceColor = Colors.PRIMARY } = $$props;
|
|
3526
|
-
let { borderColor = Colors.PRIMARY } = $$props;
|
|
3527
|
-
let { showLabels = "no" } = $$props;
|
|
3528
|
-
|
|
3529
|
-
// TODO: implemented later
|
|
3530
|
-
//export let labels = yValues;
|
|
3531
|
-
/* internal parameters */
|
|
3532
|
-
let width;
|
|
3533
|
-
|
|
3534
|
-
let left;
|
|
3535
|
-
let top;
|
|
3536
|
-
let height;
|
|
3537
|
-
|
|
3538
|
-
// to access shared parameters and methods from Axes
|
|
3539
|
-
const axes = getContext('axes');
|
|
3540
|
-
|
|
3541
|
-
$$self.$$set = $$props => {
|
|
3542
|
-
if ('xValues' in $$props) $$invalidate(7, xValues = $$props.xValues);
|
|
3543
|
-
if ('yValues' in $$props) $$invalidate(8, yValues = $$props.yValues);
|
|
3544
|
-
if ('barWidth' in $$props) $$invalidate(9, barWidth = $$props.barWidth);
|
|
3545
|
-
if ('title' in $$props) $$invalidate(0, title = $$props.title);
|
|
3546
|
-
if ('faceColor' in $$props) $$invalidate(1, faceColor = $$props.faceColor);
|
|
3547
|
-
if ('borderColor' in $$props) $$invalidate(2, borderColor = $$props.borderColor);
|
|
3548
|
-
if ('showLabels' in $$props) $$invalidate(10, showLabels = $$props.showLabels);
|
|
3549
|
-
};
|
|
3550
|
-
|
|
3551
|
-
$$self.$$.update = () => {
|
|
3552
|
-
if ($$self.$$.dirty & /*xValues, barWidth, width*/ 648) {
|
|
3553
|
-
/* reactive actions related to x-values, fires when there are changes in:
|
|
3554
|
-
* - xValues
|
|
3555
|
-
* - barWidth
|
|
3556
|
-
*/
|
|
3557
|
-
{
|
|
3558
|
-
if (!Array.isArray(xValues)) {
|
|
3559
|
-
throw "BarSeries: parameter 'xValues' must be a numeric vector.";
|
|
3560
|
-
}
|
|
3561
|
-
|
|
3562
|
-
if (barWidth <= 0 || barWidth > 1) {
|
|
3563
|
-
throw "BarSeries: parameters 'barWidth' should be between 0 and 1.";
|
|
3564
|
-
}
|
|
3565
|
-
|
|
3566
|
-
const xValuesRange = mrange(xValues, 0.1);
|
|
3567
|
-
xValuesRange[0] = xValuesRange[0] - barWidth * diff(xValuesRange) / xValues.length * 0.5;
|
|
3568
|
-
xValuesRange[1] = xValuesRange[1] + barWidth * diff(xValuesRange) / xValues.length * 0.5;
|
|
3569
|
-
axes.adjustXAxisLimits(xValuesRange);
|
|
3570
|
-
$$invalidate(3, width = Array(xValues.length).fill(max(diff(xValues)) * barWidth));
|
|
3571
|
-
$$invalidate(4, left = xValues.map((v, i) => v - width[i] / 2));
|
|
3572
|
-
}
|
|
3573
|
-
}
|
|
3574
|
-
|
|
3575
|
-
if ($$self.$$.dirty & /*yValues, xValues, showLabels*/ 1408) {
|
|
3576
|
-
/* reactive actions related to y-values, fires when there are changes in:
|
|
3577
|
-
* - yValues
|
|
3578
|
-
*/
|
|
3579
|
-
{
|
|
3580
|
-
if (!Array.isArray(yValues) || xValues.length != yValues.length) {
|
|
3581
|
-
throw "BarSeries: parameter 'yValues' must be a numeric vector of the same length as 'xValues'.";
|
|
3582
|
-
}
|
|
3583
|
-
|
|
3584
|
-
const yValuesRange = mrange(yValues, showLabels === "no" ? 0.05 : 0.20);
|
|
3585
|
-
axes.adjustYAxisLimits(yValuesRange);
|
|
3586
|
-
$$invalidate(5, top = yValues.map(v => v > 0 ? v : 0));
|
|
3587
|
-
$$invalidate(6, height = yValues.map(v => Math.abs(v)));
|
|
3588
|
-
}
|
|
3589
|
-
}
|
|
3590
|
-
};
|
|
3591
|
-
|
|
3592
|
-
return [
|
|
3593
|
-
title,
|
|
3594
|
-
faceColor,
|
|
3595
|
-
borderColor,
|
|
3596
|
-
width,
|
|
3597
|
-
left,
|
|
3598
|
-
top,
|
|
3599
|
-
height,
|
|
3600
|
-
xValues,
|
|
3601
|
-
yValues,
|
|
3602
|
-
barWidth,
|
|
3603
|
-
showLabels
|
|
3604
|
-
];
|
|
3605
|
-
}
|
|
3606
|
-
|
|
3607
|
-
class BarSeries extends SvelteComponent {
|
|
3608
|
-
constructor(options) {
|
|
3609
|
-
super();
|
|
3610
|
-
|
|
3611
|
-
init(
|
|
3612
|
-
this,
|
|
3613
|
-
options,
|
|
3614
|
-
instance$3,
|
|
3615
|
-
create_fragment$3,
|
|
3616
|
-
safe_not_equal,
|
|
3617
|
-
{
|
|
3618
|
-
xValues: 7,
|
|
3619
|
-
yValues: 8,
|
|
3620
|
-
barWidth: 9,
|
|
3621
|
-
title: 0,
|
|
3622
|
-
faceColor: 1,
|
|
3623
|
-
borderColor: 2,
|
|
3624
|
-
showLabels: 10
|
|
3625
|
-
},
|
|
3626
|
-
add_css$1
|
|
3627
|
-
);
|
|
3628
|
-
}
|
|
3629
|
-
}
|
|
3630
|
-
|
|
3631
|
-
/* src/ScatterSeries.svelte generated by Svelte v3.50.1 */
|
|
3632
|
-
|
|
3633
|
-
function add_css(target) {
|
|
3634
|
-
append_styles(target, "svelte-byxua3", ".series_scatter > text{font-size:1em;cursor:default}.series_scatter > text:hover{opacity:90%}.series_scatter > *:hover + .labels_hover{visibility:visible;opacity:1}");
|
|
3635
|
-
}
|
|
3636
|
-
|
|
3637
|
-
function create_fragment$2(ctx) {
|
|
3638
|
-
let textlabels;
|
|
3639
|
-
let current;
|
|
3640
|
-
|
|
3641
|
-
textlabels = new TextLabels({
|
|
3642
|
-
props: {
|
|
3643
|
-
xValues: /*xValues*/ ctx[0],
|
|
3644
|
-
yValues: /*yValues*/ ctx[1],
|
|
3645
|
-
faceColor: /*faceColor*/ ctx[3],
|
|
3646
|
-
borderColor: /*borderColor*/ ctx[4],
|
|
3647
|
-
borderWidth: /*borderWidth*/ ctx[5],
|
|
3648
|
-
title: /*title*/ ctx[2],
|
|
3649
|
-
style: "series_scatter",
|
|
3650
|
-
labels: /*markerSymbol*/ ctx[7],
|
|
3651
|
-
textSize: /*markerSize*/ ctx[6]
|
|
3652
|
-
}
|
|
3653
|
-
});
|
|
3654
|
-
|
|
3655
|
-
return {
|
|
3656
|
-
c() {
|
|
3657
|
-
create_component(textlabels.$$.fragment);
|
|
3658
|
-
},
|
|
3659
|
-
m(target, anchor) {
|
|
3660
|
-
mount_component(textlabels, target, anchor);
|
|
3661
|
-
current = true;
|
|
3662
|
-
},
|
|
3663
|
-
p(ctx, [dirty]) {
|
|
3664
|
-
const textlabels_changes = {};
|
|
3665
|
-
if (dirty & /*xValues*/ 1) textlabels_changes.xValues = /*xValues*/ ctx[0];
|
|
3666
|
-
if (dirty & /*yValues*/ 2) textlabels_changes.yValues = /*yValues*/ ctx[1];
|
|
3667
|
-
if (dirty & /*faceColor*/ 8) textlabels_changes.faceColor = /*faceColor*/ ctx[3];
|
|
3668
|
-
if (dirty & /*borderColor*/ 16) textlabels_changes.borderColor = /*borderColor*/ ctx[4];
|
|
3669
|
-
if (dirty & /*borderWidth*/ 32) textlabels_changes.borderWidth = /*borderWidth*/ ctx[5];
|
|
3670
|
-
if (dirty & /*title*/ 4) textlabels_changes.title = /*title*/ ctx[2];
|
|
3671
|
-
if (dirty & /*markerSymbol*/ 128) textlabels_changes.labels = /*markerSymbol*/ ctx[7];
|
|
3672
|
-
if (dirty & /*markerSize*/ 64) textlabels_changes.textSize = /*markerSize*/ ctx[6];
|
|
3673
|
-
textlabels.$set(textlabels_changes);
|
|
3674
|
-
},
|
|
3675
|
-
i(local) {
|
|
3676
|
-
if (current) return;
|
|
3677
|
-
transition_in(textlabels.$$.fragment, local);
|
|
3678
|
-
current = true;
|
|
3679
|
-
},
|
|
3680
|
-
o(local) {
|
|
3681
|
-
transition_out(textlabels.$$.fragment, local);
|
|
3682
|
-
current = false;
|
|
3683
|
-
},
|
|
3684
|
-
d(detaching) {
|
|
3685
|
-
destroy_component(textlabels, detaching);
|
|
3686
|
-
}
|
|
3687
|
-
};
|
|
3688
|
-
}
|
|
3689
|
-
|
|
3690
|
-
function instance$2($$self, $$props, $$invalidate) {
|
|
3691
|
-
let { xValues } = $$props;
|
|
3692
|
-
let { yValues } = $$props;
|
|
3693
|
-
let { marker = 1 } = $$props;
|
|
3694
|
-
let { title = "" } = $$props;
|
|
3695
|
-
let { faceColor = "transparent" } = $$props;
|
|
3696
|
-
let { borderColor = Colors.PRIMARY } = $$props;
|
|
3697
|
-
let { borderWidth = 1 } = $$props;
|
|
3698
|
-
let { markerSize = 1 } = $$props;
|
|
3699
|
-
|
|
3700
|
-
// TODO: implement later
|
|
3701
|
-
//export let labels = yValues;
|
|
3702
|
-
//export let showLabels = "no"; // can be "no", "hover", "always"
|
|
3703
|
-
/* constants for internal use */
|
|
3704
|
-
const markers = ["●", "◼", "▲", "▼", "⬥", "+", "*", "⨯"];
|
|
3705
|
-
|
|
3706
|
-
let markerSymbol;
|
|
3707
|
-
|
|
3708
|
-
/* sanity check of input parameters */
|
|
3709
|
-
if (typeof marker !== "number" || marker < 1 || marker > markers.length) {
|
|
3710
|
-
throw `ScatterSeries: parameter 'marker' must be a number from 1 to ${markers.length}."`;
|
|
3711
|
-
}
|
|
3712
|
-
|
|
3713
|
-
// to access shared parameters and methods from Axes
|
|
3714
|
-
const axes = getContext('axes');
|
|
3715
|
-
|
|
3716
|
-
$$self.$$set = $$props => {
|
|
3717
|
-
if ('xValues' in $$props) $$invalidate(0, xValues = $$props.xValues);
|
|
3718
|
-
if ('yValues' in $$props) $$invalidate(1, yValues = $$props.yValues);
|
|
3719
|
-
if ('marker' in $$props) $$invalidate(8, marker = $$props.marker);
|
|
3720
|
-
if ('title' in $$props) $$invalidate(2, title = $$props.title);
|
|
3721
|
-
if ('faceColor' in $$props) $$invalidate(3, faceColor = $$props.faceColor);
|
|
3722
|
-
if ('borderColor' in $$props) $$invalidate(4, borderColor = $$props.borderColor);
|
|
3723
|
-
if ('borderWidth' in $$props) $$invalidate(5, borderWidth = $$props.borderWidth);
|
|
3724
|
-
if ('markerSize' in $$props) $$invalidate(6, markerSize = $$props.markerSize);
|
|
3725
|
-
};
|
|
3726
|
-
|
|
3727
|
-
$$self.$$.update = () => {
|
|
3728
|
-
if ($$self.$$.dirty & /*xValues, marker*/ 257) {
|
|
3729
|
-
/* reactive actions related to x-values, fires when there are changes in:
|
|
3730
|
-
* - xValues
|
|
3731
|
-
* - marker
|
|
3732
|
-
*/
|
|
3733
|
-
{
|
|
3734
|
-
if (!Array.isArray(xValues)) {
|
|
3735
|
-
throw "ScatterSeries: parameter 'xValues' must be a numeric vector.";
|
|
3736
|
-
}
|
|
3737
|
-
|
|
3738
|
-
const xValuesRange = mrange(xValues, 0.05);
|
|
3739
|
-
axes.adjustXAxisLimits(xValuesRange);
|
|
3740
|
-
$$invalidate(7, markerSymbol = "");
|
|
3741
|
-
$$invalidate(7, markerSymbol = markers[marker - 1]);
|
|
3742
|
-
}
|
|
3743
|
-
}
|
|
3744
|
-
|
|
3745
|
-
if ($$self.$$.dirty & /*yValues, xValues*/ 3) {
|
|
3746
|
-
/* reactive actions related to y-values, fires when there are changes in:
|
|
3747
|
-
* - yValues
|
|
3748
|
-
*/
|
|
3749
|
-
{
|
|
3750
|
-
if (!Array.isArray(yValues) || xValues.length != yValues.length) {
|
|
3751
|
-
throw "BarSeries: parameter 'yValues' must be a numeric vector of the same length as 'xValues'.";
|
|
3752
|
-
}
|
|
3753
|
-
|
|
3754
|
-
const yValuesRange = mrange(yValues, 0.05);
|
|
3755
|
-
axes.adjustYAxisLimits(yValuesRange);
|
|
3756
|
-
}
|
|
3757
|
-
}
|
|
3758
|
-
};
|
|
3759
|
-
|
|
3760
|
-
return [
|
|
3761
|
-
xValues,
|
|
3762
|
-
yValues,
|
|
3763
|
-
title,
|
|
3764
|
-
faceColor,
|
|
3765
|
-
borderColor,
|
|
3766
|
-
borderWidth,
|
|
3767
|
-
markerSize,
|
|
3768
|
-
markerSymbol,
|
|
3769
|
-
marker
|
|
3770
|
-
];
|
|
3771
|
-
}
|
|
3772
|
-
|
|
3773
|
-
class ScatterSeries extends SvelteComponent {
|
|
3774
|
-
constructor(options) {
|
|
3775
|
-
super();
|
|
3776
|
-
|
|
3777
|
-
init(
|
|
3778
|
-
this,
|
|
3779
|
-
options,
|
|
3780
|
-
instance$2,
|
|
3781
|
-
create_fragment$2,
|
|
3782
|
-
safe_not_equal,
|
|
3783
|
-
{
|
|
3784
|
-
xValues: 0,
|
|
3785
|
-
yValues: 1,
|
|
3786
|
-
marker: 8,
|
|
3787
|
-
title: 2,
|
|
3788
|
-
faceColor: 3,
|
|
3789
|
-
borderColor: 4,
|
|
3790
|
-
borderWidth: 5,
|
|
3791
|
-
markerSize: 6
|
|
3792
|
-
},
|
|
3793
|
-
add_css
|
|
3794
|
-
);
|
|
3795
|
-
}
|
|
3796
|
-
}
|
|
3797
|
-
|
|
3798
|
-
/* src/LineSeries.svelte generated by Svelte v3.50.1 */
|
|
3799
|
-
|
|
3800
|
-
function create_if_block$1(ctx) {
|
|
3801
|
-
let g;
|
|
3802
|
-
let polyline;
|
|
3803
|
-
|
|
3804
|
-
return {
|
|
3805
|
-
c() {
|
|
3806
|
-
g = svg_element("g");
|
|
3807
|
-
polyline = svg_element("polyline");
|
|
3808
|
-
attr(polyline, "class", "line");
|
|
3809
|
-
attr(polyline, "points", /*p*/ ctx[2]);
|
|
3810
|
-
attr(g, "class", "series series_line");
|
|
3811
|
-
attr(g, "style", /*lineStyleStr*/ ctx[1]);
|
|
3812
|
-
attr(g, "title", /*title*/ ctx[0]);
|
|
3813
|
-
},
|
|
3814
|
-
m(target, anchor) {
|
|
3815
|
-
insert(target, g, anchor);
|
|
3816
|
-
append(g, polyline);
|
|
3817
|
-
},
|
|
3818
|
-
p(ctx, dirty) {
|
|
3819
|
-
if (dirty & /*p*/ 4) {
|
|
3820
|
-
attr(polyline, "points", /*p*/ ctx[2]);
|
|
3821
|
-
}
|
|
3822
|
-
|
|
3823
|
-
if (dirty & /*lineStyleStr*/ 2) {
|
|
3824
|
-
attr(g, "style", /*lineStyleStr*/ ctx[1]);
|
|
3825
|
-
}
|
|
3826
|
-
|
|
3827
|
-
if (dirty & /*title*/ 1) {
|
|
3828
|
-
attr(g, "title", /*title*/ ctx[0]);
|
|
3829
|
-
}
|
|
3830
|
-
},
|
|
3831
|
-
d(detaching) {
|
|
3832
|
-
if (detaching) detach(g);
|
|
3833
|
-
}
|
|
3834
|
-
};
|
|
3835
|
-
}
|
|
3836
|
-
|
|
3837
|
-
function create_fragment$1(ctx) {
|
|
3838
|
-
let if_block_anchor;
|
|
3839
|
-
let if_block = /*p*/ ctx[2] !== undefined && create_if_block$1(ctx);
|
|
3840
|
-
|
|
3841
|
-
return {
|
|
3842
|
-
c() {
|
|
3843
|
-
if (if_block) if_block.c();
|
|
3844
|
-
if_block_anchor = empty();
|
|
3845
|
-
},
|
|
3846
|
-
m(target, anchor) {
|
|
3847
|
-
if (if_block) if_block.m(target, anchor);
|
|
3848
|
-
insert(target, if_block_anchor, anchor);
|
|
3849
|
-
},
|
|
3850
|
-
p(ctx, [dirty]) {
|
|
3851
|
-
if (/*p*/ ctx[2] !== undefined) {
|
|
3852
|
-
if (if_block) {
|
|
3853
|
-
if_block.p(ctx, dirty);
|
|
3854
|
-
} else {
|
|
3855
|
-
if_block = create_if_block$1(ctx);
|
|
3856
|
-
if_block.c();
|
|
3857
|
-
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
3858
|
-
}
|
|
3859
|
-
} else if (if_block) {
|
|
3860
|
-
if_block.d(1);
|
|
3861
|
-
if_block = null;
|
|
3862
|
-
}
|
|
3863
|
-
},
|
|
3864
|
-
i: noop,
|
|
3865
|
-
o: noop,
|
|
3866
|
-
d(detaching) {
|
|
3867
|
-
if (if_block) if_block.d(detaching);
|
|
3868
|
-
if (detaching) detach(if_block_anchor);
|
|
3869
|
-
}
|
|
3870
|
-
};
|
|
3871
|
-
}
|
|
3872
|
-
|
|
3873
|
-
function instance$1($$self, $$props, $$invalidate) {
|
|
3874
|
-
let x;
|
|
3875
|
-
let y;
|
|
3876
|
-
let p;
|
|
3877
|
-
let lineStyleStr;
|
|
3878
|
-
let $scale;
|
|
3879
|
-
let $axesHeight;
|
|
3880
|
-
let $yLim;
|
|
3881
|
-
let $axesWidth;
|
|
3882
|
-
let $xLim;
|
|
3883
|
-
let { xValues } = $$props;
|
|
3884
|
-
let { yValues } = $$props;
|
|
3885
|
-
let { title = "" } = $$props;
|
|
3886
|
-
let { lineWidth = 1 } = $$props;
|
|
3887
|
-
let { lineColor = Colors.PRIMARY } = $$props;
|
|
3888
|
-
let { lineType = 1 } = $$props;
|
|
3889
|
-
|
|
3890
|
-
/* sanity check of input parameters */
|
|
3891
|
-
if (!Array.isArray(xValues) || !Array.isArray(yValues) || xValues.length != yValues.length) {
|
|
3892
|
-
throw "LineSeries: parameters 'xValues' and 'yValues' must be numeric vectors of the same length.";
|
|
3893
|
-
}
|
|
3894
|
-
|
|
3895
|
-
// compute ranges for x and y values
|
|
3896
|
-
const xValuesRange = mrange(xValues, 0.05);
|
|
3897
|
-
|
|
3898
|
-
const yValuesRange = mrange(yValues, 0.05);
|
|
3899
|
-
|
|
3900
|
-
// get axes context and adjust axes limits
|
|
3901
|
-
const axes = getContext('axes');
|
|
3902
|
-
|
|
3903
|
-
axes.adjustXAxisLimits(xValuesRange);
|
|
3904
|
-
axes.adjustYAxisLimits(yValuesRange);
|
|
3905
|
-
|
|
3906
|
-
// get reactive variables needed to compute coordinates
|
|
3907
|
-
const xLim = axes.xLim;
|
|
3908
|
-
|
|
3909
|
-
component_subscribe($$self, xLim, value => $$invalidate(19, $xLim = value));
|
|
3910
|
-
const yLim = axes.yLim;
|
|
3911
|
-
component_subscribe($$self, yLim, value => $$invalidate(17, $yLim = value));
|
|
3912
|
-
const axesWidth = axes.width;
|
|
3913
|
-
component_subscribe($$self, axesWidth, value => $$invalidate(18, $axesWidth = value));
|
|
3914
|
-
const axesHeight = axes.height;
|
|
3915
|
-
component_subscribe($$self, axesHeight, value => $$invalidate(16, $axesHeight = value));
|
|
3916
|
-
const scale = axes.scale;
|
|
3917
|
-
component_subscribe($$self, scale, value => $$invalidate(15, $scale = value));
|
|
3918
|
-
|
|
3919
|
-
$$self.$$set = $$props => {
|
|
3920
|
-
if ('xValues' in $$props) $$invalidate(8, xValues = $$props.xValues);
|
|
3921
|
-
if ('yValues' in $$props) $$invalidate(9, yValues = $$props.yValues);
|
|
3922
|
-
if ('title' in $$props) $$invalidate(0, title = $$props.title);
|
|
3923
|
-
if ('lineWidth' in $$props) $$invalidate(10, lineWidth = $$props.lineWidth);
|
|
3924
|
-
if ('lineColor' in $$props) $$invalidate(11, lineColor = $$props.lineColor);
|
|
3925
|
-
if ('lineType' in $$props) $$invalidate(12, lineType = $$props.lineType);
|
|
3926
|
-
};
|
|
3927
|
-
|
|
3928
|
-
$$self.$$.update = () => {
|
|
3929
|
-
if ($$self.$$.dirty & /*xValues, $xLim, $axesWidth*/ 786688) {
|
|
3930
|
-
// reactive variables for coordinates of data points in pixels
|
|
3931
|
-
$$invalidate(14, x = axes.scaleX(xValues, $xLim, $axesWidth));
|
|
3932
|
-
}
|
|
3933
|
-
|
|
3934
|
-
if ($$self.$$.dirty & /*yValues, $yLim, $axesHeight*/ 197120) {
|
|
3935
|
-
$$invalidate(13, y = axes.scaleY(yValues, $yLim, $axesHeight));
|
|
3936
|
-
}
|
|
3937
|
-
|
|
3938
|
-
if ($$self.$$.dirty & /*x, y*/ 24576) {
|
|
3939
|
-
$$invalidate(2, p = x !== undefined && y !== undefined
|
|
3940
|
-
? x.map((v, i) => `${v},${y[i]}`).join(' ')
|
|
3941
|
-
: undefined);
|
|
3942
|
-
}
|
|
3943
|
-
|
|
3944
|
-
if ($$self.$$.dirty & /*lineColor, lineWidth, $scale, lineType*/ 39936) {
|
|
3945
|
-
$$invalidate(1, lineStyleStr = `fill:transparent;stroke:${lineColor};stroke-width: ${lineWidth}px;
|
|
3946
|
-
stroke-dasharray:${axes.LINE_STYLES[$scale][lineType - 1]}`);
|
|
3947
|
-
}
|
|
3948
|
-
};
|
|
3949
|
-
|
|
3950
|
-
return [
|
|
3951
|
-
title,
|
|
3952
|
-
lineStyleStr,
|
|
3953
|
-
p,
|
|
3954
|
-
xLim,
|
|
3955
|
-
yLim,
|
|
3956
|
-
axesWidth,
|
|
3957
|
-
axesHeight,
|
|
3958
|
-
scale,
|
|
3959
|
-
xValues,
|
|
3960
|
-
yValues,
|
|
3961
|
-
lineWidth,
|
|
3962
|
-
lineColor,
|
|
3963
|
-
lineType,
|
|
3964
|
-
y,
|
|
3965
|
-
x,
|
|
3966
|
-
$scale,
|
|
3967
|
-
$axesHeight,
|
|
3968
|
-
$yLim,
|
|
3969
|
-
$axesWidth,
|
|
3970
|
-
$xLim
|
|
3971
|
-
];
|
|
3972
|
-
}
|
|
3973
|
-
|
|
3974
|
-
class LineSeries extends SvelteComponent {
|
|
3975
|
-
constructor(options) {
|
|
3976
|
-
super();
|
|
3977
|
-
|
|
3978
|
-
init(this, options, instance$1, create_fragment$1, safe_not_equal, {
|
|
3979
|
-
xValues: 8,
|
|
3980
|
-
yValues: 9,
|
|
3981
|
-
title: 0,
|
|
3982
|
-
lineWidth: 10,
|
|
3983
|
-
lineColor: 11,
|
|
3984
|
-
lineType: 12
|
|
3985
|
-
});
|
|
3986
|
-
}
|
|
3987
|
-
}
|
|
3988
|
-
|
|
3989
|
-
/* src/AreaSeries.svelte generated by Svelte v3.50.1 */
|
|
3990
|
-
|
|
3991
|
-
function create_if_block(ctx) {
|
|
3992
|
-
let g;
|
|
3993
|
-
let polygon;
|
|
3994
|
-
let polygon_points_value;
|
|
3995
|
-
|
|
3996
|
-
return {
|
|
3997
|
-
c() {
|
|
3998
|
-
g = svg_element("g");
|
|
3999
|
-
polygon = svg_element("polygon");
|
|
4000
|
-
attr(polygon, "points", polygon_points_value = /*x*/ ctx[1][0] + "," + /*y0*/ ctx[4] + " " + /*p*/ ctx[3] + " " + /*x*/ ctx[1][/*x*/ ctx[1].length - 1] + "," + /*y0*/ ctx[4][0]);
|
|
4001
|
-
attr(g, "class", "series lineseries");
|
|
4002
|
-
attr(g, "style", /*areaStyleStr*/ ctx[2]);
|
|
4003
|
-
attr(g, "title", /*title*/ ctx[0]);
|
|
4004
|
-
},
|
|
4005
|
-
m(target, anchor) {
|
|
4006
|
-
insert(target, g, anchor);
|
|
4007
|
-
append(g, polygon);
|
|
4008
|
-
},
|
|
4009
|
-
p(ctx, dirty) {
|
|
4010
|
-
if (dirty & /*x, y0, p*/ 26 && polygon_points_value !== (polygon_points_value = /*x*/ ctx[1][0] + "," + /*y0*/ ctx[4] + " " + /*p*/ ctx[3] + " " + /*x*/ ctx[1][/*x*/ ctx[1].length - 1] + "," + /*y0*/ ctx[4][0])) {
|
|
4011
|
-
attr(polygon, "points", polygon_points_value);
|
|
4012
|
-
}
|
|
4013
|
-
|
|
4014
|
-
if (dirty & /*areaStyleStr*/ 4) {
|
|
4015
|
-
attr(g, "style", /*areaStyleStr*/ ctx[2]);
|
|
4016
|
-
}
|
|
4017
|
-
|
|
4018
|
-
if (dirty & /*title*/ 1) {
|
|
4019
|
-
attr(g, "title", /*title*/ ctx[0]);
|
|
4020
|
-
}
|
|
4021
|
-
},
|
|
4022
|
-
d(detaching) {
|
|
4023
|
-
if (detaching) detach(g);
|
|
4024
|
-
}
|
|
4025
|
-
};
|
|
4026
|
-
}
|
|
4027
|
-
|
|
4028
|
-
function create_fragment(ctx) {
|
|
4029
|
-
let if_block_anchor;
|
|
4030
|
-
let if_block = /*p*/ ctx[3] !== undefined && create_if_block(ctx);
|
|
4031
|
-
|
|
4032
|
-
return {
|
|
4033
|
-
c() {
|
|
4034
|
-
if (if_block) if_block.c();
|
|
4035
|
-
if_block_anchor = empty();
|
|
4036
|
-
},
|
|
4037
|
-
m(target, anchor) {
|
|
4038
|
-
if (if_block) if_block.m(target, anchor);
|
|
4039
|
-
insert(target, if_block_anchor, anchor);
|
|
4040
|
-
},
|
|
4041
|
-
p(ctx, [dirty]) {
|
|
4042
|
-
if (/*p*/ ctx[3] !== undefined) {
|
|
4043
|
-
if (if_block) {
|
|
4044
|
-
if_block.p(ctx, dirty);
|
|
4045
|
-
} else {
|
|
4046
|
-
if_block = create_if_block(ctx);
|
|
4047
|
-
if_block.c();
|
|
4048
|
-
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
4049
|
-
}
|
|
4050
|
-
} else if (if_block) {
|
|
4051
|
-
if_block.d(1);
|
|
4052
|
-
if_block = null;
|
|
4053
|
-
}
|
|
4054
|
-
},
|
|
4055
|
-
i: noop,
|
|
4056
|
-
o: noop,
|
|
4057
|
-
d(detaching) {
|
|
4058
|
-
if (if_block) if_block.d(detaching);
|
|
4059
|
-
if (detaching) detach(if_block_anchor);
|
|
4060
|
-
}
|
|
4061
|
-
};
|
|
4062
|
-
}
|
|
4063
|
-
|
|
4064
|
-
function instance($$self, $$props, $$invalidate) {
|
|
4065
|
-
let y0;
|
|
4066
|
-
let x;
|
|
4067
|
-
let y;
|
|
4068
|
-
let p;
|
|
4069
|
-
let areaStyleStr;
|
|
4070
|
-
let $scale;
|
|
4071
|
-
let $axesHeight;
|
|
4072
|
-
let $yLim;
|
|
4073
|
-
let $axesWidth;
|
|
4074
|
-
let $xLim;
|
|
4075
|
-
let { xValues } = $$props;
|
|
4076
|
-
let { yValues } = $$props;
|
|
4077
|
-
let { title = "" } = $$props;
|
|
4078
|
-
let { lineWidth = 1 } = $$props;
|
|
4079
|
-
let { lineColor = Colors.PRIMARY } = $$props;
|
|
4080
|
-
let { fillColor = Colors.PRIMARY } = $$props;
|
|
4081
|
-
let { opacity = 1 } = $$props;
|
|
4082
|
-
let { lineType = 1 } = $$props;
|
|
4083
|
-
|
|
4084
|
-
/* sanity check of input parameters */
|
|
4085
|
-
if (!Array.isArray(xValues) || !Array.isArray(yValues) || xValues.length != yValues.length) {
|
|
4086
|
-
throw "AreaSeries: parameters 'xValues' and 'yValues' must be numeric vectors of the same length.";
|
|
4087
|
-
}
|
|
4088
|
-
|
|
4089
|
-
// compute ranges for x and y values
|
|
4090
|
-
const xValuesRange = mrange(xValues, 0.05);
|
|
4091
|
-
|
|
4092
|
-
const yValuesRange = mrange(yValues, 0.05);
|
|
4093
|
-
|
|
4094
|
-
// get axes context and adjust axes limits
|
|
4095
|
-
const axes = getContext('axes');
|
|
4096
|
-
|
|
4097
|
-
axes.adjustXAxisLimits(xValuesRange);
|
|
4098
|
-
axes.adjustYAxisLimits(yValuesRange);
|
|
4099
|
-
|
|
4100
|
-
// get reactive variables needed to compute coordinates
|
|
4101
|
-
const xLim = axes.xLim;
|
|
4102
|
-
|
|
4103
|
-
component_subscribe($$self, xLim, value => $$invalidate(22, $xLim = value));
|
|
4104
|
-
const yLim = axes.yLim;
|
|
4105
|
-
component_subscribe($$self, yLim, value => $$invalidate(20, $yLim = value));
|
|
4106
|
-
const axesWidth = axes.width;
|
|
4107
|
-
component_subscribe($$self, axesWidth, value => $$invalidate(21, $axesWidth = value));
|
|
4108
|
-
const axesHeight = axes.height;
|
|
4109
|
-
component_subscribe($$self, axesHeight, value => $$invalidate(19, $axesHeight = value));
|
|
4110
|
-
const scale = axes.scale;
|
|
4111
|
-
component_subscribe($$self, scale, value => $$invalidate(18, $scale = value));
|
|
4112
|
-
|
|
4113
|
-
$$self.$$set = $$props => {
|
|
4114
|
-
if ('xValues' in $$props) $$invalidate(10, xValues = $$props.xValues);
|
|
4115
|
-
if ('yValues' in $$props) $$invalidate(11, yValues = $$props.yValues);
|
|
4116
|
-
if ('title' in $$props) $$invalidate(0, title = $$props.title);
|
|
4117
|
-
if ('lineWidth' in $$props) $$invalidate(12, lineWidth = $$props.lineWidth);
|
|
4118
|
-
if ('lineColor' in $$props) $$invalidate(13, lineColor = $$props.lineColor);
|
|
4119
|
-
if ('fillColor' in $$props) $$invalidate(14, fillColor = $$props.fillColor);
|
|
4120
|
-
if ('opacity' in $$props) $$invalidate(15, opacity = $$props.opacity);
|
|
4121
|
-
if ('lineType' in $$props) $$invalidate(16, lineType = $$props.lineType);
|
|
4122
|
-
};
|
|
4123
|
-
|
|
4124
|
-
$$self.$$.update = () => {
|
|
4125
|
-
if ($$self.$$.dirty & /*$yLim, $axesHeight*/ 1572864) {
|
|
4126
|
-
// reactive variables for coordinates of data points in pixels
|
|
4127
|
-
$$invalidate(4, y0 = axes.scaleY([0], $yLim, $axesHeight));
|
|
4128
|
-
}
|
|
4129
|
-
|
|
4130
|
-
if ($$self.$$.dirty & /*xValues, $xLim, $axesWidth*/ 6292480) {
|
|
4131
|
-
$$invalidate(1, x = axes.scaleX(xValues, $xLim, $axesWidth));
|
|
4132
|
-
}
|
|
4133
|
-
|
|
4134
|
-
if ($$self.$$.dirty & /*yValues, $yLim, $axesHeight*/ 1574912) {
|
|
4135
|
-
$$invalidate(17, y = axes.scaleY(yValues, $yLim, $axesHeight));
|
|
4136
|
-
}
|
|
4137
|
-
|
|
4138
|
-
if ($$self.$$.dirty & /*x, y*/ 131074) {
|
|
4139
|
-
$$invalidate(3, p = x !== undefined && y !== undefined
|
|
4140
|
-
? x.map((v, i) => `${v},${y[i]}`).join(' ')
|
|
4141
|
-
: undefined);
|
|
4142
|
-
}
|
|
4143
|
-
|
|
4144
|
-
if ($$self.$$.dirty & /*opacity, fillColor, lineColor, lineWidth, $scale, lineType*/ 389120) {
|
|
4145
|
-
$$invalidate(2, areaStyleStr = `opacity:${opacity};fill:${fillColor};stroke:${lineColor};stroke-width: ${lineWidth}px;stroke-dasharray:${axes.LINE_STYLES[$scale][lineType - 1]}`);
|
|
4146
|
-
}
|
|
4147
|
-
};
|
|
4148
|
-
|
|
4149
|
-
return [
|
|
4150
|
-
title,
|
|
4151
|
-
x,
|
|
4152
|
-
areaStyleStr,
|
|
4153
|
-
p,
|
|
4154
|
-
y0,
|
|
4155
|
-
xLim,
|
|
4156
|
-
yLim,
|
|
4157
|
-
axesWidth,
|
|
4158
|
-
axesHeight,
|
|
4159
|
-
scale,
|
|
4160
|
-
xValues,
|
|
4161
|
-
yValues,
|
|
4162
|
-
lineWidth,
|
|
4163
|
-
lineColor,
|
|
4164
|
-
fillColor,
|
|
4165
|
-
opacity,
|
|
4166
|
-
lineType,
|
|
4167
|
-
y,
|
|
4168
|
-
$scale,
|
|
4169
|
-
$axesHeight,
|
|
4170
|
-
$yLim,
|
|
4171
|
-
$axesWidth,
|
|
4172
|
-
$xLim
|
|
4173
|
-
];
|
|
4174
|
-
}
|
|
4175
|
-
|
|
4176
|
-
class AreaSeries extends SvelteComponent {
|
|
4177
|
-
constructor(options) {
|
|
4178
|
-
super();
|
|
4179
|
-
|
|
4180
|
-
init(this, options, instance, create_fragment, safe_not_equal, {
|
|
4181
|
-
xValues: 10,
|
|
4182
|
-
yValues: 11,
|
|
4183
|
-
title: 0,
|
|
4184
|
-
lineWidth: 12,
|
|
4185
|
-
lineColor: 13,
|
|
4186
|
-
fillColor: 14,
|
|
4187
|
-
opacity: 15,
|
|
4188
|
-
lineType: 16
|
|
4189
|
-
});
|
|
4190
|
-
}
|
|
4191
|
-
}
|
|
4192
|
-
|
|
4193
|
-
exports.AreaSeries = AreaSeries;
|
|
4194
|
-
exports.Axes = Axes;
|
|
4195
|
-
exports.BarSeries = BarSeries;
|
|
4196
|
-
exports.Box = Box;
|
|
4197
|
-
exports.Colors = Colors;
|
|
4198
|
-
exports.LineSeries = LineSeries;
|
|
4199
|
-
exports.Rectangles = Rectangles;
|
|
4200
|
-
exports.ScatterSeries = ScatterSeries;
|
|
4201
|
-
exports.Segments = Segments;
|
|
4202
|
-
exports.TextLabels = TextLabels;
|
|
4203
|
-
exports.TextLegend = TextLegend;
|
|
4204
|
-
exports.XAxis = XAxis;
|
|
4205
|
-
exports.YAxis = YAxis;
|
|
4206
|
-
|
|
4207
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4208
|
-
|
|
4209
|
-
}));
|