svelte-plots-basic 1.0.0 → 1.0.1
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/README.md +1 -1
- package/dist/index.js +33 -33
- package/dist/index.mjs +33 -33
- package/package.json +1 -1
- package/src/Axes.svelte +3 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Description
|
|
4
4
|
|
|
5
|
-
`svelte-plots-basic` is a [Svelte](https://svelte.dev) component library for creating very simple 2D plots/charts. It is currently under active development and breaking changes may occur. In its current state (v. 0.1.
|
|
5
|
+
`svelte-plots-basic` is a [Svelte](https://svelte.dev) component library for creating very simple 2D plots/charts. It is currently under active development and breaking changes may occur. In its current state (v. 0.1.1) it allows to create bar, scatter, area and line charts as well as any combination of the four. The charts are created using [SVG](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics) and are re-scalable.
|
|
6
6
|
|
|
7
7
|
The description is not complete yet and will be updated during February-March of 2022.
|
|
8
8
|
|
package/dist/index.js
CHANGED
|
@@ -489,7 +489,7 @@
|
|
|
489
489
|
const get_xaxis_slot_changes = dirty => ({});
|
|
490
490
|
const get_xaxis_slot_context = ctx => ({});
|
|
491
491
|
|
|
492
|
-
// (
|
|
492
|
+
// (313:3) {#if title !== ""}
|
|
493
493
|
function create_if_block_3(ctx) {
|
|
494
494
|
let div;
|
|
495
495
|
|
|
@@ -510,7 +510,7 @@
|
|
|
510
510
|
};
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
-
// (
|
|
513
|
+
// (314:3) {#if yLabel !== ""}
|
|
514
514
|
function create_if_block_2(ctx) {
|
|
515
515
|
let div;
|
|
516
516
|
let span;
|
|
@@ -534,7 +534,7 @@
|
|
|
534
534
|
};
|
|
535
535
|
}
|
|
536
536
|
|
|
537
|
-
// (
|
|
537
|
+
// (315:3) {#if xLabel !== ""}
|
|
538
538
|
function create_if_block_1(ctx) {
|
|
539
539
|
let div;
|
|
540
540
|
let span;
|
|
@@ -558,7 +558,7 @@
|
|
|
558
558
|
};
|
|
559
559
|
}
|
|
560
560
|
|
|
561
|
-
// (
|
|
561
|
+
// (343:3) {#if !$isOk}
|
|
562
562
|
function create_if_block$9(ctx) {
|
|
563
563
|
let p;
|
|
564
564
|
|
|
@@ -609,7 +609,7 @@
|
|
|
609
609
|
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[23], null);
|
|
610
610
|
const box_slot_template = /*#slots*/ ctx[24].box;
|
|
611
611
|
const box_slot = create_slot(box_slot_template, ctx, /*$$scope*/ ctx[23], get_box_slot_context);
|
|
612
|
-
let if_block3 = !/*$isOk*/ ctx[
|
|
612
|
+
let if_block3 = !/*$isOk*/ ctx[5] && 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[4][0]);
|
|
636
|
+
attr(rect, "y", rect_y_value = /*cpy*/ ctx[3][1]);
|
|
637
|
+
attr(rect, "width", rect_width_value = /*cpx*/ ctx[4][1] - /*cpx*/ ctx[4][0]);
|
|
638
|
+
attr(rect, "height", rect_height_value = /*cpy*/ ctx[3][0] - /*cpy*/ ctx[3][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[6]));
|
|
645
|
+
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[5]);
|
|
646
646
|
},
|
|
647
647
|
m(target, anchor) {
|
|
648
648
|
insert(target, div1, anchor);
|
|
@@ -721,19 +721,19 @@
|
|
|
721
721
|
if_block2 = null;
|
|
722
722
|
}
|
|
723
723
|
|
|
724
|
-
if (!current || dirty[0] & /*cpx*/
|
|
724
|
+
if (!current || dirty[0] & /*cpx*/ 16 && rect_x_value !== (rect_x_value = /*cpx*/ ctx[4][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*/ 8 && rect_y_value !== (rect_y_value = /*cpy*/ ctx[3][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*/ 16 && rect_width_value !== (rect_width_value = /*cpx*/ ctx[4][1] - /*cpx*/ ctx[4][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*/ 8 && rect_height_value !== (rect_height_value = /*cpy*/ ctx[3][0] - /*cpy*/ ctx[3][1])) {
|
|
737
737
|
attr(rect, "height", rect_height_value);
|
|
738
738
|
}
|
|
739
739
|
|
|
@@ -797,7 +797,7 @@
|
|
|
797
797
|
}
|
|
798
798
|
}
|
|
799
799
|
|
|
800
|
-
if (!/*$isOk*/ ctx[
|
|
800
|
+
if (!/*$isOk*/ ctx[5]) {
|
|
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*/ 64 && div1_class_value !== (div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[6]))) {
|
|
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*/ 96) {
|
|
816
|
+
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[5]);
|
|
817
817
|
}
|
|
818
818
|
},
|
|
819
819
|
i(local) {
|
|
@@ -925,9 +925,9 @@
|
|
|
925
925
|
const yLim = writable([undefined, undefined]); // actual limits for y-axis in plot units
|
|
926
926
|
component_subscribe($$self, yLim, value => $$invalidate(20, $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(6, $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(5, $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(7, axesWrapper);
|
|
1112
1112
|
});
|
|
1113
1113
|
}
|
|
1114
1114
|
|
|
@@ -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*/ 262208) {
|
|
1136
1136
|
// computes real margins in pixels based on current scale
|
|
1137
1137
|
margins = axesMargins.map(v => v * AXES_MARGIN_FACTORS[$scale]);
|
|
1138
1138
|
}
|
|
1139
1139
|
|
|
1140
|
-
if ($$self.$$.dirty[0] & /*$yLim, $
|
|
1141
|
-
|
|
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]);
|
|
1140
|
+
if ($$self.$$.dirty[0] & /*$isOk, $yLim, $height*/ 1572896) {
|
|
1141
|
+
$$invalidate(3, cpy = $isOk ? scaleY($yLim, $yLim, $height) : [1, 0]);
|
|
1144
1142
|
}
|
|
1145
1143
|
|
|
1146
|
-
if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/
|
|
1144
|
+
if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/ 6291488) {
|
|
1147
1145
|
// computes coordinates for clip path box
|
|
1148
|
-
$$invalidate(
|
|
1146
|
+
$$invalidate(4, cpx = $isOk ? scaleX($xLim, $xLim, $width) : [0, 1]);
|
|
1149
1147
|
}
|
|
1150
1148
|
|
|
1151
|
-
if ($$self.$$.dirty[0] & /*$
|
|
1152
|
-
|
|
1149
|
+
if ($$self.$$.dirty[0] & /*$yLim, $xLim, cpy, cpx*/ 5242904) {
|
|
1150
|
+
// computes status which tells that axes limits look fine and it is safe to draw
|
|
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]);
|
|
1153
1153
|
}
|
|
1154
1154
|
};
|
|
1155
1155
|
|
|
@@ -1157,11 +1157,11 @@
|
|
|
1157
1157
|
title,
|
|
1158
1158
|
xLabel,
|
|
1159
1159
|
yLabel,
|
|
1160
|
+
cpy,
|
|
1161
|
+
cpx,
|
|
1160
1162
|
$isOk,
|
|
1161
1163
|
$scale,
|
|
1162
1164
|
axesWrapper,
|
|
1163
|
-
cpy,
|
|
1164
|
-
cpx,
|
|
1165
1165
|
clipPathID,
|
|
1166
1166
|
width,
|
|
1167
1167
|
height,
|
package/dist/index.mjs
CHANGED
|
@@ -483,7 +483,7 @@ const get_yaxis_slot_context = ctx => ({});
|
|
|
483
483
|
const get_xaxis_slot_changes = dirty => ({});
|
|
484
484
|
const get_xaxis_slot_context = ctx => ({});
|
|
485
485
|
|
|
486
|
-
// (
|
|
486
|
+
// (313:3) {#if title !== ""}
|
|
487
487
|
function create_if_block_3(ctx) {
|
|
488
488
|
let div;
|
|
489
489
|
|
|
@@ -504,7 +504,7 @@ function create_if_block_3(ctx) {
|
|
|
504
504
|
};
|
|
505
505
|
}
|
|
506
506
|
|
|
507
|
-
// (
|
|
507
|
+
// (314:3) {#if yLabel !== ""}
|
|
508
508
|
function create_if_block_2(ctx) {
|
|
509
509
|
let div;
|
|
510
510
|
let span;
|
|
@@ -528,7 +528,7 @@ function create_if_block_2(ctx) {
|
|
|
528
528
|
};
|
|
529
529
|
}
|
|
530
530
|
|
|
531
|
-
// (
|
|
531
|
+
// (315:3) {#if xLabel !== ""}
|
|
532
532
|
function create_if_block_1(ctx) {
|
|
533
533
|
let div;
|
|
534
534
|
let span;
|
|
@@ -552,7 +552,7 @@ function create_if_block_1(ctx) {
|
|
|
552
552
|
};
|
|
553
553
|
}
|
|
554
554
|
|
|
555
|
-
// (
|
|
555
|
+
// (343:3) {#if !$isOk}
|
|
556
556
|
function create_if_block$9(ctx) {
|
|
557
557
|
let p;
|
|
558
558
|
|
|
@@ -603,7 +603,7 @@ function create_fragment$b(ctx) {
|
|
|
603
603
|
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[23], null);
|
|
604
604
|
const box_slot_template = /*#slots*/ ctx[24].box;
|
|
605
605
|
const box_slot = create_slot(box_slot_template, ctx, /*$$scope*/ ctx[23], get_box_slot_context);
|
|
606
|
-
let if_block3 = !/*$isOk*/ ctx[
|
|
606
|
+
let if_block3 = !/*$isOk*/ ctx[5] && 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[4][0]);
|
|
630
|
+
attr(rect, "y", rect_y_value = /*cpy*/ ctx[3][1]);
|
|
631
|
+
attr(rect, "width", rect_width_value = /*cpx*/ ctx[4][1] - /*cpx*/ ctx[4][0]);
|
|
632
|
+
attr(rect, "height", rect_height_value = /*cpy*/ ctx[3][0] - /*cpy*/ ctx[3][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[6]));
|
|
639
|
+
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[5]);
|
|
640
640
|
},
|
|
641
641
|
m(target, anchor) {
|
|
642
642
|
insert(target, div1, anchor);
|
|
@@ -715,19 +715,19 @@ 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*/ 16 && rect_x_value !== (rect_x_value = /*cpx*/ ctx[4][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*/ 8 && rect_y_value !== (rect_y_value = /*cpy*/ ctx[3][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*/ 16 && rect_width_value !== (rect_width_value = /*cpx*/ ctx[4][1] - /*cpx*/ ctx[4][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*/ 8 && rect_height_value !== (rect_height_value = /*cpy*/ ctx[3][0] - /*cpy*/ ctx[3][1])) {
|
|
731
731
|
attr(rect, "height", rect_height_value);
|
|
732
732
|
}
|
|
733
733
|
|
|
@@ -791,7 +791,7 @@ function create_fragment$b(ctx) {
|
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
793
|
|
|
794
|
-
if (!/*$isOk*/ ctx[
|
|
794
|
+
if (!/*$isOk*/ ctx[5]) {
|
|
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*/ 64 && div1_class_value !== (div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[6]))) {
|
|
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*/ 96) {
|
|
810
|
+
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[5]);
|
|
811
811
|
}
|
|
812
812
|
},
|
|
813
813
|
i(local) {
|
|
@@ -919,9 +919,9 @@ function instance$b($$self, $$props, $$invalidate) {
|
|
|
919
919
|
const yLim = writable([undefined, undefined]); // actual limits for y-axis in plot units
|
|
920
920
|
component_subscribe($$self, yLim, value => $$invalidate(20, $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(6, $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(5, $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(7, axesWrapper);
|
|
1106
1106
|
});
|
|
1107
1107
|
}
|
|
1108
1108
|
|
|
@@ -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*/ 262208) {
|
|
1130
1130
|
// computes real margins in pixels based on current scale
|
|
1131
1131
|
margins = axesMargins.map(v => v * AXES_MARGIN_FACTORS[$scale]);
|
|
1132
1132
|
}
|
|
1133
1133
|
|
|
1134
|
-
if ($$self.$$.dirty[0] & /*$yLim, $
|
|
1135
|
-
|
|
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]);
|
|
1134
|
+
if ($$self.$$.dirty[0] & /*$isOk, $yLim, $height*/ 1572896) {
|
|
1135
|
+
$$invalidate(3, cpy = $isOk ? scaleY($yLim, $yLim, $height) : [1, 0]);
|
|
1138
1136
|
}
|
|
1139
1137
|
|
|
1140
|
-
if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/
|
|
1138
|
+
if ($$self.$$.dirty[0] & /*$isOk, $xLim, $width*/ 6291488) {
|
|
1141
1139
|
// computes coordinates for clip path box
|
|
1142
|
-
$$invalidate(
|
|
1140
|
+
$$invalidate(4, cpx = $isOk ? scaleX($xLim, $xLim, $width) : [0, 1]);
|
|
1143
1141
|
}
|
|
1144
1142
|
|
|
1145
|
-
if ($$self.$$.dirty[0] & /*$
|
|
1146
|
-
|
|
1143
|
+
if ($$self.$$.dirty[0] & /*$yLim, $xLim, cpy, cpx*/ 5242904) {
|
|
1144
|
+
// computes status which tells that axes limits look fine and it is safe to draw
|
|
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]);
|
|
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,
|
|
1154
1156
|
$isOk,
|
|
1155
1157
|
$scale,
|
|
1156
1158
|
axesWrapper,
|
|
1157
|
-
cpy,
|
|
1158
|
-
cpx,
|
|
1159
1159
|
clipPathID,
|
|
1160
1160
|
width,
|
|
1161
1161
|
height,
|
package/package.json
CHANGED
package/src/Axes.svelte
CHANGED
|
@@ -296,7 +296,9 @@
|
|
|
296
296
|
!$yLim.some(v => isNaN(v)) &&
|
|
297
297
|
!$xLim.some(v => isNaN(v)) &&
|
|
298
298
|
$xLim[1] !== $xLim[0] &&
|
|
299
|
-
$yLim[1] !== $yLim[0]
|
|
299
|
+
$yLim[1] !== $yLim[0] &&
|
|
300
|
+
cpy[0] > cpy[1] &&
|
|
301
|
+
cpx[1] > cpx[0]
|
|
300
302
|
)
|
|
301
303
|
|
|
302
304
|
// computes coordinates for clip path box
|