JavaScript Polar Column Category Chart

Creates a JavaScript Polar Column Category Chart using SciChart.js, with a custom positive/negative threshold fill & stroke for each column.

Fullscreen

Edit

 Edit

Docs

drawExample.ts

index.html

vanilla.ts

theme.ts

Copy to clipboard
Minimise
Fullscreen
1import {
2    PolarColumnRenderableSeries,
3    PolarMouseWheelZoomModifier,
4    PolarZoomExtentsModifier,
5    PolarPanModifier,
6    XyDataSeries,
7    PolarNumericAxis,
8    SciChartPolarSurface,
9    EPolarAxisMode, 
10    NumberRange, 
11    EAxisAlignment, 
12    EPolarLabelMode,
13    PolarCategoryAxis,
14    DefaultPaletteProvider,
15    parseColorToUIntArgb,
16    EStrokePaletteMode,
17    WaveAnimation,
18    Thickness,
19} from "scichart";
20import { appTheme } from "../../../theme";
21
22// Custom PaletteProvider for column series which colours datapoints above a threshold
23class ColumnPaletteProvider extends DefaultPaletteProvider {
24    private threshold: number;
25    private positiveFillColor: number;
26    private positiveStroke: number;
27
28    private negativeFillColor: number;
29    private negativeStroke: number;
30
31    constructor(threshold: number) {
32        super();
33        this.strokePaletteMode = EStrokePaletteMode.SOLID;
34        this.threshold = threshold;
35        this.positiveStroke = parseColorToUIntArgb(appTheme.VividRed);
36        this.positiveFillColor = parseColorToUIntArgb(appTheme.VividRed, 127);
37        this.negativeStroke = parseColorToUIntArgb(appTheme.VividBlue);
38        this.negativeFillColor = parseColorToUIntArgb(appTheme.VividBlue, 127); // 127/255 opacity
39    }
40
41    overrideStrokeArgb(xValue: number, yValue: number, index: number, opacity: number, metadata: any) {
42        return yValue < this.threshold 
43            ? this.positiveStroke 
44            : this.negativeStroke;
45    }
46
47    overrideFillArgb(xValue: number, yValue: number, index: number, opacity: number, metadata: any) {
48        return yValue < this.threshold 
49            ? this.positiveFillColor 
50            : this.negativeFillColor;
51    }
52}
53
54const DATA_UK = {
55    labels: [
56        "Poultry", "Fruit", "Milk", "Cheese", "Pizza", "Meat", "Cereals",
57        "Eggs", "Oats", "Lamb", "Butter", "Chocolate", "Sheep", "OliveOil"
58    ],
59    data: [
60        -18.5, -12.5, -11.7, -9.2, -7.2, -6.8, -5.9, 
61        7.8, 9.1, 10.2, 10.2, 11.7, 17.6, 22.1
62    ]
63}
64
65export const drawExample = async (rootElement: string | HTMLDivElement) => {
66    const { sciChartSurface, wasmContext } = await SciChartPolarSurface.create(rootElement, {
67        theme: appTheme.SciChartJsTheme,
68        title: "Cunsumer prices relative to past year in UK, 2024",
69        titleStyle: {
70            fontSize: 24,
71        }
72    });
73
74    const radialYAxis = new PolarNumericAxis(wasmContext, {
75        polarAxisMode: EPolarAxisMode.Radial,
76        axisAlignment: EAxisAlignment.Right,
77        visibleRange: new NumberRange(
78            Math.min(...DATA_UK.data),
79            Math.max(...DATA_UK.data) + 4 // Add some padding to fit data-label for topmost column
80        ),
81        drawMinorTickLines: false,
82        drawMajorTickLines: false,
83        useNativeText: true,
84        drawMinorGridLines: false,
85        zoomExtentsToInitialRange: true,
86        labelPostfix: "%",
87        labelPrecision: 0,
88        labelStyle: {
89            color: "white",
90        },
91        innerRadius: 0.15,
92        startAngle: Math.PI / 2,
93    });
94    sciChartSurface.yAxes.add(radialYAxis);
95
96    const polarXAxis = new PolarCategoryAxis(wasmContext, {
97        polarAxisMode: EPolarAxisMode.Angular,
98        axisAlignment: EAxisAlignment.Top,
99        polarLabelMode: EPolarLabelMode.Parallel,
100        visibleRange: new NumberRange(-1, DATA_UK.data.length),
101        drawMajorGridLines: false,
102        drawMinorGridLines: false,
103        useNativeText: true,
104        zoomExtentsToInitialRange: true,
105        flippedCoordinates: true,
106        labelPrecision: 0,
107        labelStyle: {
108            color: "white",
109        },
110        totalAngle: Math.PI * 2,
111        startAngle: Math.PI / 2,
112        autoTicks: false,
113        majorDelta: 1,
114        labels: DATA_UK.labels
115    });
116    sciChartSurface.xAxes.add(polarXAxis);
117
118    const polarColumn = new PolarColumnRenderableSeries(wasmContext, {
119        dataSeries: new XyDataSeries(wasmContext, {
120            xValues: Array.from({ length: DATA_UK.data.length }, (_, i) => i),
121            yValues: DATA_UK.data
122        }),
123        dataLabels: {
124            style: {
125                fontSize: 14,
126                padding: Thickness.fromNumber(0),
127            },
128            polarLabelMode: EPolarLabelMode.Parallel,
129            color: "white",
130            precision: 0,
131        },
132        dataPointWidth: 0.6,
133        strokeThickness: 2,
134        paletteProvider: new ColumnPaletteProvider(0), 
135        animation: new WaveAnimation({ duration: 800, zeroLine: 0, fadeEffect: true }),
136    });
137    sciChartSurface.renderableSeries.add(polarColumn);
138
139    sciChartSurface.chartModifiers.add(
140        new PolarPanModifier(),
141        new PolarZoomExtentsModifier(),
142        new PolarMouseWheelZoomModifier()
143    );
144
145    return { sciChartSurface, wasmContext };
146};

Polar Column Category Chart - JavaScript

Overview

This example demonstrates how to create a Polar Column Chart with category axis labels in JavaScript using SciChart.js. The visualization displays UK consumer price changes as radial columns with color-coded positive/negative values.

Technical Implementation

The chart uses a PolarCategoryAxis for angular positioning of food categories and a PolarNumericAxis for radial value display. Data is rendered via PolarColumnRenderableSeries with a custom ColumnPaletteProvider that colors columns differently above/below a threshold.

Features and Capabilities

Key features include:

  • Radial data labels with percentage formatting
  • Custom color thresholds using palette providers
  • Interactive modifiers like PolarZoomExtentsModifier and PolarPanModifier
  • Wave animation effects on initial render

Integration and Best Practices

The implementation follows SciChart's async initialization pattern for optimal performance. Proper cleanup is handled via surface disposal. For production use, consider data streaming techniques for dynamic updates.

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 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 Radar Chart | Spider Radar Chart | SciChart

JavaScript Polar Radar Chart

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.

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.