Introduction
The jQuery Odontogram plugin is a powerful dental charting system that provides an interactive canvas-based interface for creating and managing dental odontograms. It renders tooth diagrams and supports various dental treatments and conditions through a shape-based rendering system.Core Concepts
The plugin is built on several key architectural concepts:Canvas-Based Rendering
The odontogram uses HTML5 Canvas for rendering all visual elements. This provides:- High-performance rendering of complex tooth diagrams
- Precise control over drawing operations
- Support for multiple rendering layers
- Export capabilities via canvas data URLs
Treatment Mode System
The plugin operates on a mode-based system where each dental treatment or condition has a corresponding mode constant (e.g.,ODONTOGRAM_MODE_AMF, ODONTOGRAM_MODE_CARIES). Users interact with the odontogram by:
- Setting a treatment mode using
setMode() - Clicking on tooth surfaces to apply treatments
- The plugin automatically handles rendering and geometry management
Geometry Storage
Treatments are stored as geometry objects that contain:- Vertices: Coordinate points defining the shape
- Name: Treatment type identifier
- Position: Surface location on the tooth
- Layer: Annotation layer (pre-existing or required)
- Options: Rendering options like colors and styles
Shape Classes
The plugin uses JavaScript classes to represent different dental treatments. Each shape class implements arender() method that draws to the canvas context.
Base Shape Classes
Shape Categories
Shapes are categorized by their rendering approach: Surface Fill Shapes- Fill entire tooth surfaces with colors
- Examples:
CARIES,CARIES_UNTREATABLE,RES,FIS - Render in background layer
- Draw text symbols on surfaces
- Examples:
AMF(/A),COF(/Ob),INC(I),SIL(/S) - Render in foreground layer
- Apply to entire tooth, not individual surfaces
- Examples:
MIS(X),UNE(X),RCT(▼)
- Draw borders or special markers
- Examples:
FMC(square border),POC(circle)
Rendering System
The plugin uses a two-layer rendering system:Layer 1: Background (Painting Functions)
These shapes render first, behind everything else:RES- Restoration fillCARIES- Caries fillCARIES_UNTREATABLE- Untreatable cariesFIS- Fissure sealantPolygon- Custom polygons
Layer 2: Foreground (Symbols and Markers)
All other treatments render on top:- Text-based symbols (AMF, COF, INC, etc.)
- Structural markers (FMC, POC, BRIDGE)
- Whole tooth markers (MIS, UNE, RCT)
Rendering Order
Main Components
Odontogram Class
The main class that manages the entire odontogram:Tooth Coordinate System
Each tooth is mapped with precise coordinates for its surfaces:Event System
The plugin handles mouse events for user interaction:- mousemove: Shows hover effects on tooth surfaces
- click: Applies the current mode’s treatment to clicked surface
- change: Fires when geometry is modified (custom jQuery event)
Layer System
The plugin supports a dual-layer annotation system:- Pre-existing layer (
pre): Red color (#FF0000) - Required layer (
req): Blue color (#0066FF)
CARIES_UNTREATABLE) maintain fixed colors regardless of layer.
Next Steps
Initialization
Learn how to initialize and configure the plugin
Methods
Explore available plugin methods
Treatment Codes
View all treatment mode constants