Angular Non Uniform Heatmap Chart

This SciChart demo demonstrates how to create a Angular Non Uniform Heatmap Chart using SciChart.js our High Performance JavaScript Chart component.

Fullscreen

Edit

 Edit

Docs

drawExample.ts

angular.ts

theme.ts

Copy to clipboard
Minimise
Fullscreen
1import { appTheme } from "../../../theme";
2import {
3    HeatmapColorMap,
4    MouseWheelZoomModifier,
5    NumericAxis,
6    NonUniformHeatmapDataSeries,
7    NonUniformHeatmapRenderableSeries,
8    NumberRange,
9    PinchZoomModifier,
10    SciChartSurface,
11    ZoomExtentsModifier,
12    ZoomPanModifier,
13} from "scichart";
14
15export const drawExample = async (rootElement: string | HTMLDivElement) => {
16    // Create a SciChartSurface with Theme
17    const { sciChartSurface, wasmContext } = await SciChartSurface.create(rootElement, {
18        theme: appTheme.SciChartJsTheme,
19    });
20
21    // Create an X, Y Axis
22    sciChartSurface.xAxes.add(new NumericAxis(wasmContext, { growBy: new NumberRange(0.1, 0.1) }));
23    sciChartSurface.yAxes.add(new NumericAxis(wasmContext, { growBy: new NumberRange(0.1, 0.1) }));
24
25    // Create some data for the heatmap as a 2d array
26    const heatmapWidth = 7;
27    const heatmapHeight = 4;
28    const zValues = Array.from(Array(heatmapHeight));
29    zValues.forEach((row, index, collection) => {
30        collection[index] = Array.from(Array(heatmapWidth));
31    });
32    let maxValue = Number.MIN_VALUE;
33    for (let x = 0; x < heatmapWidth; x++) {
34        for (let y = 0; y < heatmapHeight; y++) {
35            zValues[y][x] = 3.5 * ((heatmapHeight - y) * (heatmapWidth - x));
36            maxValue = Math.max(maxValue, zValues[y][x]);
37        }
38    }
39
40    // arrays with cell offsets
41    const xRangeOffsetsSource = [0, 10, 20, 26, 36, 60, 72, 84];
42    const yRangeOffsetsSource = [100, 250, 390, 410, 600];
43
44    // mapping functions that will calculate cell offsets based on heatmap width and height (zValues dimension sizes)
45    const xCellOffsets = (i: number) => xRangeOffsetsSource[i];
46    const yCellOffsets = (i: number) => yRangeOffsetsSource[i];
47
48    // Create the NonUniform Heatmap Series
49    const heatmapSeries = new NonUniformHeatmapRenderableSeries(wasmContext, {
50        // DataSeries defines data. This contains zValues 2D array plus the x and y cell offsets
51        dataSeries: new NonUniformHeatmapDataSeries(wasmContext, { zValues, xCellOffsets, yCellOffsets }),
52        // Color map defines how heatmap cells map to colours between minimum & maximum
53        colorMap: new HeatmapColorMap({
54            minimum: 0,
55            maximum: 100,
56            gradientStops: [
57                { offset: 0, color: appTheme.DarkIndigo },
58                { offset: 0.2, color: appTheme.Indigo },
59                { offset: 0.3, color: appTheme.VividSkyBlue },
60                { offset: 0.5, color: appTheme.VividGreen },
61                { offset: 0.7, color: appTheme.MutedRed },
62                { offset: 0.9, color: appTheme.VividOrange },
63                { offset: 1, color: appTheme.VividPink },
64            ],
65        }),
66        // optional settings
67        opacity: 0.77,
68        // values outside of the colorMap.min/max will be filled with the colours at edge of the colormap
69        fillValuesOutOfRange: true,
70        // add datalabels to the cells of the heatmap
71        dataLabels: {
72            style: {
73                fontFamily: "Arial",
74                fontSize: 16,
75            },
76            color: appTheme.ForegroundColor,
77        },
78    });
79
80    sciChartSurface.renderableSeries.add(heatmapSeries);
81
82    // add some interactivity
83    sciChartSurface.chartModifiers.add(
84        new ZoomPanModifier({ enableZoom: true }),
85        new ZoomExtentsModifier(),
86        new MouseWheelZoomModifier()
87    );
88
89    return { sciChartSurface };
90};
91

Angular Non Uniform Heatmap Chart

Overview

This example demonstrates how to integrate SciChart.js into an Angular application using a standalone Angular component. The chart visualizes data with a non uniform heatmap where each cell can have variable sizes and offsets. It leverages Angular’s input binding to pass an initialization function to the ScichartAngularComponent, ensuring a smooth integration and dynamic chart creation.

Technical Implementation

The implementation is centered around the drawExample function which creates a SciChartSurface with a specific theme and performance optimizations provided via the WebAssembly context (wasmContext). Within the function, NumericAxis are created and added to the SciChartSurface. A NonUniformHeatmapDataSeries is then constructed using custom mapping functions for x and y cell offsets, enabling each heatmap cell to be placed precisely on the grid. The example further configures a HeatmapColorMap with gradient stops and data labels to enhance the visual representation. For more detailed information on non uniform heatmap charts, refer to the Non-Uniform Heatmap Chart Type documentation.

Features and Capabilities

The example provides several advanced features such as interactive zooming and panning using modifiers like ZoomPanModifier, ZoomExtentsModifier, and MouseWheelZoomModifier. It supports dynamic customization of visual elements including opacity and color mapping, and includes data labels for each heatmap cell for clearer data visualization. The use of custom cell offset mapping ensures that developers can precisely control the layout of the heatmap. Additional insights on interactive chart controls can be obtained from the Tutorial on Adding Zooming, Panning Behavior.

Integration and Best Practices

By using the ScichartAngularComponent, the example adheres to Angular best practices for component-based architecture and input binding as described in Accepting data with input properties - Angular. The drawExample function is passed directly to the component as an input, demonstrating a clean and modular approach to chart initialization. Performance optimization is achieved by leveraging the WebAssembly context to handle intensive rendering operations, which aligns with guidelines from Memory Best Practices | JavaScript Chart Documentation - SciChart. For further guidance on Angular integration, developers may also review the scichart-angular and the Getting Started with SciChart JS resources.

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 Spline Band Chart | Angular Charts | SciChart.js Demo

Angular Spline Band Chart

SciChart's Angular Spline Band Chart makes it easy to draw thresholds or fills between two lines on a chart. Get your free demo today.

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 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.