svelte-plots-basic 1.1.1 → 1.1.3
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 +47 -29
- package/dist/index.mjs +47 -29
- package/package.json +1 -1
- package/src/Axes.svelte +32 -10
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. 1.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. 1.1.3) 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
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
}
|
|
109
109
|
function append_stylesheet(node, style) {
|
|
110
110
|
append(node.head || node, style);
|
|
111
|
+
return style.sheet;
|
|
111
112
|
}
|
|
112
113
|
function insert(target, node, anchor) {
|
|
113
114
|
target.insertBefore(node, anchor || null);
|
|
@@ -183,6 +184,9 @@
|
|
|
183
184
|
function onMount(fn) {
|
|
184
185
|
get_current_component().$$.on_mount.push(fn);
|
|
185
186
|
}
|
|
187
|
+
function onDestroy(fn) {
|
|
188
|
+
get_current_component().$$.on_destroy.push(fn);
|
|
189
|
+
}
|
|
186
190
|
function createEventDispatcher() {
|
|
187
191
|
const component = get_current_component();
|
|
188
192
|
return (type, detail, { cancelable = false } = {}) => {
|
|
@@ -324,6 +328,9 @@
|
|
|
324
328
|
});
|
|
325
329
|
block.o(local);
|
|
326
330
|
}
|
|
331
|
+
else if (callback) {
|
|
332
|
+
callback();
|
|
333
|
+
}
|
|
327
334
|
}
|
|
328
335
|
function create_component(block) {
|
|
329
336
|
block && block.c();
|
|
@@ -502,10 +509,10 @@
|
|
|
502
509
|
return { set, update, subscribe };
|
|
503
510
|
}
|
|
504
511
|
|
|
505
|
-
/* src/Axes.svelte generated by Svelte v3.
|
|
512
|
+
/* src/Axes.svelte generated by Svelte v3.50.1 */
|
|
506
513
|
|
|
507
514
|
function add_css$3(target) {
|
|
508
|
-
append_styles(target, "svelte-
|
|
515
|
+
append_styles(target, "svelte-jxlrcp", ".plot{font-family:Arial, Helvetica, sans-serif;display:grid;grid-template-columns:min-content auto;grid-template-rows:min-content auto min-content;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-jxlrcp{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-content{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}");
|
|
509
516
|
}
|
|
510
517
|
|
|
511
518
|
const get_box_slot_changes = dirty => ({});
|
|
@@ -515,7 +522,7 @@
|
|
|
515
522
|
const get_xaxis_slot_changes = dirty => ({});
|
|
516
523
|
const get_xaxis_slot_context = ctx => ({});
|
|
517
524
|
|
|
518
|
-
// (
|
|
525
|
+
// (352:3) {#if title !== ""}
|
|
519
526
|
function create_if_block_3(ctx) {
|
|
520
527
|
let div;
|
|
521
528
|
|
|
@@ -536,7 +543,7 @@
|
|
|
536
543
|
};
|
|
537
544
|
}
|
|
538
545
|
|
|
539
|
-
// (
|
|
546
|
+
// (353:3) {#if yLabel !== ""}
|
|
540
547
|
function create_if_block_2(ctx) {
|
|
541
548
|
let div;
|
|
542
549
|
let span;
|
|
@@ -560,7 +567,7 @@
|
|
|
560
567
|
};
|
|
561
568
|
}
|
|
562
569
|
|
|
563
|
-
// (
|
|
570
|
+
// (354:3) {#if xLabel !== ""}
|
|
564
571
|
function create_if_block_1(ctx) {
|
|
565
572
|
let div;
|
|
566
573
|
let span;
|
|
@@ -584,7 +591,7 @@
|
|
|
584
591
|
};
|
|
585
592
|
}
|
|
586
593
|
|
|
587
|
-
// (
|
|
594
|
+
// (382:3) {#if !$isOk}
|
|
588
595
|
function create_if_block$9(ctx) {
|
|
589
596
|
let p;
|
|
590
597
|
|
|
@@ -666,11 +673,12 @@
|
|
|
666
673
|
attr(rect, "width", rect_width_value = /*cpx*/ ctx[8][1] - /*cpx*/ ctx[8][0]);
|
|
667
674
|
attr(rect, "height", rect_height_value = /*cpy*/ ctx[7][0] - /*cpy*/ ctx[7][1]);
|
|
668
675
|
attr(clipPath, "id", /*clipPathID*/ ctx[9]);
|
|
676
|
+
attr(g, "class", "axes-content");
|
|
669
677
|
attr(g, "clip-path", "url(#" + /*clipPathID*/ ctx[9] + ")");
|
|
670
678
|
attr(svg, "preserveAspectRatio", "none");
|
|
671
679
|
attr(svg, "class", "axes");
|
|
672
|
-
attr(div0, "class", "axes-wrapper svelte-
|
|
673
|
-
attr(div1, "class", div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-
|
|
680
|
+
attr(div0, "class", "axes-wrapper svelte-jxlrcp");
|
|
681
|
+
attr(div1, "class", div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-jxlrcp");
|
|
674
682
|
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[3]);
|
|
675
683
|
},
|
|
676
684
|
m(target, anchor) {
|
|
@@ -843,11 +851,11 @@
|
|
|
843
851
|
if_block3 = null;
|
|
844
852
|
}
|
|
845
853
|
|
|
846
|
-
if (!current || dirty[0] & /*$scale*/ 16 && div1_class_value !== (div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-
|
|
854
|
+
if (!current || dirty[0] & /*$scale*/ 16 && div1_class_value !== (div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-jxlrcp")) {
|
|
847
855
|
attr(div1, "class", div1_class_value);
|
|
848
856
|
}
|
|
849
857
|
|
|
850
|
-
if (dirty[0] & /*$scale, $isOk*/ 24) {
|
|
858
|
+
if (!current || dirty[0] & /*$scale, $isOk*/ 24) {
|
|
851
859
|
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[3]);
|
|
852
860
|
}
|
|
853
861
|
},
|
|
@@ -1157,19 +1165,31 @@
|
|
|
1157
1165
|
dispatch("axesclick");
|
|
1158
1166
|
}
|
|
1159
1167
|
|
|
1160
|
-
/* observer for the
|
|
1161
|
-
|
|
1168
|
+
/* observer for the axes area size - to update size of axes */
|
|
1169
|
+
const ro2 = new ResizeObserver(entries => {
|
|
1162
1170
|
for (let entry of entries) {
|
|
1163
|
-
const pcr = plotElement.getBoundingClientRect();
|
|
1164
1171
|
const acr = axesElement.getBoundingClientRect();
|
|
1165
1172
|
width.update(x => acr.width);
|
|
1166
1173
|
height.update(x => acr.height);
|
|
1174
|
+
}
|
|
1175
|
+
});
|
|
1176
|
+
|
|
1177
|
+
/* observer for the plot area size — to update scale */
|
|
1178
|
+
const ro1 = new ResizeObserver(entries => {
|
|
1179
|
+
for (let entry of entries) {
|
|
1180
|
+
const pcr = plotElement.getBoundingClientRect();
|
|
1167
1181
|
scale.update(x => getScale(pcr.width, pcr.height));
|
|
1168
1182
|
}
|
|
1169
1183
|
});
|
|
1170
1184
|
|
|
1171
1185
|
onMount(() => {
|
|
1172
|
-
|
|
1186
|
+
ro1.observe(plotElement);
|
|
1187
|
+
ro2.observe(axesElement);
|
|
1188
|
+
});
|
|
1189
|
+
|
|
1190
|
+
onDestroy(() => {
|
|
1191
|
+
ro1.unobserve(plotElement);
|
|
1192
|
+
ro2.unobserve(axesElement);
|
|
1173
1193
|
});
|
|
1174
1194
|
|
|
1175
1195
|
function div0_binding($$value) {
|
|
@@ -1299,7 +1319,7 @@
|
|
|
1299
1319
|
"PRIMARY_TEXT": "#333",
|
|
1300
1320
|
};
|
|
1301
1321
|
|
|
1302
|
-
/* src/XAxis.svelte generated by Svelte v3.
|
|
1322
|
+
/* src/XAxis.svelte generated by Svelte v3.50.1 */
|
|
1303
1323
|
|
|
1304
1324
|
function get_each_context$5(ctx, list, i) {
|
|
1305
1325
|
const child_ctx = ctx.slice();
|
|
@@ -1679,7 +1699,7 @@
|
|
|
1679
1699
|
}
|
|
1680
1700
|
}
|
|
1681
1701
|
|
|
1682
|
-
/* src/YAxis.svelte generated by Svelte v3.
|
|
1702
|
+
/* src/YAxis.svelte generated by Svelte v3.50.1 */
|
|
1683
1703
|
|
|
1684
1704
|
function get_each_context$4(ctx, list, i) {
|
|
1685
1705
|
const child_ctx = ctx.slice();
|
|
@@ -1792,7 +1812,6 @@
|
|
|
1792
1812
|
let t;
|
|
1793
1813
|
let text_1_x_value;
|
|
1794
1814
|
let text_1_y_value;
|
|
1795
|
-
let text_1_dy_value;
|
|
1796
1815
|
|
|
1797
1816
|
return {
|
|
1798
1817
|
c() {
|
|
@@ -1813,7 +1832,7 @@
|
|
|
1813
1832
|
attr(text_1, "x", text_1_x_value = /*ticksX*/ ctx[3][0]);
|
|
1814
1833
|
attr(text_1, "y", text_1_y_value = /*ty*/ ctx[26]);
|
|
1815
1834
|
attr(text_1, "dx", /*dx*/ ctx[2]);
|
|
1816
|
-
attr(text_1, "dy",
|
|
1835
|
+
attr(text_1, "dy", 0);
|
|
1817
1836
|
attr(text_1, "transform", /*transform*/ ctx[6]);
|
|
1818
1837
|
set_style(text_1, "background", "red");
|
|
1819
1838
|
attr(text_1, "class", "mdaplot__axis-labels");
|
|
@@ -2065,7 +2084,7 @@
|
|
|
2065
2084
|
}
|
|
2066
2085
|
}
|
|
2067
2086
|
|
|
2068
|
-
/* src/Rectangles.svelte generated by Svelte v3.
|
|
2087
|
+
/* src/Rectangles.svelte generated by Svelte v3.50.1 */
|
|
2069
2088
|
|
|
2070
2089
|
function get_each_context$3(ctx, list, i) {
|
|
2071
2090
|
const child_ctx = ctx.slice();
|
|
@@ -2361,7 +2380,7 @@
|
|
|
2361
2380
|
}
|
|
2362
2381
|
}
|
|
2363
2382
|
|
|
2364
|
-
/* src/Box.svelte generated by Svelte v3.
|
|
2383
|
+
/* src/Box.svelte generated by Svelte v3.50.1 */
|
|
2365
2384
|
|
|
2366
2385
|
function create_if_block$5(ctx) {
|
|
2367
2386
|
let g;
|
|
@@ -2528,7 +2547,7 @@
|
|
|
2528
2547
|
}
|
|
2529
2548
|
}
|
|
2530
2549
|
|
|
2531
|
-
/* src/Segments.svelte generated by Svelte v3.
|
|
2550
|
+
/* src/Segments.svelte generated by Svelte v3.50.1 */
|
|
2532
2551
|
|
|
2533
2552
|
function get_each_context$2(ctx, list, i) {
|
|
2534
2553
|
const child_ctx = ctx.slice();
|
|
@@ -2795,7 +2814,7 @@
|
|
|
2795
2814
|
}
|
|
2796
2815
|
}
|
|
2797
2816
|
|
|
2798
|
-
/* src/TextLabels.svelte generated by Svelte v3.
|
|
2817
|
+
/* src/TextLabels.svelte generated by Svelte v3.50.1 */
|
|
2799
2818
|
|
|
2800
2819
|
function add_css$2(target) {
|
|
2801
2820
|
append_styles(target, "svelte-1xvrp9d", "text.svelte-1xvrp9d,text.svelte-1xvrp9d>tspan{dominant-baseline:middle}");
|
|
@@ -2885,14 +2904,13 @@
|
|
|
2885
2904
|
function create_each_block$1(ctx) {
|
|
2886
2905
|
let text_1;
|
|
2887
2906
|
let raw_value = /*labels*/ ctx[0][/*i*/ ctx[29]] + "";
|
|
2888
|
-
let text_1_data_id_value;
|
|
2889
2907
|
let text_1_x_value;
|
|
2890
2908
|
let text_1_y_value;
|
|
2891
2909
|
|
|
2892
2910
|
return {
|
|
2893
2911
|
c() {
|
|
2894
2912
|
text_1 = svg_element("text");
|
|
2895
|
-
attr(text_1, "data-id",
|
|
2913
|
+
attr(text_1, "data-id", /*i*/ ctx[29]);
|
|
2896
2914
|
attr(text_1, "x", text_1_x_value = /*x*/ ctx[7][/*i*/ ctx[29]]);
|
|
2897
2915
|
attr(text_1, "y", text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]]);
|
|
2898
2916
|
attr(text_1, "dx", /*dx*/ ctx[5]);
|
|
@@ -3118,7 +3136,7 @@
|
|
|
3118
3136
|
}
|
|
3119
3137
|
}
|
|
3120
3138
|
|
|
3121
|
-
/* src/TextLegend.svelte generated by Svelte v3.
|
|
3139
|
+
/* src/TextLegend.svelte generated by Svelte v3.50.1 */
|
|
3122
3140
|
|
|
3123
3141
|
function get_each_context(ctx, list, i) {
|
|
3124
3142
|
const child_ctx = ctx.slice();
|
|
@@ -3442,7 +3460,7 @@
|
|
|
3442
3460
|
return x.slice(1).map( (y, i) => (y - x[i]));
|
|
3443
3461
|
}
|
|
3444
3462
|
|
|
3445
|
-
/* src/BarSeries.svelte generated by Svelte v3.
|
|
3463
|
+
/* src/BarSeries.svelte generated by Svelte v3.50.1 */
|
|
3446
3464
|
|
|
3447
3465
|
function add_css$1(target) {
|
|
3448
3466
|
append_styles(target, "svelte-kw726w", ".series_bar > rect{stroke-width:1px}.series_bar > rect:hover{opacity:90%}");
|
|
@@ -3610,7 +3628,7 @@
|
|
|
3610
3628
|
}
|
|
3611
3629
|
}
|
|
3612
3630
|
|
|
3613
|
-
/* src/ScatterSeries.svelte generated by Svelte v3.
|
|
3631
|
+
/* src/ScatterSeries.svelte generated by Svelte v3.50.1 */
|
|
3614
3632
|
|
|
3615
3633
|
function add_css(target) {
|
|
3616
3634
|
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}");
|
|
@@ -3777,7 +3795,7 @@
|
|
|
3777
3795
|
}
|
|
3778
3796
|
}
|
|
3779
3797
|
|
|
3780
|
-
/* src/LineSeries.svelte generated by Svelte v3.
|
|
3798
|
+
/* src/LineSeries.svelte generated by Svelte v3.50.1 */
|
|
3781
3799
|
|
|
3782
3800
|
function create_if_block$1(ctx) {
|
|
3783
3801
|
let g;
|
|
@@ -3968,7 +3986,7 @@
|
|
|
3968
3986
|
}
|
|
3969
3987
|
}
|
|
3970
3988
|
|
|
3971
|
-
/* src/AreaSeries.svelte generated by Svelte v3.
|
|
3989
|
+
/* src/AreaSeries.svelte generated by Svelte v3.50.1 */
|
|
3972
3990
|
|
|
3973
3991
|
function create_if_block(ctx) {
|
|
3974
3992
|
let g;
|
package/dist/index.mjs
CHANGED
|
@@ -102,6 +102,7 @@ function get_root_for_style(node) {
|
|
|
102
102
|
}
|
|
103
103
|
function append_stylesheet(node, style) {
|
|
104
104
|
append(node.head || node, style);
|
|
105
|
+
return style.sheet;
|
|
105
106
|
}
|
|
106
107
|
function insert(target, node, anchor) {
|
|
107
108
|
target.insertBefore(node, anchor || null);
|
|
@@ -177,6 +178,9 @@ function get_current_component() {
|
|
|
177
178
|
function onMount(fn) {
|
|
178
179
|
get_current_component().$$.on_mount.push(fn);
|
|
179
180
|
}
|
|
181
|
+
function onDestroy(fn) {
|
|
182
|
+
get_current_component().$$.on_destroy.push(fn);
|
|
183
|
+
}
|
|
180
184
|
function createEventDispatcher() {
|
|
181
185
|
const component = get_current_component();
|
|
182
186
|
return (type, detail, { cancelable = false } = {}) => {
|
|
@@ -318,6 +322,9 @@ function transition_out(block, local, detach, callback) {
|
|
|
318
322
|
});
|
|
319
323
|
block.o(local);
|
|
320
324
|
}
|
|
325
|
+
else if (callback) {
|
|
326
|
+
callback();
|
|
327
|
+
}
|
|
321
328
|
}
|
|
322
329
|
function create_component(block) {
|
|
323
330
|
block && block.c();
|
|
@@ -496,10 +503,10 @@ function writable(value, start = noop) {
|
|
|
496
503
|
return { set, update, subscribe };
|
|
497
504
|
}
|
|
498
505
|
|
|
499
|
-
/* src/Axes.svelte generated by Svelte v3.
|
|
506
|
+
/* src/Axes.svelte generated by Svelte v3.50.1 */
|
|
500
507
|
|
|
501
508
|
function add_css$3(target) {
|
|
502
|
-
append_styles(target, "svelte-
|
|
509
|
+
append_styles(target, "svelte-jxlrcp", ".plot{font-family:Arial, Helvetica, sans-serif;display:grid;grid-template-columns:min-content auto;grid-template-rows:min-content auto min-content;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-jxlrcp{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-content{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}");
|
|
503
510
|
}
|
|
504
511
|
|
|
505
512
|
const get_box_slot_changes = dirty => ({});
|
|
@@ -509,7 +516,7 @@ const get_yaxis_slot_context = ctx => ({});
|
|
|
509
516
|
const get_xaxis_slot_changes = dirty => ({});
|
|
510
517
|
const get_xaxis_slot_context = ctx => ({});
|
|
511
518
|
|
|
512
|
-
// (
|
|
519
|
+
// (352:3) {#if title !== ""}
|
|
513
520
|
function create_if_block_3(ctx) {
|
|
514
521
|
let div;
|
|
515
522
|
|
|
@@ -530,7 +537,7 @@ function create_if_block_3(ctx) {
|
|
|
530
537
|
};
|
|
531
538
|
}
|
|
532
539
|
|
|
533
|
-
// (
|
|
540
|
+
// (353:3) {#if yLabel !== ""}
|
|
534
541
|
function create_if_block_2(ctx) {
|
|
535
542
|
let div;
|
|
536
543
|
let span;
|
|
@@ -554,7 +561,7 @@ function create_if_block_2(ctx) {
|
|
|
554
561
|
};
|
|
555
562
|
}
|
|
556
563
|
|
|
557
|
-
// (
|
|
564
|
+
// (354:3) {#if xLabel !== ""}
|
|
558
565
|
function create_if_block_1(ctx) {
|
|
559
566
|
let div;
|
|
560
567
|
let span;
|
|
@@ -578,7 +585,7 @@ function create_if_block_1(ctx) {
|
|
|
578
585
|
};
|
|
579
586
|
}
|
|
580
587
|
|
|
581
|
-
// (
|
|
588
|
+
// (382:3) {#if !$isOk}
|
|
582
589
|
function create_if_block$9(ctx) {
|
|
583
590
|
let p;
|
|
584
591
|
|
|
@@ -660,11 +667,12 @@ function create_fragment$b(ctx) {
|
|
|
660
667
|
attr(rect, "width", rect_width_value = /*cpx*/ ctx[8][1] - /*cpx*/ ctx[8][0]);
|
|
661
668
|
attr(rect, "height", rect_height_value = /*cpy*/ ctx[7][0] - /*cpy*/ ctx[7][1]);
|
|
662
669
|
attr(clipPath, "id", /*clipPathID*/ ctx[9]);
|
|
670
|
+
attr(g, "class", "axes-content");
|
|
663
671
|
attr(g, "clip-path", "url(#" + /*clipPathID*/ ctx[9] + ")");
|
|
664
672
|
attr(svg, "preserveAspectRatio", "none");
|
|
665
673
|
attr(svg, "class", "axes");
|
|
666
|
-
attr(div0, "class", "axes-wrapper svelte-
|
|
667
|
-
attr(div1, "class", div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-
|
|
674
|
+
attr(div0, "class", "axes-wrapper svelte-jxlrcp");
|
|
675
|
+
attr(div1, "class", div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-jxlrcp");
|
|
668
676
|
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[3]);
|
|
669
677
|
},
|
|
670
678
|
m(target, anchor) {
|
|
@@ -837,11 +845,11 @@ function create_fragment$b(ctx) {
|
|
|
837
845
|
if_block3 = null;
|
|
838
846
|
}
|
|
839
847
|
|
|
840
|
-
if (!current || dirty[0] & /*$scale*/ 16 && div1_class_value !== (div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-
|
|
848
|
+
if (!current || dirty[0] & /*$scale*/ 16 && div1_class_value !== (div1_class_value = "plot " + ('plot_' + /*$scale*/ ctx[4]) + " svelte-jxlrcp")) {
|
|
841
849
|
attr(div1, "class", div1_class_value);
|
|
842
850
|
}
|
|
843
851
|
|
|
844
|
-
if (dirty[0] & /*$scale, $isOk*/ 24) {
|
|
852
|
+
if (!current || dirty[0] & /*$scale, $isOk*/ 24) {
|
|
845
853
|
toggle_class(div1, "plot_error", !/*$isOk*/ ctx[3]);
|
|
846
854
|
}
|
|
847
855
|
},
|
|
@@ -1151,19 +1159,31 @@ function instance$b($$self, $$props, $$invalidate) {
|
|
|
1151
1159
|
dispatch("axesclick");
|
|
1152
1160
|
}
|
|
1153
1161
|
|
|
1154
|
-
/* observer for the
|
|
1155
|
-
|
|
1162
|
+
/* observer for the axes area size - to update size of axes */
|
|
1163
|
+
const ro2 = new ResizeObserver(entries => {
|
|
1156
1164
|
for (let entry of entries) {
|
|
1157
|
-
const pcr = plotElement.getBoundingClientRect();
|
|
1158
1165
|
const acr = axesElement.getBoundingClientRect();
|
|
1159
1166
|
width.update(x => acr.width);
|
|
1160
1167
|
height.update(x => acr.height);
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
|
|
1171
|
+
/* observer for the plot area size — to update scale */
|
|
1172
|
+
const ro1 = new ResizeObserver(entries => {
|
|
1173
|
+
for (let entry of entries) {
|
|
1174
|
+
const pcr = plotElement.getBoundingClientRect();
|
|
1161
1175
|
scale.update(x => getScale(pcr.width, pcr.height));
|
|
1162
1176
|
}
|
|
1163
1177
|
});
|
|
1164
1178
|
|
|
1165
1179
|
onMount(() => {
|
|
1166
|
-
|
|
1180
|
+
ro1.observe(plotElement);
|
|
1181
|
+
ro2.observe(axesElement);
|
|
1182
|
+
});
|
|
1183
|
+
|
|
1184
|
+
onDestroy(() => {
|
|
1185
|
+
ro1.unobserve(plotElement);
|
|
1186
|
+
ro2.unobserve(axesElement);
|
|
1167
1187
|
});
|
|
1168
1188
|
|
|
1169
1189
|
function div0_binding($$value) {
|
|
@@ -1293,7 +1313,7 @@ const Colors = {
|
|
|
1293
1313
|
"PRIMARY_TEXT": "#333",
|
|
1294
1314
|
};
|
|
1295
1315
|
|
|
1296
|
-
/* src/XAxis.svelte generated by Svelte v3.
|
|
1316
|
+
/* src/XAxis.svelte generated by Svelte v3.50.1 */
|
|
1297
1317
|
|
|
1298
1318
|
function get_each_context$5(ctx, list, i) {
|
|
1299
1319
|
const child_ctx = ctx.slice();
|
|
@@ -1673,7 +1693,7 @@ class XAxis extends SvelteComponent {
|
|
|
1673
1693
|
}
|
|
1674
1694
|
}
|
|
1675
1695
|
|
|
1676
|
-
/* src/YAxis.svelte generated by Svelte v3.
|
|
1696
|
+
/* src/YAxis.svelte generated by Svelte v3.50.1 */
|
|
1677
1697
|
|
|
1678
1698
|
function get_each_context$4(ctx, list, i) {
|
|
1679
1699
|
const child_ctx = ctx.slice();
|
|
@@ -1786,7 +1806,6 @@ function create_each_block$4(ctx) {
|
|
|
1786
1806
|
let t;
|
|
1787
1807
|
let text_1_x_value;
|
|
1788
1808
|
let text_1_y_value;
|
|
1789
|
-
let text_1_dy_value;
|
|
1790
1809
|
|
|
1791
1810
|
return {
|
|
1792
1811
|
c() {
|
|
@@ -1807,7 +1826,7 @@ function create_each_block$4(ctx) {
|
|
|
1807
1826
|
attr(text_1, "x", text_1_x_value = /*ticksX*/ ctx[3][0]);
|
|
1808
1827
|
attr(text_1, "y", text_1_y_value = /*ty*/ ctx[26]);
|
|
1809
1828
|
attr(text_1, "dx", /*dx*/ ctx[2]);
|
|
1810
|
-
attr(text_1, "dy",
|
|
1829
|
+
attr(text_1, "dy", 0);
|
|
1811
1830
|
attr(text_1, "transform", /*transform*/ ctx[6]);
|
|
1812
1831
|
set_style(text_1, "background", "red");
|
|
1813
1832
|
attr(text_1, "class", "mdaplot__axis-labels");
|
|
@@ -2059,7 +2078,7 @@ class YAxis extends SvelteComponent {
|
|
|
2059
2078
|
}
|
|
2060
2079
|
}
|
|
2061
2080
|
|
|
2062
|
-
/* src/Rectangles.svelte generated by Svelte v3.
|
|
2081
|
+
/* src/Rectangles.svelte generated by Svelte v3.50.1 */
|
|
2063
2082
|
|
|
2064
2083
|
function get_each_context$3(ctx, list, i) {
|
|
2065
2084
|
const child_ctx = ctx.slice();
|
|
@@ -2355,7 +2374,7 @@ class Rectangles extends SvelteComponent {
|
|
|
2355
2374
|
}
|
|
2356
2375
|
}
|
|
2357
2376
|
|
|
2358
|
-
/* src/Box.svelte generated by Svelte v3.
|
|
2377
|
+
/* src/Box.svelte generated by Svelte v3.50.1 */
|
|
2359
2378
|
|
|
2360
2379
|
function create_if_block$5(ctx) {
|
|
2361
2380
|
let g;
|
|
@@ -2522,7 +2541,7 @@ class Box extends SvelteComponent {
|
|
|
2522
2541
|
}
|
|
2523
2542
|
}
|
|
2524
2543
|
|
|
2525
|
-
/* src/Segments.svelte generated by Svelte v3.
|
|
2544
|
+
/* src/Segments.svelte generated by Svelte v3.50.1 */
|
|
2526
2545
|
|
|
2527
2546
|
function get_each_context$2(ctx, list, i) {
|
|
2528
2547
|
const child_ctx = ctx.slice();
|
|
@@ -2789,7 +2808,7 @@ class Segments extends SvelteComponent {
|
|
|
2789
2808
|
}
|
|
2790
2809
|
}
|
|
2791
2810
|
|
|
2792
|
-
/* src/TextLabels.svelte generated by Svelte v3.
|
|
2811
|
+
/* src/TextLabels.svelte generated by Svelte v3.50.1 */
|
|
2793
2812
|
|
|
2794
2813
|
function add_css$2(target) {
|
|
2795
2814
|
append_styles(target, "svelte-1xvrp9d", "text.svelte-1xvrp9d,text.svelte-1xvrp9d>tspan{dominant-baseline:middle}");
|
|
@@ -2879,14 +2898,13 @@ function create_if_block$3(ctx) {
|
|
|
2879
2898
|
function create_each_block$1(ctx) {
|
|
2880
2899
|
let text_1;
|
|
2881
2900
|
let raw_value = /*labels*/ ctx[0][/*i*/ ctx[29]] + "";
|
|
2882
|
-
let text_1_data_id_value;
|
|
2883
2901
|
let text_1_x_value;
|
|
2884
2902
|
let text_1_y_value;
|
|
2885
2903
|
|
|
2886
2904
|
return {
|
|
2887
2905
|
c() {
|
|
2888
2906
|
text_1 = svg_element("text");
|
|
2889
|
-
attr(text_1, "data-id",
|
|
2907
|
+
attr(text_1, "data-id", /*i*/ ctx[29]);
|
|
2890
2908
|
attr(text_1, "x", text_1_x_value = /*x*/ ctx[7][/*i*/ ctx[29]]);
|
|
2891
2909
|
attr(text_1, "y", text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]]);
|
|
2892
2910
|
attr(text_1, "dx", /*dx*/ ctx[5]);
|
|
@@ -3112,7 +3130,7 @@ class TextLabels extends SvelteComponent {
|
|
|
3112
3130
|
}
|
|
3113
3131
|
}
|
|
3114
3132
|
|
|
3115
|
-
/* src/TextLegend.svelte generated by Svelte v3.
|
|
3133
|
+
/* src/TextLegend.svelte generated by Svelte v3.50.1 */
|
|
3116
3134
|
|
|
3117
3135
|
function get_each_context(ctx, list, i) {
|
|
3118
3136
|
const child_ctx = ctx.slice();
|
|
@@ -3436,7 +3454,7 @@ function diff(x) {
|
|
|
3436
3454
|
return x.slice(1).map( (y, i) => (y - x[i]));
|
|
3437
3455
|
}
|
|
3438
3456
|
|
|
3439
|
-
/* src/BarSeries.svelte generated by Svelte v3.
|
|
3457
|
+
/* src/BarSeries.svelte generated by Svelte v3.50.1 */
|
|
3440
3458
|
|
|
3441
3459
|
function add_css$1(target) {
|
|
3442
3460
|
append_styles(target, "svelte-kw726w", ".series_bar > rect{stroke-width:1px}.series_bar > rect:hover{opacity:90%}");
|
|
@@ -3604,7 +3622,7 @@ class BarSeries extends SvelteComponent {
|
|
|
3604
3622
|
}
|
|
3605
3623
|
}
|
|
3606
3624
|
|
|
3607
|
-
/* src/ScatterSeries.svelte generated by Svelte v3.
|
|
3625
|
+
/* src/ScatterSeries.svelte generated by Svelte v3.50.1 */
|
|
3608
3626
|
|
|
3609
3627
|
function add_css(target) {
|
|
3610
3628
|
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}");
|
|
@@ -3771,7 +3789,7 @@ class ScatterSeries extends SvelteComponent {
|
|
|
3771
3789
|
}
|
|
3772
3790
|
}
|
|
3773
3791
|
|
|
3774
|
-
/* src/LineSeries.svelte generated by Svelte v3.
|
|
3792
|
+
/* src/LineSeries.svelte generated by Svelte v3.50.1 */
|
|
3775
3793
|
|
|
3776
3794
|
function create_if_block$1(ctx) {
|
|
3777
3795
|
let g;
|
|
@@ -3962,7 +3980,7 @@ class LineSeries extends SvelteComponent {
|
|
|
3962
3980
|
}
|
|
3963
3981
|
}
|
|
3964
3982
|
|
|
3965
|
-
/* src/AreaSeries.svelte generated by Svelte v3.
|
|
3983
|
+
/* src/AreaSeries.svelte generated by Svelte v3.50.1 */
|
|
3966
3984
|
|
|
3967
3985
|
function create_if_block(ctx) {
|
|
3968
3986
|
let g;
|
package/package.json
CHANGED
package/src/Axes.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { setContext, createEventDispatcher, onMount } from 'svelte';
|
|
2
|
+
import { setContext, createEventDispatcher, onMount, onDestroy } from 'svelte';
|
|
3
3
|
import { writable } from 'svelte/store';
|
|
4
4
|
|
|
5
5
|
/* input parameters */
|
|
@@ -317,22 +317,32 @@
|
|
|
317
317
|
$: cpx = $isOk ? scaleX($xLim, $xLim, $width) : [0, 1];
|
|
318
318
|
$: cpy = $isOk ? scaleY($yLim, $yLim, $height) : [1, 0];
|
|
319
319
|
|
|
320
|
-
/* observer for the
|
|
321
|
-
|
|
320
|
+
/* observer for the axes area size - to update size of axes */
|
|
321
|
+
const ro2 = new ResizeObserver(entries => {
|
|
322
322
|
for (let entry of entries) {
|
|
323
|
-
|
|
324
|
-
const pcr = plotElement.getBoundingClientRect();
|
|
325
323
|
const acr = axesElement.getBoundingClientRect();
|
|
326
|
-
|
|
327
324
|
width.update(x => acr.width);
|
|
328
325
|
height.update(x => acr.height);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
/* observer for the plot area size — to update scale */
|
|
330
|
+
const ro1 = new ResizeObserver(entries => {
|
|
331
|
+
for (let entry of entries) {
|
|
332
|
+
const pcr = plotElement.getBoundingClientRect();
|
|
329
333
|
scale.update(x => getScale(pcr.width, pcr.height));
|
|
330
334
|
}
|
|
331
335
|
});
|
|
332
336
|
|
|
333
337
|
onMount(() => {
|
|
334
|
-
|
|
338
|
+
ro1.observe(plotElement);
|
|
339
|
+
ro2.observe(axesElement);
|
|
335
340
|
});
|
|
341
|
+
|
|
342
|
+
onDestroy(() => {
|
|
343
|
+
ro1.unobserve(plotElement);
|
|
344
|
+
ro2.unobserve(axesElement);
|
|
345
|
+
})
|
|
336
346
|
</script>
|
|
337
347
|
|
|
338
348
|
|
|
@@ -359,7 +369,7 @@
|
|
|
359
369
|
<slot name="yaxis"></slot>
|
|
360
370
|
|
|
361
371
|
<!-- main plot content -->
|
|
362
|
-
<g clip-path="url(#{clipPathID})">
|
|
372
|
+
<g class="axes-content" clip-path="url(#{clipPathID})">
|
|
363
373
|
<slot></slot>
|
|
364
374
|
</g>
|
|
365
375
|
|
|
@@ -385,8 +395,8 @@
|
|
|
385
395
|
font-family: Arial, Helvetica, sans-serif;
|
|
386
396
|
|
|
387
397
|
display: grid;
|
|
388
|
-
grid-template-columns: min-content
|
|
389
|
-
grid-template-rows: auto
|
|
398
|
+
grid-template-columns: min-content auto;
|
|
399
|
+
grid-template-rows: min-content auto min-content;
|
|
390
400
|
grid-template-areas:
|
|
391
401
|
". title"
|
|
392
402
|
"ylab axes"
|
|
@@ -456,6 +466,18 @@
|
|
|
456
466
|
min-width: 100%;
|
|
457
467
|
}
|
|
458
468
|
|
|
469
|
+
:global(.axes-content) {
|
|
470
|
+
padding: 0;
|
|
471
|
+
margin: 0;
|
|
472
|
+
height: 100%;
|
|
473
|
+
width: 100%;
|
|
474
|
+
max-height: 100%;
|
|
475
|
+
max-width: 100%;
|
|
476
|
+
min-height: 100%;
|
|
477
|
+
min-width: 100%;
|
|
478
|
+
|
|
479
|
+
}
|
|
480
|
+
|
|
459
481
|
:global(.axes__xlabel) {
|
|
460
482
|
grid-area: xlab;
|
|
461
483
|
font-size: 1.0em;
|