@konce-pt/angular 0.18.0 → 0.18.2
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.
- package/CHANGELOG.md +58 -0
- package/charts/src/lib/llms.txt +116 -100
- package/fesm2022/konce-pt-angular-charts.mjs +451 -336
- package/fesm2022/konce-pt-angular-charts.mjs.map +1 -1
- package/fesm2022/konce-pt-angular.mjs.map +1 -1
- package/package.json +13 -13
- package/types/konce-pt-angular-charts.d.ts +48 -7
- package/types/konce-pt-angular-charts.d.ts.map +1 -1
- package/types/konce-pt-angular.d.ts +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# @konce-pt/angular
|
|
2
2
|
|
|
3
|
+
## 0.18.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- `kpt-chart` / `KptChart` rysuje w pikselach swojego kontenera: `ResizeObserver` mierzy szerokość płótna,
|
|
8
|
+
a viewBox idzie za nią. Długości rosną z kontenerem, a tekst osi i grubość linii zostają stałe - wcześniej
|
|
9
|
+
stały viewBox 600x360 skalował się w całości, więc na szerokim ekranie tekst puchł i się rozmywał, a w wąskiej
|
|
10
|
+
kolumnie malał. `width`/`height` wyznaczają już tylko proporcję i pierwszą klatkę przed pomiarem.
|
|
11
|
+
|
|
12
|
+
Tekst osi ma rozmiar z tokenu `--kpt-chart-font-size` (domyślnie `--kpt-font-size-sm`, 14px - jak dymek
|
|
13
|
+
i legenda; wcześniej 11px). Marginesy, odstęp etykiet od osi, pigułka prowadnicy i przerzedzanie etykiet
|
|
14
|
+
liczą się z niego przez nowe `chartMetrics(fontSize)` w `@konce-pt/chart`.
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @konce-pt/chart@0.18.2
|
|
18
|
+
- @konce-pt/backdrop@0.18.2
|
|
19
|
+
- @konce-pt/chat@0.18.2
|
|
20
|
+
- @konce-pt/datetime@0.18.2
|
|
21
|
+
- @konce-pt/i18n@0.18.2
|
|
22
|
+
- @konce-pt/icons@0.18.2
|
|
23
|
+
- @konce-pt/map@0.18.2
|
|
24
|
+
- @konce-pt/mention@0.18.2
|
|
25
|
+
- @konce-pt/motion@0.18.2
|
|
26
|
+
- @konce-pt/roadmap@0.18.2
|
|
27
|
+
- @konce-pt/speech@0.18.2
|
|
28
|
+
- @konce-pt/table@0.18.2
|
|
29
|
+
|
|
30
|
+
## 0.18.1
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- 6faf0a5: Gęsta oś kategorii w `kpt-chart`, w obu portach.
|
|
35
|
+
|
|
36
|
+
- Etykiety osi kategorii nie nachodzą już na siebie: gdy wszystkie się nie mieszczą, wykres pokazuje
|
|
37
|
+
równy podział - 9 etykiet (ósemki osi), 5 (pierwsza, 1/4, środek, 3/4, ostatnia), 3 albo same skrajne.
|
|
38
|
+
Wykres, którego etykiety się mieszczą, wygląda jak dotąd. Słupki poziome przerzedzają tak samo wiersze.
|
|
39
|
+
- Skrajne etykiety i pigułka prowadnicy (`crosshair`) nie wychodzą poza wykres - ostatnia etykieta
|
|
40
|
+
nie jest już ucinana przy prawej krawędzi.
|
|
41
|
+
- Wykres liniowy ma małą kropkę pod każdą kategorią na osi; aktywna rośnie przy najechaniu. Pełną nazwę
|
|
42
|
+
kategorii spoza widocznych etykiet pokazuje pigułka prowadnicy i dymek.
|
|
43
|
+
- `@konce-pt/chart`: `axisLabelIndices`, `estimateLabelWidth`, `clampLabel`, z testami.
|
|
44
|
+
- Eksport typów, których brakowało przy nowym API 0.18.0: `KptColumnGroup` z `@konce-pt/angular`
|
|
45
|
+
oraz `KptValueAxisOptions` z `@konce-pt/angular/charts` i `@konce-pt/react/charts`.
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [6faf0a5]
|
|
48
|
+
- @konce-pt/chart@0.18.1
|
|
49
|
+
- @konce-pt/backdrop@0.18.1
|
|
50
|
+
- @konce-pt/chat@0.18.1
|
|
51
|
+
- @konce-pt/datetime@0.18.1
|
|
52
|
+
- @konce-pt/i18n@0.18.1
|
|
53
|
+
- @konce-pt/icons@0.18.1
|
|
54
|
+
- @konce-pt/map@0.18.1
|
|
55
|
+
- @konce-pt/mention@0.18.1
|
|
56
|
+
- @konce-pt/motion@0.18.1
|
|
57
|
+
- @konce-pt/roadmap@0.18.1
|
|
58
|
+
- @konce-pt/speech@0.18.1
|
|
59
|
+
- @konce-pt/table@0.18.1
|
|
60
|
+
|
|
3
61
|
## 0.18.0
|
|
4
62
|
|
|
5
63
|
### Minor Changes
|
package/charts/src/lib/llms.txt
CHANGED
|
@@ -1,100 +1,116 @@
|
|
|
1
|
-
# KptChart (kpt-chart)
|
|
2
|
-
|
|
3
|
-
An SVG chart in plain Angular (signals, zoneless), with no Chart.js/D3-style dependency.
|
|
4
|
-
The computation core lives in `@konce-pt/chart` - plain TypeScript, tested, shared with the React port.
|
|
5
|
-
Import: `import { KptChart } from '@konce-pt/angular/charts';`
|
|
6
|
-
|
|
7
|
-
## Chart types (config.type)
|
|
8
|
-
- `line` - a line chart; interpolation `linear` | `cubic` | `cubic-monotonic`; `area?: boolean`, `points?: boolean`,
|
|
9
|
-
`crosshair?: boolean` (hovering a point -> a vertical guide + a highlighted pill on the X axis label)
|
|
10
|
-
- `bar` - a bar chart; `orientation: 'vertical' | 'horizontal'`, `borderRadius?: px`
|
|
11
|
-
- `pie` - a pie chart
|
|
12
|
-
- `doughnut` - a doughnut; `innerRadius?: 0..1` (default 0.6)
|
|
13
|
-
- `polarArea` - equal angles, the radius proportional to the value
|
|
14
|
-
- `radar` - radial axes + a polygon per series
|
|
15
|
-
|
|
16
|
-
## Value axis and stacking (line, bar)
|
|
17
|
-
- `valueAxis?: { zero?, min?, max? }` - the value axis starts at zero by default, so a bar and the area under a line
|
|
18
|
-
show the size directly. `zero: false` fits the axis to the data (a weight of 79-90 kg is no longer a flat line under
|
|
19
|
-
the ceiling); `min` / `max` pin an end of the axis exactly and win over `zero` - a value beyond a pinned end is
|
|
20
|
-
cut at the edge. Bars and areas grow from zero, or from the end of the axis nearer to it
|
|
21
|
-
- `stacked?: boolean` - stacked series: bars on top of each other in one band per category (positive values up,
|
|
22
|
-
negative down; only the outer segment is rounded), lines as running totals with a band under each one (with
|
|
23
|
-
`area`). The axis covers the totals; the tooltip shows the values of the series, not the totals
|
|
24
|
-
- The rules live in `@konce-pt/chart`: `axisScale`, `chartScale`, `stackSeries`, `bandPath` (tested)
|
|
25
|
-
|
|
26
|
-
##
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
The
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
- `
|
|
39
|
-
- `
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
###
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
The
|
|
74
|
-
`
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
##
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
1
|
+
# KptChart (kpt-chart)
|
|
2
|
+
|
|
3
|
+
An SVG chart in plain Angular (signals, zoneless), with no Chart.js/D3-style dependency.
|
|
4
|
+
The computation core lives in `@konce-pt/chart` - plain TypeScript, tested, shared with the React port.
|
|
5
|
+
Import: `import { KptChart } from '@konce-pt/angular/charts';`
|
|
6
|
+
|
|
7
|
+
## Chart types (config.type)
|
|
8
|
+
- `line` - a line chart; interpolation `linear` | `cubic` | `cubic-monotonic`; `area?: boolean`, `points?: boolean`,
|
|
9
|
+
`crosshair?: boolean` (hovering a point -> a vertical guide + a highlighted pill on the X axis label)
|
|
10
|
+
- `bar` - a bar chart; `orientation: 'vertical' | 'horizontal'`, `borderRadius?: px`
|
|
11
|
+
- `pie` - a pie chart
|
|
12
|
+
- `doughnut` - a doughnut; `innerRadius?: 0..1` (default 0.6)
|
|
13
|
+
- `polarArea` - equal angles, the radius proportional to the value
|
|
14
|
+
- `radar` - radial axes + a polygon per series
|
|
15
|
+
|
|
16
|
+
## Value axis and stacking (line, bar)
|
|
17
|
+
- `valueAxis?: { zero?, min?, max? }` - the value axis starts at zero by default, so a bar and the area under a line
|
|
18
|
+
show the size directly. `zero: false` fits the axis to the data (a weight of 79-90 kg is no longer a flat line under
|
|
19
|
+
the ceiling); `min` / `max` pin an end of the axis exactly and win over `zero` - a value beyond a pinned end is
|
|
20
|
+
cut at the edge. Bars and areas grow from zero, or from the end of the axis nearer to it
|
|
21
|
+
- `stacked?: boolean` - stacked series: bars on top of each other in one band per category (positive values up,
|
|
22
|
+
negative down; only the outer segment is rounded), lines as running totals with a band under each one (with
|
|
23
|
+
`area`). The axis covers the totals; the tooltip shows the values of the series, not the totals
|
|
24
|
+
- The rules live in `@konce-pt/chart`: `axisScale`, `chartScale`, `stackSeries`, `bandPath` (tested)
|
|
25
|
+
|
|
26
|
+
## Category axis (line, bar)
|
|
27
|
+
- When the category labels do not fit, the axis shows an even subset instead of overlapping text: all of
|
|
28
|
+
them if they fit, otherwise the densest split that fits - 9 labels (eighths of the axis), 5 (first, 1/4,
|
|
29
|
+
middle, 3/4, last), 3, and finally the two ends only. Horizontal bars apply the same rule to the rows
|
|
30
|
+
- The choice is made in on-screen pixels (the chart measures its container), so a narrow column shows fewer
|
|
31
|
+
labels and a wide one more; the outer labels and the
|
|
32
|
+
crosshair pill are shifted inward so they never leave the chart
|
|
33
|
+
- A line chart marks every category with a small dot on the axis; the active one grows on hover. The full
|
|
34
|
+
name of any category stays in the crosshair pill and the tooltip
|
|
35
|
+
- The rules live in `@konce-pt/chart`: `axisLabelIndices`, `estimateLabelWidth`, `clampLabel` (tested)
|
|
36
|
+
|
|
37
|
+
## Inputs
|
|
38
|
+
- `config: KptChartConfig` (required) - a single object driving everything
|
|
39
|
+
- `width` / `height`: the aspect ratio (default 600x360); the chart fills the width of its container
|
|
40
|
+
|
|
41
|
+
The chart draws in the pixels of its container: a `ResizeObserver` measures the canvas width and the
|
|
42
|
+
viewBox follows it, the height comes from the `width`/`height` ratio. Lengths grow and shrink with the
|
|
43
|
+
container, while the text (axis labels, 14px by default) and the line weights stay real pixels - the
|
|
44
|
+
same in a 300px column and on a 3000px screen. `width`/`height` are therefore only the aspect ratio and the
|
|
45
|
+
size of the first frame before the measurement arrives (SSR); there is no need to scale them by hand.
|
|
46
|
+
|
|
47
|
+
## KptChartConfig (in brief)
|
|
48
|
+
- `labels: string[]`, `series: { name; data: number[]; color? }[]`
|
|
49
|
+
- `legend`: `{ display?, position: top|bottom|left|right, align: start|center|end, pointStyle: circle|rect|rectRot|triangle|line, title? }`
|
|
50
|
+
- `title` / `subtitle`: `{ display?, text, align, color?, font?, padding? }`
|
|
51
|
+
- `tooltip`: `{ enabled?, format?(ctx: {series,label,value}): string, motion?: boolean }`
|
|
52
|
+
- `animation`: `{ enabled?, duration=400, delay=0, stagger=60, update?: boolean, delta?: boolean }`
|
|
53
|
+
- `ariaLabel?`: string - the chart's accessible name; `description?`: string - the takeaway for a screen reader
|
|
54
|
+
|
|
55
|
+
## Interactions
|
|
56
|
+
- Line and bar: the pointer anywhere over the plot picks the nearest category; the tooltip lists every visible
|
|
57
|
+
series at that category and travels from category to category without fading out in between.
|
|
58
|
+
- Slice/radar point: hovering the element -> a tooltip (series, label, value).
|
|
59
|
+
- The bubble never leaves the chart: it is clamped by its real width, not by its center.
|
|
60
|
+
- Clicking the legend -> hide/show a series (pie/doughnut/polar: hide a slice) with the scale recomputed.
|
|
61
|
+
- Hovering the legend -> highlight that series, dim the rest.
|
|
62
|
+
|
|
63
|
+
## Animations
|
|
64
|
+
Line: `stroke-dasharray/offset`. Bars: `scaleY/scaleX` (origin at the axis). Slices/radar: `scale` from the center.
|
|
65
|
+
Stagger `delay = index * stagger`. Disabled by `animation.enabled=false` and by `prefers-reduced-motion`.
|
|
66
|
+
|
|
67
|
+
### Data updates (same chart, new values)
|
|
68
|
+
A new `config` with the same type, categories and series names is a data update, not a new chart. The values
|
|
69
|
+
travel as a wave from left to right (springs with a damped wobble, 70 ms per category), and a light sheen runs
|
|
70
|
+
with the wave front. Line and bar charts also keep the previous state on screen for 1.7 s: a dashed ghost,
|
|
71
|
+
up/down segments between old and new values (`--kpt-color-success` / `--kpt-color-danger`, override with
|
|
72
|
+
`--kpt-chart-delta-up` / `--kpt-chart-delta-down`) and the difference above each point that changed by 2% or
|
|
73
|
+
more. The value axis holds both states while the ghost is visible, then zooms to the new data. Sheen color:
|
|
74
|
+
`--kpt-chart-sheen` (default `--kpt-color-info`). `animation.update: false` - values jump; `animation.delta:
|
|
75
|
+
false` - the wave without ghost, segments, differences and sheen. Another chart shape (type, categories,
|
|
76
|
+
series) plays the regular entry animation.
|
|
77
|
+
|
|
78
|
+
### Tooltip motion
|
|
79
|
+
The bubble, the crosshair and the category pill travel to the next category (460 ms, emphasized curve), the
|
|
80
|
+
digits of the value roll on reels to the new number, the category name slides in from the direction of travel
|
|
81
|
+
and the target point of a line sends out a ripple. Leaving the chart fades the bubble out. `tooltip.motion:
|
|
82
|
+
false` - the bubble jumps.
|
|
83
|
+
|
|
84
|
+
The code-driven motion (data updates, tooltip) is off with `animation.enabled: false`, with
|
|
85
|
+
`provideKptMotion({ enabled: false })` and with the system "reduce motion" setting. The data table for screen
|
|
86
|
+
readers always reads the final values from `config`.
|
|
87
|
+
|
|
88
|
+
## Example
|
|
89
|
+
<kpt-chart [config]="{
|
|
90
|
+
type: 'line',
|
|
91
|
+
labels: ['Jan','Feb','Mar'],
|
|
92
|
+
series: [{ name: 'Sales', data: [12, 19, 7] }],
|
|
93
|
+
interpolation: 'cubic-monotonic',
|
|
94
|
+
legend: { position: 'top' }
|
|
95
|
+
}" />
|
|
96
|
+
|
|
97
|
+
## Accessibility
|
|
98
|
+
The `<svg>` is `role="img"` with a name: `config.ariaLabel`, else the title text, else `chart.label`
|
|
99
|
+
from i18n. `config.description` (one sentence with the takeaway) is tied to it through
|
|
100
|
+
`aria-describedby`. The data itself sits in a visually hidden `<table>` (categories in rows, series in
|
|
101
|
+
columns, numbers in the active language), so a screen reader can walk the values - the tooltip is
|
|
102
|
+
pointer-only. The legend is a list of real buttons, so series can be toggled from the keyboard.
|
|
103
|
+
|
|
104
|
+
## Tokens / styling
|
|
105
|
+
The palette comes from the semantic tokens (`--kpt-color-primary|info|success|warning|danger` + the scale).
|
|
106
|
+
SCSS lives in `@layer kpt.components`, classes `kpt-chart__*`. Series colors can be overridden through `series[].color`.
|
|
107
|
+
Axis text size: `--kpt-chart-font-size` on the chart (default `--kpt-font-size-sm`, 14px - the size of the
|
|
108
|
+
tooltip and the legend). The SVG text inherits it, and the component reads the computed value to derive
|
|
109
|
+
everything that sits next to the text - the margins for the labels, the gap between a label and its axis,
|
|
110
|
+
the crosshair pill, the label thinning (`chartMetrics` in `@konce-pt/chart`). Override it in CSS, the
|
|
111
|
+
layout follows: `.revenue kpt-chart { --kpt-chart-font-size: 12px; }`.
|
|
112
|
+
|
|
113
|
+
## Core (pure TS, optional)
|
|
114
|
+
Exported functions: `linePath`, `areaPath`, `barLayout`, `pieSlices`, `polarSlices`, `radarGrid`,
|
|
115
|
+
`radarPoints`, `niceScale`, `seriesColor`, `KPT_CHART_PALETTE` - for your own extensions or SSR.
|
|
116
|
+
They are re-exported from `@konce-pt/chart`, so an app never has to install that package itself.
|