Demonstrates interaction by dragging vertical and horizontal line thresholds on a mountain chart. As the thresholds move, the chart colour updates. The vertical mountain fill is done using a separate renderableSeries and a dataFilter which reshapes the data to draw only the portion above the threshold.
This example demonstrates an interactive mountain chart built using JavaScript and SciChart.js. It highlights dynamic interaction by using draggable annotations that adjust both visual thresholds and underlying data filters.
The chart is initialized asynchronously via SciChartSurface.create(), which sets up the WebAssembly context for high-performance rendering. A custom data filter, implemented as the ThresholdFilter class by extending XyFilterBase, processes the data to display only regions above a specified threshold. Additionally, the custom palette provider (XThresholdPaletteProvider) overrides fill colors based on x-values relative to a defined threshold. These components work together to update chart visuals in real time as users interact with the graphic elements. For more details, refer to the Creating a Custom Filter and The PaletteProvider API documentation.
This example includes several advanced features:
onDrag event handlers, enabling dynamic modification of threshold values. See Editable Annotations for additional insights.SciChartSurface.invalidateElement(), ensuring real-time feedback.FastMountainRenderableSeries along with WebGL capabilities and optimized data handling ensures smooth performance even with high data volumes. Developers can explore related techniques in the Performance Tips & Tricks guide.This implementation follows best practices for integrating SciChart.js in a JavaScript environment. The separation of data filtering and visual elements into bespoke components (i.e., ThresholdFilter and XThresholdPaletteProvider) allows for modular, maintainable code. Developers are encouraged to refer to Creating a new SciChartSurface and loading Wasm for more context on initializing the chart with WebAssembly and to leverage interactive modifiers such as ZoomPanModifier, ZoomExtentsModifier, and MouseWheelZoomModifier for an enhanced user experience.

Demonstrates how to place Annotations (lines, arrows, markers, text) over a JavaScript Chart using SciChart.js Annotations API

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

Demonstrates how to place Buy/Sell arrow markers on a JavaScript Stock Chart using SciChart.js - Annotations API

Demonstrates how to edit Annotations (shapes, boxes, lines, text, horizontal and vertical line) over a JavaScript Chart using SciChart.js Annotations API

Demonstrates how to color areas of the chart surface using background Annotations using SciChart.js Annotations API

Demonstrates how layering works a JavaScript Chart using SciChart.js Annotations API

Build Responsive JavaScript HTML Annotations with SciChart. Use the advanced CSS container queries for responsive text layout and custom design. View demo now.

JavaScript HTML Chart Control example demonstrates advanced HTML annotation integration and how to render HTML components within charts. Try the SciChart demo.