Creates a JavaScript Polar Scatter Chart using SciChart.js, with the PolarXyScatterRenderableSeries and custom legend-markers.
drawExample.ts
index.html
vanilla.ts
theme.ts
1import {
2 PolarMouseWheelZoomModifier,
3 PolarZoomExtentsModifier,
4 PolarPanModifier,
5 XyDataSeries,
6 PolarNumericAxis,
7 SciChartPolarSurface,
8 EPolarAxisMode,
9 NumberRange,
10 EAxisAlignment,
11 EPolarLabelMode,
12 PolarXyScatterRenderableSeries,
13 SweepAnimation,
14 PolarLegendModifier,
15 EPointMarkerType,
16 ELegendOrientation,
17 TLegendItem,
18 EActionType,
19} from "scichart";
20import { appTheme } from "../../../theme";
21
22export const drawExample = async (rootElement: string | HTMLDivElement) => {
23 const { sciChartSurface, wasmContext } = await SciChartPolarSurface.create(rootElement, {
24 theme: appTheme.SciChartJsTheme,
25 });
26
27 const radialYAxis = new PolarNumericAxis(wasmContext, {
28 polarAxisMode: EPolarAxisMode.Radial,
29 axisAlignment: EAxisAlignment.Right,
30 visibleRange: new NumberRange(0, 1400),
31 zoomExtentsToInitialRange: true,
32
33 drawMinorTickLines: false,
34 drawMajorTickLines: false,
35 drawMinorGridLines: false,
36
37 startAngle: Math.PI / 2,
38 majorGridLineStyle: {
39 color: appTheme.DarkIndigo,
40 strokeThickness: 1,
41 },
42 drawLabels: false, // no radial labels
43 });
44 sciChartSurface.yAxes.add(radialYAxis);
45
46 const polarXAxis = new PolarNumericAxis(wasmContext, {
47 polarAxisMode: EPolarAxisMode.Angular,
48 axisAlignment: EAxisAlignment.Top,
49 polarLabelMode: EPolarLabelMode.Parallel,
50 visibleRange: new NumberRange(0, 360),
51 startAngle: Math.PI / 2, // start at 12 o'clock
52 flippedCoordinates: true, // go clockwise
53 zoomExtentsToInitialRange: true,
54
55 autoTicks: false,
56 majorDelta: 30,
57
58 drawMinorTickLines: false,
59 drawMajorTickLines: false,
60 drawMinorGridLines: false,
61
62 useNativeText: true,
63 labelPrecision: 0,
64 labelPostfix: "°",
65 labelStyle: {
66 color: "white",
67 },
68 majorGridLineStyle: {
69 color: appTheme.DarkIndigo,
70 strokeThickness: 1,
71 },
72 });
73 sciChartSurface.xAxes.add(polarXAxis);
74
75 const xValues = Array.from({ length: 540 }, (_, i) => i);
76 const SCATTER_DATA = [
77 {
78 yVals: xValues.map((x) => 2 * x + x * Math.random() * 0.5),
79 color: appTheme.VividOrange,
80 name: "Circle Series",
81 pointMarkerType: EPointMarkerType.Ellipse
82 },
83 {
84 yVals: xValues.map((x) => x + x * Math.random() * 0.5),
85 color: appTheme.VividSkyBlue,
86 name: "Triangular Series",
87 pointMarkerType: EPointMarkerType.Triangle,
88 }
89 ]
90
91 SCATTER_DATA.forEach(({ yVals, color, name, pointMarkerType }) => {
92 const polarScatter = new PolarXyScatterRenderableSeries(wasmContext, {
93 dataSeries: new XyDataSeries(wasmContext, {
94 xValues: xValues,
95 yValues: yVals,
96 dataSeriesName: name,
97 }),
98 opacity: 0.7,
99 stroke: color, // set stroke color for Legend modifier markers
100
101 // @ts-ignore
102 pointMarker: {
103 type: pointMarkerType,
104 options: {
105 width: 10,
106 height: 10,
107 stroke: color,
108 strokeThickness: 1,
109 fill: color + "88",
110 }
111 },
112 animation: new SweepAnimation({ duration: 800 }),
113 });
114 sciChartSurface.renderableSeries.add(polarScatter);
115 });
116
117 // Extra feature -> Custom legend marker with SVG shapes
118 const customMarkerLegendModifier = new PolarLegendModifier({
119 showCheckboxes: true,
120 showSeriesMarkers: true,
121 backgroundColor: "#66666633"
122 });
123 // override "getLegendItemHTML" to add custom SVG shapes
124 customMarkerLegendModifier.sciChartLegend.getLegendItemHTML = (
125 orientation: ELegendOrientation,
126 showCheckboxes: boolean,
127 showSeriesMarkers: boolean,
128 item: TLegendItem
129 ): string => {
130 const display = orientation === ELegendOrientation.Vertical ? "flex" : "inline-flex";
131 let str = `<span class="scichart__legend-item" style="display: ${display}; align-items: center; margin-right: 4px; padding: 0 4px 0 5px; white-space: nowrap; gap: 5px">`;
132
133 if (showCheckboxes) {
134 const checked = item.checked ? "checked" : "";
135 str += `<input ${checked} type="checkbox" id="${item.id}">`;
136 }
137
138 if (showSeriesMarkers) {
139 str += `<svg
140 xmlns="http://www.w3.org/2000/svg"
141 for="${item.id}"
142 style="width: 15px; height: 15px;"
143 viewBox="0 0 24 24"
144 stroke-width="2"
145 >
146 ${(() => {
147 switch (item.name) {
148 case SCATTER_DATA[0].name: // Circle
149 return `<circle cx="12" cy="12" r="9" fill="${item.color + "88"}" stroke="${item.color}"/>`;
150
151 case SCATTER_DATA[1].name: // Triangle
152 return `<polygon points="12,2 22,22 2,22" fill="${item.color + "88"}" stroke="${item.color}"/>`;
153
154 default: // Others
155 return `<rect x="2" y="2" width="20" height="20" fill="${item.color + "88"}" stroke="${item.color}"/>`;
156 }
157 })()}
158 </svg>`
159 }
160 str += `<label for="${item.id}">${item.name}</label>`;
161 str += `</span>`;
162 return str;
163 };
164
165 sciChartSurface.chartModifiers.add(
166 customMarkerLegendModifier,
167 new PolarPanModifier(),
168 new PolarZoomExtentsModifier(),
169 new PolarMouseWheelZoomModifier({
170 defaultActionType: EActionType.Zoom
171 }),
172 );
173
174 return { sciChartSurface, wasmContext };
175};This example demonstrates how to render a high-performance Polar Scatter Chart using SciChart.js. It creates a circular XY scatter by calling SciChartPolarSurface.create, configuring radial and angular axes, and plotting multiple series with custom point markers and animations.
The chart is initialized via the asynchronous SciChartPolarSurface.create API, which loads WebAssembly and returns a SciChartSurface and wasmContext. A Radial axis and an Angular axis are added using PolarNumericAxis, configured for start angle, visible range, and grid line styling. Data series are generated as arrays and rendered with PolarXyScatterRenderableSeries, each using a SweepAnimation for smooth startup.
The example showcases:
PolarLegendModifier to display checkboxes and SVG markersThis pure JavaScript implementation leverages direct API calls instead of the Builder API for granular control. Async initialization ensures the WebAssembly context is ready before chart creation. Developers should dispose of the SciChartSurface via .delete() to free memory when the chart is no longer needed.

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.

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.

No description available for this example yet

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.