Skip to main content

Chartlet

Extends

  • Layer

Constructors

Constructor

new Chartlet(glyphUrl): Chartlet

Initializes the Chartlet library with glyphs url

The layer must be added to a leaflet map to initialize the Maplibre GL map

Parameters

glyphUrl

string

URL of the chartx-server glyphs endpoint

Returns

Chartlet

Overrides

L.Layer.constructor

Methods

getChartRegistry()

getChartRegistry(showBasemap?, options?): Promise<ChartRegistry>

Initializes and returns an instance of ChartRegistry from chartx plugin with the given options

Parameters

showBasemap?

boolean = true

Show or hide default basemap

options?

ChartOptions

Options to control chart presentation

Returns

Promise<ChartRegistry>

see ChartRegistry from chartx plugin


getInfoAtLatLng()

getInfoAtLatLng(coords, snapPixels?): QueryResult

Retrieves chart and feature information at the specified coordinates

Parameters

coords

LatLng

Leaflet LatLng coordinate to query

snapPixels?

number = 10

Pixel buffer around the point used for hit detection

Returns

QueryResult

see QueryResult containing matching chart features


onAdd()

onAdd(map): this

Parameters

map

Map

Returns

this

Overrides

L.Layer.onAdd


onChartClick()

onChartClick(callback): object

Registers a callback to be invoked when a chart feature is clicked

The callback is called with a QueryResult containing information about the selected chart feature

Parameters

callback

(info) => void

Function invoked on chart click

Returns

object

An unsubscribe handle to remove the onChartClick listener

unsubscribe

unsubscribe: () => boolean

Returns

boolean


onRemove()

onRemove(map): this

Parameters

map

Map

Returns

this

Overrides

L.Layer.onRemove