11import * as d3 from 'd3' ;
22import { SimulationNodeDatum , SimulationLinkDatum } from 'd3' ;
3+ import { Collors , Settings } from './settings' ;
34import { convertToCategoryKey } from './utils/string' ;
45
5- /**
6- * Settings for the graph (inlined from deleted settings.ts)
7- */
8- const Settings = {
9- DEFAULT_NODE_SIZE : 5 ,
10- DEFAULT_COLOR : 'TYPE_A' ,
11- } ;
12-
13- const Collors = {
14- TYPE_A : 'red' ,
15- TYPE_B : 'blue' ,
16- TYPE_C : 'green' ,
17- TYPE_D : 'yellow' ,
18- TYPE_E : 'purple' ,
19- TYPE_F : 'orange' ,
20- TYPE_G : 'black' ,
21- TYPE_H : 'white' ,
22- } ;
23-
246export interface Node extends SimulationNodeDatum {
257 id : string ;
268 [ key : string ] : any ; // Additional properties can be added
@@ -245,22 +227,18 @@ function Graph(svg: any, { nodes, links }: { nodes: Node[]; links: Link[] }) {
245227export function renderGraph ( container : HTMLElement , data : GraphData ) : void {
246228 // Validate data before rendering
247229 console . log ( '[NetVis] renderGraph called with data:' , data ) ;
248-
249230 if ( ! data ) {
250231 console . error ( '[NetVis] Error: data is null or undefined' ) ;
251232 throw new Error ( 'GraphData is required' ) ;
252233 }
253-
254234 if ( ! data . nodes ) {
255235 console . error ( '[NetVis] Error: data.nodes is missing' , data ) ;
256236 throw new Error ( 'GraphData must have nodes array' ) ;
257237 }
258-
259238 if ( ! data . links ) {
260239 console . error ( '[NetVis] Error: data.links is missing' , data ) ;
261240 throw new Error ( 'GraphData must have links array' ) ;
262241 }
263-
264242 console . log (
265243 `[NetVis] Rendering ${ data . nodes . length } nodes and ${ data . links . length } links` ,
266244 ) ;
@@ -273,7 +251,6 @@ export function renderGraph(container: HTMLElement, data: GraphData): void {
273251 }
274252 return false ;
275253 } ) ;
276-
277254 if ( missingIds . length > 0 ) {
278255 throw new Error ( `${ missingIds . length } nodes are missing 'id' field` ) ;
279256 }
@@ -289,4 +266,4 @@ export function renderGraph(container: HTMLElement, data: GraphData): void {
289266 Graph ( svg , data ) ;
290267}
291268
292- export default Graph ;
269+ // export default Graph;
0 commit comments