Charts
Data visualization on a dependency-free SVG kernel — no D3, no Chart.js, no canvas library. Eleven cartesian series types (line/spline/area/spline-area/stacked-area/bar/stacked/full-stacked/ scatter/range-area/candlestick) plus pie and doughnut share pure engines for 1-2-5 nice-tick scales, calendar-true time axes, log axes, stacking with separate negative branches and single-path rendering that stays fluid at 10k+ points. Wheel and drag-select zoom (cursor-centered, Escape resets), crosshair, shared tooltips, an interactive legend and point/series selection are built in. No WAI-ARIA APG chart pattern exists, so the widget composes: role="img" with a generated label, a screen-reader-only data table, real legend buttons, and keyboard point inspection — arrows walk arguments and series with polite live-region announcements.
@oge-ui/charts is a commercial package — free for evaluation and development, with no notice on development hosts; production use needs a license key. See licensing for the terms.
Getting started
One element, a working chart: the category axis auto-detects from the string arguments, the value axis picks nice ticks, the legend toggles series, and hovering shows the crosshair and tooltip.
| Argument | Product | Services |
|---|---|---|
| Q1 | 120 | 60 |
| Q2 | 150 | 74 |
| Q3 | 138 | 90 |
| Q4 | 190 | 105 |
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeChart } from '@oge-ui/charts';
import type { OgeChartSeriesInput } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgeChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- One element, a working chart: category axis auto-detected
from the string arguments, nice-tick value axis, interactive legend
(click hides a series), hover tooltip and crosshair. Everything is
drawn as dependency-free SVG — no D3, no canvas library. -->
<oge-chart
[dataSource]="data"
[series]="series"
title="Quarterly revenue"
style="height: 380px"
/>
`,
})
export class Demo {
protected readonly data = [
{ quarter: 'Q1', product: 120, services: 60 },
{ quarter: 'Q2', product: 150, services: 74 },
{ quarter: 'Q3', product: 138, services: 90 },
{ quarter: 'Q4', product: 190, services: 105 },
];
protected readonly series: OgeChartSeriesInput[] = [
{ type: 'bar', argumentField: 'quarter', valueField: 'product', name: 'Product' },
{ type: 'line', argumentField: 'quarter', valueField: 'services', name: 'Services' },
];
}Series types
Sixteen series types share one kernel — line/spline/step lines, five area flavors, four bar flavors (incl. rangeBar spanning value1..value2), scatter, bubble (sizeField drives each bubble's area), rangeArea and candlestick. showLabels prints values next to small series, null values become gaps, and hovering a legend item spotlights its series.
| Argument | Band | Steps | Bubbles |
|---|---|---|---|
| 1 | 22 – 42 | 60 | 80 |
| 2 | 27.753 – 47.753 | 74.383 | 74.647 |
| 3 | 32.098 – 52.098 | 85.244 | 60.881 |
| 4 | 33.97 – 53.97 | 89.925 | 44.596 |
| 5 | 32.912 – 52.912 | 87.279 | 32.767 |
| 6 | 29.182 – 49.182 | 77.954 | 30.458 |
| 7 | 23.693 – 43.693 | 64.234 | 38.659 |
| 8 | 17.791 – 37.791 | 49.477 | 53.857 |
| 9 | 12.918 – 32.918 | 37.296 | 69.545 |
| 10 | 10.27 – 30.27 | 30.674 | 79.004 |
| 11 | 10.493 – 30.493 | 31.232 | 78.184 |
| 12 | 13.534 – 33.534 | 38.834 | 67.436 |
| 13 | 18.647 – 38.647 | 51.618 | 51.362 |
| 14 | 24.581 – 44.581 | 66.454 | 36.847 |
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeChart } from '@oge-ui/charts';
import type { OgeChartSeriesInput } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgeChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- Sixteen series types share one kernel: line/spline/step
lines, five area flavors, four bar flavors (incl. rangeBar spanning
value1..value2), scatter, bubble (sizeField drives the AREA of each
bubble), rangeArea and candlestick. showLabels prints SI-formatted
values next to small series; null values become gaps, never fake
zeros. Hovering a legend item spotlights its series. -->
<oge-chart
[dataSource]="data"
[series]="series"
[commonSeries]="{ argumentField: 'day' }"
style="height: 380px"
/>
`,
})
export class Demo {
protected readonly data = Array.from({ length: 14 }, (_, i) => ({
day: i + 1,
smooth: Math.sin(i / 2) * 30 + 60,
lo: Math.sin(i / 2) * 12 + 22,
hi: Math.sin(i / 2) * 12 + 42,
dots: Math.cos(i / 1.5) * 25 + 55,
weight: (i % 5) + 1,
}));
protected readonly series: OgeChartSeriesInput[] = [
{ type: 'rangeBar', value1Field: 'lo', value2Field: 'hi', name: 'Band' },
{ type: 'stepLine', valueField: 'smooth', name: 'Steps', width: 2.5 },
{
type: 'bubble',
valueField: 'dots',
sizeField: 'weight',
name: 'Bubbles',
opacity: 0.75,
},
];
}Time axis & strip lines
Date arguments auto-detect the time axis: ticks are calendar-true (real month boundaries, DST-safe) and labels format through Intl in your locale. stripLines mark a deadline (line) or a window (band).
| Argument | Visitors |
|---|---|
| Jan 1, 2026 | 400 |
| Jan 2, 2026 | 424.632 |
| Jan 3, 2026 | 449.06 |
| Jan 4, 2026 | 473.079 |
| Jan 5, 2026 | 496.493 |
| Jan 6, 2026 | 519.112 |
| Jan 7, 2026 | 540.755 |
| Jan 8, 2026 | 561.255 |
| Jan 9, 2026 | 580.456 |
| Jan 10, 2026 | 598.221 |
| Jan 11, 2026 | 614.429 |
| Jan 12, 2026 | 628.979 |
| Jan 13, 2026 | 641.791 |
| Jan 14, 2026 | 652.804 |
| Jan 15, 2026 | 661.983 |
| Jan 16, 2026 | 669.311 |
| Jan 17, 2026 | 674.798 |
| Jan 18, 2026 | 542.475 |
| Jan 19, 2026 | 544.395 |
| Jan 20, 2026 | 544.632 |
| Jan 21, 2026 | 543.283 |
| Jan 22, 2026 | 540.463 |
| Jan 23, 2026 | 536.305 |
| Jan 24, 2026 | 530.96 |
| Jan 25, 2026 | 524.591 |
| Jan 26, 2026 | 517.376 |
| Jan 27, 2026 | 509.503 |
| Jan 28, 2026 | 501.168 |
| Jan 29, 2026 | 492.572 |
| Jan 30, 2026 | 483.919 |
| Jan 31, 2026 | 475.415 |
| Feb 1, 2026 | 467.263 |
| Feb 2, 2026 | 459.664 |
| Feb 3, 2026 | 452.808 |
| Feb 4, 2026 | 310.88 |
| Feb 5, 2026 | 306.051 |
| Feb 6, 2026 | 302.48 |
| Feb 7, 2026 | 300.308 |
| Feb 8, 2026 | 299.662 |
| Feb 9, 2026 | 300.648 |
| Feb 10, 2026 | 303.352 |
| Feb 11, 2026 | 307.841 |
| Feb 12, 2026 | 314.157 |
| Feb 13, 2026 | 322.321 |
| Feb 14, 2026 | 332.33 |
| Feb 15, 2026 | 344.161 |
| Feb 16, 2026 | 357.766 |
| Feb 17, 2026 | 373.076 |
| Feb 18, 2026 | 390.001 |
| Feb 19, 2026 | 408.43 |
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeChart } from '@oge-ui/charts';
import type { OgeChartSeriesInput, OgeChartStripLine } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgeChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- Date arguments auto-detect the time axis: ticks are
calendar-true (real month boundaries, DST-safe) and labels format
through Intl in your locale. stripLines mark a deadline (line) or a
window (band) on the argument axis. -->
<oge-chart
[dataSource]="data"
[series]="series"
[stripLines]="stripLines"
[argumentAxis]="{ grid: true }"
style="height: 380px"
/>
`,
})
export class Demo {
protected readonly data = Array.from({ length: 120 }, (_, i) => ({
date: new Date(2026, 0, 1 + i),
visitors: 400 + Math.sin(i / 9) * 150 + (i % 17) * 8,
}));
protected readonly series: OgeChartSeriesInput[] = [
{ type: 'area', argumentField: 'date', valueField: 'visitors', name: 'Visitors' },
];
protected readonly stripLines: OgeChartStripLine[] = [
{ start: new Date(2026, 2, 1), end: new Date(2026, 2, 15), label: 'Campaign' },
{ start: new Date(2026, 3, 10), label: 'Release', color: '#dc2626' },
];
}Stacked series
stackedBar accumulates per argument with negatives stacking downward separately; fullStackedBar normalizes each argument to 100%; the stack option splits independent groups.
| Argument | Online | Retail | Refunds |
|---|---|---|---|
| Jan | 40 | 24 | -6 |
| Feb | 52 | 28 | -4 |
| Mar | 47 | 35 | -9 |
| Apr | 61 | 31 | -5 |
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeChart } from '@oge-ui/charts';
import type { OgeChartSeriesInput } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgeChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- stackedBar accumulates per argument (negatives stack
downward separately); fullStackedBar normalizes each argument to
100%. The stack option splits series into independent stack groups. -->
<oge-chart
[dataSource]="data"
[series]="series"
[commonSeries]="{ argumentField: 'month' }"
[valueAxis]="{ abbreviate: false }"
style="height: 380px"
/>
`,
})
export class Demo {
protected readonly data = [
{ month: 'Jan', on: 40, off: 24, refunds: -6 },
{ month: 'Feb', on: 52, off: 28, refunds: -4 },
{ month: 'Mar', on: 47, off: 35, refunds: -9 },
{ month: 'Apr', on: 61, off: 31, refunds: -5 },
];
protected readonly series: OgeChartSeriesInput[] = [
{ type: 'stackedBar', valueField: 'on', name: 'Online' },
{ type: 'stackedBar', valueField: 'off', name: 'Retail' },
{ type: 'stackedBar', valueField: 'refunds', name: 'Refunds' },
];
}Zoom, pan & tooltips
50,000 points per series stay fluid: paths auto-downsample with LTTB (Largest-Triangle-Three-Buckets — peaks survive) to roughly one point per pixel, while hit-testing stays a binary search over the full data. Wheel zooms around the cursor, dragging selects a range, Shift+drag pans, Escape resets — [(visualRange)] is two-way and shared tooltips list every series.
| Argument | CPU | Memory |
|---|---|---|
| Jan 1, 2026 | 40 | 73 |
| Jan 1, 2026 | 41.417 | 73.999 |
| Jan 1, 2026 | 42.833 | 74.996 |
| Jan 1, 2026 | 44.249 | 75.99 |
| Jan 1, 2026 | 45.665 | 76.982 |
| Jan 1, 2026 | 47.081 | 77.972 |
| Jan 1, 2026 | 48.496 | 78.96 |
| Jan 1, 2026 | 49.91 | 72.946 |
| Jan 1, 2026 | 51.323 | 73.929 |
| Jan 1, 2026 | 52.736 | 74.91 |
| Jan 1, 2026 | 54.147 | 75.889 |
| Jan 1, 2026 | 55.558 | 76.866 |
| Jan 1, 2026 | 56.967 | 77.84 |
| Jan 1, 2026 | 45.374 | 78.813 |
| Jan 1, 2026 | 46.781 | 72.783 |
| Jan 1, 2026 | 48.185 | 73.751 |
| Jan 1, 2026 | 49.588 | 74.716 |
| Jan 1, 2026 | 50.989 | 75.68 |
| Jan 1, 2026 | 52.388 | 76.641 |
| Jan 1, 2026 | 53.785 | 77.6 |
| Jan 1, 2026 | 55.18 | 78.557 |
| Jan 1, 2026 | 56.572 | 72.512 |
| Jan 1, 2026 | 57.963 | 73.465 |
| Jan 1, 2026 | 59.35 | 74.415 |
| Jan 1, 2026 | 60.735 | 75.364 |
| Jan 1, 2026 | 62.118 | 76.31 |
| Jan 1, 2026 | 50.497 | 77.254 |
| Jan 1, 2026 | 51.874 | 78.196 |
| Jan 1, 2026 | 53.248 | 72.136 |
| Jan 1, 2026 | 54.618 | 73.074 |
| Jan 1, 2026 | 55.986 | 74.009 |
| Jan 1, 2026 | 57.35 | 74.943 |
| Jan 1, 2026 | 58.71 | 75.874 |
| Jan 1, 2026 | 60.067 | 76.803 |
| Jan 1, 2026 | 61.421 | 77.731 |
| Jan 1, 2026 | 62.77 | 71.656 |
| Jan 1, 2026 | 64.116 | 72.579 |
| Jan 1, 2026 | 65.458 | 73.5 |
| Jan 1, 2026 | 66.796 | 74.419 |
| Jan 1, 2026 | 55.13 | 75.336 |
| Jan 1, 2026 | 56.459 | 76.251 |
| Jan 1, 2026 | 57.785 | 77.164 |
| Jan 1, 2026 | 59.105 | 71.075 |
| Jan 1, 2026 | 60.422 | 71.984 |
| Jan 1, 2026 | 61.734 | 72.891 |
| Jan 1, 2026 | 63.041 | 73.796 |
| Jan 1, 2026 | 64.343 | 74.7 |
| Jan 1, 2026 | 65.641 | 75.601 |
| Jan 1, 2026 | 66.934 | 76.5 |
| Jan 1, 2026 | 68.222 | 70.397 |
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { OgeChart } from '@oge-ui/charts';
import type { OgeChartRange, OgeChartSeriesInput } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgeChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- 50,000 points per series stay fluid: paths auto-downsample with
LTTB (Largest-Triangle-Three-Buckets — peaks survive) to roughly
one point per pixel, hit-testing is a binary search over the FULL
data and pointer work is rAF-coalesced. Wheel zooms around the
cursor, dragging selects a range, Shift+drag pans, Escape resets;
visualRange is two-way; shared tooltips list every series. -->
<oge-chart
[dataSource]="data"
[series]="series"
[(visualRange)]="range"
zoomEnabled="both"
[panEnabled]="true"
[tooltip]="{ shared: true }"
[crosshair]="{ horizontal: true }"
style="height: 380px"
/>
`,
})
export class Demo {
protected readonly range = signal<OgeChartRange | null>(null);
protected readonly data = Array.from({ length: 50_000 }, (_, i) => ({
t: new Date(2026, 0, 1, 0, i * 15),
cpu: 40 + Math.sin(i / 60) * 25 + (i % 13),
memory: 55 + Math.cos(i / 90) * 18 + (i % 7),
}));
protected readonly series: OgeChartSeriesInput[] = [
{ type: 'line', argumentField: 't', valueField: 'cpu', name: 'CPU' },
{ type: 'line', argumentField: 't', valueField: 'memory', name: 'Memory' },
];
}Candlestick & multi-axis
Candlesticks read OHLC fields; a second value axis (position: 'end') carries the volume bars so the two scales stay independent. Rising/falling bodies color via the theme tokens.
| Argument | OGE | Volume |
|---|---|---|
| Jul 1, 2026 | O 100 H 104 L 94 C 98 | 800 |
| Jul 2, 2026 | O 103.969 H 108.845 L 99.969 C 104.845 | 920 |
| Jul 3, 2026 | O 107.753 H 114.802 L 103.753 C 110.802 | 1,040 |
| Jul 4, 2026 | O 111.18 H 119.165 L 107.18 C 115.165 | 1,160 |
| Jul 5, 2026 | O 114.098 H 121.553 L 110.098 C 117.553 | 1,280 |
| Jul 6, 2026 | O 111.388 H 116.979 L 107.388 C 112.979 | 1,400 |
| Jul 7, 2026 | O 112.97 H 116.97 L 107.817 C 111.817 | 1,520 |
| Jul 8, 2026 | O 113.808 H 117.808 L 105.703 C 109.703 | 1,640 |
| Jul 9, 2026 | O 113.912 H 117.912 L 103.371 C 107.371 | 1,760 |
| Jul 10, 2026 | O 113.337 H 117.337 L 101.472 C 105.472 | 800 |
| Jul 11, 2026 | O 107.182 H 111.182 L 95.428 C 99.428 | 920 |
| Jul 12, 2026 | O 105.58 H 109.58 L 95.347 C 99.347 | 1,040 |
| Jul 13, 2026 | O 103.693 H 107.693 L 96.017 C 100.017 | 1,160 |
| Jul 14, 2026 | O 101.702 H 105.702 L 96.992 C 100.992 | 1,280 |
| Jul 15, 2026 | O 99.791 H 105.733 L 95.791 C 101.733 | 1,400 |
| Jul 16, 2026 | O 93.141 H 100.769 L 89.141 C 96.769 | 1,520 |
| Jul 17, 2026 | O 91.918 H 99.855 L 87.918 C 95.855 | 1,640 |
| Jul 18, 2026 | O 91.26 H 98.051 L 87.26 C 94.051 | 1,760 |
| Jul 19, 2026 | O 91.27 H 95.742 L 87.27 C 91.742 | 800 |
| Jul 20, 2026 | O 92.008 H 96.008 L 85.558 C 89.558 | 920 |
| Jul 21, 2026 | O 88.493 H 92.493 L 79.229 C 83.229 | 1,040 |
| Jul 22, 2026 | O 90.693 H 94.693 L 79.415 C 83.415 | 1,160 |
| Jul 23, 2026 | O 93.534 H 97.534 L 81.534 C 85.534 | 1,280 |
| Jul 24, 2026 | O 96.901 H 100.901 L 85.648 C 89.648 | 1,400 |
| Jul 25, 2026 | O 100.647 H 104.647 L 91.428 C 95.428 | 1,520 |
| Jul 26, 2026 | O 99.602 H 103.602 L 93.204 C 97.204 | 1,640 |
| Jul 27, 2026 | O 103.581 H 108.102 L 99.581 C 104.102 | 1,760 |
| Jul 28, 2026 | O 107.401 H 114.223 L 103.401 C 110.223 | 800 |
| Jul 29, 2026 | O 110.884 H 118.827 L 106.884 C 114.827 | 920 |
| Jul 30, 2026 | O 113.877 H 121.486 L 109.877 C 117.486 | 1,040 |
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeChart } from '@oge-ui/charts';
import type { OgeChartSeriesInput } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgeChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- Candlesticks read OHLC fields; a second value axis
(position: 'end') carries the volume bars so the two scales stay
independent. Rising/falling bodies color via the theme tokens. -->
<oge-chart
[dataSource]="data"
[series]="series"
[valueAxis]="[
{ title: 'Price' },
{ position: 'end', title: 'Volume' },
]"
style="height: 380px"
/>
`,
})
export class Demo {
protected readonly data = Array.from({ length: 30 }, (_, i) => {
const open = 100 + Math.sin(i / 4) * 12 + (i % 5);
const close = open + Math.sin(i / 2) * 6 - 2;
return {
day: new Date(2026, 6, 1 + i),
o: open,
h: Math.max(open, close) + 4,
l: Math.min(open, close) - 4,
c: close,
vol: 800 + (i % 9) * 120,
};
});
protected readonly series: OgeChartSeriesInput[] = [
{
type: 'candlestick',
argumentField: 'day',
openField: 'o',
highField: 'h',
lowField: 'l',
closeField: 'c',
name: 'OGE',
},
{
type: 'bar',
argumentField: 'day',
valueField: 'vol',
name: 'Volume',
axis: 1,
opacity: 0.4,
},
];
}Pie & doughnut
Pie and doughnut share the kernel: outside labels with connector lines, small-value grouping folds the tail into an "Others" slice, and clicking a slice (or its legend button) selects and explodes it.
| Chrome | 62 (62%) |
|---|---|
| Safari | 20 (20%) |
| Edge | 6 (6%) |
| Firefox | 5 (5%) |
| Others | 7 (7%) |
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgePieChart } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgePieChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- Pie and doughnut share the kernel: outside labels with
connector lines, small-value grouping folds the tail into an
"Others" slice, clicking (or the legend) selects and explodes. -->
<oge-pie-chart
[dataSource]="data"
argumentField="browser"
valueField="share"
type="doughnut"
[innerRadius]="0.55"
[smallValuesGrouping]="{ mode: 'topN', topCount: 4 }"
title="Browser share"
style="height: 360px"
/>
`,
})
export class Demo {
protected readonly data = [
{ browser: 'Chrome', share: 62 },
{ browser: 'Safari', share: 20 },
{ browser: 'Edge', share: 6 },
{ browser: 'Firefox', share: 5 },
{ browser: 'Samsung', share: 3 },
{ browser: 'Opera', share: 2 },
{ browser: 'Other', share: 2 },
];
}Polar & radar
Radar/polar on the same kernel: categories slot around the circle, values map radially with nice-tick rings. line/area draw closed radar loops (a null value breaks the loop into a gap), scatter renders markers, bar renders sectors — and spider swaps circular rings for polygons.
| Argument | Ada | Grace |
|---|---|---|
| TypeScript | 9 | 7 |
| CSS | 6 | 8 |
| SQL | 7 | 5 |
| Rust | 4 | 6 |
| Go | 5 | 9 |
| Testing | 8 | 7 |
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgePolarChart } from '@oge-ui/charts';
import type { OgeChartSeriesInput } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgePolarChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- Radar/polar on the same kernel: categories slot around the
circle, values map radially with nice ticks. line/area draw closed
radar loops (a null value breaks the loop into a gap), scatter renders
markers, bar renders sectors. spider swaps circular rings for
polygons. -->
<oge-polar-chart
[dataSource]="data"
[series]="series"
[commonSeries]="{ argumentField: 'skill' }"
[spider]="true"
title="Team skills"
style="height: 400px"
/>
`,
})
export class Demo {
protected readonly data = [
{ skill: 'TypeScript', ada: 9, grace: 7 },
{ skill: 'CSS', ada: 6, grace: 8 },
{ skill: 'SQL', ada: 7, grace: 5 },
{ skill: 'Rust', ada: 4, grace: 6 },
{ skill: 'Go', ada: 5, grace: 9 },
{ skill: 'Testing', ada: 8, grace: 7 },
];
protected readonly series: OgeChartSeriesInput[] = [
{ type: 'area', valueField: 'ada', name: 'Ada' },
{ type: 'line', valueField: 'grace', name: 'Grace', width: 2.5 },
];
}Annotations
Annotations anchor on the plot: point draws a marker dot with a connector into a label box at (argument, value); text places the label alone. *ogeChartAnnotationTemplate swaps in arbitrary HTML.
| Argument | Price |
|---|---|
| 1 | 80 |
| 2 | 84.473 |
| 3 | 88.788 |
| 4 | 92.793 |
| 5 | 96.347 |
| 6 | 99.329 |
| 7 | 101.641 |
| 8 | 103.209 |
| 9 | 103.991 |
| 10 | 103.977 |
| 11 | 103.186 |
| 12 | 101.67 |
| 13 | 99.509 |
| 14 | 96.81 |
| 15 | 93.7 |
| 16 | 90.322 |
| 17 | 86.833 |
| 18 | 83.389 |
| 19 | 80.15 |
| 20 | 77.263 |
| 21 | 74.864 |
| 22 | 73.068 |
| 23 | 71.968 |
| 24 | 71.626 |
| 25 | 72.077 |
| 26 | 73.322 |
| 27 | 75.331 |
| 28 | 78.045 |
| 29 | 81.375 |
| 30 | 85.208 |
| 31 | 89.412 |
| 32 | 93.838 |
| 33 | 98.331 |
| 34 | 102.731 |
| 35 | 106.882 |
| 36 | 110.64 |
| 37 | 113.873 |
| 38 | 116.474 |
| 39 | 118.358 |
| 40 | 119.471 |
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeChart } from '@oge-ui/charts';
import type { OgeChartAnnotation, OgeChartSeriesInput } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgeChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- Annotations anchor on the plot: 'point' draws a marker dot
with a connector into a label box at (argument, value); 'text' places
the label alone (top of the plot without a value).
*ogeChartAnnotationTemplate swaps in arbitrary HTML. -->
<oge-chart
[dataSource]="data"
[series]="series"
[annotations]="annotations"
style="height: 380px"
/>
`,
})
export class Demo {
protected readonly data = Array.from({ length: 40 }, (_, i) => ({
day: i + 1,
price: 80 + Math.sin(i / 5) * 20 + i / 2,
}));
protected readonly series: OgeChartSeriesInput[] = [
{ type: 'spline', argumentField: 'day', valueField: 'price', name: 'Price' },
];
protected readonly annotations: OgeChartAnnotation[] = [
{ type: 'point', text: 'All-time high', argument: 34, value: 116.9 },
{ type: 'point', text: 'Correction', argument: 22, value: 76.1, offsetY: 24 },
{ type: 'text', text: 'Q1 guidance', argument: 8 },
];
}Range selector
The overview strip: a mini background chart with a draggable window and two WAI-ARIA slider handles (arrows adjust, Home/End jump, Escape mid-drag restores). Bound to the chart's [(visualRange)], the two stay in lockstep — drag the window and the chart zooms.
| Argument | Sales |
|---|---|
| Jan 1, 2026 | 200 |
| Jan 2, 2026 | 209.998 |
| Jan 3, 2026 | 219.987 |
| Jan 4, 2026 | 229.955 |
| Jan 5, 2026 | 239.894 |
| Jan 6, 2026 | 249.792 |
| Jan 7, 2026 | 259.642 |
| Jan 8, 2026 | 269.432 |
| Jan 9, 2026 | 279.153 |
| Jan 10, 2026 | 288.797 |
| Jan 11, 2026 | 298.354 |
| Jan 12, 2026 | 241.815 |
| Jan 13, 2026 | 251.171 |
| Jan 14, 2026 | 260.415 |
| Jan 15, 2026 | 269.537 |
| Jan 16, 2026 | 278.531 |
| Jan 17, 2026 | 287.388 |
| Jan 18, 2026 | 296.102 |
| Jan 19, 2026 | 304.666 |
| Jan 20, 2026 | 313.073 |
| Jan 21, 2026 | 321.318 |
| Jan 22, 2026 | 329.394 |
| Jan 23, 2026 | 271.297 |
| Jan 24, 2026 | 279.021 |
| Jan 25, 2026 | 286.563 |
| Jan 26, 2026 | 293.919 |
| Jan 27, 2026 | 301.085 |
| Jan 28, 2026 | 308.058 |
| Jan 29, 2026 | 314.836 |
| Jan 30, 2026 | 321.417 |
| Jan 31, 2026 | 327.8 |
| Feb 1, 2026 | 333.983 |
| Feb 2, 2026 | 339.966 |
| Feb 3, 2026 | 279.749 |
| Feb 4, 2026 | 285.333 |
| Feb 5, 2026 | 290.719 |
| Feb 6, 2026 | 295.908 |
| Feb 7, 2026 | 300.902 |
| Feb 8, 2026 | 305.704 |
| Feb 9, 2026 | 310.317 |
| Feb 10, 2026 | 314.744 |
| Feb 11, 2026 | 318.989 |
| Feb 12, 2026 | 323.057 |
| Feb 13, 2026 | 326.952 |
| Feb 14, 2026 | 264.68 |
| Feb 15, 2026 | 268.246 |
| Feb 16, 2026 | 271.656 |
| Feb 17, 2026 | 274.918 |
| Feb 18, 2026 | 278.037 |
| Feb 19, 2026 | 281.021 |
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { OgeChart, OgeRangeSelector } from '@oge-ui/charts';
import type { OgeChartRange, OgeChartSeriesInput } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgeChart, OgeRangeSelector],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- The overview strip: a mini background chart with a draggable
window and two WAI-ARIA slider handles (arrows adjust, Home/End jump,
Escape mid-drag restores). Bind the same range to a chart's
[(visualRange)] and the two stay in lockstep. -->
<oge-chart
[dataSource]="data"
[series]="series"
[(visualRange)]="range"
zoomEnabled="both"
style="height: 300px"
/>
<oge-range-selector
[dataSource]="data"
[series]="miniSeries"
[(value)]="range"
style="display: block; margin-top: 8px"
/>
`,
})
export class Demo {
protected readonly range = signal<OgeChartRange | null>(null);
protected readonly data = Array.from({ length: 365 }, (_, i) => ({
date: new Date(2026, 0, 1 + i),
sales: 200 + Math.sin(i / 20) * 80 + (i % 11) * 6,
}));
protected readonly series: OgeChartSeriesInput[] = [
{ type: 'line', argumentField: 'date', valueField: 'sales', name: 'Sales' },
];
protected readonly miniSeries: OgeChartSeriesInput[] = [
{ type: 'area', argumentField: 'date', valueField: 'sales', name: 'Sales' },
];
}Selection, i18n & export
selectionMode="point" rings clicked points (Ctrl adds to the set). Every user-facing string, aria labels included, lives in OgeChartsMessages (provideOgeChartsConfig(), locale). The dependency-free @oge-ui/charts/export-image entry serializes the live SVG with inlined styles — PNG via canvas rasterization, or the standalone .svg itself.
| Argument | Value |
|---|---|
| Jan | 12 |
| Feb | 31 |
| Mar | 24 |
| Apr | 42 |
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { OgeChart, provideOgeChartsConfig } from '@oge-ui/charts';
import type { OgeChartPointEvent, OgeChartPointRef, OgeChartSeriesInput } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgeChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- selectionMode="point" rings clicked points (Ctrl adds);
legendClick is cancelable. Every user-facing string, aria included,
lives in OgeChartsMessages (provideOgeChartsConfig, locale). The
dependency-free export entry serializes the SVG with inlined styles
— PNG via canvas rasterization, or the standalone .svg itself. -->
<div class="mb-2 flex gap-2">
<button type="button" (click)="exportPng(chart)">Export PNG</button>
<button type="button" (click)="exportSvg(chart)">Export SVG</button>
</div>
<oge-chart
#chart
[dataSource]="data"
[series]="series"
selectionMode="point"
[(selectedPoints)]="selected"
locale="de"
(pointClick)="lastPoint = $event"
style="height: 340px"
/>
`,
})
export class Demo {
// App-wide (main.ts / route providers):
// provideOgeChartsConfig({ locale: 'de', a11yTableLimit: 100 })
protected readonly selected = signal<readonly OgeChartPointRef[]>([]);
protected lastPoint: OgeChartPointEvent<Record<string, unknown>> | null =
null;
protected readonly data = [
{ month: 'Jan', value: 12 },
{ month: 'Feb', value: 31 },
{ month: 'Mar', value: 24 },
{ month: 'Apr', value: 42 },
];
protected readonly series: OgeChartSeriesInput[] = [
{ type: 'bar', argumentField: 'month', valueField: 'value', name: 'Value' },
];
/** The exporter loads lazily and needs no third-party library at all. */
protected async exportPng<T extends object>(
chart: OgeChart<T>,
): Promise<void> {
const { exportChartToPng } = await import('@oge-ui/charts/export-image');
await exportChartToPng(chart, { filename: 'chart.png' });
}
protected async exportSvg<T extends object>(
chart: OgeChart<T>,
): Promise<void> {
const { exportChartToSvg } = await import('@oge-ui/charts/export-image');
exportChartToSvg(chart, { filename: 'chart.svg' });
}
}Live data
Updates glide instead of jumping. Marks are matched by series name and category: changed values tween, a new month grows from the baseline, a dropped one shrinks into it, and the line morphs point by point. Clicking a legend item fades the series out while the value axis re-scales. New data arriving mid-tween continues from the frame on screen. animation sets the timing, the easing presets follow the motion tokens, and prefers-reduced-motion turns it all off.
| Argument | Orders | Returns |
|---|---|---|
| Jan | 60 | 28 |
| Feb | 111 | 23 |
| Mar | 92 | 14 |
| Apr | 47 | 8 |
| May | 37 | 11 |
| Jun | 73 | 21 |
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { OgeChart } from '@oge-ui/charts';
import type { OgeChartSeriesInput } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgeChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- Updates glide instead of jumping: marks are matched by series
name and category, so changed values tween, a new month grows from the
baseline and a dropped one shrinks into it, and the line morphs point by
point. Clicking a legend item fades that series out while the value axis
re-scales. New data mid-tween continues from the frame on screen; the
animation input times it, and prefers-reduced-motion turns it off. -->
<div class="mb-2 flex gap-2">
<button type="button" (click)="shuffle()">New values</button>
<button type="button" (click)="shift()">Next month</button>
</div>
<oge-chart
[dataSource]="data()"
[series]="series"
[animation]="{ duration: 600, easing: 'easeOut' }"
title="Live data"
style="height: 340px"
/>
`,
})
export class Demo {
private static readonly MONTHS = [
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
];
private tick = 0;
private start = 0;
protected readonly data = signal(this.rows());
protected readonly series: OgeChartSeriesInput[] = [
{ type: 'bar', argumentField: 'month', valueField: 'orders', name: 'Orders' },
{ type: 'spline', argumentField: 'month', valueField: 'returns', name: 'Returns' },
];
/** Fresh values for the same months: every bar and point glides. */
protected shuffle(): void {
this.tick++;
this.data.set(this.rows());
}
/** Drops the first month and appends the next: enter and exit together. */
protected shift(): void {
this.start++;
this.data.set(this.rows());
}
private rows(): { month: string; orders: number; returns: number }[] {
const months = Demo.MONTHS;
return Array.from({ length: 6 }, (_, i) => {
const n = this.start + i;
const wave = Math.sin(n * 1.3 + this.tick * 2.1);
return {
month: months[n % months.length],
orders: Math.round(60 + wave * 35 + ((n * 17 + this.tick * 11) % 20)),
returns: Math.round(18 + Math.cos(n + this.tick) * 10),
};
});
}
}Data labels
Data labels on any series — position outside, inside, center, insideEnd or insideBase (inside labels pick a contrasting text colour), format, showForZero and overlap resolution (hide / shift / none), always clipped to the plot. customizePoint colours the regions below target red and says so in the tooltip and the screen-reader table. The nested doughnut draws one ring per series entry; radial bars draw one ring per category.
| Argument | Sales |
|---|---|
| North | 182 |
| South | 96, below target |
| East | 151 |
| West | 128, below target |
| Central | 204 |
| Argument | 2025 | 2026 |
|---|---|---|
| Online | 42 (42%) | 55 (55%) |
| Retail | 38 (38%) | 30 (30%) |
| Partners | 20 (20%) | 15 (15%) |
| Argument | Done |
|---|---|
| Design | 72 |
| Web | 88 |
| Mobile | 54 |
| QA | 93 |
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeChart, OgePieChart, OgePolarChart } from '@oge-ui/charts';
import type { OgeChartLabelOptions, OgeChartPointInfo, OgeChartSeriesInput, OgePieSeriesInput } from '@oge-ui/charts';
interface SalesRow {
region: string;
sales: number;
target: number;
}
interface ChannelRow {
channel: string;
y2025: number;
y2026: number;
}
@Component({
selector: 'demo-root',
imports: [OgeChart, OgePieChart, OgePolarChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- Data labels on any series: position (outside / inside / center /
insideEnd / insideBase), format, showForZero and overlap resolution
(hide / shift / none). customizePoint colours single points — and its
description is spoken in the tooltip and the screen-reader table, so
colour is never the only channel. -->
<oge-chart
[dataSource]="sales"
[series]="salesSeries"
title="Sales vs target (k€)"
style="height: 320px"
/>
<div class="mt-4 grid gap-4 md:grid-cols-2">
<!-- Nested doughnut: one ring per series entry; slices of one argument
share a colour and a legend button across rings. -->
<oge-pie-chart
[dataSource]="channels"
argumentField="channel"
type="doughnut"
[innerRadius]="0.35"
[series]="rings"
[label]="percentLabels"
title="Revenue by channel, 2025 → 2026"
style="height: 320px"
/>
<!-- Radial bars: one ring per category, the arc is the value. -->
<oge-polar-chart
[dataSource]="goals"
[series]="goalSeries"
[valueAxis]="{ max: 100 }"
title="Sprint goals done"
style="height: 320px"
/>
</div>
`,
})
export class Demo {
protected readonly sales: SalesRow[] = [
{ region: 'North', sales: 182, target: 160 },
{ region: 'South', sales: 96, target: 140 },
{ region: 'East', sales: 151, target: 150 },
{ region: 'West', sales: 128, target: 130 },
{ region: 'Central', sales: 204, target: 170 },
];
protected readonly salesSeries: OgeChartSeriesInput<SalesRow>[] = [
{
type: 'bar',
argumentField: 'region',
valueField: 'sales',
name: 'Sales',
label: { visible: true, position: 'insideEnd' },
customizePoint: (info: OgeChartPointInfo<SalesRow>) =>
info.source !== undefined && info.source.sales < info.source.target
? { color: '#ef4444', description: 'below target' }
: undefined,
},
];
protected readonly channels: ChannelRow[] = [
{ channel: 'Online', y2025: 42, y2026: 55 },
{ channel: 'Retail', y2025: 38, y2026: 30 },
{ channel: 'Partners', y2025: 20, y2026: 15 },
];
protected readonly rings: OgePieSeriesInput<ChannelRow>[] = [
{ name: '2025', valueField: 'y2025' },
{ name: '2026', valueField: 'y2026' },
];
protected readonly percentLabels: OgeChartLabelOptions<ChannelRow> = {
visible: true,
position: 'inside',
format: (info) => `${Math.round((info.percent ?? 0) * 100)}%`,
};
protected readonly goals = [
{ team: 'Design', done: 72 },
{ team: 'Web', done: 88 },
{ team: 'Mobile', done: 54 },
{ team: 'QA', done: 93 },
];
protected readonly goalSeries: OgeChartSeriesInput[] = [
{
type: 'radialBar',
argumentField: 'team',
valueField: 'done',
name: 'Done',
label: { visible: true, format: (info) => `${info.value}%` },
},
];
}Trendlines & indicators
type: 'indicator' series compute SMA, EMA, Bollinger Bands, MACD or RSI from the close prices — the same pure ogeSma/ogeEma/ogeBollingerBands/ogeMacd/ogeRsi you can import. The RSI series sets pane: 'rsi' and draws in its own pane under the price, on the shared argument axis (wheel zooms both). trendline fits linear, exponential, logarithmic, polynomial or moving-average lines; showR2 adds the fit to the tooltip.
| Argument | OGE | Bollinger (20, 2) | EMA (10) | RSI (14) |
|---|---|---|---|---|
| Jan 1, 2026 | O 99 H 102.5 L 97 C 100 | |||
| Jan 2, 2026 | O 100.727 H 104.227 L 98.727 C 102.989 | |||
| Jan 3, 2026 | O 102.418 H 105.918 L 100.418 C 104.782 | |||
| Jan 4, 2026 | O 104.035 H 107.535 L 102.035 C 105.247 | |||
| Jan 5, 2026 | O 105.547 H 109.047 L 103.547 C 105.412 | |||
| Jan 6, 2026 | O 106.921 H 110.421 L 104.921 C 106.483 | |||
| Jan 7, 2026 | O 108.132 H 111.632 L 106.132 C 108.713 | |||
| Jan 8, 2026 | O 109.156 H 112.656 L 107.156 C 111.141 | |||
| Jan 9, 2026 | O 109.976 H 113.476 L 107.976 C 112.46 | |||
| Jan 10, 2026 | O 110.58 H 114.08 L 108.58 C 112.198 | 106.942 | ||
| Jan 11, 2026 | O 110.963 H 114.463 L 108.963 C 111.147 | 107.707 | ||
| Jan 12, 2026 | O 111.126 H 114.626 L 109.126 C 110.626 | 108.238 | ||
| Jan 13, 2026 | O 111.074 H 114.574 L 109.074 C 111.27 | 108.789 | ||
| Jan 14, 2026 | O 110.821 H 114.321 L 108.821 C 112.452 | 109.455 | ||
| Jan 15, 2026 | O 110.385 H 113.885 L 108.385 C 112.871 | 110.076 | 88.912 | |
| Jan 16, 2026 | O 109.788 H 113.288 L 107.788 C 111.763 | 110.383 | 82.932 | |
| Jan 17, 2026 | O 109.058 H 112.558 L 107.058 C 109.626 | 110.245 | 72.762 | |
| Jan 18, 2026 | O 108.227 H 111.727 L 106.227 C 107.785 | 109.798 | 65.328 | |
| Jan 19, 2026 | O 107.329 H 110.829 L 105.329 C 107.202 | 109.326 | 63.13 | |
| Jan 20, 2026 | O 106.399 H 109.899 L 104.399 C 107.624 | 108.59 (upper 115.599, lower 101.58) | 109.017 | 64.072 |
| Jan 21, 2026 | O 105.475 H 108.975 L 103.475 C 107.845 | 108.982 (upper 114.801, lower 103.162) | 108.804 | 64.582 |
| Jan 22, 2026 | O 104.594 H 108.094 L 102.594 C 106.849 | 109.175 (upper 114.414, lower 103.936) | 108.448 | 60.413 |
| Jan 23, 2026 | O 103.79 H 107.29 L 101.79 C 104.777 | 109.174 (upper 114.414, lower 103.935) | 107.781 | 52.779 |
| Jan 24, 2026 | O 103.097 H 106.597 L 101.097 C 102.828 | 109.054 (upper 114.743, lower 103.364) | 106.88 | 46.791 |
| Jan 25, 2026 | O 102.546 H 106.046 L 100.546 C 102.187 | 108.892 (upper 115.141, lower 102.644) | 106.027 | 44.985 |
| Jan 26, 2026 | O 102.162 H 105.662 L 100.162 C 102.963 | 108.716 (upper 115.409, lower 102.024) | 105.47 | 47.624 |
| Jan 27, 2026 | O 101.968 H 105.468 L 99.968 C 104.112 | 108.486 (upper 115.473, lower 101.499) | 105.223 | 51.342 |
| Jan 28, 2026 | O 101.98 H 105.48 L 99.98 C 104.414 | 108.15 (upper 115.24, lower 101.06) | 105.076 | 52.303 |
| Jan 29, 2026 | O 102.208 H 105.708 L 100.208 C 103.615 | 107.708 (upper 114.771, lower 100.645) | 104.81 | 49.52 |
| Jan 30, 2026 | O 102.658 H 106.158 L 100.658 C 102.663 | 107.231 (upper 114.304, lower 100.157) | 104.42 | 46.358 |
| Jan 31, 2026 | O 103.329 H 106.829 L 101.329 C 102.847 | 106.816 (upper 113.896, lower 99.736) | 104.134 | 47.06 |
| Feb 1, 2026 | O 104.211 H 107.711 L 102.211 C 104.605 | 106.515 (upper 113.431, lower 99.599) | 104.219 | 53.359 |
| Feb 2, 2026 | O 105.293 H 108.793 L 103.293 C 107.121 | 106.307 (upper 112.881, lower 99.734) | 104.747 | 60.583 |
| Feb 3, 2026 | O 106.556 H 110.056 L 104.556 C 109.056 | 106.138 (upper 112.225, lower 100.05) | 105.53 | 65.065 |
| Feb 4, 2026 | O 107.974 H 111.474 L 105.974 C 109.768 | 105.982 (upper 111.508, lower 100.457) | 106.301 | 66.573 |
| Feb 5, 2026 | O 109.521 H 113.021 L 107.521 C 109.879 | 105.888 (upper 111.07, lower 100.707) | 106.951 | 66.813 |
| Feb 6, 2026 | O 111.165 H 114.665 L 109.165 C 110.677 | 105.941 (upper 111.291, lower 100.59) | 107.629 | 68.562 |
| Feb 7, 2026 | O 112.87 H 116.37 L 110.87 C 112.905 | 106.197 (upper 112.311, lower 100.082) | 108.588 | 72.863 |
| Feb 8, 2026 | O 114.601 H 118.101 L 112.601 C 116.046 | 106.639 (upper 114.109, lower 99.169) | 109.944 | 77.53 |
| Feb 9, 2026 | O 116.321 H 119.821 L 114.321 C 118.767 | 107.196 (upper 116.349, lower 98.043) | 111.548 | 80.637 |
| Feb 10, 2026 | O 117.993 H 121.493 L 115.993 C 120.111 | 107.809 (upper 118.559, lower 97.06) | 113.105 | 81.963 |
| Feb 11, 2026 | O 119.583 H 123.083 L 117.583 C 120.345 | 108.484 (upper 120.525, lower 96.444) | 114.421 | 82.192 |
| Feb 12, 2026 | O 121.056 H 124.556 L 119.056 C 120.681 | 109.279 (upper 122.297, lower 96.262) | 115.559 | 82.535 |
| Feb 13, 2026 | O 122.384 H 125.884 L 120.384 C 122.136 | 110.245 (upper 124.045, lower 96.444) | 116.755 | 83.972 |
| Feb 14, 2026 | O 123.54 H 127.04 L 121.54 C 124.567 | 111.364 (upper 125.975, lower 96.753) | 118.175 | 86.04 |
| Feb 15, 2026 | O 124.504 H 128.004 L 122.504 C 126.78 | 112.555 (upper 128.086, lower 97.023) | 119.74 | 87.608 |
| Feb 16, 2026 | O 125.26 H 128.76 L 123.26 C 127.613 | 113.73 (upper 130.064, lower 97.396) | 121.171 | 88.147 |
| Feb 17, 2026 | O 125.798 H 129.298 L 123.798 C 126.984 | 114.858 (upper 131.576, lower 98.14) | 122.228 | 85.133 |
| Feb 18, 2026 | O 126.115 H 129.615 L 124.115 C 125.962 | 115.976 (upper 132.525, lower 99.427) | 122.907 | 80.331 |
| Feb 19, 2026 | O 126.212 H 129.712 L 124.212 C 125.781 | 117.131 (upper 133.016, lower 101.247) | 123.43 | 79.475 |
| Argument | Campaigns |
|---|---|
| 5 | 35.5 |
| 7 | 50.625 |
| 9 | 45.6 |
| 11 | 45.768 |
| 13 | 64.747 |
| 15 | 73.686 |
| 17 | 66.401 |
| 19 | 73.337 |
| 21 | 92.832 |
| 23 | 94.871 |
| 25 | 88.847 |
| 27 | 102.359 |
| 29 | 118.898 |
| 31 | 115.122 |
| 33 | 113.554 |
| 35 | 131.732 |
| 37 | 142.613 |
| 39 | 135.629 |
| 41 | 140.545 |
| 43 | 160.26 |
| 45 | 164.262 |
| 47 | 157.513 |
| 49 | 169.248 |
| 51 | 186.97 |
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeChart } from '@oge-ui/charts';
import type { OgeChartAxisOptions, OgeChartPane, OgeChartSeriesInput } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgeChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- Technical indicators are series: type 'indicator' computes SMA,
EMA, Bollinger Bands, MACD or RSI from the close prices (the same pure
ogeSma/ogeEma/ogeBollingerBands/ogeMacd/ogeRsi you can import). The
RSI draws in its own pane under the price, sharing the argument axis. -->
<oge-chart
[dataSource]="prices"
[series]="priceSeries"
[panes]="panes"
[valueAxis]="paneAxes"
zoomEnabled="wheel"
[tooltip]="{ shared: true }"
style="height: 440px"
/>
<!-- Trendlines: linear, exponential, logarithmic, polynomial or moving
average over any series; showR2 adds the fit to the tooltip. -->
<oge-chart
[dataSource]="campaigns"
[series]="campaignSeries"
[argumentAxis]="{ title: 'Ad spend (k€)' }"
[valueAxis]="{ title: 'Revenue (k€)' }"
style="height: 300px"
/>
`,
})
export class Demo {
protected readonly panes: OgeChartPane[] = [
{ name: 'price', height: 3 },
{ name: 'rsi', height: 1 },
];
protected readonly paneAxes: OgeChartAxisOptions[] = [
{ pane: 'price', title: 'Price' },
{ pane: 'rsi', title: 'RSI', min: 0, max: 100 },
];
protected readonly prices = Array.from({ length: 60 }, (_, i) => {
const base = 100 + Math.sin(i / 6) * 8 + i * 0.4;
return {
day: new Date(2026, 0, 1 + i),
open: base - 1,
high: base + 2.5,
low: base - 3,
close: base + Math.sin(i) * 1.5,
};
});
protected readonly priceSeries: OgeChartSeriesInput[] = [
{
type: 'ohlc',
argumentField: 'day',
openField: 'open',
highField: 'high',
lowField: 'low',
closeField: 'close',
name: 'OGE',
},
{
type: 'indicator',
argumentField: 'day',
closeField: 'close',
indicator: { type: 'bollinger', period: 20, stdDev: 2 },
},
{
type: 'indicator',
argumentField: 'day',
closeField: 'close',
indicator: { type: 'ema', period: 10 },
dashStyle: 'dash',
},
{
type: 'indicator',
argumentField: 'day',
closeField: 'close',
indicator: { type: 'rsi', period: 14 },
pane: 'rsi',
},
];
protected readonly campaigns = Array.from({ length: 24 }, (_, i) => ({
spend: 5 + i * 2,
revenue: 20 + (5 + i * 2) * 3.1 + Math.sin(i * 1.7) * 9,
}));
protected readonly campaignSeries: OgeChartSeriesInput[] = [
{
type: 'scatter',
argumentField: 'spend',
valueField: 'revenue',
name: 'Campaigns',
trendline: { type: 'linear', showR2: true },
},
];
}Waterfall & Pareto
waterfall floats each delta from the running total; summaryField marks intermediate subtotals and the total. Rising, falling and sum bars colour by kind with dashed connectors, and the screen-reader table says increase, decrease or total. pareto sorts the bars by value and runs a cumulative-% line over them on a second value axis.
| Argument | Cash flow |
|---|---|
| Opening | 120 (increase) |
| Sales | 85 (increase) |
| Services | 34 (increase) |
| Payroll | -72 (decrease) |
| Rent | -18 (decrease) |
| Q1 | 149 (subtotal) |
| Tax | -26 (decrease) |
| Closing | 123 (total) |
| Argument | Defects |
|---|---|
| Scratches | 46 (cumulative 45.1%) |
| Misalignment | 31 (cumulative 75.5%) |
| Wrong part | 12 (cumulative 87.3%) |
| Dents | 8 (cumulative 95.1%) |
| Other | 5 (cumulative 100%) |
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeChart } from '@oge-ui/charts';
import type { OgeChartAxisOptions, OgeChartSeriesInput } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgeChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- waterfall: deltas float from the running total; summaryField marks
'intermediate' subtotals and the 'total'. Rising, falling and sum bars
colour by kind, dashed connectors join them, and the screen-reader
table says "increase" / "decrease" / "total". -->
<oge-chart
[dataSource]="cashFlow"
[series]="cashSeries"
[legend]="{ visible: false }"
title="Cash flow (k€)"
style="height: 320px"
/>
<!-- pareto: bars sort by value and a cumulative-% line runs over them on
a second value axis. -->
<oge-chart
[dataSource]="defects"
[series]="defectSeries"
[valueAxis]="paretoAxes"
title="Defects by cause"
style="height: 320px"
/>
`,
})
export class Demo {
protected readonly cashFlow = [
{ step: 'Opening', amount: 120 },
{ step: 'Sales', amount: 85 },
{ step: 'Services', amount: 34 },
{ step: 'Payroll', amount: -72 },
{ step: 'Rent', amount: -18 },
{ step: 'Q1', sum: 'intermediate' },
{ step: 'Tax', amount: -26 },
{ step: 'Closing', sum: 'total' },
];
protected readonly cashSeries: OgeChartSeriesInput[] = [
{
type: 'waterfall',
argumentField: 'step',
valueField: 'amount',
summaryField: 'sum',
name: 'Cash flow',
label: { visible: true },
},
];
protected readonly defects = [
{ cause: 'Dents', count: 8 },
{ cause: 'Scratches', count: 46 },
{ cause: 'Wrong part', count: 12 },
{ cause: 'Misalignment', count: 31 },
{ cause: 'Other', count: 5 },
];
protected readonly defectSeries: OgeChartSeriesInput[] = [
{
type: 'pareto',
argumentField: 'cause',
valueField: 'count',
name: 'Defects',
cumulativeAxis: 1,
},
];
protected readonly paretoAxes: OgeChartAxisOptions[] = [
{ title: 'Count' },
{
position: 'end',
title: 'Cumulative',
max: 100,
labelFormat: (value) => `${String(value)}%`,
},
];
}Box plot & histogram
boxPlot computes quartiles, Tukey whiskers (1.5 × IQR) and outlier dots from raw samples — or reads precomputed q1Field/medianField/q3Field. histogram bins the values by count, width or thresholds; the tooltip reads the bin range.
| Argument | Latency |
|---|---|
| API | Min 20, Q1 28, Median 35.5, Q3 44, Max 48, 4 outliers |
| Web | Min 32, Q1 40, Median 47.5, Q3 56, Max 60, 4 outliers |
| Worker | Min 44, Q1 52, Median 59.5, Q3 68, Max 72, 4 outliers |
| DB | Min 56, Q1 64, Median 71.5, Q3 80, Max 84, 4 outliers |
| Argument | People |
|---|---|
| 155 – 160 | 8 |
| 160 – 165 | 12 |
| 165 – 170 | 15 |
| 170 – 175 | 45 |
| 175 – 180 | 45 |
| 180 – 185 | 43 |
| 185 – 190 | 35 |
| 190 – 195 | 24 |
| 195 – 200 | 8 |
| 200 – 205 | 5 |
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeChart } from '@oge-ui/charts';
import type { OgeChartSeriesInput } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgeChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- boxPlot from raw samples: quartiles, Tukey whiskers (1.5 × IQR)
and outlier dots — or from precomputed q1/median/q3 fields. The tooltip
and the screen-reader table read Min, Q1, Median, Q3, Max. -->
<oge-chart
[dataSource]="latency"
[series]="latencySeries"
[valueAxis]="{ title: 'ms' }"
title="Response time by service"
style="height: 320px"
/>
<!-- histogram: bins the values (count, width or explicit thresholds);
bars span their bins and the argument reads "165 – 170". -->
<oge-chart
[dataSource]="heights"
[series]="heightSeries"
[argumentAxis]="{ title: 'Height (cm)' }"
title="Height distribution"
style="height: 300px"
/>
`,
})
export class Demo {
protected readonly latency = ['API', 'Web', 'Worker', 'DB'].map(
(service, s) => ({
service,
samples: Array.from(
{ length: 40 },
(_, i) => 20 + s * 12 + ((i * 37) % 29) + (i % 13 === 0 ? 55 : 0),
),
}),
);
protected readonly latencySeries: OgeChartSeriesInput[] = [
{
type: 'boxPlot',
argumentField: 'service',
valuesField: 'samples',
name: 'Latency',
},
];
/** Deterministic pseudo-random 0..1 (the demo needs stable data). */
private readonly noise = (k: number): number =>
Math.abs(Math.sin(k * 12.9898) * 43758.5453) % 1;
protected readonly heights = Array.from({ length: 240 }, (_, i) => ({
height:
150 +
20 * (this.noise(i) + this.noise(i + 1000) + this.noise(i + 2000)),
}));
protected readonly heightSeries: OgeChartSeriesInput[] = [
{
type: 'histogram',
valueField: 'height',
name: 'People',
bins: { width: 5 },
label: { visible: true },
},
];
}Export & print
No chart library involved: PNG and JPEG rasterize the live SVG with its styles inlined, @oge-ui/charts/export-pdf embeds that image under a real-text title in a jsPDF page (an optional peer — the docs register Noto Sans through setOgePdfDefaultFont(), so Turkish titles work), and print() opens the browser dialog for the chart alone. The chart itself is a stackedSplineArea.
| Argument | Solar | Wind | Hydro |
|---|---|---|---|
| Jan | 12 | 30 | 18 |
| Feb | 16 | 27 | 17 |
| Mar | 24 | 25 | 20 |
| Apr | 31 | 22 | 22 |
| May | 38 | 18 | 24 |
| Jun | 42 | 16 | 21 |
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeChart } from '@oge-ui/charts';
import type { OgeChartSeriesInput } from '@oge-ui/charts';
@Component({
selector: 'demo-root',
imports: [OgeChart],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- Export without a chart library: PNG/JPEG rasterize the live SVG
(styles inlined), PDF embeds that image under a real-text title in a
jsPDF page (an optional peer, loaded only by /export-pdf), and print()
opens the browser dialog for the chart alone. -->
<div class="mb-2 flex flex-wrap gap-2">
<button type="button" (click)="exportPng(chart)">PNG</button>
<button type="button" (click)="exportJpeg(chart)">JPEG</button>
<button type="button" (click)="exportPdf(chart)">PDF</button>
<button type="button" (click)="chart.print()">Print</button>
</div>
<oge-chart
#chart
[dataSource]="energy"
[series]="energySeries"
title="Energy mix (GWh)"
style="height: 340px"
/>
`,
})
export class Demo {
protected readonly energy = [
{ month: 'Jan', solar: 12, wind: 30, hydro: 18 },
{ month: 'Feb', solar: 16, wind: 27, hydro: 17 },
{ month: 'Mar', solar: 24, wind: 25, hydro: 20 },
{ month: 'Apr', solar: 31, wind: 22, hydro: 22 },
{ month: 'May', solar: 38, wind: 18, hydro: 24 },
{ month: 'Jun', solar: 42, wind: 16, hydro: 21 },
];
protected readonly energySeries: OgeChartSeriesInput[] = [
{ type: 'stackedSplineArea', argumentField: 'month', valueField: 'solar', name: 'Solar' },
{ type: 'stackedSplineArea', argumentField: 'month', valueField: 'wind', name: 'Wind' },
{ type: 'stackedSplineArea', argumentField: 'month', valueField: 'hydro', name: 'Hydro' },
];
protected async exportPng<T extends object>(chart: OgeChart<T>): Promise<void> {
const { exportChartToPng } = await import('@oge-ui/charts/export-image');
await exportChartToPng(chart, { filename: 'energy.png' });
}
protected async exportJpeg<T extends object>(chart: OgeChart<T>): Promise<void> {
const { exportChartToJpeg } = await import('@oge-ui/charts/export-image');
await exportChartToJpeg(chart, { filename: 'energy.jpeg', quality: 0.9 });
}
/**
* Non-WinAnsi titles (Turkish ğ ş ı İ, Greek, Cyrillic) need a Unicode font:
* pass `font`, or register one once with setOgePdfDefaultFont() from
* @oge-ui/behavior — every OGE PDF export then uses it.
*/
protected async exportPdf<T extends object>(chart: OgeChart<T>): Promise<void> {
const { exportChartToPdf } = await import('@oge-ui/charts/export-pdf');
await exportChartToPdf(chart, {
filename: 'energy.pdf',
title: 'Energy mix',
subtitle: 'Generation by source, GWh',
});
}
}