@funnest/charts 0.6.17 → 0.6.18
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 +20 -11
- package/dist/objects/types.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2412,6 +2412,25 @@ function drawMain(layer, m) {
|
|
|
2412
2412
|
}
|
|
2413
2413
|
}
|
|
2414
2414
|
if (f.settings.gridVertical) for (const tick of f.timeTicks) p.vLine(tick.x, 0, f.panesHeight, pal.grid);
|
|
2415
|
+
const o = m.objects;
|
|
2416
|
+
const rc = { painter: p, coords: o.coords, palette: pal };
|
|
2417
|
+
const runOverlay = (overlay) => {
|
|
2418
|
+
ctx.save();
|
|
2419
|
+
try {
|
|
2420
|
+
overlay.render(rc);
|
|
2421
|
+
} catch (error) {
|
|
2422
|
+
console.error("[fnc] overlay", error);
|
|
2423
|
+
}
|
|
2424
|
+
ctx.restore();
|
|
2425
|
+
};
|
|
2426
|
+
if (o.overlays.some((x) => x.layer === "below")) {
|
|
2427
|
+
ctx.save();
|
|
2428
|
+
ctx.beginPath();
|
|
2429
|
+
ctx.rect(0, main.top, f.plotWidth, main.height);
|
|
2430
|
+
ctx.clip();
|
|
2431
|
+
for (const overlay of o.overlays) if (overlay.layer === "below") runOverlay(overlay);
|
|
2432
|
+
ctx.restore();
|
|
2433
|
+
}
|
|
2415
2434
|
const hasBars = f.range.to >= f.range.from;
|
|
2416
2435
|
if (hasBars) {
|
|
2417
2436
|
ctx.save();
|
|
@@ -2451,17 +2470,7 @@ function drawMain(layer, m) {
|
|
|
2451
2470
|
ctx.beginPath();
|
|
2452
2471
|
ctx.rect(0, main.top, f.plotWidth, main.height);
|
|
2453
2472
|
ctx.clip();
|
|
2454
|
-
const o
|
|
2455
|
-
const rc = { painter: p, coords: o.coords, palette: pal };
|
|
2456
|
-
for (const overlay of o.overlays) {
|
|
2457
|
-
ctx.save();
|
|
2458
|
-
try {
|
|
2459
|
-
overlay.render(rc);
|
|
2460
|
-
} catch (error) {
|
|
2461
|
-
console.error("[fnc] overlay", error);
|
|
2462
|
-
}
|
|
2463
|
-
ctx.restore();
|
|
2464
|
-
}
|
|
2473
|
+
for (const overlay of o.overlays) if (overlay.layer !== "below") runOverlay(overlay);
|
|
2465
2474
|
o.trading.render(rc, m.bars, o.barIndexAt, (i) => m.timeScale.indexToX(i), o.tradingLabels, badges);
|
|
2466
2475
|
o.drawings.render(rc, badges, m.bars, o.barIndexAt);
|
|
2467
2476
|
ctx.restore();
|
package/dist/objects/types.d.ts
CHANGED
|
@@ -29,6 +29,11 @@ export interface ObjectRenderContext {
|
|
|
29
29
|
*/
|
|
30
30
|
export interface ChartOverlay {
|
|
31
31
|
render(rc: ObjectRenderContext): void;
|
|
32
|
+
/**
|
|
33
|
+
* 'below': painted right after the grid, under the candles and indicators (an order-book
|
|
34
|
+
* heatmap, session shading). Default 'above'.
|
|
35
|
+
*/
|
|
36
|
+
layer?: 'above' | 'below';
|
|
32
37
|
}
|
|
33
38
|
export type ObjectHit = {
|
|
34
39
|
kind: 'drawing';
|