@siemens/native-charts-ng 48.0.0-next.4 → 48.0.0-next.5
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siemens-native-charts-ng-micro-donut.mjs","sources":["../../../../projects/native-charts-ng/micro-donut/si-micro-donut.component.ts","../../../../projects/native-charts-ng/micro-donut/si-micro-donut.component.html","../../../../projects/native-charts-ng/micro-donut/index.ts","../../../../projects/native-charts-ng/micro-donut/siemens-native-charts-ng-micro-donut.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n numberAttribute\n} from '@angular/core';\nimport { Coordinate, makeArc, valueToRelativeAngle } from '@siemens/native-charts-ng/utils';\n\n/**\n * One series of the micro donut chart.\n */\nexport interface MicroDonutSeries {\n /** value in percent */\n valuePercent: number;\n
|
|
1
|
+
{"version":3,"file":"siemens-native-charts-ng-micro-donut.mjs","sources":["../../../../projects/native-charts-ng/micro-donut/si-micro-donut.component.ts","../../../../projects/native-charts-ng/micro-donut/si-micro-donut.component.html","../../../../projects/native-charts-ng/micro-donut/index.ts","../../../../projects/native-charts-ng/micro-donut/siemens-native-charts-ng-micro-donut.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n numberAttribute\n} from '@angular/core';\nimport { Coordinate, makeArc, valueToRelativeAngle } from '@siemens/native-charts-ng/utils';\n\n/**\n * One series of the micro donut chart.\n */\nexport interface MicroDonutSeries {\n /** value in percent */\n valuePercent: number;\n /**\n * Use a data-color. See: {@link https://element.siemens.io/fundamentals/colors/data-visualization-colors/#tokens}\n *\n * @example \"element-data-10\"\n */\n colorToken: string;\n /** ID exposed as `data-id` */\n id?: string;\n}\n\ninterface InternalSeries {\n series: MicroDonutSeries;\n path: string;\n colorVar: string;\n}\n\n@Component({\n selector: 'si-micro-donut',\n templateUrl: './si-micro-donut.component.html',\n styleUrl: './si-micro-donut.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class SiMicroDonutComponent {\n /**\n * Micro donut series. Can also be an array representing multiple series.\n * Each series, in case of multiple, forms section of the arc, in percentage\n * of the respective value.\n * Example series can be:\n * @example\n * ```ts\n * Series: MicroDonutSeries[] = [{ valuePercent: 40, colorToken: 'element-data-4' }];\n * ```\n * @defaultValue []\n */\n readonly series = input.required<MicroDonutSeries[]>();\n /**\n * Radius of donut. The radius is calculated from center of the donut to the mid point of the arc.\n * @defaultValue 7.5\n */\n readonly radius = input(7.5, { transform: numberAttribute });\n\n protected readonly arcThickness = computed(() => 0.7 * this.radius());\n protected readonly dim = computed(() => {\n // Keeping the viewbox width and height only enough to fit the donut.\n // The radius is calculated from center of the donut to the mid point of the arc.\n // Hence half the arc thicknes on both side needs to be added (equals full arc thickness)\n // The buffer space is added because the svg donut gets cropped on certain Os + browser configuration.\n const radius = this.radius();\n const arcThickness = this.arcThickness();\n const size = 2 * radius + arcThickness + this.bufferSpace;\n return { width: size, height: size };\n });\n\n protected readonly backgroundPath = computed(() =>\n makeArc(this.center(), this.radius(), this.startAngle, this.endAngle)\n );\n\n private readonly center = computed<Coordinate>(() => {\n // Once we have the viewbox dimensions, getting the donut at the center by\n // calculating correct coordinates\n const d = this.dim();\n return {\n x: d.width / 2,\n y: d.height / 2\n };\n });\n private readonly min = 0;\n private readonly max = 100;\n private readonly startAngle = 0;\n private readonly endAngle = 360;\n private readonly bufferSpace = 4;\n\n protected readonly internalSeries = computed(() => {\n const inputSeries = this.series();\n const result: InternalSeries[] = [];\n let nextPosAngle = 0;\n\n for (const series of inputSeries) {\n // Does not add series if percent is 0 or less\n if (series.valuePercent > 0) {\n const { nextAngle, internal } = this.toInternalSeries(nextPosAngle, series);\n result.push(internal);\n nextPosAngle = nextAngle;\n }\n }\n return result;\n });\n\n private toInternalSeries(\n startAngle: number,\n series: MicroDonutSeries,\n color?: string\n ): { nextAngle: number; internal: InternalSeries } {\n let nextAngle =\n valueToRelativeAngle(\n this.startAngle,\n this.endAngle,\n this.min,\n this.max,\n series.valuePercent\n ) + startAngle;\n\n startAngle = this.containAngle(startAngle);\n nextAngle = this.containAngle(nextAngle);\n\n color ??= series.colorToken;\n const internal: InternalSeries = {\n series,\n path: makeArc(this.center(), this.radius(), startAngle, nextAngle),\n colorVar: `var(--${color})`\n };\n return { nextAngle, internal };\n }\n\n private containAngle(angle: number): number {\n return Math.max(this.startAngle, Math.min(this.endAngle, angle));\n }\n}\n","<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"chart\"\n [attr.viewBox]=\"'0 0 ' + dim().width + ' ' + dim().height\"\n [attr.width]=\"dim().width\"\n [attr.height]=\"dim().height\"\n>\n <g class=\"background\">\n <path [attr.d]=\"backgroundPath()\" [style.stroke-width]=\"arcThickness()\" />\n </g>\n <g class=\"data\">\n @for (series of internalSeries(); track $index) {\n @if (series?.path) {\n <path\n [attr.d]=\"series.path\"\n [attr.data-id]=\"series.series.id\"\n [style.stroke]=\"series.colorVar\"\n [style.stroke-width]=\"arcThickness()\"\n />\n }\n }\n </g>\n</svg>\n","/**\n * Copyright (c) Siemens 2016 - 2025\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-micro-donut.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAAA;;;AAGG;MAsCU,qBAAqB,CAAA;AAChC;;;;;;;;;;AAUG;AACM,IAAA,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAsB;AACtD;;;AAGG;IACM,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;AAEzC,IAAA,YAAY,GAAG,QAAQ,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;AAClD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AA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FDkBa,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBANjC,SAAS;+BACE,gBAAgB,EAAA,eAAA,EAGT,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,wpBAAA,EAAA,MAAA,EAAA,CAAA,4FAAA,CAAA,EAAA;;;AEvCjD;;;AAGG;;ACHH;;AAEG;;;;"}
|
package/micro-donut/index.d.ts
CHANGED
|
@@ -6,7 +6,11 @@ import * as _angular_core from '@angular/core';
|
|
|
6
6
|
interface MicroDonutSeries {
|
|
7
7
|
/** value in percent */
|
|
8
8
|
valuePercent: number;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Use a data-color. See: {@link https://element.siemens.io/fundamentals/colors/data-visualization-colors/#tokens}
|
|
11
|
+
*
|
|
12
|
+
* @example "element-data-10"
|
|
13
|
+
*/
|
|
10
14
|
colorToken: string;
|
|
11
15
|
/** ID exposed as `data-id` */
|
|
12
16
|
id?: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siemens/native-charts-ng",
|
|
3
3
|
"description": "Element Native charts library.",
|
|
4
|
-
"version": "48.0.0-next.
|
|
4
|
+
"version": "48.0.0-next.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"types": "./index.d.ts",
|
|
33
33
|
"default": "./fesm2022/siemens-native-charts-ng.mjs"
|
|
34
34
|
},
|
|
35
|
-
"./micro-bar": {
|
|
36
|
-
"types": "./micro-bar/index.d.ts",
|
|
37
|
-
"default": "./fesm2022/siemens-native-charts-ng-micro-bar.mjs"
|
|
38
|
-
},
|
|
39
35
|
"./gauge": {
|
|
40
36
|
"types": "./gauge/index.d.ts",
|
|
41
37
|
"default": "./fesm2022/siemens-native-charts-ng-gauge.mjs"
|
|
42
38
|
},
|
|
39
|
+
"./micro-bar": {
|
|
40
|
+
"types": "./micro-bar/index.d.ts",
|
|
41
|
+
"default": "./fesm2022/siemens-native-charts-ng-micro-bar.mjs"
|
|
42
|
+
},
|
|
43
43
|
"./micro-donut": {
|
|
44
44
|
"types": "./micro-donut/index.d.ts",
|
|
45
45
|
"default": "./fesm2022/siemens-native-charts-ng-micro-donut.mjs"
|