Data Labels

Shows how you can add Data Labels to a chart using SciChart.js

Fullscreen

Edit

 Edit

Docs

drawExample.ts

Copy to clipboard
Minimise
Fullscreen
1// Loading ... 

Data Labels - JavaScript

Overview

This example demonstrates advanced customization of data labels in a SciChart.js chart using JavaScript. The implementation sets up a SciChartSurface with numeric axes and multiple renderable series to showcase how dynamic label styling and metadata-driven text labels can enhance data visualization.

Technical Implementation

The chart is constructed by first creating a SciChartSurface and adding numeric X and Y axes. Three renderable series are configured: a column series with dynamic label colors using a custom function in the DataLabelProvider, a spline series that extracts label text from metadata via a custom metaDataSelector (see Getting Labels from Metadata), and a line series that conditionally displays labels only at peak values using a customized getText function as detailed in Custom DataLabel Formatting with getText(). Interactive modifiers such as ZoomPanModifier, ZoomExtentsModifier, and MouseWheelZoomModifier are incorporated to enable smooth zooming and panning, which can be explored further in Adding Zooming, Panning Behavior.

Features and Capabilities

The example illustrates several advanced features including conditional label styling based on data values, metadata-driven labels, and performance optimizations achieved by showing labels only when there is sufficient space. In addition, custom point markers like EllipsePointMarker are used to clearly highlight data points. Dynamic color styling is applied using the parseColorToUIntArgb() function, aligning with techniques described in Data Label Colouring.

Integration and Best Practices

This implementation adheres to best practices in resource management by encapsulating chart creation within an asynchronous function that returns a cleanup mechanism for disposing of the SciChartSurface. Developers leveraging JavaScript can refer to the Getting Started with SciChart JS guide to understand proper initialization and disposal of chart resources. The example’s modular approach ensures that chart configuration remains maintainable and scalable while enabling advanced interactive visualization through integrated chart modifiers.

javascript Chart Examples & Demos

See Also: Styling and Theming (11 Demos)

Chart Background Image with Transparency | SciChart.js

Chart Background Image with Transparency

Demonstrates how to create a JavaScript Chart with background image using transparency in SciChart.js

Styling a JavaScript Chart in Code | SciChart.js Demo

Styling a JavaScript Chart in Code

Demonstrates how to style a JavaScript Chart entirely in code with SciChart.js themeing API

Using Theme Manager in JavaScript Chart | SciChart.js

Using Theme Manager in JavaScript Chart

Demonstrates our Light and Dark Themes for JavaScript Charts with SciChart.js ThemeManager API

Create a Custom Theme for JavaScript Chart | SciChart.js

Create a Custom Theme for JavaScript Chart

Demonstrates how to create a Custom Theme for a SciChart.js JavaScript Chart using our Theming API

Coloring Series per-point using the PaletteProvider

Coloring Series per-point using the PaletteProvider

Demonstrates per-point coloring in JavaScript chart types with SciChart.js PaletteProvider API

JavaScript Point-Markers Chart | Javascript Charts | SciChart.js

JavaScript Point-Markers Chart

Demonstrates the different point-marker types for JavaScript Scatter charts (Square, Circle, Triangle and Custom image point-marker)

Dashed Line Styling | Javascript Charts | SciChart.js Demo

Dashed Line Styling

Demonstrates dashed line series in JavaScript Charts with SciChart.js

JavaScript Chart with Multi-Style Series | SciChart.js

JavaScript Chart with Multi-Style Series

Demonstrates how to apply multiple different styles to a single series using RenderDataTransform

JavaScript Chart with lines split by thresholds | SciChart

JavaScript Chart with lines split by thresholds

Demonstrates how to use a RenderDataTransform to split lines into multiple segments so they can be individually colored according to thresholds

JavaScript Chart Title | Javascript Charts | SciChart.js Demo

JavaScript Chart Title

Demonstrates chart title with different position and alignment options

NEW!
JavaScript Order of Rendering | Javascript Charts | SciChart.js

JavaScript Order of Rendering Example

The JavaScript Order of Rendering example gives you full control of the draw order of series and annotations for charts. Try SciChart's advanced customizations.

SciChart Ltd, 16 Beaufort Court, Admirals Way, Docklands, London, E14 9XL.