• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

graphty-org / graphty-element / 15989108794

01 Jul 2025 03:28AM UTC coverage: 78.501% (+0.4%) from 78.121%
15989108794

push

github

apowers313
docs(storybook): add calculated node color example

320 of 435 branches covered (73.56%)

Branch coverage included in aggregate %.

3 of 3 new or added lines in 2 files covered. (100.0%)

10 existing lines in 1 file now uncovered.

2298 of 2900 relevant lines covered (79.24%)

836.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

65.52
/src/layout/CircularLayoutEngine.ts
1
import {circularLayout, Edge as LayoutEdge, Node as LayoutNode} from "@graphty/layout";
1✔
2
import {z} from "zod/v4";
1✔
3

4
import {SimpleLayoutConfig, SimpleLayoutEngine} from "./LayoutEngine";
1✔
5

6
export const CircularLayoutConfig = z.strictObject({
1✔
7
    ... SimpleLayoutConfig.shape,
1✔
8
    scale: z.number().positive().default(1),
1✔
9
    center: z.array(z.number()).length(2).or(z.null()).default(null),
1✔
10
    dim: z.number().default(2),
1✔
11
});
1✔
12
export type CircularLayoutConfigType = z.infer<typeof CircularLayoutConfig>;
13
export type CircularLayoutOpts = Partial<CircularLayoutConfigType>;
14

15
export class CircularLayout extends SimpleLayoutEngine {
1✔
16
    static type = "circular";
1✔
17
    scalingFactor = 80;
1✔
18
    config: CircularLayoutConfigType;
19

20
    constructor(opts: CircularLayoutOpts) {
1✔
21
        super(opts);
1✔
22
        this.config = CircularLayoutConfig.parse(opts);
1✔
23
    }
1✔
24

25
    doLayout(): void {
1✔
UNCOV
26
        this.stale = false;
×
UNCOV
27
        const nodes = (): LayoutNode[] => this._nodes.map((n) => n.id as LayoutNode);
×
UNCOV
28
        const edges = (): LayoutEdge[] => this._edges.map((e) => [e.srcId, e.dstId] as LayoutEdge);
×
29

UNCOV
30
        this.positions = circularLayout(
×
UNCOV
31
            {nodes, edges},
×
UNCOV
32
            this.config.scale,
×
UNCOV
33
            this.config.center,
×
UNCOV
34
            this.config.dim,
×
UNCOV
35
        );
×
UNCOV
36
    }
×
37
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc