JavaScript Polar Radar Chart

Creates a JavaScript Polar Radar Chart, also known as a Spider Chart using SciChart.js, which expresses the complexity, memory usage, stability, adaptability, scalability, and cache efficiency of two popular sorting algorithms

This type of plot is also Known As: Spider Chart, Web Chart, Cobweb Chart, and Kiviat Chart

Fullscreen

Edit

 Edit

Docs

drawExample.ts

index.html

vanilla.ts

theme.ts

Copy to clipboard
Minimise
Fullscreen
1import {
2    PolarMouseWheelZoomModifier,
3    PolarZoomExtentsModifier,
4    PolarPanModifier,
5    XyDataSeries,
6    PolarNumericAxis,
7    SciChartPolarSurface,
8    EColor, 
9    EPolarAxisMode, 
10    EPolarGridlineMode, 
11    PolarCategoryAxis,
12    ENumericFormat,
13    EPolarLabelMode,
14    PolarMountainRenderableSeries,
15    FadeAnimation,
16    PolarLegendModifier,
17    EllipsePointMarker,
18    PolarLineRenderableSeries,
19} from "scichart";
20import { appTheme } from "../../../theme";
21
22const LABELS = [
23    "Complexity",
24    "Memory Usage",
25    "Stability",
26    "Adaptability",
27    "Scalability",
28    "Cache Efficiency"
29];
30
31const DATA_SET = [
32    {
33        name: "Quick Sort",
34        color: appTheme.VividSkyBlue,
35        values: [7, 8, 2, 8, 9, 9]
36    },
37    {   
38        name: "Bubble Sort",
39        color: appTheme.VividOrange,
40        values: [2, 9, 10, 5, 1, 2], 
41    },
42]
43
44// this chart expresses the complexity, memory usage, stability, adaptability, scalability, and cache efficiency of two sorting algorithms
45
46export const drawExample = async (rootElement: string | HTMLDivElement) => {
47    const { sciChartSurface, wasmContext } = await SciChartPolarSurface.create(rootElement, {
48        theme: appTheme.SciChartJsTheme
49    });
50
51    const radialYAxis = new PolarNumericAxis(wasmContext, {
52        polarAxisMode: EPolarAxisMode.Radial,
53        gridlineMode: EPolarGridlineMode.Polygons,
54        useNativeText: true,
55        labelPrecision: 0,
56        zoomExtentsToInitialRange: true,
57
58        majorGridLineStyle: {
59            color: EColor.BackgroundColor,
60            strokeThickness: 1,
61            strokeDashArray: [5, 5]
62        },
63        labelStyle: {
64            color: EColor.White,
65            fontSize: 16,
66        },
67        drawLabels: false,
68        drawMinorGridLines: false,
69        drawMajorTickLines: false,
70        drawMinorTickLines: false,
71        startAngle: Math.PI / 2, // start at 12 o'clock
72        innerRadius: 0, 
73    });
74    sciChartSurface.yAxes.add(radialYAxis); 
75
76    const angularXAxis = new PolarCategoryAxis(wasmContext, {
77        polarAxisMode: EPolarAxisMode.Angular,
78        labels: LABELS,
79        labelStyle: {
80            fontSize: 16,
81            color: EColor.White,
82        },
83        majorGridLineStyle: {
84            color: EColor.BackgroundColor,
85            strokeThickness: 1,
86            strokeDashArray: [5, 5]
87        },
88        flippedCoordinates: true, // go clockwise
89        drawMinorGridLines: false,
90        useNativeText: true,
91        polarLabelMode: EPolarLabelMode.Horizontal,
92        labelFormat: ENumericFormat.NoFormat,
93        startAngle: Math.PI / 2, // start at 12 o'clock
94    });
95    sciChartSurface.xAxes.add(angularXAxis);
96
97    const xValues = Array.from({ length: LABELS.length + 1 }, (_, i) => i); 
98    // +1 to complete the radar chart without overlap of first and last labels
99    
100    const polarMountain = new PolarMountainRenderableSeries(wasmContext, {
101        dataSeries: new XyDataSeries(wasmContext, {
102            xValues: xValues,
103            yValues: [...DATA_SET[0].values, DATA_SET[0].values[0]], // +1 append first value to complete the radar chart
104            dataSeriesName: DATA_SET[0].name
105        }),
106        stroke: DATA_SET[0].color,
107        fill: DATA_SET[0].color + "30",
108        strokeThickness: 4,
109        animation: new FadeAnimation({ duration: 1000 })
110    });
111    sciChartSurface.renderableSeries.add(polarMountain);
112
113    // You can just as well use a PolarLineRenderableSeries
114    const polarLine = new PolarLineRenderableSeries(wasmContext, {
115        dataSeries: new XyDataSeries(wasmContext, {
116            xValues: xValues,
117            yValues: [...DATA_SET[1].values, DATA_SET[1].values[0]], // +1 append first value to complete the radar chart
118            dataSeriesName: DATA_SET[1].name
119        }),
120        stroke: DATA_SET[1].color,
121        strokeThickness: 4,
122        pointMarker: new EllipsePointMarker(wasmContext, {
123            width: 10,
124            height: 10,
125            strokeThickness: 2,
126            fill: DATA_SET[1].color,
127            stroke: EColor.White,
128        }),
129        animation: new FadeAnimation({ duration: 1000 })
130    });
131    sciChartSurface.renderableSeries.add(polarLine);
132
133    sciChartSurface.chartModifiers.add(
134        new PolarPanModifier(),
135        new PolarZoomExtentsModifier(),
136        new PolarMouseWheelZoomModifier({ growFactor: 0.0002 }),
137        new PolarLegendModifier({ showSeriesMarkers: true, showCheckboxes: true }),
138    );
139
140    return { sciChartSurface, wasmContext };
141};
142

JavaScript Polar Radar Chart

Overview

This example shows how to build a Polar Radar Chart in vanilla JavaScript with SciChart.js, comparing attributes like complexity and scalability of Quick Sort and Bubble Sort using polar series representations.

Technical Implementation

The chart uses async creation of SciChartPolarSurface, setting up PolarNumericAxis and PolarCategoryAxis with custom gridlines and labels. It employs PolarMountainRenderableSeries and PolarLineRenderableSeries backed by XyDataSeries, incorporating optimizations like native text and precise label formatting for efficient rendering, as explained in the Polar Radar Chart guide.

Features and Capabilities

It enables real-time data updates through series manipulation and offers custom features including fade animations, ellipse point markers, and modifiers like PolarMouseWheelZoomModifier for interactive zooming and panning.

Integration and Best Practices

In JavaScript, implement async initialization with a destructor for resource cleanup to prevent memory leaks. Adhere to modular configuration for scalable code, leveraging direct API calls for fine-tuned performance.

javascript Chart Examples & Demos

See Also: Polar Charts (21 Demos)

JavaScript Polar Line Chart | Javascript Charts | SciChart.js

JavaScript Polar Line Chart

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

JavaScript Polar Spline Line Chart | SciChart.js Demo

JavaScript Polar Spline Line Chart

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.

JavaScript Multi-Cycle Polar Line | SciChart.js Demo

JavaScript Multi Cycle-Polar Line Example

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.

JavaScript Polar Column Chart | Polar Bar Chart | SciChart

JavaScript Polar Column | Polar Bar

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.

JavaScript Polar Column Category Chart | SciChart.js Demo

JavaScript Polar Column Category Chart

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

JavaScript Polar Range Column Chart | SciChart.js Demo

JavaScript Polar Range Column Chart

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

JavaScript Windrose Plot | Polar Stacked Radial Column Chart

JavaScript Windrose Plot | Polar Stacked Radial Column Chart

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

JavaScript Polar Sunburst Chart | Javascript Charts | SciChart.js

JavaScript Polar Sunburst Chart

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

JavaScript Polar Radial Column Chart | SciChart.js Demo

JavaScript Polar Radial Column Chart

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.

JavaScript Stacked Radial Column Chart | Stacked Radial Bar Chart

JavaScript Stacked Radial Column Chart | Stacked Radial Bar Chart

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

JavaScript Polar Area Chart | Polar Mountain Chart | SciChart

JavaScript Polar Area Chart | Polar Mountain Chart

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

JavaScript Polar Stacked Radial Mountain Chart | SciChart

JavaScript Polar Stacked Radial Mountain Chart

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

JavaScript Polar Band | Polar Error Bands Chart | SciChart

JavaScript Polar Band | Polar Error Bands Chart

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.

JavaScript Polar Scatter Chart | Javascript Charts | SciChart.js

JavaScript Polar Scatter Chart

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.

JavaScript Polar Gauge Chart | Circular Gauge Chart

JavaScript Gauge Charts

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

JavaScript Arc Gauge & FIFO Scrolling Charts Dashboard

JavaScript Arc Gauge & FIFO Scrolling Charts Dashboard Example

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

JavaScript Polar Uniform Heatmap Chart | SciChart.js Demo

JavaScript Polar Uniform Heatmap Chart

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

JS Polar Heatmap | B-Mode Image Ultrasound | Medical Heatmap

JavaScript Polar Heatmap | B-Mode Image Ultrasound | Medical Heatmap

No description available for this example yet

JavaScript Polar Partial Arc | Javascript Charts | SciChart.js

JavaScript Polar Partial Arc

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.

JavaScript Polar Axis Label Modes | SciChart.js Demo

JavaScript Polar Axis Label Modes

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.

JavaScript Polar Map Example | Javascript Charts | SciChart.js

JavaScript Polar Map Example

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

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