Creates a JavaScript Polar Ultrasound Heatmap in SciChart.js, by taking a 2D array of data points as hex values between 00 and FF, and displaying them in a polar heatmap.
Also Known As: B-Mode Image Ultrasound, Medical Heatmap
drawExample.ts
index.html
vanilla.ts
theme.ts
1import {
2 PolarMouseWheelZoomModifier,
3 PolarZoomExtentsModifier,
4 PolarPanModifier,
5 PolarNumericAxis,
6 SciChartPolarSurface,
7 EPolarAxisMode,
8 EAxisAlignment,
9 HeatmapColorMap,
10 UniformHeatmapDataSeries,
11 PolarUniformHeatmapRenderableSeries,
12 LineArrowAnnotation,
13 EArrowHeadPosition,
14} from "scichart";
15import { appTheme } from "../../../theme";
16
17const FETAL_DATA_PATH = "heatmap_data.csv";
18
19async function parseCSV(): Promise<number[][]> {
20 const fileData = await fetch(FETAL_DATA_PATH);
21 const rows = (await fileData.text()).split("\n");
22
23 const zValues = rows.map(row => {
24 return row.split(",")
25 // from base 16 to decimal value
26 .map(value => parseInt(value, 16))
27 });
28
29 return zValues;
30}
31
32export const drawExample = async (rootElement: string | HTMLDivElement) => {
33 const { sciChartSurface, wasmContext } = await SciChartPolarSurface.create(rootElement, {
34 theme: appTheme.SciChartJsTheme,
35 title: "Fetal ultrasound at 31 weeks",
36 titleStyle: {
37 fontSize: 32
38 }
39 });
40
41 const angularAxisX = new PolarNumericAxis(wasmContext, {
42 polarAxisMode: EPolarAxisMode.Angular,
43 axisAlignment: EAxisAlignment.Top,
44 useNativeText: false,
45 labelPrecision: 0,
46 drawMajorBands: false,
47 drawMajorGridLines: false,
48 drawMinorGridLines: false,
49 totalAngle: Math.PI / 3,
50 startAngle: (Math.PI * 3 / 2) - (Math.PI / 6),
51 // (start at 270deg) - (half of totalAngle) = 240deg
52 // could be simplified to `Math.PI * 4 / 3`
53 });
54 sciChartSurface.xAxes.add(angularAxisX);
55
56 const radialAxisY = new PolarNumericAxis(wasmContext, {
57 polarAxisMode: EPolarAxisMode.Radial,
58 axisAlignment: EAxisAlignment.Left,
59 useNativeText: false,
60 labelPrecision: 0,
61 drawMajorBands: false,
62 drawMajorGridLines: false,
63 drawMinorGridLines: false,
64 innerRadius: 0.4,
65 startAngle: Math.PI * 3 / 2 - Math.PI / 6,
66 });
67 sciChartSurface.yAxes.add(radialAxisY);
68
69 // Heatmap
70 const heatmapSeries = new PolarUniformHeatmapRenderableSeries(wasmContext, {
71 opacity: 0.8,
72 dataSeries: new UniformHeatmapDataSeries(wasmContext, {
73 xStart: 0,
74 xStep: 1,
75 yStart: 0,
76 yStep: 1,
77 zValues: await parseCSV()
78 }),
79 colorMap: new HeatmapColorMap({
80 minimum: 0,
81 maximum: 255,
82 gradientStops: [
83 { offset: 0, color: "transparent" },
84 { offset: 1, color: "white" }
85 ]
86 })
87 });
88 sciChartSurface.renderableSeries.add(heatmapSeries);
89
90 // Optional Annotations
91 const headLine = new LineArrowAnnotation({
92 x1: 165.9,
93 y1: 74.5,
94 x2: 219.2,
95 y2: 136.5,
96 stroke: "white",
97 strokeThickness: 2,
98 arrowHeadPosition: EArrowHeadPosition.StartEnd,
99 arrowStyle: {
100 headWidth: 18,
101 headLength: 14
102 },
103 isEditable: true,
104 // strokeDashArray: [6, 30],
105 // labelValue: "Head diameter",
106 // axisLabelFill: appTheme.VividTeal,
107 // labelPlacement: ELabelPlacement.Auto,
108 });
109 const femurLine = new LineArrowAnnotation({
110 x1: 61,
111 y1: 166,
112 x2: 82,
113 y2: 127,
114 stroke: "white",
115 strokeThickness: 2,
116 arrowHeadPosition: EArrowHeadPosition.StartEnd,
117 arrowStyle: {
118 headWidth: 10
119 },
120 // strokeDashArray: [6, 30],
121 // labelValue: "Head diameter",
122 // axisLabelFill: appTheme.VividTeal,
123 // labelPlacement: ELabelPlacement.Auto,
124 });
125 sciChartSurface.annotations.add(
126 headLine,
127 femurLine
128 );
129
130 sciChartSurface.chartModifiers.add(
131 new PolarMouseWheelZoomModifier(),
132 new PolarZoomExtentsModifier(),
133 new PolarPanModifier()
134 );
135
136 return { sciChartSurface, wasmContext };
137};This example demonstrates how to create a Polar Uniform Heatmap in JavaScript using SciChart.js, specifically designed for medical ultrasound visualization. The chart displays fetal ultrasound data at 31 weeks in a polar coordinate system, with intensity values mapped to a color gradient.
The implementation uses PolarUniformHeatmapRenderableSeries to render heatmap data loaded from a CSV file. The chart features custom angular and radial axes configured with PolarNumericAxis, limited to a 60-degree sector (Math.PI/3) starting at 240 degrees. Data is parsed from hexadecimal values in the CSV using a custom parseCSV function.
The heatmap uses a transparent-to-white gradient defined by HeatmapColorMap with medical measurement annotations via LineArrowAnnotation. Interactive features include PolarMouseWheelZoomModifier, PolarZoomExtentsModifier, and PolarPanModifier for navigation.

Explore the React Polar Line Chart example to create data labels, line interpolation, gradient palette stroke and startup animations. Try the SciChart Demo.

Try the JavaScript Polar Spline Line Chart example to see SciChart's GPU-accelerated rendering in action. Choose a cubic spline or polar interpolation. View demo.

Create a JavaScript Multi-Cycle Polar Chart to plot data over multiple cycles and visualize patterns over time. This example shows surface temperature by month.

Try the JavaScript Polar Column or Bar Chart example to render bars in a polar layout with gradient fills and animations. Use SciChart for seamless integrations.

Create a JavaScript Polar Colum Category chart visualizing UK consumer price changes. Try the demo with a custom positive/negative threshold fill and stroke.

Create a JavaScript Polar Range Column Chart with SciChart. This example displays monthly minimum and maximum temperatures within a Polar layout. Try the demo.

View the JavaScript Windrose Chart example to display directional data with stacked columns in a polar layout. Try the polar chart demo with customizable labels

See the JavaScript Sunburst Chart example with multiple levels, smooth animation transitions and dynamically updating segment colors. Try the SciChart demo.

View the JavaScript Radial Column Chart example to see the difference that SciChart has to offer. Switch radial and angular axes and add interactive modifiers.

This JavaScript Stacked Radial Bar Chart example shows Olympic medal data by country. Try the demo for yourself with async initialization and theme application.

The JavaScript Polar Area Chart example, also known as Nightingale Rose Chart, renders an area series with polar coordinates with interactive legend controls.

Try the JavaScript Stacked Radial Mountain Chart example to show multiple datasets on a polar layout with a stacked mountain series and animated transitions.

Create a JavaScript Polar Chart with regular and interpolated error bands. Enhance a standard chart with shaded areas to show upper and lower data boundaries.

Build a JavaScript Polar Scatter Chart with this example to render multiple scatter series on radial and angular axes. Try the flexible SciChart demo today.

View the JavaScript Polar Radar Chart example. Also known as the Spider Radar Chart, view the scalability and stability that SciChart has to offer. Try demo.

Create JavaScript Gauge Charts, including a JavaScript Circular Gauge Dashboard, with user-friendly initialization and responsive design. Give SciChart a go.

View JavaScript Arc Gauge Charts alongside FIFO Scrolling Charts, all on the same dashboard with real-time, high-performance data rendering. Try the demo.

Try SciChart's JavaScript Polar Heatmap example to combine a polar heatmap with a legend component. Supports responsive design and chart and legend separation.

Create a JavaScript Polar Partial Arc that bends from a full Polar Circle to a Cartesian-like arc. Try the demo to display an arc segment with Polar coordinates.

Create a JavaScript Polar Axis Label with SciChart. This demo shows the various label modes for Polar Axes – all optimised for pan, zoom, and mouse wheel.

View the React Polar Map Example using the SciChartReact component. Display geographic data as color-coded triangles on a polar coordinate system. Try demo.