Demonstrates how to add Hoverable Buy/Sell Markers (annotations) and News/Dividend bullets to a JavaScript Stock Chart using SciChart.js, High Performance JavaScript Charts
This example demonstrates how to integrate SciChart.js using JavaScript to create a high performance stock chart that features interactive buy/sell markers and news/dividend annotations. The implementation focuses on asynchronous chart initialization, dynamic annotation management, and performance optimization via WebGL rendering.
The chart is initialized asynchronously using async/await together with Promise.all() to fetch simulated trading data and set up the SciChartSurface. A CategoryAxis is used for displaying dates (see The Category Axis) and NumericAxis represent pricing and additional metrics. Custom SVG-based annotations are created for buy and sell markers, and dynamic hover functionality is implemented via the AnnotationHoverModifier (see Annotation Hover API), which binds event handlers for interactive tooltips. Efficient chart rendering is achieved through WebGL, as detailed in Performance Tips & Tricks.
The example simulates real-time trading actions by dynamically adding annotations based on randomized trading data. It supports advanced multi-axis layout configurations using techniques similar to those described for vertically and horizontally stacked axes. Interactive features such as hoverable annotations provide immediate trade details, and dynamically added news bullets give contextual information, enhancing user engagement. Additionally, the integration of custom SVG strings for marker design showcases how developers can tailor the visual appearance of annotations.
Designed for JavaScript applications, the example cleanly separates the initialization logic in a dedicated function that takes a DOM element as the chart container. This modular approach simplifies lifecycle management and cleanup via a destructor function. Developers are encouraged to follow these best practices, as explained in resources for asynchronous initialization in JavaScript like Sequential promises using async/await in JavaScript to enhance maintainability and performance. Furthermore, the use of custom event subscriptions and dynamic annotation management illustrates best practices for interactive charting solutions.

Discover how to create a JavaScript Candlestick Chart or Stock Chart using SciChart.js. For high Performance JavaScript Charts, get your free demo now.

Easily create JavaScript OHLC Chart or Stock Chart using feature-rich SciChart.js chart library. Supports custom colors. Get your free trial now.

Create a JavaScript Realtime Ticking Candlestick / Stock Chart with live ticking and updating, using the high performance SciChart.js chart library. Get free demo now.

Create a Javascript heatmap chart showing historical orderbook levels using the high performance SciChart.js chart library. Get free demo now.

Create a JavaScript Multi-Pane Candlestick / Stock Chart with indicator panels, synchronized zooming, panning and cursors. Get your free trial of SciChart.js now.

Demonstrating the capability of SciChart.js to create a composite 2D & 3D Chart application. An example like this could be used to visualize Tenor curves in a financial setting, or other 2D/3D data combined on a single screen.

Create a JavaScript Multi-Pane Candlestick / Stock Chart with indicator panels, synchronized zooming, panning and cursors. Get your free trial of SciChart.js now.

Create a JavaScript Depth Chart, using the high performance SciChart.js chart library. Get free demo now.

This demo shows you how to create a <strong>{frameworkName} User Annotated Stock Chart</strong> using SciChart.js. Custom modifiers allow you to add lines and markers, then use the built in serialisation functions to save and reload the chart, including the data and all your custom annotations.

Create an interactive JavaScript trading charts for technical analysis. Trading Drawing Tools Demo, which shows how to use Polylines, Extended Lines, Rays, Channels, Pitchforks, Pitchfans, Fibonnaci Retracements, Measure, Stop Loss and Take Profit chart drawing tools for Technical Analysis.

An example of using JavaScript FreehandDrawingModifier for arbitrary drawing on trading and financial charts. Can be used for drawing trends, arrow, markers, text, etc.