@ojiepermana/angular-chart 22.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +249 -0
  2. package/fesm2022/ojiepermana-angular-chart-area.mjs +266 -0
  3. package/fesm2022/ojiepermana-angular-chart-area.mjs.map +1 -0
  4. package/fesm2022/ojiepermana-angular-chart-bar.mjs +674 -0
  5. package/fesm2022/ojiepermana-angular-chart-bar.mjs.map +1 -0
  6. package/fesm2022/ojiepermana-angular-chart-core.mjs +764 -0
  7. package/fesm2022/ojiepermana-angular-chart-core.mjs.map +1 -0
  8. package/fesm2022/ojiepermana-angular-chart-line.mjs +281 -0
  9. package/fesm2022/ojiepermana-angular-chart-line.mjs.map +1 -0
  10. package/fesm2022/ojiepermana-angular-chart-pie.mjs +248 -0
  11. package/fesm2022/ojiepermana-angular-chart-pie.mjs.map +1 -0
  12. package/fesm2022/ojiepermana-angular-chart-primitives.mjs +1186 -0
  13. package/fesm2022/ojiepermana-angular-chart-primitives.mjs.map +1 -0
  14. package/fesm2022/ojiepermana-angular-chart-radar.mjs +329 -0
  15. package/fesm2022/ojiepermana-angular-chart-radar.mjs.map +1 -0
  16. package/fesm2022/ojiepermana-angular-chart-radial.mjs +255 -0
  17. package/fesm2022/ojiepermana-angular-chart-radial.mjs.map +1 -0
  18. package/fesm2022/ojiepermana-angular-chart-scatter.mjs +253 -0
  19. package/fesm2022/ojiepermana-angular-chart-scatter.mjs.map +1 -0
  20. package/fesm2022/ojiepermana-angular-chart.mjs +20 -0
  21. package/fesm2022/ojiepermana-angular-chart.mjs.map +1 -0
  22. package/package.json +76 -0
  23. package/types/ojiepermana-angular-chart-area.d.ts +58 -0
  24. package/types/ojiepermana-angular-chart-bar.d.ts +171 -0
  25. package/types/ojiepermana-angular-chart-core.d.ts +369 -0
  26. package/types/ojiepermana-angular-chart-line.d.ts +57 -0
  27. package/types/ojiepermana-angular-chart-pie.d.ts +93 -0
  28. package/types/ojiepermana-angular-chart-primitives.d.ts +265 -0
  29. package/types/ojiepermana-angular-chart-radar.d.ts +89 -0
  30. package/types/ojiepermana-angular-chart-radial.d.ts +86 -0
  31. package/types/ojiepermana-angular-chart-scatter.d.ts +95 -0
  32. package/types/ojiepermana-angular-chart.d.ts +2 -0
@@ -0,0 +1,369 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { Type, Signal } from '@angular/core';
3
+ import * as _ojiepermana_angular_chart_core from '@ojiepermana/angular-chart/core';
4
+ import { ScaleBand, ScaleLinear, scalePoint, scaleLinear, ScalePoint, scaleBand } from 'd3-scale';
5
+
6
+ /**
7
+ * Theme-aware color definition for a chart series.
8
+ *
9
+ * Either:
10
+ * - a single `color` string (raw CSS color — hex, hsl, oklch, CSS var ref), or
11
+ * - a `theme` map whose keys match the document color scheme (`light` / `dark`).
12
+ *
13
+ * Values are injected verbatim into a scoped `<style>` block as
14
+ * `--color-<key>: <value>;`, so any valid CSS color works.
15
+ *
16
+ * Defaults reference the theme tokens from `@ojiepermana/angular-theme/styles`
17
+ * (e.g. `'hsl(var(--chart-1))'`).
18
+ */
19
+ interface ChartSeriesConfig {
20
+ /** Human-readable label (shown in legend, tooltip). */
21
+ readonly label?: string;
22
+ /** Optional icon component rendered next to the label. */
23
+ readonly icon?: Type<unknown>;
24
+ /** Raw color. Mutually exclusive with `theme`. */
25
+ readonly color?: string;
26
+ /** Theme-aware colors — keyed by color scheme. */
27
+ readonly theme?: Readonly<Record<ChartThemeKey, string>>;
28
+ }
29
+ /** Supported color scheme keys. */
30
+ type ChartThemeKey = 'light' | 'dark';
31
+ /** Map of series-key → config. */
32
+ type ChartConfig = Readonly<Record<string, ChartSeriesConfig>>;
33
+ /** CSS selector under which a chart instance is scoped. */
34
+ declare const CHART_DATA_ATTRIBUTE = "data-chart";
35
+ /** Default color schemes supported by the generated `<style>` block. */
36
+ declare const CHART_THEMES: ReadonlyArray<{
37
+ readonly key: ChartThemeKey;
38
+ readonly selector: string;
39
+ }>;
40
+ /**
41
+ * Generate the CSS rule-set for a chart instance: one `--color-<key>` per
42
+ * series, scoped to the owning `[data-chart]` element, with optional dark
43
+ * variant via `[data-mode="dark"] [data-chart="…"]`.
44
+ *
45
+ * Series without any color are skipped (consumer can fall back to a default).
46
+ *
47
+ * @param chartId Unique chart id (used as attribute value).
48
+ * @param config Series configuration map.
49
+ */
50
+ declare function buildChartCss(chartId: string, config: ChartConfig): string;
51
+ /** Resolve the `var(--color-<key>)` reference for a given series. */
52
+ declare function seriesColorVar(seriesKey: string): string;
53
+
54
+ /** Pixel dimensions of the chart render area. */
55
+ interface ChartDimensions {
56
+ readonly width: number;
57
+ readonly height: number;
58
+ }
59
+ /** Active data point (for tooltip / crosshair) shared across primitives. */
60
+ interface ChartActivePoint {
61
+ readonly index: number;
62
+ readonly datumIndex?: number;
63
+ readonly seriesKey?: string;
64
+ readonly clientX?: number;
65
+ readonly clientY?: number;
66
+ }
67
+ /**
68
+ * Shared chart state provided by `ChartContainer` to all nested chart
69
+ * components (axes, grid, tooltip, legend, chart types).
70
+ *
71
+ * All state is exposed as signals so consumers can derive computed state
72
+ * (scales, visible series, tooltip position) without manual subscriptions.
73
+ */
74
+ declare class ChartContext {
75
+ /** Stable instance id — used in the `data-chart` attribute and CSS scope. */
76
+ readonly id: _angular_core.WritableSignal<string>;
77
+ /** User-provided series config. */
78
+ readonly config: _angular_core.WritableSignal<Readonly<Record<string, _ojiepermana_angular_chart_core.ChartSeriesConfig>>>;
79
+ /** Measured render-area dimensions (ResizeObserver-driven). */
80
+ readonly dimensions: _angular_core.WritableSignal<ChartDimensions>;
81
+ /** Currently highlighted data point (tooltip / crosshair). */
82
+ readonly activePoint: _angular_core.WritableSignal<ChartActivePoint | null>;
83
+ /** Series keys the user has toggled off via legend. */
84
+ readonly hiddenSeries: _angular_core.WritableSignal<ReadonlySet<string>>;
85
+ /** Ordered list of series keys (from `config`). */
86
+ readonly seriesKeys: Signal<readonly string[]>;
87
+ /** Series keys currently visible (config order minus `hiddenSeries`). */
88
+ readonly visibleSeriesKeys: Signal<readonly string[]>;
89
+ /** Toggle visibility of a series. */
90
+ toggleSeries(key: string): void;
91
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChartContext, never>;
92
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<ChartContext>;
93
+ }
94
+
95
+ /**
96
+ * Emits a scoped `<style>` block mapping every series key in the current
97
+ * `ChartConfig` to a `--color-<key>` CSS custom property, scoped to
98
+ * `[data-chart="<id>"]`. Dark-mode values are scoped under `[data-mode="dark"]`.
99
+ *
100
+ * Implemented as an empty component that injects a real `<style>` element
101
+ * into its host via `Renderer2`. We avoid rendering `<style>` directly in a
102
+ * template — Angular hoists those into component CSS and strips
103
+ * interpolations from them.
104
+ *
105
+ * Consumers never instantiate this directly — `ChartContainer` renders it.
106
+ */
107
+ declare class ChartStyle {
108
+ private readonly ctx;
109
+ private readonly host;
110
+ private readonly renderer;
111
+ private styleEl;
112
+ protected readonly css: _angular_core.Signal<string>;
113
+ constructor();
114
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChartStyle, never>;
115
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ChartStyle, "ChartStyle", never, {}, {}, never, never, true, never>;
116
+ }
117
+
118
+ /**
119
+ * Presentational style of a chart family.
120
+ *
121
+ * Every chart component exposes a `styles` input that defaults to `'base'`
122
+ * (the classic look). Families may widen this union with their own custom
123
+ * styles — e.g. the bar family adds `'dot'` for a dot-matrix rendering.
124
+ *
125
+ * Custom styles are implemented inside each chart family (not in the theme
126
+ * library) but must only use theme CSS variables (`--muted`, `--color-<key>`,
127
+ * …) so they follow the active theme automatically.
128
+ */
129
+ type ChartStyleVariant = 'base';
130
+
131
+ /**
132
+ * Root of every chart. Provides `ChartContext` to descendants, reflects the
133
+ * chart id via `data-chart`, injects the per-instance CSS-variable
134
+ * `<style>` block, and tracks its render-area dimensions via
135
+ * `ResizeObserver`.
136
+ *
137
+ * Usage:
138
+ * ```html
139
+ * <Chart [config]="cfg">
140
+ * <ChartBar [data]="data" />
141
+ * <ChartLegend />
142
+ * </Chart>
143
+ * ```
144
+ *
145
+ * The chart render area is laid out on top; any projected `<ChartLegend>` is
146
+ * rendered as a centered row beneath it. Render-area dimensions are measured on
147
+ * the chart area only, so the legend never shrinks the chart.
148
+ */
149
+ declare class ChartContainer {
150
+ protected readonly ctx: ChartContext;
151
+ private readonly zone;
152
+ private readonly platformId;
153
+ private readonly destroyRef;
154
+ private readonly areaRef;
155
+ /** Series configuration. Required for color / label resolution. */
156
+ readonly config: _angular_core.InputSignal<Readonly<Record<string, _ojiepermana_angular_chart_core.ChartSeriesConfig>>>;
157
+ /**
158
+ * Tailwind aspect-ratio utility for the chart render area. Defaults to
159
+ * `aspect-video` for cartesian charts; override with `aspect-square` for
160
+ * radial / pie layouts, or e.g. `aspect-auto h-[320px]` for a fixed height.
161
+ */
162
+ readonly aspect: _angular_core.InputSignal<string>;
163
+ protected readonly areaClass: _angular_core.Signal<string>;
164
+ /**
165
+ * Optional explicit id override. When omitted, a stable auto-id is
166
+ * generated (`chart-<n>`), unique across the document.
167
+ */
168
+ readonly chartId: _angular_core.InputSignal<string | null>;
169
+ constructor();
170
+ private observeSize;
171
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ChartContainer, never>;
172
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ChartContainer, "Chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; "aspect": { "alias": "aspect"; "required": false; "isSignal": true; }; "chartId": { "alias": "chartId"; "required": false; "isSignal": true; }; }, {}, never, ["*", "ChartLegend"], true, never>;
173
+ }
174
+
175
+ /** A single row of chart data — one categorical key + N numeric series. */
176
+ type ChartDatum = Readonly<Record<string, unknown>>;
177
+ /** Render-area margins inside the chart's SVG (px). */
178
+ interface ChartMargin {
179
+ readonly top: number;
180
+ readonly right: number;
181
+ readonly bottom: number;
182
+ readonly left: number;
183
+ }
184
+ /** Axis orientation for cartesian charts. */
185
+ type ChartOrientation = 'vertical' | 'horizontal';
186
+ /** Primary axis scale — band for categorical, linear for numeric. */
187
+ type CategoryScale = ScaleBand<string>;
188
+ type ValueScale = ScaleLinear<number, number>;
189
+ /**
190
+ * Cartesian plotting frame shared between a chart type (Bar, Line, Area…)
191
+ * and its axis / grid primitives.
192
+ *
193
+ * The owning chart component provides an instance and publishes its scales;
194
+ * descendants read them via signals and re-render when dimensions or data
195
+ * change.
196
+ */
197
+ declare class CartesianContext {
198
+ /** Inner width (outer width − margin.left − margin.right). */
199
+ readonly innerWidth: _angular_core.WritableSignal<number>;
200
+ /** Inner height (outer height − margin.top − margin.bottom). */
201
+ readonly innerHeight: _angular_core.WritableSignal<number>;
202
+ /** Margins around the plotting area. */
203
+ readonly margin: _angular_core.WritableSignal<ChartMargin>;
204
+ /** Layout orientation (drives which axis holds the band scale). */
205
+ readonly orientation: _angular_core.WritableSignal<ChartOrientation>;
206
+ /** Band (categorical) scale. */
207
+ readonly categoryScale: _angular_core.WritableSignal<CategoryScale | null>;
208
+ /** Linear (numeric) scale. */
209
+ readonly valueScale: _angular_core.WritableSignal<ValueScale | null>;
210
+ /** Ordered category domain (e.g. x labels for vertical, y labels for horizontal). */
211
+ readonly categories: _angular_core.WritableSignal<readonly string[]>;
212
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CartesianContext, never>;
213
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<CartesianContext>;
214
+ }
215
+ /** Resolve the scale that maps to the X axis for a given orientation. */
216
+ declare function xScale(ctx: Pick<CartesianContext, 'orientation' | 'categoryScale' | 'valueScale'>): Signal<CategoryScale | ValueScale | null>;
217
+ /** Resolve the scale that maps to the Y axis for a given orientation. */
218
+ declare function yScale(ctx: Pick<CartesianContext, 'orientation' | 'categoryScale' | 'valueScale'>): Signal<CategoryScale | ValueScale | null>;
219
+
220
+ interface ChartIndexRange {
221
+ readonly startIndex: number;
222
+ readonly endIndex: number;
223
+ }
224
+ type NumericDomain = readonly [number, number];
225
+ declare function normalizeIndexRange(start: number, end: number, maxCount: number): ChartIndexRange | null;
226
+ declare function effectiveIndexRange(range: ChartIndexRange | null, maxCount: number): ChartIndexRange | null;
227
+ declare function indexRangeSize(range: ChartIndexRange | null, maxCount: number): number;
228
+ declare function sliceByIndexRange<T>(data: readonly T[], range: ChartIndexRange | null): readonly T[];
229
+ declare function zoomIndexRange(current: ChartIndexRange | null, maxCount: number, anchorIndex: number, factor: number): ChartIndexRange | null;
230
+ declare function panIndexRange(current: ChartIndexRange | null, maxCount: number, deltaSteps: number): ChartIndexRange | null;
231
+ declare function normalizeNumericDomain(a: number, b: number): NumericDomain;
232
+ declare function zoomNumericDomain(current: NumericDomain, full: NumericDomain, anchor: number, factor: number): NumericDomain;
233
+ declare function panNumericDomain(current: NumericDomain, full: NumericDomain, delta: number): NumericDomain;
234
+
235
+ declare class CategoricalViewportContext {
236
+ readonly dataCount: _angular_core.WritableSignal<number>;
237
+ readonly brushRange: _angular_core.WritableSignal<ChartIndexRange | null>;
238
+ readonly zoomRange: _angular_core.WritableSignal<ChartIndexRange | null>;
239
+ readonly hasZoom: _angular_core.Signal<boolean>;
240
+ resetZoom(): void;
241
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CategoricalViewportContext, never>;
242
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<CategoricalViewportContext>;
243
+ }
244
+
245
+ declare class ScatterViewportContext {
246
+ readonly innerWidth: _angular_core.WritableSignal<number>;
247
+ readonly innerHeight: _angular_core.WritableSignal<number>;
248
+ readonly fullXDomain: _angular_core.WritableSignal<NumericDomain | null>;
249
+ readonly fullYDomain: _angular_core.WritableSignal<NumericDomain | null>;
250
+ readonly zoomXDomain: _angular_core.WritableSignal<NumericDomain | null>;
251
+ readonly zoomYDomain: _angular_core.WritableSignal<NumericDomain | null>;
252
+ readonly xScale: _angular_core.WritableSignal<ScaleLinear<number, number, never> | null>;
253
+ readonly yScale: _angular_core.WritableSignal<ScaleLinear<number, number, never> | null>;
254
+ readonly hasZoom: _angular_core.Signal<boolean>;
255
+ resetZoom(): void;
256
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ScatterViewportContext, never>;
257
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<ScatterViewportContext>;
258
+ }
259
+
260
+ /** A tick descriptor for rendering axes. */
261
+ interface ChartTick {
262
+ readonly value: string | number;
263
+ /** Offset (px) along the axis. For band scales this is the band center. */
264
+ readonly offset: number;
265
+ /** Display label. */
266
+ readonly label: string;
267
+ }
268
+ /** Produce evenly-spaced ticks for a band (categorical) scale. */
269
+ declare function bandTicks(scale: ScaleBand<string>): ChartTick[];
270
+ /**
271
+ * Produce ticks for a linear scale.
272
+ *
273
+ * @param scale The linear scale.
274
+ * @param count Approximate number of ticks (hint, d3 may return fewer/more).
275
+ * @param formatter Label formatter.
276
+ */
277
+ declare function linearTicks(scale: ScaleLinear<number, number>, count?: number, formatter?: (value: number) => string): ChartTick[];
278
+
279
+ interface ClientPoint {
280
+ readonly clientX: number;
281
+ readonly clientY: number;
282
+ }
283
+ /**
284
+ * Given a pointer event's local (x, y) relative to the chart's inner group,
285
+ * resolve the nearest category index along the categorical axis.
286
+ *
287
+ * @returns index into `ctx.categories()` (or −1 if no scale / no data).
288
+ */
289
+ declare function nearestCategoryIndex(ctx: Pick<CartesianContext, 'categoryScale' | 'categories' | 'orientation'>, localX: number, localY: number): number;
290
+ /** Resolve the client-space center point of a focused or clicked SVG/HTML element. */
291
+ declare function elementClientCenter(target: EventTarget | null): ClientPoint | null;
292
+
293
+ /** Curve type shared by line & area charts. */
294
+ type LineCurve = 'linear' | 'monotone' | 'step';
295
+ /** A single series ready to render as either a line or an area. */
296
+ interface LineSeriesPath {
297
+ readonly seriesKey: string;
298
+ readonly color: string;
299
+ readonly linePath: string;
300
+ /** Optional area path — only populated when `computeAreaLayout` is used. */
301
+ readonly areaPath?: string;
302
+ /** Raw points for dots / active markers. */
303
+ readonly points: readonly LinePoint[];
304
+ }
305
+ /** One resolved (x, y) point for a series. */
306
+ interface LinePoint {
307
+ readonly seriesKey: string;
308
+ readonly datumIndex: number;
309
+ readonly category: string;
310
+ readonly value: number;
311
+ readonly x: number;
312
+ readonly y: number;
313
+ }
314
+ interface CartesianBase {
315
+ readonly data: readonly ChartDatum[];
316
+ readonly xKey: string;
317
+ readonly seriesKeys: readonly string[];
318
+ readonly orientation: ChartOrientation;
319
+ readonly innerWidth: number;
320
+ readonly innerHeight: number;
321
+ readonly curve: LineCurve;
322
+ }
323
+ interface LineLayoutResult {
324
+ readonly series: readonly LineSeriesPath[];
325
+ readonly points: readonly LinePoint[];
326
+ readonly categoryScale: ReturnType<typeof scalePoint<string>>;
327
+ readonly valueScale: ReturnType<typeof scaleLinear<number, number>>;
328
+ readonly categories: readonly string[];
329
+ }
330
+ interface AreaLayoutResult extends LineLayoutResult {
331
+ readonly stacked: boolean;
332
+ }
333
+ /** Build category + value scales for point-based charts (line / area). */
334
+ declare function buildCartesianScales(input: CartesianBase): {
335
+ categories: readonly string[];
336
+ categoryScale: ReturnType<typeof scalePoint<string>>;
337
+ valueScale: ReturnType<typeof scaleLinear<number, number>>;
338
+ };
339
+ /** Compute line-chart geometry. */
340
+ declare function computeLineLayout(input: CartesianBase): LineLayoutResult;
341
+ interface AreaLayoutInput extends CartesianBase {
342
+ readonly stacked: boolean;
343
+ readonly expanded?: boolean;
344
+ }
345
+ /** Compute area-chart geometry (single or stacked). */
346
+ declare function computeAreaLayout(input: AreaLayoutInput): AreaLayoutResult;
347
+
348
+ /**
349
+ * Publish a `scalePoint` from line/area layouts to the `CartesianContext`,
350
+ * which expects a `scaleBand`. Line/area points sit on the range edges (the
351
+ * point scale has zero padding, so the first point touches the y-axis and the
352
+ * last touches the right edge). We extend the band range by half a step on
353
+ * each side so band centers — used to position axis ticks — line up exactly
354
+ * with those edge-touching points.
355
+ *
356
+ * This keeps axes/grid primitives agnostic to whether the underlying chart
357
+ * uses `scaleBand` (bar) or `scalePoint` (line/area).
358
+ */
359
+ declare function pointToBandAdapter(pointScale: ScalePoint<string>, range: [number, number]): ReturnType<typeof scaleBand<string>>;
360
+ /** Recreate a linear scale with the same domain/range (handy for effects). */
361
+ declare function cloneLinear(scale: ReturnType<typeof scaleLinear<number, number>>): ReturnType<typeof scaleLinear<number, number>>;
362
+ declare function provideCartesianFromLineLayout(ctx: CartesianContext, layout: {
363
+ categoryScale: ScalePoint<string>;
364
+ valueScale: ReturnType<typeof scaleLinear<number, number>>;
365
+ categories: readonly string[];
366
+ }, orientation: 'vertical' | 'horizontal', innerWidth: number, innerHeight: number): void;
367
+
368
+ export { CHART_DATA_ATTRIBUTE, CHART_THEMES, CartesianContext, CategoricalViewportContext, ChartContainer, ChartContext, ChartStyle, ScatterViewportContext, bandTicks, buildCartesianScales, buildChartCss, cloneLinear, computeAreaLayout, computeLineLayout, effectiveIndexRange, elementClientCenter, indexRangeSize, linearTicks, nearestCategoryIndex, normalizeIndexRange, normalizeNumericDomain, panIndexRange, panNumericDomain, pointToBandAdapter, provideCartesianFromLineLayout, seriesColorVar, sliceByIndexRange, xScale, yScale, zoomIndexRange, zoomNumericDomain };
369
+ export type { AreaLayoutInput, AreaLayoutResult, CartesianBase, CategoryScale, ChartActivePoint, ChartConfig, ChartDatum, ChartDimensions, ChartIndexRange, ChartMargin, ChartOrientation, ChartSeriesConfig, ChartStyleVariant, ChartThemeKey, ChartTick, ClientPoint, LineCurve, LineLayoutResult, LinePoint, LineSeriesPath, NumericDomain, ValueScale };
@@ -0,0 +1,57 @@
1
+ import * as _ojiepermana_angular_chart_core from '@ojiepermana/angular-chart/core';
2
+ import { ChartOrientation, LineCurve, ChartMargin, ChartDatum, LineSeriesPath, LinePoint } from '@ojiepermana/angular-chart/core';
3
+ export { AreaLayoutInput, AreaLayoutResult, CartesianBase, LineCurve, LineLayoutResult, LinePoint, LineSeriesPath, buildCartesianScales, cloneLinear, computeAreaLayout, computeLineLayout, pointToBandAdapter, provideCartesianFromLineLayout } from '@ojiepermana/angular-chart/core';
4
+ import * as _angular_core from '@angular/core';
5
+
6
+ /** Emitted when a data point is activated (click or keyboard). */
7
+ interface LinePointClickEvent {
8
+ readonly seriesKey: string;
9
+ readonly datumIndex: number;
10
+ readonly category: string;
11
+ readonly value: number;
12
+ readonly datum: ChartDatum;
13
+ }
14
+ declare class LineChart {
15
+ private readonly root;
16
+ private readonly cart;
17
+ private readonly viewport;
18
+ readonly data: _angular_core.InputSignal<readonly Readonly<Record<string, unknown>>[]>;
19
+ readonly xKey: _angular_core.InputSignal<string>;
20
+ readonly orientation: _angular_core.InputSignal<ChartOrientation>;
21
+ readonly styles: _angular_core.InputSignal<"base">;
22
+ readonly curve: _angular_core.InputSignal<LineCurve>;
23
+ readonly margin: _angular_core.InputSignal<ChartMargin>;
24
+ readonly strokeWidth: _angular_core.InputSignal<number>;
25
+ readonly showDots: _angular_core.InputSignal<boolean>;
26
+ readonly dotRadius: _angular_core.InputSignal<number>;
27
+ readonly dotColorKey: _angular_core.InputSignal<string | undefined>;
28
+ readonly dotStrokeColor: _angular_core.InputSignal<string | undefined>;
29
+ readonly dotStrokeWidth: _angular_core.InputSignal<number>;
30
+ readonly showValueLabels: _angular_core.InputSignal<boolean>;
31
+ readonly valueLabelFormat: _angular_core.InputSignal<(value: number) => string>;
32
+ readonly pointClick: _angular_core.OutputEmitterRef<LinePointClickEvent>;
33
+ protected readonly innerWidth: _angular_core.Signal<number>;
34
+ protected readonly innerHeight: _angular_core.Signal<number>;
35
+ protected readonly visibleStartIndex: _angular_core.Signal<number>;
36
+ protected readonly visibleData: _angular_core.Signal<readonly Readonly<Record<string, unknown>>[]>;
37
+ protected readonly layout: _angular_core.Signal<_ojiepermana_angular_chart_core.LineLayoutResult>;
38
+ protected readonly series: _angular_core.Signal<readonly LineSeriesPath[]>;
39
+ protected readonly viewBox: _angular_core.Signal<string>;
40
+ protected readonly innerTransform: _angular_core.Signal<string>;
41
+ protected readonly ariaSummary: _angular_core.Signal<string>;
42
+ constructor();
43
+ protected emitClick(p: LinePoint): void;
44
+ protected setActivePoint(event: FocusEvent, p: LinePoint): void;
45
+ protected clearActivePoint(): void;
46
+ protected dotFill(point: LinePoint, fallbackColor: string): string;
47
+ protected formatValueLabel(point: LinePoint): string;
48
+ protected labelX(point: LinePoint): number;
49
+ protected labelY(point: LinePoint): number;
50
+ protected labelAnchor(): 'middle' | 'start';
51
+ protected pointAriaLabel(p: LinePoint): string;
52
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<LineChart, never>;
53
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<LineChart, "ChartLine", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "xKey": { "alias": "xKey"; "required": true; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "styles": { "alias": "styles"; "required": false; "isSignal": true; }; "curve": { "alias": "curve"; "required": false; "isSignal": true; }; "margin": { "alias": "margin"; "required": false; "isSignal": true; }; "strokeWidth": { "alias": "strokeWidth"; "required": false; "isSignal": true; }; "showDots": { "alias": "showDots"; "required": false; "isSignal": true; }; "dotRadius": { "alias": "dotRadius"; "required": false; "isSignal": true; }; "dotColorKey": { "alias": "dotColorKey"; "required": false; "isSignal": true; }; "dotStrokeColor": { "alias": "dotStrokeColor"; "required": false; "isSignal": true; }; "dotStrokeWidth": { "alias": "dotStrokeWidth"; "required": false; "isSignal": true; }; "showValueLabels": { "alias": "showValueLabels"; "required": false; "isSignal": true; }; "valueLabelFormat": { "alias": "valueLabelFormat"; "required": false; "isSignal": true; }; }, { "pointClick": "pointClick"; }, never, ["svg\\:g[ChartGrid]", "svg\\:g[ChartAxisX]", "svg\\:g[ChartAxisY]", "svg\\:g[ChartCrosshair]", "svg:g[ChartBrush]", "ChartTooltip", "ChartLegend", "ChartZoomControls"], true, never>;
54
+ }
55
+
56
+ export { LineChart };
57
+ export type { LinePointClickEvent };
@@ -0,0 +1,93 @@
1
+ import { ChartDatum, ChartMargin } from '@ojiepermana/angular-chart/core';
2
+ import * as _ojiepermana_angular_chart_pie from '@ojiepermana/angular-chart/pie';
3
+ import * as _angular_core from '@angular/core';
4
+
5
+ interface PieLayoutInput {
6
+ readonly data: readonly ChartDatum[];
7
+ /** Field on each datum whose value is the slice's numeric magnitude. */
8
+ readonly valueKey: string;
9
+ /** Field on each datum whose value is the slice's categorical label. */
10
+ readonly nameKey: string;
11
+ /**
12
+ * Ordered series keys used to resolve color (`var(--color-<key>)`).
13
+ * Must have the same length as `data`. If omitted, falls back to
14
+ * `nameKey` values.
15
+ */
16
+ readonly seriesKeys?: readonly string[];
17
+ readonly innerWidth: number;
18
+ readonly innerHeight: number;
19
+ /** Inner radius for donut-style charts (0 = full pie). */
20
+ readonly innerRadius: number;
21
+ /** Gap between slices, in radians. */
22
+ readonly padAngle: number;
23
+ /** Corner radius for slices (px). */
24
+ readonly cornerRadius: number;
25
+ /** Starting angle in radians (default −π/2 = 12 o'clock). */
26
+ readonly startAngle: number;
27
+ /** Ending angle in radians (default 3π/2). */
28
+ readonly endAngle: number;
29
+ readonly activeIndex?: number;
30
+ readonly activeOffset?: number;
31
+ }
32
+ interface PieSliceRect {
33
+ readonly seriesKey: string;
34
+ readonly name: string;
35
+ readonly value: number;
36
+ readonly datumIndex: number;
37
+ readonly color: string;
38
+ readonly arcPath: string;
39
+ readonly centroid: readonly [number, number];
40
+ readonly startAngle: number;
41
+ readonly endAngle: number;
42
+ readonly translateX: number;
43
+ readonly translateY: number;
44
+ }
45
+ interface PieLayout {
46
+ readonly slices: readonly PieSliceRect[];
47
+ readonly centerX: number;
48
+ readonly centerY: number;
49
+ readonly outerRadius: number;
50
+ }
51
+ declare function computePieLayout(input: PieLayoutInput): PieLayout;
52
+
53
+ interface PieSliceClickEvent {
54
+ readonly seriesKey: string;
55
+ readonly name: string;
56
+ readonly value: number;
57
+ readonly datumIndex: number;
58
+ readonly datum: ChartDatum;
59
+ }
60
+ declare class PieChart {
61
+ private readonly root;
62
+ readonly data: _angular_core.InputSignal<readonly Readonly<Record<string, unknown>>[]>;
63
+ readonly valueKey: _angular_core.InputSignal<string>;
64
+ readonly nameKey: _angular_core.InputSignal<string>;
65
+ readonly seriesKeys: _angular_core.InputSignal<readonly string[] | undefined>;
66
+ readonly styles: _angular_core.InputSignal<"base">;
67
+ readonly margin: _angular_core.InputSignal<ChartMargin>;
68
+ readonly innerRadius: _angular_core.InputSignal<number>;
69
+ readonly padAngle: _angular_core.InputSignal<number>;
70
+ readonly cornerRadius: _angular_core.InputSignal<number>;
71
+ readonly startAngle: _angular_core.InputSignal<number>;
72
+ readonly endAngle: _angular_core.InputSignal<number>;
73
+ readonly showLabels: _angular_core.InputSignal<boolean>;
74
+ readonly activeIndex: _angular_core.InputSignal<number | undefined>;
75
+ readonly activeOffset: _angular_core.InputSignal<number>;
76
+ readonly sliceClick: _angular_core.OutputEmitterRef<PieSliceClickEvent>;
77
+ protected readonly innerWidth: _angular_core.Signal<number>;
78
+ protected readonly innerHeight: _angular_core.Signal<number>;
79
+ protected readonly layout: _angular_core.Signal<_ojiepermana_angular_chart_pie.PieLayout>;
80
+ protected readonly viewBox: _angular_core.Signal<string>;
81
+ protected readonly innerTransform: _angular_core.Signal<string>;
82
+ protected readonly ariaSummary: _angular_core.Signal<string>;
83
+ protected sliceAriaLabel(s: PieSliceRect): string;
84
+ protected sliceTransform(s: PieSliceRect): string | null;
85
+ protected emitClick(s: PieSliceRect): void;
86
+ protected setActive(event: PointerEvent | FocusEvent, s: PieSliceRect): void;
87
+ protected clearActive(): void;
88
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<PieChart, never>;
89
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<PieChart, "ChartPie", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "valueKey": { "alias": "valueKey"; "required": true; "isSignal": true; }; "nameKey": { "alias": "nameKey"; "required": true; "isSignal": true; }; "seriesKeys": { "alias": "seriesKeys"; "required": false; "isSignal": true; }; "styles": { "alias": "styles"; "required": false; "isSignal": true; }; "margin": { "alias": "margin"; "required": false; "isSignal": true; }; "innerRadius": { "alias": "innerRadius"; "required": false; "isSignal": true; }; "padAngle": { "alias": "padAngle"; "required": false; "isSignal": true; }; "cornerRadius": { "alias": "cornerRadius"; "required": false; "isSignal": true; }; "startAngle": { "alias": "startAngle"; "required": false; "isSignal": true; }; "endAngle": { "alias": "endAngle"; "required": false; "isSignal": true; }; "showLabels": { "alias": "showLabels"; "required": false; "isSignal": true; }; "activeIndex": { "alias": "activeIndex"; "required": false; "isSignal": true; }; "activeOffset": { "alias": "activeOffset"; "required": false; "isSignal": true; }; }, { "sliceClick": "sliceClick"; }, never, ["ChartPieCenter", "ChartTooltip", "ChartLegend"], true, never>;
90
+ }
91
+
92
+ export { PieChart, computePieLayout };
93
+ export type { PieLayout, PieLayoutInput, PieSliceClickEvent, PieSliceRect };