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

graphty-org / graphty-element / 19792929756

30 Nov 2025 02:57AM UTC coverage: 86.308% (+3.9%) from 82.377%
19792929756

push

github

apowers313
docs: fix stories for chromatic

3676 of 4303 branches covered (85.43%)

Branch coverage included in aggregate %.

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

1093 existing lines in 30 files now uncovered.

17371 of 20083 relevant lines covered (86.5%)

7075.46 hits per line

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

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

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

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

15
export class SpectralLayout extends SimpleLayoutEngine {
2✔
16
    static type = "spectral";
2✔
17
    static maxDimensions = 2;
2✔
18
    scalingFactor = 100;
2✔
19
    config: SpectralLayoutConfigType;
20

21
    constructor(opts: SpectralLayoutOpts) {
2✔
22
        super(opts);
×
23
        this.config = SpectralLayoutConfig.parse(opts);
×
24
    }
×
25

26
    static getOptionsForDimension(dimension: 2 | 3): object {
2✔
27
        return {dim: dimension};
×
28
    }
×
29

30
    doLayout(): void {
2✔
31
        this.stale = false;
×
32
        const nodes = (): LayoutNode[] => this._nodes.map((n) => n.id as LayoutNode);
×
33
        const edges = (): LayoutEdge[] => this._edges.map((e) => [e.srcId, e.dstId] as LayoutEdge);
×
34

35
        this.positions = spectralLayout(
×
36
            {nodes, edges},
×
37
            this.config.scale,
×
UNCOV
38
            this.config.center,
×
UNCOV
39
            this.config.dim,
×
UNCOV
40
        );
×
UNCOV
41
    }
×
42
}
2✔
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