Angular Polar Stacked Mountain Chart

Creates a Angular Polar Stacked Mountain Chart using SciChart.js, with the following features: DataLabels, Rounded corners, Gradient-palette fill, startup animations.

Fullscreen

Edit

 Edit

Docs

drawExample.ts

angular.ts

theme.ts

Copy to clipboard
Minimise
Fullscreen
1import {
2    PolarMouseWheelZoomModifier,
3    PolarZoomExtentsModifier,
4    PolarPanModifier,
5    XyDataSeries,
6    PolarNumericAxis,
7    SciChartPolarSurface,
8    EPolarAxisMode, 
9    NumberRange, 
10    EAxisAlignment,  
11    EPolarLabelMode,
12    WaveAnimation,
13    PolarMountainRenderableSeries,
14    PolarStackedMountainCollection,
15    PolarStackedMountainRenderableSeries,
16    PolarLegendModifier,
17} from "scichart";
18import { appTheme } from "../../../theme";
19
20const xValues = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
21const MountainsDatasets = [
22    {
23        yValues: [2.7, 1.4, 2.3, 2.1, 1.2, 1.5, 2.4, 1.5, 2.7, 1.3],
24        fillColor: appTheme.DarkIndigo,
25    },
26    {
27        yValues: [3.2, 0.9, 2, 2.5, 1.3, 2.8, 2.1, 2, 1.2, 2.4],
28        fillColor: appTheme.VividBlue,
29    },
30    {
31        yValues: [0.3, 2.3, 1.7, 3.2, 2, 2.9, 1, 2, 2.1, 1.1],
32        fillColor: appTheme.VividOrange,
33    },
34    {
35        yValues: [2.1, 1.8, 2.7, 0.5, 2.2, 0.3, 3, 1.6, 2.1, 1],
36        fillColor: appTheme.VividPink,
37    },
38];
39
40export const drawExample = async (rootElement: string | HTMLDivElement) => {
41    const { sciChartSurface, wasmContext } = await SciChartPolarSurface.create(rootElement, {
42        theme: appTheme.SciChartJsTheme,
43    });
44
45    // add Radial Y axis
46    const radialYAxis = new PolarNumericAxis(wasmContext, {
47        polarAxisMode: EPolarAxisMode.Radial,
48        axisAlignment: EAxisAlignment.Right,
49
50        visibleRange: new NumberRange(0, 9),
51        drawMinorTickLines: false,
52        drawMajorTickLines: false,
53        useNativeText: true,
54        drawMinorGridLines: false,
55
56        startAngle: Math.PI / 2,
57        zoomExtentsToInitialRange: true,
58        labelPrecision: 0,
59        labelStyle: {
60            color: "white",
61        },
62    });
63    sciChartSurface.yAxes.add(radialYAxis);
64
65    // add Angular X axis
66    const polarXAxis = new PolarNumericAxis(wasmContext, {
67        polarAxisMode: EPolarAxisMode.Angular,
68        axisAlignment: EAxisAlignment.Top,
69
70        visibleRange: new NumberRange(0, 10),
71        polarLabelMode: EPolarLabelMode.Parallel,
72        
73        startAngle: Math.PI / 2, // start at 12 o'clock
74        flippedCoordinates: true, // go clockwise
75        zoomExtentsToInitialRange: true,
76        
77        useNativeText: true,
78        labelPrecision: 0,
79        labelStyle: {
80            color: "white",
81        },
82    });
83    sciChartSurface.xAxes.add(polarXAxis);
84
85    // Make collection to hold all the stacked mountains renderable series
86    const mountainCollection = new PolarStackedMountainCollection(wasmContext)
87    mountainCollection.animation = new WaveAnimation({ duration: 800, zeroLine: 0 }),
88
89    MountainsDatasets.forEach(({yValues, fillColor}) => {
90        const polarMountain = new PolarStackedMountainRenderableSeries(wasmContext, {
91            dataSeries: new XyDataSeries(wasmContext, {
92                xValues: [...xValues, xValues[xValues.length - 1] + 1], // add 1 more xValue to close the loop
93                yValues: [...yValues, yValues[0]] // close the loop by drawing to the first yValue
94            }),
95            fill: fillColor + "BB", // 75% opacity
96            stroke: "white",
97            strokeThickness: 1,
98        });
99        mountainCollection.add(polarMountain);
100    })
101    sciChartSurface.renderableSeries.add(mountainCollection);
102
103    sciChartSurface.chartModifiers.add(
104        new PolarPanModifier(),
105        new PolarZoomExtentsModifier(),
106        new PolarMouseWheelZoomModifier(),
107        new PolarLegendModifier({
108            showCheckboxes: true,
109            backgroundColor: "#88888833",
110        })
111    );
112
113    return { sciChartSurface, wasmContext };
114};

See Also: Polar Charts (20 Demos)

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

Angular Polar Line Chart

Angular Polar Line Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

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

Angular Polar Spline Line Chart

Angular Polar Spline Line Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Polar Line Temperature Average | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Polar Line Temperature Average

Angular Polar Line Temperature Average demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Polar Column Chart | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Polar Column Chart

Angular Polar Column Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Polar Column Category Chart | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Polar Column Category Chart

Angular Polar Column Category Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

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

Angular Polar Range Column Chart

Angular Polar Range Column Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Windrose Column Chart | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Windrose Column Chart

Angular Windrose Column Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Polar Sunburst Chart | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Polar Sunburst Chart

Angular Polar Sunburst Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Radial Column Chart | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Radial Column Chart

Angular Radial Column Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Stacked Radial Column Chart | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Stacked Radial Column Chart

Angular Stacked Radial Column Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Polar Mountain Chart | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Polar Mountain Chart

Angular Polar Mountain Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Polar Band Chart | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Polar Band Chart

Angular Polar Band Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Polar Scatter Chart | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Polar Scatter Chart

Angular Polar Scatter Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Polar Radar Chart | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Polar Radar Chart

Angular Polar Radar Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Polar Gauge Chart | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Polar Gauge Chart

Angular Polar Gauge Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Polar Gauge Fifo Dashboard | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Polar Gauge Fifo Dashboard

Angular Polar Gauge Fifo Dashboard demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Polar Uniform Heatmap Chart | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Polar Uniform Heatmap Chart

Angular Polar Uniform Heatmap Chart demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Polar Ultrasound Heatmap | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Polar Ultrasound Heatmap

Angular Polar Ultrasound Heatmap demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

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

Angular Polar Partial Arc

Angular Polar Partial Arc demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

Angular Polar Label Modes | JavaScript Charts | SciChart.js | SciChart.js Demo

Angular Polar Label Modes

Angular Polar Label Modes demo by SciChart supports gradient fill and paletteproviders for more custom coloring options. Get your free demo now.

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