Readonly scaleAdd callback function to be triggered when specified event is fired.
// Example syntax
object.addEventListener('click', (event) => {
console.log(event)
})
Some classes also report extra information about the interacted object with the second parameter:
// Most series share information about interacted data point
series.addEventListener('click', (event, info) => {
console.log(info)
})
Optional third parameter allows registering event handlers that will automatically remove themselves after first trigger:
// Example this listener will only fire once
object.addEventListener('click', (event) => {})
Each class has its own list of supported events.
Some events are from HTML standard (click, pointerdown, etc.),
while others are own events from LightningChart JS (dispose, resize, etc.)
To find what events are available, you can try following:
TypeScript enabled, just write addEventListener and see what possible event types the IDE suggests. These APIs are strongly typed, and even the callback event will be correctly typed.K type parameter extends.Callback function that is triggered when event is fired.
Optional options: LCJSAddEventListenerOptionsOptional extra configuration options.
Permanently destroy the component.
To fully allow Garbage-Collection to free the resources used by the component, make sure to remove any references to the component and its children in application code.
let chart = ...ChartXY()
let axisX = chart.getDefaultAxisX()
// Dispose Chart, and remove all references so that they can be garbage-collected.
chart.dispose()
chart = undefined
axisX = undefined
Object itself for fluent interface
Get bounding box of text in axis coordinates according to current configuration.
The returned value is also widely affected by the overall state of the chart and its axes. If chart state has been changed, waiting for the next animation frame might be necessary before this method would return the correct value.
// Example
requestAnimationFrame(() => {
console.log(textFigure.getBoundingBox())
})
Bounding box as { min: { x: number, y: number }, max: { x: number, y: number } }
Get font of Text.
FontSettings object
Beta
Not to be confused with GlowEffect
Introduced in v7.0. API may be changed according to user feedback and reports.
Remove event listener added using addEventListener.
The expected argument should be the exact same callback function that was supplied using addEventListener:
// Basic example syntax
const listener = () => {}
obj.addEventListener('click', listener)
obj.removeEventListener('click', listener)
// Basic boilerplate of custom interaction when user drags on an object
obj.addEventListener('pointerdown', (eventDown) => {
let prevCoord = eventDown
const handlePointerMove: LCJSInteractionEventListener<'pointermove'> = (eventMove) => {
const delta = { x: eventMove.clientX - prevCoord.clientX, y: eventMove.clientY - prevCoord.clientY }
prevCoord = eventMove
console.log(delta, eventMove.clientX, eventMove.clientY)
}
const handlePointerUp: LCJSInteractionEventListener<'pointerup'> = (eventUp) => {
window.removeEventListener('pointermove', handlePointerMove)
window.removeEventListener('pointerup', handlePointerUp)
}
window.addEventListener('pointermove', handlePointerMove)
window.addEventListener('pointerup', handlePointerUp)
})
Listener that was added using addEventListener.
Set text alignment (which corner of text is position at configured location)
// Example, position text by center
TextFigure.setAlignment({ x: 0, y: 0 })
// Example, position text by center horizontally but bottom vertically
TextFigure.setAlignment({ x: 0, y: -1 })
Object itself.
Alignment, where 0 = center, -1 is left/bottom, +1 is right/top
Set fill style of Text.
Object itself
FillStyle object or mutator to modify existing one
Set font of Text.
Object itself
FontSettings object or mutator to modify existing one
Beta
Not to be confused with GlowEffect
Introduced in v7.0. API may be changed according to user feedback and reports.
Set text location.
Object itself.
Location on axis
Set text margin as pixels. This can be used to tweak Text position with pixel based offsets.
Object itself.
Margins as pixels.
Set mouse interactions enabled or disabled
Object itself for fluent interface
Specifies state of mouse interactions
Set text rotation.
Object itself.
Rotation as degrees.
Set text to display.
Object itself.
Text string to display
Set element visibility.
Object itself.
true when element should be visible and false when element should be hidden.
1 Figure object inside a TextSeries which can house any number of text objects. Created with add