Chart from JSON

Demonstrates how to use the Builder Api to create a Chart from JSON using SciChart.js. Adjust the JSON in the window below and the chart will re-build. Choose from pre-selected defaults to learn more about the Builder API.

Fullscreen

Edit

 Edit

Docs

drawExample.ts

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

Chart From JSON - JavaScript

Overview

This example demonstrates how to create a chart from a JSON configuration using the SciChart.js Builder API in JavaScript. The purpose is to provide a dynamic and highly customizable charting solution that leverages JSON data to configure series, axes, layout, annotations and more.

Technical Implementation

The example utilizes the Builder API method build2DChart to parse JSON definitions and initialize the chart. The async function handles chart creation and integrates WebAssembly for high-performance rendering, following best practices for asynchronous error handling as outlined in Getting Started with SciChart JS. Dynamic data is generated using JavaScript loops to create series data such as spiraling points, demonstrating practical usage of the Working with Data techniques.

Features and Capabilities

The configuration supports multiple chart types including simple spline line series, dual-axis charts, bubble series, and scatter series with a central axis layout. Advanced customizations are provided via JSON definitions such as gradient fill configurations and annotation settings. The example also showcases the ability to switch between different pre-defined configurations, including a detailed full-featured chart, a simple minimal example, and a central layout configuration as described in the Central Axis Layout documentation.

Integration and Best Practices

By relying solely on JavaScript, the example avoids framework-specific implementations and highlights the simplicity of using the SciChart.js Builder API for dynamic chart configuration. Developers are encouraged to use async/await for clear error handling and to utilize JSON configurations for scalable chart definitions, ensuring maintainability and performance. The approach detailed here aligns with recommended practices for creating modular and efficient charting applications, as emphasized in the Intro to the Builder API and the broader SciChart.js documentation.

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