svelte-plots-basic 1.0.2 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -130,6 +130,10 @@ function space() {
130
130
  function empty() {
131
131
  return text('');
132
132
  }
133
+ function listen(node, event, handler, options) {
134
+ node.addEventListener(event, handler, options);
135
+ return () => node.removeEventListener(event, handler, options);
136
+ }
133
137
  function attr(node, attribute, value) {
134
138
  if (value == null)
135
139
  node.removeAttribute(attribute);
@@ -155,6 +159,11 @@ function set_style(node, key, value, important) {
155
159
  function toggle_class(element, name, toggle) {
156
160
  element.classList[toggle ? 'add' : 'remove'](name);
157
161
  }
162
+ function custom_event(type, detail, bubbles = false) {
163
+ const e = document.createEvent('CustomEvent');
164
+ e.initCustomEvent(type, bubbles, false, detail);
165
+ return e;
166
+ }
158
167
 
159
168
  let current_component;
160
169
  function set_current_component(component) {
@@ -168,6 +177,20 @@ function get_current_component() {
168
177
  function onMount(fn) {
169
178
  get_current_component().$$.on_mount.push(fn);
170
179
  }
180
+ function createEventDispatcher() {
181
+ const component = get_current_component();
182
+ return (type, detail) => {
183
+ const callbacks = component.$$.callbacks[type];
184
+ if (callbacks) {
185
+ // TODO are there situations where events could be dispatched
186
+ // in a server (non-DOM) environment?
187
+ const event = custom_event(type, detail);
188
+ callbacks.slice().forEach(fn => {
189
+ fn.call(component, event);
190
+ });
191
+ }
192
+ };
193
+ }
171
194
  function setContext(key, context) {
172
195
  get_current_component().$$.context.set(key, context);
173
196
  }
@@ -472,8 +495,8 @@ function writable(value, start = noop) {
472
495
 
473
496
  /* src/Axes.svelte generated by Svelte v3.46.3 */
474
497
 
475
- function add_css$2(target) {
476
- 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}");
498
+ function add_css$3(target) {
499
+ append_styles(target, "svelte-n80kcc", ".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.svelte-n80kcc{grid-area:axes;position:relative;box-sizing:border-box;display:flex;width:100%;height:100%;padding:0;margin:0}.axes{display:block;box-sizing:border-box;position:absolute;padding:0;margin:0;height:100%;width:100%;max-height:100%;max-width:100%;min-height:100%;min-width:100%}.axes__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}");
477
500
  }
478
501
 
479
502
  const get_box_slot_changes = dirty => ({});
@@ -483,7 +506,7 @@ const get_yaxis_slot_context = ctx => ({});
483
506
  const get_xaxis_slot_changes = dirty => ({});
484
507
  const get_xaxis_slot_context = ctx => ({});
485
508
 
486
- // (313:3) {#if title !== ""}
509
+ // (338:3) {#if title !== ""}
487
510
  function create_if_block_3(ctx) {
488
511
  let div;
489
512
 
@@ -504,7 +527,7 @@ function create_if_block_3(ctx) {
504
527
  };
505
528
  }
506
529
 
507
- // (314:3) {#if yLabel !== ""}
530
+ // (339:3) {#if yLabel !== ""}
508
531
  function create_if_block_2(ctx) {
509
532
  let div;
510
533
  let span;
@@ -528,7 +551,7 @@ function create_if_block_2(ctx) {
528
551
  };
529
552
  }
530
553
 
531
- // (315:3) {#if xLabel !== ""}
554
+ // (340:3) {#if xLabel !== ""}
532
555
  function create_if_block_1(ctx) {
533
556
  let div;
534
557
  let span;
@@ -552,7 +575,7 @@ function create_if_block_1(ctx) {
552
575
  };
553
576
  }
554
577
 
555
- // (343:3) {#if !$isOk}
578
+ // (368:3) {#if !$isOk}
556
579
  function create_if_block$9(ctx) {
557
580
  let p;
558
581
 
@@ -592,17 +615,19 @@ function create_fragment$b(ctx) {
592
615
  let t3;
593
616
  let div1_class_value;
594
617
  let current;
618
+ let mounted;
619
+ let dispose;
595
620
  let if_block0 = /*title*/ ctx[0] !== "" && create_if_block_3(ctx);
596
621
  let if_block1 = /*yLabel*/ ctx[2] !== "" && create_if_block_2(ctx);
597
622
  let if_block2 = /*xLabel*/ ctx[1] !== "" && create_if_block_1(ctx);
598
- const xaxis_slot_template = /*#slots*/ ctx[25].xaxis;
599
- const xaxis_slot = create_slot(xaxis_slot_template, ctx, /*$$scope*/ ctx[24], get_xaxis_slot_context);
600
- const yaxis_slot_template = /*#slots*/ ctx[25].yaxis;
601
- const yaxis_slot = create_slot(yaxis_slot_template, ctx, /*$$scope*/ ctx[24], get_yaxis_slot_context);
602
- const default_slot_template = /*#slots*/ ctx[25].default;
603
- const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[24], null);
604
- const box_slot_template = /*#slots*/ ctx[25].box;
605
- const box_slot = create_slot(box_slot_template, ctx, /*$$scope*/ ctx[24], get_box_slot_context);
623
+ const xaxis_slot_template = /*#slots*/ ctx[26].xaxis;
624
+ const xaxis_slot = create_slot(xaxis_slot_template, ctx, /*$$scope*/ ctx[25], get_xaxis_slot_context);
625
+ const yaxis_slot_template = /*#slots*/ ctx[26].yaxis;
626
+ const yaxis_slot = create_slot(yaxis_slot_template, ctx, /*$$scope*/ ctx[25], get_yaxis_slot_context);
627
+ const default_slot_template = /*#slots*/ ctx[26].default;
628
+ const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[25], null);
629
+ const box_slot_template = /*#slots*/ ctx[26].box;
630
+ const box_slot = create_slot(box_slot_template, ctx, /*$$scope*/ ctx[25], get_box_slot_context);
606
631
  let if_block3 = !/*$isOk*/ ctx[3] && create_if_block$9();
607
632
 
608
633
  return {
@@ -626,6 +651,7 @@ function create_fragment$b(ctx) {
626
651
  if (box_slot) box_slot.c();
627
652
  t3 = space();
628
653
  if (if_block3) if_block3.c();
654
+ set_style(rect, "pointer-events", "none");
629
655
  attr(rect, "x", rect_x_value = /*cpx*/ ctx[7][0]);
630
656
  attr(rect, "y", rect_y_value = /*cpy*/ ctx[6][1]);
631
657
  attr(rect, "width", rect_width_value = /*cpx*/ ctx[7][1] - /*cpx*/ ctx[7][0]);
@@ -634,8 +660,8 @@ function create_fragment$b(ctx) {
634
660
  attr(g, "clip-path", "url(#" + /*clipPathID*/ ctx[8] + ")");
635
661
  attr(svg, "preserveAspectRatio", "none");
636
662
  attr(svg, "class", "axes");
637
- attr(div0, "class", "axes-wrapper");
638
- attr(div1, "class", div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]));
663
+ attr(div0, "class", "axes-wrapper svelte-n80kcc");
664
+ attr(div1, "class", div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-n80kcc");
639
665
  toggle_class(div1, "plot_error", !/*$isOk*/ ctx[3]);
640
666
  },
641
667
  m(target, anchor) {
@@ -670,10 +696,15 @@ function create_fragment$b(ctx) {
670
696
  box_slot.m(svg, null);
671
697
  }
672
698
 
673
- /*div0_binding*/ ctx[26](div0);
699
+ /*div0_binding*/ ctx[27](div0);
674
700
  append(div1, t3);
675
701
  if (if_block3) if_block3.m(div1, null);
676
702
  current = true;
703
+
704
+ if (!mounted) {
705
+ dispose = listen(svg, "click", /*handleClick*/ ctx[15]);
706
+ mounted = true;
707
+ }
677
708
  },
678
709
  p(ctx, dirty) {
679
710
  if (/*title*/ ctx[0] !== "") {
@@ -732,60 +763,60 @@ function create_fragment$b(ctx) {
732
763
  }
733
764
 
734
765
  if (xaxis_slot) {
735
- if (xaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
766
+ if (xaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 33554432)) {
736
767
  update_slot_base(
737
768
  xaxis_slot,
738
769
  xaxis_slot_template,
739
770
  ctx,
740
- /*$$scope*/ ctx[24],
771
+ /*$$scope*/ ctx[25],
741
772
  !current
742
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
743
- : get_slot_changes(xaxis_slot_template, /*$$scope*/ ctx[24], dirty, get_xaxis_slot_changes),
773
+ ? get_all_dirty_from_scope(/*$$scope*/ ctx[25])
774
+ : get_slot_changes(xaxis_slot_template, /*$$scope*/ ctx[25], dirty, get_xaxis_slot_changes),
744
775
  get_xaxis_slot_context
745
776
  );
746
777
  }
747
778
  }
748
779
 
749
780
  if (yaxis_slot) {
750
- if (yaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
781
+ if (yaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 33554432)) {
751
782
  update_slot_base(
752
783
  yaxis_slot,
753
784
  yaxis_slot_template,
754
785
  ctx,
755
- /*$$scope*/ ctx[24],
786
+ /*$$scope*/ ctx[25],
756
787
  !current
757
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
758
- : get_slot_changes(yaxis_slot_template, /*$$scope*/ ctx[24], dirty, get_yaxis_slot_changes),
788
+ ? get_all_dirty_from_scope(/*$$scope*/ ctx[25])
789
+ : get_slot_changes(yaxis_slot_template, /*$$scope*/ ctx[25], dirty, get_yaxis_slot_changes),
759
790
  get_yaxis_slot_context
760
791
  );
761
792
  }
762
793
  }
763
794
 
764
795
  if (default_slot) {
765
- if (default_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
796
+ if (default_slot.p && (!current || dirty[0] & /*$$scope*/ 33554432)) {
766
797
  update_slot_base(
767
798
  default_slot,
768
799
  default_slot_template,
769
800
  ctx,
770
- /*$$scope*/ ctx[24],
801
+ /*$$scope*/ ctx[25],
771
802
  !current
772
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
773
- : get_slot_changes(default_slot_template, /*$$scope*/ ctx[24], dirty, null),
803
+ ? get_all_dirty_from_scope(/*$$scope*/ ctx[25])
804
+ : get_slot_changes(default_slot_template, /*$$scope*/ ctx[25], dirty, null),
774
805
  null
775
806
  );
776
807
  }
777
808
  }
778
809
 
779
810
  if (box_slot) {
780
- if (box_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
811
+ if (box_slot.p && (!current || dirty[0] & /*$$scope*/ 33554432)) {
781
812
  update_slot_base(
782
813
  box_slot,
783
814
  box_slot_template,
784
815
  ctx,
785
- /*$$scope*/ ctx[24],
816
+ /*$$scope*/ ctx[25],
786
817
  !current
787
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
788
- : get_slot_changes(box_slot_template, /*$$scope*/ ctx[24], dirty, get_box_slot_changes),
818
+ ? get_all_dirty_from_scope(/*$$scope*/ ctx[25])
819
+ : get_slot_changes(box_slot_template, /*$$scope*/ ctx[25], dirty, get_box_slot_changes),
789
820
  get_box_slot_context
790
821
  );
791
822
  }
@@ -802,7 +833,7 @@ function create_fragment$b(ctx) {
802
833
  if_block3 = null;
803
834
  }
804
835
 
805
- if (!current || dirty[0] & /*$scale*/ 16 && div1_class_value !== (div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]))) {
836
+ if (!current || dirty[0] & /*$scale*/ 16 && div1_class_value !== (div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-n80kcc")) {
806
837
  attr(div1, "class", div1_class_value);
807
838
  }
808
839
 
@@ -834,8 +865,10 @@ function create_fragment$b(ctx) {
834
865
  if (yaxis_slot) yaxis_slot.d(detaching);
835
866
  if (default_slot) default_slot.d(detaching);
836
867
  if (box_slot) box_slot.d(detaching);
837
- /*div0_binding*/ ctx[26](null);
868
+ /*div0_binding*/ ctx[27](null);
838
869
  if (if_block3) if_block3.d();
870
+ mounted = false;
871
+ dispose();
839
872
  }
840
873
  };
841
874
  }
@@ -883,7 +916,9 @@ function instance$b($$self, $$props, $$invalidate) {
883
916
  let { yLabel = "" } = $$props;
884
917
  let { multiSeries = true } = $$props;
885
918
 
886
- /* constants for internal use */
919
+ // event dispatcher
920
+ const dispatch = createEventDispatcher();
921
+
887
922
  // how big are margins (number of pixels in unit margin value) between axis and plot area if axis are shown
888
923
  const AXES_MARGIN_FACTORS = { "small": 30, "medium": 40, "large": 50 };
889
924
 
@@ -911,13 +946,13 @@ function instance$b($$self, $$props, $$invalidate) {
911
946
  /* reactive parameters to be shared with children via context */
912
947
  const width = writable(100); // actual width of plotting area in pixels
913
948
 
914
- component_subscribe($$self, width, value => $$invalidate(22, $width = value));
949
+ component_subscribe($$self, width, value => $$invalidate(23, $width = value));
915
950
  const height = writable(100); // actual height of plotting area in pixels
916
- component_subscribe($$self, height, value => $$invalidate(20, $height = value));
951
+ component_subscribe($$self, height, value => $$invalidate(21, $height = value));
917
952
  const xLim = writable([undefined, undefined]); // actual limits for x-axis in plot units
918
- component_subscribe($$self, xLim, value => $$invalidate(23, $xLim = value));
953
+ component_subscribe($$self, xLim, value => $$invalidate(24, $xLim = value));
919
954
  const yLim = writable([undefined, undefined]); // actual limits for y-axis in plot units
920
- component_subscribe($$self, yLim, value => $$invalidate(21, $yLim = value));
955
+ component_subscribe($$self, yLim, value => $$invalidate(22, $yLim = value));
921
956
  const scale = writable("medium"); // scale factor (how big the shown plot is)
922
957
  component_subscribe($$self, scale, value => $$invalidate(4, $scale = value));
923
958
  const isOk = writable(false); // are axes ready for drawing
@@ -925,18 +960,18 @@ function instance$b($$self, $$props, $$invalidate) {
925
960
 
926
961
  /** Adds margins for x-axis (e.g. when x-axis must be shown) */
927
962
  const addXAxisMargins = function () {
928
- $$invalidate(18, axesMargins[0] = 1, axesMargins);
929
- $$invalidate(18, axesMargins[2] = 0.5, axesMargins);
930
- $$invalidate(18, axesMargins[1] = axesMargins[1] > 0.5 ? axesMargins[1] : 0.5, axesMargins);
931
- $$invalidate(18, axesMargins[3] = axesMargins[3] > 0.5 ? axesMargins[3] : 0.5, axesMargins);
963
+ $$invalidate(19, axesMargins[0] = 1, axesMargins);
964
+ $$invalidate(19, axesMargins[2] = 0.5, axesMargins);
965
+ $$invalidate(19, axesMargins[1] = axesMargins[1] > 0.5 ? axesMargins[1] : 0.5, axesMargins);
966
+ $$invalidate(19, axesMargins[3] = axesMargins[3] > 0.5 ? axesMargins[3] : 0.5, axesMargins);
932
967
  };
933
968
 
934
969
  /** Adds margins for y-axis (e.g. when y-axis must be shown) */
935
970
  const addYAxisMargins = function () {
936
- $$invalidate(18, axesMargins[1] = 1, axesMargins);
937
- $$invalidate(18, axesMargins[3] = 0.5, axesMargins);
938
- $$invalidate(18, axesMargins[0] = axesMargins[0] > 0.5 ? axesMargins[0] : 0.5, axesMargins);
939
- $$invalidate(18, axesMargins[2] = axesMargins[2] > 0.5 ? axesMargins[2] : 0.5, axesMargins);
971
+ $$invalidate(19, axesMargins[1] = 1, axesMargins);
972
+ $$invalidate(19, axesMargins[3] = 0.5, axesMargins);
973
+ $$invalidate(19, axesMargins[0] = axesMargins[0] > 0.5 ? axesMargins[0] : 0.5, axesMargins);
974
+ $$invalidate(19, axesMargins[2] = axesMargins[2] > 0.5 ? axesMargins[2] : 0.5, axesMargins);
940
975
  };
941
976
 
942
977
  /** Adjusts limits for x-axis (e.g. when new series is added)
@@ -1099,6 +1134,31 @@ function instance$b($$self, $$props, $$invalidate) {
1099
1134
  ro.observe(axesWrapper);
1100
1135
  });
1101
1136
 
1137
+ // handle click on plot elements and dispatch manual events
1138
+ function dispatchClickEvent(eventName, el) {
1139
+ dispatch(eventName, {
1140
+ seriesTitle: el.parentNode.getAttribute('title'),
1141
+ elementID: el.dataset.id
1142
+ });
1143
+ }
1144
+
1145
+ function handleClick(e) {
1146
+ // scatter plot markers
1147
+ if (e.target.tagName === "text" && e.target.parentNode.classList.contains("series_scatter")) {
1148
+ dispatchClickEvent("markerclick", e.target);
1149
+ return;
1150
+ }
1151
+
1152
+ // bar plot bars
1153
+ if (e.target.tagName === "rect" && e.target.parentNode.classList.contains("series_bar")) {
1154
+ dispatchClickEvent("barclick", e.target);
1155
+ return;
1156
+ }
1157
+
1158
+ // outside any plot element
1159
+ dispatch("axesclick");
1160
+ }
1161
+
1102
1162
  function div0_binding($$value) {
1103
1163
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
1104
1164
  axesWrapper = $$value;
@@ -1107,42 +1167,42 @@ function instance$b($$self, $$props, $$invalidate) {
1107
1167
  }
1108
1168
 
1109
1169
  $$self.$$set = $$props => {
1110
- if ('limX' in $$props) $$invalidate(15, limX = $$props.limX);
1111
- if ('limY' in $$props) $$invalidate(16, limY = $$props.limY);
1170
+ if ('limX' in $$props) $$invalidate(16, limX = $$props.limX);
1171
+ if ('limY' in $$props) $$invalidate(17, limY = $$props.limY);
1112
1172
  if ('title' in $$props) $$invalidate(0, title = $$props.title);
1113
1173
  if ('xLabel' in $$props) $$invalidate(1, xLabel = $$props.xLabel);
1114
1174
  if ('yLabel' in $$props) $$invalidate(2, yLabel = $$props.yLabel);
1115
- if ('multiSeries' in $$props) $$invalidate(17, multiSeries = $$props.multiSeries);
1116
- if ('$$scope' in $$props) $$invalidate(24, $$scope = $$props.$$scope);
1175
+ if ('multiSeries' in $$props) $$invalidate(18, multiSeries = $$props.multiSeries);
1176
+ if ('$$scope' in $$props) $$invalidate(25, $$scope = $$props.$$scope);
1117
1177
  };
1118
1178
 
1119
1179
  $$self.$$.update = () => {
1120
- if ($$self.$$.dirty[0] & /*limX*/ 32768) {
1180
+ if ($$self.$$.dirty[0] & /*limX*/ 65536) {
1121
1181
  // this is reactive in case if limX and limY are interactively changed by parent script
1122
1182
  if (!limX.some(v => v === undefined)) xLim.update(v => limX);
1123
1183
  }
1124
1184
 
1125
- if ($$self.$$.dirty[0] & /*limY*/ 65536) {
1185
+ if ($$self.$$.dirty[0] & /*limY*/ 131072) {
1126
1186
  if (!limY.some(v => v === undefined)) yLim.update(v => limY);
1127
1187
  }
1128
1188
 
1129
- if ($$self.$$.dirty[0] & /*axesMargins, $scale*/ 262160) {
1189
+ if ($$self.$$.dirty[0] & /*axesMargins, $scale*/ 524304) {
1130
1190
  // computes real margins in pixels based on current scale
1131
- $$invalidate(19, margins = axesMargins.map(v => v * AXES_MARGIN_FACTORS[$scale]));
1191
+ $$invalidate(20, margins = axesMargins.map(v => v * AXES_MARGIN_FACTORS[$scale]));
1132
1192
  }
1133
1193
 
1134
- if ($$self.$$.dirty[0] & /*$yLim, $xLim, $width, margins, $height*/ 16252928) {
1194
+ if ($$self.$$.dirty[0] & /*$yLim, $xLim, $width, margins, $height*/ 32505856) {
1135
1195
  // computes status which tells that axes limits look fine and it is safe to draw
1136
1196
  // the status is based on the axis limits validity
1137
1197
  isOk.update(v => Array.isArray($yLim) && Array.isArray($xLim) && $xLim.length === 2 && $yLim.length === 2 && !$yLim.some(v => v === undefined) && !$xLim.some(v => v === undefined) && !$yLim.some(v => isNaN(v)) && !$xLim.some(v => isNaN(v)) && $xLim[1] !== $xLim[0] && $yLim[1] !== $yLim[0] && $width > margins[1] + margins[3] && $height > margins[0] + margins[2]);
1138
1198
  }
1139
1199
 
1140
- if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/ 12582920) {
1200
+ if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/ 25165832) {
1141
1201
  // computes coordinates for clip path box
1142
1202
  $$invalidate(7, cpx = $isOk ? scaleX($xLim, $xLim, $width) : [0, 1]);
1143
1203
  }
1144
1204
 
1145
- if ($$self.$$.dirty[0] & /*$isOk, $yLim, $height*/ 3145736) {
1205
+ if ($$self.$$.dirty[0] & /*$isOk, $yLim, $height*/ 6291464) {
1146
1206
  $$invalidate(6, cpy = $isOk ? scaleY($yLim, $yLim, $height) : [1, 0]);
1147
1207
  }
1148
1208
  };
@@ -1163,6 +1223,7 @@ function instance$b($$self, $$props, $$invalidate) {
1163
1223
  yLim,
1164
1224
  scale,
1165
1225
  isOk,
1226
+ handleClick,
1166
1227
  limX,
1167
1228
  limY,
1168
1229
  multiSeries,
@@ -1189,14 +1250,14 @@ class Axes extends SvelteComponent {
1189
1250
  create_fragment$b,
1190
1251
  safe_not_equal,
1191
1252
  {
1192
- limX: 15,
1193
- limY: 16,
1253
+ limX: 16,
1254
+ limY: 17,
1194
1255
  title: 0,
1195
1256
  xLabel: 1,
1196
1257
  yLabel: 2,
1197
- multiSeries: 17
1258
+ multiSeries: 18
1198
1259
  },
1199
- add_css$2,
1260
+ add_css$3,
1200
1261
  [-1, -1]
1201
1262
  );
1202
1263
  }
@@ -1986,14 +2047,15 @@ class YAxis extends SvelteComponent {
1986
2047
 
1987
2048
  function get_each_context$3(ctx, list, i) {
1988
2049
  const child_ctx = ctx.slice();
1989
- child_ctx[23] = list[i];
1990
- child_ctx[25] = i;
2050
+ child_ctx[25] = list[i];
2051
+ child_ctx[27] = i;
1991
2052
  return child_ctx;
1992
2053
  }
1993
2054
 
1994
- // (51:0) {#if rx !== undefined && ry !== undefined}
2055
+ // (53:0) {#if rx !== undefined && ry !== undefined}
1995
2056
  function create_if_block$6(ctx) {
1996
- let each_1_anchor;
2057
+ let g;
2058
+ let g_class_value;
1997
2059
  let each_value = /*left*/ ctx[0];
1998
2060
  let each_blocks = [];
1999
2061
 
@@ -2003,21 +2065,25 @@ function create_if_block$6(ctx) {
2003
2065
 
2004
2066
  return {
2005
2067
  c() {
2068
+ g = svg_element("g");
2069
+
2006
2070
  for (let i = 0; i < each_blocks.length; i += 1) {
2007
2071
  each_blocks[i].c();
2008
2072
  }
2009
2073
 
2010
- each_1_anchor = empty();
2074
+ attr(g, "class", g_class_value = "series " + /*style*/ ctx[2]);
2075
+ attr(g, "title", /*title*/ ctx[1]);
2076
+ attr(g, "style", /*barsStyleStr*/ ctx[7]);
2011
2077
  },
2012
2078
  m(target, anchor) {
2079
+ insert(target, g, anchor);
2080
+
2013
2081
  for (let i = 0; i < each_blocks.length; i += 1) {
2014
- each_blocks[i].m(target, anchor);
2082
+ each_blocks[i].m(g, null);
2015
2083
  }
2016
-
2017
- insert(target, each_1_anchor, anchor);
2018
2084
  },
2019
2085
  p(ctx, dirty) {
2020
- if (dirty & /*rx, ry, rw, rh, barsStyleStr, left*/ 63) {
2086
+ if (dirty & /*rx, ry, rw, rh, left*/ 121) {
2021
2087
  each_value = /*left*/ ctx[0];
2022
2088
  let i;
2023
2089
 
@@ -2029,7 +2095,7 @@ function create_if_block$6(ctx) {
2029
2095
  } else {
2030
2096
  each_blocks[i] = create_each_block$3(child_ctx);
2031
2097
  each_blocks[i].c();
2032
- each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
2098
+ each_blocks[i].m(g, null);
2033
2099
  }
2034
2100
  }
2035
2101
 
@@ -2039,15 +2105,23 @@ function create_if_block$6(ctx) {
2039
2105
 
2040
2106
  each_blocks.length = each_value.length;
2041
2107
  }
2108
+
2109
+ if (dirty & /*style*/ 4 && g_class_value !== (g_class_value = "series " + /*style*/ ctx[2])) {
2110
+ attr(g, "class", g_class_value);
2111
+ }
2112
+
2113
+ if (dirty & /*title*/ 2) {
2114
+ attr(g, "title", /*title*/ ctx[1]);
2115
+ }
2042
2116
  },
2043
2117
  d(detaching) {
2118
+ if (detaching) detach(g);
2044
2119
  destroy_each(each_blocks, detaching);
2045
- if (detaching) detach(each_1_anchor);
2046
2120
  }
2047
2121
  };
2048
2122
  }
2049
2123
 
2050
- // (52:3) {#each left as v, i}
2124
+ // (55:3) {#each left as v, i}
2051
2125
  function create_each_block$3(ctx) {
2052
2126
  let rect;
2053
2127
  let rect_x_value;
@@ -2058,29 +2132,28 @@ function create_each_block$3(ctx) {
2058
2132
  return {
2059
2133
  c() {
2060
2134
  rect = svg_element("rect");
2061
- attr(rect, "x", rect_x_value = /*rx*/ ctx[4][/*i*/ ctx[25]]);
2062
- attr(rect, "y", rect_y_value = /*ry*/ ctx[3][/*i*/ ctx[25]]);
2063
- attr(rect, "width", rect_width_value = /*rw*/ ctx[2][/*i*/ ctx[25]]);
2064
- attr(rect, "height", rect_height_value = /*rh*/ ctx[1][/*i*/ ctx[25]]);
2065
- attr(rect, "style", /*barsStyleStr*/ ctx[5]);
2135
+ attr(rect, "x", rect_x_value = /*rx*/ ctx[6][/*i*/ ctx[27]]);
2136
+ attr(rect, "y", rect_y_value = /*ry*/ ctx[5][/*i*/ ctx[27]]);
2137
+ attr(rect, "width", rect_width_value = /*rw*/ ctx[4][/*i*/ ctx[27]]);
2138
+ attr(rect, "height", rect_height_value = /*rh*/ ctx[3][/*i*/ ctx[27]]);
2066
2139
  },
2067
2140
  m(target, anchor) {
2068
2141
  insert(target, rect, anchor);
2069
2142
  },
2070
2143
  p(ctx, dirty) {
2071
- if (dirty & /*rx*/ 16 && rect_x_value !== (rect_x_value = /*rx*/ ctx[4][/*i*/ ctx[25]])) {
2144
+ if (dirty & /*rx*/ 64 && rect_x_value !== (rect_x_value = /*rx*/ ctx[6][/*i*/ ctx[27]])) {
2072
2145
  attr(rect, "x", rect_x_value);
2073
2146
  }
2074
2147
 
2075
- if (dirty & /*ry*/ 8 && rect_y_value !== (rect_y_value = /*ry*/ ctx[3][/*i*/ ctx[25]])) {
2148
+ if (dirty & /*ry*/ 32 && rect_y_value !== (rect_y_value = /*ry*/ ctx[5][/*i*/ ctx[27]])) {
2076
2149
  attr(rect, "y", rect_y_value);
2077
2150
  }
2078
2151
 
2079
- if (dirty & /*rw*/ 4 && rect_width_value !== (rect_width_value = /*rw*/ ctx[2][/*i*/ ctx[25]])) {
2152
+ if (dirty & /*rw*/ 16 && rect_width_value !== (rect_width_value = /*rw*/ ctx[4][/*i*/ ctx[27]])) {
2080
2153
  attr(rect, "width", rect_width_value);
2081
2154
  }
2082
2155
 
2083
- if (dirty & /*rh*/ 2 && rect_height_value !== (rect_height_value = /*rh*/ ctx[1][/*i*/ ctx[25]])) {
2156
+ if (dirty & /*rh*/ 8 && rect_height_value !== (rect_height_value = /*rh*/ ctx[3][/*i*/ ctx[27]])) {
2084
2157
  attr(rect, "height", rect_height_value);
2085
2158
  }
2086
2159
  },
@@ -2092,7 +2165,7 @@ function create_each_block$3(ctx) {
2092
2165
 
2093
2166
  function create_fragment$8(ctx) {
2094
2167
  let if_block_anchor;
2095
- let if_block = /*rx*/ ctx[4] !== undefined && /*ry*/ ctx[3] !== undefined && create_if_block$6(ctx);
2168
+ let if_block = /*rx*/ ctx[6] !== undefined && /*ry*/ ctx[5] !== undefined && create_if_block$6(ctx);
2096
2169
 
2097
2170
  return {
2098
2171
  c() {
@@ -2104,7 +2177,7 @@ function create_fragment$8(ctx) {
2104
2177
  insert(target, if_block_anchor, anchor);
2105
2178
  },
2106
2179
  p(ctx, [dirty]) {
2107
- if (/*rx*/ ctx[4] !== undefined && /*ry*/ ctx[3] !== undefined) {
2180
+ if (/*rx*/ ctx[6] !== undefined && /*ry*/ ctx[5] !== undefined) {
2108
2181
  if (if_block) {
2109
2182
  if_block.p(ctx, dirty);
2110
2183
  } else {
@@ -2143,6 +2216,8 @@ function instance$8($$self, $$props, $$invalidate) {
2143
2216
  let { faceColor = Colors.PRIMARY } = $$props;
2144
2217
  let { borderColor = faceColor } = $$props;
2145
2218
  let { lineWidth = 1 } = $$props;
2219
+ let { title = "" } = $$props;
2220
+ let { style = "series_rect" } = $$props;
2146
2221
 
2147
2222
  // styles for bars and labels
2148
2223
  const barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`;
@@ -2171,46 +2246,50 @@ function instance$8($$self, $$props, $$invalidate) {
2171
2246
  const axes = getContext('axes');
2172
2247
 
2173
2248
  const xLim = axes.xLim;
2174
- component_subscribe($$self, xLim, value => $$invalidate(20, $xLim = value));
2249
+ component_subscribe($$self, xLim, value => $$invalidate(22, $xLim = value));
2175
2250
  const yLim = axes.yLim;
2176
- component_subscribe($$self, yLim, value => $$invalidate(18, $yLim = value));
2251
+ component_subscribe($$self, yLim, value => $$invalidate(20, $yLim = value));
2177
2252
  const axesWidth = axes.width;
2178
- component_subscribe($$self, axesWidth, value => $$invalidate(19, $axesWidth = value));
2253
+ component_subscribe($$self, axesWidth, value => $$invalidate(21, $axesWidth = value));
2179
2254
  const axesHeight = axes.height;
2180
- component_subscribe($$self, axesHeight, value => $$invalidate(17, $axesHeight = value));
2255
+ component_subscribe($$self, axesHeight, value => $$invalidate(19, $axesHeight = value));
2181
2256
 
2182
2257
  $$self.$$set = $$props => {
2183
2258
  if ('left' in $$props) $$invalidate(0, left = $$props.left);
2184
- if ('top' in $$props) $$invalidate(12, top = $$props.top);
2185
- if ('width' in $$props) $$invalidate(10, width = $$props.width);
2186
- if ('height' in $$props) $$invalidate(11, height = $$props.height);
2187
- if ('labels' in $$props) $$invalidate(13, labels = $$props.labels);
2188
- if ('faceColor' in $$props) $$invalidate(14, faceColor = $$props.faceColor);
2189
- if ('borderColor' in $$props) $$invalidate(15, borderColor = $$props.borderColor);
2190
- if ('lineWidth' in $$props) $$invalidate(16, lineWidth = $$props.lineWidth);
2259
+ if ('top' in $$props) $$invalidate(14, top = $$props.top);
2260
+ if ('width' in $$props) $$invalidate(12, width = $$props.width);
2261
+ if ('height' in $$props) $$invalidate(13, height = $$props.height);
2262
+ if ('labels' in $$props) $$invalidate(15, labels = $$props.labels);
2263
+ if ('faceColor' in $$props) $$invalidate(16, faceColor = $$props.faceColor);
2264
+ if ('borderColor' in $$props) $$invalidate(17, borderColor = $$props.borderColor);
2265
+ if ('lineWidth' in $$props) $$invalidate(18, lineWidth = $$props.lineWidth);
2266
+ if ('title' in $$props) $$invalidate(1, title = $$props.title);
2267
+ if ('style' in $$props) $$invalidate(2, style = $$props.style);
2191
2268
  };
2192
2269
 
2193
2270
  $$self.$$.update = () => {
2194
- if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 1572865) {
2271
+ if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 6291457) {
2195
2272
  // reactive variables for coordinates of data points in pixels
2196
- $$invalidate(4, rx = axes.scaleX(left, $xLim, $axesWidth));
2273
+ $$invalidate(6, rx = axes.scaleX(left, $xLim, $axesWidth));
2197
2274
  }
2198
2275
 
2199
- if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 397312) {
2200
- $$invalidate(3, ry = axes.scaleY(top, $yLim, $axesHeight));
2276
+ if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 1589248) {
2277
+ $$invalidate(5, ry = axes.scaleY(top, $yLim, $axesHeight));
2201
2278
  }
2202
2279
 
2203
- if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/ 1573888) {
2204
- $$invalidate(2, rw = axes.scaleX(width, $xLim, $axesWidth, true));
2280
+ if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/ 6295552) {
2281
+ $$invalidate(4, rw = axes.scaleX(width, $xLim, $axesWidth, true));
2205
2282
  }
2206
2283
 
2207
- if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/ 395264) {
2208
- $$invalidate(1, rh = axes.scaleY(height, $yLim, $axesHeight, true));
2284
+ if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/ 1581056) {
2285
+ $$invalidate(3, rh = axes.scaleY(height, $yLim, $axesHeight, true));
2209
2286
  }
2210
2287
  };
2211
2288
 
2212
2289
  return [
2213
2290
  left,
2291
+ title,
2292
+ style,
2214
2293
  rh,
2215
2294
  rw,
2216
2295
  ry,
@@ -2240,13 +2319,15 @@ class Rectangles extends SvelteComponent {
2240
2319
 
2241
2320
  init(this, options, instance$8, create_fragment$8, safe_not_equal, {
2242
2321
  left: 0,
2243
- top: 12,
2244
- width: 10,
2245
- height: 11,
2246
- labels: 13,
2247
- faceColor: 14,
2248
- borderColor: 15,
2249
- lineWidth: 16
2322
+ top: 14,
2323
+ width: 12,
2324
+ height: 13,
2325
+ labels: 15,
2326
+ faceColor: 16,
2327
+ borderColor: 17,
2328
+ lineWidth: 18,
2329
+ title: 1,
2330
+ style: 2
2250
2331
  });
2251
2332
  }
2252
2333
  }
@@ -2273,6 +2354,7 @@ function create_if_block$5(ctx) {
2273
2354
  c() {
2274
2355
  g = svg_element("g");
2275
2356
  create_component(rectangles.$$.fragment);
2357
+ set_style(g, "pointer-events", "none");
2276
2358
  attr(g, "class", "mdaplot__axes-box");
2277
2359
  },
2278
2360
  m(target, anchor) {
@@ -2686,17 +2768,22 @@ class Segments extends SvelteComponent {
2686
2768
 
2687
2769
  /* src/TextLabels.svelte generated by Svelte v3.46.3 */
2688
2770
 
2771
+ function add_css$2(target) {
2772
+ append_styles(target, "svelte-1szep8i", "text.svelte-1szep8i{dominant-baseline:middle}");
2773
+ }
2774
+
2689
2775
  function get_each_context$1(ctx, list, i) {
2690
2776
  const child_ctx = ctx.slice();
2691
- child_ctx[25] = list[i];
2692
- child_ctx[27] = i;
2777
+ child_ctx[27] = list[i];
2778
+ child_ctx[29] = i;
2693
2779
  return child_ctx;
2694
2780
  }
2695
2781
 
2696
- // (56:0) {#if x !== undefined && y !== undefined}
2782
+ // (66:0) {#if x !== undefined && y !== undefined}
2697
2783
  function create_if_block$3(ctx) {
2698
- let each_1_anchor;
2699
- let each_value = /*x*/ ctx[6];
2784
+ let g;
2785
+ let g_class_value;
2786
+ let each_value = /*x*/ ctx[7];
2700
2787
  let each_blocks = [];
2701
2788
 
2702
2789
  for (let i = 0; i < each_value.length; i += 1) {
@@ -2705,22 +2792,26 @@ function create_if_block$3(ctx) {
2705
2792
 
2706
2793
  return {
2707
2794
  c() {
2795
+ g = svg_element("g");
2796
+
2708
2797
  for (let i = 0; i < each_blocks.length; i += 1) {
2709
2798
  each_blocks[i].c();
2710
2799
  }
2711
2800
 
2712
- each_1_anchor = empty();
2801
+ attr(g, "class", g_class_value = "series " + /*style*/ ctx[1]);
2802
+ attr(g, "title", /*title*/ ctx[2]);
2803
+ attr(g, "style", /*textStyleStr*/ ctx[3]);
2713
2804
  },
2714
2805
  m(target, anchor) {
2806
+ insert(target, g, anchor);
2807
+
2715
2808
  for (let i = 0; i < each_blocks.length; i += 1) {
2716
- each_blocks[i].m(target, anchor);
2809
+ each_blocks[i].m(g, null);
2717
2810
  }
2718
-
2719
- insert(target, each_1_anchor, anchor);
2720
2811
  },
2721
2812
  p(ctx, dirty) {
2722
- if (dirty & /*textStyleStr, x, y, dx, dy, textAnchors, pos, labels*/ 255) {
2723
- each_value = /*x*/ ctx[6];
2813
+ if (dirty & /*x, y, dx, dy, labels*/ 241) {
2814
+ each_value = /*x*/ ctx[7];
2724
2815
  let i;
2725
2816
 
2726
2817
  for (i = 0; i < each_value.length; i += 1) {
@@ -2731,7 +2822,7 @@ function create_if_block$3(ctx) {
2731
2822
  } else {
2732
2823
  each_blocks[i] = create_each_block$1(child_ctx);
2733
2824
  each_blocks[i].c();
2734
- each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
2825
+ each_blocks[i].m(g, null);
2735
2826
  }
2736
2827
  }
2737
2828
 
@@ -2741,61 +2832,64 @@ function create_if_block$3(ctx) {
2741
2832
 
2742
2833
  each_blocks.length = each_value.length;
2743
2834
  }
2835
+
2836
+ if (dirty & /*style*/ 2 && g_class_value !== (g_class_value = "series " + /*style*/ ctx[1])) {
2837
+ attr(g, "class", g_class_value);
2838
+ }
2839
+
2840
+ if (dirty & /*title*/ 4) {
2841
+ attr(g, "title", /*title*/ ctx[2]);
2842
+ }
2843
+
2844
+ if (dirty & /*textStyleStr*/ 8) {
2845
+ attr(g, "style", /*textStyleStr*/ ctx[3]);
2846
+ }
2744
2847
  },
2745
2848
  d(detaching) {
2849
+ if (detaching) detach(g);
2746
2850
  destroy_each(each_blocks, detaching);
2747
- if (detaching) detach(each_1_anchor);
2748
2851
  }
2749
2852
  };
2750
2853
  }
2751
2854
 
2752
- // (57:3) {#each x as v, i}
2855
+ // (68:3) {#each x as v, i}
2753
2856
  function create_each_block$1(ctx) {
2754
2857
  let text_1;
2755
- let raw_value = /*labels*/ ctx[0][/*i*/ ctx[27]] + "";
2858
+ let raw_value = /*labels*/ ctx[0][/*i*/ ctx[29]] + "";
2859
+ let text_1_data_id_value;
2756
2860
  let text_1_x_value;
2757
2861
  let text_1_y_value;
2758
- let text_1_text_anchor_value;
2759
2862
 
2760
2863
  return {
2761
2864
  c() {
2762
2865
  text_1 = svg_element("text");
2763
- attr(text_1, "style", /*textStyleStr*/ ctx[2]);
2764
- attr(text_1, "x", text_1_x_value = /*x*/ ctx[6][/*i*/ ctx[27]]);
2765
- attr(text_1, "y", text_1_y_value = /*y*/ ctx[5][/*i*/ ctx[27]]);
2766
- attr(text_1, "dx", /*dx*/ ctx[4]);
2767
- attr(text_1, "dy", /*dy*/ ctx[3]);
2768
- attr(text_1, "dominant-baseline", "middle");
2769
- attr(text_1, "text-anchor", text_1_text_anchor_value = /*textAnchors*/ ctx[7][/*pos*/ ctx[1]]);
2866
+ attr(text_1, "data-id", text_1_data_id_value = /*i*/ ctx[29]);
2867
+ attr(text_1, "x", text_1_x_value = /*x*/ ctx[7][/*i*/ ctx[29]]);
2868
+ attr(text_1, "y", text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]]);
2869
+ attr(text_1, "dx", /*dx*/ ctx[5]);
2870
+ attr(text_1, "dy", /*dy*/ ctx[4]);
2871
+ attr(text_1, "class", "svelte-1szep8i");
2770
2872
  },
2771
2873
  m(target, anchor) {
2772
2874
  insert(target, text_1, anchor);
2773
2875
  text_1.innerHTML = raw_value;
2774
2876
  },
2775
2877
  p(ctx, dirty) {
2776
- if (dirty & /*labels*/ 1 && raw_value !== (raw_value = /*labels*/ ctx[0][/*i*/ ctx[27]] + "")) text_1.innerHTML = raw_value;
2777
- if (dirty & /*textStyleStr*/ 4) {
2778
- attr(text_1, "style", /*textStyleStr*/ ctx[2]);
2779
- }
2780
-
2781
- if (dirty & /*x*/ 64 && text_1_x_value !== (text_1_x_value = /*x*/ ctx[6][/*i*/ ctx[27]])) {
2878
+ if (dirty & /*labels*/ 1 && raw_value !== (raw_value = /*labels*/ ctx[0][/*i*/ ctx[29]] + "")) text_1.innerHTML = raw_value;
2879
+ if (dirty & /*x*/ 128 && text_1_x_value !== (text_1_x_value = /*x*/ ctx[7][/*i*/ ctx[29]])) {
2782
2880
  attr(text_1, "x", text_1_x_value);
2783
2881
  }
2784
2882
 
2785
- if (dirty & /*y*/ 32 && text_1_y_value !== (text_1_y_value = /*y*/ ctx[5][/*i*/ ctx[27]])) {
2883
+ if (dirty & /*y*/ 64 && text_1_y_value !== (text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]])) {
2786
2884
  attr(text_1, "y", text_1_y_value);
2787
2885
  }
2788
2886
 
2789
- if (dirty & /*dx*/ 16) {
2790
- attr(text_1, "dx", /*dx*/ ctx[4]);
2791
- }
2792
-
2793
- if (dirty & /*dy*/ 8) {
2794
- attr(text_1, "dy", /*dy*/ ctx[3]);
2887
+ if (dirty & /*dx*/ 32) {
2888
+ attr(text_1, "dx", /*dx*/ ctx[5]);
2795
2889
  }
2796
2890
 
2797
- if (dirty & /*pos*/ 2 && text_1_text_anchor_value !== (text_1_text_anchor_value = /*textAnchors*/ ctx[7][/*pos*/ ctx[1]])) {
2798
- attr(text_1, "text-anchor", text_1_text_anchor_value);
2891
+ if (dirty & /*dy*/ 16) {
2892
+ attr(text_1, "dy", /*dy*/ ctx[4]);
2799
2893
  }
2800
2894
  },
2801
2895
  d(detaching) {
@@ -2806,7 +2900,7 @@ function create_each_block$1(ctx) {
2806
2900
 
2807
2901
  function create_fragment$5(ctx) {
2808
2902
  let if_block_anchor;
2809
- let if_block = /*x*/ ctx[6] !== undefined && /*y*/ ctx[5] !== undefined && create_if_block$3(ctx);
2903
+ let if_block = /*x*/ ctx[7] !== undefined && /*y*/ ctx[6] !== undefined && create_if_block$3(ctx);
2810
2904
 
2811
2905
  return {
2812
2906
  c() {
@@ -2818,7 +2912,7 @@ function create_fragment$5(ctx) {
2818
2912
  insert(target, if_block_anchor, anchor);
2819
2913
  },
2820
2914
  p(ctx, [dirty]) {
2821
- if (/*x*/ ctx[6] !== undefined && /*y*/ ctx[5] !== undefined) {
2915
+ if (/*x*/ ctx[7] !== undefined && /*y*/ ctx[6] !== undefined) {
2822
2916
  if (if_block) {
2823
2917
  if_block.p(ctx, dirty);
2824
2918
  } else {
@@ -2859,11 +2953,13 @@ function instance$5($$self, $$props, $$invalidate) {
2859
2953
  let { borderColor = "transparent" } = $$props;
2860
2954
  let { borderWidth = 0 } = $$props;
2861
2955
  let { textSize = 1 } = $$props;
2956
+ let { style = "" } = $$props;
2957
+ let { title = "series_text" } = $$props;
2862
2958
 
2863
2959
  // text-anchor values depending on position
2864
2960
  const textAnchors = ["middle", "middle", "start", "middle", "end"];
2865
2961
 
2866
- /* sanity check for input parameters */
2962
+ // sanity check for input parameters
2867
2963
  if (!Array.isArray(xValues) || !Array.isArray(yValues) || xValues.length !== yValues.length) {
2868
2964
  throw "TextLabels: parameters 'xValues' and 'yValues' must be vectors of the same length.";
2869
2965
  }
@@ -2872,30 +2968,32 @@ function instance$5($$self, $$props, $$invalidate) {
2872
2968
  const axes = getContext('axes');
2873
2969
 
2874
2970
  const xLim = axes.xLim;
2875
- component_subscribe($$self, xLim, value => $$invalidate(23, $xLim = value));
2971
+ component_subscribe($$self, xLim, value => $$invalidate(24, $xLim = value));
2876
2972
  const yLim = axes.yLim;
2877
- component_subscribe($$self, yLim, value => $$invalidate(21, $yLim = value));
2973
+ component_subscribe($$self, yLim, value => $$invalidate(22, $yLim = value));
2878
2974
  const axesWidth = axes.width;
2879
- component_subscribe($$self, axesWidth, value => $$invalidate(22, $axesWidth = value));
2975
+ component_subscribe($$self, axesWidth, value => $$invalidate(23, $axesWidth = value));
2880
2976
  const axesHeight = axes.height;
2881
- component_subscribe($$self, axesHeight, value => $$invalidate(20, $axesHeight = value));
2977
+ component_subscribe($$self, axesHeight, value => $$invalidate(21, $axesHeight = value));
2882
2978
  const scale = axes.scale;
2883
- component_subscribe($$self, scale, value => $$invalidate(19, $scale = value));
2979
+ component_subscribe($$self, scale, value => $$invalidate(20, $scale = value));
2884
2980
 
2885
2981
  $$self.$$set = $$props => {
2886
2982
  if ('xValues' in $$props) $$invalidate(13, xValues = $$props.xValues);
2887
2983
  if ('yValues' in $$props) $$invalidate(14, yValues = $$props.yValues);
2888
2984
  if ('labels' in $$props) $$invalidate(0, labels = $$props.labels);
2889
- if ('pos' in $$props) $$invalidate(1, pos = $$props.pos);
2890
- if ('faceColor' in $$props) $$invalidate(15, faceColor = $$props.faceColor);
2891
- if ('borderColor' in $$props) $$invalidate(16, borderColor = $$props.borderColor);
2892
- if ('borderWidth' in $$props) $$invalidate(17, borderWidth = $$props.borderWidth);
2893
- if ('textSize' in $$props) $$invalidate(18, textSize = $$props.textSize);
2985
+ if ('pos' in $$props) $$invalidate(15, pos = $$props.pos);
2986
+ if ('faceColor' in $$props) $$invalidate(16, faceColor = $$props.faceColor);
2987
+ if ('borderColor' in $$props) $$invalidate(17, borderColor = $$props.borderColor);
2988
+ if ('borderWidth' in $$props) $$invalidate(18, borderWidth = $$props.borderWidth);
2989
+ if ('textSize' in $$props) $$invalidate(19, textSize = $$props.textSize);
2990
+ if ('style' in $$props) $$invalidate(1, style = $$props.style);
2991
+ if ('title' in $$props) $$invalidate(2, title = $$props.title);
2894
2992
  };
2895
2993
 
2896
2994
  $$self.$$.update = () => {
2897
2995
  if ($$self.$$.dirty & /*xValues, labels*/ 8193) {
2898
- // multiply labels values if needed
2996
+ // multiply label values if needed
2899
2997
  {
2900
2998
  const n = xValues.length;
2901
2999
  if (!Array.isArray(labels)) $$invalidate(0, labels = Array(n).fill(labels));
@@ -2911,38 +3009,39 @@ function instance$5($$self, $$props, $$invalidate) {
2911
3009
  }
2912
3010
  }
2913
3011
 
2914
- if ($$self.$$.dirty & /*xValues, $xLim, $axesWidth*/ 12591104) {
3012
+ if ($$self.$$.dirty & /*xValues, $xLim, $axesWidth*/ 25174016) {
2915
3013
  // reactive variables for coordinates of data points in pixels
2916
- $$invalidate(6, x = axes.scaleX(xValues, $xLim, $axesWidth));
3014
+ $$invalidate(7, x = axes.scaleX(xValues, $xLim, $axesWidth));
2917
3015
  }
2918
3016
 
2919
- if ($$self.$$.dirty & /*yValues, $yLim, $axesHeight*/ 3162112) {
2920
- $$invalidate(5, y = axes.scaleY(yValues, $yLim, $axesHeight));
3017
+ if ($$self.$$.dirty & /*yValues, $yLim, $axesHeight*/ 6307840) {
3018
+ $$invalidate(6, y = axes.scaleY(yValues, $yLim, $axesHeight));
2921
3019
  }
2922
3020
 
2923
- if ($$self.$$.dirty & /*pos, $scale*/ 524290) {
2924
- $$invalidate(4, dx = [0, 0, 1, 0, -1][pos] * axes.LABELS_MARGIN[$scale]);
3021
+ if ($$self.$$.dirty & /*pos, $scale*/ 1081344) {
3022
+ $$invalidate(5, dx = [0, 0, 1, 0, -1][pos] * axes.LABELS_MARGIN[$scale]);
2925
3023
  }
2926
3024
 
2927
- if ($$self.$$.dirty & /*pos, $scale*/ 524290) {
2928
- $$invalidate(3, dy = [0, 1, 0, -1, 0][pos] * axes.LABELS_MARGIN[$scale]);
3025
+ if ($$self.$$.dirty & /*pos, $scale*/ 1081344) {
3026
+ $$invalidate(4, dy = [0, 1, 0, -1, 0][pos] * axes.LABELS_MARGIN[$scale]);
2929
3027
  }
2930
3028
 
2931
- if ($$self.$$.dirty & /*faceColor, borderWidth, borderColor, textSize*/ 491520) {
2932
- // styles for bars and labels
2933
- $$invalidate(2, textStyleStr = `fill:${faceColor};stroke-width:${borderWidth}px;stroke:${borderColor};font-size:${textSize}em;`);
3029
+ if ($$self.$$.dirty & /*faceColor, borderWidth, borderColor, textSize, pos*/ 1015808) {
3030
+ // styles for the elements
3031
+ $$invalidate(3, textStyleStr = `fill:${faceColor};stroke-width:${borderWidth}px;stroke:${borderColor};
3032
+ font-size:${textSize}em; text-anchor:${textAnchors[pos]};`);
2934
3033
  }
2935
3034
  };
2936
3035
 
2937
3036
  return [
2938
3037
  labels,
2939
- pos,
3038
+ style,
3039
+ title,
2940
3040
  textStyleStr,
2941
3041
  dy,
2942
3042
  dx,
2943
3043
  y,
2944
3044
  x,
2945
- textAnchors,
2946
3045
  xLim,
2947
3046
  yLim,
2948
3047
  axesWidth,
@@ -2950,6 +3049,7 @@ function instance$5($$self, $$props, $$invalidate) {
2950
3049
  scale,
2951
3050
  xValues,
2952
3051
  yValues,
3052
+ pos,
2953
3053
  faceColor,
2954
3054
  borderColor,
2955
3055
  borderWidth,
@@ -2966,16 +3066,26 @@ class TextLabels extends SvelteComponent {
2966
3066
  constructor(options) {
2967
3067
  super();
2968
3068
 
2969
- init(this, options, instance$5, create_fragment$5, safe_not_equal, {
2970
- xValues: 13,
2971
- yValues: 14,
2972
- labels: 0,
2973
- pos: 1,
2974
- faceColor: 15,
2975
- borderColor: 16,
2976
- borderWidth: 17,
2977
- textSize: 18
2978
- });
3069
+ init(
3070
+ this,
3071
+ options,
3072
+ instance$5,
3073
+ create_fragment$5,
3074
+ safe_not_equal,
3075
+ {
3076
+ xValues: 13,
3077
+ yValues: 14,
3078
+ labels: 0,
3079
+ pos: 15,
3080
+ faceColor: 16,
3081
+ borderColor: 17,
3082
+ borderWidth: 18,
3083
+ textSize: 19,
3084
+ style: 1,
3085
+ title: 2
3086
+ },
3087
+ add_css$2
3088
+ );
2979
3089
  }
2980
3090
  }
2981
3091
 
@@ -3310,31 +3420,28 @@ function add_css$1(target) {
3310
3420
  }
3311
3421
 
3312
3422
  function create_fragment$3(ctx) {
3313
- let g;
3314
3423
  let rectangles;
3315
3424
  let current;
3316
3425
 
3317
3426
  rectangles = new Rectangles({
3318
3427
  props: {
3428
+ style: "series_bar",
3319
3429
  left: /*left*/ ctx[4],
3320
3430
  top: /*top*/ ctx[5],
3321
3431
  width: /*width*/ ctx[3],
3322
3432
  height: /*height*/ ctx[6],
3323
3433
  borderColor: /*borderColor*/ ctx[2],
3324
- faceColor: /*faceColor*/ ctx[1]
3434
+ faceColor: /*faceColor*/ ctx[1],
3435
+ title: /*title*/ ctx[0]
3325
3436
  }
3326
3437
  });
3327
3438
 
3328
3439
  return {
3329
3440
  c() {
3330
- g = svg_element("g");
3331
3441
  create_component(rectangles.$$.fragment);
3332
- attr(g, "class", "series series_bar");
3333
- attr(g, "title", /*title*/ ctx[0]);
3334
3442
  },
3335
3443
  m(target, anchor) {
3336
- insert(target, g, anchor);
3337
- mount_component(rectangles, g, null);
3444
+ mount_component(rectangles, target, anchor);
3338
3445
  current = true;
3339
3446
  },
3340
3447
  p(ctx, [dirty]) {
@@ -3345,11 +3452,8 @@ function create_fragment$3(ctx) {
3345
3452
  if (dirty & /*height*/ 64) rectangles_changes.height = /*height*/ ctx[6];
3346
3453
  if (dirty & /*borderColor*/ 4) rectangles_changes.borderColor = /*borderColor*/ ctx[2];
3347
3454
  if (dirty & /*faceColor*/ 2) rectangles_changes.faceColor = /*faceColor*/ ctx[1];
3455
+ if (dirty & /*title*/ 1) rectangles_changes.title = /*title*/ ctx[0];
3348
3456
  rectangles.$set(rectangles_changes);
3349
-
3350
- if (!current || dirty & /*title*/ 1) {
3351
- attr(g, "title", /*title*/ ctx[0]);
3352
- }
3353
3457
  },
3354
3458
  i(local) {
3355
3459
  if (current) return;
@@ -3361,8 +3465,7 @@ function create_fragment$3(ctx) {
3361
3465
  current = false;
3362
3466
  },
3363
3467
  d(detaching) {
3364
- if (detaching) detach(g);
3365
- destroy_component(rectangles);
3468
+ destroy_component(rectangles, detaching);
3366
3469
  }
3367
3470
  };
3368
3471
  }
@@ -3481,11 +3584,10 @@ class BarSeries extends SvelteComponent {
3481
3584
  /* src/ScatterSeries.svelte generated by Svelte v3.46.3 */
3482
3585
 
3483
3586
  function add_css(target) {
3484
- append_styles(target, "svelte-11a4d2d", ".marker{font-size:1em;cursor:default}.marker:hover{opacity:90%}.series_scatter > *:hover + .labels_hover{visibility:visible;opacity:1}");
3587
+ append_styles(target, "svelte-byxua3", ".series_scatter > text{font-size:1em;cursor:default}.series_scatter > text:hover{opacity:90%}.series_scatter > *:hover + .labels_hover{visibility:visible;opacity:1}");
3485
3588
  }
3486
3589
 
3487
3590
  function create_fragment$2(ctx) {
3488
- let g;
3489
3591
  let textlabels;
3490
3592
  let current;
3491
3593
 
@@ -3493,40 +3595,35 @@ function create_fragment$2(ctx) {
3493
3595
  props: {
3494
3596
  xValues: /*xValues*/ ctx[0],
3495
3597
  yValues: /*yValues*/ ctx[1],
3496
- labels: /*markerSymbol*/ ctx[7],
3497
- textSize: /*markerSize*/ ctx[6],
3498
3598
  faceColor: /*faceColor*/ ctx[3],
3499
3599
  borderColor: /*borderColor*/ ctx[4],
3500
- borderWidth: /*borderWidth*/ ctx[5]
3600
+ borderWidth: /*borderWidth*/ ctx[5],
3601
+ title: /*title*/ ctx[2],
3602
+ style: "series_scatter",
3603
+ labels: /*markerSymbol*/ ctx[7],
3604
+ textSize: /*markerSize*/ ctx[6]
3501
3605
  }
3502
3606
  });
3503
3607
 
3504
3608
  return {
3505
3609
  c() {
3506
- g = svg_element("g");
3507
3610
  create_component(textlabels.$$.fragment);
3508
- attr(g, "class", "series series_scatter");
3509
- attr(g, "title", /*title*/ ctx[2]);
3510
3611
  },
3511
3612
  m(target, anchor) {
3512
- insert(target, g, anchor);
3513
- mount_component(textlabels, g, null);
3613
+ mount_component(textlabels, target, anchor);
3514
3614
  current = true;
3515
3615
  },
3516
3616
  p(ctx, [dirty]) {
3517
3617
  const textlabels_changes = {};
3518
3618
  if (dirty & /*xValues*/ 1) textlabels_changes.xValues = /*xValues*/ ctx[0];
3519
3619
  if (dirty & /*yValues*/ 2) textlabels_changes.yValues = /*yValues*/ ctx[1];
3520
- if (dirty & /*markerSymbol*/ 128) textlabels_changes.labels = /*markerSymbol*/ ctx[7];
3521
- if (dirty & /*markerSize*/ 64) textlabels_changes.textSize = /*markerSize*/ ctx[6];
3522
3620
  if (dirty & /*faceColor*/ 8) textlabels_changes.faceColor = /*faceColor*/ ctx[3];
3523
3621
  if (dirty & /*borderColor*/ 16) textlabels_changes.borderColor = /*borderColor*/ ctx[4];
3524
3622
  if (dirty & /*borderWidth*/ 32) textlabels_changes.borderWidth = /*borderWidth*/ ctx[5];
3623
+ if (dirty & /*title*/ 4) textlabels_changes.title = /*title*/ ctx[2];
3624
+ if (dirty & /*markerSymbol*/ 128) textlabels_changes.labels = /*markerSymbol*/ ctx[7];
3625
+ if (dirty & /*markerSize*/ 64) textlabels_changes.textSize = /*markerSize*/ ctx[6];
3525
3626
  textlabels.$set(textlabels_changes);
3526
-
3527
- if (!current || dirty & /*title*/ 4) {
3528
- attr(g, "title", /*title*/ ctx[2]);
3529
- }
3530
3627
  },
3531
3628
  i(local) {
3532
3629
  if (current) return;
@@ -3538,8 +3635,7 @@ function create_fragment$2(ctx) {
3538
3635
  current = false;
3539
3636
  },
3540
3637
  d(detaching) {
3541
- if (detaching) detach(g);
3542
- destroy_component(textlabels);
3638
+ destroy_component(textlabels, detaching);
3543
3639
  }
3544
3640
  };
3545
3641
  }
@@ -3557,6 +3653,7 @@ function instance$2($$self, $$props, $$invalidate) {
3557
3653
  // TODO: implement later
3558
3654
  //export let labels = yValues;
3559
3655
  //export let showLabels = "no"; // can be "no", "hover", "always"
3656
+ /* constants for internal use */
3560
3657
  const markers = ["●", "◼", "▲", "▼", "⬥", "+", "*", "⨯"];
3561
3658
 
3562
3659
  let markerSymbol;
@@ -3663,7 +3760,7 @@ function create_if_block$1(ctx) {
3663
3760
  polyline = svg_element("polyline");
3664
3761
  attr(polyline, "class", "line");
3665
3762
  attr(polyline, "points", /*p*/ ctx[2]);
3666
- attr(g, "class", "series lineseries");
3763
+ attr(g, "class", "series series_line");
3667
3764
  attr(g, "style", /*lineStyleStr*/ ctx[1]);
3668
3765
  attr(g, "title", /*title*/ ctx[0]);
3669
3766
  },
@@ -3798,7 +3895,8 @@ function instance$1($$self, $$props, $$invalidate) {
3798
3895
  }
3799
3896
 
3800
3897
  if ($$self.$$.dirty & /*lineColor, lineWidth, $scale, lineType*/ 39936) {
3801
- $$invalidate(1, lineStyleStr = `fill:transparent;stroke:${lineColor};stroke-width: ${lineWidth}px;stroke-dasharray:${axes.LINE_STYLES[$scale][lineType - 1]}`);
3898
+ $$invalidate(1, lineStyleStr = `fill:transparent;stroke:${lineColor};stroke-width: ${lineWidth}px;
3899
+ stroke-dasharray:${axes.LINE_STYLES[$scale][lineType - 1]}`);
3802
3900
  }
3803
3901
  };
3804
3902