Overview
The diagram editor provides:- Drawing tools: lines, polylines, text, and images
- Image library with pre-loaded equipment icons
- Live variable integration with tooltips
- Layer management (bring to front/send to back)
- Zoom and pan capabilities
- Save/load functionality
Accessing the Diagram Editor
Understanding the Interface
The diagram editor (src/modules/DrawDiagram/views/DrawDiagram.jsx) consists of:Top Navbar
Controls for diagram-level actions:- Clear: Remove all elements from canvas
- Save: Save diagram to database
- Undo: Remove last added element
- Send to Back: Move selected element behind others
- Bring to Front: Move selected element to top layer
- Zoom In/Out: Adjust canvas zoom level
- Pan Mode: Toggle panning mode
Left Sidebar
Drawing tools and options:- Image: Add images from library
- Line: Draw straight lines
- Polyline: Draw multi-segment lines
- Text: Add text labels
- Floating Variable: Add variable display
- Delete: Remove selected element
Main Canvas
The interactive drawing area where you create your diagram.Right Panels
Context-sensitive panels that appear based on selection:- Image Selector: Choose from image library
- Line Style Panel: Configure line appearance
- Text Styler: Format text properties
- Tooltip Position Panel: Configure variable display
Drawing Lines
Select Line Tool
Click the line tool button in the left sidebar. The line style panel opens automatically.
Configure Line Style
In the Line Style Panel:
- Color: Choose line color using color picker
- Stroke Width: Set line thickness (pixels)
- Dash Pattern: Select solid or dashed style
Draw the Line
- Click on the canvas at the starting point
- Move mouse to endpoint (you’ll see a preview)
- Click again to complete the line
Drawing Polylines
Polylines allow multi-segment paths:Polylines require at least 2 vertices (4 points in the points array) to be saved. Press Escape to cancel if you haven’t placed enough points.
Adding Images
Open Image Selector
Click the image tool in the sidebar. The image selector panel opens with available images.
Browse Image Library
The library (src/modules/DrawDiagram/utils/js/ListImg.js) contains equipment icons organized by category:
- Pumps and motors
- Valves and controls
- Tanks and vessels
- Sensors and instruments
Select Image
Click on an image to add it to the canvas. It appears at position (150, 150) by default.
Adding Text Labels
Format Text (Optional)
Click the text styler button to configure:
- Font Size: Size in pixels
- Fill Color: Text color
- Font Style: Normal, bold, or italic
Associating Variables with Elements
Adding Variable to Image
Choose Variable
Select an InfluxDB variable from the list. The variable will display near the image.
Configure Tooltip Position
The Tooltip Position Panel opens. Configure:
- Position: Centro, Arriba, Abajo, Izquierda, Derecha
- Show/Hide: Toggle variable visibility
- Max Value: Set scale maximum (for gauges)
- Boolean Colors: Configure colors for true/false states
- Binary Bit: Specify bit position for binary variables
Adding Floating Variable
Element Manipulation
Selecting Elements
- Click any element to select it
- Selected elements show transformation handles
- Selection enables context-specific panels
Moving Elements
Deleting Elements
Layer Management
Zoom and Pan
Zooming
Zoom is controlled by a scale factor:- Zoom In: Multiplies scale by 1.05
- Zoom Out: Divides scale by 1.05
Panning
Saving Diagrams
What Gets Saved
The save operation (src/modules/DrawDiagram/views/DrawDiagram.jsx:192-250) stores:When editing existing diagrams, only new elements have their IDs cleared before saving. Existing elements retain their IDs to enable proper updates.
Viewing Diagrams
Navigate to View Mode
From the diagrams list at
/config/diagram, click the view button to open /viewDiagram/{id}.Keyboard Shortcuts
Efficient diagram creation with keyboard shortcuts:| Shortcut | Action |
|---|---|
| Escape | Cancel current tool / Close panels |
| Delete | Delete selected element |
| Enter | Finish polyline / Save text |
| Right-click | Finish polyline |
Best Practices
Diagram Organization
- Use layers strategically (backgrounds behind, important elements in front)
- Group related elements visually
- Use consistent colors for similar element types
- Label important components with text
Variable Integration
- Position variable tooltips to avoid overlapping elements
- Use meaningful positions (e.g., above for overhead displays)
- Configure boolean colors to match standard conventions (green=on, red=off)
- Set appropriate max values for gauge-style displays
Performance
- Limit the number of elements in complex diagrams (< 100 recommended)
- Use simple images when possible (smaller file sizes)
- Avoid excessive polyline vertices
Naming
- Use descriptive diagram names that indicate the system or area
- Include version numbers if maintaining multiple iterations
- Document what the diagram represents in the name
Troubleshooting
Element not appearing- Check that element is not hidden behind others (use Bring to Front)
- Verify element is within visible canvas area
- Check zoom level - element may be very small or large
- Ensure element is selected (shows transformation handles)
- Try selecting by clicking the element directly
- Press Delete key rather than using menu
- Ensure you have at least 2 vertices placed
- Press Enter or right-click to complete
- Press Escape to cancel if needed
- Verify variable exists in InfluxDB
- Check that variable is receiving data
- Ensure variable visibility is enabled in Tooltip Position Panel
- Ensure you’ve entered a diagram name
- Check browser console for errors
- Verify backend API connectivity
- Diagrams are only saved when you click Save
- No auto-save functionality exists
- Save frequently during creation
Advanced Features
Background Configuration
Diagrams support:- Background Color: Set via
diagramMetadata.backgroundColor - Background Image: Set via
diagramMetadata.backgroundImg

