svelte-plots-basic 1.0.1 → 1.0.2
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 +62 -61
- package/dist/index.mjs +62 -61
- package/package.json +1 -1
- package/src/Axes.svelte +2 -2
package/dist/index.js
CHANGED
|
@@ -601,15 +601,15 @@
|
|
|
601
601
|
let if_block0 = /*title*/ ctx[0] !== "" && create_if_block_3(ctx);
|
|
602
602
|
let if_block1 = /*yLabel*/ ctx[2] !== "" && create_if_block_2(ctx);
|
|
603
603
|
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[
|
|
612
|
-
let if_block3 = !/*$isOk*/ 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);
|
|
612
|
+
let if_block3 = !/*$isOk*/ ctx[3] && create_if_block$9();
|
|
613
613
|
|
|
614
614
|
return {
|
|
615
615
|
c() {
|
|
@@ -632,17 +632,17 @@
|
|
|
632
632
|
if (box_slot) box_slot.c();
|
|
633
633
|
t3 = space();
|
|
634
634
|
if (if_block3) if_block3.c();
|
|
635
|
-
attr(rect, "x", rect_x_value = /*cpx*/ ctx[
|
|
636
|
-
attr(rect, "y", rect_y_value = /*cpy*/ ctx[
|
|
637
|
-
attr(rect, "width", rect_width_value = /*cpx*/ ctx[
|
|
638
|
-
attr(rect, "height", rect_height_value = /*cpy*/ ctx[
|
|
635
|
+
attr(rect, "x", rect_x_value = /*cpx*/ ctx[7][0]);
|
|
636
|
+
attr(rect, "y", rect_y_value = /*cpy*/ ctx[6][1]);
|
|
637
|
+
attr(rect, "width", rect_width_value = /*cpx*/ ctx[7][1] - /*cpx*/ ctx[7][0]);
|
|
638
|
+
attr(rect, "height", rect_height_value = /*cpy*/ ctx[6][0] - /*cpy*/ ctx[6][1]);
|
|
639
639
|
attr(clipPath, "id", /*clipPathID*/ ctx[8]);
|
|
640
640
|
attr(g, "clip-path", "url(#" + /*clipPathID*/ ctx[8] + ")");
|
|
641
641
|
attr(svg, "preserveAspectRatio", "none");
|
|
642
642
|
attr(svg, "class", "axes");
|
|
643
643
|
attr(div0, "class", "axes-wrapper");
|
|
644
|
-
attr(div1, "class", div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[
|
|
645
|
-
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[
|
|
644
|
+
attr(div1, "class", div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]));
|
|
645
|
+
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[3]);
|
|
646
646
|
},
|
|
647
647
|
m(target, anchor) {
|
|
648
648
|
insert(target, div1, anchor);
|
|
@@ -676,7 +676,7 @@
|
|
|
676
676
|
box_slot.m(svg, null);
|
|
677
677
|
}
|
|
678
678
|
|
|
679
|
-
/*div0_binding*/ ctx[
|
|
679
|
+
/*div0_binding*/ ctx[26](div0);
|
|
680
680
|
append(div1, t3);
|
|
681
681
|
if (if_block3) if_block3.m(div1, null);
|
|
682
682
|
current = true;
|
|
@@ -721,83 +721,83 @@
|
|
|
721
721
|
if_block2 = null;
|
|
722
722
|
}
|
|
723
723
|
|
|
724
|
-
if (!current || dirty[0] & /*cpx*/
|
|
724
|
+
if (!current || dirty[0] & /*cpx*/ 128 && rect_x_value !== (rect_x_value = /*cpx*/ ctx[7][0])) {
|
|
725
725
|
attr(rect, "x", rect_x_value);
|
|
726
726
|
}
|
|
727
727
|
|
|
728
|
-
if (!current || dirty[0] & /*cpy*/
|
|
728
|
+
if (!current || dirty[0] & /*cpy*/ 64 && rect_y_value !== (rect_y_value = /*cpy*/ ctx[6][1])) {
|
|
729
729
|
attr(rect, "y", rect_y_value);
|
|
730
730
|
}
|
|
731
731
|
|
|
732
|
-
if (!current || dirty[0] & /*cpx*/
|
|
732
|
+
if (!current || dirty[0] & /*cpx*/ 128 && rect_width_value !== (rect_width_value = /*cpx*/ ctx[7][1] - /*cpx*/ ctx[7][0])) {
|
|
733
733
|
attr(rect, "width", rect_width_value);
|
|
734
734
|
}
|
|
735
735
|
|
|
736
|
-
if (!current || dirty[0] & /*cpy*/
|
|
736
|
+
if (!current || dirty[0] & /*cpy*/ 64 && rect_height_value !== (rect_height_value = /*cpy*/ ctx[6][0] - /*cpy*/ ctx[6][1])) {
|
|
737
737
|
attr(rect, "height", rect_height_value);
|
|
738
738
|
}
|
|
739
739
|
|
|
740
740
|
if (xaxis_slot) {
|
|
741
|
-
if (xaxis_slot.p && (!current || dirty[0] & /*$$scope*/
|
|
741
|
+
if (xaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
|
|
742
742
|
update_slot_base(
|
|
743
743
|
xaxis_slot,
|
|
744
744
|
xaxis_slot_template,
|
|
745
745
|
ctx,
|
|
746
|
-
/*$$scope*/ ctx[
|
|
746
|
+
/*$$scope*/ ctx[24],
|
|
747
747
|
!current
|
|
748
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[
|
|
749
|
-
: get_slot_changes(xaxis_slot_template, /*$$scope*/ ctx[
|
|
748
|
+
? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
|
|
749
|
+
: get_slot_changes(xaxis_slot_template, /*$$scope*/ ctx[24], dirty, get_xaxis_slot_changes),
|
|
750
750
|
get_xaxis_slot_context
|
|
751
751
|
);
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
754
|
|
|
755
755
|
if (yaxis_slot) {
|
|
756
|
-
if (yaxis_slot.p && (!current || dirty[0] & /*$$scope*/
|
|
756
|
+
if (yaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
|
|
757
757
|
update_slot_base(
|
|
758
758
|
yaxis_slot,
|
|
759
759
|
yaxis_slot_template,
|
|
760
760
|
ctx,
|
|
761
|
-
/*$$scope*/ ctx[
|
|
761
|
+
/*$$scope*/ ctx[24],
|
|
762
762
|
!current
|
|
763
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[
|
|
764
|
-
: get_slot_changes(yaxis_slot_template, /*$$scope*/ ctx[
|
|
763
|
+
? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
|
|
764
|
+
: get_slot_changes(yaxis_slot_template, /*$$scope*/ ctx[24], dirty, get_yaxis_slot_changes),
|
|
765
765
|
get_yaxis_slot_context
|
|
766
766
|
);
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
769
|
|
|
770
770
|
if (default_slot) {
|
|
771
|
-
if (default_slot.p && (!current || dirty[0] & /*$$scope*/
|
|
771
|
+
if (default_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
|
|
772
772
|
update_slot_base(
|
|
773
773
|
default_slot,
|
|
774
774
|
default_slot_template,
|
|
775
775
|
ctx,
|
|
776
|
-
/*$$scope*/ ctx[
|
|
776
|
+
/*$$scope*/ ctx[24],
|
|
777
777
|
!current
|
|
778
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[
|
|
779
|
-
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[
|
|
778
|
+
? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
|
|
779
|
+
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[24], dirty, null),
|
|
780
780
|
null
|
|
781
781
|
);
|
|
782
782
|
}
|
|
783
783
|
}
|
|
784
784
|
|
|
785
785
|
if (box_slot) {
|
|
786
|
-
if (box_slot.p && (!current || dirty[0] & /*$$scope*/
|
|
786
|
+
if (box_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
|
|
787
787
|
update_slot_base(
|
|
788
788
|
box_slot,
|
|
789
789
|
box_slot_template,
|
|
790
790
|
ctx,
|
|
791
|
-
/*$$scope*/ ctx[
|
|
791
|
+
/*$$scope*/ ctx[24],
|
|
792
792
|
!current
|
|
793
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[
|
|
794
|
-
: get_slot_changes(box_slot_template, /*$$scope*/ ctx[
|
|
793
|
+
? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
|
|
794
|
+
: get_slot_changes(box_slot_template, /*$$scope*/ ctx[24], dirty, get_box_slot_changes),
|
|
795
795
|
get_box_slot_context
|
|
796
796
|
);
|
|
797
797
|
}
|
|
798
798
|
}
|
|
799
799
|
|
|
800
|
-
if (!/*$isOk*/ ctx[
|
|
800
|
+
if (!/*$isOk*/ ctx[3]) {
|
|
801
801
|
if (if_block3) ; else {
|
|
802
802
|
if_block3 = create_if_block$9();
|
|
803
803
|
if_block3.c();
|
|
@@ -808,12 +808,12 @@
|
|
|
808
808
|
if_block3 = null;
|
|
809
809
|
}
|
|
810
810
|
|
|
811
|
-
if (!current || dirty[0] & /*$scale*/
|
|
811
|
+
if (!current || dirty[0] & /*$scale*/ 16 && div1_class_value !== (div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]))) {
|
|
812
812
|
attr(div1, "class", div1_class_value);
|
|
813
813
|
}
|
|
814
814
|
|
|
815
|
-
if (dirty[0] & /*$scale, $isOk*/
|
|
816
|
-
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[
|
|
815
|
+
if (dirty[0] & /*$scale, $isOk*/ 24) {
|
|
816
|
+
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[3]);
|
|
817
817
|
}
|
|
818
818
|
},
|
|
819
819
|
i(local) {
|
|
@@ -840,7 +840,7 @@
|
|
|
840
840
|
if (yaxis_slot) yaxis_slot.d(detaching);
|
|
841
841
|
if (default_slot) default_slot.d(detaching);
|
|
842
842
|
if (box_slot) box_slot.d(detaching);
|
|
843
|
-
/*div0_binding*/ ctx[
|
|
843
|
+
/*div0_binding*/ ctx[26](null);
|
|
844
844
|
if (if_block3) if_block3.d();
|
|
845
845
|
}
|
|
846
846
|
};
|
|
@@ -917,17 +917,17 @@
|
|
|
917
917
|
/* reactive parameters to be shared with children via context */
|
|
918
918
|
const width = writable(100); // actual width of plotting area in pixels
|
|
919
919
|
|
|
920
|
-
component_subscribe($$self, width, value => $$invalidate(
|
|
920
|
+
component_subscribe($$self, width, value => $$invalidate(22, $width = value));
|
|
921
921
|
const height = writable(100); // actual height of plotting area in pixels
|
|
922
|
-
component_subscribe($$self, height, value => $$invalidate(
|
|
922
|
+
component_subscribe($$self, height, value => $$invalidate(20, $height = value));
|
|
923
923
|
const xLim = writable([undefined, undefined]); // actual limits for x-axis in plot units
|
|
924
|
-
component_subscribe($$self, xLim, value => $$invalidate(
|
|
924
|
+
component_subscribe($$self, xLim, value => $$invalidate(23, $xLim = value));
|
|
925
925
|
const yLim = writable([undefined, undefined]); // actual limits for y-axis in plot units
|
|
926
|
-
component_subscribe($$self, yLim, value => $$invalidate(
|
|
926
|
+
component_subscribe($$self, yLim, value => $$invalidate(21, $yLim = value));
|
|
927
927
|
const scale = writable("medium"); // scale factor (how big the shown plot is)
|
|
928
|
-
component_subscribe($$self, scale, value => $$invalidate(
|
|
928
|
+
component_subscribe($$self, scale, value => $$invalidate(4, $scale = value));
|
|
929
929
|
const isOk = writable(false); // are axes ready for drawing
|
|
930
|
-
component_subscribe($$self, isOk, value => $$invalidate(
|
|
930
|
+
component_subscribe($$self, isOk, value => $$invalidate(3, $isOk = value));
|
|
931
931
|
|
|
932
932
|
/** Adds margins for x-axis (e.g. when x-axis must be shown) */
|
|
933
933
|
const addXAxisMargins = function () {
|
|
@@ -1108,7 +1108,7 @@
|
|
|
1108
1108
|
function div0_binding($$value) {
|
|
1109
1109
|
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
1110
1110
|
axesWrapper = $$value;
|
|
1111
|
-
$$invalidate(
|
|
1111
|
+
$$invalidate(5, axesWrapper);
|
|
1112
1112
|
});
|
|
1113
1113
|
}
|
|
1114
1114
|
|
|
@@ -1119,7 +1119,7 @@
|
|
|
1119
1119
|
if ('xLabel' in $$props) $$invalidate(1, xLabel = $$props.xLabel);
|
|
1120
1120
|
if ('yLabel' in $$props) $$invalidate(2, yLabel = $$props.yLabel);
|
|
1121
1121
|
if ('multiSeries' in $$props) $$invalidate(17, multiSeries = $$props.multiSeries);
|
|
1122
|
-
if ('$$scope' in $$props) $$invalidate(
|
|
1122
|
+
if ('$$scope' in $$props) $$invalidate(24, $$scope = $$props.$$scope);
|
|
1123
1123
|
};
|
|
1124
1124
|
|
|
1125
1125
|
$$self.$$.update = () => {
|
|
@@ -1132,24 +1132,24 @@
|
|
|
1132
1132
|
if (!limY.some(v => v === undefined)) yLim.update(v => limY);
|
|
1133
1133
|
}
|
|
1134
1134
|
|
|
1135
|
-
if ($$self.$$.dirty[0] & /*axesMargins, $scale*/
|
|
1135
|
+
if ($$self.$$.dirty[0] & /*axesMargins, $scale*/ 262160) {
|
|
1136
1136
|
// computes real margins in pixels based on current scale
|
|
1137
|
-
margins = axesMargins.map(v => v * AXES_MARGIN_FACTORS[$scale]);
|
|
1137
|
+
$$invalidate(19, margins = axesMargins.map(v => v * AXES_MARGIN_FACTORS[$scale]));
|
|
1138
1138
|
}
|
|
1139
1139
|
|
|
1140
|
-
if ($$self.$$.dirty[0] & /*$
|
|
1141
|
-
|
|
1140
|
+
if ($$self.$$.dirty[0] & /*$yLim, $xLim, $width, margins, $height*/ 16252928) {
|
|
1141
|
+
// computes status which tells that axes limits look fine and it is safe to draw
|
|
1142
|
+
// the status is based on the axis limits validity
|
|
1143
|
+
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]);
|
|
1142
1144
|
}
|
|
1143
1145
|
|
|
1144
|
-
if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/
|
|
1146
|
+
if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/ 12582920) {
|
|
1145
1147
|
// computes coordinates for clip path box
|
|
1146
|
-
$$invalidate(
|
|
1148
|
+
$$invalidate(7, cpx = $isOk ? scaleX($xLim, $xLim, $width) : [0, 1]);
|
|
1147
1149
|
}
|
|
1148
1150
|
|
|
1149
|
-
if ($$self.$$.dirty[0] & /*$
|
|
1150
|
-
|
|
1151
|
-
// the status is based on the axis limits validity
|
|
1152
|
-
isOk.update(v => Array.isArray($yLim) && Array.isArray($xLim) && $xLim.length === 2 && $yLim.length === 2 && !$yLim.some(v => v === undefined) && !$xLim.some(v => v === undefined) && !$yLim.some(v => isNaN(v)) && !$xLim.some(v => isNaN(v)) && $xLim[1] !== $xLim[0] && $yLim[1] !== $yLim[0] && cpy[0] > cpy[1] && cpx[1] > cpx[0]);
|
|
1151
|
+
if ($$self.$$.dirty[0] & /*$isOk, $yLim, $height*/ 3145736) {
|
|
1152
|
+
$$invalidate(6, cpy = $isOk ? scaleY($yLim, $yLim, $height) : [1, 0]);
|
|
1153
1153
|
}
|
|
1154
1154
|
};
|
|
1155
1155
|
|
|
@@ -1157,11 +1157,11 @@
|
|
|
1157
1157
|
title,
|
|
1158
1158
|
xLabel,
|
|
1159
1159
|
yLabel,
|
|
1160
|
-
cpy,
|
|
1161
|
-
cpx,
|
|
1162
1160
|
$isOk,
|
|
1163
1161
|
$scale,
|
|
1164
1162
|
axesWrapper,
|
|
1163
|
+
cpy,
|
|
1164
|
+
cpx,
|
|
1165
1165
|
clipPathID,
|
|
1166
1166
|
width,
|
|
1167
1167
|
height,
|
|
@@ -1173,6 +1173,7 @@
|
|
|
1173
1173
|
limY,
|
|
1174
1174
|
multiSeries,
|
|
1175
1175
|
axesMargins,
|
|
1176
|
+
margins,
|
|
1176
1177
|
$height,
|
|
1177
1178
|
$yLim,
|
|
1178
1179
|
$width,
|
package/dist/index.mjs
CHANGED
|
@@ -595,15 +595,15 @@ function create_fragment$b(ctx) {
|
|
|
595
595
|
let if_block0 = /*title*/ ctx[0] !== "" && create_if_block_3(ctx);
|
|
596
596
|
let if_block1 = /*yLabel*/ ctx[2] !== "" && create_if_block_2(ctx);
|
|
597
597
|
let if_block2 = /*xLabel*/ ctx[1] !== "" && create_if_block_1(ctx);
|
|
598
|
-
const xaxis_slot_template = /*#slots*/ ctx[
|
|
599
|
-
const xaxis_slot = create_slot(xaxis_slot_template, ctx, /*$$scope*/ ctx[
|
|
600
|
-
const yaxis_slot_template = /*#slots*/ ctx[
|
|
601
|
-
const yaxis_slot = create_slot(yaxis_slot_template, ctx, /*$$scope*/ ctx[
|
|
602
|
-
const default_slot_template = /*#slots*/ ctx[
|
|
603
|
-
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[
|
|
604
|
-
const box_slot_template = /*#slots*/ ctx[
|
|
605
|
-
const box_slot = create_slot(box_slot_template, ctx, /*$$scope*/ ctx[
|
|
606
|
-
let if_block3 = !/*$isOk*/ ctx[
|
|
598
|
+
const xaxis_slot_template = /*#slots*/ ctx[25].xaxis;
|
|
599
|
+
const xaxis_slot = create_slot(xaxis_slot_template, ctx, /*$$scope*/ ctx[24], get_xaxis_slot_context);
|
|
600
|
+
const yaxis_slot_template = /*#slots*/ ctx[25].yaxis;
|
|
601
|
+
const yaxis_slot = create_slot(yaxis_slot_template, ctx, /*$$scope*/ ctx[24], get_yaxis_slot_context);
|
|
602
|
+
const default_slot_template = /*#slots*/ ctx[25].default;
|
|
603
|
+
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[24], null);
|
|
604
|
+
const box_slot_template = /*#slots*/ ctx[25].box;
|
|
605
|
+
const box_slot = create_slot(box_slot_template, ctx, /*$$scope*/ ctx[24], get_box_slot_context);
|
|
606
|
+
let if_block3 = !/*$isOk*/ ctx[3] && create_if_block$9();
|
|
607
607
|
|
|
608
608
|
return {
|
|
609
609
|
c() {
|
|
@@ -626,17 +626,17 @@ function create_fragment$b(ctx) {
|
|
|
626
626
|
if (box_slot) box_slot.c();
|
|
627
627
|
t3 = space();
|
|
628
628
|
if (if_block3) if_block3.c();
|
|
629
|
-
attr(rect, "x", rect_x_value = /*cpx*/ ctx[
|
|
630
|
-
attr(rect, "y", rect_y_value = /*cpy*/ ctx[
|
|
631
|
-
attr(rect, "width", rect_width_value = /*cpx*/ ctx[
|
|
632
|
-
attr(rect, "height", rect_height_value = /*cpy*/ ctx[
|
|
629
|
+
attr(rect, "x", rect_x_value = /*cpx*/ ctx[7][0]);
|
|
630
|
+
attr(rect, "y", rect_y_value = /*cpy*/ ctx[6][1]);
|
|
631
|
+
attr(rect, "width", rect_width_value = /*cpx*/ ctx[7][1] - /*cpx*/ ctx[7][0]);
|
|
632
|
+
attr(rect, "height", rect_height_value = /*cpy*/ ctx[6][0] - /*cpy*/ ctx[6][1]);
|
|
633
633
|
attr(clipPath, "id", /*clipPathID*/ ctx[8]);
|
|
634
634
|
attr(g, "clip-path", "url(#" + /*clipPathID*/ ctx[8] + ")");
|
|
635
635
|
attr(svg, "preserveAspectRatio", "none");
|
|
636
636
|
attr(svg, "class", "axes");
|
|
637
637
|
attr(div0, "class", "axes-wrapper");
|
|
638
|
-
attr(div1, "class", div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[
|
|
639
|
-
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[
|
|
638
|
+
attr(div1, "class", div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]));
|
|
639
|
+
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[3]);
|
|
640
640
|
},
|
|
641
641
|
m(target, anchor) {
|
|
642
642
|
insert(target, div1, anchor);
|
|
@@ -670,7 +670,7 @@ function create_fragment$b(ctx) {
|
|
|
670
670
|
box_slot.m(svg, null);
|
|
671
671
|
}
|
|
672
672
|
|
|
673
|
-
/*div0_binding*/ ctx[
|
|
673
|
+
/*div0_binding*/ ctx[26](div0);
|
|
674
674
|
append(div1, t3);
|
|
675
675
|
if (if_block3) if_block3.m(div1, null);
|
|
676
676
|
current = true;
|
|
@@ -715,83 +715,83 @@ function create_fragment$b(ctx) {
|
|
|
715
715
|
if_block2 = null;
|
|
716
716
|
}
|
|
717
717
|
|
|
718
|
-
if (!current || dirty[0] & /*cpx*/
|
|
718
|
+
if (!current || dirty[0] & /*cpx*/ 128 && rect_x_value !== (rect_x_value = /*cpx*/ ctx[7][0])) {
|
|
719
719
|
attr(rect, "x", rect_x_value);
|
|
720
720
|
}
|
|
721
721
|
|
|
722
|
-
if (!current || dirty[0] & /*cpy*/
|
|
722
|
+
if (!current || dirty[0] & /*cpy*/ 64 && rect_y_value !== (rect_y_value = /*cpy*/ ctx[6][1])) {
|
|
723
723
|
attr(rect, "y", rect_y_value);
|
|
724
724
|
}
|
|
725
725
|
|
|
726
|
-
if (!current || dirty[0] & /*cpx*/
|
|
726
|
+
if (!current || dirty[0] & /*cpx*/ 128 && rect_width_value !== (rect_width_value = /*cpx*/ ctx[7][1] - /*cpx*/ ctx[7][0])) {
|
|
727
727
|
attr(rect, "width", rect_width_value);
|
|
728
728
|
}
|
|
729
729
|
|
|
730
|
-
if (!current || dirty[0] & /*cpy*/
|
|
730
|
+
if (!current || dirty[0] & /*cpy*/ 64 && rect_height_value !== (rect_height_value = /*cpy*/ ctx[6][0] - /*cpy*/ ctx[6][1])) {
|
|
731
731
|
attr(rect, "height", rect_height_value);
|
|
732
732
|
}
|
|
733
733
|
|
|
734
734
|
if (xaxis_slot) {
|
|
735
|
-
if (xaxis_slot.p && (!current || dirty[0] & /*$$scope*/
|
|
735
|
+
if (xaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
|
|
736
736
|
update_slot_base(
|
|
737
737
|
xaxis_slot,
|
|
738
738
|
xaxis_slot_template,
|
|
739
739
|
ctx,
|
|
740
|
-
/*$$scope*/ ctx[
|
|
740
|
+
/*$$scope*/ ctx[24],
|
|
741
741
|
!current
|
|
742
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[
|
|
743
|
-
: get_slot_changes(xaxis_slot_template, /*$$scope*/ ctx[
|
|
742
|
+
? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
|
|
743
|
+
: get_slot_changes(xaxis_slot_template, /*$$scope*/ ctx[24], dirty, get_xaxis_slot_changes),
|
|
744
744
|
get_xaxis_slot_context
|
|
745
745
|
);
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
748
|
|
|
749
749
|
if (yaxis_slot) {
|
|
750
|
-
if (yaxis_slot.p && (!current || dirty[0] & /*$$scope*/
|
|
750
|
+
if (yaxis_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
|
|
751
751
|
update_slot_base(
|
|
752
752
|
yaxis_slot,
|
|
753
753
|
yaxis_slot_template,
|
|
754
754
|
ctx,
|
|
755
|
-
/*$$scope*/ ctx[
|
|
755
|
+
/*$$scope*/ ctx[24],
|
|
756
756
|
!current
|
|
757
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[
|
|
758
|
-
: get_slot_changes(yaxis_slot_template, /*$$scope*/ ctx[
|
|
757
|
+
? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
|
|
758
|
+
: get_slot_changes(yaxis_slot_template, /*$$scope*/ ctx[24], dirty, get_yaxis_slot_changes),
|
|
759
759
|
get_yaxis_slot_context
|
|
760
760
|
);
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
|
|
764
764
|
if (default_slot) {
|
|
765
|
-
if (default_slot.p && (!current || dirty[0] & /*$$scope*/
|
|
765
|
+
if (default_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
|
|
766
766
|
update_slot_base(
|
|
767
767
|
default_slot,
|
|
768
768
|
default_slot_template,
|
|
769
769
|
ctx,
|
|
770
|
-
/*$$scope*/ ctx[
|
|
770
|
+
/*$$scope*/ ctx[24],
|
|
771
771
|
!current
|
|
772
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[
|
|
773
|
-
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[
|
|
772
|
+
? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
|
|
773
|
+
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[24], dirty, null),
|
|
774
774
|
null
|
|
775
775
|
);
|
|
776
776
|
}
|
|
777
777
|
}
|
|
778
778
|
|
|
779
779
|
if (box_slot) {
|
|
780
|
-
if (box_slot.p && (!current || dirty[0] & /*$$scope*/
|
|
780
|
+
if (box_slot.p && (!current || dirty[0] & /*$$scope*/ 16777216)) {
|
|
781
781
|
update_slot_base(
|
|
782
782
|
box_slot,
|
|
783
783
|
box_slot_template,
|
|
784
784
|
ctx,
|
|
785
|
-
/*$$scope*/ ctx[
|
|
785
|
+
/*$$scope*/ ctx[24],
|
|
786
786
|
!current
|
|
787
|
-
? get_all_dirty_from_scope(/*$$scope*/ ctx[
|
|
788
|
-
: get_slot_changes(box_slot_template, /*$$scope*/ ctx[
|
|
787
|
+
? get_all_dirty_from_scope(/*$$scope*/ ctx[24])
|
|
788
|
+
: get_slot_changes(box_slot_template, /*$$scope*/ ctx[24], dirty, get_box_slot_changes),
|
|
789
789
|
get_box_slot_context
|
|
790
790
|
);
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
793
|
|
|
794
|
-
if (!/*$isOk*/ ctx[
|
|
794
|
+
if (!/*$isOk*/ ctx[3]) {
|
|
795
795
|
if (if_block3) ; else {
|
|
796
796
|
if_block3 = create_if_block$9();
|
|
797
797
|
if_block3.c();
|
|
@@ -802,12 +802,12 @@ function create_fragment$b(ctx) {
|
|
|
802
802
|
if_block3 = null;
|
|
803
803
|
}
|
|
804
804
|
|
|
805
|
-
if (!current || dirty[0] & /*$scale*/
|
|
805
|
+
if (!current || dirty[0] & /*$scale*/ 16 && div1_class_value !== (div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]))) {
|
|
806
806
|
attr(div1, "class", div1_class_value);
|
|
807
807
|
}
|
|
808
808
|
|
|
809
|
-
if (dirty[0] & /*$scale, $isOk*/
|
|
810
|
-
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[
|
|
809
|
+
if (dirty[0] & /*$scale, $isOk*/ 24) {
|
|
810
|
+
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[3]);
|
|
811
811
|
}
|
|
812
812
|
},
|
|
813
813
|
i(local) {
|
|
@@ -834,7 +834,7 @@ function create_fragment$b(ctx) {
|
|
|
834
834
|
if (yaxis_slot) yaxis_slot.d(detaching);
|
|
835
835
|
if (default_slot) default_slot.d(detaching);
|
|
836
836
|
if (box_slot) box_slot.d(detaching);
|
|
837
|
-
/*div0_binding*/ ctx[
|
|
837
|
+
/*div0_binding*/ ctx[26](null);
|
|
838
838
|
if (if_block3) if_block3.d();
|
|
839
839
|
}
|
|
840
840
|
};
|
|
@@ -911,17 +911,17 @@ function instance$b($$self, $$props, $$invalidate) {
|
|
|
911
911
|
/* reactive parameters to be shared with children via context */
|
|
912
912
|
const width = writable(100); // actual width of plotting area in pixels
|
|
913
913
|
|
|
914
|
-
component_subscribe($$self, width, value => $$invalidate(
|
|
914
|
+
component_subscribe($$self, width, value => $$invalidate(22, $width = value));
|
|
915
915
|
const height = writable(100); // actual height of plotting area in pixels
|
|
916
|
-
component_subscribe($$self, height, value => $$invalidate(
|
|
916
|
+
component_subscribe($$self, height, value => $$invalidate(20, $height = value));
|
|
917
917
|
const xLim = writable([undefined, undefined]); // actual limits for x-axis in plot units
|
|
918
|
-
component_subscribe($$self, xLim, value => $$invalidate(
|
|
918
|
+
component_subscribe($$self, xLim, value => $$invalidate(23, $xLim = value));
|
|
919
919
|
const yLim = writable([undefined, undefined]); // actual limits for y-axis in plot units
|
|
920
|
-
component_subscribe($$self, yLim, value => $$invalidate(
|
|
920
|
+
component_subscribe($$self, yLim, value => $$invalidate(21, $yLim = value));
|
|
921
921
|
const scale = writable("medium"); // scale factor (how big the shown plot is)
|
|
922
|
-
component_subscribe($$self, scale, value => $$invalidate(
|
|
922
|
+
component_subscribe($$self, scale, value => $$invalidate(4, $scale = value));
|
|
923
923
|
const isOk = writable(false); // are axes ready for drawing
|
|
924
|
-
component_subscribe($$self, isOk, value => $$invalidate(
|
|
924
|
+
component_subscribe($$self, isOk, value => $$invalidate(3, $isOk = value));
|
|
925
925
|
|
|
926
926
|
/** Adds margins for x-axis (e.g. when x-axis must be shown) */
|
|
927
927
|
const addXAxisMargins = function () {
|
|
@@ -1102,7 +1102,7 @@ function instance$b($$self, $$props, $$invalidate) {
|
|
|
1102
1102
|
function div0_binding($$value) {
|
|
1103
1103
|
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
1104
1104
|
axesWrapper = $$value;
|
|
1105
|
-
$$invalidate(
|
|
1105
|
+
$$invalidate(5, axesWrapper);
|
|
1106
1106
|
});
|
|
1107
1107
|
}
|
|
1108
1108
|
|
|
@@ -1113,7 +1113,7 @@ function instance$b($$self, $$props, $$invalidate) {
|
|
|
1113
1113
|
if ('xLabel' in $$props) $$invalidate(1, xLabel = $$props.xLabel);
|
|
1114
1114
|
if ('yLabel' in $$props) $$invalidate(2, yLabel = $$props.yLabel);
|
|
1115
1115
|
if ('multiSeries' in $$props) $$invalidate(17, multiSeries = $$props.multiSeries);
|
|
1116
|
-
if ('$$scope' in $$props) $$invalidate(
|
|
1116
|
+
if ('$$scope' in $$props) $$invalidate(24, $$scope = $$props.$$scope);
|
|
1117
1117
|
};
|
|
1118
1118
|
|
|
1119
1119
|
$$self.$$.update = () => {
|
|
@@ -1126,24 +1126,24 @@ function instance$b($$self, $$props, $$invalidate) {
|
|
|
1126
1126
|
if (!limY.some(v => v === undefined)) yLim.update(v => limY);
|
|
1127
1127
|
}
|
|
1128
1128
|
|
|
1129
|
-
if ($$self.$$.dirty[0] & /*axesMargins, $scale*/
|
|
1129
|
+
if ($$self.$$.dirty[0] & /*axesMargins, $scale*/ 262160) {
|
|
1130
1130
|
// computes real margins in pixels based on current scale
|
|
1131
|
-
margins = axesMargins.map(v => v * AXES_MARGIN_FACTORS[$scale]);
|
|
1131
|
+
$$invalidate(19, margins = axesMargins.map(v => v * AXES_MARGIN_FACTORS[$scale]));
|
|
1132
1132
|
}
|
|
1133
1133
|
|
|
1134
|
-
if ($$self.$$.dirty[0] & /*$
|
|
1135
|
-
|
|
1134
|
+
if ($$self.$$.dirty[0] & /*$yLim, $xLim, $width, margins, $height*/ 16252928) {
|
|
1135
|
+
// computes status which tells that axes limits look fine and it is safe to draw
|
|
1136
|
+
// the status is based on the axis limits validity
|
|
1137
|
+
isOk.update(v => Array.isArray($yLim) && Array.isArray($xLim) && $xLim.length === 2 && $yLim.length === 2 && !$yLim.some(v => v === undefined) && !$xLim.some(v => v === undefined) && !$yLim.some(v => isNaN(v)) && !$xLim.some(v => isNaN(v)) && $xLim[1] !== $xLim[0] && $yLim[1] !== $yLim[0] && $width > margins[1] + margins[3] && $height > margins[0] + margins[2]);
|
|
1136
1138
|
}
|
|
1137
1139
|
|
|
1138
|
-
if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/
|
|
1140
|
+
if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/ 12582920) {
|
|
1139
1141
|
// computes coordinates for clip path box
|
|
1140
|
-
$$invalidate(
|
|
1142
|
+
$$invalidate(7, cpx = $isOk ? scaleX($xLim, $xLim, $width) : [0, 1]);
|
|
1141
1143
|
}
|
|
1142
1144
|
|
|
1143
|
-
if ($$self.$$.dirty[0] & /*$
|
|
1144
|
-
|
|
1145
|
-
// the status is based on the axis limits validity
|
|
1146
|
-
isOk.update(v => Array.isArray($yLim) && Array.isArray($xLim) && $xLim.length === 2 && $yLim.length === 2 && !$yLim.some(v => v === undefined) && !$xLim.some(v => v === undefined) && !$yLim.some(v => isNaN(v)) && !$xLim.some(v => isNaN(v)) && $xLim[1] !== $xLim[0] && $yLim[1] !== $yLim[0] && cpy[0] > cpy[1] && cpx[1] > cpx[0]);
|
|
1145
|
+
if ($$self.$$.dirty[0] & /*$isOk, $yLim, $height*/ 3145736) {
|
|
1146
|
+
$$invalidate(6, cpy = $isOk ? scaleY($yLim, $yLim, $height) : [1, 0]);
|
|
1147
1147
|
}
|
|
1148
1148
|
};
|
|
1149
1149
|
|
|
@@ -1151,11 +1151,11 @@ function instance$b($$self, $$props, $$invalidate) {
|
|
|
1151
1151
|
title,
|
|
1152
1152
|
xLabel,
|
|
1153
1153
|
yLabel,
|
|
1154
|
-
cpy,
|
|
1155
|
-
cpx,
|
|
1156
1154
|
$isOk,
|
|
1157
1155
|
$scale,
|
|
1158
1156
|
axesWrapper,
|
|
1157
|
+
cpy,
|
|
1158
|
+
cpx,
|
|
1159
1159
|
clipPathID,
|
|
1160
1160
|
width,
|
|
1161
1161
|
height,
|
|
@@ -1167,6 +1167,7 @@ function instance$b($$self, $$props, $$invalidate) {
|
|
|
1167
1167
|
limY,
|
|
1168
1168
|
multiSeries,
|
|
1169
1169
|
axesMargins,
|
|
1170
|
+
margins,
|
|
1170
1171
|
$height,
|
|
1171
1172
|
$yLim,
|
|
1172
1173
|
$width,
|
package/package.json
CHANGED
package/src/Axes.svelte
CHANGED
|
@@ -297,8 +297,8 @@
|
|
|
297
297
|
!$xLim.some(v => isNaN(v)) &&
|
|
298
298
|
$xLim[1] !== $xLim[0] &&
|
|
299
299
|
$yLim[1] !== $yLim[0] &&
|
|
300
|
-
|
|
301
|
-
|
|
300
|
+
$width > (margins[1] + margins[3]) &&
|
|
301
|
+
$height > (margins[0] + margins[2])
|
|
302
302
|
)
|
|
303
303
|
|
|
304
304
|
// computes coordinates for clip path box
|