svelte-plots-basic 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +304 -216
- package/dist/index.mjs +304 -216
- package/package.json +1 -1
- package/src/Axes.svelte +21 -4
- package/src/BarSeries.svelte +1 -3
- package/src/Box.svelte +1 -1
- package/src/LineSeries.svelte +4 -4
- package/src/Rectangles.svelte +5 -1
- package/src/ScatterSeries.svelte +10 -6
- package/src/TextLabels.svelte +22 -7
- package/src/TextLegend.svelte +1 -1
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$
|
|
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
|
-
// (
|
|
515
|
+
// (330: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
|
-
// (
|
|
536
|
+
// (331: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
|
-
// (
|
|
560
|
+
// (332: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
|
-
// (
|
|
584
|
+
// (360: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[
|
|
605
|
-
const xaxis_slot = create_slot(xaxis_slot_template, ctx, /*$$scope*/ ctx[
|
|
606
|
-
const yaxis_slot_template = /*#slots*/ ctx[
|
|
607
|
-
const yaxis_slot = create_slot(yaxis_slot_template, ctx, /*$$scope*/ ctx[
|
|
608
|
-
const default_slot_template = /*#slots*/ ctx[
|
|
609
|
-
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[
|
|
610
|
-
const box_slot_template = /*#slots*/ ctx[
|
|
611
|
-
const box_slot = create_slot(box_slot_template, ctx, /*$$scope*/ ctx[
|
|
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[
|
|
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*/
|
|
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[
|
|
777
|
+
/*$$scope*/ ctx[25],
|
|
747
778
|
!current
|
|
748
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[
|
|
749
|
-
: get_slot_changes(xaxis_slot_template, /*$$scope*/ ctx[
|
|
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*/
|
|
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[
|
|
792
|
+
/*$$scope*/ ctx[25],
|
|
762
793
|
!current
|
|
763
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[
|
|
764
|
-
: get_slot_changes(yaxis_slot_template, /*$$scope*/ ctx[
|
|
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*/
|
|
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[
|
|
807
|
+
/*$$scope*/ ctx[25],
|
|
777
808
|
!current
|
|
778
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[
|
|
779
|
-
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[
|
|
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*/
|
|
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[
|
|
822
|
+
/*$$scope*/ ctx[25],
|
|
792
823
|
!current
|
|
793
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[
|
|
794
|
-
: get_slot_changes(box_slot_template, /*$$scope*/ ctx[
|
|
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[
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
935
|
-
$$invalidate(
|
|
936
|
-
$$invalidate(
|
|
937
|
-
$$invalidate(
|
|
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(
|
|
943
|
-
$$invalidate(
|
|
944
|
-
$$invalidate(
|
|
945
|
-
$$invalidate(
|
|
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,21 @@
|
|
|
1105
1140
|
ro.observe(axesWrapper);
|
|
1106
1141
|
});
|
|
1107
1142
|
|
|
1143
|
+
// handle click on plot elements and dispatch manual events
|
|
1144
|
+
function handleClick(e) {
|
|
1145
|
+
if (e.target.tagName === "text" && e.target.parentNode.classList.contains("series_scatter")) {
|
|
1146
|
+
dispatch("markerclick", { markerid: e.target.dataset.id });
|
|
1147
|
+
return;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
if (e.target.tagName === "rect" && e.target.parentNode.classList.contains("series_bar")) {
|
|
1151
|
+
dispatch("barclick", { markerid: e.target.dataset.id });
|
|
1152
|
+
return;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
dispatch("axesclick");
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1108
1158
|
function div0_binding($$value) {
|
|
1109
1159
|
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
1110
1160
|
axesWrapper = $$value;
|
|
@@ -1113,42 +1163,42 @@
|
|
|
1113
1163
|
}
|
|
1114
1164
|
|
|
1115
1165
|
$$self.$$set = $$props => {
|
|
1116
|
-
if ('limX' in $$props) $$invalidate(
|
|
1117
|
-
if ('limY' in $$props) $$invalidate(
|
|
1166
|
+
if ('limX' in $$props) $$invalidate(16, limX = $$props.limX);
|
|
1167
|
+
if ('limY' in $$props) $$invalidate(17, limY = $$props.limY);
|
|
1118
1168
|
if ('title' in $$props) $$invalidate(0, title = $$props.title);
|
|
1119
1169
|
if ('xLabel' in $$props) $$invalidate(1, xLabel = $$props.xLabel);
|
|
1120
1170
|
if ('yLabel' in $$props) $$invalidate(2, yLabel = $$props.yLabel);
|
|
1121
|
-
if ('multiSeries' in $$props) $$invalidate(
|
|
1122
|
-
if ('$$scope' in $$props) $$invalidate(
|
|
1171
|
+
if ('multiSeries' in $$props) $$invalidate(18, multiSeries = $$props.multiSeries);
|
|
1172
|
+
if ('$$scope' in $$props) $$invalidate(25, $$scope = $$props.$$scope);
|
|
1123
1173
|
};
|
|
1124
1174
|
|
|
1125
1175
|
$$self.$$.update = () => {
|
|
1126
|
-
if ($$self.$$.dirty[0] & /*limX*/
|
|
1176
|
+
if ($$self.$$.dirty[0] & /*limX*/ 65536) {
|
|
1127
1177
|
// this is reactive in case if limX and limY are interactively changed by parent script
|
|
1128
1178
|
if (!limX.some(v => v === undefined)) xLim.update(v => limX);
|
|
1129
1179
|
}
|
|
1130
1180
|
|
|
1131
|
-
if ($$self.$$.dirty[0] & /*limY*/
|
|
1181
|
+
if ($$self.$$.dirty[0] & /*limY*/ 131072) {
|
|
1132
1182
|
if (!limY.some(v => v === undefined)) yLim.update(v => limY);
|
|
1133
1183
|
}
|
|
1134
1184
|
|
|
1135
|
-
if ($$self.$$.dirty[0] & /*axesMargins, $scale*/
|
|
1185
|
+
if ($$self.$$.dirty[0] & /*axesMargins, $scale*/ 524304) {
|
|
1136
1186
|
// computes real margins in pixels based on current scale
|
|
1137
|
-
$$invalidate(
|
|
1187
|
+
$$invalidate(20, margins = axesMargins.map(v => v * AXES_MARGIN_FACTORS[$scale]));
|
|
1138
1188
|
}
|
|
1139
1189
|
|
|
1140
|
-
if ($$self.$$.dirty[0] & /*$yLim, $xLim, $width, margins, $height*/
|
|
1190
|
+
if ($$self.$$.dirty[0] & /*$yLim, $xLim, $width, margins, $height*/ 32505856) {
|
|
1141
1191
|
// computes status which tells that axes limits look fine and it is safe to draw
|
|
1142
1192
|
// the status is based on the axis limits validity
|
|
1143
1193
|
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
1194
|
}
|
|
1145
1195
|
|
|
1146
|
-
if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/
|
|
1196
|
+
if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/ 25165832) {
|
|
1147
1197
|
// computes coordinates for clip path box
|
|
1148
1198
|
$$invalidate(7, cpx = $isOk ? scaleX($xLim, $xLim, $width) : [0, 1]);
|
|
1149
1199
|
}
|
|
1150
1200
|
|
|
1151
|
-
if ($$self.$$.dirty[0] & /*$isOk, $yLim, $height*/
|
|
1201
|
+
if ($$self.$$.dirty[0] & /*$isOk, $yLim, $height*/ 6291464) {
|
|
1152
1202
|
$$invalidate(6, cpy = $isOk ? scaleY($yLim, $yLim, $height) : [1, 0]);
|
|
1153
1203
|
}
|
|
1154
1204
|
};
|
|
@@ -1169,6 +1219,7 @@
|
|
|
1169
1219
|
yLim,
|
|
1170
1220
|
scale,
|
|
1171
1221
|
isOk,
|
|
1222
|
+
handleClick,
|
|
1172
1223
|
limX,
|
|
1173
1224
|
limY,
|
|
1174
1225
|
multiSeries,
|
|
@@ -1195,14 +1246,14 @@
|
|
|
1195
1246
|
create_fragment$b,
|
|
1196
1247
|
safe_not_equal,
|
|
1197
1248
|
{
|
|
1198
|
-
limX:
|
|
1199
|
-
limY:
|
|
1249
|
+
limX: 16,
|
|
1250
|
+
limY: 17,
|
|
1200
1251
|
title: 0,
|
|
1201
1252
|
xLabel: 1,
|
|
1202
1253
|
yLabel: 2,
|
|
1203
|
-
multiSeries:
|
|
1254
|
+
multiSeries: 18
|
|
1204
1255
|
},
|
|
1205
|
-
add_css$
|
|
1256
|
+
add_css$3,
|
|
1206
1257
|
[-1, -1]
|
|
1207
1258
|
);
|
|
1208
1259
|
}
|
|
@@ -1992,14 +2043,15 @@
|
|
|
1992
2043
|
|
|
1993
2044
|
function get_each_context$3(ctx, list, i) {
|
|
1994
2045
|
const child_ctx = ctx.slice();
|
|
1995
|
-
child_ctx[
|
|
1996
|
-
child_ctx[
|
|
2046
|
+
child_ctx[25] = list[i];
|
|
2047
|
+
child_ctx[27] = i;
|
|
1997
2048
|
return child_ctx;
|
|
1998
2049
|
}
|
|
1999
2050
|
|
|
2000
|
-
// (
|
|
2051
|
+
// (53:0) {#if rx !== undefined && ry !== undefined}
|
|
2001
2052
|
function create_if_block$6(ctx) {
|
|
2002
|
-
let
|
|
2053
|
+
let g;
|
|
2054
|
+
let g_class_value;
|
|
2003
2055
|
let each_value = /*left*/ ctx[0];
|
|
2004
2056
|
let each_blocks = [];
|
|
2005
2057
|
|
|
@@ -2009,21 +2061,25 @@
|
|
|
2009
2061
|
|
|
2010
2062
|
return {
|
|
2011
2063
|
c() {
|
|
2064
|
+
g = svg_element("g");
|
|
2065
|
+
|
|
2012
2066
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2013
2067
|
each_blocks[i].c();
|
|
2014
2068
|
}
|
|
2015
2069
|
|
|
2016
|
-
|
|
2070
|
+
attr(g, "class", g_class_value = "series " + /*style*/ ctx[2]);
|
|
2071
|
+
attr(g, "title", /*title*/ ctx[1]);
|
|
2072
|
+
attr(g, "style", /*barsStyleStr*/ ctx[7]);
|
|
2017
2073
|
},
|
|
2018
2074
|
m(target, anchor) {
|
|
2075
|
+
insert(target, g, anchor);
|
|
2076
|
+
|
|
2019
2077
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2020
|
-
each_blocks[i].m(
|
|
2078
|
+
each_blocks[i].m(g, null);
|
|
2021
2079
|
}
|
|
2022
|
-
|
|
2023
|
-
insert(target, each_1_anchor, anchor);
|
|
2024
2080
|
},
|
|
2025
2081
|
p(ctx, dirty) {
|
|
2026
|
-
if (dirty & /*rx, ry, rw, rh,
|
|
2082
|
+
if (dirty & /*rx, ry, rw, rh, left*/ 121) {
|
|
2027
2083
|
each_value = /*left*/ ctx[0];
|
|
2028
2084
|
let i;
|
|
2029
2085
|
|
|
@@ -2035,7 +2091,7 @@
|
|
|
2035
2091
|
} else {
|
|
2036
2092
|
each_blocks[i] = create_each_block$3(child_ctx);
|
|
2037
2093
|
each_blocks[i].c();
|
|
2038
|
-
each_blocks[i].m(
|
|
2094
|
+
each_blocks[i].m(g, null);
|
|
2039
2095
|
}
|
|
2040
2096
|
}
|
|
2041
2097
|
|
|
@@ -2045,15 +2101,23 @@
|
|
|
2045
2101
|
|
|
2046
2102
|
each_blocks.length = each_value.length;
|
|
2047
2103
|
}
|
|
2104
|
+
|
|
2105
|
+
if (dirty & /*style*/ 4 && g_class_value !== (g_class_value = "series " + /*style*/ ctx[2])) {
|
|
2106
|
+
attr(g, "class", g_class_value);
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
if (dirty & /*title*/ 2) {
|
|
2110
|
+
attr(g, "title", /*title*/ ctx[1]);
|
|
2111
|
+
}
|
|
2048
2112
|
},
|
|
2049
2113
|
d(detaching) {
|
|
2114
|
+
if (detaching) detach(g);
|
|
2050
2115
|
destroy_each(each_blocks, detaching);
|
|
2051
|
-
if (detaching) detach(each_1_anchor);
|
|
2052
2116
|
}
|
|
2053
2117
|
};
|
|
2054
2118
|
}
|
|
2055
2119
|
|
|
2056
|
-
// (
|
|
2120
|
+
// (55:3) {#each left as v, i}
|
|
2057
2121
|
function create_each_block$3(ctx) {
|
|
2058
2122
|
let rect;
|
|
2059
2123
|
let rect_x_value;
|
|
@@ -2064,29 +2128,28 @@
|
|
|
2064
2128
|
return {
|
|
2065
2129
|
c() {
|
|
2066
2130
|
rect = svg_element("rect");
|
|
2067
|
-
attr(rect, "x", rect_x_value = /*rx*/ ctx[
|
|
2068
|
-
attr(rect, "y", rect_y_value = /*ry*/ ctx[
|
|
2069
|
-
attr(rect, "width", rect_width_value = /*rw*/ ctx[
|
|
2070
|
-
attr(rect, "height", rect_height_value = /*rh*/ ctx[
|
|
2071
|
-
attr(rect, "style", /*barsStyleStr*/ ctx[5]);
|
|
2131
|
+
attr(rect, "x", rect_x_value = /*rx*/ ctx[6][/*i*/ ctx[27]]);
|
|
2132
|
+
attr(rect, "y", rect_y_value = /*ry*/ ctx[5][/*i*/ ctx[27]]);
|
|
2133
|
+
attr(rect, "width", rect_width_value = /*rw*/ ctx[4][/*i*/ ctx[27]]);
|
|
2134
|
+
attr(rect, "height", rect_height_value = /*rh*/ ctx[3][/*i*/ ctx[27]]);
|
|
2072
2135
|
},
|
|
2073
2136
|
m(target, anchor) {
|
|
2074
2137
|
insert(target, rect, anchor);
|
|
2075
2138
|
},
|
|
2076
2139
|
p(ctx, dirty) {
|
|
2077
|
-
if (dirty & /*rx*/
|
|
2140
|
+
if (dirty & /*rx*/ 64 && rect_x_value !== (rect_x_value = /*rx*/ ctx[6][/*i*/ ctx[27]])) {
|
|
2078
2141
|
attr(rect, "x", rect_x_value);
|
|
2079
2142
|
}
|
|
2080
2143
|
|
|
2081
|
-
if (dirty & /*ry*/
|
|
2144
|
+
if (dirty & /*ry*/ 32 && rect_y_value !== (rect_y_value = /*ry*/ ctx[5][/*i*/ ctx[27]])) {
|
|
2082
2145
|
attr(rect, "y", rect_y_value);
|
|
2083
2146
|
}
|
|
2084
2147
|
|
|
2085
|
-
if (dirty & /*rw*/
|
|
2148
|
+
if (dirty & /*rw*/ 16 && rect_width_value !== (rect_width_value = /*rw*/ ctx[4][/*i*/ ctx[27]])) {
|
|
2086
2149
|
attr(rect, "width", rect_width_value);
|
|
2087
2150
|
}
|
|
2088
2151
|
|
|
2089
|
-
if (dirty & /*rh*/
|
|
2152
|
+
if (dirty & /*rh*/ 8 && rect_height_value !== (rect_height_value = /*rh*/ ctx[3][/*i*/ ctx[27]])) {
|
|
2090
2153
|
attr(rect, "height", rect_height_value);
|
|
2091
2154
|
}
|
|
2092
2155
|
},
|
|
@@ -2098,7 +2161,7 @@
|
|
|
2098
2161
|
|
|
2099
2162
|
function create_fragment$8(ctx) {
|
|
2100
2163
|
let if_block_anchor;
|
|
2101
|
-
let if_block = /*rx*/ ctx[
|
|
2164
|
+
let if_block = /*rx*/ ctx[6] !== undefined && /*ry*/ ctx[5] !== undefined && create_if_block$6(ctx);
|
|
2102
2165
|
|
|
2103
2166
|
return {
|
|
2104
2167
|
c() {
|
|
@@ -2110,7 +2173,7 @@
|
|
|
2110
2173
|
insert(target, if_block_anchor, anchor);
|
|
2111
2174
|
},
|
|
2112
2175
|
p(ctx, [dirty]) {
|
|
2113
|
-
if (/*rx*/ ctx[
|
|
2176
|
+
if (/*rx*/ ctx[6] !== undefined && /*ry*/ ctx[5] !== undefined) {
|
|
2114
2177
|
if (if_block) {
|
|
2115
2178
|
if_block.p(ctx, dirty);
|
|
2116
2179
|
} else {
|
|
@@ -2149,6 +2212,8 @@
|
|
|
2149
2212
|
let { faceColor = Colors.PRIMARY } = $$props;
|
|
2150
2213
|
let { borderColor = faceColor } = $$props;
|
|
2151
2214
|
let { lineWidth = 1 } = $$props;
|
|
2215
|
+
let { title = "" } = $$props;
|
|
2216
|
+
let { style = "series_rect" } = $$props;
|
|
2152
2217
|
|
|
2153
2218
|
// styles for bars and labels
|
|
2154
2219
|
const barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`;
|
|
@@ -2177,46 +2242,50 @@
|
|
|
2177
2242
|
const axes = getContext('axes');
|
|
2178
2243
|
|
|
2179
2244
|
const xLim = axes.xLim;
|
|
2180
|
-
component_subscribe($$self, xLim, value => $$invalidate(
|
|
2245
|
+
component_subscribe($$self, xLim, value => $$invalidate(22, $xLim = value));
|
|
2181
2246
|
const yLim = axes.yLim;
|
|
2182
|
-
component_subscribe($$self, yLim, value => $$invalidate(
|
|
2247
|
+
component_subscribe($$self, yLim, value => $$invalidate(20, $yLim = value));
|
|
2183
2248
|
const axesWidth = axes.width;
|
|
2184
|
-
component_subscribe($$self, axesWidth, value => $$invalidate(
|
|
2249
|
+
component_subscribe($$self, axesWidth, value => $$invalidate(21, $axesWidth = value));
|
|
2185
2250
|
const axesHeight = axes.height;
|
|
2186
|
-
component_subscribe($$self, axesHeight, value => $$invalidate(
|
|
2251
|
+
component_subscribe($$self, axesHeight, value => $$invalidate(19, $axesHeight = value));
|
|
2187
2252
|
|
|
2188
2253
|
$$self.$$set = $$props => {
|
|
2189
2254
|
if ('left' in $$props) $$invalidate(0, left = $$props.left);
|
|
2190
|
-
if ('top' in $$props) $$invalidate(
|
|
2191
|
-
if ('width' in $$props) $$invalidate(
|
|
2192
|
-
if ('height' in $$props) $$invalidate(
|
|
2193
|
-
if ('labels' in $$props) $$invalidate(
|
|
2194
|
-
if ('faceColor' in $$props) $$invalidate(
|
|
2195
|
-
if ('borderColor' in $$props) $$invalidate(
|
|
2196
|
-
if ('lineWidth' in $$props) $$invalidate(
|
|
2255
|
+
if ('top' in $$props) $$invalidate(14, top = $$props.top);
|
|
2256
|
+
if ('width' in $$props) $$invalidate(12, width = $$props.width);
|
|
2257
|
+
if ('height' in $$props) $$invalidate(13, height = $$props.height);
|
|
2258
|
+
if ('labels' in $$props) $$invalidate(15, labels = $$props.labels);
|
|
2259
|
+
if ('faceColor' in $$props) $$invalidate(16, faceColor = $$props.faceColor);
|
|
2260
|
+
if ('borderColor' in $$props) $$invalidate(17, borderColor = $$props.borderColor);
|
|
2261
|
+
if ('lineWidth' in $$props) $$invalidate(18, lineWidth = $$props.lineWidth);
|
|
2262
|
+
if ('title' in $$props) $$invalidate(1, title = $$props.title);
|
|
2263
|
+
if ('style' in $$props) $$invalidate(2, style = $$props.style);
|
|
2197
2264
|
};
|
|
2198
2265
|
|
|
2199
2266
|
$$self.$$.update = () => {
|
|
2200
|
-
if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/
|
|
2267
|
+
if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 6291457) {
|
|
2201
2268
|
// reactive variables for coordinates of data points in pixels
|
|
2202
|
-
$$invalidate(
|
|
2269
|
+
$$invalidate(6, rx = axes.scaleX(left, $xLim, $axesWidth));
|
|
2203
2270
|
}
|
|
2204
2271
|
|
|
2205
|
-
if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/
|
|
2206
|
-
$$invalidate(
|
|
2272
|
+
if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 1589248) {
|
|
2273
|
+
$$invalidate(5, ry = axes.scaleY(top, $yLim, $axesHeight));
|
|
2207
2274
|
}
|
|
2208
2275
|
|
|
2209
|
-
if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/
|
|
2210
|
-
$$invalidate(
|
|
2276
|
+
if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/ 6295552) {
|
|
2277
|
+
$$invalidate(4, rw = axes.scaleX(width, $xLim, $axesWidth, true));
|
|
2211
2278
|
}
|
|
2212
2279
|
|
|
2213
|
-
if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/
|
|
2214
|
-
$$invalidate(
|
|
2280
|
+
if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/ 1581056) {
|
|
2281
|
+
$$invalidate(3, rh = axes.scaleY(height, $yLim, $axesHeight, true));
|
|
2215
2282
|
}
|
|
2216
2283
|
};
|
|
2217
2284
|
|
|
2218
2285
|
return [
|
|
2219
2286
|
left,
|
|
2287
|
+
title,
|
|
2288
|
+
style,
|
|
2220
2289
|
rh,
|
|
2221
2290
|
rw,
|
|
2222
2291
|
ry,
|
|
@@ -2246,13 +2315,15 @@
|
|
|
2246
2315
|
|
|
2247
2316
|
init(this, options, instance$8, create_fragment$8, safe_not_equal, {
|
|
2248
2317
|
left: 0,
|
|
2249
|
-
top:
|
|
2250
|
-
width:
|
|
2251
|
-
height:
|
|
2252
|
-
labels:
|
|
2253
|
-
faceColor:
|
|
2254
|
-
borderColor:
|
|
2255
|
-
lineWidth:
|
|
2318
|
+
top: 14,
|
|
2319
|
+
width: 12,
|
|
2320
|
+
height: 13,
|
|
2321
|
+
labels: 15,
|
|
2322
|
+
faceColor: 16,
|
|
2323
|
+
borderColor: 17,
|
|
2324
|
+
lineWidth: 18,
|
|
2325
|
+
title: 1,
|
|
2326
|
+
style: 2
|
|
2256
2327
|
});
|
|
2257
2328
|
}
|
|
2258
2329
|
}
|
|
@@ -2279,6 +2350,7 @@
|
|
|
2279
2350
|
c() {
|
|
2280
2351
|
g = svg_element("g");
|
|
2281
2352
|
create_component(rectangles.$$.fragment);
|
|
2353
|
+
set_style(g, "pointer-events", "none");
|
|
2282
2354
|
attr(g, "class", "mdaplot__axes-box");
|
|
2283
2355
|
},
|
|
2284
2356
|
m(target, anchor) {
|
|
@@ -2692,17 +2764,22 @@
|
|
|
2692
2764
|
|
|
2693
2765
|
/* src/TextLabels.svelte generated by Svelte v3.46.3 */
|
|
2694
2766
|
|
|
2767
|
+
function add_css$2(target) {
|
|
2768
|
+
append_styles(target, "svelte-1szep8i", "text.svelte-1szep8i{dominant-baseline:middle}");
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2695
2771
|
function get_each_context$1(ctx, list, i) {
|
|
2696
2772
|
const child_ctx = ctx.slice();
|
|
2697
|
-
child_ctx[
|
|
2698
|
-
child_ctx[
|
|
2773
|
+
child_ctx[27] = list[i];
|
|
2774
|
+
child_ctx[29] = i;
|
|
2699
2775
|
return child_ctx;
|
|
2700
2776
|
}
|
|
2701
2777
|
|
|
2702
|
-
// (
|
|
2778
|
+
// (66:0) {#if x !== undefined && y !== undefined}
|
|
2703
2779
|
function create_if_block$3(ctx) {
|
|
2704
|
-
let
|
|
2705
|
-
let
|
|
2780
|
+
let g;
|
|
2781
|
+
let g_class_value;
|
|
2782
|
+
let each_value = /*x*/ ctx[7];
|
|
2706
2783
|
let each_blocks = [];
|
|
2707
2784
|
|
|
2708
2785
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
@@ -2711,22 +2788,26 @@
|
|
|
2711
2788
|
|
|
2712
2789
|
return {
|
|
2713
2790
|
c() {
|
|
2791
|
+
g = svg_element("g");
|
|
2792
|
+
|
|
2714
2793
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2715
2794
|
each_blocks[i].c();
|
|
2716
2795
|
}
|
|
2717
2796
|
|
|
2718
|
-
|
|
2797
|
+
attr(g, "class", g_class_value = "series " + /*style*/ ctx[1]);
|
|
2798
|
+
attr(g, "title", /*title*/ ctx[2]);
|
|
2799
|
+
attr(g, "style", /*textStyleStr*/ ctx[3]);
|
|
2719
2800
|
},
|
|
2720
2801
|
m(target, anchor) {
|
|
2802
|
+
insert(target, g, anchor);
|
|
2803
|
+
|
|
2721
2804
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
2722
|
-
each_blocks[i].m(
|
|
2805
|
+
each_blocks[i].m(g, null);
|
|
2723
2806
|
}
|
|
2724
|
-
|
|
2725
|
-
insert(target, each_1_anchor, anchor);
|
|
2726
2807
|
},
|
|
2727
2808
|
p(ctx, dirty) {
|
|
2728
|
-
if (dirty & /*
|
|
2729
|
-
each_value = /*x*/ ctx[
|
|
2809
|
+
if (dirty & /*x, y, dx, dy, labels*/ 241) {
|
|
2810
|
+
each_value = /*x*/ ctx[7];
|
|
2730
2811
|
let i;
|
|
2731
2812
|
|
|
2732
2813
|
for (i = 0; i < each_value.length; i += 1) {
|
|
@@ -2737,7 +2818,7 @@
|
|
|
2737
2818
|
} else {
|
|
2738
2819
|
each_blocks[i] = create_each_block$1(child_ctx);
|
|
2739
2820
|
each_blocks[i].c();
|
|
2740
|
-
each_blocks[i].m(
|
|
2821
|
+
each_blocks[i].m(g, null);
|
|
2741
2822
|
}
|
|
2742
2823
|
}
|
|
2743
2824
|
|
|
@@ -2747,61 +2828,64 @@
|
|
|
2747
2828
|
|
|
2748
2829
|
each_blocks.length = each_value.length;
|
|
2749
2830
|
}
|
|
2831
|
+
|
|
2832
|
+
if (dirty & /*style*/ 2 && g_class_value !== (g_class_value = "series " + /*style*/ ctx[1])) {
|
|
2833
|
+
attr(g, "class", g_class_value);
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
if (dirty & /*title*/ 4) {
|
|
2837
|
+
attr(g, "title", /*title*/ ctx[2]);
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
if (dirty & /*textStyleStr*/ 8) {
|
|
2841
|
+
attr(g, "style", /*textStyleStr*/ ctx[3]);
|
|
2842
|
+
}
|
|
2750
2843
|
},
|
|
2751
2844
|
d(detaching) {
|
|
2845
|
+
if (detaching) detach(g);
|
|
2752
2846
|
destroy_each(each_blocks, detaching);
|
|
2753
|
-
if (detaching) detach(each_1_anchor);
|
|
2754
2847
|
}
|
|
2755
2848
|
};
|
|
2756
2849
|
}
|
|
2757
2850
|
|
|
2758
|
-
// (
|
|
2851
|
+
// (68:3) {#each x as v, i}
|
|
2759
2852
|
function create_each_block$1(ctx) {
|
|
2760
2853
|
let text_1;
|
|
2761
|
-
let raw_value = /*labels*/ ctx[0][/*i*/ ctx[
|
|
2854
|
+
let raw_value = /*labels*/ ctx[0][/*i*/ ctx[29]] + "";
|
|
2855
|
+
let text_1_data_id_value;
|
|
2762
2856
|
let text_1_x_value;
|
|
2763
2857
|
let text_1_y_value;
|
|
2764
|
-
let text_1_text_anchor_value;
|
|
2765
2858
|
|
|
2766
2859
|
return {
|
|
2767
2860
|
c() {
|
|
2768
2861
|
text_1 = svg_element("text");
|
|
2769
|
-
attr(text_1, "
|
|
2770
|
-
attr(text_1, "x", text_1_x_value = /*x*/ ctx[
|
|
2771
|
-
attr(text_1, "y", text_1_y_value = /*y*/ ctx[
|
|
2772
|
-
attr(text_1, "dx", /*dx*/ ctx[
|
|
2773
|
-
attr(text_1, "dy", /*dy*/ ctx[
|
|
2774
|
-
attr(text_1, "
|
|
2775
|
-
attr(text_1, "text-anchor", text_1_text_anchor_value = /*textAnchors*/ ctx[7][/*pos*/ ctx[1]]);
|
|
2862
|
+
attr(text_1, "data-id", text_1_data_id_value = /*i*/ ctx[29]);
|
|
2863
|
+
attr(text_1, "x", text_1_x_value = /*x*/ ctx[7][/*i*/ ctx[29]]);
|
|
2864
|
+
attr(text_1, "y", text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]]);
|
|
2865
|
+
attr(text_1, "dx", /*dx*/ ctx[5]);
|
|
2866
|
+
attr(text_1, "dy", /*dy*/ ctx[4]);
|
|
2867
|
+
attr(text_1, "class", "svelte-1szep8i");
|
|
2776
2868
|
},
|
|
2777
2869
|
m(target, anchor) {
|
|
2778
2870
|
insert(target, text_1, anchor);
|
|
2779
2871
|
text_1.innerHTML = raw_value;
|
|
2780
2872
|
},
|
|
2781
2873
|
p(ctx, dirty) {
|
|
2782
|
-
if (dirty & /*labels*/ 1 && raw_value !== (raw_value = /*labels*/ ctx[0][/*i*/ ctx[
|
|
2783
|
-
if (dirty & /*
|
|
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]])) {
|
|
2874
|
+
if (dirty & /*labels*/ 1 && raw_value !== (raw_value = /*labels*/ ctx[0][/*i*/ ctx[29]] + "")) text_1.innerHTML = raw_value;
|
|
2875
|
+
if (dirty & /*x*/ 128 && text_1_x_value !== (text_1_x_value = /*x*/ ctx[7][/*i*/ ctx[29]])) {
|
|
2788
2876
|
attr(text_1, "x", text_1_x_value);
|
|
2789
2877
|
}
|
|
2790
2878
|
|
|
2791
|
-
if (dirty & /*y*/
|
|
2879
|
+
if (dirty & /*y*/ 64 && text_1_y_value !== (text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]])) {
|
|
2792
2880
|
attr(text_1, "y", text_1_y_value);
|
|
2793
2881
|
}
|
|
2794
2882
|
|
|
2795
|
-
if (dirty & /*dx*/
|
|
2796
|
-
attr(text_1, "dx", /*dx*/ ctx[
|
|
2797
|
-
}
|
|
2798
|
-
|
|
2799
|
-
if (dirty & /*dy*/ 8) {
|
|
2800
|
-
attr(text_1, "dy", /*dy*/ ctx[3]);
|
|
2883
|
+
if (dirty & /*dx*/ 32) {
|
|
2884
|
+
attr(text_1, "dx", /*dx*/ ctx[5]);
|
|
2801
2885
|
}
|
|
2802
2886
|
|
|
2803
|
-
if (dirty & /*
|
|
2804
|
-
attr(text_1, "
|
|
2887
|
+
if (dirty & /*dy*/ 16) {
|
|
2888
|
+
attr(text_1, "dy", /*dy*/ ctx[4]);
|
|
2805
2889
|
}
|
|
2806
2890
|
},
|
|
2807
2891
|
d(detaching) {
|
|
@@ -2812,7 +2896,7 @@
|
|
|
2812
2896
|
|
|
2813
2897
|
function create_fragment$5(ctx) {
|
|
2814
2898
|
let if_block_anchor;
|
|
2815
|
-
let if_block = /*x*/ ctx[
|
|
2899
|
+
let if_block = /*x*/ ctx[7] !== undefined && /*y*/ ctx[6] !== undefined && create_if_block$3(ctx);
|
|
2816
2900
|
|
|
2817
2901
|
return {
|
|
2818
2902
|
c() {
|
|
@@ -2824,7 +2908,7 @@
|
|
|
2824
2908
|
insert(target, if_block_anchor, anchor);
|
|
2825
2909
|
},
|
|
2826
2910
|
p(ctx, [dirty]) {
|
|
2827
|
-
if (/*x*/ ctx[
|
|
2911
|
+
if (/*x*/ ctx[7] !== undefined && /*y*/ ctx[6] !== undefined) {
|
|
2828
2912
|
if (if_block) {
|
|
2829
2913
|
if_block.p(ctx, dirty);
|
|
2830
2914
|
} else {
|
|
@@ -2865,11 +2949,13 @@
|
|
|
2865
2949
|
let { borderColor = "transparent" } = $$props;
|
|
2866
2950
|
let { borderWidth = 0 } = $$props;
|
|
2867
2951
|
let { textSize = 1 } = $$props;
|
|
2952
|
+
let { style = "" } = $$props;
|
|
2953
|
+
let { title = "series_text" } = $$props;
|
|
2868
2954
|
|
|
2869
2955
|
// text-anchor values depending on position
|
|
2870
2956
|
const textAnchors = ["middle", "middle", "start", "middle", "end"];
|
|
2871
2957
|
|
|
2872
|
-
|
|
2958
|
+
// sanity check for input parameters
|
|
2873
2959
|
if (!Array.isArray(xValues) || !Array.isArray(yValues) || xValues.length !== yValues.length) {
|
|
2874
2960
|
throw "TextLabels: parameters 'xValues' and 'yValues' must be vectors of the same length.";
|
|
2875
2961
|
}
|
|
@@ -2878,30 +2964,32 @@
|
|
|
2878
2964
|
const axes = getContext('axes');
|
|
2879
2965
|
|
|
2880
2966
|
const xLim = axes.xLim;
|
|
2881
|
-
component_subscribe($$self, xLim, value => $$invalidate(
|
|
2967
|
+
component_subscribe($$self, xLim, value => $$invalidate(24, $xLim = value));
|
|
2882
2968
|
const yLim = axes.yLim;
|
|
2883
|
-
component_subscribe($$self, yLim, value => $$invalidate(
|
|
2969
|
+
component_subscribe($$self, yLim, value => $$invalidate(22, $yLim = value));
|
|
2884
2970
|
const axesWidth = axes.width;
|
|
2885
|
-
component_subscribe($$self, axesWidth, value => $$invalidate(
|
|
2971
|
+
component_subscribe($$self, axesWidth, value => $$invalidate(23, $axesWidth = value));
|
|
2886
2972
|
const axesHeight = axes.height;
|
|
2887
|
-
component_subscribe($$self, axesHeight, value => $$invalidate(
|
|
2973
|
+
component_subscribe($$self, axesHeight, value => $$invalidate(21, $axesHeight = value));
|
|
2888
2974
|
const scale = axes.scale;
|
|
2889
|
-
component_subscribe($$self, scale, value => $$invalidate(
|
|
2975
|
+
component_subscribe($$self, scale, value => $$invalidate(20, $scale = value));
|
|
2890
2976
|
|
|
2891
2977
|
$$self.$$set = $$props => {
|
|
2892
2978
|
if ('xValues' in $$props) $$invalidate(13, xValues = $$props.xValues);
|
|
2893
2979
|
if ('yValues' in $$props) $$invalidate(14, yValues = $$props.yValues);
|
|
2894
2980
|
if ('labels' in $$props) $$invalidate(0, labels = $$props.labels);
|
|
2895
|
-
if ('pos' in $$props) $$invalidate(
|
|
2896
|
-
if ('faceColor' in $$props) $$invalidate(
|
|
2897
|
-
if ('borderColor' in $$props) $$invalidate(
|
|
2898
|
-
if ('borderWidth' in $$props) $$invalidate(
|
|
2899
|
-
if ('textSize' in $$props) $$invalidate(
|
|
2981
|
+
if ('pos' in $$props) $$invalidate(15, pos = $$props.pos);
|
|
2982
|
+
if ('faceColor' in $$props) $$invalidate(16, faceColor = $$props.faceColor);
|
|
2983
|
+
if ('borderColor' in $$props) $$invalidate(17, borderColor = $$props.borderColor);
|
|
2984
|
+
if ('borderWidth' in $$props) $$invalidate(18, borderWidth = $$props.borderWidth);
|
|
2985
|
+
if ('textSize' in $$props) $$invalidate(19, textSize = $$props.textSize);
|
|
2986
|
+
if ('style' in $$props) $$invalidate(1, style = $$props.style);
|
|
2987
|
+
if ('title' in $$props) $$invalidate(2, title = $$props.title);
|
|
2900
2988
|
};
|
|
2901
2989
|
|
|
2902
2990
|
$$self.$$.update = () => {
|
|
2903
2991
|
if ($$self.$$.dirty & /*xValues, labels*/ 8193) {
|
|
2904
|
-
// multiply
|
|
2992
|
+
// multiply label values if needed
|
|
2905
2993
|
{
|
|
2906
2994
|
const n = xValues.length;
|
|
2907
2995
|
if (!Array.isArray(labels)) $$invalidate(0, labels = Array(n).fill(labels));
|
|
@@ -2917,38 +3005,39 @@
|
|
|
2917
3005
|
}
|
|
2918
3006
|
}
|
|
2919
3007
|
|
|
2920
|
-
if ($$self.$$.dirty & /*xValues, $xLim, $axesWidth*/
|
|
3008
|
+
if ($$self.$$.dirty & /*xValues, $xLim, $axesWidth*/ 25174016) {
|
|
2921
3009
|
// reactive variables for coordinates of data points in pixels
|
|
2922
|
-
$$invalidate(
|
|
3010
|
+
$$invalidate(7, x = axes.scaleX(xValues, $xLim, $axesWidth));
|
|
2923
3011
|
}
|
|
2924
3012
|
|
|
2925
|
-
if ($$self.$$.dirty & /*yValues, $yLim, $axesHeight*/
|
|
2926
|
-
$$invalidate(
|
|
3013
|
+
if ($$self.$$.dirty & /*yValues, $yLim, $axesHeight*/ 6307840) {
|
|
3014
|
+
$$invalidate(6, y = axes.scaleY(yValues, $yLim, $axesHeight));
|
|
2927
3015
|
}
|
|
2928
3016
|
|
|
2929
|
-
if ($$self.$$.dirty & /*pos, $scale*/
|
|
2930
|
-
$$invalidate(
|
|
3017
|
+
if ($$self.$$.dirty & /*pos, $scale*/ 1081344) {
|
|
3018
|
+
$$invalidate(5, dx = [0, 0, 1, 0, -1][pos] * axes.LABELS_MARGIN[$scale]);
|
|
2931
3019
|
}
|
|
2932
3020
|
|
|
2933
|
-
if ($$self.$$.dirty & /*pos, $scale*/
|
|
2934
|
-
$$invalidate(
|
|
3021
|
+
if ($$self.$$.dirty & /*pos, $scale*/ 1081344) {
|
|
3022
|
+
$$invalidate(4, dy = [0, 1, 0, -1, 0][pos] * axes.LABELS_MARGIN[$scale]);
|
|
2935
3023
|
}
|
|
2936
3024
|
|
|
2937
|
-
if ($$self.$$.dirty & /*faceColor, borderWidth, borderColor, textSize*/
|
|
2938
|
-
// styles for
|
|
2939
|
-
$$invalidate(
|
|
3025
|
+
if ($$self.$$.dirty & /*faceColor, borderWidth, borderColor, textSize, pos*/ 1015808) {
|
|
3026
|
+
// styles for the elements
|
|
3027
|
+
$$invalidate(3, textStyleStr = `fill:${faceColor};stroke-width:${borderWidth}px;stroke:${borderColor};
|
|
3028
|
+
font-size:${textSize}em; text-anchor:${textAnchors[pos]};`);
|
|
2940
3029
|
}
|
|
2941
3030
|
};
|
|
2942
3031
|
|
|
2943
3032
|
return [
|
|
2944
3033
|
labels,
|
|
2945
|
-
|
|
3034
|
+
style,
|
|
3035
|
+
title,
|
|
2946
3036
|
textStyleStr,
|
|
2947
3037
|
dy,
|
|
2948
3038
|
dx,
|
|
2949
3039
|
y,
|
|
2950
3040
|
x,
|
|
2951
|
-
textAnchors,
|
|
2952
3041
|
xLim,
|
|
2953
3042
|
yLim,
|
|
2954
3043
|
axesWidth,
|
|
@@ -2956,6 +3045,7 @@
|
|
|
2956
3045
|
scale,
|
|
2957
3046
|
xValues,
|
|
2958
3047
|
yValues,
|
|
3048
|
+
pos,
|
|
2959
3049
|
faceColor,
|
|
2960
3050
|
borderColor,
|
|
2961
3051
|
borderWidth,
|
|
@@ -2972,16 +3062,26 @@
|
|
|
2972
3062
|
constructor(options) {
|
|
2973
3063
|
super();
|
|
2974
3064
|
|
|
2975
|
-
init(
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
3065
|
+
init(
|
|
3066
|
+
this,
|
|
3067
|
+
options,
|
|
3068
|
+
instance$5,
|
|
3069
|
+
create_fragment$5,
|
|
3070
|
+
safe_not_equal,
|
|
3071
|
+
{
|
|
3072
|
+
xValues: 13,
|
|
3073
|
+
yValues: 14,
|
|
3074
|
+
labels: 0,
|
|
3075
|
+
pos: 15,
|
|
3076
|
+
faceColor: 16,
|
|
3077
|
+
borderColor: 17,
|
|
3078
|
+
borderWidth: 18,
|
|
3079
|
+
textSize: 19,
|
|
3080
|
+
style: 1,
|
|
3081
|
+
title: 2
|
|
3082
|
+
},
|
|
3083
|
+
add_css$2
|
|
3084
|
+
);
|
|
2985
3085
|
}
|
|
2986
3086
|
}
|
|
2987
3087
|
|
|
@@ -3316,31 +3416,28 @@
|
|
|
3316
3416
|
}
|
|
3317
3417
|
|
|
3318
3418
|
function create_fragment$3(ctx) {
|
|
3319
|
-
let g;
|
|
3320
3419
|
let rectangles;
|
|
3321
3420
|
let current;
|
|
3322
3421
|
|
|
3323
3422
|
rectangles = new Rectangles({
|
|
3324
3423
|
props: {
|
|
3424
|
+
style: "series_bar",
|
|
3325
3425
|
left: /*left*/ ctx[4],
|
|
3326
3426
|
top: /*top*/ ctx[5],
|
|
3327
3427
|
width: /*width*/ ctx[3],
|
|
3328
3428
|
height: /*height*/ ctx[6],
|
|
3329
3429
|
borderColor: /*borderColor*/ ctx[2],
|
|
3330
|
-
faceColor: /*faceColor*/ ctx[1]
|
|
3430
|
+
faceColor: /*faceColor*/ ctx[1],
|
|
3431
|
+
title: /*title*/ ctx[0]
|
|
3331
3432
|
}
|
|
3332
3433
|
});
|
|
3333
3434
|
|
|
3334
3435
|
return {
|
|
3335
3436
|
c() {
|
|
3336
|
-
g = svg_element("g");
|
|
3337
3437
|
create_component(rectangles.$$.fragment);
|
|
3338
|
-
attr(g, "class", "series series_bar");
|
|
3339
|
-
attr(g, "title", /*title*/ ctx[0]);
|
|
3340
3438
|
},
|
|
3341
3439
|
m(target, anchor) {
|
|
3342
|
-
|
|
3343
|
-
mount_component(rectangles, g, null);
|
|
3440
|
+
mount_component(rectangles, target, anchor);
|
|
3344
3441
|
current = true;
|
|
3345
3442
|
},
|
|
3346
3443
|
p(ctx, [dirty]) {
|
|
@@ -3351,11 +3448,8 @@
|
|
|
3351
3448
|
if (dirty & /*height*/ 64) rectangles_changes.height = /*height*/ ctx[6];
|
|
3352
3449
|
if (dirty & /*borderColor*/ 4) rectangles_changes.borderColor = /*borderColor*/ ctx[2];
|
|
3353
3450
|
if (dirty & /*faceColor*/ 2) rectangles_changes.faceColor = /*faceColor*/ ctx[1];
|
|
3451
|
+
if (dirty & /*title*/ 1) rectangles_changes.title = /*title*/ ctx[0];
|
|
3354
3452
|
rectangles.$set(rectangles_changes);
|
|
3355
|
-
|
|
3356
|
-
if (!current || dirty & /*title*/ 1) {
|
|
3357
|
-
attr(g, "title", /*title*/ ctx[0]);
|
|
3358
|
-
}
|
|
3359
3453
|
},
|
|
3360
3454
|
i(local) {
|
|
3361
3455
|
if (current) return;
|
|
@@ -3367,8 +3461,7 @@
|
|
|
3367
3461
|
current = false;
|
|
3368
3462
|
},
|
|
3369
3463
|
d(detaching) {
|
|
3370
|
-
|
|
3371
|
-
destroy_component(rectangles);
|
|
3464
|
+
destroy_component(rectangles, detaching);
|
|
3372
3465
|
}
|
|
3373
3466
|
};
|
|
3374
3467
|
}
|
|
@@ -3487,11 +3580,10 @@
|
|
|
3487
3580
|
/* src/ScatterSeries.svelte generated by Svelte v3.46.3 */
|
|
3488
3581
|
|
|
3489
3582
|
function add_css(target) {
|
|
3490
|
-
append_styles(target, "svelte-
|
|
3583
|
+
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
3584
|
}
|
|
3492
3585
|
|
|
3493
3586
|
function create_fragment$2(ctx) {
|
|
3494
|
-
let g;
|
|
3495
3587
|
let textlabels;
|
|
3496
3588
|
let current;
|
|
3497
3589
|
|
|
@@ -3499,40 +3591,35 @@
|
|
|
3499
3591
|
props: {
|
|
3500
3592
|
xValues: /*xValues*/ ctx[0],
|
|
3501
3593
|
yValues: /*yValues*/ ctx[1],
|
|
3502
|
-
labels: /*markerSymbol*/ ctx[7],
|
|
3503
|
-
textSize: /*markerSize*/ ctx[6],
|
|
3504
3594
|
faceColor: /*faceColor*/ ctx[3],
|
|
3505
3595
|
borderColor: /*borderColor*/ ctx[4],
|
|
3506
|
-
borderWidth: /*borderWidth*/ ctx[5]
|
|
3596
|
+
borderWidth: /*borderWidth*/ ctx[5],
|
|
3597
|
+
title: /*title*/ ctx[2],
|
|
3598
|
+
style: "series_scatter",
|
|
3599
|
+
labels: /*markerSymbol*/ ctx[7],
|
|
3600
|
+
textSize: /*markerSize*/ ctx[6]
|
|
3507
3601
|
}
|
|
3508
3602
|
});
|
|
3509
3603
|
|
|
3510
3604
|
return {
|
|
3511
3605
|
c() {
|
|
3512
|
-
g = svg_element("g");
|
|
3513
3606
|
create_component(textlabels.$$.fragment);
|
|
3514
|
-
attr(g, "class", "series series_scatter");
|
|
3515
|
-
attr(g, "title", /*title*/ ctx[2]);
|
|
3516
3607
|
},
|
|
3517
3608
|
m(target, anchor) {
|
|
3518
|
-
|
|
3519
|
-
mount_component(textlabels, g, null);
|
|
3609
|
+
mount_component(textlabels, target, anchor);
|
|
3520
3610
|
current = true;
|
|
3521
3611
|
},
|
|
3522
3612
|
p(ctx, [dirty]) {
|
|
3523
3613
|
const textlabels_changes = {};
|
|
3524
3614
|
if (dirty & /*xValues*/ 1) textlabels_changes.xValues = /*xValues*/ ctx[0];
|
|
3525
3615
|
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
3616
|
if (dirty & /*faceColor*/ 8) textlabels_changes.faceColor = /*faceColor*/ ctx[3];
|
|
3529
3617
|
if (dirty & /*borderColor*/ 16) textlabels_changes.borderColor = /*borderColor*/ ctx[4];
|
|
3530
3618
|
if (dirty & /*borderWidth*/ 32) textlabels_changes.borderWidth = /*borderWidth*/ ctx[5];
|
|
3619
|
+
if (dirty & /*title*/ 4) textlabels_changes.title = /*title*/ ctx[2];
|
|
3620
|
+
if (dirty & /*markerSymbol*/ 128) textlabels_changes.labels = /*markerSymbol*/ ctx[7];
|
|
3621
|
+
if (dirty & /*markerSize*/ 64) textlabels_changes.textSize = /*markerSize*/ ctx[6];
|
|
3531
3622
|
textlabels.$set(textlabels_changes);
|
|
3532
|
-
|
|
3533
|
-
if (!current || dirty & /*title*/ 4) {
|
|
3534
|
-
attr(g, "title", /*title*/ ctx[2]);
|
|
3535
|
-
}
|
|
3536
3623
|
},
|
|
3537
3624
|
i(local) {
|
|
3538
3625
|
if (current) return;
|
|
@@ -3544,8 +3631,7 @@
|
|
|
3544
3631
|
current = false;
|
|
3545
3632
|
},
|
|
3546
3633
|
d(detaching) {
|
|
3547
|
-
|
|
3548
|
-
destroy_component(textlabels);
|
|
3634
|
+
destroy_component(textlabels, detaching);
|
|
3549
3635
|
}
|
|
3550
3636
|
};
|
|
3551
3637
|
}
|
|
@@ -3563,6 +3649,7 @@
|
|
|
3563
3649
|
// TODO: implement later
|
|
3564
3650
|
//export let labels = yValues;
|
|
3565
3651
|
//export let showLabels = "no"; // can be "no", "hover", "always"
|
|
3652
|
+
/* constants for internal use */
|
|
3566
3653
|
const markers = ["●", "◼", "▲", "▼", "⬥", "+", "*", "⨯"];
|
|
3567
3654
|
|
|
3568
3655
|
let markerSymbol;
|
|
@@ -3669,7 +3756,7 @@
|
|
|
3669
3756
|
polyline = svg_element("polyline");
|
|
3670
3757
|
attr(polyline, "class", "line");
|
|
3671
3758
|
attr(polyline, "points", /*p*/ ctx[2]);
|
|
3672
|
-
attr(g, "class", "series
|
|
3759
|
+
attr(g, "class", "series series_line");
|
|
3673
3760
|
attr(g, "style", /*lineStyleStr*/ ctx[1]);
|
|
3674
3761
|
attr(g, "title", /*title*/ ctx[0]);
|
|
3675
3762
|
},
|
|
@@ -3804,7 +3891,8 @@
|
|
|
3804
3891
|
}
|
|
3805
3892
|
|
|
3806
3893
|
if ($$self.$$.dirty & /*lineColor, lineWidth, $scale, lineType*/ 39936) {
|
|
3807
|
-
$$invalidate(1, lineStyleStr = `fill:transparent;stroke:${lineColor};stroke-width: ${lineWidth}px;
|
|
3894
|
+
$$invalidate(1, lineStyleStr = `fill:transparent;stroke:${lineColor};stroke-width: ${lineWidth}px;
|
|
3895
|
+
stroke-dasharray:${axes.LINE_STYLES[$scale][lineType - 1]}`);
|
|
3808
3896
|
}
|
|
3809
3897
|
};
|
|
3810
3898
|
|