Angular 3D Log-Log Scatter Chart

Demonstrates LogarithmicAxis3D on X and Y axes in an Angular 3D Scatter Chart using SciChart.js.

Fullscreen

Edit

 Edit

Docs

drawExample.ts

angular.ts

theme.ts

Copy to clipboard
Minimise
Fullscreen
1import { appTheme } from "../../../theme";
2import {
3    SciChart3DSurface,
4    CameraController,
5    Vector3,
6    MouseWheelZoomModifier3D,
7    OrbitModifier3D,
8    ResetCamera3DModifier,
9    NumericAxis3D,
10    LogarithmicAxis3D,
11    NumberRange,
12    ScatterRenderableSeries3D,
13    XyzDataSeries3D,
14    SpherePointMarker3D,
15} from "scichart";
16
17const SENSOR_COUNT = 8;
18const POINTS_PER_SENSOR = 200;
19
20const createSensorData = (sensor: number): { xValues: number[]; yValues: number[]; zValues: number[] } => {
21    const xValues: number[] = new Array(POINTS_PER_SENSOR);
22    const yValues: number[] = new Array(POINTS_PER_SENSOR);
23    const zValues: number[] = new Array(POINTS_PER_SENSOR);
24
25    const alpha = 0.4 + sensor * 0.18;
26    const amplitude = 5e4 / (sensor + 1);
27
28    for (let i = 0; i < POINTS_PER_SENSOR; i++) {
29        const logFreq = (i / (POINTS_PER_SENSOR - 1)) * 5 + (Math.random() - 0.5) * 0.06;
30        const freq = Math.pow(10, logFreq);
31        const noise = 0.7 + Math.random() * 0.6;
32        const psd = Math.max(amplitude * Math.pow(freq, -alpha) * noise, 1e-6);
33        xValues[i] = freq;
34        yValues[i] = psd;
35        zValues[i] = sensor;
36    }
37    return { xValues, yValues, zValues };
38};
39
40const sensorColor = (sensor: number): string => {
41    const t = sensor / (SENSOR_COUNT - 1);
42    const r = Math.round(20 + t * 230);
43    const g = Math.round(180 - t * 120);
44    const b = Math.round(255 - t * 210);
45    return `#${r.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}${b.toString(16).padStart(2, "0")}`;
46};
47
48export const X_RANGE_LOG = new NumberRange(1, 1e5);
49export const X_RANGE_LINEAR = new NumberRange(0, 1e5);
50export const Y_RANGE_LOG = new NumberRange(1e-4, 1e5);
51export const Y_RANGE_LINEAR = new NumberRange(0, 1e5);
52
53export const drawExample = async (rootElement: string | HTMLDivElement) => {
54    const { sciChart3DSurface, wasmContext } = await SciChart3DSurface.create(rootElement, {
55        theme: appTheme.SciChartJsTheme,
56    });
57
58    sciChart3DSurface.camera = new CameraController(wasmContext, {
59        position: new Vector3(-300, 220, -280),
60        target: new Vector3(0, 50, 0),
61    });
62
63    sciChart3DSurface.chartModifiers.add(
64        new MouseWheelZoomModifier3D(),
65        new OrbitModifier3D(),
66        new ResetCamera3DModifier()
67    );
68
69    sciChart3DSurface.xAxis = new LogarithmicAxis3D(wasmContext, {
70        axisTitle: "Frequency (Hz)",
71        logBase: 10,
72        visibleRange: X_RANGE_LOG,
73    });
74
75    sciChart3DSurface.yAxis = new LogarithmicAxis3D(wasmContext, {
76        axisTitle: "PSD (V²/Hz)",
77        logBase: 10,
78        visibleRange: Y_RANGE_LOG,
79    });
80
81    sciChart3DSurface.zAxis = new NumericAxis3D(wasmContext, {
82        axisTitle: "Sensor",
83        visibleRange: new NumberRange(-0.5, SENSOR_COUNT - 0.5),
84    });
85
86    for (let s = 0; s < SENSOR_COUNT; s++) {
87        const { xValues, yValues, zValues } = createSensorData(s);
88        const dataSeries = new XyzDataSeries3D(wasmContext, {
89            xValues,
90            yValues,
91            zValues,
92            dataSeriesName: `Sensor ${s + 1}`,
93        });
94        const scatter = new ScatterRenderableSeries3D(wasmContext, {
95            dataSeries,
96            pointMarker: new SpherePointMarker3D(wasmContext, { size: 5, fill: sensorColor(s) }),
97            opacity: 0.85,
98        });
99        sciChart3DSurface.renderableSeries.add(scatter);
100    }
101
102    return { sciChartSurface: sciChart3DSurface, wasmContext };
103};
104

Angular 3D Log-Log Scatter Chart

Overview

This example shows how to integrate LogarithmicAxis3D within an Angular standalone component using SciChart.js. The scichart-angular package provides the ScichartAngularComponent wrapper that handles WebAssembly initialization and disposal.

Technical Implementation

The Angular component binds the drawExample function to the [initChart] input of ScichartAngularComponent. The chart uses LogarithmicAxis3D (base 10) on both X (Frequency, 1–100k Hz) and Y (PSD, 1e-4–1e5 V²/Hz) axes, with NumericAxis3D on Z for the sensor index. Data is generated client-side using power-law distributions.

Features and Capabilities

Interactive 3D navigation is provided by OrbitModifier3D, MouseWheelZoomModifier3D, and ResetCamera3DModifier. Eight sensor series are each assigned a unique color and rendered as sphere point markers.

Integration and Best Practices

Follows Angular standalone component patterns. For more details see the scichart-angular npm package and Getting Started with SciChart JS.

angular Chart Examples & Demos

See Also: JavaScript 3D Chart Types (8 Demos)

Angular 3D Bubble Chart | 3D JavaScript Charts | View Now

Angular 3D Bubble Chart

Create detailed Angular 3D Bubble Chart using SciChart's 5-star rated JavaScript chart library. Supports large datasets. Get your free demo now.

Angular 3D Surface Mesh Chart | View 3D JavaScript Charts

Angular Surface Mesh 3D Chart

Design a Angular 3D Surface Mesh Chart with SciChart.js - feature-rich JavaScript chart library. Represent 2D data in a 3D map. Get your free demo.

Angular 3D Point Line Chart | View 3D JavaScript Charts

Angular Point Line 3D Chart

Create detailed Angular 3D Line Chart using SciChart's 5-star rated JavaScript chart library. Supports large datasets. Get your free demo now.

LiDAR 3D Point Cloud of Geospatial Data | SciChart.js

LiDAR 3D Point Cloud of Geospatial Data

Demonstrating the capability of SciChart.js to create JavaScript 3D Point Cloud charts and visualize LiDAR data from the UK Defra Survey.

Tenor Curves Demo | Angular Charts | SciChart.js Demo

Tenor Curves Demo

Demonstrating the capability of SciChart.js to create a composite 2D &amp; 3D Chart application. An example like this could be used to visualize Tenor curves in a financial setting, or other 2D/3D data combined on a single screen.

Angular Realtime 3D Surface Mesh Chart | View 3D JavaScript Charts

Angular Realtime Surface Mesh 3D Chart

Design a Angular 3D Surface Mesh Chart with SciChart.js - feature-rich JavaScript chart library. Represent 2D data in a 3D map. Get your free demo.

Angular 3D Column Chart | View 3D JavaScript Charts

Angular Column 3D Chart

Create detailed Angular 3D Column Chart using SciChart's 5-star rated JavaScript chart library. Supports large datasets

Angular 3D Styling Demo Chart | Advanced 3D Chart Styling

Angular 3D Styling Demo Chart

Create advanced Angular 3D Styling Demo using SciChart's 5-star rated JavaScript chart library. Explore axis styling, plane visibility and multiple point markers.

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