[D3/AI] Implement Semantic Text Truncation & Pill-Node Geometry #21

Closed
opened 2026-05-08 18:33:01 +00:00 by mjasin · 0 comments
Owner

Context: Graph nodes currently display full sentences or multiple comma-separated terms, causing massive overlap and unreadability.
Role: Data Visualization Specialist.
Task: Refactor knowledgeGraph.js and the LLM extraction logic to enforce concise node labels.
Requirements:

  1. Extraction Constraint: Update the LLM prompt to restrict concept.label to a maximum of 3 words (e.g., "Dependency Injection" instead of full descriptive lists).
  2. Pill Geometry: Render nodes as dynamic SVG <rect> elements with rx="15". The width must automatically adjust to the text length with internal padding.
  3. Text Truncation: In D3, use a truncation function to append "..." if a label exceeds 20 characters, showing the full text only on hover.
  4. Collision Detection: Increase the d3.forceCollide radius to nodeWidth + 20px to ensure physical separation between concept pills.
**Context:** Graph nodes currently display full sentences or multiple comma-separated terms, causing massive overlap and unreadability. **Role:** Data Visualization Specialist. **Task:** Refactor `knowledgeGraph.js` and the LLM extraction logic to enforce concise node labels. **Requirements:** 1. **Extraction Constraint:** Update the LLM prompt to restrict `concept.label` to a maximum of 3 words (e.g., "Dependency Injection" instead of full descriptive lists). 2. **Pill Geometry:** Render nodes as dynamic SVG `<rect>` elements with `rx="15"`. The width must automatically adjust to the text length with internal padding. 3. **Text Truncation:** In D3, use a truncation function to append "..." if a label exceeds 20 characters, showing the full text only on hover. 4. **Collision Detection:** Increase the `d3.forceCollide` radius to `nodeWidth + 20px` to ensure physical separation between concept pills.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mjasin/Nexus.Reader#21