Demonstrates the light and dark theme in SciChart.js, High Performance JavaScript Charts
This example demonstrates how to leverage SciChart.js in a JavaScript environment to initialize and render multiple chart surfaces, each with its own distinct theme. The implementation showcases the use of built-in themes such as Navy (SciChartJsNavyTheme), Light (SciChartJSLightTheme), and Dark (SciChartJSDarkv2Theme) alongside a customTheme created by merging properties from a built-in theme (see IThemeProvider) using the spread operator. This approach is ideal for developers looking to customize chart appearances while maintaining high performance in data visualization projects.
The code uses asynchronous programming with async/await to create multiple chart surfaces concurrently via Promise.all(). Each chart is initialized using the SciChartSurface.create() method, which accepts a theme object (for example, SciChartJsNavyTheme, SciChartJSLightTheme, or a custom theme) and returns a chart instance. Animated line series are rendered using the EAnimationType.Sweep animation option, and annotations (like TextAnnotation with relative coordinate modes) are used to add titles to the charts. For further details on initializing charts with specific themes, see Chart Styling - ThemeManager API, and for asynchronous setup, refer to Getting Started with SciChart JS.
The example illustrates several advanced capabilities including animated line series, custom theming, and efficient resource management through proper clean-up of SciChartSurface instances. The custom theme creation leverages JavaScript’s spread operator to extend a built-in theme with new properties, an approach detailed in Chart Styling - Creating a Custom Theme. Additionally, performance optimization techniques, such as asynchronous surface creation and proper disposal of resources, are important for maintaining optimal performance; more information is available in Performance Tips & Tricks.
This example integrates SciChart.js directly into a JavaScript application without relying on frameworks like React, managing DOM elements and resource disposal explicitly. Developers are encouraged to adopt best practices for memory and resource management, as outlined in the Memory Best Practices documentation, to ensure that chart surfaces are properly disposed of when no longer needed.
By following these techniques, the example provides a comprehensive guide to creating themed, animated, and high-performance charts with SciChart.js using JavaScript.

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

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

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

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

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

Demonstrates dashed line series in JavaScript Charts with SciChart.js

Show data labels on JavaScript Chart. Get your free demo now.

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

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

Demonstrates chart title with different position and alignment options

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.