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.js CHANGED
@@ -136,6 +136,10 @@
136
136
  function empty() {
137
137
  return text('');
138
138
  }
139
+ function listen(node, event, handler, options) {
140
+ node.addEventListener(event, handler, options);
141
+ return () => node.removeEventListener(event, handler, options);
142
+ }
139
143
  function attr(node, attribute, value) {
140
144
  if (value == null)
141
145
  node.removeAttribute(attribute);
@@ -161,6 +165,11 @@
161
165
  function toggle_class(element, name, toggle) {
162
166
  element.classList[toggle ? 'add' : 'remove'](name);
163
167
  }
168
+ function custom_event(type, detail, bubbles = false) {
169
+ const e = document.createEvent('CustomEvent');
170
+ e.initCustomEvent(type, bubbles, false, detail);
171
+ return e;
172
+ }
164
173
 
165
174
  let current_component;
166
175
  function set_current_component(component) {
@@ -174,6 +183,20 @@
174
183
  function onMount(fn) {
175
184
  get_current_component().$$.on_mount.push(fn);
176
185
  }
186
+ function createEventDispatcher() {
187
+ const component = get_current_component();
188
+ return (type, detail) => {
189
+ const callbacks = component.$$.callbacks[type];
190
+ if (callbacks) {
191
+ // TODO are there situations where events could be dispatched
192
+ // in a server (non-DOM) environment?
193
+ const event = custom_event(type, detail);
194
+ callbacks.slice().forEach(fn => {
195
+ fn.call(component, event);
196
+ });
197
+ }
198
+ };
199
+ }
177
200
  function setContext(key, context) {
178
201
  get_current_component().$$.context.set(key, context);
179
202
  }
@@ -478,8 +501,8 @@
478
501
 
479
502
  /* src/Axes.svelte generated by Svelte v3.46.3 */
480
503
 
481
- function add_css$2(target) {
482
- append_styles(target, "svelte-vuzab", ".plot{font-family:Arial, Helvetica, sans-serif;display:grid;grid-template-columns:min-content 1fr;grid-template-rows:auto 1fr auto;grid-template-areas:\". title\"\n \"ylab axes\"\n \". xlab\";box-sizing:border-box;background:#fefefe;min-width:100px;min-height:50px;width:100%;height:100%;padding:0;margin:0}.plot_small{font-size:11px}.plot_medium{font-size:13px}.plot_large{font-size:16px}.plot_error{display:flex}.plot_error > .axes-wrapper{display:none}.message_error{font-size:1.2em;color:crimson;padding:20px;text-align:center}.axes-wrapper{grid-area:axes;position:relative;box-sizing:border-box;display:flex;padding:0;margin:0}.axes{display:block;box-sizing:border-box;position:absolute;padding:0;margin:0;height:100%;width:100%;max-height:100%;max-width:100%;min-height:100%;min-width:100%}.axes__xlabel{grid-area:xlab;font-size:1.0em;font-weight:600;padding:0.25em;text-align:center}.axes__ylabel{grid-area:ylab;font-size:1.0em;font-weight:600;padding:0.25em;text-align:center;vertical-align:middle;display:flex}.axes__ylabel > span{width:1.5em;line-height:1.5em;display:inline-block;writing-mode:vertical-rl;transform:rotate(180deg)}.axes__title{background:transparent;grid-area:title;font-size:1.3em;font-weight:bold;line-height:1.2em;padding:0.5em 0;text-align:center}.axis-labels{fill:#303030;font-size:0.95em}.labels{fill:#606060;font-size:0.90em}.labels{visibility:hidden;transition:visibility 0.25s linear, opacity 0.25s linear;opacity:0}");
504
+ function add_css$3(target) {
505
+ 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}");
483
506
  }
484
507
 
485
508
  const get_box_slot_changes = dirty => ({});
@@ -489,7 +512,7 @@
489
512
  const get_xaxis_slot_changes = dirty => ({});
490
513
  const get_xaxis_slot_context = ctx => ({});
491
514
 
492
- // (313:3) {#if title !== ""}
515
+ // (338:3) {#if title !== ""}
493
516
  function create_if_block_3(ctx) {
494
517
  let div;
495
518
 
@@ -510,7 +533,7 @@
510
533
  };
511
534
  }
512
535
 
513
- // (314:3) {#if yLabel !== ""}
536
+ // (339:3) {#if yLabel !== ""}
514
537
  function create_if_block_2(ctx) {
515
538
  let div;
516
539
  let span;
@@ -534,7 +557,7 @@
534
557
  };
535
558
  }
536
559
 
537
- // (315:3) {#if xLabel !== ""}
560
+ // (340:3) {#if xLabel !== ""}
538
561
  function create_if_block_1(ctx) {
539
562
  let div;
540
563
  let span;
@@ -558,7 +581,7 @@
558
581
  };
559
582
  }
560
583
 
561
- // (343:3) {#if !$isOk}
584
+ // (368:3) {#if !$isOk}
562
585
  function create_if_block$9(ctx) {
563
586
  let p;
564
587
 
@@ -598,17 +621,19 @@
598
621
  let t3;
599
622
  let div1_class_value;
600
623
  let current;
624
+ let mounted;
625
+ let dispose;
601
626
  let if_block0 = /*title*/ ctx[0] !== "" && create_if_block_3(ctx);
602
627
  let if_block1 = /*yLabel*/ ctx[2] !== "" && create_if_block_2(ctx);
603
628
  let if_block2 = /*xLabel*/ ctx[1] !== "" && create_if_block_1(ctx);
604
- const xaxis_slot_template = /*#slots*/ ctx[25].xaxis;
605
- const xaxis_slot = create_slot(xaxis_slot_template, ctx, /*$$scope*/ ctx[24], get_xaxis_slot_context);
606
- const yaxis_slot_template = /*#slots*/ ctx[25].yaxis;
607
- const yaxis_slot = create_slot(yaxis_slot_template, ctx, /*$$scope*/ ctx[24], get_yaxis_slot_context);
608
- const default_slot_template = /*#slots*/ ctx[25].default;
609
- const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[24], null);
610
- const box_slot_template = /*#slots*/ ctx[25].box;
611
- const box_slot = create_slot(box_slot_template, ctx, /*$$scope*/ ctx[24], get_box_slot_context);
629
+ const xaxis_slot_template = /*#slots*/ ctx[26].xaxis;
630
+ const xaxis_slot = create_slot(xaxis_slot_template, ctx, /*$$scope*/ ctx[25], get_xaxis_slot_context);
631
+ const yaxis_slot_template = /*#slots*/ ctx[26].yaxis;
632
+ const yaxis_slot = create_slot(yaxis_slot_template, ctx, /*$$scope*/ ctx[25], get_yaxis_slot_context);
633
+ const default_slot_template = /*#slots*/ ctx[26].default;
634
+ const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[25], null);
635
+ const box_slot_template = /*#slots*/ ctx[26].box;
636
+ const box_slot = create_slot(box_slot_template, ctx, /*$$scope*/ ctx[25], get_box_slot_context);
612
637
  let if_block3 = !/*$isOk*/ ctx[3] && create_if_block$9();
613
638
 
614
639
  return {
@@ -632,6 +657,7 @@
632
657
  if (box_slot) box_slot.c();
633
658
  t3 = space();
634
659
  if (if_block3) if_block3.c();
660
+ set_style(rect, "pointer-events", "none");
635
661
  attr(rect, "x", rect_x_value = /*cpx*/ ctx[7][0]);
636
662
  attr(rect, "y", rect_y_value = /*cpy*/ ctx[6][1]);
637
663
  attr(rect, "width", rect_width_value = /*cpx*/ ctx[7][1] - /*cpx*/ ctx[7][0]);
@@ -640,8 +666,8 @@
640
666
  attr(g, "clip-path", "url(#" + /*clipPathID*/ ctx[8] + ")");
641
667
  attr(svg, "preserveAspectRatio", "none");
642
668
  attr(svg, "class", "axes");
643
- attr(div0, "class", "axes-wrapper");
644
- attr(div1, "class", div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]));
669
+ attr(div0, "class", "axes-wrapper svelte-n80kcc");
670
+ attr(div1, "class", div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-n80kcc");
645
671
  toggle_class(div1, "plot_error", !/*$isOk*/ ctx[3]);
646
672
  },
647
673
  m(target, anchor) {
@@ -676,10 +702,15 @@
676
702
  box_slot.m(svg, null);
677
703
  }
678
704
 
679
- /*div0_binding*/ ctx[26](div0);
705
+ /*div0_binding*/ ctx[27](div0);
680
706
  append(div1, t3);
681
707
  if (if_block3) if_block3.m(div1, null);
682
708
  current = true;
709
+
710
+ if (!mounted) {
711
+ dispose = listen(svg, "click", /*handleClick*/ ctx[15]);
712
+ mounted = true;
713
+ }
683
714
  },
684
715
  p(ctx, dirty) {
685
716
  if (/*title*/ ctx[0] !== "") {
@@ -738,60 +769,60 @@
738
769
  }
739
770
 
740
771
  if (xaxis_slot) {
741
- if (xaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
772
+ if (xaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 33554432)) {
742
773
  update_slot_base(
743
774
  xaxis_slot,
744
775
  xaxis_slot_template,
745
776
  ctx,
746
- /*$$scope*/ ctx[24],
777
+ /*$$scope*/ ctx[25],
747
778
  !current
748
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
749
- : get_slot_changes(xaxis_slot_template, /*$$scope*/ ctx[24], dirty, get_xaxis_slot_changes),
779
+ ? get_all_dirty_from_scope(/*$$scope*/ ctx[25])
780
+ : get_slot_changes(xaxis_slot_template, /*$$scope*/ ctx[25], dirty, get_xaxis_slot_changes),
750
781
  get_xaxis_slot_context
751
782
  );
752
783
  }
753
784
  }
754
785
 
755
786
  if (yaxis_slot) {
756
- if (yaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
787
+ if (yaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 33554432)) {
757
788
  update_slot_base(
758
789
  yaxis_slot,
759
790
  yaxis_slot_template,
760
791
  ctx,
761
- /*$$scope*/ ctx[24],
792
+ /*$$scope*/ ctx[25],
762
793
  !current
763
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
764
- : get_slot_changes(yaxis_slot_template, /*$$scope*/ ctx[24], dirty, get_yaxis_slot_changes),
794
+ ? get_all_dirty_from_scope(/*$$scope*/ ctx[25])
795
+ : get_slot_changes(yaxis_slot_template, /*$$scope*/ ctx[25], dirty, get_yaxis_slot_changes),
765
796
  get_yaxis_slot_context
766
797
  );
767
798
  }
768
799
  }
769
800
 
770
801
  if (default_slot) {
771
- if (default_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
802
+ if (default_slot.p && (!current || dirty[0] & /*$$scope*/ 33554432)) {
772
803
  update_slot_base(
773
804
  default_slot,
774
805
  default_slot_template,
775
806
  ctx,
776
- /*$$scope*/ ctx[24],
807
+ /*$$scope*/ ctx[25],
777
808
  !current
778
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
779
- : get_slot_changes(default_slot_template, /*$$scope*/ ctx[24], dirty, null),
809
+ ? get_all_dirty_from_scope(/*$$scope*/ ctx[25])
810
+ : get_slot_changes(default_slot_template, /*$$scope*/ ctx[25], dirty, null),
780
811
  null
781
812
  );
782
813
  }
783
814
  }
784
815
 
785
816
  if (box_slot) {
786
- if (box_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
817
+ if (box_slot.p && (!current || dirty[0] & /*$$scope*/ 33554432)) {
787
818
  update_slot_base(
788
819
  box_slot,
789
820
  box_slot_template,
790
821
  ctx,
791
- /*$$scope*/ ctx[24],
822
+ /*$$scope*/ ctx[25],
792
823
  !current
793
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
794
- : get_slot_changes(box_slot_template, /*$$scope*/ ctx[24], dirty, get_box_slot_changes),
824
+ ? get_all_dirty_from_scope(/*$$scope*/ ctx[25])
825
+ : get_slot_changes(box_slot_template, /*$$scope*/ ctx[25], dirty, get_box_slot_changes),
795
826
  get_box_slot_context
796
827
  );
797
828
  }
@@ -808,7 +839,7 @@
808
839
  if_block3 = null;
809
840
  }
810
841
 
811
- if (!current || dirty[0] & /*$scale*/ 16 && div1_class_value !== (div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]))) {
842
+ if (!current || dirty[0] & /*$scale*/ 16 && div1_class_value !== (div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-n80kcc")) {
812
843
  attr(div1, "class", div1_class_value);
813
844
  }
814
845
 
@@ -840,8 +871,10 @@
840
871
  if (yaxis_slot) yaxis_slot.d(detaching);
841
872
  if (default_slot) default_slot.d(detaching);
842
873
  if (box_slot) box_slot.d(detaching);
843
- /*div0_binding*/ ctx[26](null);
874
+ /*div0_binding*/ ctx[27](null);
844
875
  if (if_block3) if_block3.d();
876
+ mounted = false;
877
+ dispose();
845
878
  }
846
879
  };
847
880
  }
@@ -889,7 +922,9 @@
889
922
  let { yLabel = "" } = $$props;
890
923
  let { multiSeries = true } = $$props;
891
924
 
892
- /* constants for internal use */
925
+ // event dispatcher
926
+ const dispatch = createEventDispatcher();
927
+
893
928
  // how big are margins (number of pixels in unit margin value) between axis and plot area if axis are shown
894
929
  const AXES_MARGIN_FACTORS = { "small": 30, "medium": 40, "large": 50 };
895
930
 
@@ -917,13 +952,13 @@
917
952
  /* reactive parameters to be shared with children via context */
918
953
  const width = writable(100); // actual width of plotting area in pixels
919
954
 
920
- component_subscribe($$self, width, value => $$invalidate(22, $width = value));
955
+ component_subscribe($$self, width, value => $$invalidate(23, $width = value));
921
956
  const height = writable(100); // actual height of plotting area in pixels
922
- component_subscribe($$self, height, value => $$invalidate(20, $height = value));
957
+ component_subscribe($$self, height, value => $$invalidate(21, $height = value));
923
958
  const xLim = writable([undefined, undefined]); // actual limits for x-axis in plot units
924
- component_subscribe($$self, xLim, value => $$invalidate(23, $xLim = value));
959
+ component_subscribe($$self, xLim, value => $$invalidate(24, $xLim = value));
925
960
  const yLim = writable([undefined, undefined]); // actual limits for y-axis in plot units
926
- component_subscribe($$self, yLim, value => $$invalidate(21, $yLim = value));
961
+ component_subscribe($$self, yLim, value => $$invalidate(22, $yLim = value));
927
962
  const scale = writable("medium"); // scale factor (how big the shown plot is)
928
963
  component_subscribe($$self, scale, value => $$invalidate(4, $scale = value));
929
964
  const isOk = writable(false); // are axes ready for drawing
@@ -931,18 +966,18 @@
931
966
 
932
967
  /** Adds margins for x-axis (e.g. when x-axis must be shown) */
933
968
  const addXAxisMargins = function () {
934
- $$invalidate(18, axesMargins[0] = 1, axesMargins);
935
- $$invalidate(18, axesMargins[2] = 0.5, axesMargins);
936
- $$invalidate(18, axesMargins[1] = axesMargins[1] > 0.5 ? axesMargins[1] : 0.5, axesMargins);
937
- $$invalidate(18, axesMargins[3] = axesMargins[3] > 0.5 ? axesMargins[3] : 0.5, axesMargins);
969
+ $$invalidate(19, axesMargins[0] = 1, axesMargins);
970
+ $$invalidate(19, axesMargins[2] = 0.5, axesMargins);
971
+ $$invalidate(19, axesMargins[1] = axesMargins[1] > 0.5 ? axesMargins[1] : 0.5, axesMargins);
972
+ $$invalidate(19, axesMargins[3] = axesMargins[3] > 0.5 ? axesMargins[3] : 0.5, axesMargins);
938
973
  };
939
974
 
940
975
  /** Adds margins for y-axis (e.g. when y-axis must be shown) */
941
976
  const addYAxisMargins = function () {
942
- $$invalidate(18, axesMargins[1] = 1, axesMargins);
943
- $$invalidate(18, axesMargins[3] = 0.5, axesMargins);
944
- $$invalidate(18, axesMargins[0] = axesMargins[0] > 0.5 ? axesMargins[0] : 0.5, axesMargins);
945
- $$invalidate(18, axesMargins[2] = axesMargins[2] > 0.5 ? axesMargins[2] : 0.5, axesMargins);
977
+ $$invalidate(19, axesMargins[1] = 1, axesMargins);
978
+ $$invalidate(19, axesMargins[3] = 0.5, axesMargins);
979
+ $$invalidate(19, axesMargins[0] = axesMargins[0] > 0.5 ? axesMargins[0] : 0.5, axesMargins);
980
+ $$invalidate(19, axesMargins[2] = axesMargins[2] > 0.5 ? axesMargins[2] : 0.5, axesMargins);
946
981
  };
947
982
 
948
983
  /** Adjusts limits for x-axis (e.g. when new series is added)
@@ -1105,6 +1140,31 @@
1105
1140
  ro.observe(axesWrapper);
1106
1141
  });
1107
1142
 
1143
+ // handle click on plot elements and dispatch manual events
1144
+ function dispatchClickEvent(eventName, el) {
1145
+ dispatch(eventName, {
1146
+ seriesTitle: el.parentNode.getAttribute('title'),
1147
+ elementID: el.dataset.id
1148
+ });
1149
+ }
1150
+
1151
+ function handleClick(e) {
1152
+ // scatter plot markers
1153
+ if (e.target.tagName === "text" && e.target.parentNode.classList.contains("series_scatter")) {
1154
+ dispatchClickEvent("markerclick", e.target);
1155
+ return;
1156
+ }
1157
+
1158
+ // bar plot bars
1159
+ if (e.target.tagName === "rect" && e.target.parentNode.classList.contains("series_bar")) {
1160
+ dispatchClickEvent("barclick", e.target);
1161
+ return;
1162
+ }
1163
+
1164
+ // outside any plot element
1165
+ dispatch("axesclick");
1166
+ }
1167
+
1108
1168
  function div0_binding($$value) {
1109
1169
  binding_callbacks[$$value ? 'unshift' : 'push'](() => {
1110
1170
  axesWrapper = $$value;
@@ -1113,42 +1173,42 @@
1113
1173
  }
1114
1174
 
1115
1175
  $$self.$$set = $$props => {
1116
- if ('limX' in $$props) $$invalidate(15, limX = $$props.limX);
1117
- if ('limY' in $$props) $$invalidate(16, limY = $$props.limY);
1176
+ if ('limX' in $$props) $$invalidate(16, limX = $$props.limX);
1177
+ if ('limY' in $$props) $$invalidate(17, limY = $$props.limY);
1118
1178
  if ('title' in $$props) $$invalidate(0, title = $$props.title);
1119
1179
  if ('xLabel' in $$props) $$invalidate(1, xLabel = $$props.xLabel);
1120
1180
  if ('yLabel' in $$props) $$invalidate(2, yLabel = $$props.yLabel);
1121
- if ('multiSeries' in $$props) $$invalidate(17, multiSeries = $$props.multiSeries);
1122
- if ('$$scope' in $$props) $$invalidate(24, $$scope = $$props.$$scope);
1181
+ if ('multiSeries' in $$props) $$invalidate(18, multiSeries = $$props.multiSeries);
1182
+ if ('$$scope' in $$props) $$invalidate(25, $$scope = $$props.$$scope);
1123
1183
  };
1124
1184
 
1125
1185
  $$self.$$.update = () => {
1126
- if ($$self.$$.dirty[0] & /*limX*/ 32768) {
1186
+ if ($$self.$$.dirty[0] & /*limX*/ 65536) {
1127
1187
  // this is reactive in case if limX and limY are interactively changed by parent script
1128
1188
  if (!limX.some(v => v === undefined)) xLim.update(v => limX);
1129
1189
  }
1130
1190
 
1131
- if ($$self.$$.dirty[0] & /*limY*/ 65536) {
1191
+ if ($$self.$$.dirty[0] & /*limY*/ 131072) {
1132
1192
  if (!limY.some(v => v === undefined)) yLim.update(v => limY);
1133
1193
  }
1134
1194
 
1135
- if ($$self.$$.dirty[0] & /*axesMargins, $scale*/ 262160) {
1195
+ if ($$self.$$.dirty[0] & /*axesMargins, $scale*/ 524304) {
1136
1196
  // computes real margins in pixels based on current scale
1137
- $$invalidate(19, margins = axesMargins.map(v => v * AXES_MARGIN_FACTORS[$scale]));
1197
+ $$invalidate(20, margins = axesMargins.map(v => v * AXES_MARGIN_FACTORS[$scale]));
1138
1198
  }
1139
1199
 
1140
- if ($$self.$$.dirty[0] & /*$yLim, $xLim, $width, margins, $height*/ 16252928) {
1200
+ if ($$self.$$.dirty[0] & /*$yLim, $xLim, $width, margins, $height*/ 32505856) {
1141
1201
  // computes status which tells that axes limits look fine and it is safe to draw
1142
1202
  // the status is based on the axis limits validity
1143
1203
  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]);
1144
1204
  }
1145
1205
 
1146
- if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/ 12582920) {
1206
+ if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/ 25165832) {
1147
1207
  // computes coordinates for clip path box
1148
1208
  $$invalidate(7, cpx = $isOk ? scaleX($xLim, $xLim, $width) : [0, 1]);
1149
1209
  }
1150
1210
 
1151
- if ($$self.$$.dirty[0] & /*$isOk, $yLim, $height*/ 3145736) {
1211
+ if ($$self.$$.dirty[0] & /*$isOk, $yLim, $height*/ 6291464) {
1152
1212
  $$invalidate(6, cpy = $isOk ? scaleY($yLim, $yLim, $height) : [1, 0]);
1153
1213
  }
1154
1214
  };
@@ -1169,6 +1229,7 @@
1169
1229
  yLim,
1170
1230
  scale,
1171
1231
  isOk,
1232
+ handleClick,
1172
1233
  limX,
1173
1234
  limY,
1174
1235
  multiSeries,
@@ -1195,14 +1256,14 @@
1195
1256
  create_fragment$b,
1196
1257
  safe_not_equal,
1197
1258
  {
1198
- limX: 15,
1199
- limY: 16,
1259
+ limX: 16,
1260
+ limY: 17,
1200
1261
  title: 0,
1201
1262
  xLabel: 1,
1202
1263
  yLabel: 2,
1203
- multiSeries: 17
1264
+ multiSeries: 18
1204
1265
  },
1205
- add_css$2,
1266
+ add_css$3,
1206
1267
  [-1, -1]
1207
1268
  );
1208
1269
  }
@@ -1992,14 +2053,15 @@
1992
2053
 
1993
2054
  function get_each_context$3(ctx, list, i) {
1994
2055
  const child_ctx = ctx.slice();
1995
- child_ctx[23] = list[i];
1996
- child_ctx[25] = i;
2056
+ child_ctx[25] = list[i];
2057
+ child_ctx[27] = i;
1997
2058
  return child_ctx;
1998
2059
  }
1999
2060
 
2000
- // (51:0) {#if rx !== undefined && ry !== undefined}
2061
+ // (53:0) {#if rx !== undefined && ry !== undefined}
2001
2062
  function create_if_block$6(ctx) {
2002
- let each_1_anchor;
2063
+ let g;
2064
+ let g_class_value;
2003
2065
  let each_value = /*left*/ ctx[0];
2004
2066
  let each_blocks = [];
2005
2067
 
@@ -2009,21 +2071,25 @@
2009
2071
 
2010
2072
  return {
2011
2073
  c() {
2074
+ g = svg_element("g");
2075
+
2012
2076
  for (let i = 0; i < each_blocks.length; i += 1) {
2013
2077
  each_blocks[i].c();
2014
2078
  }
2015
2079
 
2016
- each_1_anchor = empty();
2080
+ attr(g, "class", g_class_value = "series " + /*style*/ ctx[2]);
2081
+ attr(g, "title", /*title*/ ctx[1]);
2082
+ attr(g, "style", /*barsStyleStr*/ ctx[7]);
2017
2083
  },
2018
2084
  m(target, anchor) {
2085
+ insert(target, g, anchor);
2086
+
2019
2087
  for (let i = 0; i < each_blocks.length; i += 1) {
2020
- each_blocks[i].m(target, anchor);
2088
+ each_blocks[i].m(g, null);
2021
2089
  }
2022
-
2023
- insert(target, each_1_anchor, anchor);
2024
2090
  },
2025
2091
  p(ctx, dirty) {
2026
- if (dirty & /*rx, ry, rw, rh, barsStyleStr, left*/ 63) {
2092
+ if (dirty & /*rx, ry, rw, rh, left*/ 121) {
2027
2093
  each_value = /*left*/ ctx[0];
2028
2094
  let i;
2029
2095
 
@@ -2035,7 +2101,7 @@
2035
2101
  } else {
2036
2102
  each_blocks[i] = create_each_block$3(child_ctx);
2037
2103
  each_blocks[i].c();
2038
- each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
2104
+ each_blocks[i].m(g, null);
2039
2105
  }
2040
2106
  }
2041
2107
 
@@ -2045,15 +2111,23 @@
2045
2111
 
2046
2112
  each_blocks.length = each_value.length;
2047
2113
  }
2114
+
2115
+ if (dirty & /*style*/ 4 && g_class_value !== (g_class_value = "series " + /*style*/ ctx[2])) {
2116
+ attr(g, "class", g_class_value);
2117
+ }
2118
+
2119
+ if (dirty & /*title*/ 2) {
2120
+ attr(g, "title", /*title*/ ctx[1]);
2121
+ }
2048
2122
  },
2049
2123
  d(detaching) {
2124
+ if (detaching) detach(g);
2050
2125
  destroy_each(each_blocks, detaching);
2051
- if (detaching) detach(each_1_anchor);
2052
2126
  }
2053
2127
  };
2054
2128
  }
2055
2129
 
2056
- // (52:3) {#each left as v, i}
2130
+ // (55:3) {#each left as v, i}
2057
2131
  function create_each_block$3(ctx) {
2058
2132
  let rect;
2059
2133
  let rect_x_value;
@@ -2064,29 +2138,28 @@
2064
2138
  return {
2065
2139
  c() {
2066
2140
  rect = svg_element("rect");
2067
- attr(rect, "x", rect_x_value = /*rx*/ ctx[4][/*i*/ ctx[25]]);
2068
- attr(rect, "y", rect_y_value = /*ry*/ ctx[3][/*i*/ ctx[25]]);
2069
- attr(rect, "width", rect_width_value = /*rw*/ ctx[2][/*i*/ ctx[25]]);
2070
- attr(rect, "height", rect_height_value = /*rh*/ ctx[1][/*i*/ ctx[25]]);
2071
- attr(rect, "style", /*barsStyleStr*/ ctx[5]);
2141
+ attr(rect, "x", rect_x_value = /*rx*/ ctx[6][/*i*/ ctx[27]]);
2142
+ attr(rect, "y", rect_y_value = /*ry*/ ctx[5][/*i*/ ctx[27]]);
2143
+ attr(rect, "width", rect_width_value = /*rw*/ ctx[4][/*i*/ ctx[27]]);
2144
+ attr(rect, "height", rect_height_value = /*rh*/ ctx[3][/*i*/ ctx[27]]);
2072
2145
  },
2073
2146
  m(target, anchor) {
2074
2147
  insert(target, rect, anchor);
2075
2148
  },
2076
2149
  p(ctx, dirty) {
2077
- if (dirty & /*rx*/ 16 && rect_x_value !== (rect_x_value = /*rx*/ ctx[4][/*i*/ ctx[25]])) {
2150
+ if (dirty & /*rx*/ 64 && rect_x_value !== (rect_x_value = /*rx*/ ctx[6][/*i*/ ctx[27]])) {
2078
2151
  attr(rect, "x", rect_x_value);
2079
2152
  }
2080
2153
 
2081
- if (dirty & /*ry*/ 8 && rect_y_value !== (rect_y_value = /*ry*/ ctx[3][/*i*/ ctx[25]])) {
2154
+ if (dirty & /*ry*/ 32 && rect_y_value !== (rect_y_value = /*ry*/ ctx[5][/*i*/ ctx[27]])) {
2082
2155
  attr(rect, "y", rect_y_value);
2083
2156
  }
2084
2157
 
2085
- if (dirty & /*rw*/ 4 && rect_width_value !== (rect_width_value = /*rw*/ ctx[2][/*i*/ ctx[25]])) {
2158
+ if (dirty & /*rw*/ 16 && rect_width_value !== (rect_width_value = /*rw*/ ctx[4][/*i*/ ctx[27]])) {
2086
2159
  attr(rect, "width", rect_width_value);
2087
2160
  }
2088
2161
 
2089
- if (dirty & /*rh*/ 2 && rect_height_value !== (rect_height_value = /*rh*/ ctx[1][/*i*/ ctx[25]])) {
2162
+ if (dirty & /*rh*/ 8 && rect_height_value !== (rect_height_value = /*rh*/ ctx[3][/*i*/ ctx[27]])) {
2090
2163
  attr(rect, "height", rect_height_value);
2091
2164
  }
2092
2165
  },
@@ -2098,7 +2171,7 @@
2098
2171
 
2099
2172
  function create_fragment$8(ctx) {
2100
2173
  let if_block_anchor;
2101
- let if_block = /*rx*/ ctx[4] !== undefined && /*ry*/ ctx[3] !== undefined && create_if_block$6(ctx);
2174
+ let if_block = /*rx*/ ctx[6] !== undefined && /*ry*/ ctx[5] !== undefined && create_if_block$6(ctx);
2102
2175
 
2103
2176
  return {
2104
2177
  c() {
@@ -2110,7 +2183,7 @@
2110
2183
  insert(target, if_block_anchor, anchor);
2111
2184
  },
2112
2185
  p(ctx, [dirty]) {
2113
- if (/*rx*/ ctx[4] !== undefined && /*ry*/ ctx[3] !== undefined) {
2186
+ if (/*rx*/ ctx[6] !== undefined && /*ry*/ ctx[5] !== undefined) {
2114
2187
  if (if_block) {
2115
2188
  if_block.p(ctx, dirty);
2116
2189
  } else {
@@ -2149,6 +2222,8 @@
2149
2222
  let { faceColor = Colors.PRIMARY } = $$props;
2150
2223
  let { borderColor = faceColor } = $$props;
2151
2224
  let { lineWidth = 1 } = $$props;
2225
+ let { title = "" } = $$props;
2226
+ let { style = "series_rect" } = $$props;
2152
2227
 
2153
2228
  // styles for bars and labels
2154
2229
  const barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`;
@@ -2177,46 +2252,50 @@
2177
2252
  const axes = getContext('axes');
2178
2253
 
2179
2254
  const xLim = axes.xLim;
2180
- component_subscribe($$self, xLim, value => $$invalidate(20, $xLim = value));
2255
+ component_subscribe($$self, xLim, value => $$invalidate(22, $xLim = value));
2181
2256
  const yLim = axes.yLim;
2182
- component_subscribe($$self, yLim, value => $$invalidate(18, $yLim = value));
2257
+ component_subscribe($$self, yLim, value => $$invalidate(20, $yLim = value));
2183
2258
  const axesWidth = axes.width;
2184
- component_subscribe($$self, axesWidth, value => $$invalidate(19, $axesWidth = value));
2259
+ component_subscribe($$self, axesWidth, value => $$invalidate(21, $axesWidth = value));
2185
2260
  const axesHeight = axes.height;
2186
- component_subscribe($$self, axesHeight, value => $$invalidate(17, $axesHeight = value));
2261
+ component_subscribe($$self, axesHeight, value => $$invalidate(19, $axesHeight = value));
2187
2262
 
2188
2263
  $$self.$$set = $$props => {
2189
2264
  if ('left' in $$props) $$invalidate(0, left = $$props.left);
2190
- if ('top' in $$props) $$invalidate(12, top = $$props.top);
2191
- if ('width' in $$props) $$invalidate(10, width = $$props.width);
2192
- if ('height' in $$props) $$invalidate(11, height = $$props.height);
2193
- if ('labels' in $$props) $$invalidate(13, labels = $$props.labels);
2194
- if ('faceColor' in $$props) $$invalidate(14, faceColor = $$props.faceColor);
2195
- if ('borderColor' in $$props) $$invalidate(15, borderColor = $$props.borderColor);
2196
- if ('lineWidth' in $$props) $$invalidate(16, lineWidth = $$props.lineWidth);
2265
+ if ('top' in $$props) $$invalidate(14, top = $$props.top);
2266
+ if ('width' in $$props) $$invalidate(12, width = $$props.width);
2267
+ if ('height' in $$props) $$invalidate(13, height = $$props.height);
2268
+ if ('labels' in $$props) $$invalidate(15, labels = $$props.labels);
2269
+ if ('faceColor' in $$props) $$invalidate(16, faceColor = $$props.faceColor);
2270
+ if ('borderColor' in $$props) $$invalidate(17, borderColor = $$props.borderColor);
2271
+ if ('lineWidth' in $$props) $$invalidate(18, lineWidth = $$props.lineWidth);
2272
+ if ('title' in $$props) $$invalidate(1, title = $$props.title);
2273
+ if ('style' in $$props) $$invalidate(2, style = $$props.style);
2197
2274
  };
2198
2275
 
2199
2276
  $$self.$$.update = () => {
2200
- if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 1572865) {
2277
+ if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 6291457) {
2201
2278
  // reactive variables for coordinates of data points in pixels
2202
- $$invalidate(4, rx = axes.scaleX(left, $xLim, $axesWidth));
2279
+ $$invalidate(6, rx = axes.scaleX(left, $xLim, $axesWidth));
2203
2280
  }
2204
2281
 
2205
- if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 397312) {
2206
- $$invalidate(3, ry = axes.scaleY(top, $yLim, $axesHeight));
2282
+ if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 1589248) {
2283
+ $$invalidate(5, ry = axes.scaleY(top, $yLim, $axesHeight));
2207
2284
  }
2208
2285
 
2209
- if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/ 1573888) {
2210
- $$invalidate(2, rw = axes.scaleX(width, $xLim, $axesWidth, true));
2286
+ if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/ 6295552) {
2287
+ $$invalidate(4, rw = axes.scaleX(width, $xLim, $axesWidth, true));
2211
2288
  }
2212
2289
 
2213
- if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/ 395264) {
2214
- $$invalidate(1, rh = axes.scaleY(height, $yLim, $axesHeight, true));
2290
+ if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/ 1581056) {
2291
+ $$invalidate(3, rh = axes.scaleY(height, $yLim, $axesHeight, true));
2215
2292
  }
2216
2293
  };
2217
2294
 
2218
2295
  return [
2219
2296
  left,
2297
+ title,
2298
+ style,
2220
2299
  rh,
2221
2300
  rw,
2222
2301
  ry,
@@ -2246,13 +2325,15 @@
2246
2325
 
2247
2326
  init(this, options, instance$8, create_fragment$8, safe_not_equal, {
2248
2327
  left: 0,
2249
- top: 12,
2250
- width: 10,
2251
- height: 11,
2252
- labels: 13,
2253
- faceColor: 14,
2254
- borderColor: 15,
2255
- lineWidth: 16
2328
+ top: 14,
2329
+ width: 12,
2330
+ height: 13,
2331
+ labels: 15,
2332
+ faceColor: 16,
2333
+ borderColor: 17,
2334
+ lineWidth: 18,
2335
+ title: 1,
2336
+ style: 2
2256
2337
  });
2257
2338
  }
2258
2339
  }
@@ -2279,6 +2360,7 @@
2279
2360
  c() {
2280
2361
  g = svg_element("g");
2281
2362
  create_component(rectangles.$$.fragment);
2363
+ set_style(g, "pointer-events", "none");
2282
2364
  attr(g, "class", "mdaplot__axes-box");
2283
2365
  },
2284
2366
  m(target, anchor) {
@@ -2692,17 +2774,22 @@
2692
2774
 
2693
2775
  /* src/TextLabels.svelte generated by Svelte v3.46.3 */
2694
2776
 
2777
+ function add_css$2(target) {
2778
+ append_styles(target, "svelte-1szep8i", "text.svelte-1szep8i{dominant-baseline:middle}");
2779
+ }
2780
+
2695
2781
  function get_each_context$1(ctx, list, i) {
2696
2782
  const child_ctx = ctx.slice();
2697
- child_ctx[25] = list[i];
2698
- child_ctx[27] = i;
2783
+ child_ctx[27] = list[i];
2784
+ child_ctx[29] = i;
2699
2785
  return child_ctx;
2700
2786
  }
2701
2787
 
2702
- // (56:0) {#if x !== undefined && y !== undefined}
2788
+ // (66:0) {#if x !== undefined && y !== undefined}
2703
2789
  function create_if_block$3(ctx) {
2704
- let each_1_anchor;
2705
- let each_value = /*x*/ ctx[6];
2790
+ let g;
2791
+ let g_class_value;
2792
+ let each_value = /*x*/ ctx[7];
2706
2793
  let each_blocks = [];
2707
2794
 
2708
2795
  for (let i = 0; i < each_value.length; i += 1) {
@@ -2711,22 +2798,26 @@
2711
2798
 
2712
2799
  return {
2713
2800
  c() {
2801
+ g = svg_element("g");
2802
+
2714
2803
  for (let i = 0; i < each_blocks.length; i += 1) {
2715
2804
  each_blocks[i].c();
2716
2805
  }
2717
2806
 
2718
- each_1_anchor = empty();
2807
+ attr(g, "class", g_class_value = "series " + /*style*/ ctx[1]);
2808
+ attr(g, "title", /*title*/ ctx[2]);
2809
+ attr(g, "style", /*textStyleStr*/ ctx[3]);
2719
2810
  },
2720
2811
  m(target, anchor) {
2812
+ insert(target, g, anchor);
2813
+
2721
2814
  for (let i = 0; i < each_blocks.length; i += 1) {
2722
- each_blocks[i].m(target, anchor);
2815
+ each_blocks[i].m(g, null);
2723
2816
  }
2724
-
2725
- insert(target, each_1_anchor, anchor);
2726
2817
  },
2727
2818
  p(ctx, dirty) {
2728
- if (dirty & /*textStyleStr, x, y, dx, dy, textAnchors, pos, labels*/ 255) {
2729
- each_value = /*x*/ ctx[6];
2819
+ if (dirty & /*x, y, dx, dy, labels*/ 241) {
2820
+ each_value = /*x*/ ctx[7];
2730
2821
  let i;
2731
2822
 
2732
2823
  for (i = 0; i < each_value.length; i += 1) {
@@ -2737,7 +2828,7 @@
2737
2828
  } else {
2738
2829
  each_blocks[i] = create_each_block$1(child_ctx);
2739
2830
  each_blocks[i].c();
2740
- each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
2831
+ each_blocks[i].m(g, null);
2741
2832
  }
2742
2833
  }
2743
2834
 
@@ -2747,61 +2838,64 @@
2747
2838
 
2748
2839
  each_blocks.length = each_value.length;
2749
2840
  }
2841
+
2842
+ if (dirty & /*style*/ 2 && g_class_value !== (g_class_value = "series " + /*style*/ ctx[1])) {
2843
+ attr(g, "class", g_class_value);
2844
+ }
2845
+
2846
+ if (dirty & /*title*/ 4) {
2847
+ attr(g, "title", /*title*/ ctx[2]);
2848
+ }
2849
+
2850
+ if (dirty & /*textStyleStr*/ 8) {
2851
+ attr(g, "style", /*textStyleStr*/ ctx[3]);
2852
+ }
2750
2853
  },
2751
2854
  d(detaching) {
2855
+ if (detaching) detach(g);
2752
2856
  destroy_each(each_blocks, detaching);
2753
- if (detaching) detach(each_1_anchor);
2754
2857
  }
2755
2858
  };
2756
2859
  }
2757
2860
 
2758
- // (57:3) {#each x as v, i}
2861
+ // (68:3) {#each x as v, i}
2759
2862
  function create_each_block$1(ctx) {
2760
2863
  let text_1;
2761
- let raw_value = /*labels*/ ctx[0][/*i*/ ctx[27]] + "";
2864
+ let raw_value = /*labels*/ ctx[0][/*i*/ ctx[29]] + "";
2865
+ let text_1_data_id_value;
2762
2866
  let text_1_x_value;
2763
2867
  let text_1_y_value;
2764
- let text_1_text_anchor_value;
2765
2868
 
2766
2869
  return {
2767
2870
  c() {
2768
2871
  text_1 = svg_element("text");
2769
- attr(text_1, "style", /*textStyleStr*/ ctx[2]);
2770
- attr(text_1, "x", text_1_x_value = /*x*/ ctx[6][/*i*/ ctx[27]]);
2771
- attr(text_1, "y", text_1_y_value = /*y*/ ctx[5][/*i*/ ctx[27]]);
2772
- attr(text_1, "dx", /*dx*/ ctx[4]);
2773
- attr(text_1, "dy", /*dy*/ ctx[3]);
2774
- attr(text_1, "dominant-baseline", "middle");
2775
- attr(text_1, "text-anchor", text_1_text_anchor_value = /*textAnchors*/ ctx[7][/*pos*/ ctx[1]]);
2872
+ attr(text_1, "data-id", text_1_data_id_value = /*i*/ ctx[29]);
2873
+ attr(text_1, "x", text_1_x_value = /*x*/ ctx[7][/*i*/ ctx[29]]);
2874
+ attr(text_1, "y", text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]]);
2875
+ attr(text_1, "dx", /*dx*/ ctx[5]);
2876
+ attr(text_1, "dy", /*dy*/ ctx[4]);
2877
+ attr(text_1, "class", "svelte-1szep8i");
2776
2878
  },
2777
2879
  m(target, anchor) {
2778
2880
  insert(target, text_1, anchor);
2779
2881
  text_1.innerHTML = raw_value;
2780
2882
  },
2781
2883
  p(ctx, dirty) {
2782
- if (dirty & /*labels*/ 1 && raw_value !== (raw_value = /*labels*/ ctx[0][/*i*/ ctx[27]] + "")) text_1.innerHTML = raw_value;
2783
- if (dirty & /*textStyleStr*/ 4) {
2784
- attr(text_1, "style", /*textStyleStr*/ ctx[2]);
2785
- }
2786
-
2787
- if (dirty & /*x*/ 64 && text_1_x_value !== (text_1_x_value = /*x*/ ctx[6][/*i*/ ctx[27]])) {
2884
+ if (dirty & /*labels*/ 1 && raw_value !== (raw_value = /*labels*/ ctx[0][/*i*/ ctx[29]] + "")) text_1.innerHTML = raw_value;
2885
+ if (dirty & /*x*/ 128 && text_1_x_value !== (text_1_x_value = /*x*/ ctx[7][/*i*/ ctx[29]])) {
2788
2886
  attr(text_1, "x", text_1_x_value);
2789
2887
  }
2790
2888
 
2791
- if (dirty & /*y*/ 32 && text_1_y_value !== (text_1_y_value = /*y*/ ctx[5][/*i*/ ctx[27]])) {
2889
+ if (dirty & /*y*/ 64 && text_1_y_value !== (text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]])) {
2792
2890
  attr(text_1, "y", text_1_y_value);
2793
2891
  }
2794
2892
 
2795
- if (dirty & /*dx*/ 16) {
2796
- attr(text_1, "dx", /*dx*/ ctx[4]);
2797
- }
2798
-
2799
- if (dirty & /*dy*/ 8) {
2800
- attr(text_1, "dy", /*dy*/ ctx[3]);
2893
+ if (dirty & /*dx*/ 32) {
2894
+ attr(text_1, "dx", /*dx*/ ctx[5]);
2801
2895
  }
2802
2896
 
2803
- if (dirty & /*pos*/ 2 && text_1_text_anchor_value !== (text_1_text_anchor_value = /*textAnchors*/ ctx[7][/*pos*/ ctx[1]])) {
2804
- attr(text_1, "text-anchor", text_1_text_anchor_value);
2897
+ if (dirty & /*dy*/ 16) {
2898
+ attr(text_1, "dy", /*dy*/ ctx[4]);
2805
2899
  }
2806
2900
  },
2807
2901
  d(detaching) {
@@ -2812,7 +2906,7 @@
2812
2906
 
2813
2907
  function create_fragment$5(ctx) {
2814
2908
  let if_block_anchor;
2815
- let if_block = /*x*/ ctx[6] !== undefined && /*y*/ ctx[5] !== undefined && create_if_block$3(ctx);
2909
+ let if_block = /*x*/ ctx[7] !== undefined && /*y*/ ctx[6] !== undefined && create_if_block$3(ctx);
2816
2910
 
2817
2911
  return {
2818
2912
  c() {
@@ -2824,7 +2918,7 @@
2824
2918
  insert(target, if_block_anchor, anchor);
2825
2919
  },
2826
2920
  p(ctx, [dirty]) {
2827
- if (/*x*/ ctx[6] !== undefined && /*y*/ ctx[5] !== undefined) {
2921
+ if (/*x*/ ctx[7] !== undefined && /*y*/ ctx[6] !== undefined) {
2828
2922
  if (if_block) {
2829
2923
  if_block.p(ctx, dirty);
2830
2924
  } else {
@@ -2865,11 +2959,13 @@
2865
2959
  let { borderColor = "transparent" } = $$props;
2866
2960
  let { borderWidth = 0 } = $$props;
2867
2961
  let { textSize = 1 } = $$props;
2962
+ let { style = "" } = $$props;
2963
+ let { title = "series_text" } = $$props;
2868
2964
 
2869
2965
  // text-anchor values depending on position
2870
2966
  const textAnchors = ["middle", "middle", "start", "middle", "end"];
2871
2967
 
2872
- /* sanity check for input parameters */
2968
+ // sanity check for input parameters
2873
2969
  if (!Array.isArray(xValues) || !Array.isArray(yValues) || xValues.length !== yValues.length) {
2874
2970
  throw "TextLabels: parameters 'xValues' and 'yValues' must be vectors of the same length.";
2875
2971
  }
@@ -2878,30 +2974,32 @@
2878
2974
  const axes = getContext('axes');
2879
2975
 
2880
2976
  const xLim = axes.xLim;
2881
- component_subscribe($$self, xLim, value => $$invalidate(23, $xLim = value));
2977
+ component_subscribe($$self, xLim, value => $$invalidate(24, $xLim = value));
2882
2978
  const yLim = axes.yLim;
2883
- component_subscribe($$self, yLim, value => $$invalidate(21, $yLim = value));
2979
+ component_subscribe($$self, yLim, value => $$invalidate(22, $yLim = value));
2884
2980
  const axesWidth = axes.width;
2885
- component_subscribe($$self, axesWidth, value => $$invalidate(22, $axesWidth = value));
2981
+ component_subscribe($$self, axesWidth, value => $$invalidate(23, $axesWidth = value));
2886
2982
  const axesHeight = axes.height;
2887
- component_subscribe($$self, axesHeight, value => $$invalidate(20, $axesHeight = value));
2983
+ component_subscribe($$self, axesHeight, value => $$invalidate(21, $axesHeight = value));
2888
2984
  const scale = axes.scale;
2889
- component_subscribe($$self, scale, value => $$invalidate(19, $scale = value));
2985
+ component_subscribe($$self, scale, value => $$invalidate(20, $scale = value));
2890
2986
 
2891
2987
  $$self.$$set = $$props => {
2892
2988
  if ('xValues' in $$props) $$invalidate(13, xValues = $$props.xValues);
2893
2989
  if ('yValues' in $$props) $$invalidate(14, yValues = $$props.yValues);
2894
2990
  if ('labels' in $$props) $$invalidate(0, labels = $$props.labels);
2895
- if ('pos' in $$props) $$invalidate(1, pos = $$props.pos);
2896
- if ('faceColor' in $$props) $$invalidate(15, faceColor = $$props.faceColor);
2897
- if ('borderColor' in $$props) $$invalidate(16, borderColor = $$props.borderColor);
2898
- if ('borderWidth' in $$props) $$invalidate(17, borderWidth = $$props.borderWidth);
2899
- if ('textSize' in $$props) $$invalidate(18, textSize = $$props.textSize);
2991
+ if ('pos' in $$props) $$invalidate(15, pos = $$props.pos);
2992
+ if ('faceColor' in $$props) $$invalidate(16, faceColor = $$props.faceColor);
2993
+ if ('borderColor' in $$props) $$invalidate(17, borderColor = $$props.borderColor);
2994
+ if ('borderWidth' in $$props) $$invalidate(18, borderWidth = $$props.borderWidth);
2995
+ if ('textSize' in $$props) $$invalidate(19, textSize = $$props.textSize);
2996
+ if ('style' in $$props) $$invalidate(1, style = $$props.style);
2997
+ if ('title' in $$props) $$invalidate(2, title = $$props.title);
2900
2998
  };
2901
2999
 
2902
3000
  $$self.$$.update = () => {
2903
3001
  if ($$self.$$.dirty & /*xValues, labels*/ 8193) {
2904
- // multiply labels values if needed
3002
+ // multiply label values if needed
2905
3003
  {
2906
3004
  const n = xValues.length;
2907
3005
  if (!Array.isArray(labels)) $$invalidate(0, labels = Array(n).fill(labels));
@@ -2917,38 +3015,39 @@
2917
3015
  }
2918
3016
  }
2919
3017
 
2920
- if ($$self.$$.dirty & /*xValues, $xLim, $axesWidth*/ 12591104) {
3018
+ if ($$self.$$.dirty & /*xValues, $xLim, $axesWidth*/ 25174016) {
2921
3019
  // reactive variables for coordinates of data points in pixels
2922
- $$invalidate(6, x = axes.scaleX(xValues, $xLim, $axesWidth));
3020
+ $$invalidate(7, x = axes.scaleX(xValues, $xLim, $axesWidth));
2923
3021
  }
2924
3022
 
2925
- if ($$self.$$.dirty & /*yValues, $yLim, $axesHeight*/ 3162112) {
2926
- $$invalidate(5, y = axes.scaleY(yValues, $yLim, $axesHeight));
3023
+ if ($$self.$$.dirty & /*yValues, $yLim, $axesHeight*/ 6307840) {
3024
+ $$invalidate(6, y = axes.scaleY(yValues, $yLim, $axesHeight));
2927
3025
  }
2928
3026
 
2929
- if ($$self.$$.dirty & /*pos, $scale*/ 524290) {
2930
- $$invalidate(4, dx = [0, 0, 1, 0, -1][pos] * axes.LABELS_MARGIN[$scale]);
3027
+ if ($$self.$$.dirty & /*pos, $scale*/ 1081344) {
3028
+ $$invalidate(5, dx = [0, 0, 1, 0, -1][pos] * axes.LABELS_MARGIN[$scale]);
2931
3029
  }
2932
3030
 
2933
- if ($$self.$$.dirty & /*pos, $scale*/ 524290) {
2934
- $$invalidate(3, dy = [0, 1, 0, -1, 0][pos] * axes.LABELS_MARGIN[$scale]);
3031
+ if ($$self.$$.dirty & /*pos, $scale*/ 1081344) {
3032
+ $$invalidate(4, dy = [0, 1, 0, -1, 0][pos] * axes.LABELS_MARGIN[$scale]);
2935
3033
  }
2936
3034
 
2937
- if ($$self.$$.dirty & /*faceColor, borderWidth, borderColor, textSize*/ 491520) {
2938
- // styles for bars and labels
2939
- $$invalidate(2, textStyleStr = `fill:${faceColor};stroke-width:${borderWidth}px;stroke:${borderColor};font-size:${textSize}em;`);
3035
+ if ($$self.$$.dirty & /*faceColor, borderWidth, borderColor, textSize, pos*/ 1015808) {
3036
+ // styles for the elements
3037
+ $$invalidate(3, textStyleStr = `fill:${faceColor};stroke-width:${borderWidth}px;stroke:${borderColor};
3038
+ font-size:${textSize}em; text-anchor:${textAnchors[pos]};`);
2940
3039
  }
2941
3040
  };
2942
3041
 
2943
3042
  return [
2944
3043
  labels,
2945
- pos,
3044
+ style,
3045
+ title,
2946
3046
  textStyleStr,
2947
3047
  dy,
2948
3048
  dx,
2949
3049
  y,
2950
3050
  x,
2951
- textAnchors,
2952
3051
  xLim,
2953
3052
  yLim,
2954
3053
  axesWidth,
@@ -2956,6 +3055,7 @@
2956
3055
  scale,
2957
3056
  xValues,
2958
3057
  yValues,
3058
+ pos,
2959
3059
  faceColor,
2960
3060
  borderColor,
2961
3061
  borderWidth,
@@ -2972,16 +3072,26 @@
2972
3072
  constructor(options) {
2973
3073
  super();
2974
3074
 
2975
- init(this, options, instance$5, create_fragment$5, safe_not_equal, {
2976
- xValues: 13,
2977
- yValues: 14,
2978
- labels: 0,
2979
- pos: 1,
2980
- faceColor: 15,
2981
- borderColor: 16,
2982
- borderWidth: 17,
2983
- textSize: 18
2984
- });
3075
+ init(
3076
+ this,
3077
+ options,
3078
+ instance$5,
3079
+ create_fragment$5,
3080
+ safe_not_equal,
3081
+ {
3082
+ xValues: 13,
3083
+ yValues: 14,
3084
+ labels: 0,
3085
+ pos: 15,
3086
+ faceColor: 16,
3087
+ borderColor: 17,
3088
+ borderWidth: 18,
3089
+ textSize: 19,
3090
+ style: 1,
3091
+ title: 2
3092
+ },
3093
+ add_css$2
3094
+ );
2985
3095
  }
2986
3096
  }
2987
3097
 
@@ -3316,31 +3426,28 @@
3316
3426
  }
3317
3427
 
3318
3428
  function create_fragment$3(ctx) {
3319
- let g;
3320
3429
  let rectangles;
3321
3430
  let current;
3322
3431
 
3323
3432
  rectangles = new Rectangles({
3324
3433
  props: {
3434
+ style: "series_bar",
3325
3435
  left: /*left*/ ctx[4],
3326
3436
  top: /*top*/ ctx[5],
3327
3437
  width: /*width*/ ctx[3],
3328
3438
  height: /*height*/ ctx[6],
3329
3439
  borderColor: /*borderColor*/ ctx[2],
3330
- faceColor: /*faceColor*/ ctx[1]
3440
+ faceColor: /*faceColor*/ ctx[1],
3441
+ title: /*title*/ ctx[0]
3331
3442
  }
3332
3443
  });
3333
3444
 
3334
3445
  return {
3335
3446
  c() {
3336
- g = svg_element("g");
3337
3447
  create_component(rectangles.$$.fragment);
3338
- attr(g, "class", "series series_bar");
3339
- attr(g, "title", /*title*/ ctx[0]);
3340
3448
  },
3341
3449
  m(target, anchor) {
3342
- insert(target, g, anchor);
3343
- mount_component(rectangles, g, null);
3450
+ mount_component(rectangles, target, anchor);
3344
3451
  current = true;
3345
3452
  },
3346
3453
  p(ctx, [dirty]) {
@@ -3351,11 +3458,8 @@
3351
3458
  if (dirty & /*height*/ 64) rectangles_changes.height = /*height*/ ctx[6];
3352
3459
  if (dirty & /*borderColor*/ 4) rectangles_changes.borderColor = /*borderColor*/ ctx[2];
3353
3460
  if (dirty & /*faceColor*/ 2) rectangles_changes.faceColor = /*faceColor*/ ctx[1];
3461
+ if (dirty & /*title*/ 1) rectangles_changes.title = /*title*/ ctx[0];
3354
3462
  rectangles.$set(rectangles_changes);
3355
-
3356
- if (!current || dirty & /*title*/ 1) {
3357
- attr(g, "title", /*title*/ ctx[0]);
3358
- }
3359
3463
  },
3360
3464
  i(local) {
3361
3465
  if (current) return;
@@ -3367,8 +3471,7 @@
3367
3471
  current = false;
3368
3472
  },
3369
3473
  d(detaching) {
3370
- if (detaching) detach(g);
3371
- destroy_component(rectangles);
3474
+ destroy_component(rectangles, detaching);
3372
3475
  }
3373
3476
  };
3374
3477
  }
@@ -3487,11 +3590,10 @@
3487
3590
  /* src/ScatterSeries.svelte generated by Svelte v3.46.3 */
3488
3591
 
3489
3592
  function add_css(target) {
3490
- append_styles(target, "svelte-11a4d2d", ".marker{font-size:1em;cursor:default}.marker:hover{opacity:90%}.series_scatter > *:hover + .labels_hover{visibility:visible;opacity:1}");
3593
+ 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}");
3491
3594
  }
3492
3595
 
3493
3596
  function create_fragment$2(ctx) {
3494
- let g;
3495
3597
  let textlabels;
3496
3598
  let current;
3497
3599
 
@@ -3499,40 +3601,35 @@
3499
3601
  props: {
3500
3602
  xValues: /*xValues*/ ctx[0],
3501
3603
  yValues: /*yValues*/ ctx[1],
3502
- labels: /*markerSymbol*/ ctx[7],
3503
- textSize: /*markerSize*/ ctx[6],
3504
3604
  faceColor: /*faceColor*/ ctx[3],
3505
3605
  borderColor: /*borderColor*/ ctx[4],
3506
- borderWidth: /*borderWidth*/ ctx[5]
3606
+ borderWidth: /*borderWidth*/ ctx[5],
3607
+ title: /*title*/ ctx[2],
3608
+ style: "series_scatter",
3609
+ labels: /*markerSymbol*/ ctx[7],
3610
+ textSize: /*markerSize*/ ctx[6]
3507
3611
  }
3508
3612
  });
3509
3613
 
3510
3614
  return {
3511
3615
  c() {
3512
- g = svg_element("g");
3513
3616
  create_component(textlabels.$$.fragment);
3514
- attr(g, "class", "series series_scatter");
3515
- attr(g, "title", /*title*/ ctx[2]);
3516
3617
  },
3517
3618
  m(target, anchor) {
3518
- insert(target, g, anchor);
3519
- mount_component(textlabels, g, null);
3619
+ mount_component(textlabels, target, anchor);
3520
3620
  current = true;
3521
3621
  },
3522
3622
  p(ctx, [dirty]) {
3523
3623
  const textlabels_changes = {};
3524
3624
  if (dirty & /*xValues*/ 1) textlabels_changes.xValues = /*xValues*/ ctx[0];
3525
3625
  if (dirty & /*yValues*/ 2) textlabels_changes.yValues = /*yValues*/ ctx[1];
3526
- if (dirty & /*markerSymbol*/ 128) textlabels_changes.labels = /*markerSymbol*/ ctx[7];
3527
- if (dirty & /*markerSize*/ 64) textlabels_changes.textSize = /*markerSize*/ ctx[6];
3528
3626
  if (dirty & /*faceColor*/ 8) textlabels_changes.faceColor = /*faceColor*/ ctx[3];
3529
3627
  if (dirty & /*borderColor*/ 16) textlabels_changes.borderColor = /*borderColor*/ ctx[4];
3530
3628
  if (dirty & /*borderWidth*/ 32) textlabels_changes.borderWidth = /*borderWidth*/ ctx[5];
3629
+ if (dirty & /*title*/ 4) textlabels_changes.title = /*title*/ ctx[2];
3630
+ if (dirty & /*markerSymbol*/ 128) textlabels_changes.labels = /*markerSymbol*/ ctx[7];
3631
+ if (dirty & /*markerSize*/ 64) textlabels_changes.textSize = /*markerSize*/ ctx[6];
3531
3632
  textlabels.$set(textlabels_changes);
3532
-
3533
- if (!current || dirty & /*title*/ 4) {
3534
- attr(g, "title", /*title*/ ctx[2]);
3535
- }
3536
3633
  },
3537
3634
  i(local) {
3538
3635
  if (current) return;
@@ -3544,8 +3641,7 @@
3544
3641
  current = false;
3545
3642
  },
3546
3643
  d(detaching) {
3547
- if (detaching) detach(g);
3548
- destroy_component(textlabels);
3644
+ destroy_component(textlabels, detaching);
3549
3645
  }
3550
3646
  };
3551
3647
  }
@@ -3563,6 +3659,7 @@
3563
3659
  // TODO: implement later
3564
3660
  //export let labels = yValues;
3565
3661
  //export let showLabels = "no"; // can be "no", "hover", "always"
3662
+ /* constants for internal use */
3566
3663
  const markers = ["●", "◼", "▲", "▼", "⬥", "+", "*", "⨯"];
3567
3664
 
3568
3665
  let markerSymbol;
@@ -3669,7 +3766,7 @@
3669
3766
  polyline = svg_element("polyline");
3670
3767
  attr(polyline, "class", "line");
3671
3768
  attr(polyline, "points", /*p*/ ctx[2]);
3672
- attr(g, "class", "series lineseries");
3769
+ attr(g, "class", "series series_line");
3673
3770
  attr(g, "style", /*lineStyleStr*/ ctx[1]);
3674
3771
  attr(g, "title", /*title*/ ctx[0]);
3675
3772
  },
@@ -3804,7 +3901,8 @@
3804
3901
  }
3805
3902
 
3806
3903
  if ($$self.$$.dirty & /*lineColor, lineWidth, $scale, lineType*/ 39936) {
3807
- $$invalidate(1, lineStyleStr = `fill:transparent;stroke:${lineColor};stroke-width: ${lineWidth}px;stroke-dasharray:${axes.LINE_STYLES[$scale][lineType - 1]}`);
3904
+ $$invalidate(1, lineStyleStr = `fill:transparent;stroke:${lineColor};stroke-width: ${lineWidth}px;
3905
+ stroke-dasharray:${axes.LINE_STYLES[$scale][lineType - 1]}`);
3808
3906
  }
3809
3907
  };
3810
3908