svelte-plots-basic 1.0.3 → 1.0.6

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