Server Traffic Dashboard

Demonstrates handling realtime big data with different chart types using SciChart.js, High Performance JavaScript Charts

Fullscreen

Edit

 Edit

Docs

index.tsx

containerSizeHooks.ts

theme.ts

after-all-charts-init.ts

chart-configurations.ts

chart-types.ts

data-generation.ts

GridLayoutModifier.ts

main-chart-config.ts

ModifierGroup.ts

Overview.tsx

page-statistics-chart-config.ts

region-statistic-charts.ts

server-load-chart-config.ts

ThresholdSlider.tsx

VisibleRangeSynchronizationManager.ts

Copy to clipboard
Minimise
Fullscreen
1import { IThemeProvider, SciChartJsNavyTheme } from "scichart";
2
3const getCssColor = (cssVar: string, fallback: string): string => {
4    if (typeof document === "undefined") {
5        return fallback;
6    }
7    const cssValue = getComputedStyle(document.documentElement).getPropertyValue(cssVar).trim();
8    return cssValue || fallback;
9};
10
11type TRgbColor = { r: number; g: number; b: number };
12
13const parseCssColorToRgb = (color: string): TRgbColor | undefined => {
14    const trimmed = color.trim();
15
16    if (trimmed.startsWith("#")) {
17        let hex = trimmed.slice(1);
18        if (hex.length === 3 || hex.length === 4) {
19            hex = hex
20                .slice(0, 3)
21                .split("")
22                .map((channel) => channel + channel)
23                .join("");
24        } else if (hex.length === 6 || hex.length === 8) {
25            hex = hex.slice(0, 6);
26        } else {
27            return undefined;
28        }
29
30        if (!/^[0-9a-fA-F]{6}$/.test(hex)) {
31            return undefined;
32        }
33
34        return {
35            r: Number.parseInt(hex.slice(0, 2), 16),
36            g: Number.parseInt(hex.slice(2, 4), 16),
37            b: Number.parseInt(hex.slice(4, 6), 16),
38        };
39    }
40
41    const rgbMatch = trimmed.match(/^rgba?\((.+)\)$/i);
42    if (!rgbMatch) {
43        return undefined;
44    }
45
46    const channels = rgbMatch[1]
47        .split(",")
48        .slice(0, 3)
49        .map((channel) => Number.parseFloat(channel.trim()));
50
51    if (channels.length !== 3 || channels.some((channel) => !Number.isFinite(channel))) {
52        return undefined;
53    }
54
55    const clamp = (value: number) => Math.max(0, Math.min(255, value));
56
57    return {
58        r: clamp(channels[0]),
59        g: clamp(channels[1]),
60        b: clamp(channels[2]),
61    };
62};
63
64const getPerceivedBrightness = (color: string): number | undefined => {
65    const rgb = parseCssColorToRgb(color);
66    if (!rgb) return undefined;
67
68    // WCAG-adjacent perceptual weighting for quick dark/light detection.
69    return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
70};
71
72export interface AppThemeBase {
73    SciChartJsTheme: IThemeProvider;
74
75    // general colors
76    isDark: boolean;
77    ForegroundColor: string;
78    Background: string;
79
80    // Series colors
81    VividSkyBlue: string;
82    VividPink: string;
83    VividTeal: string;
84    VividOrange: string;
85    VividBlue: string;
86    VividPurple: string;
87    VividGreen: string;
88    VividRed: string;
89
90    MutedSkyBlue: string;
91    MutedPink: string;
92    MutedTeal: string;
93    MutedOrange: string;
94    MutedBlue: string;
95    MutedPurple: string;
96    MutedRed: string;
97
98    PaleSkyBlue: string;
99    PalePink: string;
100    PaleTeal: string;
101    PaleOrange: string;
102    PaleBlue: string;
103    PalePurple: string;
104}
105
106export class SciChart2022AppTheme implements AppThemeBase {
107    SciChartJsTheme = new SciChartJsNavyTheme();
108
109    // Dynamic colors
110    get isDark() {
111        const brightness = getPerceivedBrightness(this.Background);
112        return brightness === undefined || brightness < 128;
113    }
114    get TextColor() { return this.ForegroundColor; }
115    get ForegroundColor() {
116        return getCssColor("--text", "#F5F5F5");
117    }
118    get Background() {
119        return getCssColor("--bg-chart", this.SciChartJsTheme.sciChartBackground);
120    }
121
122    // Series colors
123    VividSkyBlue = "#50C7E0";
124    VividPink = "#EC0F6C";
125    VividTeal = "#30BC9A";
126    VividOrange = "#F48420";
127    VividBlue = "#364BA0";
128    VividPurple = "#882B91";
129    VividGreen = "#67BDAF";
130    VividRed = "#C52E60";
131
132    DarkIndigo = "#14233C";
133    Indigo = "#264B93";
134
135    MutedSkyBlue = "#83D2F5";
136    MutedPink = "#DF69A8";
137    MutedTeal = "#7BCAAB";
138    MutedOrange = "#E7C565";
139    MutedBlue = "#537ABD";
140    MutedPurple = "#A16DAE";
141    MutedRed = "#DC7969";
142
143    PaleSkyBlue = "#E4F5FC";
144    PalePink = "#EEB3D2";
145    PaleTeal = "#B9E0D4";
146    PaleOrange = "#F1CFB5";
147    PaleBlue = "#B5BEDF";
148    PalePurple = "#CFB4D5";
149}
150
151export const appTheme = new SciChart2022AppTheme();
152

Server Traffic Dashboard on Angular

Overview

This example demonstrates a comprehensive server traffic dashboard implemented using SciChart.js within an Angular framework. It showcases real-time data updates across multiple chart types including a main chart, URL statistics, server load, and region statistics, offering interactive exploration and high performance visualization capabilities.

Technical Implementation

The dashboard is built by asynchronously initializing several SciChart surfaces using ScichartAngularComponent from scichart-angular. Each chart is configured via dedicated Angular services which manage state updates and inter-chart communication. The implementation employs a visible range synchronization manager that ensures the x-axis visible ranges remain consistent across charts as detailed in the Synchronizing Multiple Charts guide. Custom modifiers such as the GridLayoutModifier leverage SciChart.js’ GenericAnimation API to provide smooth grid formation and transition effects, which aligns with best practices for implementing Angular animations.

Features and Capabilities

Key features include real-time data filtering based on server and location selections, dynamic chart updating, and interactive tooltips defined through custom palette providers registered with the chart builder. Advanced interactivity is achieved with custom rollover and cursor modifiers that enhance user engagement. Performance considerations are addressed by optimizing render routines to handle large data volumes, as described in the Performance Optimization Tips.

Integration and Best Practices

From an Angular integration perspective, this dashboard illustrates effective state management and component communication techniques, crucial for real-time data visualization. It adopts a responsive grid layout rendered through Angular, ensuring that charts resize and update seamlessly. Developers are encouraged to review Angular real-time data visualization and component interaction guidance on managing chart thresholds and synchronization, aligning with best practices for implementing interactive dashboards in Angular. Additionally, custom theming and tooltip configurations provided via SciChart.js enhance the overall user experience, marking this example as a robust reference for high-performance Angular dashboard development.

angular Chart Examples & Demos

See Also: Performance Demos & Showcases (12 Demos)

Realtime Angular Chart Performance Demo | SciChart.js

Realtime Angular Chart Performance Demo

This demo showcases the incredible realtime performance of our Angular charts by updating the series with millions of data-points!

Load 500 Series x 500 Points Performance Demo | SciChart

Load 500 Series x 500 Points Performance Demo

This demo showcases the incredible performance of our Angular Chart by loading 500 series with 500 points (250k points) instantly!

Load 1 Million Points Performance Demo | SciChart.js Demo

Load 1 Million Points Performance Demo

This demo showcases the incredible performance of our JavaScript Chart by loading a million points instantly.

Realtime Ghosted Traces | Angular Charts | SciChart.js Demo

Realtime Ghosted Traces

This demo showcases the realtime performance of our Angular Chart by animating several series with thousands of data-points at 60 FPS

Realtime Audio Spectrum Analyzer Chart | SciChart.js Demo

Realtime Audio Spectrum Analyzer Chart Example

See the frequency of recordings with the Angular audio spectrum analyzer example from SciChart. This real-time audio visualizer demo uses a Fourier Transform.

Oil & Gas Explorer Angular Dashboard | SciChart.js Demo

Oil & Gas Explorer Angular Dashboard

Demonstrates how to create Oil and Gas Dashboard

Client/Server Websocket Data Streaming | SciChart.js Demo

Client/Server Websocket Data Streaming

This demo showcases the incredible realtime performance of our JavaScript charts by updating the series with millions of data-points!

Rich Interactions Showcase | Angular Charts | SciChart.js

Rich Interactions Showcase

This demo showcases the incredible realtime performance of our Angular charts by updating the series with millions of data-points!

Dynamic Layout Showcase | Angular Charts | SciChart.js Demo

Dynamic Layout Showcase

Demonstrates a custom modifier which can convert from single chart to grid layout and back.

Dragabble Event Markers | Angular Charts | SciChart.js Demo

Dragabble Event Markers

Demonstrates how to repurpose a Candlestick Series into dragabble, labled, event markers

Angular Population Pyramid | Angular Charts | SciChart.js

Angular Population Pyramid

Population Pyramid of Europe and Africa

NEW!
High Performance SVG Cursor & Rollover | SciChart.js Demo

High Performance SVG Cursor & Rollover

Demonstrates how to use the SVG render layer in SciChart.js to maintain smooth cursor interaction on heavy charts with millions of points.

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