You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+146-4Lines changed: 146 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
A GPU/Canvas hybrid Screen-Space Grid Aggregation library for MapLibre GL JS. This library provides efficient real-time aggregation of point data into screen-space grids with customizable styling, interactive features, and advanced glyph drawing capabilities.
6
6
7
-
This library is inspired by Aidan Slingsby's Gridded Glyphmaps and deck.gl's `ScreenGridLayer` but is built from the ground up with a modular architecture, focusing on performance, flexibility, and ease of use.
7
+
This library is inspired by Aidan Slingsby's [Gridded Glyphmaps](https://openaccess.city.ac.uk/id/eprint/31115/) and borrows some basic concepts from deck.gl's [`ScreenGridLayer`](https://deck.gl/docs/api-reference/aggregation-layers/screen-grid-layer), but is built from the ground up with a modular architecture, focusing on performance, flexibility, and ease of use, particularly for MaplibreGL ecosystem.
8
8
9
9

10
10
@@ -14,6 +14,8 @@ This library is inspired by Aidan Slingsby's Gridded Glyphmaps and deck.gl's `Sc
14
14
-**Customizable Styling**: Flexible color scales and cell sizing
15
15
-**Interactive Events**: Hover and click handlers for grid cells
16
16
-**Glyph Drawing**: Custom glyph rendering with Canvas 2D for advanced visualizations
17
+
-**Plugin Ecosystem**: Reusable, named glyph plugins with registry system, lifecycle hooks, and legend integration
18
+
-**Built-in Plugins**: Four ready-to-use plugins (`circle`, `bar`, `pie`, `heatmap`) plus utilities for custom plugins
17
19
-**MapLibre Integration**: Seamless integration with MapLibre GL JS
18
20
-**Performance Optimized**: Uses Canvas 2D rendering for optimal performance
19
21
-**Responsive Design**: Automatically adjusts to map viewport changes
`maplibre-gl` is a peer dependency and is not bundled. In UMD builds, it is expected as a global `maplibregl`.
181
183
## 🎨 Glyph Drawing
182
184
183
-
The library supports custom glyph drawing through the `onDrawCell` callback. This enables rich multivariate visualizations including time series, categorical breakdowns, and complex relationships.
185
+
The library supports custom glyph drawing through the `onDrawCell` callback and a powerful **Plugin Ecosystem** for reusable glyph visualizations. This enables rich multivariate visualizations including time series, categorical breakdowns, and complex relationships.
184
186
185
187
📖 **📚 Comprehensive Guide**: See [docs/GLYPH_DRAWING_GUIDE.md](./docs/GLYPH_DRAWING_GUIDE.md) for detailed documentation on:
186
188
- All built-in glyph utilities (8 types including time series)
@@ -189,7 +191,7 @@ The library supports custom glyph drawing through the `onDrawCell` callback. Thi
189
191
- Time series and spatio-temporal visualization
190
192
- Advanced patterns and best practices
191
193
192
-
### Quick Example
194
+
### Quick Example: Using onDrawCell
193
195
194
196
```javascript
195
197
constgridLayer=newScreenGridLayerGL({
@@ -219,6 +221,115 @@ const gridLayer = new ScreenGridLayerGL({
219
221
});
220
222
```
221
223
224
+
## 🔌 Plugin Ecosystem
225
+
226
+
ScreenGrid includes a **Plugin Ecosystem** that allows you to create reusable, named glyph visualizations. This system provides:
227
+
228
+
-**Built-in Plugins**: Four ready-to-use plugins (`circle`, `bar`, `pie`, `heatmap`)
229
+
-**Plugin Registry**: Register custom plugins by name for reuse across multiple layers
230
+
-**Lifecycle Hooks**: Support for initialization and cleanup
231
+
-**Legend Integration**: Automatic legend generation for plugins
232
+
-**Backward Compatible**: Existing `onDrawCell` callbacks work with highest precedence
233
+
234
+
📖 **📚 Full Documentation**: See [docs/PLUGIN_GLYPH_ECOSYSTEM.md](./docs/PLUGIN_GLYPH_ECOSYSTEM.md) for comprehensive plugin documentation, API reference, and usage patterns.
235
+
236
+
### Using Built-in Plugins
237
+
238
+
```javascript
239
+
import { ScreenGridLayerGL } from'screengrid';
240
+
241
+
// Use a built-in plugin
242
+
constlayer=newScreenGridLayerGL({
243
+
data,
244
+
getPosition: (d) =>d.coordinates,
245
+
glyph:'circle', // Built-in plugin name
246
+
glyphConfig: {
247
+
radius:15,
248
+
color:'#3498db',
249
+
alpha:0.9
250
+
},
251
+
enableGlyphs:true
252
+
});
253
+
```
254
+
255
+
### Available Built-in Plugins
256
+
257
+
1.**`circle`** - Simple filled circle with customizable size, color, and opacity
258
+
2.**`bar`** - Horizontal bar chart showing multiple values side-by-side
259
+
3.**`pie`** - Pie chart showing proportional distribution of values
260
+
4.**`heatmap`** - Circle with color intensity representing normalized values
**Description**: A sophisticated custom plugin that visualizes carbon savings vs. cost comparison across multiple technology categories (ASHP, EV, PV) and cost types (Labour, Material).
249
+
**Description**: A sophisticated custom plugin that visualizes parking capacity data comparing bike racks vs. parking spaces using grouped bars. This plugin demonstrates advanced plugin features including global state management, cross-cell normalization, and interactive hover effects.
250
250
251
251
**Features**:
252
-
- Multivariate data aggregation (carbon and cost values)
253
-
- Category-specific color schemes
254
-
-Dual-axis visualization (carbon for technologies, cost for expenses)
252
+
- Multivariate data aggregation (racks and spaces values)
253
+
- Category-specific color schemes (blue for racks, green for spaces)
254
+
-Global normalization for cross-cell comparison
255
255
- Integrated legend support via `getLegend()` method
256
256
- Lifecycle hooks (`init()` and `destroy()`)
257
+
- Interactive hover effects with comparison outlines
258
+
- Global statistics tracking across all cells
257
259
258
260
**Key Implementation Details**:
259
261
260
262
```javascript
261
263
constGroupedBarGlyph= {
264
+
// Global stats for normalization across all cells
0 commit comments