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.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,7 +501,7 @@
478
501
 
479
502
  /* src/Axes.svelte generated by Svelte v3.46.3 */
480
503
 
481
- function add_css$2(target) {
504
+ function add_css$3(target) {
482
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
 
@@ -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]);
@@ -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
  }
@@ -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
+ // (55: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[3]);
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*/ 241) {
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,27 @@
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
+ }
2122
+
2123
+ if (dirty & /*barsStyleStr*/ 8) {
2124
+ attr(g, "style", /*barsStyleStr*/ ctx[3]);
2125
+ }
2048
2126
  },
2049
2127
  d(detaching) {
2128
+ if (detaching) detach(g);
2050
2129
  destroy_each(each_blocks, detaching);
2051
- if (detaching) detach(each_1_anchor);
2052
2130
  }
2053
2131
  };
2054
2132
  }
2055
2133
 
2056
- // (52:3) {#each left as v, i}
2134
+ // (57:3) {#each left as v, i}
2057
2135
  function create_each_block$3(ctx) {
2058
2136
  let rect;
2059
2137
  let rect_x_value;
@@ -2064,29 +2142,28 @@
2064
2142
  return {
2065
2143
  c() {
2066
2144
  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]);
2145
+ attr(rect, "x", rect_x_value = /*rx*/ ctx[7][/*i*/ ctx[27]]);
2146
+ attr(rect, "y", rect_y_value = /*ry*/ ctx[6][/*i*/ ctx[27]]);
2147
+ attr(rect, "width", rect_width_value = /*rw*/ ctx[5][/*i*/ ctx[27]]);
2148
+ attr(rect, "height", rect_height_value = /*rh*/ ctx[4][/*i*/ ctx[27]]);
2072
2149
  },
2073
2150
  m(target, anchor) {
2074
2151
  insert(target, rect, anchor);
2075
2152
  },
2076
2153
  p(ctx, dirty) {
2077
- if (dirty & /*rx*/ 16 && rect_x_value !== (rect_x_value = /*rx*/ ctx[4][/*i*/ ctx[25]])) {
2154
+ if (dirty & /*rx*/ 128 && rect_x_value !== (rect_x_value = /*rx*/ ctx[7][/*i*/ ctx[27]])) {
2078
2155
  attr(rect, "x", rect_x_value);
2079
2156
  }
2080
2157
 
2081
- if (dirty & /*ry*/ 8 && rect_y_value !== (rect_y_value = /*ry*/ ctx[3][/*i*/ ctx[25]])) {
2158
+ if (dirty & /*ry*/ 64 && rect_y_value !== (rect_y_value = /*ry*/ ctx[6][/*i*/ ctx[27]])) {
2082
2159
  attr(rect, "y", rect_y_value);
2083
2160
  }
2084
2161
 
2085
- if (dirty & /*rw*/ 4 && rect_width_value !== (rect_width_value = /*rw*/ ctx[2][/*i*/ ctx[25]])) {
2162
+ if (dirty & /*rw*/ 32 && rect_width_value !== (rect_width_value = /*rw*/ ctx[5][/*i*/ ctx[27]])) {
2086
2163
  attr(rect, "width", rect_width_value);
2087
2164
  }
2088
2165
 
2089
- if (dirty & /*rh*/ 2 && rect_height_value !== (rect_height_value = /*rh*/ ctx[1][/*i*/ ctx[25]])) {
2166
+ if (dirty & /*rh*/ 16 && rect_height_value !== (rect_height_value = /*rh*/ ctx[4][/*i*/ ctx[27]])) {
2090
2167
  attr(rect, "height", rect_height_value);
2091
2168
  }
2092
2169
  },
@@ -2098,7 +2175,7 @@
2098
2175
 
2099
2176
  function create_fragment$8(ctx) {
2100
2177
  let if_block_anchor;
2101
- let if_block = /*rx*/ ctx[4] !== undefined && /*ry*/ ctx[3] !== undefined && create_if_block$6(ctx);
2178
+ let if_block = /*rx*/ ctx[7] !== undefined && /*ry*/ ctx[6] !== undefined && create_if_block$6(ctx);
2102
2179
 
2103
2180
  return {
2104
2181
  c() {
@@ -2110,7 +2187,7 @@
2110
2187
  insert(target, if_block_anchor, anchor);
2111
2188
  },
2112
2189
  p(ctx, [dirty]) {
2113
- if (/*rx*/ ctx[4] !== undefined && /*ry*/ ctx[3] !== undefined) {
2190
+ if (/*rx*/ ctx[7] !== undefined && /*ry*/ ctx[6] !== undefined) {
2114
2191
  if (if_block) {
2115
2192
  if_block.p(ctx, dirty);
2116
2193
  } else {
@@ -2137,6 +2214,7 @@
2137
2214
  let ry;
2138
2215
  let rw;
2139
2216
  let rh;
2217
+ let barsStyleStr;
2140
2218
  let $axesHeight;
2141
2219
  let $yLim;
2142
2220
  let $axesWidth;
@@ -2149,9 +2227,8 @@
2149
2227
  let { faceColor = Colors.PRIMARY } = $$props;
2150
2228
  let { borderColor = faceColor } = $$props;
2151
2229
  let { lineWidth = 1 } = $$props;
2152
-
2153
- // styles for bars and labels
2154
- const barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`;
2230
+ let { title = "" } = $$props;
2231
+ let { style = "series_rect" } = $$props;
2155
2232
 
2156
2233
  // multiply width and height values if needed
2157
2234
  if (!Array.isArray(left) || !Array.isArray(top) || left.length < 1 || left.length != top.length) {
@@ -2177,51 +2254,60 @@
2177
2254
  const axes = getContext('axes');
2178
2255
 
2179
2256
  const xLim = axes.xLim;
2180
- component_subscribe($$self, xLim, value => $$invalidate(20, $xLim = value));
2257
+ component_subscribe($$self, xLim, value => $$invalidate(22, $xLim = value));
2181
2258
  const yLim = axes.yLim;
2182
- component_subscribe($$self, yLim, value => $$invalidate(18, $yLim = value));
2259
+ component_subscribe($$self, yLim, value => $$invalidate(20, $yLim = value));
2183
2260
  const axesWidth = axes.width;
2184
- component_subscribe($$self, axesWidth, value => $$invalidate(19, $axesWidth = value));
2261
+ component_subscribe($$self, axesWidth, value => $$invalidate(21, $axesWidth = value));
2185
2262
  const axesHeight = axes.height;
2186
- component_subscribe($$self, axesHeight, value => $$invalidate(17, $axesHeight = value));
2263
+ component_subscribe($$self, axesHeight, value => $$invalidate(19, $axesHeight = value));
2187
2264
 
2188
2265
  $$self.$$set = $$props => {
2189
2266
  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);
2267
+ if ('top' in $$props) $$invalidate(14, top = $$props.top);
2268
+ if ('width' in $$props) $$invalidate(12, width = $$props.width);
2269
+ if ('height' in $$props) $$invalidate(13, height = $$props.height);
2270
+ if ('labels' in $$props) $$invalidate(15, labels = $$props.labels);
2271
+ if ('faceColor' in $$props) $$invalidate(16, faceColor = $$props.faceColor);
2272
+ if ('borderColor' in $$props) $$invalidate(17, borderColor = $$props.borderColor);
2273
+ if ('lineWidth' in $$props) $$invalidate(18, lineWidth = $$props.lineWidth);
2274
+ if ('title' in $$props) $$invalidate(1, title = $$props.title);
2275
+ if ('style' in $$props) $$invalidate(2, style = $$props.style);
2197
2276
  };
2198
2277
 
2199
2278
  $$self.$$.update = () => {
2200
- if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 1572865) {
2279
+ if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 6291457) {
2201
2280
  // reactive variables for coordinates of data points in pixels
2202
- $$invalidate(4, rx = axes.scaleX(left, $xLim, $axesWidth));
2281
+ $$invalidate(7, rx = axes.scaleX(left, $xLim, $axesWidth));
2203
2282
  }
2204
2283
 
2205
- if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 397312) {
2206
- $$invalidate(3, ry = axes.scaleY(top, $yLim, $axesHeight));
2284
+ if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 1589248) {
2285
+ $$invalidate(6, ry = axes.scaleY(top, $yLim, $axesHeight));
2207
2286
  }
2208
2287
 
2209
- if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/ 1573888) {
2210
- $$invalidate(2, rw = axes.scaleX(width, $xLim, $axesWidth, true));
2288
+ if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/ 6295552) {
2289
+ $$invalidate(5, rw = axes.scaleX(width, $xLim, $axesWidth, true));
2211
2290
  }
2212
2291
 
2213
- if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/ 395264) {
2214
- $$invalidate(1, rh = axes.scaleY(height, $yLim, $axesHeight, true));
2292
+ if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/ 1581056) {
2293
+ $$invalidate(4, rh = axes.scaleY(height, $yLim, $axesHeight, true));
2294
+ }
2295
+
2296
+ if ($$self.$$.dirty & /*faceColor, borderColor, lineWidth*/ 458752) {
2297
+ // styles for bars and labels
2298
+ $$invalidate(3, barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`);
2215
2299
  }
2216
2300
  };
2217
2301
 
2218
2302
  return [
2219
2303
  left,
2304
+ title,
2305
+ style,
2306
+ barsStyleStr,
2220
2307
  rh,
2221
2308
  rw,
2222
2309
  ry,
2223
2310
  rx,
2224
- barsStyleStr,
2225
2311
  xLim,
2226
2312
  yLim,
2227
2313
  axesWidth,
@@ -2246,13 +2332,15 @@
2246
2332
 
2247
2333
  init(this, options, instance$8, create_fragment$8, safe_not_equal, {
2248
2334
  left: 0,
2249
- top: 12,
2250
- width: 10,
2251
- height: 11,
2252
- labels: 13,
2253
- faceColor: 14,
2254
- borderColor: 15,
2255
- lineWidth: 16
2335
+ top: 14,
2336
+ width: 12,
2337
+ height: 13,
2338
+ labels: 15,
2339
+ faceColor: 16,
2340
+ borderColor: 17,
2341
+ lineWidth: 18,
2342
+ title: 1,
2343
+ style: 2
2256
2344
  });
2257
2345
  }
2258
2346
  }
@@ -2279,6 +2367,7 @@
2279
2367
  c() {
2280
2368
  g = svg_element("g");
2281
2369
  create_component(rectangles.$$.fragment);
2370
+ set_style(g, "pointer-events", "none");
2282
2371
  attr(g, "class", "mdaplot__axes-box");
2283
2372
  },
2284
2373
  m(target, anchor) {
@@ -2692,17 +2781,22 @@
2692
2781
 
2693
2782
  /* src/TextLabels.svelte generated by Svelte v3.46.3 */
2694
2783
 
2784
+ function add_css$2(target) {
2785
+ append_styles(target, "svelte-1szep8i", "text.svelte-1szep8i{dominant-baseline:middle}");
2786
+ }
2787
+
2695
2788
  function get_each_context$1(ctx, list, i) {
2696
2789
  const child_ctx = ctx.slice();
2697
- child_ctx[25] = list[i];
2698
- child_ctx[27] = i;
2790
+ child_ctx[27] = list[i];
2791
+ child_ctx[29] = i;
2699
2792
  return child_ctx;
2700
2793
  }
2701
2794
 
2702
- // (56:0) {#if x !== undefined && y !== undefined}
2795
+ // (66:0) {#if x !== undefined && y !== undefined}
2703
2796
  function create_if_block$3(ctx) {
2704
- let each_1_anchor;
2705
- let each_value = /*x*/ ctx[6];
2797
+ let g;
2798
+ let g_class_value;
2799
+ let each_value = /*x*/ ctx[7];
2706
2800
  let each_blocks = [];
2707
2801
 
2708
2802
  for (let i = 0; i < each_value.length; i += 1) {
@@ -2711,22 +2805,26 @@
2711
2805
 
2712
2806
  return {
2713
2807
  c() {
2808
+ g = svg_element("g");
2809
+
2714
2810
  for (let i = 0; i < each_blocks.length; i += 1) {
2715
2811
  each_blocks[i].c();
2716
2812
  }
2717
2813
 
2718
- each_1_anchor = empty();
2814
+ attr(g, "class", g_class_value = "series " + /*style*/ ctx[1]);
2815
+ attr(g, "title", /*title*/ ctx[2]);
2816
+ attr(g, "style", /*textStyleStr*/ ctx[3]);
2719
2817
  },
2720
2818
  m(target, anchor) {
2819
+ insert(target, g, anchor);
2820
+
2721
2821
  for (let i = 0; i < each_blocks.length; i += 1) {
2722
- each_blocks[i].m(target, anchor);
2822
+ each_blocks[i].m(g, null);
2723
2823
  }
2724
-
2725
- insert(target, each_1_anchor, anchor);
2726
2824
  },
2727
2825
  p(ctx, dirty) {
2728
- if (dirty & /*textStyleStr, x, y, dx, dy, textAnchors, pos, labels*/ 255) {
2729
- each_value = /*x*/ ctx[6];
2826
+ if (dirty & /*x, y, dx, dy, labels*/ 241) {
2827
+ each_value = /*x*/ ctx[7];
2730
2828
  let i;
2731
2829
 
2732
2830
  for (i = 0; i < each_value.length; i += 1) {
@@ -2737,7 +2835,7 @@
2737
2835
  } else {
2738
2836
  each_blocks[i] = create_each_block$1(child_ctx);
2739
2837
  each_blocks[i].c();
2740
- each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
2838
+ each_blocks[i].m(g, null);
2741
2839
  }
2742
2840
  }
2743
2841
 
@@ -2747,61 +2845,64 @@
2747
2845
 
2748
2846
  each_blocks.length = each_value.length;
2749
2847
  }
2848
+
2849
+ if (dirty & /*style*/ 2 && g_class_value !== (g_class_value = "series " + /*style*/ ctx[1])) {
2850
+ attr(g, "class", g_class_value);
2851
+ }
2852
+
2853
+ if (dirty & /*title*/ 4) {
2854
+ attr(g, "title", /*title*/ ctx[2]);
2855
+ }
2856
+
2857
+ if (dirty & /*textStyleStr*/ 8) {
2858
+ attr(g, "style", /*textStyleStr*/ ctx[3]);
2859
+ }
2750
2860
  },
2751
2861
  d(detaching) {
2862
+ if (detaching) detach(g);
2752
2863
  destroy_each(each_blocks, detaching);
2753
- if (detaching) detach(each_1_anchor);
2754
2864
  }
2755
2865
  };
2756
2866
  }
2757
2867
 
2758
- // (57:3) {#each x as v, i}
2868
+ // (68:3) {#each x as v, i}
2759
2869
  function create_each_block$1(ctx) {
2760
2870
  let text_1;
2761
- let raw_value = /*labels*/ ctx[0][/*i*/ ctx[27]] + "";
2871
+ let raw_value = /*labels*/ ctx[0][/*i*/ ctx[29]] + "";
2872
+ let text_1_data_id_value;
2762
2873
  let text_1_x_value;
2763
2874
  let text_1_y_value;
2764
- let text_1_text_anchor_value;
2765
2875
 
2766
2876
  return {
2767
2877
  c() {
2768
2878
  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]]);
2879
+ attr(text_1, "data-id", text_1_data_id_value = /*i*/ ctx[29]);
2880
+ attr(text_1, "x", text_1_x_value = /*x*/ ctx[7][/*i*/ ctx[29]]);
2881
+ attr(text_1, "y", text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]]);
2882
+ attr(text_1, "dx", /*dx*/ ctx[5]);
2883
+ attr(text_1, "dy", /*dy*/ ctx[4]);
2884
+ attr(text_1, "class", "svelte-1szep8i");
2776
2885
  },
2777
2886
  m(target, anchor) {
2778
2887
  insert(target, text_1, anchor);
2779
2888
  text_1.innerHTML = raw_value;
2780
2889
  },
2781
2890
  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]])) {
2891
+ if (dirty & /*labels*/ 1 && raw_value !== (raw_value = /*labels*/ ctx[0][/*i*/ ctx[29]] + "")) text_1.innerHTML = raw_value;
2892
+ if (dirty & /*x*/ 128 && text_1_x_value !== (text_1_x_value = /*x*/ ctx[7][/*i*/ ctx[29]])) {
2788
2893
  attr(text_1, "x", text_1_x_value);
2789
2894
  }
2790
2895
 
2791
- if (dirty & /*y*/ 32 && text_1_y_value !== (text_1_y_value = /*y*/ ctx[5][/*i*/ ctx[27]])) {
2896
+ if (dirty & /*y*/ 64 && text_1_y_value !== (text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]])) {
2792
2897
  attr(text_1, "y", text_1_y_value);
2793
2898
  }
2794
2899
 
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]);
2900
+ if (dirty & /*dx*/ 32) {
2901
+ attr(text_1, "dx", /*dx*/ ctx[5]);
2801
2902
  }
2802
2903
 
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);
2904
+ if (dirty & /*dy*/ 16) {
2905
+ attr(text_1, "dy", /*dy*/ ctx[4]);
2805
2906
  }
2806
2907
  },
2807
2908
  d(detaching) {
@@ -2812,7 +2913,7 @@
2812
2913
 
2813
2914
  function create_fragment$5(ctx) {
2814
2915
  let if_block_anchor;
2815
- let if_block = /*x*/ ctx[6] !== undefined && /*y*/ ctx[5] !== undefined && create_if_block$3(ctx);
2916
+ let if_block = /*x*/ ctx[7] !== undefined && /*y*/ ctx[6] !== undefined && create_if_block$3(ctx);
2816
2917
 
2817
2918
  return {
2818
2919
  c() {
@@ -2824,7 +2925,7 @@
2824
2925
  insert(target, if_block_anchor, anchor);
2825
2926
  },
2826
2927
  p(ctx, [dirty]) {
2827
- if (/*x*/ ctx[6] !== undefined && /*y*/ ctx[5] !== undefined) {
2928
+ if (/*x*/ ctx[7] !== undefined && /*y*/ ctx[6] !== undefined) {
2828
2929
  if (if_block) {
2829
2930
  if_block.p(ctx, dirty);
2830
2931
  } else {
@@ -2865,11 +2966,13 @@
2865
2966
  let { borderColor = "transparent" } = $$props;
2866
2967
  let { borderWidth = 0 } = $$props;
2867
2968
  let { textSize = 1 } = $$props;
2969
+ let { style = "" } = $$props;
2970
+ let { title = "series_text" } = $$props;
2868
2971
 
2869
2972
  // text-anchor values depending on position
2870
2973
  const textAnchors = ["middle", "middle", "start", "middle", "end"];
2871
2974
 
2872
- /* sanity check for input parameters */
2975
+ // sanity check for input parameters
2873
2976
  if (!Array.isArray(xValues) || !Array.isArray(yValues) || xValues.length !== yValues.length) {
2874
2977
  throw "TextLabels: parameters 'xValues' and 'yValues' must be vectors of the same length.";
2875
2978
  }
@@ -2878,30 +2981,32 @@
2878
2981
  const axes = getContext('axes');
2879
2982
 
2880
2983
  const xLim = axes.xLim;
2881
- component_subscribe($$self, xLim, value => $$invalidate(23, $xLim = value));
2984
+ component_subscribe($$self, xLim, value => $$invalidate(24, $xLim = value));
2882
2985
  const yLim = axes.yLim;
2883
- component_subscribe($$self, yLim, value => $$invalidate(21, $yLim = value));
2986
+ component_subscribe($$self, yLim, value => $$invalidate(22, $yLim = value));
2884
2987
  const axesWidth = axes.width;
2885
- component_subscribe($$self, axesWidth, value => $$invalidate(22, $axesWidth = value));
2988
+ component_subscribe($$self, axesWidth, value => $$invalidate(23, $axesWidth = value));
2886
2989
  const axesHeight = axes.height;
2887
- component_subscribe($$self, axesHeight, value => $$invalidate(20, $axesHeight = value));
2990
+ component_subscribe($$self, axesHeight, value => $$invalidate(21, $axesHeight = value));
2888
2991
  const scale = axes.scale;
2889
- component_subscribe($$self, scale, value => $$invalidate(19, $scale = value));
2992
+ component_subscribe($$self, scale, value => $$invalidate(20, $scale = value));
2890
2993
 
2891
2994
  $$self.$$set = $$props => {
2892
2995
  if ('xValues' in $$props) $$invalidate(13, xValues = $$props.xValues);
2893
2996
  if ('yValues' in $$props) $$invalidate(14, yValues = $$props.yValues);
2894
2997
  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);
2998
+ if ('pos' in $$props) $$invalidate(15, pos = $$props.pos);
2999
+ if ('faceColor' in $$props) $$invalidate(16, faceColor = $$props.faceColor);
3000
+ if ('borderColor' in $$props) $$invalidate(17, borderColor = $$props.borderColor);
3001
+ if ('borderWidth' in $$props) $$invalidate(18, borderWidth = $$props.borderWidth);
3002
+ if ('textSize' in $$props) $$invalidate(19, textSize = $$props.textSize);
3003
+ if ('style' in $$props) $$invalidate(1, style = $$props.style);
3004
+ if ('title' in $$props) $$invalidate(2, title = $$props.title);
2900
3005
  };
2901
3006
 
2902
3007
  $$self.$$.update = () => {
2903
3008
  if ($$self.$$.dirty & /*xValues, labels*/ 8193) {
2904
- // multiply labels values if needed
3009
+ // multiply label values if needed
2905
3010
  {
2906
3011
  const n = xValues.length;
2907
3012
  if (!Array.isArray(labels)) $$invalidate(0, labels = Array(n).fill(labels));
@@ -2917,38 +3022,39 @@
2917
3022
  }
2918
3023
  }
2919
3024
 
2920
- if ($$self.$$.dirty & /*xValues, $xLim, $axesWidth*/ 12591104) {
3025
+ if ($$self.$$.dirty & /*xValues, $xLim, $axesWidth*/ 25174016) {
2921
3026
  // reactive variables for coordinates of data points in pixels
2922
- $$invalidate(6, x = axes.scaleX(xValues, $xLim, $axesWidth));
3027
+ $$invalidate(7, x = axes.scaleX(xValues, $xLim, $axesWidth));
2923
3028
  }
2924
3029
 
2925
- if ($$self.$$.dirty & /*yValues, $yLim, $axesHeight*/ 3162112) {
2926
- $$invalidate(5, y = axes.scaleY(yValues, $yLim, $axesHeight));
3030
+ if ($$self.$$.dirty & /*yValues, $yLim, $axesHeight*/ 6307840) {
3031
+ $$invalidate(6, y = axes.scaleY(yValues, $yLim, $axesHeight));
2927
3032
  }
2928
3033
 
2929
- if ($$self.$$.dirty & /*pos, $scale*/ 524290) {
2930
- $$invalidate(4, dx = [0, 0, 1, 0, -1][pos] * axes.LABELS_MARGIN[$scale]);
3034
+ if ($$self.$$.dirty & /*pos, $scale*/ 1081344) {
3035
+ $$invalidate(5, dx = [0, 0, 1, 0, -1][pos] * axes.LABELS_MARGIN[$scale]);
2931
3036
  }
2932
3037
 
2933
- if ($$self.$$.dirty & /*pos, $scale*/ 524290) {
2934
- $$invalidate(3, dy = [0, 1, 0, -1, 0][pos] * axes.LABELS_MARGIN[$scale]);
3038
+ if ($$self.$$.dirty & /*pos, $scale*/ 1081344) {
3039
+ $$invalidate(4, dy = [0, 1, 0, -1, 0][pos] * axes.LABELS_MARGIN[$scale]);
2935
3040
  }
2936
3041
 
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;`);
3042
+ if ($$self.$$.dirty & /*faceColor, borderWidth, borderColor, textSize, pos*/ 1015808) {
3043
+ // styles for the elements
3044
+ $$invalidate(3, textStyleStr = `fill:${faceColor};stroke-width:${borderWidth}px;stroke:${borderColor};
3045
+ font-size:${textSize}em; text-anchor:${textAnchors[pos]};`);
2940
3046
  }
2941
3047
  };
2942
3048
 
2943
3049
  return [
2944
3050
  labels,
2945
- pos,
3051
+ style,
3052
+ title,
2946
3053
  textStyleStr,
2947
3054
  dy,
2948
3055
  dx,
2949
3056
  y,
2950
3057
  x,
2951
- textAnchors,
2952
3058
  xLim,
2953
3059
  yLim,
2954
3060
  axesWidth,
@@ -2956,6 +3062,7 @@
2956
3062
  scale,
2957
3063
  xValues,
2958
3064
  yValues,
3065
+ pos,
2959
3066
  faceColor,
2960
3067
  borderColor,
2961
3068
  borderWidth,
@@ -2972,16 +3079,26 @@
2972
3079
  constructor(options) {
2973
3080
  super();
2974
3081
 
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
- });
3082
+ init(
3083
+ this,
3084
+ options,
3085
+ instance$5,
3086
+ create_fragment$5,
3087
+ safe_not_equal,
3088
+ {
3089
+ xValues: 13,
3090
+ yValues: 14,
3091
+ labels: 0,
3092
+ pos: 15,
3093
+ faceColor: 16,
3094
+ borderColor: 17,
3095
+ borderWidth: 18,
3096
+ textSize: 19,
3097
+ style: 1,
3098
+ title: 2
3099
+ },
3100
+ add_css$2
3101
+ );
2985
3102
  }
2986
3103
  }
2987
3104
 
@@ -3316,31 +3433,28 @@
3316
3433
  }
3317
3434
 
3318
3435
  function create_fragment$3(ctx) {
3319
- let g;
3320
3436
  let rectangles;
3321
3437
  let current;
3322
3438
 
3323
3439
  rectangles = new Rectangles({
3324
3440
  props: {
3441
+ style: "series_bar",
3325
3442
  left: /*left*/ ctx[4],
3326
3443
  top: /*top*/ ctx[5],
3327
3444
  width: /*width*/ ctx[3],
3328
3445
  height: /*height*/ ctx[6],
3329
3446
  borderColor: /*borderColor*/ ctx[2],
3330
- faceColor: /*faceColor*/ ctx[1]
3447
+ faceColor: /*faceColor*/ ctx[1],
3448
+ title: /*title*/ ctx[0]
3331
3449
  }
3332
3450
  });
3333
3451
 
3334
3452
  return {
3335
3453
  c() {
3336
- g = svg_element("g");
3337
3454
  create_component(rectangles.$$.fragment);
3338
- attr(g, "class", "series series_bar");
3339
- attr(g, "title", /*title*/ ctx[0]);
3340
3455
  },
3341
3456
  m(target, anchor) {
3342
- insert(target, g, anchor);
3343
- mount_component(rectangles, g, null);
3457
+ mount_component(rectangles, target, anchor);
3344
3458
  current = true;
3345
3459
  },
3346
3460
  p(ctx, [dirty]) {
@@ -3351,11 +3465,8 @@
3351
3465
  if (dirty & /*height*/ 64) rectangles_changes.height = /*height*/ ctx[6];
3352
3466
  if (dirty & /*borderColor*/ 4) rectangles_changes.borderColor = /*borderColor*/ ctx[2];
3353
3467
  if (dirty & /*faceColor*/ 2) rectangles_changes.faceColor = /*faceColor*/ ctx[1];
3468
+ if (dirty & /*title*/ 1) rectangles_changes.title = /*title*/ ctx[0];
3354
3469
  rectangles.$set(rectangles_changes);
3355
-
3356
- if (!current || dirty & /*title*/ 1) {
3357
- attr(g, "title", /*title*/ ctx[0]);
3358
- }
3359
3470
  },
3360
3471
  i(local) {
3361
3472
  if (current) return;
@@ -3367,8 +3478,7 @@
3367
3478
  current = false;
3368
3479
  },
3369
3480
  d(detaching) {
3370
- if (detaching) detach(g);
3371
- destroy_component(rectangles);
3481
+ destroy_component(rectangles, detaching);
3372
3482
  }
3373
3483
  };
3374
3484
  }
@@ -3487,11 +3597,10 @@
3487
3597
  /* src/ScatterSeries.svelte generated by Svelte v3.46.3 */
3488
3598
 
3489
3599
  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}");
3600
+ 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
3601
  }
3492
3602
 
3493
3603
  function create_fragment$2(ctx) {
3494
- let g;
3495
3604
  let textlabels;
3496
3605
  let current;
3497
3606
 
@@ -3499,40 +3608,35 @@
3499
3608
  props: {
3500
3609
  xValues: /*xValues*/ ctx[0],
3501
3610
  yValues: /*yValues*/ ctx[1],
3502
- labels: /*markerSymbol*/ ctx[7],
3503
- textSize: /*markerSize*/ ctx[6],
3504
3611
  faceColor: /*faceColor*/ ctx[3],
3505
3612
  borderColor: /*borderColor*/ ctx[4],
3506
- borderWidth: /*borderWidth*/ ctx[5]
3613
+ borderWidth: /*borderWidth*/ ctx[5],
3614
+ title: /*title*/ ctx[2],
3615
+ style: "series_scatter",
3616
+ labels: /*markerSymbol*/ ctx[7],
3617
+ textSize: /*markerSize*/ ctx[6]
3507
3618
  }
3508
3619
  });
3509
3620
 
3510
3621
  return {
3511
3622
  c() {
3512
- g = svg_element("g");
3513
3623
  create_component(textlabels.$$.fragment);
3514
- attr(g, "class", "series series_scatter");
3515
- attr(g, "title", /*title*/ ctx[2]);
3516
3624
  },
3517
3625
  m(target, anchor) {
3518
- insert(target, g, anchor);
3519
- mount_component(textlabels, g, null);
3626
+ mount_component(textlabels, target, anchor);
3520
3627
  current = true;
3521
3628
  },
3522
3629
  p(ctx, [dirty]) {
3523
3630
  const textlabels_changes = {};
3524
3631
  if (dirty & /*xValues*/ 1) textlabels_changes.xValues = /*xValues*/ ctx[0];
3525
3632
  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
3633
  if (dirty & /*faceColor*/ 8) textlabels_changes.faceColor = /*faceColor*/ ctx[3];
3529
3634
  if (dirty & /*borderColor*/ 16) textlabels_changes.borderColor = /*borderColor*/ ctx[4];
3530
3635
  if (dirty & /*borderWidth*/ 32) textlabels_changes.borderWidth = /*borderWidth*/ ctx[5];
3636
+ if (dirty & /*title*/ 4) textlabels_changes.title = /*title*/ ctx[2];
3637
+ if (dirty & /*markerSymbol*/ 128) textlabels_changes.labels = /*markerSymbol*/ ctx[7];
3638
+ if (dirty & /*markerSize*/ 64) textlabels_changes.textSize = /*markerSize*/ ctx[6];
3531
3639
  textlabels.$set(textlabels_changes);
3532
-
3533
- if (!current || dirty & /*title*/ 4) {
3534
- attr(g, "title", /*title*/ ctx[2]);
3535
- }
3536
3640
  },
3537
3641
  i(local) {
3538
3642
  if (current) return;
@@ -3544,8 +3648,7 @@
3544
3648
  current = false;
3545
3649
  },
3546
3650
  d(detaching) {
3547
- if (detaching) detach(g);
3548
- destroy_component(textlabels);
3651
+ destroy_component(textlabels, detaching);
3549
3652
  }
3550
3653
  };
3551
3654
  }
@@ -3563,6 +3666,7 @@
3563
3666
  // TODO: implement later
3564
3667
  //export let labels = yValues;
3565
3668
  //export let showLabels = "no"; // can be "no", "hover", "always"
3669
+ /* constants for internal use */
3566
3670
  const markers = ["●", "◼", "▲", "▼", "⬥", "+", "*", "⨯"];
3567
3671
 
3568
3672
  let markerSymbol;
@@ -3669,7 +3773,7 @@
3669
3773
  polyline = svg_element("polyline");
3670
3774
  attr(polyline, "class", "line");
3671
3775
  attr(polyline, "points", /*p*/ ctx[2]);
3672
- attr(g, "class", "series lineseries");
3776
+ attr(g, "class", "series series_line");
3673
3777
  attr(g, "style", /*lineStyleStr*/ ctx[1]);
3674
3778
  attr(g, "title", /*title*/ ctx[0]);
3675
3779
  },
@@ -3804,7 +3908,8 @@
3804
3908
  }
3805
3909
 
3806
3910
  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]}`);
3911
+ $$invalidate(1, lineStyleStr = `fill:transparent;stroke:${lineColor};stroke-width: ${lineWidth}px;
3912
+ stroke-dasharray:${axes.LINE_STYLES[$scale][lineType - 1]}`);
3808
3913
  }
3809
3914
  };
3810
3915