svelteplot 0.3.6-pr-124.0 → 0.3.6-pr-127.0
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/core/Plot.svelte
CHANGED
|
@@ -519,7 +519,20 @@
|
|
|
519
519
|
{/if}
|
|
520
520
|
</FacetGrid>
|
|
521
521
|
</svg>
|
|
522
|
-
{#if overlay}<div class="plot-overlay">
|
|
522
|
+
{#if overlay}<div class="plot-overlay">
|
|
523
|
+
{@render overlay?.({
|
|
524
|
+
width,
|
|
525
|
+
height,
|
|
526
|
+
options: plotOptions,
|
|
527
|
+
scales: plotState.scales,
|
|
528
|
+
mapXY,
|
|
529
|
+
hasProjection,
|
|
530
|
+
hasExplicitAxisX,
|
|
531
|
+
hasExplicitAxisY,
|
|
532
|
+
hasExplicitGridX,
|
|
533
|
+
hasExplicitGridY
|
|
534
|
+
})}
|
|
535
|
+
</div>{/if}
|
|
523
536
|
</div>
|
|
524
537
|
{#if footer}
|
|
525
538
|
<figcaption class="plot-footer">
|
|
@@ -53,16 +53,16 @@ export function arrowPath(x1, y1, x2, y2, insetStart, insetEnd, headAngle, headL
|
|
|
53
53
|
if (insetEnd) {
|
|
54
54
|
const [x, y] = circleCircleIntersect([cx, cy, r], [x2, y2, insetEnd], sign * Math.sign(insetEnd));
|
|
55
55
|
lineAngle += Math.atan2(y - cy, x - cx) - Math.atan2(y2 - cy, x2 - cx);
|
|
56
|
-
(x2 = x), (y2 = y);
|
|
56
|
+
((x2 = x), (y2 = y));
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
else {
|
|
60
60
|
// For inset straight arrows, offset along the straight line.
|
|
61
61
|
const dx = x2 - x1, dy = y2 - y1, d = Math.hypot(dx, dy);
|
|
62
62
|
if (insetStart)
|
|
63
|
-
(x1 += (dx / d) * insetStart), (y1 += (dy / d) * insetStart);
|
|
63
|
+
((x1 += (dx / d) * insetStart), (y1 += (dy / d) * insetStart));
|
|
64
64
|
if (insetEnd)
|
|
65
|
-
(x2 -= (dx / d) * insetEnd), (y2 -= (dy / d) * insetEnd);
|
|
65
|
+
((x2 -= (dx / d) * insetEnd), (y2 -= (dy / d) * insetEnd));
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
// The angle of the arrow as it approaches the endpoint, and the
|
|
@@ -36,18 +36,18 @@ function bollinger(values, N, K) {
|
|
|
36
36
|
// compute sum and square of sums
|
|
37
37
|
for (let n = Math.min(N - 1, values.length); i < n; ++i) {
|
|
38
38
|
const value = values[i];
|
|
39
|
-
(sum += value), (sumSquared += value ** 2);
|
|
39
|
+
((sum += value), (sumSquared += value ** 2));
|
|
40
40
|
}
|
|
41
41
|
for (let n = values.length, m = bands.length; i < n; ++i) {
|
|
42
42
|
const value = values[i];
|
|
43
|
-
(sum += value), (sumSquared += value ** 2);
|
|
43
|
+
((sum += value), (sumSquared += value ** 2));
|
|
44
44
|
const mean = sum / N;
|
|
45
45
|
const deviation = Math.sqrt((sumSquared - sum ** 2 / N) / (N - 1));
|
|
46
46
|
for (let j = 0; j < K.length; ++j) {
|
|
47
47
|
bands[j][i] = mean + deviation * K[j];
|
|
48
48
|
}
|
|
49
49
|
const value0 = values[i - N + 1];
|
|
50
|
-
(sum -= value0), (sumSquared -= value0 ** 2);
|
|
50
|
+
((sum -= value0), (sumSquared -= value0 ** 2));
|
|
51
51
|
}
|
|
52
52
|
return bands;
|
|
53
53
|
}
|
package/dist/types/plot.d.ts
CHANGED
|
@@ -432,7 +432,12 @@ export type PlotOptions = {
|
|
|
432
432
|
* The overlay snippet is useful for adding a layer of custom HTML markup
|
|
433
433
|
* in front of the SVG body of your plot, e.g. for HTML tooltips.
|
|
434
434
|
*/
|
|
435
|
-
overlay: Snippet
|
|
435
|
+
overlay: Snippet<[{
|
|
436
|
+
width: number;
|
|
437
|
+
height: number;
|
|
438
|
+
options: PlotOptions;
|
|
439
|
+
scales: PlotScales;
|
|
440
|
+
}]>;
|
|
436
441
|
facetAxes: Snippet;
|
|
437
442
|
/**
|
|
438
443
|
* if you set testid, the plot container will get a data-testid attribute which
|