Angular Spline Band Chart

Demonstrates how to create a Angular Spline Band Chart or High-Low Fill using SciChart.js, our High Performance JavaScript Chart Software

Fullscreen

Edit

 Edit

Docs

drawExample.ts

angular.ts

stackedMountainChartData.ts

ExampleDataProvider.ts

theme.ts

Copy to clipboard
Minimise
Fullscreen
1import {
2    AxisMarkerAnnotation,
3    EAxisAlignment,
4    ECoordinateMode,
5    EDragMode,
6    EHorizontalAnchorPoint,
7    ELegendOrientation,
8    ELegendPlacement,
9    EllipsePointMarker,
10    FadeAnimation,
11    LegendModifier,
12    MouseWheelZoomModifier,
13    NativeTextAnnotation,
14    NumberRange,
15    NumericAxis,
16    ScaleAnimation,
17    SciChartSurface,
18    SplineBandRenderableSeries,
19    XyyBezierRenderDataTransform,
20    XyyDataSeries,
21    YAxisDragModifier,
22    ZoomExtentsModifier,
23    ZoomPanModifier,
24} from "scichart";
25// import { XyyBezierRenderDataTransform } from "scichart/Charting/Visuals/RenderableSeries/RenderDataTransforms/BezierRenderDataTransform";
26import { ExampleDataProvider } from "../../../ExampleData/ExampleDataProvider";
27import { appTheme } from "../../../theme";
28//import { xValues } from "../StackedMountainChart/data/stackedMountainChartData";
29
30
31export const drawExample = async (rootElement: string | HTMLDivElement) => {
32    
33    // Create a SciChartSurface
34    const { wasmContext, sciChartSurface } = await SciChartSurface.create(rootElement, {
35        theme: appTheme.SciChartJsTheme,
36    });
37
38    // Add an XAxis, YAxis
39    sciChartSurface.xAxes.add(new NumericAxis(wasmContext, { axisAlignment: EAxisAlignment.Top }));
40    sciChartSurface.yAxes.add(
41        new NumericAxis(wasmContext, {
42            axisAlignment: EAxisAlignment.Left,
43            visibleRange: new NumberRange(-1.75, 0.75),
44            backgroundColor: appTheme.VividSkyBlue + "33",
45            labelStyle: { color: appTheme.VividOrange },
46            majorTickLineStyle: { color: appTheme.VividOrange },
47        })
48    );
49    sciChartSurface.yAxes.add(
50        new NumericAxis(wasmContext, {
51            axisAlignment: EAxisAlignment.Right,
52            id: "y2",
53            visibleRange: new NumberRange(-0.9, 1.6),
54            backgroundColor: appTheme.VividPurple + "33",
55            labelStyle: { color: appTheme.VividRed },
56            majorTickLineStyle: { color: appTheme.VividRed },
57        })
58    );
59
60    // The spline bandseries requires a special dataseries type called XyyDataSeries
61    // This stores X, Y1, Y2 point data for the two lines in the band
62    const yData = ExampleDataProvider.getDampedSinewave(0, 0.9, 0, 0.002, 1000, 17);
63    const y1Data = ExampleDataProvider.getDampedSinewave(0, 0.9, 0, 0.002, 1000, 16);
64
65    const xValues: number[] = [];
66    const yValues: number[] = [];
67    const y1Values: number[] = [];
68
69    for (let i = 0; i < 20; i++) {
70        const index = i * 50;
71        xValues.push(yData.xValues[index]);
72        yValues.push(yData.yValues[index]);
73        y1Values.push(y1Data.yValues[index]);
74    }
75
76    // Create the band series and add to the chart
77    const rendSeries = new SplineBandRenderableSeries(wasmContext, {
78        dataSeries: new XyyDataSeries(wasmContext, { xValues, yValues, y1Values, dataSeriesName: "Default Spline" }),
79        strokeThickness: 3,
80        fill: appTheme.VividOrange + "33",
81        fillY1: appTheme.VividSkyBlue + "33",
82        stroke: appTheme.VividOrange,
83        strokeY1: appTheme.VividSkyBlue,
84        interpolationPoints: 20, // Choose the number of points to interpolate for smoothing
85        pointMarker: new EllipsePointMarker(wasmContext, {
86            width: 7,
87            height: 7,
88            fill: appTheme.PaleSkyBlue,
89            stroke: appTheme.VividSkyBlue,
90        }),
91        animation: new ScaleAnimation({ duration: 800, zeroLine: 0, fadeEffect: true }),
92    });
93
94    sciChartSurface.renderableSeries.add(rendSeries);
95
96    const bezierSeries = new SplineBandRenderableSeries(wasmContext, {
97        dataSeries: new XyyDataSeries(wasmContext, {
98            xValues,
99            yValues,
100            y1Values,
101            dataSeriesName: "XyyBezier (Range Restricted)",
102        }),
103        stroke: appTheme.VividPurple,
104        strokeY1: appTheme.VividRed,
105        fill: appTheme.VividPurple + "33",
106        fillY1: appTheme.VividRed + "33",
107        pointMarker: new EllipsePointMarker(wasmContext, {
108            width: 7,
109            height: 7,
110            fill: appTheme.PaleSkyBlue,
111            stroke: appTheme.VividSkyBlue,
112        }),
113        yAxisId: "y2",
114        strokeThickness: 3,
115        interpolationPoints: 20, // Choose the number of points to interpolate for smoothing
116        animation: new ScaleAnimation({ duration: 800, zeroLine: 0, fadeEffect: true }),
117    });
118    const bezierTransform = new XyyBezierRenderDataTransform(
119        bezierSeries,
120        wasmContext,
121        [bezierSeries.drawingProviders[0]],
122        { interpolationPoints: 20, curvature: 0.5 }
123    );
124    bezierSeries.renderDataTransform = bezierTransform;
125    sciChartSurface.renderableSeries.add(bezierSeries);
126
127    const curvatureAnnotation = new AxisMarkerAnnotation({
128        yCoordinateMode: ECoordinateMode.Relative,
129        y1: 0.5,
130        yAxisId: "y2",
131        formattedValue: "Bezier Curvature 0.5",
132        backgroundColor: appTheme.VividPurple,
133        isEditable: true,
134        onDrag: (args) => {
135            bezierTransform.curvature = curvatureAnnotation.y1;
136            curvatureAnnotation.formattedValue = "Bezier Curvature " + curvatureAnnotation.y1.toFixed(2);
137        },
138    });
139    sciChartSurface.annotations.add(curvatureAnnotation);
140
141    sciChartSurface.annotations.add(
142        new NativeTextAnnotation({
143            xCoordinateMode: ECoordinateMode.Relative,
144            yCoordinateMode: ECoordinateMode.Relative,
145            x1: 0.9,
146            y1: 0.9,
147            horizontalAnchorPoint: EHorizontalAnchorPoint.Right,
148            text: "Drag the left or right y axis to overlay and compare the series",
149            fontSize: 16,
150        })
151    );
152
153    // Optional: Add some interactivity modifiers
154    sciChartSurface.chartModifiers.add(
155        new YAxisDragModifier({ dragMode: EDragMode.Panning }),
156        new MouseWheelZoomModifier(),
157        new LegendModifier({
158            orientation: ELegendOrientation.Vertical,
159            placement: ELegendPlacement.TopRight,
160            showCheckboxes: true,
161        })
162    );
163
164    return { wasmContext, sciChartSurface };
165};
166

Angular Spline Band Series Chart Example

Overview

This example demonstrates how to create an Angular Spline Band Chart using SciChart.js. The chart visualizes two spline band series with high-low fills and smooth interpolations, leveraging advanced features such as real-time interactive annotations and multiple Y-axes. The sample is built as an Angular standalone component and utilizes the scichart-angular integration, ensuring seamless embedding of SciChart within an Angular application.

Technical Implementation

The chart is initialized asynchronously by calling the SciChartSurface.create() method, which is integrated within an Angular component. This pattern follows asynchronous initialization best practices, as described in the Getting Started with SciChart JS documentation. The example sets up two NumericAxis (one on the left and a secondary axis on the right) and populates data using the XyyDataSeries to represent two datasets for the spline band. A SplineBandRenderableSeries is configured with custom styling for strokes, fills, and point markers, and enhanced with a ScaleAnimation to provide smooth render transitions. Additionally, a XyyBezierRenderDataTransform is applied to one of the series to perform smooth spline interpolation with adjustable curvature, as referenced in the XyyBezierRenderDataTransform documentation.

Features and Capabilities

The example showcases several key features including the ability to update chart parameters in real time. An interactive AxisMarkerAnnotation is implemented, allowing users to adjust the Bezier curvature dynamically. Furthermore, interactive modifiers such as YAxisDragModifier and MouseWheelZoomModifier enable intuitive mouse-based interactions, enhancing the user experience. Multiple Y-axes are configured with distinct visual styles, allowing users to compare different data ranges side-by-side; additional technical details can be found in the Tutorial 08 - Adding Multiple Axis guide.

Integration and Best Practices

The integration is designed following Angular best practices by implementing a standalone component which encapsulates the SciChart setup. Efficient performance optimization is achieved through asynchronous resource loading and careful memory management, as recommended in the Memory Best Practices | JavaScript Chart Documentation. Developers can further explore interactive chart modifications and custom theming—such as configuring interpolation points and applying custom fill and stroke styles—to create highly responsive and visually appealing charts. The use of interactive modifiers and smooth animations illustrates the powerful capabilities provided by SciChart.js when integrated with Angular.

angular Chart Examples & Demos

See Also: JavaScript Chart Types (39 Demos)

Angular Line Chart | Angular Charts | SciChart.js Demo

Angular Line Chart

Discover how to create a high performance Angular Line Chart with SciChart - the leading JavaScript library. Get your free demo now.

Angular Spline Line Chart | Angular Charts | SciChart.js Demo

Angular Spline Line Chart

Discover how to create a Angular Spline Line Chart with SciChart. Demo includes algorithm for smoother lines. Get your free trial now.

Angular Digital Line Chart | Angular Charts | SciChart.js

Angular Digital Line Chart

Discover how to create a Angular Digital Line Chart with SciChart - your feature-rich JavaScript Chart Library. Get your free demo now.

Angular Band Chart | Angular Charts | SciChart.js Demo

Angular Band Chart

Easily create a Angular Band Chart or High-Low Fill with SciChart - high performance JavaScript Chart Library. Get your free trial now.

Angular Digital Band Chart | Angular Charts | SciChart.js

Angular Digital Band Chart

Learn how to create a Angular Digital Band Chart or High-Low Fill Chart with SciChart's easy-to-follow demos. Get your free trial today.

Angular Bubble Chart | Online JavaScript Chart Examples

Angular Bubble Chart

Create a high performance Angular Bubble Chart with Sci-Chart. Demo shows how to draw point-markers at X,Y locations. Get your free demo now.

Angular Candlestick Chart | Online JavaScript Chart Examples

Angular Candlestick Chart

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

Angular Column Chart | Angular Charts | SciChart.js Demo

Angular Column Chart

Angular Column Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Population Pyramid | Angular Charts | SciChart.js

Angular Population Pyramid

Population Pyramid of Europe and Africa

Angular Error Bars Char | Angular Charts | SciChart.js Demo

Angular Error Bars Chart

Create Angular Error Bars Chart using high performance SciChart.js. Display uncertainty or statistical confidence of a data-point. Get free demo now.

Angular Impulse Chart | Angular Charts | SciChart.js Demo

Angular Impulse Chart

Easily create Angular Impulse Chart or Stem Chart using SciChart.js - our own high performance JavaScript Chart Library. Get your free trial now.

Angular Text Chart | Angular Charts | SciChart.js Demo

Angular Text Chart

Create Angular Text Chart with high performance SciChart.js.

Angular Fan Chart | Angular Charts | SciChart.js Demo

Angular Fan Chart

Discover how to create Angular Fan Chart with SciChart. Zoom in to see the detail you can go to using our JavaScript Charts. Get your free demo today.

Angular Heatmap Chart | Angular Charts | SciChart.js Demo

Angular Heatmap Chart

Easily create a high performance Angular Heatmap Chart with SciChart. Get your free trial of our 5-star rated JavaScript Chart Component today.

Angular Non Uniform Heatmap Chart | SciChart.js Demo

Angular Non Uniform Heatmap Chart

Create Angular Non Uniform Chart using high performance SciChart.js. Display Heatmap with variable cell sizes. Get free demo now.

Angular Heatmap Chart With Contours | SciChart.js Demo

Angular Heatmap Chart With Contours Example

Design a highly dynamic Angular Heatmap Chart With Contours with SciChart's feature-rich JavaScript Chart Library. Get your free demo today.

NEW!
Angular Map Chart with Heatmap overlay | SciChart.js Demo

Angular Map Chart with Heatmap overlay

Design a highly dynamic Angular Map Chart with Heatmap overlay with SciChart's feature-rich JavaScript Chart Library. Get your free demo today.

Angular Mountain Chart | Angular Charts | SciChart.js Demo

Angular Mountain Chart

Create Angular Mountain Chart with SciChart.js. Zero line can be zero or a specific value. Fill color can be solid or gradient as well. Get a free demo now.

Angular Spline Mountain Chart | Angular Charts | SciChart.js

Angular Spline Mountain Chart

Angular Spline Mountain Chart design made easy. Use SciChart.js' JavaScript Charts for high performance, feature-rich designs. Get free demo now.

Angular Digital Mountain Chart | Angular Charts | SciChart.js

Angular Digital Mountain Chart

Create Angular Digital Mountain Chart with a stepped-line visual effect. Get your free trial of SciChart's 5-star rated JavaScript Chart Component now.

Angular Realtime Mountain Chart | View Online At SciChart

Angular Realtime Mountain Chart

Angular Realtime Mountain Chart made easy. Add animated, real-time updates with SciChart.js - high performance JavaScript Charts. Get free trial now.

Angular Scatter Chart | Angular Charts | SciChart.js Demo

Angular Scatter Chart

Create Angular Scatter Chart with high performance SciChart.js. Easily render pre-defined point types. Supports custom shapes. Get your free trial now.

Angular Stacked Column Chart | Online JavaScript Charts

Angular Stacked Column Chart

Discover how to create a Angular Stacked Column Chart using our feature-rich JavaScript Chart Library, SciChart.js. Get your free demo today!

Angular Stacked Group Column Chart | View Examples Now

Angular Stacked Column Side by Side

Design Angular Stacked Group Column Chart side-by-side using our 5-star rated JavaScript Chart Framework, SciChart.js. Get your free demo now.

Angular Stacked Mountain Chart | Angular Charts | SciChart.js

Angular Stacked Mountain Chart

Design a high performance Angular Stacked Mountain Chart with SciChart.js - your one-stop JavaScript chart library. Get free demo now to get started.

Angular Smooth Stacked Mountain Chart | SciChart.js Demo

Angular Smooth Stacked Mountain Chart

Design a high performance Angular Stacked Mountain Chart with SciChart.js - your one-stop JavaScript chart library. Get free demo now to get started.

Angular Pie Chart | Angular Charts | SciChart.js Demo

Angular Pie Chart

Easily create and customise a high performance Angular Pie Chart with 5-star rated SciChart.js. Get your free trial now to access the whole library.

Angular Donut Chart | Angular Charts | SciChart.js Demo

Angular Donut Chart

Create Angular Donut Chart with 5-star rated SciChart.js chart library. Supports legends, text labels, animated updates and more. Get free trial now.

Angular Linear Gauges | Angular Charts | SciChart.js Demo

Angular Linear Gauges Example

View the Angular Linear Gauge Chart example to combine rectangles & annotations. Create a linear gauge dashboard with animated indicators and custom scales.

Angular Quadrant Chart using Background Annotations

Angular Quadrant Chart using Background Annotations

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

Angular Histogram Chart | Angular Charts | SciChart.js Demo

Angular Histogram Chart

Create an Angular Histogram Chart with custom texture fills and patterns. Try the SciChartAngular wrapper component for seamless Angular integration today.

Angular Gantt Chart | Angular Charts | SciChart.js Demo

Angular Gantt Chart Example

Build an Angular Gantt Chart with SciChart. View the demo for horizontal bars, rounded corners and data labels to show project timelines and task completion.

Angular Choropleth Map | Angular Charts | SciChart.js Demo

Angular Choropleth Map Example

Create an Angular Choropleth map, a type of thematic map where areas are shaded or patterned in proportion to the value of a variable being represented.

Angular Multi-Layer Map | Angular Charts | SciChart.js Demo

Angular Multi-Layer Map Example

Create a Angular Multi-Layer Map Example, using FastTriangleRenderableSeries with GeoJSON data-points using a constrained delaunay triangulation algorithm.

Angular Vector Field Plot | Angular Charts | SciChart.js Demo

Angular Vector Field Plot

View the Angular Vector Field Plot example from SciChart, including dynamic vector generation, gradient-colored segments, and interactive zoom/pan. Try demo.

Angular Waterfall Chart | Bridge Chart | SciChart.js Demo

Angular Waterfall Chart | Bridge Chart

Build an Angular Waterfall Chart with dynamic coloring, multi-line data labels & responsive design, using ScichartAngular component for seamless integration

Angular Box Plot Chart | Angular Charts | SciChart.js Demo

Angular Box Plot Chart

Try the Angular Box Plot Chart example for Angular-friendly chart lifecycle management, dynamic sub-surface positioning, and custom styling. Try the demo now.

Angular Triangle Series | Triangle Mesh Chart | SciChart

Angular Triangle Series | Triangle Mesh Chart

Create Angular Triangle Meshes with the Triangle Series from SciChart. This demo supports strip mode, list mode and the drawing of polygons. View the example.

Angular Treemap Chart | Angular Charts | SciChart.js Demo

Angular Treemap Chart

Create an Angular Treemap Chart to define rectangle positions based on total value. Use SciChart FastRectangleRenderableSeries and d3-hierarchy.js layouts.

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