@mantha911/ng-echarts 0.1.0-rc.19 → 0.1.0-rc.21

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 CHANGED
@@ -1,6 +1,16 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.0-rc.19 — Unreleased source
3
+ ## 0.1.0-rc.21 — Documentation correction
4
+
5
+ - Correct packaged availability/version guidance after rc.19 publication, and document pagination and named composed stacks by their introduction versions.
6
+ - Preserve rc.20 runtime/declarations, dependencies, licensing, notices and all archived candidates. Human release gates remain pending.
7
+
8
+ ## 0.1.0-rc.20 — Verified local candidate
9
+
10
+ - Add optional named bar stacks to composed charts on the existing shared scale, with signed end caps, raw point actions and independent supplied line values.
11
+ - Preserve the verified rc.19 performance/Angular artifact and all earlier archives. Human release gates remain pending.
12
+
13
+ ## 0.1.0-rc.19 — Verified local candidate
4
14
 
5
15
  - Reconcile renderer recovery, legend visibility and transient plot previews with dependent signals; explicitly phase browser rendering while retaining mixed CSS-color and focus operations.
6
16
  - Add opt-in `tablePageSize` to bar, line, area, composed and pie tables, with keyboard paging, bounded row creation and original-row selection events. The default remains a complete table.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Angular chart library
2
2
 
3
- Experimental standalone Angular 22 components using Apache ECharts. Public prerelease identity: `@mantha911/ng-echarts`. Working source: `0.1.0-rc.19` (unpublished); the public prerelease remains `0.1.0-rc.18`. Original library code is MIT licensed; preserve `LICENSE`, `THIRD_PARTY_NOTICES.md`, and the `third-party/` notices. The API is experimental; human screen-reader interpretation remains unreviewed at the user’s request.
3
+ Experimental standalone Angular 22 components using Apache ECharts. Public prerelease identity: `@mantha911/ng-echarts`. Current candidate: `0.1.0-rc.21`. Public prereleases use the `next` tag; consult the repository publication record for the current registry version. Original library code is MIT licensed; preserve `LICENSE`, `THIRD_PARTY_NOTICES.md`, and the `third-party/` notices. The API is experimental; human screen-reader interpretation remains unreviewed at the user’s request.
4
4
 
5
5
  ## Installation
6
6
 
@@ -13,10 +13,10 @@ npm install @mantha911/ng-echarts@next echarts@6.1.0
13
13
  For a retained exact local candidate:
14
14
 
15
15
  ```sh
16
- npm install /absolute/path/to/mantha911-ng-echarts-0.1.0-rc.19.tgz echarts@6.1.0
16
+ npm install /absolute/path/to/mantha911-ng-echarts-0.1.0-rc.21.tgz echarts@6.1.0
17
17
  ```
18
18
 
19
- Retain the tarball at the lockfile's recorded path, or store it in the consumer's `vendor/` directory. Commit the lockfile and use `npm ci` for repeat installs. Repack and reinstall to consume source changes. The registry `next` tag still points to rc.18; table pagination requires a local rc.19 source build until a new version is published.
19
+ Retain the tarball at the lockfile's recorded path, or store it in the consumer's `vendor/` directory. Commit the lockfile and use `npm ci` for repeat installs. Repack and reinstall to consume source changes. Table pagination is available since rc.19. Named composed bar stacks require rc.20 or later. The exact local candidate includes both; a registry install must resolve a version containing the features you use.
20
20
 
21
21
  No global ECharts registration, library stylesheet, Angular provider or React runtime is required. The package supplies scoped styles and a lazy Canvas renderer. Give its containing card a nonzero width. Cartesian/radar/pie plot height defaults to 320 px, with native controls adding to total height; radial progress defaults to 240 px and calendar/Sankey use family-specific layouts.
22
22
 
@@ -101,13 +101,13 @@ Tested: Angular/CLI 22.2.6, TypeScript 6.0.3, ECharts 6.1.0, RxJS 7.8.2, Node 24
101
101
 
102
102
  The starting measured envelope is 200 categories × three Cartesian series or 12 pie/donut categories on the recorded M2 Pro machine. Stress fixtures use 2,000 Cartesian or 100 pie/donut categories; these are observations, not hard limits or portable latency guarantees. Outside labels may shorten/hide collisions; expanded tables have separate costs.
103
103
 
104
- Focused imports keep unrelated engines out. Line and area intentionally share ECharts' Line engine. Root imports preserve class identity but include combined registrations. Deep paths and core `ɵ` exports are unsupported implementation APIs. Size checks count all lazy chunks, excluding Angular/RxJS peers: gzip/Brotli caps are 200,000/175,000 bytes per family, 10,000/9,000 for core, 219,500/187,500 for root, and 203,000/175,000 for root-frame emitted orphan chunks (zero reachable engine modules).
104
+ Focused imports keep unrelated engines out. Line and area intentionally share ECharts' Line engine. Root imports preserve class identity but include combined registrations. Deep paths and core `ɵ` exports are unsupported implementation APIs. Size checks count all lazy chunks, excluding Angular/RxJS peers: gzip/Brotli caps are 200,000/175,000 bytes per family, 10,000/9,000 for core, 222,000/190,000 for root, and 206,000/178,000 for root-frame emitted orphan chunks (zero reachable engine modules).
105
105
 
106
106
  Raw ECharts options, custom tooltip templates, time/logarithmic axes, server plot images/export, brushes, advanced decoration and additional chart families are outside the MVP. APIs remain experimental. Automated acceptance passes; human interpretation and final artifact/release gates remain pending.
107
107
 
108
108
  ## Composed charts
109
109
 
110
- The post-MVP `ComposedChart` and `ComposedSeries<T>` exports in `/composed` combine vertical bars and lines on one category/value scale. Every descriptor adds `kind: 'bar' | 'line'` to the shared series fields; lines accept `smooth` and `showPoints`. Supply comparable units. The renderer uses supplied trend values; the demo computes its trailing mean separately. Dual axes, stacking and area composition are outside this first increment.
110
+ The post-MVP `ComposedChart` and `ComposedSeries<T>` exports in `/composed` combine vertical bars and lines on one category/value scale. Every descriptor adds `kind: 'bar' | 'line'` to the shared series fields; lines accept `smooth` and `showPoints`. Supply comparable units. The renderer uses supplied trend values; the demo computes its trailing mean separately. Bars optionally accept a nonempty `stack` name: equal names stack by sign; omitted names keep bars grouped. Lines remain independent supplied values. Dual axes and area composition remain outside this increment. Named composed stacks require rc.20 or later; published rc.18 does not contain this API.
111
111
 
112
112
  ## Controlled bar selection
113
113
 
@@ -147,6 +147,6 @@ Charts reserve plot space during loading, empty and error states and retain unav
147
147
 
148
148
  The compatibility root reexports bar, line, area, pie/donut and composed components plus `ChartFrame` and applicable types. Radar, radial progress, calendar and Sankey require their focused entries. Original API documentation is at [the repository docs index](https://github.com/phalla-doll/ng-echarts#documents). Private rc.15 includes opt-in bar `previewEnabled` / `pointPreview` for transient pointer/table-focus context, settled-input reconciliation and Escape cancellation. Earlier archives, including rc.13/rc.14 and the documentation-only rc.12, retain their original bytes and scoped evidence.
149
149
 
150
- ## Optional table pagination in rc.19 source
150
+ ## Optional table pagination since rc.19
151
151
 
152
152
  Bar, line, area, composed and pie accept `[tablePageSize]="50"`. The default `null` renders the complete table. A positive safe integer limits table row creation to the current page while the plot retains every observation. Previous/Next buttons preserve keyboard focus and announce the visible row range. Replacing the data array or page size restarts at the first page; collapsing and reopening retains the page. Off-page rows remain available through paging, with original-row selection events and hidden-series values preserved. Radar, calendar and Sankey retain their existing bounded tables.
@@ -19,10 +19,31 @@ function buildComposedOptions(context, series) {
19
19
  series: series.flatMap((item, index) => {
20
20
  if (hiddenIds.has(item.id)) return [];
21
21
  const color = tokens.series[index % tokens.series.length] ?? "#047857";
22
- const data = model.rows.map((row) => ({
23
- id: row.id,
24
- value: row.points[index]?.value ?? "-"
25
- }));
22
+ const data = model.rows.map((row) => {
23
+ const value = row.points[index]?.value ?? null;
24
+ let borderRadius = 0;
25
+ if (item.kind === "bar" && item.stack !== void 0 && value !== null && value !== 0) {
26
+ if (!series.some((later, laterIndex) => {
27
+ const other = row.points[laterIndex]?.value ?? 0;
28
+ return laterIndex > index && later.kind === "bar" && later.stack === item.stack && !hiddenIds.has(later.id) && other !== 0 && Math.sign(other) === Math.sign(value);
29
+ })) borderRadius = value < 0 ? [
30
+ 0,
31
+ 0,
32
+ 2,
33
+ 2
34
+ ] : [
35
+ 2,
36
+ 2,
37
+ 0,
38
+ 0
39
+ ];
40
+ }
41
+ return {
42
+ id: row.id,
43
+ value: value ?? "-",
44
+ ...item.kind === "bar" && item.stack !== void 0 ? { itemStyle: { borderRadius } } : {}
45
+ };
46
+ });
26
47
  const identity = {
27
48
  id: item.id,
28
49
  name: item.label,
@@ -31,11 +52,13 @@ function buildComposedOptions(context, series) {
31
52
  return item.kind === "bar" ? [{
32
53
  ...identity,
33
54
  type: "bar",
55
+ stack: item.stack,
56
+ stackStrategy: "samesign",
34
57
  z: 2,
35
58
  barMaxWidth: 48,
36
59
  itemStyle: {
37
60
  color,
38
- borderRadius: 2
61
+ borderRadius: item.stack === void 0 ? 2 : 0
39
62
  }
40
63
  }] : [{
41
64
  ...identity,
@@ -68,6 +91,8 @@ function composedSeriesError(series) {
68
91
  for (const item of series) {
69
92
  if (!item || !["bar", "line"].includes(item.kind)) return "Composed series require a 'bar' or 'line' kind.";
70
93
  if (item.kind === "bar" && (item.smooth !== void 0 || item.showPoints !== void 0)) return "Line settings cannot be used on bar series.";
94
+ if (item.kind === "bar" && item.stack !== void 0 && (typeof item.stack !== "string" || !item.stack.trim() || item.stack !== item.stack.trim())) return "Bar stack names must be nonempty strings without surrounding whitespace.";
95
+ if (item.kind === "line" && item.stack !== void 0) return "Stack settings cannot be used on line series.";
71
96
  if (item.kind === "line" && (item.smooth !== void 0 && typeof item.smooth !== "boolean" || item.showPoints !== void 0 && typeof item.showPoints !== "boolean")) return "Line settings must be booleans.";
72
97
  }
73
98
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"mantha911-ng-echarts-composed.mjs","names":[],"sources":["../../../projects/chart-library/composed/src/lib/composed-browser.ts","../../../projects/chart-library/composed/src/lib/composed-options.ts","../../../projects/chart-library/composed/src/lib/composed-types.ts","../../../projects/chart-library/composed/src/lib/composed-chart.ts","../../../projects/chart-library/core/src/lib/cartesian-chart.html"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport type { ɵPlotRendererFactory } from '@mantha911/ng-echarts/core';\nimport type { ComposedOption } from './composed-options';\nexport const COMPOSED_RENDERER_LOADER = new InjectionToken<\n () => Promise<ɵPlotRendererFactory<ComposedOption>>\n>('Composed renderer loader', {\n providedIn: 'root',\n factory: () => () =>\n import('./composed-renderer').then((module) => module.createComposedRenderer),\n});\n","import type { BarSeriesOption, LineSeriesOption } from 'echarts/charts';\nimport type { GridComponentOption, TooltipComponentOption } from 'echarts/components';\nimport type { ComposeOption } from 'echarts/core';\nimport { ɵbuildCartesianOptions, type ɵCartesianContext } from '@mantha911/ng-echarts/core';\nimport type { ComposedSeries } from './composed-types';\nexport type ComposedOption = ComposeOption<\n BarSeriesOption | LineSeriesOption | GridComponentOption | TooltipComponentOption\n>;\n\nexport function buildComposedOptions<T>(\n context: ɵCartesianContext<T>,\n series: readonly ComposedSeries<T>[],\n): ComposedOption {\n const { model, hiddenIds, tokens, animation, format, categoryTicks } = context;\n const common = ɵbuildCartesianOptions(\n model,\n hiddenIds,\n tokens,\n false,\n animation,\n format,\n categoryTicks,\n );\n const categoryAxis = common.xAxis;\n if (categoryAxis.type !== 'category') throw new Error('Expected category axis');\n return {\n ...common,\n // Keep category centers stable even while every bar is hidden.\n xAxis: { ...categoryAxis, boundaryGap: true },\n series: series.flatMap((item, index): (BarSeriesOption | LineSeriesOption)[] => {\n if (hiddenIds.has(item.id)) return [];\n const color = tokens.series[index % tokens.series.length] ?? '#047857';\n const data = model.rows.map((row) => ({\n id: row.id,\n value: row.points[index]?.value ?? '-',\n }));\n const identity = { id: item.id, name: item.label, data };\n return item.kind === 'bar'\n ? [\n {\n ...identity,\n type: 'bar',\n z: 2,\n barMaxWidth: 48,\n itemStyle: { color, borderRadius: 2 },\n },\n ]\n : [\n {\n ...identity,\n type: 'line',\n z: 3,\n smooth: item.smooth ?? false,\n showSymbol: item.showPoints ?? true,\n connectNulls: false,\n symbol: 'diamond',\n clip: false,\n symbolSize: 7,\n triggerEvent: 'line',\n lineStyle: { color, width: 2.5, type: 'dashed', cap: 'round' },\n itemStyle: { color: tokens.background, borderColor: color, borderWidth: 2 },\n },\n ];\n }),\n };\n}\n","import type { ChartSeries } from '@mantha911/ng-echarts/core';\n\nexport interface ComposedBarSeries<T> extends ChartSeries<T> {\n readonly kind: 'bar';\n readonly smooth?: never;\n readonly showPoints?: never;\n}\nexport interface ComposedLineSeries<T> extends ChartSeries<T> {\n readonly kind: 'line';\n readonly smooth?: boolean;\n readonly showPoints?: boolean;\n}\n/** Series share one category axis and one numeric scale; measures must use comparable units. */\nexport type ComposedSeries<T> = ComposedBarSeries<T> | ComposedLineSeries<T>;\n\nexport function composedSeriesError<T>(series: readonly ComposedSeries<T>[]): string | null {\n if (!Array.isArray(series)) return 'Chart data and series must be arrays.';\n for (const item of series) {\n if (!item || !['bar', 'line'].includes(item.kind))\n return \"Composed series require a 'bar' or 'line' kind.\";\n if (item.kind === 'bar' && (item.smooth !== undefined || item.showPoints !== undefined))\n return 'Line settings cannot be used on bar series.';\n if (\n item.kind === 'line' &&\n ((item.smooth !== undefined && typeof item.smooth !== 'boolean') ||\n (item.showPoints !== undefined && typeof item.showPoints !== 'boolean'))\n )\n return 'Line settings must be booleans.';\n }\n return null;\n}\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport {\n ChartFrame,\n ɵChartStage,\n ɵTablePager,\n ɵCartesianChart,\n type ɵCartesianContext,\n} from '@mantha911/ng-echarts/core';\nimport { COMPOSED_RENDERER_LOADER } from './composed-browser';\nimport { buildComposedOptions, type ComposedOption } from './composed-options';\nimport { composedSeriesError, type ComposedSeries } from './composed-types';\n@Component({\n selector: 'nec-composed-chart',\n imports: [ChartFrame, ɵChartStage, ɵTablePager],\n templateUrl: '../../../core/src/lib/cartesian-chart.html',\n styleUrls: [\n '../../../core/src/lib/cartesian-chart.css',\n '../../../core/src/lib/chart-controls.css',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ComposedChart<T extends object> extends ɵCartesianChart<\n T,\n ComposedOption,\n ComposedSeries<T>\n> {\n private readonly loader = inject(COMPOSED_RENDERER_LOADER);\n protected override renderer() {\n return this.loader();\n }\n protected override familyConfiguration() {\n return this.series();\n }\n protected override familyError() {\n return composedSeriesError(this.series());\n }\n protected override buildOptions(context: ɵCartesianContext<T>): ComposedOption {\n return buildComposedOptions(context, this.series());\n }\n}\n","<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <nec-table-pager [pagination]=\"tablePagination\" [label]=\"title()\" />\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n"],"mappings":";;;AAGA,MAAa,2BAA2B,IAAI,eAE1C,4BAA4B;CAC5B,YAAY;CACZ,qBACE,OAAO,iEAAsB,CAAC,MAAM,WAAW,OAAO,sBAAsB;AAC/E,CAAA;ACAD,SAAgB,qBACd,SACA,QAAoC;CAEpC,MAAM,EAAE,OAAO,WAAW,QAAQ,WAAW,QAAQ,kBAAkB;CACvE,MAAM,SAAS,uBACb,OACA,WACA,QACA,OACA,WACA,QACA,aAAa;CAEf,MAAM,eAAe,OAAO;CAC5B,IAAI,aAAa,SAAS,YAAY,MAAM,IAAI,MAAM,wBAAwB;CAC9E,OAAO;EACL,GAAG;EAEH,OAAO;GAAE,GAAG;GAAc,aAAa;EAAI;EAC3C,QAAQ,OAAO,SAAS,MAAM,UAAiD;GAC7E,IAAI,UAAU,IAAI,KAAK,EAAE,GAAG,OAAO,CAAA;GACnC,MAAM,QAAQ,OAAO,OAAO,QAAQ,OAAO,OAAO,WAAW;GAC7D,MAAM,OAAO,MAAM,KAAK,KAAK,SAAS;IACpC,IAAI,IAAI;IACR,OAAO,IAAI,OAAO,MAAM,EAAE,SAAS;GACpC,EAAC;GACF,MAAM,WAAW;IAAE,IAAI,KAAK;IAAI,MAAM,KAAK;IAAO;GAAI;GACtD,OAAO,KAAK,SAAS,QACjB,CACE;IACE,GAAG;I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A,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAa,cAAA;EAAA,UAAA;EAAA,iBAAA;EAAA,UAAA;EAAA,UCrB1B;EA0HA,QAAA,CAAA,wjFAAA,wrBAAA;EAAA,cAAA;GAAA;IAAA,MAAA;IAAA,MD7GY;IAAU,UAAA;IAAA,QAAA,CAAA,SAAA,aAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAW,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,OAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAW,UAAA;IAAA,QAAA,CAAA,cAAA,OAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAQnC,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EAVzB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAoB,SACrB;IAAC;IAAY;IAAa;GAAW;GAAC,iBAM9B,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,wjFAAA,wrBAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"mantha911-ng-echarts-composed.mjs","names":[],"sources":["../../../projects/chart-library/composed/src/lib/composed-browser.ts","../../../projects/chart-library/composed/src/lib/composed-options.ts","../../../projects/chart-library/composed/src/lib/composed-types.ts","../../../projects/chart-library/composed/src/lib/composed-chart.ts","../../../projects/chart-library/core/src/lib/cartesian-chart.html"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport type { ɵPlotRendererFactory } from '@mantha911/ng-echarts/core';\nimport type { ComposedOption } from './composed-options';\nexport const COMPOSED_RENDERER_LOADER = new InjectionToken<\n () => Promise<ɵPlotRendererFactory<ComposedOption>>\n>('Composed renderer loader', {\n providedIn: 'root',\n factory: () => () =>\n import('./composed-renderer').then((module) => module.createComposedRenderer),\n});\n","import type { BarSeriesOption, LineSeriesOption } from 'echarts/charts';\nimport type { GridComponentOption, TooltipComponentOption } from 'echarts/components';\nimport type { ComposeOption } from 'echarts/core';\nimport { ɵbuildCartesianOptions, type ɵCartesianContext } from '@mantha911/ng-echarts/core';\nimport type { ComposedSeries } from './composed-types';\nexport type ComposedOption = ComposeOption<\n BarSeriesOption | LineSeriesOption | GridComponentOption | TooltipComponentOption\n>;\n\nexport function buildComposedOptions<T>(\n context: ɵCartesianContext<T>,\n series: readonly ComposedSeries<T>[],\n): ComposedOption {\n const { model, hiddenIds, tokens, animation, format, categoryTicks } = context;\n const common = ɵbuildCartesianOptions(\n model,\n hiddenIds,\n tokens,\n false,\n animation,\n format,\n categoryTicks,\n );\n const categoryAxis = common.xAxis;\n if (categoryAxis.type !== 'category') throw new Error('Expected category axis');\n return {\n ...common,\n // Keep category centers stable even while every bar is hidden.\n xAxis: { ...categoryAxis, boundaryGap: true },\n series: series.flatMap((item, index): (BarSeriesOption | LineSeriesOption)[] => {\n if (hiddenIds.has(item.id)) return [];\n const color = tokens.series[index % tokens.series.length] ?? '#047857';\n const data = model.rows.map((row) => {\n const value = row.points[index]?.value ?? null;\n let borderRadius: number | number[] = 0;\n if (item.kind === 'bar' && item.stack !== undefined && value !== null && value !== 0) {\n const covered = series.some((later, laterIndex) => {\n const other = row.points[laterIndex]?.value ?? 0;\n return (\n laterIndex > index &&\n later.kind === 'bar' &&\n later.stack === item.stack &&\n !hiddenIds.has(later.id) &&\n other !== 0 &&\n Math.sign(other) === Math.sign(value)\n );\n });\n if (!covered) borderRadius = value < 0 ? [0, 0, 2, 2] : [2, 2, 0, 0];\n }\n return {\n id: row.id,\n value: value ?? '-',\n ...(item.kind === 'bar' && item.stack !== undefined\n ? { itemStyle: { borderRadius } }\n : {}),\n };\n });\n const identity = { id: item.id, name: item.label, data };\n return item.kind === 'bar'\n ? [\n {\n ...identity,\n type: 'bar',\n stack: item.stack,\n stackStrategy: 'samesign',\n z: 2,\n barMaxWidth: 48,\n itemStyle: { color, borderRadius: item.stack === undefined ? 2 : 0 },\n },\n ]\n : [\n {\n ...identity,\n type: 'line',\n z: 3,\n smooth: item.smooth ?? false,\n showSymbol: item.showPoints ?? true,\n connectNulls: false,\n symbol: 'diamond',\n clip: false,\n symbolSize: 7,\n triggerEvent: 'line',\n lineStyle: { color, width: 2.5, type: 'dashed', cap: 'round' },\n itemStyle: { color: tokens.background, borderColor: color, borderWidth: 2 },\n },\n ];\n }),\n };\n}\n","import type { ChartSeries } from '@mantha911/ng-echarts/core';\n\nexport interface ComposedBarSeries<T> extends ChartSeries<T> {\n readonly kind: 'bar';\n /** Bars with the same nonempty name stack by sign; omission keeps a grouped bar. */\n readonly stack?: string;\n readonly smooth?: never;\n readonly showPoints?: never;\n}\nexport interface ComposedLineSeries<T> extends ChartSeries<T> {\n readonly kind: 'line';\n readonly stack?: never;\n readonly smooth?: boolean;\n readonly showPoints?: boolean;\n}\n/** Series share one category axis and one numeric scale; measures must use comparable units. */\nexport type ComposedSeries<T> = ComposedBarSeries<T> | ComposedLineSeries<T>;\n\nexport function composedSeriesError<T>(series: readonly ComposedSeries<T>[]): string | null {\n if (!Array.isArray(series)) return 'Chart data and series must be arrays.';\n for (const item of series) {\n if (!item || !['bar', 'line'].includes(item.kind))\n return \"Composed series require a 'bar' or 'line' kind.\";\n if (item.kind === 'bar' && (item.smooth !== undefined || item.showPoints !== undefined))\n return 'Line settings cannot be used on bar series.';\n if (\n item.kind === 'bar' &&\n item.stack !== undefined &&\n (typeof item.stack !== 'string' || !item.stack.trim() || item.stack !== item.stack.trim())\n )\n return 'Bar stack names must be nonempty strings without surrounding whitespace.';\n if (item.kind === 'line' && item.stack !== undefined)\n return 'Stack settings cannot be used on line series.';\n if (\n item.kind === 'line' &&\n ((item.smooth !== undefined && typeof item.smooth !== 'boolean') ||\n (item.showPoints !== undefined && typeof item.showPoints !== 'boolean'))\n )\n return 'Line settings must be booleans.';\n }\n return null;\n}\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport {\n ChartFrame,\n ɵChartStage,\n ɵTablePager,\n ɵCartesianChart,\n type ɵCartesianContext,\n} from '@mantha911/ng-echarts/core';\nimport { COMPOSED_RENDERER_LOADER } from './composed-browser';\nimport { buildComposedOptions, type ComposedOption } from './composed-options';\nimport { composedSeriesError, type ComposedSeries } from './composed-types';\n@Component({\n selector: 'nec-composed-chart',\n imports: [ChartFrame, ɵChartStage, ɵTablePager],\n templateUrl: '../../../core/src/lib/cartesian-chart.html',\n styleUrls: [\n '../../../core/src/lib/cartesian-chart.css',\n '../../../core/src/lib/chart-controls.css',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ComposedChart<T extends object> extends ɵCartesianChart<\n T,\n ComposedOption,\n ComposedSeries<T>\n> {\n private readonly loader = inject(COMPOSED_RENDERER_LOADER);\n protected override renderer() {\n return this.loader();\n }\n protected override familyConfiguration() {\n return this.series();\n }\n protected override familyError() {\n return composedSeriesError(this.series());\n }\n protected override buildOptions(context: ɵCartesianContext<T>): ComposedOption {\n return buildComposedOptions(context, this.series());\n }\n}\n","<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <nec-table-pager [pagination]=\"tablePagination\" [label]=\"title()\" />\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n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.0-rc.19",
3
+ "version": "0.1.0-rc.21",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^22.2.6",
6
6
  "@angular/core": "^22.2.6",
@@ -5,11 +5,14 @@ import { ComposeOption } from "echarts/core";
5
5
  import * as i0 from "@angular/core";
6
6
  interface ComposedBarSeries<T> extends ChartSeries$1<T> {
7
7
  readonly kind: 'bar';
8
+ /** Bars with the same nonempty name stack by sign; omission keeps a grouped bar. */
9
+ readonly stack?: string;
8
10
  readonly smooth?: never;
9
11
  readonly showPoints?: never;
10
12
  }
11
13
  interface ComposedLineSeries<T> extends ChartSeries$1<T> {
12
14
  readonly kind: 'line';
15
+ readonly stack?: never;
13
16
  readonly smooth?: boolean;
14
17
  readonly showPoints?: boolean;
15
18
  }