Demonstrates LogarithmicAxis3D on X and Y axes in an Angular 3D Scatter Chart using SciChart.js.
drawExample.ts
angular.ts
theme.ts
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};
104This 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.
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.
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.
Follows Angular standalone component patterns. For more details see the scichart-angular npm package and Getting Started with SciChart JS.

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

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.

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

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

Demonstrating the capability of SciChart.js to create a composite 2D & 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.

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.

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

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