svelte-plots-basic 1.0.0

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