@praxisui/charts 10.0.0-rc.53 → 10.0.0-rc.55

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/README.md CHANGED
@@ -121,7 +121,9 @@ Use the component with either local data or governed remote execution:
121
121
 
122
122
  - `dataSource.kind = 'local'`: the chart consumes rows supplied in `dataSource.items` or the `data` input.
123
123
  - `dataSource.kind = 'remote'`: the chart emits `queryRequest`, then uses a host `remoteDataResolver` or the default `PraxisChartStatsApiService` path for `praxis.stats`.
124
- - `praxis.stats/comparison`: analytics projections materialize one `Current` and one `Previous` series per governed metric. The starter remains responsible for period resolution, bucket union, delta and baseline semantics; charts only render the returned period values.
124
+ - `praxis.stats/comparison`: analytics projections materialize one `Current` and one `Previous` series per governed metric, while `PraxisChartStatsApiService` also preserves backend `delta`, `deltaPercent`, and `baselineMissing` values. Configurable display via `comparison` (`showDelta`, `showDeltaPercent`, `showInTooltip`, `showInLabels`) surfaces variation cleanly in tooltips, compact non-overlapping series labels, the accessible table, and enriched KPI cards without cluttering `390px` viewports.
125
+ - Reference annotations (`referenceLines`, `referenceBands`, `targetMarkers`): renderer-neutral thresholds, tolerance bands, and coordinate milestones bound to governed semantic tones (`info`, `success`, `warning`, `danger`, `critical`, `neutral`) and surfaced in both ECharts (`MarkLine`, `MarkArea`, `MarkPoint`) and the accessible structured data panel.
126
+ - Declarative scalability & renderer options (`dataZoom`, `axisScaleBreak`, `labelLayout`, `renderer`): temporal/axis window zoom (`DataZoomComponent`), automatic or explicit ECharts 6 outlier scale breaks (`AxisBreak`), automatic label overlap prevention (`LabelLayout`), and `'canvas' | 'svg'` renderer selection (`SVGRenderer`) without exposing raw engine options.
125
127
  - `queryContext`: primary input for dynamic-page orchestration; filters, sort and limit are merged into remote requests where supported.
126
128
  - `filterCriteria`: accepted as a compatibility bridge, but new integrations should use `queryContext`.
127
129
  - `pointClick`: raw renderer-neutral point evidence. Configured click actions are emitted separately through `pointAction`.
@@ -160,11 +162,12 @@ The structured alternative is automatic. It does not add an accessibility field
160
162
  Standalone charts render that toggle inside the component. When the chart is loaded by `WidgetShell`, it contributes the same stateful action to the shell toolbar and suppresses the duplicate internal control. The visual canvas becomes hidden and inert while the opaque structured-data surface is active, so the two representations never compete visually or interactively.
161
163
 
162
164
  Supported canonical kinds are `bar`, `horizontal-bar`, `line`, `area`, `stacked-bar`,
163
- `stacked-area`, `combo`, `pie`, `donut`, `scatter`, `funnel`, `pyramid`, `treemap`, and `gauge`. Funnel,
164
- pyramid, and treemap require one categorical dimension and exactly one non-negative metric. Funnel
165
- and pyramid preserve the canonical row order; pyramid reverses the visual direction without sorting
166
- stages by value. Treemap materializes the same governed category/metric buckets as proportional
167
- rectangles without introducing hierarchy or engine-specific options into the public contract.
165
+ `stacked-area`, `combo`, `pie`, `donut`, `scatter`, `funnel`, `pyramid`, `treemap`, `sunburst`,
166
+ `sankey`, `radar`, `gauge`, `heatmap`, `boxplot`, `calendar`, and `waterfall`. Funnel,
167
+ pyramid, and flat 1D treemap require one categorical dimension and exactly one non-negative metric. Funnel
168
+ stages by value. Flat 1D treemap preserves the governed category/metric bucket contract untouched,
169
+ while multilevel `treemap` and `sunburst` share an ordered `dimensions[]` / `path` / `parentId` /
170
+ `children` hierarchical tree builder (see [`ADR-0003`](./docs/adr/0003-hierarchical-sunburst-treemap-and-sankey-links.md)).
168
171
  Gauge requires one dimension, exactly one metric and an explicit finite `gauge.scale` whose `max`
169
172
  is greater than `min`. A remote gauge uses `praxis.stats` `group-by` with
170
173
  `source.options.limit = 1`; zero or multiple buckets, non-finite values and values outside the
@@ -172,20 +175,33 @@ declared scale fail closed instead of being clamped. Pointer, ticks and angles r
172
175
  details and are not part of the public contract.
173
176
  Scatter accepts one or two metrics. With one metric, the first dimension is X and the metric is Y.
174
177
  With two metrics, the first dimension remains the grouped bucket identity while the first and second
175
- metrics map to X and Y; the canonical mapper derives the multi-metric stats request.
178
+ metrics map to X and Y; the canonical mapper derives the multi-metric stats request, and
179
+ `AnalyticsChartConfigAdapterService` automatically maps `intent: 'correlation'` projections to
180
+ `scatter`.
181
+ Heatmap requires exactly two dimensions (X and Y matrix axes) and one numeric metric, rendering a
182
+ continuous `visualMap` gradient that distinguishes literal `0` values from missing cells (`null`).
183
+ Boxplot renders category quartile distributions (`min`, `Q1`, `median`, `Q3`, `max`) plus Tukey `1.5 × IQR` outliers and sample size (`n`); remote `praxis.stats` queries request `MIN`, `PERCENTILE_25`, `MEDIAN`/`PERCENTILE_50`, `PERCENTILE_75`, `MAX` (plus optional `COUNT`) while preserving LGPD `suppressed`/`suppressedBucketCount`/`minBucketCount` governance.
184
+ Calendar renders daily intensity heatmaps across a configurable `range` (`'YYYY'`, `'YYYY-MM'`, or `[startDate, endDate]`) from `praxis.stats` `timeseries` (`DAY`) or active intervals `[dtini, dtfim]`, strictly separating `0` (literal zero) from `null` (omitted/suppressed) and missing days, with accessible dark/light token palettes and `crossFilter` emitting `'YYYY-MM-DD'`.
185
+ Waterfall renders ordered cumulative flow steps (`start`, `increase`, `decrease`, `subtotal`, `total`) preserving declared input order, stacked transparent base bars, step connectors, and explicit `+`/`-`/`=` formatted deltas without double negatives (`-R$ -...`).
186
+ In `AnalyticsChartConfigAdapterService`, non-comparison multi-metric projections also infer
187
+ `combo` with a right-hand secondary axis (`axis: 'secondary'`) whenever `secondaryMetrics`
188
+ explicitly requests `'secondary'` or diverges in unit, format family, or aggregation scale, while
189
+ semantic hints or quartile metric bundles materialize `boxplot`, `calendar`, and `waterfall` through existing `distribution`, `trend`, and `composition` intents.
176
190
 
177
191
  ## Governed chart/table presentation
178
192
 
179
- `PraxisAnalyticsPresentationComponent` materializes an existing `x-ui.analytics` projection as a
180
- chart or analytic table. The projection is selected by exact `projectionId`; the component reuses
181
- `AnalyticsPresentationResolver` and the official Charts/Table adapters instead of rebuilding stats
182
- requests.
193
+ `PraxisAnalyticsPresentationComponent` materializes an existing `x-ui.analytics` projection across
194
+ `chart`, `analytic-table`, `kpi`, and `summary-list`. When `analytics.projections` publishes more
195
+ than one projection, the toolbar exposes an accessible projection selector that preserves active
196
+ presentation family eligibility and `queryContext`. The projection is selected by exact
197
+ `projectionId`; the component reuses `AnalyticsPresentationResolver` and the official Charts/Table
198
+ adapters instead of rebuilding stats requests.
183
199
 
184
200
  ```html
185
201
  <praxis-analytics-presentation
186
202
  [analytics]="analytics"
187
203
  projectionId="supplier-procurement-funnel"
188
- [availableFamilies]="['chart', 'analytic-table']"
204
+ [availableFamilies]="['chart', 'analytic-table', 'kpi', 'summary-list']"
189
205
  [preferredFamily]="savedPreference"
190
206
  [queryContext]="queryContext"
191
207
  (presentationChange)="rememberTemporarily($event)"
@@ -196,10 +212,12 @@ Choice precedence is temporary user choice, persisted `preferredFamily`, then pr
196
212
  `availableFamilies` must already reflect host policy/capabilities; the runtime intersects it with
197
213
  installed and semantically eligible renderers. Incompatible preferences fail closed. Switching
198
214
  renderer may execute the same canonical query again; when projection, family or `queryContext`
199
- changes, the component unsubscribes the previous Table/KPI request so the HTTP transport is
200
- aborted instead of merely ignoring a stale result. KPI is eligible for canonical `group-by`
201
- projections with exactly one primary metric. Summary-list remains unavailable until it has a
202
- canonical remote renderer.
215
+ changes, the component unsubscribes the previous Table/KPI/Summary-list request so the HTTP
216
+ transport is aborted instead of merely ignoring a stale result. KPI is eligible for canonical
217
+ `group-by` and `comparison` projections with one primary metric, enriched with comparison delta
218
+ badges and `<praxis-micro-visualization [interactiveContainer]="true">`. `summary-list` renders an
219
+ ordered, keyboard-accessible proportional summary list with normalized bar shares and comparison
220
+ delta badges when published by the projection's `preferredFamilies`.
203
221
 
204
222
  ## Canonical Chart Documents
205
223
 
@@ -282,9 +300,9 @@ computed appearance values are transient and never saved into the chart document
282
300
  `PraxisChartConfig.motion` and `PraxisXUiChartContract.motion` govern both initial entrance animations and data/filter transition animations without exposing raw engine timing properties:
283
301
 
284
302
  - `enabled: false`: disables initial and update animations (`animationThreshold: 0`).
285
- - `preset: 'subtle'`: fast, understated corporate cadence (`240ms` entrance, `200ms` update, `cubicOut`, `animationThreshold: 1000`).
286
- - `preset: 'standard'` (default when motion is enabled): balanced analytical transition (`420ms` entrance, `320ms` update, `cubicOut` / `cubicInOut`, `animationThreshold: 1500`).
287
- - `preset: 'expressive'`: emphasized storytelling cadence (`680ms` entrance, `520ms` update, `quinticOut` / `cubicInOut`, `animationThreshold: 2000`).
303
+ - `preset: 'subtle'`: fast, understated corporate cadence (`220ms` entrance, `180ms` update, `cubicOut`, `animationThreshold: 1000`).
304
+ - `preset: 'standard'` (default when motion is enabled): balanced analytical transition (`450ms` entrance, `320ms` update, `cubicOut` / `cubicInOut`, `animationThreshold: 1500`).
305
+ - `preset: 'expressive'`: emphasized storytelling cadence (`750ms` entrance, `520ms` update, `quinticOut` / `cubicInOut`, `animationThreshold: 2000`).
288
306
 
289
307
  When `queryContext`, `filterCriteria`, or `data` changes for the same governed chart structure and remote resource identity, the default ECharts adapter updates the existing instance with `{ notMerge: false, replaceMerge: ['series'] }` so bars, lines, slices, and gauges interpolate smoothly between filter states. Structural or chrome mutations (chart kind, axis bounds, legend/tooltip visibility, titles, or switching to a different remote `resourcePath`/`resourceKey`) force a clean state reset (`setOption(option, true)` or canvas teardown) so stale options never leak across resources.
290
308
 
@@ -309,11 +327,12 @@ The table-safe kinds currently aligned with `PraxisPresentationVisualizationKind
309
327
  - `bullet`
310
328
  - `delta`
311
329
  - `processFlow`
330
+ - `waterfall` (compact flow bridges for cards and `kpiBand`)
312
331
 
313
332
  The component does not instantiate ECharts. It renders lightweight HTML/CSS/SVG from `PraxisPresentationVisualizationConfig`
314
333
  and falls back to `fallbackText` when the visualization kind cannot be rendered for the current compact surface.
315
334
  Use `points` as the canonical numeric series for `line`, `area`, `column`, and `comparison` (accepting raw numbers or `{ value, label }` points);
316
- use `segments` for `stackedBar` (with optional `title` and `legend: true` on non-`table-cell` surfaces), `thresholds` and `targetLabel` (e.g., `'Meta'`, `'Teto'`, `'Limite'`, `'Alerta'`) for `bullet` and `delta`, and `items` for item/step-oriented visualizations such as `processFlow`.
335
+ use `segments` for `stackedBar` (with optional `title` and `legend: true` on non-`table-cell` surfaces), `thresholds` and `targetLabel` (e.g., `'Meta'`, `'Teto'`, `'Limite'`, `'Alerta'`) for `bullet` and `delta`, and `items` for item/step-oriented visualizations such as `processFlow` and `waterfall` (with optional `role`: `'start' | 'increase' | 'decrease' | 'subtotal' | 'total'`).
317
336
  For `line`, `area`, and `column`, optional `min`/`max` bounds control the vertical domain, `target` and `baseline` render dashed horizontal reference lines inside the SVG plot, and `valueSuffix` appends a unit suffix to readouts and endpoint labels.
318
337
  Floating hover/focus telemetry readouts (`data-micro-readout`) are rendered via `PraxisMicroTooltipOverlayService` directly in `document.body` / HTML Top Layer so ancestor `overflow: hidden`, sticky headers, virtual scroll viewports, and card `transform` states never clip or duplicate percentages.
319
338
  On non-`table-cell` surfaces (`list-item`, `object-header`, `card-summary`, `form-presentation`), multi-item visualizations (`stackedBar`, `comparison`, `line`, `area`, `column`, `processFlow`) expose a single keyboard stop (`tabindex="0"`) on the figure container supporting `ArrowLeft`/`ArrowRight`/`ArrowUp`/`ArrowDown`/`Home`/`End`/`Escape` scrubbing with polite `aria-live` announcements, while `surface: 'table-cell'` or `[interactiveContainer]="true"` (when nested inside a clickable KPI card) keeps zero internal `tabindex` stops so grid/card keyboard navigation remains unobstructed.
@@ -325,7 +344,7 @@ The Dynamic Page Lab's preset studio includes “Testar com componentes reais”
325
344
 
326
345
  ## Authoring Surface
327
346
 
328
- `PraxisChartConfigEditor` is the initial editor shell for canonical `x-ui.chart` documents. It consumes governed resources, fields and targets and emits structured apply/save/reset events. The authoring manifest is exported as `PRAXIS_CHARTS_AUTHORING_MANIFEST` for backend/tooling workflows that need executable chart-edit operations.
347
+ `PraxisChartConfigEditor` is the initial frameless editor shell for canonical `x-ui.chart` documents. It consumes governed resources, fields and targets, provides frameless authoring for reference lines/bands/markers, scalability (`dataZoom`, `axisScaleBreak`, `labelLayout`, `renderer`), comparison delta visibility, and bidirectional `visual ↔ JSON` round-trip, and emits structured apply/save/reset events. The authoring manifest is exported as `PRAXIS_CHARTS_AUTHORING_MANIFEST` for backend/tooling workflows that need executable chart-edit operations.
329
348
 
330
349
  The direct runtime host opens `PraxisChartWidgetConfigEditor` with the existing `{ inputs }` envelope so the canonical document, derived `data` and separate `queryContext` share the Apply/Save boundary. Apply updates the runtime and emits `chartDocumentApplied`; Save emits `chartDocumentSaved`. Both document outputs retain their `PraxisXUiChartContract` shape. `chartDocumentPatchChange` carries independent snapshots in `inputPatch.chartDocument`, `data` and `queryContext` when applicable, plus mapped `config` for a config-driven host. Switching to `praxis.stats` clears local data precedence with `inputPatch.data: null`; clearing query context uses `queryContext: null`.
331
350
 
@@ -414,9 +433,26 @@ a dirty draft, without emitting Save or asking to save a target that no longer e
414
433
  A pending opening is cancelled as well. This applies to the chart-owned editor; other
415
434
  consumers must explicitly supply their own owner to adopt the same lifecycle.
416
435
 
417
- ### Cor dos nomes dos eixos
436
+ ## `<praxis-timeline-lanes>` — Swimlane Chronological Timeline
418
437
 
419
- O adaptador ECharts aplica a cor efetiva de texto (`theme.textColor`) tanto aos valores quanto aos nomes dos eixos cartesianos, incluindo eixo secundário, orientação horizontal e dispersão. Essa projeção não cria opções de engine no contrato público nem altera dados ou formatação. A legibilidade final ainda depende da coerência entre a cor de texto e o fundo configurado.
438
+ `<praxis-timeline-lanes>` (`PraxisTimelineLanesComponent`) is the governed `@praxisui/charts` component for continuous intervals across synchronized swimlanes with an accessible table alternative (`timeline | split | table`), non-chromatic conflict detection, and open-ended period support (`endDate == null`).
439
+
440
+ - **Contract & Metadata:** `PraxisTimelineLanesConfig` (`x-ui.timelineLanes`), ports `config`, `queryContext`, `barSelect`, `rangeFilter`, `conflictClick`, and `actionClick` registered by `providePraxisTimelineLanesMetadata()` (included in `providePraxisCharts()`).
441
+ - **Datasources:** accepts inline items (`items` / `dataSource.data`), a single resource endpoint (`resourcePath` + `PraxisDataQueryContext`), or parallel per-lane sources (`dataSource.laneSources[]`).
442
+ - **Governance & Editor:** conditional rules via `PraxisJsonLogicService`, actions via `visibleWhen`/`disabledWhen`/`hateoasRel`/`quickView`/`globalAction`, persistence through `ASYNC_CONFIG_STORAGE`, and bidirectional frameless `visual ↔ JSON` editor (`PraxisTimelineLanesConfigEditorComponent`).
443
+ - **Detailed docs:** see [`praxis-timeline-lanes.json-api.md`](./src/lib/praxis-timeline-lanes.json-api.md) and [`praxis-timeline-lanes-landing.md`](./docs/praxis-timeline-lanes-landing.md).
444
+
445
+ ### Axis Title Colors
446
+
447
+ The ECharts adapter applies the effective foreground text color (`theme.textColor`) to both axis tick labels and axis names across cartesian axes, including secondary axes, horizontal orientations, and scatter plots without adding raw engine properties to the public contract. Final readability depends on keeping `theme.textColor` consistent with the configured chart background.
448
+
449
+ ## Multidimensional & Hierarchical Kinds (`sankey`, `sunburst` / multilevel `treemap`, `radar`)
450
+
451
+ Formalized in [`ADR-0003`](./docs/adr/0003-hierarchical-sunburst-treemap-and-sankey-links.md), [`praxis-chart.json-api.md`](./src/lib/praxis-chart.json-api.md), and [`praxis-charts-flow-hierarchy-radar-landing.md`](./docs/praxis-charts-flow-hierarchy-radar-landing.md):
452
+
453
+ - **`sankey` (Acyclic Flow & Cycle Guard):** accepts renderer-neutral `sankey.nodes` (`id`, `label`, `type`, `stage`) and `sankey.links` (`source`, `target`, `value`, `relation`, `evidence`) aligned with `<praxis-relationship-graph>` (`#668`), or 2D tabular aggregation (`sourceField`, `targetField`, `valueField`). Cycles and self-loops are detected deterministically before rendering, failing cleanly with an actionable recommendation to switch to `<praxis-relationship-graph>` (`#668`). Emits `crossFilter` on node and link clicks and exposes an accessible `Origem | Destino | Volume | %` table.
454
+ - **`sunburst` & multilevel `treemap`:** builds a proportional aggregated tree from ordered `dimensions[]` (`2+` levels, e.g. `['orgao', 'subempresa', 'setor']`) or explicit `path` / `parentId` / `children` data, keeping single-dimension 1D `treemap` configs unchanged. Supports interactive breadcrumb level zoom with `crossFilter` emission and hierarchical table fallback.
455
+ - **`radar` (Multidimensional Comparison vs. "Radar Preventivo"):** compares multiple series over `>= 3` indicators with explicit `[min, max]` bounds (`max > min`) and accessible tabular breakdown. **Semantic Disambiguation:** `kind = 'radar'` renders a geometric `RadarChart` comparing quantitative indicator axes; it must **not** be confused with business domain features/endpoints named **"Radar Preventivo"** (e.g. retirement eligibility or workforce vacancy monitoring, which map to KPIs, `gauge`, `bar`, `funnel`, or `<praxis-timeline-lanes>` unless explicitly plotting `>= 3` comparative `[min, max]` indicators).
420
456
 
421
457
  <!-- praxis-npm-catalog-links:start -->
422
458
  ## Official documentation and examples