svelte-plots-basic 1.0.4 → 1.0.7
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 +47 -30
- package/dist/index.mjs +47 -30
- package/package.json +1 -1
- package/src/Axes.svelte +10 -2
- package/src/Rectangles.svelte +4 -2
- package/src/TextLabels.svelte +1 -1
package/dist/index.js
CHANGED
|
@@ -512,7 +512,7 @@
|
|
|
512
512
|
const get_xaxis_slot_changes = dirty => ({});
|
|
513
513
|
const get_xaxis_slot_context = ctx => ({});
|
|
514
514
|
|
|
515
|
-
// (
|
|
515
|
+
// (338:3) {#if title !== ""}
|
|
516
516
|
function create_if_block_3(ctx) {
|
|
517
517
|
let div;
|
|
518
518
|
|
|
@@ -533,7 +533,7 @@
|
|
|
533
533
|
};
|
|
534
534
|
}
|
|
535
535
|
|
|
536
|
-
// (
|
|
536
|
+
// (339:3) {#if yLabel !== ""}
|
|
537
537
|
function create_if_block_2(ctx) {
|
|
538
538
|
let div;
|
|
539
539
|
let span;
|
|
@@ -557,7 +557,7 @@
|
|
|
557
557
|
};
|
|
558
558
|
}
|
|
559
559
|
|
|
560
|
-
// (
|
|
560
|
+
// (340:3) {#if xLabel !== ""}
|
|
561
561
|
function create_if_block_1(ctx) {
|
|
562
562
|
let div;
|
|
563
563
|
let span;
|
|
@@ -581,7 +581,7 @@
|
|
|
581
581
|
};
|
|
582
582
|
}
|
|
583
583
|
|
|
584
|
-
// (
|
|
584
|
+
// (368:3) {#if !$isOk}
|
|
585
585
|
function create_if_block$9(ctx) {
|
|
586
586
|
let p;
|
|
587
587
|
|
|
@@ -1141,17 +1141,27 @@
|
|
|
1141
1141
|
});
|
|
1142
1142
|
|
|
1143
1143
|
// handle click on plot elements and dispatch manual events
|
|
1144
|
+
function dispatchClickEvent(eventName, el) {
|
|
1145
|
+
dispatch(eventName, {
|
|
1146
|
+
seriesTitle: el.parentNode.getAttribute('title'),
|
|
1147
|
+
elementID: el.dataset.id
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1144
1151
|
function handleClick(e) {
|
|
1152
|
+
// scatter plot markers
|
|
1145
1153
|
if (e.target.tagName === "text" && e.target.parentNode.classList.contains("series_scatter")) {
|
|
1146
|
-
|
|
1154
|
+
dispatchClickEvent("markerclick", e.target);
|
|
1147
1155
|
return;
|
|
1148
1156
|
}
|
|
1149
1157
|
|
|
1158
|
+
// bar plot bars
|
|
1150
1159
|
if (e.target.tagName === "rect" && e.target.parentNode.classList.contains("series_bar")) {
|
|
1151
|
-
|
|
1160
|
+
dispatchClickEvent("barclick", e.target);
|
|
1152
1161
|
return;
|
|
1153
1162
|
}
|
|
1154
1163
|
|
|
1164
|
+
// outside any plot element
|
|
1155
1165
|
dispatch("axesclick");
|
|
1156
1166
|
}
|
|
1157
1167
|
|
|
@@ -2048,7 +2058,7 @@
|
|
|
2048
2058
|
return child_ctx;
|
|
2049
2059
|
}
|
|
2050
2060
|
|
|
2051
|
-
// (
|
|
2061
|
+
// (55:0) {#if rx !== undefined && ry !== undefined}
|
|
2052
2062
|
function create_if_block$6(ctx) {
|
|
2053
2063
|
let g;
|
|
2054
2064
|
let g_class_value;
|
|
@@ -2069,7 +2079,7 @@
|
|
|
2069
2079
|
|
|
2070
2080
|
attr(g, "class", g_class_value = "series " + /*style*/ ctx[2]);
|
|
2071
2081
|
attr(g, "title", /*title*/ ctx[1]);
|
|
2072
|
-
attr(g, "style", /*barsStyleStr*/ ctx[
|
|
2082
|
+
attr(g, "style", /*barsStyleStr*/ ctx[3]);
|
|
2073
2083
|
},
|
|
2074
2084
|
m(target, anchor) {
|
|
2075
2085
|
insert(target, g, anchor);
|
|
@@ -2079,7 +2089,7 @@
|
|
|
2079
2089
|
}
|
|
2080
2090
|
},
|
|
2081
2091
|
p(ctx, dirty) {
|
|
2082
|
-
if (dirty & /*rx, ry, rw, rh, left*/
|
|
2092
|
+
if (dirty & /*rx, ry, rw, rh, left*/ 241) {
|
|
2083
2093
|
each_value = /*left*/ ctx[0];
|
|
2084
2094
|
let i;
|
|
2085
2095
|
|
|
@@ -2109,6 +2119,10 @@
|
|
|
2109
2119
|
if (dirty & /*title*/ 2) {
|
|
2110
2120
|
attr(g, "title", /*title*/ ctx[1]);
|
|
2111
2121
|
}
|
|
2122
|
+
|
|
2123
|
+
if (dirty & /*barsStyleStr*/ 8) {
|
|
2124
|
+
attr(g, "style", /*barsStyleStr*/ ctx[3]);
|
|
2125
|
+
}
|
|
2112
2126
|
},
|
|
2113
2127
|
d(detaching) {
|
|
2114
2128
|
if (detaching) detach(g);
|
|
@@ -2117,7 +2131,7 @@
|
|
|
2117
2131
|
};
|
|
2118
2132
|
}
|
|
2119
2133
|
|
|
2120
|
-
// (
|
|
2134
|
+
// (57:3) {#each left as v, i}
|
|
2121
2135
|
function create_each_block$3(ctx) {
|
|
2122
2136
|
let rect;
|
|
2123
2137
|
let rect_x_value;
|
|
@@ -2128,28 +2142,28 @@
|
|
|
2128
2142
|
return {
|
|
2129
2143
|
c() {
|
|
2130
2144
|
rect = svg_element("rect");
|
|
2131
|
-
attr(rect, "x", rect_x_value = /*rx*/ ctx[
|
|
2132
|
-
attr(rect, "y", rect_y_value = /*ry*/ ctx[
|
|
2133
|
-
attr(rect, "width", rect_width_value = /*rw*/ ctx[
|
|
2134
|
-
attr(rect, "height", rect_height_value = /*rh*/ ctx[
|
|
2145
|
+
attr(rect, "x", rect_x_value = /*rx*/ ctx[7][/*i*/ ctx[27]]);
|
|
2146
|
+
attr(rect, "y", rect_y_value = /*ry*/ ctx[6][/*i*/ ctx[27]]);
|
|
2147
|
+
attr(rect, "width", rect_width_value = /*rw*/ ctx[5][/*i*/ ctx[27]]);
|
|
2148
|
+
attr(rect, "height", rect_height_value = /*rh*/ ctx[4][/*i*/ ctx[27]]);
|
|
2135
2149
|
},
|
|
2136
2150
|
m(target, anchor) {
|
|
2137
2151
|
insert(target, rect, anchor);
|
|
2138
2152
|
},
|
|
2139
2153
|
p(ctx, dirty) {
|
|
2140
|
-
if (dirty & /*rx*/
|
|
2154
|
+
if (dirty & /*rx*/ 128 && rect_x_value !== (rect_x_value = /*rx*/ ctx[7][/*i*/ ctx[27]])) {
|
|
2141
2155
|
attr(rect, "x", rect_x_value);
|
|
2142
2156
|
}
|
|
2143
2157
|
|
|
2144
|
-
if (dirty & /*ry*/
|
|
2158
|
+
if (dirty & /*ry*/ 64 && rect_y_value !== (rect_y_value = /*ry*/ ctx[6][/*i*/ ctx[27]])) {
|
|
2145
2159
|
attr(rect, "y", rect_y_value);
|
|
2146
2160
|
}
|
|
2147
2161
|
|
|
2148
|
-
if (dirty & /*rw*/
|
|
2162
|
+
if (dirty & /*rw*/ 32 && rect_width_value !== (rect_width_value = /*rw*/ ctx[5][/*i*/ ctx[27]])) {
|
|
2149
2163
|
attr(rect, "width", rect_width_value);
|
|
2150
2164
|
}
|
|
2151
2165
|
|
|
2152
|
-
if (dirty & /*rh*/
|
|
2166
|
+
if (dirty & /*rh*/ 16 && rect_height_value !== (rect_height_value = /*rh*/ ctx[4][/*i*/ ctx[27]])) {
|
|
2153
2167
|
attr(rect, "height", rect_height_value);
|
|
2154
2168
|
}
|
|
2155
2169
|
},
|
|
@@ -2161,7 +2175,7 @@
|
|
|
2161
2175
|
|
|
2162
2176
|
function create_fragment$8(ctx) {
|
|
2163
2177
|
let if_block_anchor;
|
|
2164
|
-
let if_block = /*rx*/ ctx[
|
|
2178
|
+
let if_block = /*rx*/ ctx[7] !== undefined && /*ry*/ ctx[6] !== undefined && create_if_block$6(ctx);
|
|
2165
2179
|
|
|
2166
2180
|
return {
|
|
2167
2181
|
c() {
|
|
@@ -2173,7 +2187,7 @@
|
|
|
2173
2187
|
insert(target, if_block_anchor, anchor);
|
|
2174
2188
|
},
|
|
2175
2189
|
p(ctx, [dirty]) {
|
|
2176
|
-
if (/*rx*/ ctx[
|
|
2190
|
+
if (/*rx*/ ctx[7] !== undefined && /*ry*/ ctx[6] !== undefined) {
|
|
2177
2191
|
if (if_block) {
|
|
2178
2192
|
if_block.p(ctx, dirty);
|
|
2179
2193
|
} else {
|
|
@@ -2200,6 +2214,7 @@
|
|
|
2200
2214
|
let ry;
|
|
2201
2215
|
let rw;
|
|
2202
2216
|
let rh;
|
|
2217
|
+
let barsStyleStr;
|
|
2203
2218
|
let $axesHeight;
|
|
2204
2219
|
let $yLim;
|
|
2205
2220
|
let $axesWidth;
|
|
@@ -2215,9 +2230,6 @@
|
|
|
2215
2230
|
let { title = "" } = $$props;
|
|
2216
2231
|
let { style = "series_rect" } = $$props;
|
|
2217
2232
|
|
|
2218
|
-
// styles for bars and labels
|
|
2219
|
-
const barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`;
|
|
2220
|
-
|
|
2221
2233
|
// multiply width and height values if needed
|
|
2222
2234
|
if (!Array.isArray(left) || !Array.isArray(top) || left.length < 1 || left.length != top.length) {
|
|
2223
2235
|
throw "Rectangles: parameters 'left' and 'top' must be vectors of the same size.";
|
|
@@ -2266,19 +2278,24 @@
|
|
|
2266
2278
|
$$self.$$.update = () => {
|
|
2267
2279
|
if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 6291457) {
|
|
2268
2280
|
// reactive variables for coordinates of data points in pixels
|
|
2269
|
-
$$invalidate(
|
|
2281
|
+
$$invalidate(7, rx = axes.scaleX(left, $xLim, $axesWidth));
|
|
2270
2282
|
}
|
|
2271
2283
|
|
|
2272
2284
|
if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 1589248) {
|
|
2273
|
-
$$invalidate(
|
|
2285
|
+
$$invalidate(6, ry = axes.scaleY(top, $yLim, $axesHeight));
|
|
2274
2286
|
}
|
|
2275
2287
|
|
|
2276
2288
|
if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/ 6295552) {
|
|
2277
|
-
$$invalidate(
|
|
2289
|
+
$$invalidate(5, rw = axes.scaleX(width, $xLim, $axesWidth, true));
|
|
2278
2290
|
}
|
|
2279
2291
|
|
|
2280
2292
|
if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/ 1581056) {
|
|
2281
|
-
$$invalidate(
|
|
2293
|
+
$$invalidate(4, rh = axes.scaleY(height, $yLim, $axesHeight, true));
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
if ($$self.$$.dirty & /*faceColor, borderColor, lineWidth*/ 458752) {
|
|
2297
|
+
// styles for bars and labels
|
|
2298
|
+
$$invalidate(3, barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`);
|
|
2282
2299
|
}
|
|
2283
2300
|
};
|
|
2284
2301
|
|
|
@@ -2286,11 +2303,11 @@
|
|
|
2286
2303
|
left,
|
|
2287
2304
|
title,
|
|
2288
2305
|
style,
|
|
2306
|
+
barsStyleStr,
|
|
2289
2307
|
rh,
|
|
2290
2308
|
rw,
|
|
2291
2309
|
ry,
|
|
2292
2310
|
rx,
|
|
2293
|
-
barsStyleStr,
|
|
2294
2311
|
xLim,
|
|
2295
2312
|
yLim,
|
|
2296
2313
|
axesWidth,
|
|
@@ -2765,7 +2782,7 @@
|
|
|
2765
2782
|
/* src/TextLabels.svelte generated by Svelte v3.46.3 */
|
|
2766
2783
|
|
|
2767
2784
|
function add_css$2(target) {
|
|
2768
|
-
append_styles(target, "svelte-
|
|
2785
|
+
append_styles(target, "svelte-1xvrp9d", "text.svelte-1xvrp9d,text.svelte-1xvrp9d>tspan{dominant-baseline:middle}");
|
|
2769
2786
|
}
|
|
2770
2787
|
|
|
2771
2788
|
function get_each_context$1(ctx, list, i) {
|
|
@@ -2864,7 +2881,7 @@
|
|
|
2864
2881
|
attr(text_1, "y", text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]]);
|
|
2865
2882
|
attr(text_1, "dx", /*dx*/ ctx[5]);
|
|
2866
2883
|
attr(text_1, "dy", /*dy*/ ctx[4]);
|
|
2867
|
-
attr(text_1, "class", "svelte-
|
|
2884
|
+
attr(text_1, "class", "svelte-1xvrp9d");
|
|
2868
2885
|
},
|
|
2869
2886
|
m(target, anchor) {
|
|
2870
2887
|
insert(target, text_1, anchor);
|
package/dist/index.mjs
CHANGED
|
@@ -506,7 +506,7 @@ const get_yaxis_slot_context = ctx => ({});
|
|
|
506
506
|
const get_xaxis_slot_changes = dirty => ({});
|
|
507
507
|
const get_xaxis_slot_context = ctx => ({});
|
|
508
508
|
|
|
509
|
-
// (
|
|
509
|
+
// (338:3) {#if title !== ""}
|
|
510
510
|
function create_if_block_3(ctx) {
|
|
511
511
|
let div;
|
|
512
512
|
|
|
@@ -527,7 +527,7 @@ function create_if_block_3(ctx) {
|
|
|
527
527
|
};
|
|
528
528
|
}
|
|
529
529
|
|
|
530
|
-
// (
|
|
530
|
+
// (339:3) {#if yLabel !== ""}
|
|
531
531
|
function create_if_block_2(ctx) {
|
|
532
532
|
let div;
|
|
533
533
|
let span;
|
|
@@ -551,7 +551,7 @@ function create_if_block_2(ctx) {
|
|
|
551
551
|
};
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
-
// (
|
|
554
|
+
// (340:3) {#if xLabel !== ""}
|
|
555
555
|
function create_if_block_1(ctx) {
|
|
556
556
|
let div;
|
|
557
557
|
let span;
|
|
@@ -575,7 +575,7 @@ function create_if_block_1(ctx) {
|
|
|
575
575
|
};
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
-
// (
|
|
578
|
+
// (368:3) {#if !$isOk}
|
|
579
579
|
function create_if_block$9(ctx) {
|
|
580
580
|
let p;
|
|
581
581
|
|
|
@@ -1135,17 +1135,27 @@ function instance$b($$self, $$props, $$invalidate) {
|
|
|
1135
1135
|
});
|
|
1136
1136
|
|
|
1137
1137
|
// handle click on plot elements and dispatch manual events
|
|
1138
|
+
function dispatchClickEvent(eventName, el) {
|
|
1139
|
+
dispatch(eventName, {
|
|
1140
|
+
seriesTitle: el.parentNode.getAttribute('title'),
|
|
1141
|
+
elementID: el.dataset.id
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1138
1145
|
function handleClick(e) {
|
|
1146
|
+
// scatter plot markers
|
|
1139
1147
|
if (e.target.tagName === "text" && e.target.parentNode.classList.contains("series_scatter")) {
|
|
1140
|
-
|
|
1148
|
+
dispatchClickEvent("markerclick", e.target);
|
|
1141
1149
|
return;
|
|
1142
1150
|
}
|
|
1143
1151
|
|
|
1152
|
+
// bar plot bars
|
|
1144
1153
|
if (e.target.tagName === "rect" && e.target.parentNode.classList.contains("series_bar")) {
|
|
1145
|
-
|
|
1154
|
+
dispatchClickEvent("barclick", e.target);
|
|
1146
1155
|
return;
|
|
1147
1156
|
}
|
|
1148
1157
|
|
|
1158
|
+
// outside any plot element
|
|
1149
1159
|
dispatch("axesclick");
|
|
1150
1160
|
}
|
|
1151
1161
|
|
|
@@ -2042,7 +2052,7 @@ function get_each_context$3(ctx, list, i) {
|
|
|
2042
2052
|
return child_ctx;
|
|
2043
2053
|
}
|
|
2044
2054
|
|
|
2045
|
-
// (
|
|
2055
|
+
// (55:0) {#if rx !== undefined && ry !== undefined}
|
|
2046
2056
|
function create_if_block$6(ctx) {
|
|
2047
2057
|
let g;
|
|
2048
2058
|
let g_class_value;
|
|
@@ -2063,7 +2073,7 @@ function create_if_block$6(ctx) {
|
|
|
2063
2073
|
|
|
2064
2074
|
attr(g, "class", g_class_value = "series " + /*style*/ ctx[2]);
|
|
2065
2075
|
attr(g, "title", /*title*/ ctx[1]);
|
|
2066
|
-
attr(g, "style", /*barsStyleStr*/ ctx[
|
|
2076
|
+
attr(g, "style", /*barsStyleStr*/ ctx[3]);
|
|
2067
2077
|
},
|
|
2068
2078
|
m(target, anchor) {
|
|
2069
2079
|
insert(target, g, anchor);
|
|
@@ -2073,7 +2083,7 @@ function create_if_block$6(ctx) {
|
|
|
2073
2083
|
}
|
|
2074
2084
|
},
|
|
2075
2085
|
p(ctx, dirty) {
|
|
2076
|
-
if (dirty & /*rx, ry, rw, rh, left*/
|
|
2086
|
+
if (dirty & /*rx, ry, rw, rh, left*/ 241) {
|
|
2077
2087
|
each_value = /*left*/ ctx[0];
|
|
2078
2088
|
let i;
|
|
2079
2089
|
|
|
@@ -2103,6 +2113,10 @@ function create_if_block$6(ctx) {
|
|
|
2103
2113
|
if (dirty & /*title*/ 2) {
|
|
2104
2114
|
attr(g, "title", /*title*/ ctx[1]);
|
|
2105
2115
|
}
|
|
2116
|
+
|
|
2117
|
+
if (dirty & /*barsStyleStr*/ 8) {
|
|
2118
|
+
attr(g, "style", /*barsStyleStr*/ ctx[3]);
|
|
2119
|
+
}
|
|
2106
2120
|
},
|
|
2107
2121
|
d(detaching) {
|
|
2108
2122
|
if (detaching) detach(g);
|
|
@@ -2111,7 +2125,7 @@ function create_if_block$6(ctx) {
|
|
|
2111
2125
|
};
|
|
2112
2126
|
}
|
|
2113
2127
|
|
|
2114
|
-
// (
|
|
2128
|
+
// (57:3) {#each left as v, i}
|
|
2115
2129
|
function create_each_block$3(ctx) {
|
|
2116
2130
|
let rect;
|
|
2117
2131
|
let rect_x_value;
|
|
@@ -2122,28 +2136,28 @@ function create_each_block$3(ctx) {
|
|
|
2122
2136
|
return {
|
|
2123
2137
|
c() {
|
|
2124
2138
|
rect = svg_element("rect");
|
|
2125
|
-
attr(rect, "x", rect_x_value = /*rx*/ ctx[
|
|
2126
|
-
attr(rect, "y", rect_y_value = /*ry*/ ctx[
|
|
2127
|
-
attr(rect, "width", rect_width_value = /*rw*/ ctx[
|
|
2128
|
-
attr(rect, "height", rect_height_value = /*rh*/ ctx[
|
|
2139
|
+
attr(rect, "x", rect_x_value = /*rx*/ ctx[7][/*i*/ ctx[27]]);
|
|
2140
|
+
attr(rect, "y", rect_y_value = /*ry*/ ctx[6][/*i*/ ctx[27]]);
|
|
2141
|
+
attr(rect, "width", rect_width_value = /*rw*/ ctx[5][/*i*/ ctx[27]]);
|
|
2142
|
+
attr(rect, "height", rect_height_value = /*rh*/ ctx[4][/*i*/ ctx[27]]);
|
|
2129
2143
|
},
|
|
2130
2144
|
m(target, anchor) {
|
|
2131
2145
|
insert(target, rect, anchor);
|
|
2132
2146
|
},
|
|
2133
2147
|
p(ctx, dirty) {
|
|
2134
|
-
if (dirty & /*rx*/
|
|
2148
|
+
if (dirty & /*rx*/ 128 && rect_x_value !== (rect_x_value = /*rx*/ ctx[7][/*i*/ ctx[27]])) {
|
|
2135
2149
|
attr(rect, "x", rect_x_value);
|
|
2136
2150
|
}
|
|
2137
2151
|
|
|
2138
|
-
if (dirty & /*ry*/
|
|
2152
|
+
if (dirty & /*ry*/ 64 && rect_y_value !== (rect_y_value = /*ry*/ ctx[6][/*i*/ ctx[27]])) {
|
|
2139
2153
|
attr(rect, "y", rect_y_value);
|
|
2140
2154
|
}
|
|
2141
2155
|
|
|
2142
|
-
if (dirty & /*rw*/
|
|
2156
|
+
if (dirty & /*rw*/ 32 && rect_width_value !== (rect_width_value = /*rw*/ ctx[5][/*i*/ ctx[27]])) {
|
|
2143
2157
|
attr(rect, "width", rect_width_value);
|
|
2144
2158
|
}
|
|
2145
2159
|
|
|
2146
|
-
if (dirty & /*rh*/
|
|
2160
|
+
if (dirty & /*rh*/ 16 && rect_height_value !== (rect_height_value = /*rh*/ ctx[4][/*i*/ ctx[27]])) {
|
|
2147
2161
|
attr(rect, "height", rect_height_value);
|
|
2148
2162
|
}
|
|
2149
2163
|
},
|
|
@@ -2155,7 +2169,7 @@ function create_each_block$3(ctx) {
|
|
|
2155
2169
|
|
|
2156
2170
|
function create_fragment$8(ctx) {
|
|
2157
2171
|
let if_block_anchor;
|
|
2158
|
-
let if_block = /*rx*/ ctx[
|
|
2172
|
+
let if_block = /*rx*/ ctx[7] !== undefined && /*ry*/ ctx[6] !== undefined && create_if_block$6(ctx);
|
|
2159
2173
|
|
|
2160
2174
|
return {
|
|
2161
2175
|
c() {
|
|
@@ -2167,7 +2181,7 @@ function create_fragment$8(ctx) {
|
|
|
2167
2181
|
insert(target, if_block_anchor, anchor);
|
|
2168
2182
|
},
|
|
2169
2183
|
p(ctx, [dirty]) {
|
|
2170
|
-
if (/*rx*/ ctx[
|
|
2184
|
+
if (/*rx*/ ctx[7] !== undefined && /*ry*/ ctx[6] !== undefined) {
|
|
2171
2185
|
if (if_block) {
|
|
2172
2186
|
if_block.p(ctx, dirty);
|
|
2173
2187
|
} else {
|
|
@@ -2194,6 +2208,7 @@ function instance$8($$self, $$props, $$invalidate) {
|
|
|
2194
2208
|
let ry;
|
|
2195
2209
|
let rw;
|
|
2196
2210
|
let rh;
|
|
2211
|
+
let barsStyleStr;
|
|
2197
2212
|
let $axesHeight;
|
|
2198
2213
|
let $yLim;
|
|
2199
2214
|
let $axesWidth;
|
|
@@ -2209,9 +2224,6 @@ function instance$8($$self, $$props, $$invalidate) {
|
|
|
2209
2224
|
let { title = "" } = $$props;
|
|
2210
2225
|
let { style = "series_rect" } = $$props;
|
|
2211
2226
|
|
|
2212
|
-
// styles for bars and labels
|
|
2213
|
-
const barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`;
|
|
2214
|
-
|
|
2215
2227
|
// multiply width and height values if needed
|
|
2216
2228
|
if (!Array.isArray(left) || !Array.isArray(top) || left.length < 1 || left.length != top.length) {
|
|
2217
2229
|
throw "Rectangles: parameters 'left' and 'top' must be vectors of the same size.";
|
|
@@ -2260,19 +2272,24 @@ function instance$8($$self, $$props, $$invalidate) {
|
|
|
2260
2272
|
$$self.$$.update = () => {
|
|
2261
2273
|
if ($$self.$$.dirty & /*left, $xLim, $axesWidth*/ 6291457) {
|
|
2262
2274
|
// reactive variables for coordinates of data points in pixels
|
|
2263
|
-
$$invalidate(
|
|
2275
|
+
$$invalidate(7, rx = axes.scaleX(left, $xLim, $axesWidth));
|
|
2264
2276
|
}
|
|
2265
2277
|
|
|
2266
2278
|
if ($$self.$$.dirty & /*top, $yLim, $axesHeight*/ 1589248) {
|
|
2267
|
-
$$invalidate(
|
|
2279
|
+
$$invalidate(6, ry = axes.scaleY(top, $yLim, $axesHeight));
|
|
2268
2280
|
}
|
|
2269
2281
|
|
|
2270
2282
|
if ($$self.$$.dirty & /*width, $xLim, $axesWidth*/ 6295552) {
|
|
2271
|
-
$$invalidate(
|
|
2283
|
+
$$invalidate(5, rw = axes.scaleX(width, $xLim, $axesWidth, true));
|
|
2272
2284
|
}
|
|
2273
2285
|
|
|
2274
2286
|
if ($$self.$$.dirty & /*height, $yLim, $axesHeight*/ 1581056) {
|
|
2275
|
-
$$invalidate(
|
|
2287
|
+
$$invalidate(4, rh = axes.scaleY(height, $yLim, $axesHeight, true));
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
if ($$self.$$.dirty & /*faceColor, borderColor, lineWidth*/ 458752) {
|
|
2291
|
+
// styles for bars and labels
|
|
2292
|
+
$$invalidate(3, barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`);
|
|
2276
2293
|
}
|
|
2277
2294
|
};
|
|
2278
2295
|
|
|
@@ -2280,11 +2297,11 @@ function instance$8($$self, $$props, $$invalidate) {
|
|
|
2280
2297
|
left,
|
|
2281
2298
|
title,
|
|
2282
2299
|
style,
|
|
2300
|
+
barsStyleStr,
|
|
2283
2301
|
rh,
|
|
2284
2302
|
rw,
|
|
2285
2303
|
ry,
|
|
2286
2304
|
rx,
|
|
2287
|
-
barsStyleStr,
|
|
2288
2305
|
xLim,
|
|
2289
2306
|
yLim,
|
|
2290
2307
|
axesWidth,
|
|
@@ -2759,7 +2776,7 @@ class Segments extends SvelteComponent {
|
|
|
2759
2776
|
/* src/TextLabels.svelte generated by Svelte v3.46.3 */
|
|
2760
2777
|
|
|
2761
2778
|
function add_css$2(target) {
|
|
2762
|
-
append_styles(target, "svelte-
|
|
2779
|
+
append_styles(target, "svelte-1xvrp9d", "text.svelte-1xvrp9d,text.svelte-1xvrp9d>tspan{dominant-baseline:middle}");
|
|
2763
2780
|
}
|
|
2764
2781
|
|
|
2765
2782
|
function get_each_context$1(ctx, list, i) {
|
|
@@ -2858,7 +2875,7 @@ function create_each_block$1(ctx) {
|
|
|
2858
2875
|
attr(text_1, "y", text_1_y_value = /*y*/ ctx[6][/*i*/ ctx[29]]);
|
|
2859
2876
|
attr(text_1, "dx", /*dx*/ ctx[5]);
|
|
2860
2877
|
attr(text_1, "dy", /*dy*/ ctx[4]);
|
|
2861
|
-
attr(text_1, "class", "svelte-
|
|
2878
|
+
attr(text_1, "class", "svelte-1xvrp9d");
|
|
2862
2879
|
},
|
|
2863
2880
|
m(target, anchor) {
|
|
2864
2881
|
insert(target, text_1, anchor);
|
package/package.json
CHANGED
package/src/Axes.svelte
CHANGED
|
@@ -277,19 +277,27 @@
|
|
|
277
277
|
ro.observe(axesWrapper);
|
|
278
278
|
});
|
|
279
279
|
|
|
280
|
+
|
|
280
281
|
// handle click on plot elements and dispatch manual events
|
|
282
|
+
function dispatchClickEvent(eventName, el) {
|
|
283
|
+
dispatch(eventName, {seriesTitle: el.parentNode.getAttribute('title'), elementID: el.dataset.id});
|
|
284
|
+
}
|
|
285
|
+
|
|
281
286
|
function handleClick(e) {
|
|
282
287
|
|
|
288
|
+
// scatter plot markers
|
|
283
289
|
if (e.target.tagName === "text" && e.target.parentNode.classList.contains("series_scatter")) {
|
|
284
|
-
|
|
290
|
+
dispatchClickEvent("markerclick", e.target);
|
|
285
291
|
return;
|
|
286
292
|
}
|
|
287
293
|
|
|
294
|
+
// bar plot bars
|
|
288
295
|
if (e.target.tagName === "rect" && e.target.parentNode.classList.contains("series_bar")) {
|
|
289
|
-
|
|
296
|
+
dispatchClickEvent("barclick", e.target);
|
|
290
297
|
return;
|
|
291
298
|
}
|
|
292
299
|
|
|
300
|
+
// outside any plot element
|
|
293
301
|
dispatch("axesclick")
|
|
294
302
|
}
|
|
295
303
|
|
package/src/Rectangles.svelte
CHANGED
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
export let title = "";
|
|
15
15
|
export let style = "series_rect";
|
|
16
16
|
|
|
17
|
-
// styles for bars and labels
|
|
18
|
-
const barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`;
|
|
19
17
|
|
|
20
18
|
// multiply width and height values if needed
|
|
21
19
|
if (!Array.isArray(left) || !Array.isArray(top) || left.length < 1 || left.length != top.length) {
|
|
@@ -48,6 +46,10 @@
|
|
|
48
46
|
$: ry = axes.scaleY(top, $yLim, $axesHeight);
|
|
49
47
|
$: rw = axes.scaleX(width, $xLim, $axesWidth, true);
|
|
50
48
|
$: rh = axes.scaleY(height, $yLim, $axesHeight, true);
|
|
49
|
+
|
|
50
|
+
// styles for bars and labels
|
|
51
|
+
$: barsStyleStr = `fill:${faceColor};stroke:${borderColor};stroke-width: ${lineWidth}px;`;
|
|
52
|
+
|
|
51
53
|
</script>
|
|
52
54
|
|
|
53
55
|
{#if rx !== undefined && ry !== undefined}
|