class
ClassBreaksRenderer
implements IRenderer
Assigns symbols based on numeric ranges. Use for quantitative data (e.g. population, elevation, speed).
Constructor
new ClassBreaksRenderer(options: ClassBreaksRendererOptions) | Parameter | Type | Description | |
|---|---|---|---|
options | ClassBreaksRendererOptions | required | Renderer configuration |
ClassBreaksRendererOptions
| Field | Type | Description | |
|---|---|---|---|
field | string | required | Numeric attribute field name |
defaultSymbol | Symbol | required | Fallback symbol when no range matches |
breaks | ClassBreakInfo[] | required | Array of { min, max, symbol } definitions |
Properties
| Name | Type | Access | Description |
|---|---|---|---|
type | 'class-breaks' | readonly | Renderer type discriminant |
field | string | readonly | Numeric field name |
defaultSymbol | Symbol | readonly | Fallback symbol |
breaks | readonly ClassBreakInfo[] | readonly | Immutable break definitions |
Methods
getSymbol()
getSymbol(feature: Feature, context?: SymbolRenderContext): Symbol Classify numeric value into range and return matching symbol.
Returns
Symbol Example
const renderer = new ClassBreaksRenderer({
field: 'population',
defaultSymbol: { type: 'simple-marker', color: [128,128,128,255], size: 4 },
breaks: [
{ min: 0, max: 100000, symbol: { type: 'simple-marker', color: [0,200,0,255], size: 6 } },
{ min: 100000, max: 1000000, symbol: { type: 'simple-marker', color: [255,200,0,255], size: 10 } },
{ min: 1000000, max: Infinity, symbol: { type: 'simple-marker', color: [255,0,0,255], size: 14 } },
],
});