Angular Polar Column Category Chart

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

Fullscreen

Edit

 Edit

Docs

drawExample.ts

angular.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        drawMinorTickLines: false, // ticks don't make sense on category axes
104        useNativeText: true,
105        zoomExtentsToInitialRange: true,
106        flippedCoordinates: true,
107        labelPrecision: 0,
108        // labelStyle: {
109        //     color: "white",
110        // },
111        totalAngle: Math.PI * 2,
112        startAngle: Math.PI / 2,
113        autoTicks: false,
114        majorDelta: 1,
115        labels: DATA_UK.labels
116    });
117    sciChartSurface.xAxes.add(polarXAxis);
118
119    const polarColumn = new PolarColumnRenderableSeries(wasmContext, {
120        dataSeries: new XyDataSeries(wasmContext, {
121            xValues: Array.from({ length: DATA_UK.data.length }, (_, i) => i),
122            yValues: DATA_UK.data
123        }),
124        dataLabels: {
125            style: {
126                fontSize: 14,
127                padding: Thickness.fromNumber(0),
128            },
129            polarLabelMode: EPolarLabelMode.Parallel,
130            // color: "white",
131            precision: 0,
132        },
133        dataPointWidth: 0.6,
134        strokeThickness: 2,
135        paletteProvider: new ColumnPaletteProvider(0), 
136        animation: new WaveAnimation({ duration: 800, zeroLine: 0, fadeEffect: true }),
137    });
138    sciChartSurface.renderableSeries.add(polarColumn);
139
140    sciChartSurface.chartModifiers.add(
141        new PolarPanModifier(),
142        new PolarZoomExtentsModifier(),
143        new PolarMouseWheelZoomModifier()
144    );
145
146    return { sciChartSurface, wasmContext };
147};

Polar Column Category Chart - Angular

Overview

This Angular standalone component demonstrates a polar column chart with category axis, built using the scichart-angular package. The chart visualizes UK consumer price data with interactive features.

Technical Implementation

The component initializes the chart through the drawExample function passed to <scichart-angular>. It configures a PolarCategoryAxis for labels and PolarNumericAxis for values.

Features and Capabilities

Key aspects include:

  • Standalone component architecture
  • Custom palette provider for conditional styling
  • Polar chart modifiers for zoom/pan
  • Data label formatting
  • Animation effects on load

Integration and Best Practices

The implementation shows Angular best practices:

  • Proper use of standalone components
  • Async chart initialization
  • Memory management via surface disposal
  • Type safety throughout
  • Theming integration

angular Chart Examples & Demos

See Also: Polar Charts (21 Demos)

Angular Polar Line Chart | Angular Charts | SciChart.js Demo

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

Angular Polar Spline Line Chart | Angular Charts | SciChart.js

Angular Polar Spline Line Chart

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

Angular Multi-Cycle Polar Line | Angular Charts | SciChart.js

Angular Multi Cycle-Polar Line Example

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

Angular Polar Column Chart | Polar Bar Chart | SciChart

Angular Polar Column Chart | Angular Polar Bar

Try the Angular Polar Bar Chart example to render bars in a polar layout with gradient fills and animations. Use SciChart for seamless integration.

Angular Polar Range Column Chart | Angular Charts | SciChart.js

Angular Polar Range Column Chart

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

Angular Windrose Plot | Angular Polar Stacked Radial Column Chart

Angular Windrose Plot | Angular Polar Stacked Radial Column Chart

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

Angular Polar Sunburst Chart | Angular Charts | SciChart.js

Angular Polar Sunburst Chart

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

Angular Polar Radial Column Chart | SciChart.js Demo

Angular Polar Radial Column Chart

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

Angular Stacked Radial Column Chart | Stacked Radial Bar Chart

Angular Stacked Radial Column Chart | Stacked Radial Bar Chart

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

Angular Polar Area Chart | Polar Mountain Chart | SciChart

Angular Polar Area Chart | Polar Mountain Chart

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

Angular Polar Stacked Radial Mountain Chart | SciChart.js

Angular Polar Stacked Radial Mountain Chart

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

Angular Polar Band | Polar Error Bands Chart | SciChart

Angular Polar Band | Polar Error Bands Chart

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

Angular Polar Scatter Chart | Angular Charts | SciChart.js

Angular Polar Scatter Chart

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

Angular Polar Radar Chart | Spider Radar Chart | SciChart

Angular Polar Radar Chart

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

Angular Polar Gauge Chart | Angular Circular Gauge | SciChart

Angular Gauge Charts

Create Angular Gauge Charts, including an Angular Circular Gauge Dashboard, with a friendly initialization and responsive design. Give the SciChart demo a go.

Angular Arc Gauge & FIFO Scrolling Charts Dashboard

Angular Arc Gauge & FIFO Scrolling Charts Dashboard Example

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

Angular Polar Uniform Heatmap Chart | SciChart.js Demo

Angular Polar Uniform Heatmap Chart

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

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

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

No description available for this example yet

Angular Polar Partial Arc | Angular Charts | SciChart.js Demo

Angular Polar Partial Arc

Create an Angular 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.

Angular Polar Axis Label Modes | Angular Charts | SciChart.js

Angular Polar Axis Label Modes

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

Angular Polar Map Example | Angular Charts | SciChart.js Demo

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