@siemens/native-charts-ng 49.5.0 → 49.7.0
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/fesm2022/siemens-native-charts-ng-gauge.mjs +9 -8
- package/fesm2022/siemens-native-charts-ng-gauge.mjs.map +1 -1
- package/fesm2022/siemens-native-charts-ng-utils.mjs +13 -2
- package/fesm2022/siemens-native-charts-ng-utils.mjs.map +1 -1
- package/package.json +2 -2
- package/types/siemens-native-charts-ng-utils.d.ts +10 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, numberAttribute, booleanAttribute, inject, LOCALE_ID, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import { makeArc, polarToCartesian, valueToRelativeAngle, makeLine } from '@siemens/native-charts-ng/utils';
|
|
3
|
+
import { makeArc, polarToCartesian, valueToRelativeAngle, relativeValueToRelativeAngle, makeLine } from '@siemens/native-charts-ng/utils';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Copyright (c) Siemens 2016 - 2026
|
|
@@ -194,7 +194,7 @@ class SiNChartGaugeComponent {
|
|
|
194
194
|
calcSeriesSum() {
|
|
195
195
|
this.reset();
|
|
196
196
|
const zeroValueAngle = this.startAngle() +
|
|
197
|
-
valueToRelativeAngle(this.startAngle(), this.endAngle(), this.min(), this.max(),
|
|
197
|
+
valueToRelativeAngle(this.startAngle(), this.endAngle(), this.min(), this.max(), 0);
|
|
198
198
|
this.addTick(this.startAngle(), this.min(), true);
|
|
199
199
|
if (this.min() !== 0) {
|
|
200
200
|
this.addTick(zeroValueAngle, 0, false);
|
|
@@ -204,20 +204,21 @@ class SiNChartGaugeComponent {
|
|
|
204
204
|
let nextNegAngle = zeroValueAngle;
|
|
205
205
|
for (const series of this.series()) {
|
|
206
206
|
if (series.value >= 0) {
|
|
207
|
-
nextPosAngle = this.addInternalSeries(nextPosAngle, series);
|
|
207
|
+
nextPosAngle = this.addInternalSeries(nextPosAngle, series, true);
|
|
208
208
|
}
|
|
209
209
|
else if (series.value < 0) {
|
|
210
|
-
nextNegAngle = this.addInternalSeries(nextNegAngle, series, true);
|
|
210
|
+
nextNegAngle = this.addInternalSeries(nextNegAngle, series, true, true);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
this.totalSumString = this.formatValue(this.totalSum);
|
|
214
214
|
}
|
|
215
215
|
calcSeriesSingle() {
|
|
216
216
|
this.reset();
|
|
217
|
+
const range = this.max() - this.min();
|
|
217
218
|
let angle = this.startAngle();
|
|
218
219
|
let value = this.min();
|
|
219
220
|
for (const segment of this.segments()) {
|
|
220
|
-
const nextAngle =
|
|
221
|
+
const nextAngle = relativeValueToRelativeAngle(this.startAngle(), this.endAngle(), range, segment.endValue - value) + angle;
|
|
221
222
|
this.internalSegments.push({
|
|
222
223
|
segment,
|
|
223
224
|
colorVar: `var(--${segment.colorToken})`,
|
|
@@ -237,7 +238,7 @@ class SiNChartGaugeComponent {
|
|
|
237
238
|
return;
|
|
238
239
|
}
|
|
239
240
|
const activeSegment = this.segments().find((s, i) => series.value < s.endValue || i == this.segments().length - 1);
|
|
240
|
-
this.addInternalSeries(this.startAngle(), series, false, activeSegment?.colorToken);
|
|
241
|
+
this.addInternalSeries(this.startAngle(), series, false, false, activeSegment?.colorToken);
|
|
241
242
|
this.totalSumString = this.formatValue(this.totalSum);
|
|
242
243
|
}
|
|
243
244
|
formatValue(value) {
|
|
@@ -268,8 +269,8 @@ class SiNChartGaugeComponent {
|
|
|
268
269
|
const end = polarToCartesian(this.center, this.radius + 2, angle);
|
|
269
270
|
return makeLine(start, end);
|
|
270
271
|
}
|
|
271
|
-
addInternalSeries(startAngle, series, reverse = false, color) {
|
|
272
|
-
let nextAngle =
|
|
272
|
+
addInternalSeries(startAngle, series, relative = false, reverse = false, color) {
|
|
273
|
+
let nextAngle = relativeValueToRelativeAngle(this.startAngle(), this.endAngle(), this.max() - this.min(), series.value - (relative ? 0 : this.min())) + startAngle;
|
|
273
274
|
const returnNextAngle = nextAngle;
|
|
274
275
|
if (reverse) {
|
|
275
276
|
[startAngle, nextAngle] = [nextAngle, startAngle];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siemens-native-charts-ng-gauge.mjs","sources":["../../../../projects/native-charts-ng/gauge/si-nchart-gauge.component.ts","../../../../projects/native-charts-ng/gauge/si-nchart-gauge.component.html","../../../../projects/native-charts-ng/gauge/index.ts","../../../../projects/native-charts-ng/gauge/siemens-native-charts-ng-gauge.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n inject,\n input,\n LOCALE_ID,\n numberAttribute,\n OnChanges,\n OnInit,\n SimpleChanges\n} from '@angular/core';\nimport {\n Coordinate,\n makeArc,\n makeLine,\n polarToCartesian,\n valueToRelativeAngle\n} from '@siemens/native-charts-ng/utils';\n\n/**\n * One series of the gauge chart.\n */\nexport interface GaugeSeries {\n /** value */\n value: number;\n /** color token */\n colorToken: string;\n /** name displayed in legend */\n name: string;\n /** Optional description line in legend */\n description?: string;\n /** ID exposed as `data-id` */\n id?: string;\n}\n\n/**\n * One segment of the gauge chart. The first segment starts at the `min` value of the gauge\n * chart and ends at `endValue`.\n */\nexport interface GaugeSegment {\n /** color token for this segment. */\n colorToken: string;\n /** end value for this segment, exclusive except for last segment where it's inclusive */\n endValue: number;\n}\n\ninterface InternalSeries {\n series: GaugeSeries;\n path: string;\n colorVar: string;\n valueString: string;\n highlight: boolean;\n}\n\ninterface InternalGaugeSegment {\n segment: GaugeSegment;\n path: string;\n colorVar: string;\n}\n\ninterface Tick {\n path: string;\n label: string;\n textPos: Coordinate;\n}\n\n@Component({\n selector: 'si-nchart-gauge',\n templateUrl: './si-nchart-gauge.component.html',\n styleUrl: './si-nchart-gauge.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': '\"legend-\" + legendPosition()'\n }\n})\nexport class SiNChartGaugeComponent implements OnInit, OnChanges {\n /**\n * Start angle in degrees\n *\n * @defaultValue -90\n */\n readonly startAngle = input(-90, { transform: numberAttribute });\n /**\n * End angle in degrees\n *\n * @defaultValue 90\n */\n readonly endAngle = input(90, { transform: numberAttribute });\n\n /**\n * Min value, can be negative\n *\n * @defaultValue -100\n */\n readonly min = input(-100, { transform: numberAttribute });\n /**\n * Max value, can be negative\n *\n * @defaultValue 100\n */\n readonly max = input(100, { transform: numberAttribute });\n /**\n * Display mode: `sum` to sum up multiple series or `single` for a single value with optional\n * segmented display.\n *\n * @defaultValue 'sum'\n */\n readonly mode = input<'sum' | 'single'>('sum');\n /**\n * The series for the chart.\n *\n * @defaultValue []\n */\n readonly series = input<GaugeSeries[]>([]);\n /**\n * Colored segments.\n *\n * @defaultValue []\n */\n readonly segments = input<GaugeSegment[]>([]);\n /**\n * Unit\n *\n * @defaultValue ''\n */\n readonly unit = input('');\n /**\n * Min number of decimals.\n * Possible values are from 0 to 100.\n * @defaultValue 0\n */\n readonly minNumberOfDecimals = input(0);\n /**\n * Max number of decimals.\n * Possible values are from 0 to 100.\n * @defaultValue 2\n */\n readonly maxNumberOfDecimals = input(2);\n /**\n * Number of decimals on the axis.\n * Possible values are from 0 to 100.\n * @defaultValue 0\n */\n readonly axisNumberOfDecimals = input(0);\n /**\n * Custom formatter for axis labels.\n * Takes precedence when specified, i.e. number of decimals needs\n * to be set by the user using this formatter.\n */\n readonly axisLabelFormatter = input<(val: number) => string>();\n /**\n * Custom formatter for value.\n * Takes precedence when specified, i.e. number of decimals needs\n * to be set by the user using this formatter.\n */\n readonly valueFormatter = input<(val: number) => string>();\n /**\n * Whether to show ticks\n *\n * @defaultValue true\n */\n readonly showTicks = input(true, { transform: booleanAttribute });\n /**\n * Whether to show the legend\n *\n * @defaultValue true\n */\n readonly showLegend = input(true, { transform: booleanAttribute });\n /**\n * Legend position:\n * - `column`: chart and legend form a column, i.e. the legend is below the chart.\n * The chart size is driven by the available width.\n * - `row`: chart and legend form a row, i.e. the legend is besides the chart. The\n * The chart size is driven by the available height.\n *\n * @defaultValue 'row'\n */\n readonly legendPosition = input<'row' | 'column'>('row');\n /**\n * Whether to show range start/end labels on the outside of the ring\n *\n * @defaultValue false\n */\n readonly showRangeLabelsOutside = input(false, { transform: booleanAttribute });\n\n protected dim = { width: 100, height: 60 };\n protected center: Coordinate = { x: 50, y: 50 };\n protected radius = 40;\n protected additionalHeight = 10;\n\n protected backgroundPath = '';\n protected internalSeries: InternalSeries[] = [];\n protected ticks: Tick[] = [];\n protected totalSum = 0;\n protected totalSumString = '0';\n protected valignMiddle = false;\n protected internalSegments: InternalGaugeSegment[] = [];\n\n private locale = inject(LOCALE_ID).toString();\n private numberFormat = new Intl.NumberFormat(this.locale, { maximumFractionDigits: 2 });\n private axisNumberFormat = new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: this.axisNumberOfDecimals(),\n maximumFractionDigits: this.axisNumberOfDecimals()\n });\n\n ngOnChanges(changes: SimpleChanges<this>): void {\n let calc = false;\n if (changes.minNumberOfDecimals || changes.maxNumberOfDecimals) {\n this.numberFormat = new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: this.minNumberOfDecimals(),\n maximumFractionDigits: Math.max(this.minNumberOfDecimals(), this.maxNumberOfDecimals())\n });\n calc = true;\n }\n if (changes.axisNumberOfDecimals) {\n this.axisNumberFormat = new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: this.axisNumberOfDecimals(),\n maximumFractionDigits: this.axisNumberOfDecimals()\n });\n calc = true;\n }\n if (changes.startAngle || changes.endAngle) {\n this.init();\n calc = true;\n }\n if (\n changes.series ||\n changes.min ||\n changes.max ||\n changes.showTicks ||\n changes.showRangeLabelsOutside ||\n changes.segments ||\n changes.axisLabelFormatter ||\n changes.valueFormatter\n ) {\n calc = true;\n }\n if (calc) {\n this.calc();\n }\n }\n\n ngOnInit(): void {\n this.init();\n this.calc();\n }\n\n protected init(): void {\n this.backgroundPath = makeArc(this.center, this.radius, this.startAngle(), this.endAngle());\n\n // auto adjust height\n const maxAngle = Math.max(Math.abs(this.startAngle()), Math.abs(this.endAngle()));\n\n const height = Math.max(50, polarToCartesian(this.center, this.radius, maxAngle).y);\n this.dim.height = height + this.additionalHeight;\n this.valignMiddle = height > 50;\n }\n\n private calc(): void {\n if (this.mode() === 'sum') {\n this.calcSeriesSum();\n } else {\n this.calcSeriesSingle();\n }\n }\n\n private reset(): void {\n this.totalSum = 0;\n this.internalSeries = [];\n this.internalSegments = [];\n this.ticks = [];\n }\n\n private calcSeriesSum(): void {\n this.reset();\n\n const zeroValueAngle =\n this.startAngle() +\n valueToRelativeAngle(this.startAngle(), this.endAngle(), this.min(), this.max(), -this.min());\n\n this.addTick(this.startAngle(), this.min(), true);\n if (this.min() !== 0) {\n this.addTick(zeroValueAngle, 0, false);\n }\n this.addTick(this.endAngle(), this.max(), true);\n\n let nextPosAngle = zeroValueAngle;\n let nextNegAngle = zeroValueAngle;\n for (const series of this.series()) {\n if (series.value >= 0) {\n nextPosAngle = this.addInternalSeries(nextPosAngle, series);\n } else if (series.value < 0) {\n nextNegAngle = this.addInternalSeries(nextNegAngle, series, true);\n }\n }\n\n this.totalSumString = this.formatValue(this.totalSum);\n }\n\n private calcSeriesSingle(): void {\n this.reset();\n\n let angle = this.startAngle();\n let value = this.min();\n for (const segment of this.segments()) {\n const nextAngle =\n valueToRelativeAngle(\n this.startAngle(),\n this.endAngle(),\n this.min(),\n this.max(),\n segment.endValue - value\n ) + angle;\n\n this.internalSegments.push({\n segment,\n colorVar: `var(--${segment.colorToken})`,\n path: makeArc(this.center, this.radius - 3.5, angle, nextAngle)\n });\n\n if (segment.endValue !== this.max()) {\n this.addTick(nextAngle, segment.endValue, false);\n }\n\n angle = nextAngle;\n value = segment.endValue;\n }\n\n this.addTick(this.startAngle(), this.min(), true);\n this.addTick(this.endAngle(), this.max(), true);\n\n const series = this.series()[0];\n if (!series) {\n this.totalSumString = '-';\n return;\n }\n\n const activeSegment = this.segments().find(\n (s, i) => series.value < s.endValue || i == this.segments().length - 1\n );\n this.addInternalSeries(this.startAngle(), series, false, activeSegment?.colorToken);\n\n this.totalSumString = this.formatValue(this.totalSum);\n }\n\n private formatValue(value: number): string {\n const formatter = this.valueFormatter();\n return formatter ? formatter(value) : this.numberFormat.format(value);\n }\n\n private addTick(angle: number, title: number, boundary: boolean): void {\n const segmentOffset = this.mode() === 'single' && this.segments().length ? 1.25 : 0;\n const textRadiusOffset =\n boundary && this.showRangeLabelsOutside()\n ? 0\n : this.showTicks()\n ? 10 + segmentOffset\n : 8 + segmentOffset;\n const textPos = polarToCartesian(this.center, this.radius - textRadiusOffset, angle);\n\n if (boundary && this.showRangeLabelsOutside()) {\n textPos.y += 6;\n }\n\n const axisLabelFormatter = this.axisLabelFormatter();\n this.ticks.push({\n path: this.showTicks() ? this.makeTickPath(angle) : '',\n label: axisLabelFormatter ? axisLabelFormatter(title) : this.axisNumberFormat.format(title),\n textPos\n });\n }\n\n private makeTickPath(angle: number): string {\n const startRadius =\n this.mode() === 'single' && this.segments().length ? this.radius - 5.5 : this.radius - 4;\n const start = polarToCartesian(this.center, startRadius, angle);\n const end = polarToCartesian(this.center, this.radius + 2, angle);\n return makeLine(start, end);\n }\n\n private addInternalSeries(\n startAngle: number,\n series: GaugeSeries,\n reverse = false,\n color?: string\n ): number {\n let nextAngle =\n valueToRelativeAngle(\n this.startAngle(),\n this.endAngle(),\n this.min(),\n this.max(),\n series.value\n ) + startAngle;\n const returnNextAngle = nextAngle;\n\n if (reverse) {\n [startAngle, nextAngle] = [nextAngle, startAngle];\n }\n\n startAngle = this.containAngle(startAngle);\n nextAngle = this.containAngle(nextAngle);\n\n if (startAngle !== nextAngle) {\n this.pushInternalSeries(\n series,\n makeArc(this.center, this.radius, startAngle, nextAngle),\n color\n );\n } else {\n this.pushInternalSeries(series, '', color);\n }\n\n this.totalSum += series.value;\n\n return returnNextAngle;\n }\n\n private pushInternalSeries(series: GaugeSeries, path: string, color?: string): void {\n color ??= series.colorToken;\n this.internalSeries.push({\n series,\n path,\n colorVar: `var(--${color})`,\n valueString: this.numberFormat.format(series.value),\n highlight: false\n });\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=\"ticks\">\n @for (tick of ticks; track $index) {\n <path [attr.d]=\"tick.path\" />\n }\n </g>\n <g class=\"tick-labels text-secondary\">\n @for (tick of ticks; track $index) {\n <text text-anchor=\"middle\" [attr.x]=\"tick.textPos.x\" [attr.y]=\"tick.textPos.y\">\n {{ tick.label }}\n </text>\n }\n </g>\n <g class=\"segments\">\n @for (seg of internalSegments; track $index) {\n <path [attr.d]=\"seg.path\" [style.stroke]=\"seg.colorVar\" />\n }\n </g>\n <g class=\"background\">\n <path [attr.d]=\"backgroundPath\" />\n </g>\n <g class=\"data\">\n @for (series of internalSeries; track $index) {\n @if (series.path) {\n <path\n [class.highlight]=\"series.highlight\"\n [attr.d]=\"series.path\"\n [attr.data-id]=\"series.series.id\"\n [style.stroke]=\"series.colorVar\"\n (mouseenter)=\"series.highlight = true\"\n (mouseleave)=\"series.highlight = false\"\n />\n }\n }\n </g>\n <text\n class=\"text-body value\"\n x=\"50\"\n y=\"50\"\n text-anchor=\"middle\"\n [attr.dominant-baseline]=\"valignMiddle ? 'middle' : 'auto'\"\n >\n {{ totalSumString }}\n @if (unit()) {\n <tspan class=\"unit\">{{ unit() }}</tspan>\n }\n </text>\n</svg>\n\n@if (showLegend()) {\n <table class=\"legend-table flex-fill\">\n <tbody>\n @for (series of internalSeries; track $index) {\n <tr [attr.data-id]=\"series.series.id\">\n <td>\n <div\n class=\"color\"\n [class.highlight]=\"series.highlight\"\n [style.color]=\"series.colorVar\"\n (mouseenter)=\"series.highlight = true\"\n (mouseleave)=\"series.highlight = false\"\n >\n </div>\n </td>\n <td class=\"value\">{{ series.valueString }}</td>\n <td class=\"name\">\n <div class=\"text-truncate\">{{ series.series.name }}</div>\n @if (series.series.description) {\n <div class=\"descr text-truncate\">{{ series.series.description }}</div>\n }\n </td>\n </tr>\n }\n </tbody>\n </table>\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-nchart-gauge.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAAA;;;AAGG;MA6EU,sBAAsB,CAAA;AACjC;;;;AAIG;IACM,UAAU,GAAG,KAAK,CAAC,CAAC,EAAE,uDAAI,SAAS,EAAE,eAAe,EAAA,CAAG;AAChE;;;;AAIG;IACM,QAAQ,GAAG,KAAK,CAAC,EAAE,qDAAI,SAAS,EAAE,eAAe,EAAA,CAAG;AAE7D;;;;AAIG;IACM,GAAG,GAAG,KAAK,CAAC,CAAC,GAAG,gDAAI,SAAS,EAAE,eAAe,EAAA,CAAG;AAC1D;;;;AAIG;IACM,GAAG,GAAG,KAAK,CAAC,GAAG,gDAAI,SAAS,EAAE,eAAe,EAAA,CAAG;AACzD;;;;;AAKG;AACM,IAAA,IAAI,GAAG,KAAK,CAAmB,KAAK,gDAAC;AAC9C;;;;AAIG;AACM,IAAA,MAAM,GAAG,KAAK,CAAgB,EAAE,kDAAC;AAC1C;;;;AAIG;AACM,IAAA,QAAQ,GAAG,KAAK,CAAiB,EAAE,oDAAC;AAC7C;;;;AAIG;AACM,IAAA,IAAI,GAAG,KAAK,CAAC,EAAE,gDAAC;AACzB;;;;AAIG;AACM,IAAA,mBAAmB,GAAG,KAAK,CAAC,CAAC,+DAAC;AACvC;;;;AAIG;AACM,IAAA,mBAAmB,GAAG,KAAK,CAAC,CAAC,+DAAC;AACvC;;;;AAIG;AACM,IAAA,oBAAoB,GAAG,KAAK,CA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A,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FDFa,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBATlC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,EAAA,eAAA,EAGV,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,SAAS,EAAE;AACZ,qBAAA,EAAA,QAAA,EAAA,k3EAAA,EAAA,MAAA,EAAA,CAAA,gmCAAA,CAAA,EAAA;;;AE9EH;;;AAGG;;ACHH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"siemens-native-charts-ng-gauge.mjs","sources":["../../../../projects/native-charts-ng/gauge/si-nchart-gauge.component.ts","../../../../projects/native-charts-ng/gauge/si-nchart-gauge.component.html","../../../../projects/native-charts-ng/gauge/index.ts","../../../../projects/native-charts-ng/gauge/siemens-native-charts-ng-gauge.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n inject,\n input,\n LOCALE_ID,\n numberAttribute,\n OnChanges,\n OnInit,\n SimpleChanges\n} from '@angular/core';\nimport {\n Coordinate,\n makeArc,\n makeLine,\n polarToCartesian,\n relativeValueToRelativeAngle,\n valueToRelativeAngle\n} from '@siemens/native-charts-ng/utils';\n\n/**\n * One series of the gauge chart.\n */\nexport interface GaugeSeries {\n /** value */\n value: number;\n /** color token */\n colorToken: string;\n /** name displayed in legend */\n name: string;\n /** Optional description line in legend */\n description?: string;\n /** ID exposed as `data-id` */\n id?: string;\n}\n\n/**\n * One segment of the gauge chart. The first segment starts at the `min` value of the gauge\n * chart and ends at `endValue`.\n */\nexport interface GaugeSegment {\n /** color token for this segment. */\n colorToken: string;\n /** end value for this segment, exclusive except for last segment where it's inclusive */\n endValue: number;\n}\n\ninterface InternalSeries {\n series: GaugeSeries;\n path: string;\n colorVar: string;\n valueString: string;\n highlight: boolean;\n}\n\ninterface InternalGaugeSegment {\n segment: GaugeSegment;\n path: string;\n colorVar: string;\n}\n\ninterface Tick {\n path: string;\n label: string;\n textPos: Coordinate;\n}\n\n@Component({\n selector: 'si-nchart-gauge',\n templateUrl: './si-nchart-gauge.component.html',\n styleUrl: './si-nchart-gauge.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': '\"legend-\" + legendPosition()'\n }\n})\nexport class SiNChartGaugeComponent implements OnInit, OnChanges {\n /**\n * Start angle in degrees\n *\n * @defaultValue -90\n */\n readonly startAngle = input(-90, { transform: numberAttribute });\n /**\n * End angle in degrees\n *\n * @defaultValue 90\n */\n readonly endAngle = input(90, { transform: numberAttribute });\n\n /**\n * Min value, can be negative\n *\n * @defaultValue -100\n */\n readonly min = input(-100, { transform: numberAttribute });\n /**\n * Max value, can be negative\n *\n * @defaultValue 100\n */\n readonly max = input(100, { transform: numberAttribute });\n /**\n * Display mode: `sum` to sum up multiple series or `single` for a single value with optional\n * segmented display.\n *\n * @defaultValue 'sum'\n */\n readonly mode = input<'sum' | 'single'>('sum');\n /**\n * The series for the chart.\n *\n * @defaultValue []\n */\n readonly series = input<GaugeSeries[]>([]);\n /**\n * Colored segments.\n *\n * @defaultValue []\n */\n readonly segments = input<GaugeSegment[]>([]);\n /**\n * Unit\n *\n * @defaultValue ''\n */\n readonly unit = input('');\n /**\n * Min number of decimals.\n * Possible values are from 0 to 100.\n * @defaultValue 0\n */\n readonly minNumberOfDecimals = input(0);\n /**\n * Max number of decimals.\n * Possible values are from 0 to 100.\n * @defaultValue 2\n */\n readonly maxNumberOfDecimals = input(2);\n /**\n * Number of decimals on the axis.\n * Possible values are from 0 to 100.\n * @defaultValue 0\n */\n readonly axisNumberOfDecimals = input(0);\n /**\n * Custom formatter for axis labels.\n * Takes precedence when specified, i.e. number of decimals needs\n * to be set by the user using this formatter.\n */\n readonly axisLabelFormatter = input<(val: number) => string>();\n /**\n * Custom formatter for value.\n * Takes precedence when specified, i.e. number of decimals needs\n * to be set by the user using this formatter.\n */\n readonly valueFormatter = input<(val: number) => string>();\n /**\n * Whether to show ticks\n *\n * @defaultValue true\n */\n readonly showTicks = input(true, { transform: booleanAttribute });\n /**\n * Whether to show the legend\n *\n * @defaultValue true\n */\n readonly showLegend = input(true, { transform: booleanAttribute });\n /**\n * Legend position:\n * - `column`: chart and legend form a column, i.e. the legend is below the chart.\n * The chart size is driven by the available width.\n * - `row`: chart and legend form a row, i.e. the legend is besides the chart. The\n * The chart size is driven by the available height.\n *\n * @defaultValue 'row'\n */\n readonly legendPosition = input<'row' | 'column'>('row');\n /**\n * Whether to show range start/end labels on the outside of the ring\n *\n * @defaultValue false\n */\n readonly showRangeLabelsOutside = input(false, { transform: booleanAttribute });\n\n protected dim = { width: 100, height: 60 };\n protected center: Coordinate = { x: 50, y: 50 };\n protected radius = 40;\n protected additionalHeight = 10;\n\n protected backgroundPath = '';\n protected internalSeries: InternalSeries[] = [];\n protected ticks: Tick[] = [];\n protected totalSum = 0;\n protected totalSumString = '0';\n protected valignMiddle = false;\n protected internalSegments: InternalGaugeSegment[] = [];\n\n private locale = inject(LOCALE_ID).toString();\n private numberFormat = new Intl.NumberFormat(this.locale, { maximumFractionDigits: 2 });\n private axisNumberFormat = new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: this.axisNumberOfDecimals(),\n maximumFractionDigits: this.axisNumberOfDecimals()\n });\n\n ngOnChanges(changes: SimpleChanges<this>): void {\n let calc = false;\n if (changes.minNumberOfDecimals || changes.maxNumberOfDecimals) {\n this.numberFormat = new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: this.minNumberOfDecimals(),\n maximumFractionDigits: Math.max(this.minNumberOfDecimals(), this.maxNumberOfDecimals())\n });\n calc = true;\n }\n if (changes.axisNumberOfDecimals) {\n this.axisNumberFormat = new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: this.axisNumberOfDecimals(),\n maximumFractionDigits: this.axisNumberOfDecimals()\n });\n calc = true;\n }\n if (changes.startAngle || changes.endAngle) {\n this.init();\n calc = true;\n }\n if (\n changes.series ||\n changes.min ||\n changes.max ||\n changes.showTicks ||\n changes.showRangeLabelsOutside ||\n changes.segments ||\n changes.axisLabelFormatter ||\n changes.valueFormatter\n ) {\n calc = true;\n }\n if (calc) {\n this.calc();\n }\n }\n\n ngOnInit(): void {\n this.init();\n this.calc();\n }\n\n protected init(): void {\n this.backgroundPath = makeArc(this.center, this.radius, this.startAngle(), this.endAngle());\n\n // auto adjust height\n const maxAngle = Math.max(Math.abs(this.startAngle()), Math.abs(this.endAngle()));\n\n const height = Math.max(50, polarToCartesian(this.center, this.radius, maxAngle).y);\n this.dim.height = height + this.additionalHeight;\n this.valignMiddle = height > 50;\n }\n\n private calc(): void {\n if (this.mode() === 'sum') {\n this.calcSeriesSum();\n } else {\n this.calcSeriesSingle();\n }\n }\n\n private reset(): void {\n this.totalSum = 0;\n this.internalSeries = [];\n this.internalSegments = [];\n this.ticks = [];\n }\n\n private calcSeriesSum(): void {\n this.reset();\n\n const zeroValueAngle =\n this.startAngle() +\n valueToRelativeAngle(this.startAngle(), this.endAngle(), this.min(), this.max(), 0);\n\n this.addTick(this.startAngle(), this.min(), true);\n if (this.min() !== 0) {\n this.addTick(zeroValueAngle, 0, false);\n }\n this.addTick(this.endAngle(), this.max(), true);\n\n let nextPosAngle = zeroValueAngle;\n let nextNegAngle = zeroValueAngle;\n for (const series of this.series()) {\n if (series.value >= 0) {\n nextPosAngle = this.addInternalSeries(nextPosAngle, series, true);\n } else if (series.value < 0) {\n nextNegAngle = this.addInternalSeries(nextNegAngle, series, true, true);\n }\n }\n\n this.totalSumString = this.formatValue(this.totalSum);\n }\n\n private calcSeriesSingle(): void {\n this.reset();\n\n const range = this.max() - this.min();\n let angle = this.startAngle();\n let value = this.min();\n for (const segment of this.segments()) {\n const nextAngle =\n relativeValueToRelativeAngle(\n this.startAngle(),\n this.endAngle(),\n range,\n segment.endValue - value\n ) + angle;\n\n this.internalSegments.push({\n segment,\n colorVar: `var(--${segment.colorToken})`,\n path: makeArc(this.center, this.radius - 3.5, angle, nextAngle)\n });\n\n if (segment.endValue !== this.max()) {\n this.addTick(nextAngle, segment.endValue, false);\n }\n\n angle = nextAngle;\n value = segment.endValue;\n }\n\n this.addTick(this.startAngle(), this.min(), true);\n this.addTick(this.endAngle(), this.max(), true);\n\n const series = this.series()[0];\n if (!series) {\n this.totalSumString = '-';\n return;\n }\n\n const activeSegment = this.segments().find(\n (s, i) => series.value < s.endValue || i == this.segments().length - 1\n );\n this.addInternalSeries(this.startAngle(), series, false, false, activeSegment?.colorToken);\n\n this.totalSumString = this.formatValue(this.totalSum);\n }\n\n private formatValue(value: number): string {\n const formatter = this.valueFormatter();\n return formatter ? formatter(value) : this.numberFormat.format(value);\n }\n\n private addTick(angle: number, title: number, boundary: boolean): void {\n const segmentOffset = this.mode() === 'single' && this.segments().length ? 1.25 : 0;\n const textRadiusOffset =\n boundary && this.showRangeLabelsOutside()\n ? 0\n : this.showTicks()\n ? 10 + segmentOffset\n : 8 + segmentOffset;\n const textPos = polarToCartesian(this.center, this.radius - textRadiusOffset, angle);\n\n if (boundary && this.showRangeLabelsOutside()) {\n textPos.y += 6;\n }\n\n const axisLabelFormatter = this.axisLabelFormatter();\n this.ticks.push({\n path: this.showTicks() ? this.makeTickPath(angle) : '',\n label: axisLabelFormatter ? axisLabelFormatter(title) : this.axisNumberFormat.format(title),\n textPos\n });\n }\n\n private makeTickPath(angle: number): string {\n const startRadius =\n this.mode() === 'single' && this.segments().length ? this.radius - 5.5 : this.radius - 4;\n const start = polarToCartesian(this.center, startRadius, angle);\n const end = polarToCartesian(this.center, this.radius + 2, angle);\n return makeLine(start, end);\n }\n\n private addInternalSeries(\n startAngle: number,\n series: GaugeSeries,\n relative = false,\n reverse = false,\n color?: string\n ): number {\n let nextAngle =\n relativeValueToRelativeAngle(\n this.startAngle(),\n this.endAngle(),\n this.max() - this.min(),\n series.value - (relative ? 0 : this.min())\n ) + startAngle;\n const returnNextAngle = nextAngle;\n\n if (reverse) {\n [startAngle, nextAngle] = [nextAngle, startAngle];\n }\n\n startAngle = this.containAngle(startAngle);\n nextAngle = this.containAngle(nextAngle);\n\n if (startAngle !== nextAngle) {\n this.pushInternalSeries(\n series,\n makeArc(this.center, this.radius, startAngle, nextAngle),\n color\n );\n } else {\n this.pushInternalSeries(series, '', color);\n }\n\n this.totalSum += series.value;\n\n return returnNextAngle;\n }\n\n private pushInternalSeries(series: GaugeSeries, path: string, color?: string): void {\n color ??= series.colorToken;\n this.internalSeries.push({\n series,\n path,\n colorVar: `var(--${color})`,\n valueString: this.numberFormat.format(series.value),\n highlight: false\n });\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=\"ticks\">\n @for (tick of ticks; track $index) {\n <path [attr.d]=\"tick.path\" />\n }\n </g>\n <g class=\"tick-labels text-secondary\">\n @for (tick of ticks; track $index) {\n <text text-anchor=\"middle\" [attr.x]=\"tick.textPos.x\" [attr.y]=\"tick.textPos.y\">\n {{ tick.label }}\n </text>\n }\n </g>\n <g class=\"segments\">\n @for (seg of internalSegments; track $index) {\n <path [attr.d]=\"seg.path\" [style.stroke]=\"seg.colorVar\" />\n }\n </g>\n <g class=\"background\">\n <path [attr.d]=\"backgroundPath\" />\n </g>\n <g class=\"data\">\n @for (series of internalSeries; track $index) {\n @if (series.path) {\n <path\n [class.highlight]=\"series.highlight\"\n [attr.d]=\"series.path\"\n [attr.data-id]=\"series.series.id\"\n [style.stroke]=\"series.colorVar\"\n (mouseenter)=\"series.highlight = true\"\n (mouseleave)=\"series.highlight = false\"\n />\n }\n }\n </g>\n <text\n class=\"text-body value\"\n x=\"50\"\n y=\"50\"\n text-anchor=\"middle\"\n [attr.dominant-baseline]=\"valignMiddle ? 'middle' : 'auto'\"\n >\n {{ totalSumString }}\n @if (unit()) {\n <tspan class=\"unit\">{{ unit() }}</tspan>\n }\n </text>\n</svg>\n\n@if (showLegend()) {\n <table class=\"legend-table flex-fill\">\n <tbody>\n @for (series of internalSeries; track $index) {\n <tr [attr.data-id]=\"series.series.id\">\n <td>\n <div\n class=\"color\"\n [class.highlight]=\"series.highlight\"\n [style.color]=\"series.colorVar\"\n (mouseenter)=\"series.highlight = true\"\n (mouseleave)=\"series.highlight = false\"\n >\n </div>\n </td>\n <td class=\"value\">{{ series.valueString }}</td>\n <td class=\"name\">\n <div class=\"text-truncate\">{{ series.series.name }}</div>\n @if (series.series.description) {\n <div class=\"descr text-truncate\">{{ series.series.description }}</div>\n }\n </td>\n </tr>\n }\n </tbody>\n </table>\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-nchart-gauge.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAAA;;;AAGG;MA8EU,sBAAsB,CAAA;AACjC;;;;AAIG;IACM,UAAU,GAAG,KAAK,CAAC,CAAC,EAAE,uDAAI,SAAS,EAAE,eAAe,EAAA,CAAG;AAChE;;;;AAIG;IACM,QAAQ,GAAG,KAAK,CAAC,EAAE,qDAAI,SAAS,EAAE,eAAe,EAAA,CAAG;AAE7D;;;;AAIG;IACM,GAAG,GAAG,KAAK,CAAC,CAAC,GAAG,gDAAI,SAAS,EAAE,eAAe,EAAA,CAAG;AAC1D;;;;AAIG;IACM,GAAG,GAAG,KAAK,CAAC,GAAG,gDAAI,SAAS,EAAE,eAAe,EAAA,CAAG;AACzD;;;;;AAKG;AACM,IAAA,IAAI,GAAG,KAAK,CAAmB,KAAK,gDAAC;AAC9C;;;;AAIG;AACM,IAAA,MAAM,GAAG,KAAK,CAAgB,EAAE,kDAAC;AAC1C;;;;AAIG;AAC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AO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC;IACtE;uGApWW,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAtB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,sBAAsB,u+ECjFnC,k3EAkFA,EAAA,MAAA,EAAA,CAAA,gmCAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FDDa,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBATlC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,EAAA,eAAA,EAGV,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,SAAS,EAAE;AACZ,qBAAA,EAAA,QAAA,EAAA,k3EAAA,EAAA,MAAA,EAAA,CAAA,gmCAAA,CAAA,EAAA;;;AE/EH;;;AAGG;;ACHH;;AAEG;;;;"}
|
|
@@ -55,6 +55,17 @@ function makeLine(start, end) {
|
|
|
55
55
|
function makePolyline(points) {
|
|
56
56
|
return points.map((point, index) => `${index === 0 ? 'M' : 'L'} ${point.x} ${point.y}`).join(' ');
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Calculates the relative angle for a given relative value
|
|
60
|
+
* @param minAngle - min/start angle in degrees
|
|
61
|
+
* @param maxAngle - max/end angle in degrees
|
|
62
|
+
* @param range - the value range
|
|
63
|
+
* @param value - the relative value
|
|
64
|
+
* @returns Relative (from minAngle) angle in degrees
|
|
65
|
+
*/
|
|
66
|
+
function relativeValueToRelativeAngle(minAngle, maxAngle, range, value) {
|
|
67
|
+
return range ? (value * (maxAngle - minAngle)) / range : 0;
|
|
68
|
+
}
|
|
58
69
|
/**
|
|
59
70
|
* Calculates the relative angle for a given value
|
|
60
71
|
* @param minAngle - min/start angle in degrees
|
|
@@ -66,7 +77,7 @@ function makePolyline(points) {
|
|
|
66
77
|
*/
|
|
67
78
|
function valueToRelativeAngle(minAngle, maxAngle, min, max, value) {
|
|
68
79
|
value = Math.max(min, Math.min(max, value));
|
|
69
|
-
return (
|
|
80
|
+
return relativeValueToRelativeAngle(minAngle, maxAngle, max - min, value - min);
|
|
70
81
|
}
|
|
71
82
|
|
|
72
83
|
/**
|
|
@@ -78,5 +89,5 @@ function valueToRelativeAngle(minAngle, maxAngle, min, max, value) {
|
|
|
78
89
|
* Generated bundle index. Do not edit.
|
|
79
90
|
*/
|
|
80
91
|
|
|
81
|
-
export { makeArc, makeLine, makePolyline, polarToCartesian, valueToRelativeAngle };
|
|
92
|
+
export { makeArc, makeLine, makePolyline, polarToCartesian, relativeValueToRelativeAngle, valueToRelativeAngle };
|
|
82
93
|
//# sourceMappingURL=siemens-native-charts-ng-utils.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siemens-native-charts-ng-utils.mjs","sources":["../../../../projects/native-charts-ng/utils/svg-math.ts","../../../../projects/native-charts-ng/utils/index.ts","../../../../projects/native-charts-ng/utils/siemens-native-charts-ng-utils.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\n/* eslint-disable prefer-arrow/prefer-arrow-functions */\n\n/**\n * Cartesian coordinate\n */\nexport interface Coordinate {\n x: number;\n y: number;\n}\n\n/**\n * Converts a polar coordinate to a cartesian\n * @param center - Center point of circle in cartesian coordinate\n * @param radius - Radius of circle\n * @param angleDeg - Angle in degrees\n * @returns cartesian coordinate\n */\nexport function polarToCartesian(center: Coordinate, radius: number, angleDeg: number): Coordinate {\n const angleRad = ((angleDeg - 90) * Math.PI) / 180;\n return {\n x: center.x + radius * Math.cos(angleRad),\n y: center.y + radius * Math.sin(angleRad)\n };\n}\n\n/**\n * Creates a SVG path representing an arc\n * @param center - Center of circle in cartesian coordinate\n * @param radius - Radius of circle\n * @param startAngle - Start angel in degrees\n * @param endAngle - End angel in degrees\n * @returns SVG path string\n */\nexport function makeArc(\n center: Coordinate,\n radius: number,\n startAngle: number,\n endAngle: number\n): string {\n // special case for full circle\n if ((endAngle - startAngle) % 360 === 0) {\n return (\n `M ${center.x} ${center.y - radius} ` +\n `A ${radius} ${radius} 0 1 0 ${center.x} ${center.y + radius} ` +\n `A ${radius} ${radius} 0 1 0 ${center.x} ${center.y - radius} z`\n );\n }\n\n // normal arc\n const start = polarToCartesian(center, radius, endAngle);\n const end = polarToCartesian(center, radius, startAngle);\n const largeArc = endAngle - startAngle <= 180 ? '0' : '1';\n return `M ${start.x} ${start.y} A ${radius} ${radius} 0 ${largeArc} 0 ${end.x} ${end.y}`;\n}\n\n/**\n * Creates a SVG path representing a line\n * @param start - Start coordinate\n * @param end - End coordinate\n * @returns SVG path string\n */\nexport function makeLine(start: Coordinate, end: Coordinate): string {\n return `M ${start.x} ${start.y} L ${end.x} ${end.y}`;\n}\n\n/**\n * Creates a SVG path representing a poly line\n * @param points - Object array with x y coordinates\n * @returns SVG path string for a polyline\n */\nexport function makePolyline(points: Coordinate[]): string {\n return points.map((point, index) => `${index === 0 ? 'M' : 'L'} ${point.x} ${point.y}`).join(' ');\n}\n\n/**\n * Calculates the relative angle for a given value\n * @param minAngle - min/start angle in degrees\n * @param maxAngle - max/end angle in degrees\n * @param min - Min value\n * @param max - Max value\n * @param value - Value\n * @returns Relative (from minAngle) angle in degrees\n */\nexport function valueToRelativeAngle(\n minAngle: number,\n maxAngle: number,\n min: number,\n max: number,\n value: number\n): number {\n value = Math.max(min, Math.min(max, value));\n return (
|
|
1
|
+
{"version":3,"file":"siemens-native-charts-ng-utils.mjs","sources":["../../../../projects/native-charts-ng/utils/svg-math.ts","../../../../projects/native-charts-ng/utils/index.ts","../../../../projects/native-charts-ng/utils/siemens-native-charts-ng-utils.ts"],"sourcesContent":["/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\n/* eslint-disable prefer-arrow/prefer-arrow-functions */\n\n/**\n * Cartesian coordinate\n */\nexport interface Coordinate {\n x: number;\n y: number;\n}\n\n/**\n * Converts a polar coordinate to a cartesian\n * @param center - Center point of circle in cartesian coordinate\n * @param radius - Radius of circle\n * @param angleDeg - Angle in degrees\n * @returns cartesian coordinate\n */\nexport function polarToCartesian(center: Coordinate, radius: number, angleDeg: number): Coordinate {\n const angleRad = ((angleDeg - 90) * Math.PI) / 180;\n return {\n x: center.x + radius * Math.cos(angleRad),\n y: center.y + radius * Math.sin(angleRad)\n };\n}\n\n/**\n * Creates a SVG path representing an arc\n * @param center - Center of circle in cartesian coordinate\n * @param radius - Radius of circle\n * @param startAngle - Start angel in degrees\n * @param endAngle - End angel in degrees\n * @returns SVG path string\n */\nexport function makeArc(\n center: Coordinate,\n radius: number,\n startAngle: number,\n endAngle: number\n): string {\n // special case for full circle\n if ((endAngle - startAngle) % 360 === 0) {\n return (\n `M ${center.x} ${center.y - radius} ` +\n `A ${radius} ${radius} 0 1 0 ${center.x} ${center.y + radius} ` +\n `A ${radius} ${radius} 0 1 0 ${center.x} ${center.y - radius} z`\n );\n }\n\n // normal arc\n const start = polarToCartesian(center, radius, endAngle);\n const end = polarToCartesian(center, radius, startAngle);\n const largeArc = endAngle - startAngle <= 180 ? '0' : '1';\n return `M ${start.x} ${start.y} A ${radius} ${radius} 0 ${largeArc} 0 ${end.x} ${end.y}`;\n}\n\n/**\n * Creates a SVG path representing a line\n * @param start - Start coordinate\n * @param end - End coordinate\n * @returns SVG path string\n */\nexport function makeLine(start: Coordinate, end: Coordinate): string {\n return `M ${start.x} ${start.y} L ${end.x} ${end.y}`;\n}\n\n/**\n * Creates a SVG path representing a poly line\n * @param points - Object array with x y coordinates\n * @returns SVG path string for a polyline\n */\nexport function makePolyline(points: Coordinate[]): string {\n return points.map((point, index) => `${index === 0 ? 'M' : 'L'} ${point.x} ${point.y}`).join(' ');\n}\n\n/**\n * Calculates the relative angle for a given relative value\n * @param minAngle - min/start angle in degrees\n * @param maxAngle - max/end angle in degrees\n * @param range - the value range\n * @param value - the relative value\n * @returns Relative (from minAngle) angle in degrees\n */\nexport function relativeValueToRelativeAngle(\n minAngle: number,\n maxAngle: number,\n range: number,\n value: number\n): number {\n return range ? (value * (maxAngle - minAngle)) / range : 0;\n}\n\n/**\n * Calculates the relative angle for a given value\n * @param minAngle - min/start angle in degrees\n * @param maxAngle - max/end angle in degrees\n * @param min - Min value\n * @param max - Max value\n * @param value - Value\n * @returns Relative (from minAngle) angle in degrees\n */\nexport function valueToRelativeAngle(\n minAngle: number,\n maxAngle: number,\n min: number,\n max: number,\n value: number\n): number {\n value = Math.max(min, Math.min(max, value));\n return relativeValueToRelativeAngle(minAngle, maxAngle, max - min, value - min);\n}\n","/**\n * Copyright (c) Siemens 2016 - 2026\n * SPDX-License-Identifier: MIT\n */\nexport * from './svg-math';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;;;AAGG;AACH;AAUA;;;;;;AAMG;SACa,gBAAgB,CAAC,MAAkB,EAAE,MAAc,EAAE,QAAgB,EAAA;AACnF,IAAA,MAAM,QAAQ,GAAG,CAAC,CAAC,QAAQ,GAAG,EAAE,IAAI,IAAI,CAAC,EAAE,IAAI,GAAG;IAClD,OAAO;AACL,QAAA,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;AACzC,QAAA,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ;KACzC;AACH;AAEA;;;;;;;AAOG;AACG,SAAU,OAAO,CACrB,MAAkB,EAClB,MAAc,EACd,UAAkB,EAClB,QAAgB,EAAA;;IAG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AY,CAAC,MAAoB,EAAA;AAC/C,IAAA,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,CAAA,EAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,GAAG,CAAA,CAAA,EAAI,KAAK,CAAC,CAAC,CAAA,CAAA,EAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AACnG;AAEA;;;;;;;AAOG;AACG,SAAU,4BAA4B,CAC1C,QAAgB,EAChB,QAAgB,EAChB,KAAa,EACb,KAAa,EAAA;AAEb,IAAA,OAAO,KAAK,GAAG,CAAC,KAAK,IAAI,QAAQ,GAAG,QAAQ,CAAC,IAAI,KAAK,GAAG,CAAC;AAC5D;AAEA;;;;;;;;AAQG;AACG,SAAU,oBAAoB,CAClC,QAAgB,EAChB,QAAgB,EAChB,GAAW,EACX,GAAW,EACX,KAAa,EAAA;AAEb,IAAA,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC3C,IAAA,OAAO,4BAA4B,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,GAAG,GAAG,EAAE,KAAK,GAAG,GAAG,CAAC;AACjF;;ACjHA;;;AAGG;;ACHH;;AAEG;;;;"}
|
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": "49.
|
|
4
|
+
"version": "49.7.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@angular/common": "21",
|
|
22
22
|
"@angular/core": "21",
|
|
23
|
-
"@siemens/element-theme": "49.
|
|
23
|
+
"@siemens/element-theme": "49.7.0"
|
|
24
24
|
},
|
|
25
25
|
"exports": {
|
|
26
26
|
"./docs.json": {
|
|
@@ -39,6 +39,15 @@ declare function makeLine(start: Coordinate, end: Coordinate): string;
|
|
|
39
39
|
* @returns SVG path string for a polyline
|
|
40
40
|
*/
|
|
41
41
|
declare function makePolyline(points: Coordinate[]): string;
|
|
42
|
+
/**
|
|
43
|
+
* Calculates the relative angle for a given relative value
|
|
44
|
+
* @param minAngle - min/start angle in degrees
|
|
45
|
+
* @param maxAngle - max/end angle in degrees
|
|
46
|
+
* @param range - the value range
|
|
47
|
+
* @param value - the relative value
|
|
48
|
+
* @returns Relative (from minAngle) angle in degrees
|
|
49
|
+
*/
|
|
50
|
+
declare function relativeValueToRelativeAngle(minAngle: number, maxAngle: number, range: number, value: number): number;
|
|
42
51
|
/**
|
|
43
52
|
* Calculates the relative angle for a given value
|
|
44
53
|
* @param minAngle - min/start angle in degrees
|
|
@@ -50,5 +59,5 @@ declare function makePolyline(points: Coordinate[]): string;
|
|
|
50
59
|
*/
|
|
51
60
|
declare function valueToRelativeAngle(minAngle: number, maxAngle: number, min: number, max: number, value: number): number;
|
|
52
61
|
|
|
53
|
-
export { makeArc, makeLine, makePolyline, polarToCartesian, valueToRelativeAngle };
|
|
62
|
+
export { makeArc, makeLine, makePolyline, polarToCartesian, relativeValueToRelativeAngle, valueToRelativeAngle };
|
|
54
63
|
export type { Coordinate };
|