Overview
Interactive diagrams are built using modern web technologies and can provide:- Real-time parameter updates
- Interactive elements (zoom, pan, click)
- Custom animations and transitions
- Complex geometric visualizations
- Industry-specific diagram types
Key Differences from Legacy Diagrams
Interactive vs Legacy Diagrams
Interactive vs Legacy Diagrams
| Feature | Legacy Diagrams | Interactive Diagrams |
|---|---|---|
| Technology | Pre-built widget types | Custom JavaScript/SVG |
| Customization | Limited to parameters | Fully customizable |
| Interactivity | Static display | Interactive elements |
| Development | Template configuration | Code development required |
| Performance | Fast rendering | Optimized for complexity |
| Maintenance | Platform managed | Custom code maintenance |
Development Workflow
Interactive diagrams are developed in separate GitHub repositories and then compiled for use in ClearCalcs templates.Repository Structure
Development Setup
First Time Setup (Mac):
- Install brew: https://brew.sh/
- Run
brew install npmin terminal - Clone the diagram repository
- Run
git pullto get latest version - Navigate to
/staticor/interactivefolder - Run
npm install
Build Process
Implementation in Templates
Interactive diagrams are implemented using the diagram widget with custom types:Multiple Diagram Types
Some repositories contain multiple diagram types, distinguished by thediagramType parameter:
Data Flow Architecture
Interactive Diagram Data Flow
Interactive Diagram Data Flow
The typical data flow for interactive diagrams follows this pattern:
- Initialize:
interface.ts : initialize()- Sets up basic framework - Client Initialize:
interface.ts : clientInitialize()- Creates canvas and loads defaults- Calls
ParamsInterface.ts : defaultParams- Loads default parameters - Calls
render.ts : update()- Renders with default parameters - Calls
getTransformations.ts- Calculates element positioning
- Calls
- Render:
interface.ts : render()- Updates with actual sheet data- Similar flow to clientInitialize but with real parameters
- Clears canvas and re-renders with new data
Shared Components
Interactive diagrams leverage shared components for consistency:SVG Extensions
- Custom SVG elements specific to ClearCalcs
- Reusable geometric shapes and annotations
- Standardized styling and behavior
Utility Functions
- Helper functions for calculations and transformations
- Common geometric operations
- Data formatting and validation
Asset Library
- SVG images for standard components
- Icons and symbols
- Material representations
Testing and Development
Testing Setup:
- Run
npm startto start development server - Run
npm testin a separate terminal - Both must be running simultaneously
- Pass
diagramTypeparameter in test calls - Select diagram type in dropdown when testing
Video Tutorial
For a complete walkthrough of the development workflow: GitHub to Calcs Builder Workflow VideoBest Practices
- Version Control: Always work from the latest repository version
- Testing: Test thoroughly before uploading to template builder
- Documentation: Document parameters and behavior changes
- Performance: Optimize for rendering speed and responsiveness
- Consistency: Use shared components when possible
Example: Atlas Tube Diagrams
The Atlas Tube custom diagrams provide a comprehensive example of interactive diagram implementation:- Repository: custom-diagrams-library
- Multiple Types: Splice and bracket diagrams
- Complex Geometry: Parametric tube connections
- Industry Specific: Tailored for structural steel connections
Interactive diagrams are powerful tools for creating highly specialized visualizations. While they require more development effort than legacy diagrams, they provide unmatched flexibility for complex engineering visualizations.
Interactive diagrams require JavaScript/TypeScript development skills and ongoing maintenance. Consider using legacy diagrams for standard visualizations and reserve interactive diagrams for cases requiring unique functionality.