svelte-plots-basic 1.0.1 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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
+ // (330: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
+ // (331: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
+ // (332: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
+ // (360:3) {#if !$isOk}
556
579
  function create_if_block$9(ctx) {
557
580
  let p;
558
581
 
@@ -592,18 +615,20 @@ 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[24].xaxis;
599
- const xaxis_slot = create_slot(xaxis_slot_template, ctx, /*$$scope*/ ctx[23], get_xaxis_slot_context);
600
- const yaxis_slot_template = /*#slots*/ ctx[24].yaxis;
601
- const yaxis_slot = create_slot(yaxis_slot_template, ctx, /*$$scope*/ ctx[23], get_yaxis_slot_context);
602
- const default_slot_template = /*#slots*/ ctx[24].default;
603
- const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[23], null);
604
- const box_slot_template = /*#slots*/ ctx[24].box;
605
- const box_slot = create_slot(box_slot_template, ctx, /*$$scope*/ ctx[23], get_box_slot_context);
606
- let if_block3 = !/*$isOk*/ ctx[5] && create_if_block$9();
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);
631
+ let if_block3 = !/*$isOk*/ ctx[3] && create_if_block$9();
607
632
 
608
633
  return {
609
634
  c() {
@@ -626,17 +651,18 @@ 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();
629
- attr(rect, "x", rect_x_value = /*cpx*/ ctx[4][0]);
630
- attr(rect, "y", rect_y_value = /*cpy*/ ctx[3][1]);
631
- attr(rect, "width", rect_width_value = /*cpx*/ ctx[4][1] - /*cpx*/ ctx[4][0]);
632
- attr(rect, "height", rect_height_value = /*cpy*/ ctx[3][0] - /*cpy*/ ctx[3][1]);
654
+ set_style(rect, "pointer-events", "none");
655
+ attr(rect, "x", rect_x_value = /*cpx*/ ctx[7][0]);
656
+ attr(rect, "y", rect_y_value = /*cpy*/ ctx[6][1]);
657
+ attr(rect, "width", rect_width_value = /*cpx*/ ctx[7][1] - /*cpx*/ ctx[7][0]);
658
+ attr(rect, "height", rect_height_value = /*cpy*/ ctx[6][0] - /*cpy*/ ctx[6][1]);
633
659
  attr(clipPath, "id", /*clipPathID*/ ctx[8]);
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[6]));
639
- toggle_class(div1, "plot_error", !/*$isOk*/ ctx[5]);
663
+ attr(div0, "class", "axes-wrapper svelte-n80kcc");
664
+ attr(div1, "class", div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-n80kcc");
665
+ toggle_class(div1, "plot_error", !/*$isOk*/ ctx[3]);
640
666
  },
641
667
  m(target, anchor) {
642
668
  insert(target, div1, 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[25](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] !== "") {
@@ -715,83 +746,83 @@ function create_fragment$b(ctx) {
715
746
  if_block2 = null;
716
747
  }
717
748
 
718
- if (!current || dirty[0] & /*cpx*/ 16 && rect_x_value !== (rect_x_value = /*cpx*/ ctx[4][0])) {
749
+ if (!current || dirty[0] & /*cpx*/ 128 && rect_x_value !== (rect_x_value = /*cpx*/ ctx[7][0])) {
719
750
  attr(rect, "x", rect_x_value);
720
751
  }
721
752
 
722
- if (!current || dirty[0] & /*cpy*/ 8 && rect_y_value !== (rect_y_value = /*cpy*/ ctx[3][1])) {
753
+ if (!current || dirty[0] & /*cpy*/ 64 && rect_y_value !== (rect_y_value = /*cpy*/ ctx[6][1])) {
723
754
  attr(rect, "y", rect_y_value);
724
755
  }
725
756
 
726
- if (!current || dirty[0] & /*cpx*/ 16 && rect_width_value !== (rect_width_value = /*cpx*/ ctx[4][1] - /*cpx*/ ctx[4][0])) {
757
+ if (!current || dirty[0] & /*cpx*/ 128 && rect_width_value !== (rect_width_value = /*cpx*/ ctx[7][1] - /*cpx*/ ctx[7][0])) {
727
758
  attr(rect, "width", rect_width_value);
728
759
  }
729
760
 
730
- if (!current || dirty[0] & /*cpy*/ 8 && rect_height_value !== (rect_height_value = /*cpy*/ ctx[3][0] - /*cpy*/ ctx[3][1])) {
761
+ if (!current || dirty[0] & /*cpy*/ 64 && rect_height_value !== (rect_height_value = /*cpy*/ ctx[6][0] - /*cpy*/ ctx[6][1])) {
731
762
  attr(rect, "height", rect_height_value);
732
763
  }
733
764
 
734
765
  if (xaxis_slot) {
735
- if (xaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 8388608)) {
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[23],
771
+ /*$$scope*/ ctx[25],
741
772
  !current
742
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[23])
743
- : get_slot_changes(xaxis_slot_template, /*$$scope*/ ctx[23], 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*/ 8388608)) {
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[23],
786
+ /*$$scope*/ ctx[25],
756
787
  !current
757
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[23])
758
- : get_slot_changes(yaxis_slot_template, /*$$scope*/ ctx[23], 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*/ 8388608)) {
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[23],
801
+ /*$$scope*/ ctx[25],
771
802
  !current
772
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[23])
773
- : get_slot_changes(default_slot_template, /*$$scope*/ ctx[23], 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*/ 8388608)) {
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[23],
816
+ /*$$scope*/ ctx[25],
786
817
  !current
787
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[23])
788
- : get_slot_changes(box_slot_template, /*$$scope*/ ctx[23], 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
  }
792
823
  }
793
824
 
794
- if (!/*$isOk*/ ctx[5]) {
825
+ if (!/*$isOk*/ ctx[3]) {
795
826
  if (if_block3) ; else {
796
827
  if_block3 = create_if_block$9();
797
828
  if_block3.c();
@@ -802,12 +833,12 @@ function create_fragment$b(ctx) {
802
833
  if_block3 = null;
803
834
  }
804
835
 
805
- if (!current || dirty[0] & /*$scale*/ 64 && div1_class_value !== (div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[6]))) {
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
 
809
- if (dirty[0] & /*$scale, $isOk*/ 96) {
810
- toggle_class(div1, "plot_error", !/*$isOk*/ ctx[5]);
840
+ if (dirty[0] & /*$scale, $isOk*/ 24) {
841
+ toggle_class(div1, "plot_error", !/*$isOk*/ ctx[3]);
811
842
  }
812
843
  },
813
844
  i(local) {
@@ -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[25](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,32 +946,32 @@ 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(21, $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(19, $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(22, $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(20, $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
- component_subscribe($$self, scale, value => $$invalidate(6, $scale = value));
957
+ component_subscribe($$self, scale, value => $$invalidate(4, $scale = value));
923
958
  const isOk = writable(false); // are axes ready for drawing
924
- component_subscribe($$self, isOk, value => $$invalidate(5, $isOk = value));
959
+ component_subscribe($$self, isOk, value => $$invalidate(3, $isOk = value));
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,51 +1134,66 @@ 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 handleClick(e) {
1139
+ if (e.target.tagName === "text" && e.target.parentNode.classList.contains("series_scatter")) {
1140
+ dispatch("markerclick", { markerid: e.target.dataset.id });
1141
+ return;
1142
+ }
1143
+
1144
+ if (e.target.tagName === "rect" && e.target.parentNode.classList.contains("series_bar")) {
1145
+ dispatch("barclick", { markerid: e.target.dataset.id });
1146
+ return;
1147
+ }
1148
+
1149
+ dispatch("axesclick");
1150
+ }
1151
+
1102
1152
  function div0_binding($$value) {
1103
1153
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
1104
1154
  axesWrapper = $$value;
1105
- $$invalidate(7, axesWrapper);
1155
+ $$invalidate(5, axesWrapper);
1106
1156
  });
1107
1157
  }
1108
1158
 
1109
1159
  $$self.$$set = $$props => {
1110
- if ('limX' in $$props) $$invalidate(15, limX = $$props.limX);
1111
- if ('limY' in $$props) $$invalidate(16, limY = $$props.limY);
1160
+ if ('limX' in $$props) $$invalidate(16, limX = $$props.limX);
1161
+ if ('limY' in $$props) $$invalidate(17, limY = $$props.limY);
1112
1162
  if ('title' in $$props) $$invalidate(0, title = $$props.title);
1113
1163
  if ('xLabel' in $$props) $$invalidate(1, xLabel = $$props.xLabel);
1114
1164
  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(23, $$scope = $$props.$$scope);
1165
+ if ('multiSeries' in $$props) $$invalidate(18, multiSeries = $$props.multiSeries);
1166
+ if ('$$scope' in $$props) $$invalidate(25, $$scope = $$props.$$scope);
1117
1167
  };
1118
1168
 
1119
1169
  $$self.$$.update = () => {
1120
- if ($$self.$$.dirty[0] & /*limX*/ 32768) {
1170
+ if ($$self.$$.dirty[0] & /*limX*/ 65536) {
1121
1171
  // this is reactive in case if limX and limY are interactively changed by parent script
1122
1172
  if (!limX.some(v => v === undefined)) xLim.update(v => limX);
1123
1173
  }
1124
1174
 
1125
- if ($$self.$$.dirty[0] & /*limY*/ 65536) {
1175
+ if ($$self.$$.dirty[0] & /*limY*/ 131072) {
1126
1176
  if (!limY.some(v => v === undefined)) yLim.update(v => limY);
1127
1177
  }
1128
1178
 
1129
- if ($$self.$$.dirty[0] & /*axesMargins, $scale*/ 262208) {
1179
+ if ($$self.$$.dirty[0] & /*axesMargins, $scale*/ 524304) {
1130
1180
  // computes real margins in pixels based on current scale
1131
- margins = axesMargins.map(v => v * AXES_MARGIN_FACTORS[$scale]);
1181
+ $$invalidate(20, margins = axesMargins.map(v => v * AXES_MARGIN_FACTORS[$scale]));
1132
1182
  }
1133
1183
 
1134
- if ($$self.$$.dirty[0] & /*$isOk, $yLim, $height*/ 1572896) {
1135
- $$invalidate(3, cpy = $isOk ? scaleY($yLim, $yLim, $height) : [1, 0]);
1184
+ if ($$self.$$.dirty[0] & /*$yLim, $xLim, $width, margins, $height*/ 32505856) {
1185
+ // computes status which tells that axes limits look fine and it is safe to draw
1186
+ // the status is based on the axis limits validity
1187
+ 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]);
1136
1188
  }
1137
1189
 
1138
- if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/ 6291488) {
1190
+ if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/ 25165832) {
1139
1191
  // computes coordinates for clip path box
1140
- $$invalidate(4, cpx = $isOk ? scaleX($xLim, $xLim, $width) : [0, 1]);
1192
+ $$invalidate(7, cpx = $isOk ? scaleX($xLim, $xLim, $width) : [0, 1]);
1141
1193
  }
1142
1194
 
1143
- if ($$self.$$.dirty[0] & /*$yLim, $xLim, cpy, cpx*/ 5242904) {
1144
- // computes status which tells that axes limits look fine and it is safe to draw
1145
- // the status is based on the axis limits validity
1146
- 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] && cpy[0] > cpy[1] && cpx[1] > cpx[0]);
1195
+ if ($$self.$$.dirty[0] & /*$isOk, $yLim, $height*/ 6291464) {
1196
+ $$invalidate(6, cpy = $isOk ? scaleY($yLim, $yLim, $height) : [1, 0]);
1147
1197
  }
1148
1198
  };
1149
1199
 
@@ -1151,11 +1201,11 @@ function instance$b($$self, $$props, $$invalidate) {
1151
1201
  title,
1152
1202
  xLabel,
1153
1203
  yLabel,
1154
- cpy,
1155
- cpx,
1156
1204
  $isOk,
1157
1205
  $scale,
1158
1206
  axesWrapper,
1207
+ cpy,
1208
+ cpx,
1159
1209
  clipPathID,
1160
1210
  width,
1161
1211
  height,
@@ -1163,10 +1213,12 @@ function instance$b($$self, $$props, $$invalidate) {
1163
1213
  yLim,
1164
1214
  scale,
1165
1215
  isOk,
1216
+ handleClick,
1166
1217
  limX,
1167
1218
  limY,
1168
1219
  multiSeries,
1169
1220
  axesMargins,
1221
+ margins,
1170
1222
  $height,
1171
1223
  $yLim,
1172
1224
  $width,
@@ -1188,14 +1240,14 @@ class Axes extends SvelteComponent {
1188
1240
  create_fragment$b,
1189
1241
  safe_not_equal,
1190
1242
  {
1191
- limX: 15,
1192
- limY: 16,
1243
+ limX: 16,
1244
+ limY: 17,
1193
1245
  title: 0,
1194
1246
  xLabel: 1,
1195
1247
  yLabel: 2,
1196
- multiSeries: 17
1248
+ multiSeries: 18
1197
1249
  },
1198
- add_css$2,
1250
+ add_css$3,
1199
1251
  [-1, -1]
1200
1252
  );
1201
1253
  }
@@ -1985,14 +2037,15 @@ class YAxis extends SvelteComponent {
1985
2037
 
1986
2038
  function get_each_context$3(ctx, list, i) {
1987
2039
  const child_ctx = ctx.slice();
1988
- child_ctx[23] = list[i];
1989
- child_ctx[25] = i;
2040
+ child_ctx[25] = list[i];
2041
+ child_ctx[27] = i;
1990
2042
  return child_ctx;
1991
2043
  }
1992
2044
 
1993
- // (51:0) {#if rx !== undefined && ry !== undefined}
2045
+ // (53:0) {#if rx !== undefined && ry !== undefined}
1994
2046
  function create_if_block$6(ctx) {
1995
- let each_1_anchor;
2047
+ let g;
2048
+ let g_class_value;
1996
2049
  let each_value = /*left*/ ctx[0];
1997
2050
  let each_blocks = [];
1998
2051
 
@@ -2002,21 +2055,25 @@ function create_if_block$6(ctx) {
2002
2055
 
2003
2056
  return {
2004
2057
  c() {
2058
+ g = svg_element("g");
2059
+
2005
2060
  for (let i = 0; i < each_blocks.length; i += 1) {
2006
2061
  each_blocks[i].c();
2007
2062
  }
2008
2063
 
2009
- each_1_anchor = empty();
2064
+ attr(g, "class", g_class_value = "series " + /*style*/ ctx[2]);
2065
+ attr(g, "title", /*title*/ ctx[1]);
2066
+ attr(g, "style", /*barsStyleStr*/ ctx[7]);
2010
2067
  },
2011
2068
  m(target, anchor) {
2069
+ insert(target, g, anchor);
2070
+
2012
2071
  for (let i = 0; i < each_blocks.length; i += 1) {
2013
- each_blocks[i].m(target, anchor);
2072
+ each_blocks[i].m(g, null);
2014
2073
  }
2015
-
2016
- insert(target, each_1_anchor, anchor);
2017
2074
  },
2018
2075
  p(ctx, dirty) {
2019
- if (dirty & /*rx, ry, rw, rh, barsStyleStr, left*/ 63) {
2076
+ if (dirty & /*rx, ry, rw, rh, left*/ 121) {
2020
2077
  each_value = /*left*/ ctx[0];
2021
2078
  let i;
2022
2079
 
@@ -2028,7 +2085,7 @@ function create_if_block$6(ctx) {
2028
2085
  } else {
2029
2086
  each_blocks[i] = create_each_block$3(child_ctx);
2030
2087
  each_blocks[i].c();
2031
- each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
2088
+ each_blocks[i].m(g, null);
2032
2089
  }
2033
2090
  }
2034
2091
 
@@ -2038,15 +2095,23 @@ function create_if_block$6(ctx) {
2038
2095
 
2039
2096
  each_blocks.length = each_value.length;
2040
2097
  }
2098
+
2099
+ if (dirty & /*style*/ 4 && g_class_value !== (g_class_value = "series " + /*style*/ ctx[2])) {
2100
+ attr(g, "class", g_class_value);
2101
+ }
2102
+
2103
+ if (dirty & /*title*/ 2) {
2104
+ attr(g, "title", /*title*/ ctx[1]);
2105
+ }
2041
2106
  },
2042
2107
  d(detaching) {
2108
+ if (detaching) detach(g);
2043
2109
  destroy_each(each_blocks, detaching);
2044
- if (detaching) detach(each_1_anchor);
2045
2110
  }
2046
2111
  };
2047
2112
  }
2048
2113
 
2049
- // (52:3) {#each left as v, i}
2114
+ // (55:3) {#each left as v, i}
2050
2115
  function create_each_block$3(ctx) {
2051
2116
  let rect;
2052
2117
  let rect_x_value;
@@ -2057,29 +2122,28 @@ function create_each_block$3(ctx) {
2057
2122
  return {
2058
2123
  c() {
2059
2124
  rect = svg_element("rect");
2060
- attr(rect, "x", rect_x_value = /*rx*/ ctx[4][/*i*/ ctx[25]]);
2061
- attr(rect, "y", rect_y_value = /*ry*/ ctx[3][/*i*/ ctx[25]]);
2062
- attr(rect, "width", rect_width_value = /*rw*/ ctx[2][/*i*/ ctx[25]]);
2063
- attr(rect, "height", rect_height_value = /*rh*/ ctx[1][/*i*/ ctx[25]]);
2064
- attr(rect, "style", /*barsStyleStr*/ ctx[5]);
2125
+ attr(rect, "x", rect_x_value = /*rx*/ ctx[6][/*i*/ ctx[27]]);
2126
+ attr(rect, "y", rect_y_value = /*ry*/ ctx[5][/*i*/ ctx[27]]);
2127
+ attr(rect, "width", rect_width_value = /*rw*/ ctx[4][/*i*/ ctx[27]]);
2128
+ attr(rect, "height", rect_height_value = /*rh*/ ctx[3][/*i*/ ctx[27]]);
2065
2129
  },
2066
2130
  m(target, anchor) {
2067
2131
  insert(target, rect, anchor);
2068
2132
  },
2069
2133
  p(ctx, dirty) {
2070
- if (dirty & /*rx*/ 16 && rect_x_value !== (rect_x_value = /*rx*/ ctx[4][/*i*/ ctx[25]])) {
2134
+ if (dirty & /*rx*/ 64 && rect_x_value !== (rect_x_value = /*rx*/ ctx[6][/*i*/ ctx[27]])) {
2071
2135
  attr(rect, "x", rect_x_value);
2072
2136
  }
2073
2137
 
2074
- if (dirty & /*ry*/ 8 && rect_y_value !== (rect_y_value = /*ry*/ ctx[3][/*i*/ ctx[25]])) {
2138
+ if (dirty & /*ry*/ 32 && rect_y_value !== (rect_y_value = /*ry*/ ctx[5][/*i*/ ctx[27]])) {
2075
2139
  attr(rect, "y", rect_y_value);
2076
2140
  }
2077
2141
 
2078
- if (dirty & /*rw*/ 4 && rect_width_value !== (rect_width_value = /*rw*/ ctx[2][/*i*/ ctx[25]])) {
2142
+ if (dirty & /*rw*/ 16 && rect_width_value !== (rect_width_value = /*rw*/ ctx[4][/*i*/ ctx[27]])) {
2079
2143
  attr(rect, "width", rect_width_value);
2080
2144
  }
2081
2145
 
2082
- if (dirty & /*rh*/ 2 && rect_height_value !== (rect_height_value = /*rh*/ ctx[1][/*i*/ ctx[25]])) {
2146
+ if (dirty & /*rh*/ 8 && rect_height_value !== (rect_height_value = /*rh*/ ctx[3][/*i*/ ctx[27]])) {
2083
2147
  attr(rect, "height", rect_height_value);
2084
2148
  }
2085
2149
  },
@@ -2091,7 +2155,7 @@ function create_each_block$3(ctx) {
2091
2155
 
2092
2156
  function create_fragment$8(ctx) {
2093
2157
  let if_block_anchor;
2094
- let if_block = /*rx*/ ctx[4] !== undefined && /*ry*/ ctx[3] !== undefined && create_if_block$6(ctx);
2158
+ let if_block = /*rx*/ ctx[6] !== undefined && /*ry*/ ctx[5] !== undefined && create_if_block$6(ctx);
2095
2159
 
2096
2160
  return {
2097
2161
  c() {
@@ -2103,7 +2167,7 @@ function create_fragment$8(ctx) {
2103
2167
  insert(target, if_block_anchor, anchor);
2104
2168
  },
2105
2169
  p(ctx, [dirty]) {
2106
- if (/*rx*/ ctx[4] !== undefined && /*ry*/ ctx[3] !== undefined) {
2170
+ if (/*rx*/ ctx[6] !== undefined && /*ry*/ ctx[5] !== undefined) {
2107
2171
  if (if_block) {
2108
2172
  if_block.p(ctx, dirty);
2109
2173
  } else {
@@ -2142,6 +2206,8 @@ function instance$8($$self, $$props, $$invalidate) {
2142
2206
  let { faceColor = Colors.PRIMARY } = $$props;
2143
2207
  let { borderColor = faceColor } = $$props;
2144
2208
  let { lineWidth = 1 } = $$props;
2209
+ let { title = "" } = $$props;
2210
+ let { style = "series_rect" } = $$props;
2145
2211
 
2146
2212
  // styles for bars and labels
2147
2213
  const barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`;
@@ -2170,46 +2236,50 @@ function instance$8($$self, $$props, $$invalidate) {
2170
2236
  const axes = getContext('axes');
2171
2237
 
2172
2238
  const xLim = axes.xLim;
2173
- component_subscribe($$self, xLim, value => $$invalidate(20, $xLim = value));
2239
+ component_subscribe($$self, xLim, value => $$invalidate(22, $xLim = value));
2174
2240
  const yLim = axes.yLim;
2175
- component_subscribe($$self, yLim, value => $$invalidate(18, $yLim = value));
2241
+ component_subscribe($$self, yLim, value => $$invalidate(20, $yLim = value));
2176
2242
  const axesWidth = axes.width;
2177
- component_subscribe($$self, axesWidth, value => $$invalidate(19, $axesWidth = value));
2243
+ component_subscribe($$self, axesWidth, value => $$invalidate(21, $axesWidth = value));
2178
2244
  const axesHeight = axes.height;
2179
- component_subscribe($$self, axesHeight, value => $$invalidate(17, $axesHeight = value));
2245
+ component_subscribe($$self, axesHeight, value => $$invalidate(19, $axesHeight = value));
2180
2246
 
2181
2247
  $$self.$$set = $$props => {
2182
2248
  if ('left' in $$props) $$invalidate(0, left = $$props.left);
2183
- if ('top' in $$props) $$invalidate(12, top = $$props.top);
2184
- if ('width' in $$props) $$invalidate(10, width = $$props.width);
2185
- if ('height' in $$props) $$invalidate(11, height = $$props.height);
2186
- if ('labels' in $$props) $$invalidate(13, labels = $$props.labels);
2187
- if ('faceColor' in $$props) $$invalidate(14, faceColor = $$props.faceColor);
2188
- if ('borderColor' in $$props) $$invalidate(15, borderColor = $$props.borderColor);
2189
- if ('lineWidth' in $$props) $$invalidate(16, lineWidth = $$props.lineWidth);
2249
+ if ('top' in $$props) $$invalidate(14, top = $$props.top);
2250
+ if ('width' in $$props) $$invalidate(12, width = $$props.width);
2251
+ if ('height' in $$props) $$invalidate(13, height = $$props.height);
2252
+ if ('labels' in $$props) $$invalidate(15, labels = $$props.labels);
2253
+ if ('faceColor' in $$props) $$invalidate(16, faceColor = $$props.faceColor);
2254
+ if ('borderColor' in $$props) $$invalidate(17, borderColor = $$props.borderColor);
2255
+ if ('lineWidth' in $$props) $$invalidate(18, lineWidth = $$props.lineWidth);
2256
+ if ('title' in $$props) $$invalidate(1, title = $$props.title);
2257
+ if ('style' in $$props) $$invalidate(2, style = $$props.style);
2190
2258
  };
2191
2259
 
2192
2260
  $$self.$$.update = () => {
2193
- if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 1572865) {
2261
+ if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 6291457) {
2194
2262
  // reactive variables for coordinates of data points in pixels
2195
- $$invalidate(4, rx = axes.scaleX(left, $xLim, $axesWidth));
2263
+ $$invalidate(6, rx = axes.scaleX(left, $xLim, $axesWidth));
2196
2264
  }
2197
2265
 
2198
- if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 397312) {
2199
- $$invalidate(3, ry = axes.scaleY(top, $yLim, $axesHeight));
2266
+ if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 1589248) {
2267
+ $$invalidate(5, ry = axes.scaleY(top, $yLim, $axesHeight));
2200
2268
  }
2201
2269
 
2202
- if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/ 1573888) {
2203
- $$invalidate(2, rw = axes.scaleX(width, $xLim, $axesWidth, true));
2270
+ if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/ 6295552) {
2271
+ $$invalidate(4, rw = axes.scaleX(width, $xLim, $axesWidth, true));
2204
2272
  }
2205
2273
 
2206
- if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/ 395264) {
2207
- $$invalidate(1, rh = axes.scaleY(height, $yLim, $axesHeight, true));
2274
+ if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/ 1581056) {
2275
+ $$invalidate(3, rh = axes.scaleY(height, $yLim, $axesHeight, true));
2208
2276
  }
2209
2277
  };
2210
2278
 
2211
2279
  return [
2212
2280
  left,
2281
+ title,
2282
+ style,
2213
2283
  rh,
2214
2284
  rw,
2215
2285
  ry,
@@ -2239,13 +2309,15 @@ class Rectangles extends SvelteComponent {
2239
2309
 
2240
2310
  init(this, options, instance$8, create_fragment$8, safe_not_equal, {
2241
2311
  left: 0,
2242
- top: 12,
2243
- width: 10,
2244
- height: 11,
2245
- labels: 13,
2246
- faceColor: 14,
2247
- borderColor: 15,
2248
- lineWidth: 16
2312
+ top: 14,
2313
+ width: 12,
2314
+ height: 13,
2315
+ labels: 15,
2316
+ faceColor: 16,
2317
+ borderColor: 17,
2318
+ lineWidth: 18,
2319
+ title: 1,
2320
+ style: 2
2249
2321
  });
2250
2322
  }
2251
2323
  }
@@ -2272,6 +2344,7 @@ function create_if_block$5(ctx) {
2272
2344
  c() {
2273
2345
  g = svg_element("g");
2274
2346
  create_component(rectangles.$$.fragment);
2347
+ set_style(g, "pointer-events", "none");
2275
2348
  attr(g, "class", "mdaplot__axes-box");
2276
2349
  },
2277
2350
  m(target, anchor) {
@@ -2685,17 +2758,22 @@ class Segments extends SvelteComponent {
2685
2758
 
2686
2759
  /* src/TextLabels.svelte generated by Svelte v3.46.3 */
2687
2760
 
2761
+ function add_css$2(target) {
2762
+ append_styles(target, "svelte-1szep8i", "text.svelte-1szep8i{dominant-baseline:middle}");
2763
+ }
2764
+
2688
2765
  function get_each_context$1(ctx, list, i) {
2689
2766
  const child_ctx = ctx.slice();
2690
- child_ctx[25] = list[i];
2691
- child_ctx[27] = i;
2767
+ child_ctx[27] = list[i];
2768
+ child_ctx[29] = i;
2692
2769
  return child_ctx;
2693
2770
  }
2694
2771
 
2695
- // (56:0) {#if x !== undefined && y !== undefined}
2772
+ // (66:0) {#if x !== undefined && y !== undefined}
2696
2773
  function create_if_block$3(ctx) {
2697
- let each_1_anchor;
2698
- let each_value = /*x*/ ctx[6];
2774
+ let g;
2775
+ let g_class_value;
2776
+ let each_value = /*x*/ ctx[7];
2699
2777
  let each_blocks = [];
2700
2778
 
2701
2779
  for (let i = 0; i < each_value.length; i += 1) {
@@ -2704,22 +2782,26 @@ function create_if_block$3(ctx) {
2704
2782
 
2705
2783
  return {
2706
2784
  c() {
2785
+ g = svg_element("g");
2786
+
2707
2787
  for (let i = 0; i < each_blocks.length; i += 1) {
2708
2788
  each_blocks[i].c();
2709
2789
  }
2710
2790
 
2711
- each_1_anchor = empty();
2791
+ attr(g, "class", g_class_value = "series " + /*style*/ ctx[1]);
2792
+ attr(g, "title", /*title*/ ctx[2]);
2793
+ attr(g, "style", /*textStyleStr*/ ctx[3]);
2712
2794
  },
2713
2795
  m(target, anchor) {
2796
+ insert(target, g, anchor);
2797
+
2714
2798
  for (let i = 0; i < each_blocks.length; i += 1) {
2715
- each_blocks[i].m(target, anchor);
2799
+ each_blocks[i].m(g, null);
2716
2800
  }
2717
-
2718
- insert(target, each_1_anchor, anchor);
2719
2801
  },
2720
2802
  p(ctx, dirty) {
2721
- if (dirty & /*textStyleStr, x, y, dx, dy, textAnchors, pos, labels*/ 255) {
2722
- each_value = /*x*/ ctx[6];
2803
+ if (dirty & /*x, y, dx, dy, labels*/ 241) {
2804
+ each_value = /*x*/ ctx[7];
2723
2805
  let i;
2724
2806
 
2725
2807
  for (i = 0; i < each_value.length; i += 1) {
@@ -2730,7 +2812,7 @@ function create_if_block$3(ctx) {
2730
2812
  } else {
2731
2813
  each_blocks[i] = create_each_block$1(child_ctx);
2732
2814
  each_blocks[i].c();
2733
- each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
2815
+ each_blocks[i].m(g, null);
2734
2816
  }
2735
2817
  }
2736
2818
 
@@ -2740,61 +2822,64 @@ function create_if_block$3(ctx) {
2740
2822
 
2741
2823
  each_blocks.length = each_value.length;
2742
2824
  }
2825
+
2826
+ if (dirty & /*style*/ 2 && g_class_value !== (g_class_value = "series " + /*style*/ ctx[1])) {
2827
+ attr(g, "class", g_class_value);
2828
+ }
2829
+
2830
+ if (dirty & /*title*/ 4) {
2831
+ attr(g, "title", /*title*/ ctx[2]);
2832
+ }
2833
+
2834
+ if (dirty & /*textStyleStr*/ 8) {
2835
+ attr(g, "style", /*textStyleStr*/ ctx[3]);
2836
+ }
2743
2837
  },
2744
2838
  d(detaching) {
2839
+ if (detaching) detach(g);
2745
2840
  destroy_each(each_blocks, detaching);
2746
- if (detaching) detach(each_1_anchor);
2747
2841
  }
2748
2842
  };
2749
2843
  }
2750
2844
 
2751
- // (57:3) {#each x as v, i}
2845
+ // (68:3) {#each x as v, i}
2752
2846
  function create_each_block$1(ctx) {
2753
2847
  let text_1;
2754
- let raw_value = /*labels*/ ctx[0][/*i*/ ctx[27]] + "";
2848
+ let raw_value = /*labels*/ ctx[0][/*i*/ ctx[29]] + "";
2849
+ let text_1_data_id_value;
2755
2850
  let text_1_x_value;
2756
2851
  let text_1_y_value;
2757
- let text_1_text_anchor_value;
2758
2852
 
2759
2853
  return {
2760
2854
  c() {
2761
2855
  text_1 = svg_element("text");
2762
- attr(text_1, "style", /*textStyleStr*/ ctx[2]);
2763
- attr(text_1, "x", text_1_x_value = /*x*/ ctx[6][/*i*/ ctx[27]]);
2764
- attr(text_1, "y", text_1_y_value = /*y*/ ctx[5][/*i*/ ctx[27]]);
2765
- attr(text_1, "dx", /*dx*/ ctx[4]);
2766
- attr(text_1, "dy", /*dy*/ ctx[3]);
2767
- attr(text_1, "dominant-baseline", "middle");
2768
- attr(text_1, "text-anchor", text_1_text_anchor_value = /*textAnchors*/ ctx[7][/*pos*/ ctx[1]]);
2856
+ attr(text_1, "data-id", text_1_data_id_value = /*i*/ ctx[29]);
2857
+ attr(text_1, "x", text_1_x_value = /*x*/ ctx[7][/*i*/ ctx[29]]);
2858
+ attr(text_1, "y", text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]]);
2859
+ attr(text_1, "dx", /*dx*/ ctx[5]);
2860
+ attr(text_1, "dy", /*dy*/ ctx[4]);
2861
+ attr(text_1, "class", "svelte-1szep8i");
2769
2862
  },
2770
2863
  m(target, anchor) {
2771
2864
  insert(target, text_1, anchor);
2772
2865
  text_1.innerHTML = raw_value;
2773
2866
  },
2774
2867
  p(ctx, dirty) {
2775
- if (dirty & /*labels*/ 1 && raw_value !== (raw_value = /*labels*/ ctx[0][/*i*/ ctx[27]] + "")) text_1.innerHTML = raw_value;
2776
- if (dirty & /*textStyleStr*/ 4) {
2777
- attr(text_1, "style", /*textStyleStr*/ ctx[2]);
2778
- }
2779
-
2780
- if (dirty & /*x*/ 64 && text_1_x_value !== (text_1_x_value = /*x*/ ctx[6][/*i*/ ctx[27]])) {
2868
+ if (dirty & /*labels*/ 1 && raw_value !== (raw_value = /*labels*/ ctx[0][/*i*/ ctx[29]] + "")) text_1.innerHTML = raw_value;
2869
+ if (dirty & /*x*/ 128 && text_1_x_value !== (text_1_x_value = /*x*/ ctx[7][/*i*/ ctx[29]])) {
2781
2870
  attr(text_1, "x", text_1_x_value);
2782
2871
  }
2783
2872
 
2784
- if (dirty & /*y*/ 32 && text_1_y_value !== (text_1_y_value = /*y*/ ctx[5][/*i*/ ctx[27]])) {
2873
+ if (dirty & /*y*/ 64 && text_1_y_value !== (text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]])) {
2785
2874
  attr(text_1, "y", text_1_y_value);
2786
2875
  }
2787
2876
 
2788
- if (dirty & /*dx*/ 16) {
2789
- attr(text_1, "dx", /*dx*/ ctx[4]);
2877
+ if (dirty & /*dx*/ 32) {
2878
+ attr(text_1, "dx", /*dx*/ ctx[5]);
2790
2879
  }
2791
2880
 
2792
- if (dirty & /*dy*/ 8) {
2793
- attr(text_1, "dy", /*dy*/ ctx[3]);
2794
- }
2795
-
2796
- if (dirty & /*pos*/ 2 && text_1_text_anchor_value !== (text_1_text_anchor_value = /*textAnchors*/ ctx[7][/*pos*/ ctx[1]])) {
2797
- attr(text_1, "text-anchor", text_1_text_anchor_value);
2881
+ if (dirty & /*dy*/ 16) {
2882
+ attr(text_1, "dy", /*dy*/ ctx[4]);
2798
2883
  }
2799
2884
  },
2800
2885
  d(detaching) {
@@ -2805,7 +2890,7 @@ function create_each_block$1(ctx) {
2805
2890
 
2806
2891
  function create_fragment$5(ctx) {
2807
2892
  let if_block_anchor;
2808
- let if_block = /*x*/ ctx[6] !== undefined && /*y*/ ctx[5] !== undefined && create_if_block$3(ctx);
2893
+ let if_block = /*x*/ ctx[7] !== undefined && /*y*/ ctx[6] !== undefined && create_if_block$3(ctx);
2809
2894
 
2810
2895
  return {
2811
2896
  c() {
@@ -2817,7 +2902,7 @@ function create_fragment$5(ctx) {
2817
2902
  insert(target, if_block_anchor, anchor);
2818
2903
  },
2819
2904
  p(ctx, [dirty]) {
2820
- if (/*x*/ ctx[6] !== undefined && /*y*/ ctx[5] !== undefined) {
2905
+ if (/*x*/ ctx[7] !== undefined && /*y*/ ctx[6] !== undefined) {
2821
2906
  if (if_block) {
2822
2907
  if_block.p(ctx, dirty);
2823
2908
  } else {
@@ -2858,11 +2943,13 @@ function instance$5($$self, $$props, $$invalidate) {
2858
2943
  let { borderColor = "transparent" } = $$props;
2859
2944
  let { borderWidth = 0 } = $$props;
2860
2945
  let { textSize = 1 } = $$props;
2946
+ let { style = "" } = $$props;
2947
+ let { title = "series_text" } = $$props;
2861
2948
 
2862
2949
  // text-anchor values depending on position
2863
2950
  const textAnchors = ["middle", "middle", "start", "middle", "end"];
2864
2951
 
2865
- /* sanity check for input parameters */
2952
+ // sanity check for input parameters
2866
2953
  if (!Array.isArray(xValues) || !Array.isArray(yValues) || xValues.length !== yValues.length) {
2867
2954
  throw "TextLabels: parameters 'xValues' and 'yValues' must be vectors of the same length.";
2868
2955
  }
@@ -2871,30 +2958,32 @@ function instance$5($$self, $$props, $$invalidate) {
2871
2958
  const axes = getContext('axes');
2872
2959
 
2873
2960
  const xLim = axes.xLim;
2874
- component_subscribe($$self, xLim, value => $$invalidate(23, $xLim = value));
2961
+ component_subscribe($$self, xLim, value => $$invalidate(24, $xLim = value));
2875
2962
  const yLim = axes.yLim;
2876
- component_subscribe($$self, yLim, value => $$invalidate(21, $yLim = value));
2963
+ component_subscribe($$self, yLim, value => $$invalidate(22, $yLim = value));
2877
2964
  const axesWidth = axes.width;
2878
- component_subscribe($$self, axesWidth, value => $$invalidate(22, $axesWidth = value));
2965
+ component_subscribe($$self, axesWidth, value => $$invalidate(23, $axesWidth = value));
2879
2966
  const axesHeight = axes.height;
2880
- component_subscribe($$self, axesHeight, value => $$invalidate(20, $axesHeight = value));
2967
+ component_subscribe($$self, axesHeight, value => $$invalidate(21, $axesHeight = value));
2881
2968
  const scale = axes.scale;
2882
- component_subscribe($$self, scale, value => $$invalidate(19, $scale = value));
2969
+ component_subscribe($$self, scale, value => $$invalidate(20, $scale = value));
2883
2970
 
2884
2971
  $$self.$$set = $$props => {
2885
2972
  if ('xValues' in $$props) $$invalidate(13, xValues = $$props.xValues);
2886
2973
  if ('yValues' in $$props) $$invalidate(14, yValues = $$props.yValues);
2887
2974
  if ('labels' in $$props) $$invalidate(0, labels = $$props.labels);
2888
- if ('pos' in $$props) $$invalidate(1, pos = $$props.pos);
2889
- if ('faceColor' in $$props) $$invalidate(15, faceColor = $$props.faceColor);
2890
- if ('borderColor' in $$props) $$invalidate(16, borderColor = $$props.borderColor);
2891
- if ('borderWidth' in $$props) $$invalidate(17, borderWidth = $$props.borderWidth);
2892
- if ('textSize' in $$props) $$invalidate(18, textSize = $$props.textSize);
2975
+ if ('pos' in $$props) $$invalidate(15, pos = $$props.pos);
2976
+ if ('faceColor' in $$props) $$invalidate(16, faceColor = $$props.faceColor);
2977
+ if ('borderColor' in $$props) $$invalidate(17, borderColor = $$props.borderColor);
2978
+ if ('borderWidth' in $$props) $$invalidate(18, borderWidth = $$props.borderWidth);
2979
+ if ('textSize' in $$props) $$invalidate(19, textSize = $$props.textSize);
2980
+ if ('style' in $$props) $$invalidate(1, style = $$props.style);
2981
+ if ('title' in $$props) $$invalidate(2, title = $$props.title);
2893
2982
  };
2894
2983
 
2895
2984
  $$self.$$.update = () => {
2896
2985
  if ($$self.$$.dirty & /*xValues, labels*/ 8193) {
2897
- // multiply labels values if needed
2986
+ // multiply label values if needed
2898
2987
  {
2899
2988
  const n = xValues.length;
2900
2989
  if (!Array.isArray(labels)) $$invalidate(0, labels = Array(n).fill(labels));
@@ -2910,38 +2999,39 @@ function instance$5($$self, $$props, $$invalidate) {
2910
2999
  }
2911
3000
  }
2912
3001
 
2913
- if ($$self.$$.dirty & /*xValues, $xLim, $axesWidth*/ 12591104) {
3002
+ if ($$self.$$.dirty & /*xValues, $xLim, $axesWidth*/ 25174016) {
2914
3003
  // reactive variables for coordinates of data points in pixels
2915
- $$invalidate(6, x = axes.scaleX(xValues, $xLim, $axesWidth));
3004
+ $$invalidate(7, x = axes.scaleX(xValues, $xLim, $axesWidth));
2916
3005
  }
2917
3006
 
2918
- if ($$self.$$.dirty & /*yValues, $yLim, $axesHeight*/ 3162112) {
2919
- $$invalidate(5, y = axes.scaleY(yValues, $yLim, $axesHeight));
3007
+ if ($$self.$$.dirty & /*yValues, $yLim, $axesHeight*/ 6307840) {
3008
+ $$invalidate(6, y = axes.scaleY(yValues, $yLim, $axesHeight));
2920
3009
  }
2921
3010
 
2922
- if ($$self.$$.dirty & /*pos, $scale*/ 524290) {
2923
- $$invalidate(4, dx = [0, 0, 1, 0, -1][pos] * axes.LABELS_MARGIN[$scale]);
3011
+ if ($$self.$$.dirty & /*pos, $scale*/ 1081344) {
3012
+ $$invalidate(5, dx = [0, 0, 1, 0, -1][pos] * axes.LABELS_MARGIN[$scale]);
2924
3013
  }
2925
3014
 
2926
- if ($$self.$$.dirty & /*pos, $scale*/ 524290) {
2927
- $$invalidate(3, dy = [0, 1, 0, -1, 0][pos] * axes.LABELS_MARGIN[$scale]);
3015
+ if ($$self.$$.dirty & /*pos, $scale*/ 1081344) {
3016
+ $$invalidate(4, dy = [0, 1, 0, -1, 0][pos] * axes.LABELS_MARGIN[$scale]);
2928
3017
  }
2929
3018
 
2930
- if ($$self.$$.dirty & /*faceColor, borderWidth, borderColor, textSize*/ 491520) {
2931
- // styles for bars and labels
2932
- $$invalidate(2, textStyleStr = `fill:${faceColor};stroke-width:${borderWidth}px;stroke:${borderColor};font-size:${textSize}em;`);
3019
+ if ($$self.$$.dirty & /*faceColor, borderWidth, borderColor, textSize, pos*/ 1015808) {
3020
+ // styles for the elements
3021
+ $$invalidate(3, textStyleStr = `fill:${faceColor};stroke-width:${borderWidth}px;stroke:${borderColor};
3022
+ font-size:${textSize}em; text-anchor:${textAnchors[pos]};`);
2933
3023
  }
2934
3024
  };
2935
3025
 
2936
3026
  return [
2937
3027
  labels,
2938
- pos,
3028
+ style,
3029
+ title,
2939
3030
  textStyleStr,
2940
3031
  dy,
2941
3032
  dx,
2942
3033
  y,
2943
3034
  x,
2944
- textAnchors,
2945
3035
  xLim,
2946
3036
  yLim,
2947
3037
  axesWidth,
@@ -2949,6 +3039,7 @@ function instance$5($$self, $$props, $$invalidate) {
2949
3039
  scale,
2950
3040
  xValues,
2951
3041
  yValues,
3042
+ pos,
2952
3043
  faceColor,
2953
3044
  borderColor,
2954
3045
  borderWidth,
@@ -2965,16 +3056,26 @@ class TextLabels extends SvelteComponent {
2965
3056
  constructor(options) {
2966
3057
  super();
2967
3058
 
2968
- init(this, options, instance$5, create_fragment$5, safe_not_equal, {
2969
- xValues: 13,
2970
- yValues: 14,
2971
- labels: 0,
2972
- pos: 1,
2973
- faceColor: 15,
2974
- borderColor: 16,
2975
- borderWidth: 17,
2976
- textSize: 18
2977
- });
3059
+ init(
3060
+ this,
3061
+ options,
3062
+ instance$5,
3063
+ create_fragment$5,
3064
+ safe_not_equal,
3065
+ {
3066
+ xValues: 13,
3067
+ yValues: 14,
3068
+ labels: 0,
3069
+ pos: 15,
3070
+ faceColor: 16,
3071
+ borderColor: 17,
3072
+ borderWidth: 18,
3073
+ textSize: 19,
3074
+ style: 1,
3075
+ title: 2
3076
+ },
3077
+ add_css$2
3078
+ );
2978
3079
  }
2979
3080
  }
2980
3081
 
@@ -3309,31 +3410,28 @@ function add_css$1(target) {
3309
3410
  }
3310
3411
 
3311
3412
  function create_fragment$3(ctx) {
3312
- let g;
3313
3413
  let rectangles;
3314
3414
  let current;
3315
3415
 
3316
3416
  rectangles = new Rectangles({
3317
3417
  props: {
3418
+ style: "series_bar",
3318
3419
  left: /*left*/ ctx[4],
3319
3420
  top: /*top*/ ctx[5],
3320
3421
  width: /*width*/ ctx[3],
3321
3422
  height: /*height*/ ctx[6],
3322
3423
  borderColor: /*borderColor*/ ctx[2],
3323
- faceColor: /*faceColor*/ ctx[1]
3424
+ faceColor: /*faceColor*/ ctx[1],
3425
+ title: /*title*/ ctx[0]
3324
3426
  }
3325
3427
  });
3326
3428
 
3327
3429
  return {
3328
3430
  c() {
3329
- g = svg_element("g");
3330
3431
  create_component(rectangles.$$.fragment);
3331
- attr(g, "class", "series series_bar");
3332
- attr(g, "title", /*title*/ ctx[0]);
3333
3432
  },
3334
3433
  m(target, anchor) {
3335
- insert(target, g, anchor);
3336
- mount_component(rectangles, g, null);
3434
+ mount_component(rectangles, target, anchor);
3337
3435
  current = true;
3338
3436
  },
3339
3437
  p(ctx, [dirty]) {
@@ -3344,11 +3442,8 @@ function create_fragment$3(ctx) {
3344
3442
  if (dirty & /*height*/ 64) rectangles_changes.height = /*height*/ ctx[6];
3345
3443
  if (dirty & /*borderColor*/ 4) rectangles_changes.borderColor = /*borderColor*/ ctx[2];
3346
3444
  if (dirty & /*faceColor*/ 2) rectangles_changes.faceColor = /*faceColor*/ ctx[1];
3445
+ if (dirty & /*title*/ 1) rectangles_changes.title = /*title*/ ctx[0];
3347
3446
  rectangles.$set(rectangles_changes);
3348
-
3349
- if (!current || dirty & /*title*/ 1) {
3350
- attr(g, "title", /*title*/ ctx[0]);
3351
- }
3352
3447
  },
3353
3448
  i(local) {
3354
3449
  if (current) return;
@@ -3360,8 +3455,7 @@ function create_fragment$3(ctx) {
3360
3455
  current = false;
3361
3456
  },
3362
3457
  d(detaching) {
3363
- if (detaching) detach(g);
3364
- destroy_component(rectangles);
3458
+ destroy_component(rectangles, detaching);
3365
3459
  }
3366
3460
  };
3367
3461
  }
@@ -3480,11 +3574,10 @@ class BarSeries extends SvelteComponent {
3480
3574
  /* src/ScatterSeries.svelte generated by Svelte v3.46.3 */
3481
3575
 
3482
3576
  function add_css(target) {
3483
- append_styles(target, "svelte-11a4d2d", ".marker{font-size:1em;cursor:default}.marker:hover{opacity:90%}.series_scatter > *:hover + .labels_hover{visibility:visible;opacity:1}");
3577
+ 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}");
3484
3578
  }
3485
3579
 
3486
3580
  function create_fragment$2(ctx) {
3487
- let g;
3488
3581
  let textlabels;
3489
3582
  let current;
3490
3583
 
@@ -3492,40 +3585,35 @@ function create_fragment$2(ctx) {
3492
3585
  props: {
3493
3586
  xValues: /*xValues*/ ctx[0],
3494
3587
  yValues: /*yValues*/ ctx[1],
3495
- labels: /*markerSymbol*/ ctx[7],
3496
- textSize: /*markerSize*/ ctx[6],
3497
3588
  faceColor: /*faceColor*/ ctx[3],
3498
3589
  borderColor: /*borderColor*/ ctx[4],
3499
- borderWidth: /*borderWidth*/ ctx[5]
3590
+ borderWidth: /*borderWidth*/ ctx[5],
3591
+ title: /*title*/ ctx[2],
3592
+ style: "series_scatter",
3593
+ labels: /*markerSymbol*/ ctx[7],
3594
+ textSize: /*markerSize*/ ctx[6]
3500
3595
  }
3501
3596
  });
3502
3597
 
3503
3598
  return {
3504
3599
  c() {
3505
- g = svg_element("g");
3506
3600
  create_component(textlabels.$$.fragment);
3507
- attr(g, "class", "series series_scatter");
3508
- attr(g, "title", /*title*/ ctx[2]);
3509
3601
  },
3510
3602
  m(target, anchor) {
3511
- insert(target, g, anchor);
3512
- mount_component(textlabels, g, null);
3603
+ mount_component(textlabels, target, anchor);
3513
3604
  current = true;
3514
3605
  },
3515
3606
  p(ctx, [dirty]) {
3516
3607
  const textlabels_changes = {};
3517
3608
  if (dirty & /*xValues*/ 1) textlabels_changes.xValues = /*xValues*/ ctx[0];
3518
3609
  if (dirty & /*yValues*/ 2) textlabels_changes.yValues = /*yValues*/ ctx[1];
3519
- if (dirty & /*markerSymbol*/ 128) textlabels_changes.labels = /*markerSymbol*/ ctx[7];
3520
- if (dirty & /*markerSize*/ 64) textlabels_changes.textSize = /*markerSize*/ ctx[6];
3521
3610
  if (dirty & /*faceColor*/ 8) textlabels_changes.faceColor = /*faceColor*/ ctx[3];
3522
3611
  if (dirty & /*borderColor*/ 16) textlabels_changes.borderColor = /*borderColor*/ ctx[4];
3523
3612
  if (dirty & /*borderWidth*/ 32) textlabels_changes.borderWidth = /*borderWidth*/ ctx[5];
3613
+ if (dirty & /*title*/ 4) textlabels_changes.title = /*title*/ ctx[2];
3614
+ if (dirty & /*markerSymbol*/ 128) textlabels_changes.labels = /*markerSymbol*/ ctx[7];
3615
+ if (dirty & /*markerSize*/ 64) textlabels_changes.textSize = /*markerSize*/ ctx[6];
3524
3616
  textlabels.$set(textlabels_changes);
3525
-
3526
- if (!current || dirty & /*title*/ 4) {
3527
- attr(g, "title", /*title*/ ctx[2]);
3528
- }
3529
3617
  },
3530
3618
  i(local) {
3531
3619
  if (current) return;
@@ -3537,8 +3625,7 @@ function create_fragment$2(ctx) {
3537
3625
  current = false;
3538
3626
  },
3539
3627
  d(detaching) {
3540
- if (detaching) detach(g);
3541
- destroy_component(textlabels);
3628
+ destroy_component(textlabels, detaching);
3542
3629
  }
3543
3630
  };
3544
3631
  }
@@ -3556,6 +3643,7 @@ function instance$2($$self, $$props, $$invalidate) {
3556
3643
  // TODO: implement later
3557
3644
  //export let labels = yValues;
3558
3645
  //export let showLabels = "no"; // can be "no", "hover", "always"
3646
+ /* constants for internal use */
3559
3647
  const markers = ["●", "◼", "▲", "▼", "⬥", "+", "*", "⨯"];
3560
3648
 
3561
3649
  let markerSymbol;
@@ -3662,7 +3750,7 @@ function create_if_block$1(ctx) {
3662
3750
  polyline = svg_element("polyline");
3663
3751
  attr(polyline, "class", "line");
3664
3752
  attr(polyline, "points", /*p*/ ctx[2]);
3665
- attr(g, "class", "series lineseries");
3753
+ attr(g, "class", "series series_line");
3666
3754
  attr(g, "style", /*lineStyleStr*/ ctx[1]);
3667
3755
  attr(g, "title", /*title*/ ctx[0]);
3668
3756
  },
@@ -3797,7 +3885,8 @@ function instance$1($$self, $$props, $$invalidate) {
3797
3885
  }
3798
3886
 
3799
3887
  if ($$self.$$.dirty & /*lineColor, lineWidth, $scale, lineType*/ 39936) {
3800
- $$invalidate(1, lineStyleStr = `fill:transparent;stroke:${lineColor};stroke-width: ${lineWidth}px;stroke-dasharray:${axes.LINE_STYLES[$scale][lineType - 1]}`);
3888
+ $$invalidate(1, lineStyleStr = `fill:transparent;stroke:${lineColor};stroke-width: ${lineWidth}px;
3889
+ stroke-dasharray:${axes.LINE_STYLES[$scale][lineType - 1]}`);
3801
3890
  }
3802
3891
  };
3803
3892