@siemens/native-charts-ng 47.5.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/README.md +23 -0
- package/components/index.d.ts +5 -0
- package/components/si-nchart-gauge/si-nchart-gauge.component.d.ts +175 -0
- package/fesm2022/siemens-native-charts-ng.mjs +383 -0
- package/fesm2022/siemens-native-charts-ng.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/package.json +42 -0
- package/public-api.d.ts +6 -0
- package/public-api.module.d.ts +7 -0
- package/utils/svg-math.d.ts +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Element Native charts
|
|
2
|
+
|
|
3
|
+
The Element native chart library for Angular w/o dependencies
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
To use the Element native charts Angular components in your project, add them to your dependencies
|
|
8
|
+
by executing:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install --save @siemens/native-charts-ng
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Running unit tests
|
|
15
|
+
|
|
16
|
+
Run `yarn native-charts:test` to perform the unit tests via [Karma](https://karma-runner.github.io).
|
|
17
|
+
You can set a seed for running the tests in a specific using an environment variable: `SEED=71384 yarn native-charts:test`
|
|
18
|
+
|
|
19
|
+
## License
|
|
20
|
+
|
|
21
|
+
Code and documentation copyright 2024 Siemens AG.
|
|
22
|
+
|
|
23
|
+
See [LICENSE.md](../../LICENSE.md).
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Siemens 2016 - 2025.
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
import { OnChanges, OnInit, SimpleChanges } from '@angular/core';
|
|
6
|
+
import { Coordinate } from '../../utils/svg-math';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
/**
|
|
9
|
+
* One series of the gauge chart.
|
|
10
|
+
*/
|
|
11
|
+
export interface GaugeSeries {
|
|
12
|
+
/** value */
|
|
13
|
+
value: number;
|
|
14
|
+
/** color token */
|
|
15
|
+
colorToken: string;
|
|
16
|
+
/** name displayed in legend */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Optional description line in legend */
|
|
19
|
+
description?: string;
|
|
20
|
+
/** ID exposed as `data-id` */
|
|
21
|
+
id?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* One segment of the gauge chart. The first segment starts at the `min` value of the gauge
|
|
25
|
+
* chart and ends at `endValue`.
|
|
26
|
+
*/
|
|
27
|
+
export interface GaugeSegment {
|
|
28
|
+
/** color token for this segment. */
|
|
29
|
+
colorToken: string;
|
|
30
|
+
/** end value for this segment, exclusive except for last segment where it's inclusive */
|
|
31
|
+
endValue: number;
|
|
32
|
+
}
|
|
33
|
+
interface InternalSeries {
|
|
34
|
+
series: GaugeSeries;
|
|
35
|
+
path: string;
|
|
36
|
+
colorVar: string;
|
|
37
|
+
valueString: string;
|
|
38
|
+
highlight: boolean;
|
|
39
|
+
}
|
|
40
|
+
interface InternalGaugeSegment {
|
|
41
|
+
segment: GaugeSegment;
|
|
42
|
+
path: string;
|
|
43
|
+
colorVar: string;
|
|
44
|
+
}
|
|
45
|
+
interface Tick {
|
|
46
|
+
path: string;
|
|
47
|
+
label: string;
|
|
48
|
+
textPos: Coordinate;
|
|
49
|
+
}
|
|
50
|
+
export declare class SiNChartGaugeComponent implements OnInit, OnChanges {
|
|
51
|
+
/**
|
|
52
|
+
* Start angle in degrees
|
|
53
|
+
*
|
|
54
|
+
* @defaultValue -90
|
|
55
|
+
*/
|
|
56
|
+
readonly startAngle: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
57
|
+
/**
|
|
58
|
+
* End angle in degrees
|
|
59
|
+
*
|
|
60
|
+
* @defaultValue 90
|
|
61
|
+
*/
|
|
62
|
+
readonly endAngle: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
63
|
+
/**
|
|
64
|
+
* Min value, can be negative
|
|
65
|
+
*
|
|
66
|
+
* @defaultValue -100
|
|
67
|
+
*/
|
|
68
|
+
readonly min: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* Max value, can be negative
|
|
71
|
+
*
|
|
72
|
+
* @defaultValue 100
|
|
73
|
+
*/
|
|
74
|
+
readonly max: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
75
|
+
/**
|
|
76
|
+
* Display mode: `sum` to sum up multiple series or `single` for a single value with optional
|
|
77
|
+
* segmented display.
|
|
78
|
+
*
|
|
79
|
+
* @defaultValue 'sum'
|
|
80
|
+
*/
|
|
81
|
+
readonly mode: import("@angular/core").InputSignal<"sum" | "single">;
|
|
82
|
+
/**
|
|
83
|
+
* Series
|
|
84
|
+
*
|
|
85
|
+
* @defaultValue []
|
|
86
|
+
*/
|
|
87
|
+
readonly series: import("@angular/core").InputSignal<GaugeSeries[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Colored segments.
|
|
90
|
+
*
|
|
91
|
+
* @defaultValue []
|
|
92
|
+
*/
|
|
93
|
+
readonly segments: import("@angular/core").InputSignal<GaugeSegment[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Unit
|
|
96
|
+
*
|
|
97
|
+
* @defaultValue ''
|
|
98
|
+
*/
|
|
99
|
+
readonly unit: import("@angular/core").InputSignal<string>;
|
|
100
|
+
/**
|
|
101
|
+
* Min number of decimals.
|
|
102
|
+
* @defaultValue 0
|
|
103
|
+
*/
|
|
104
|
+
readonly minNumberOfDecimals: import("@angular/core").InputSignal<number>;
|
|
105
|
+
/**
|
|
106
|
+
* Max number of decimals.
|
|
107
|
+
* @defaultValue 2
|
|
108
|
+
*/
|
|
109
|
+
readonly maxNumberOfDecimals: import("@angular/core").InputSignal<number>;
|
|
110
|
+
/**
|
|
111
|
+
* Number of decimals on the axis.
|
|
112
|
+
* @defaultValue 0
|
|
113
|
+
*/
|
|
114
|
+
readonly axisNumberOfDecimals: import("@angular/core").InputSignal<number>;
|
|
115
|
+
/**
|
|
116
|
+
* Whether to show ticks
|
|
117
|
+
*
|
|
118
|
+
* @defaultValue true
|
|
119
|
+
*/
|
|
120
|
+
readonly showTicks: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
121
|
+
/**
|
|
122
|
+
* Whether to show the legend
|
|
123
|
+
*
|
|
124
|
+
* @defaultValue true
|
|
125
|
+
*/
|
|
126
|
+
readonly showLegend: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
127
|
+
/**
|
|
128
|
+
* Legend position:
|
|
129
|
+
* - `column`: chart and legend form a column, i.e. the legend is below the chart.
|
|
130
|
+
* The chart size is driven by the available width.
|
|
131
|
+
* - `row`: chart and legend form a row, i.e. the legend is besides the chart. The
|
|
132
|
+
* The chart size is driven by the available height.
|
|
133
|
+
*
|
|
134
|
+
* @defaultValue 'row'
|
|
135
|
+
*/
|
|
136
|
+
readonly legendPosition: import("@angular/core").InputSignal<"row" | "column">;
|
|
137
|
+
/**
|
|
138
|
+
* Whether to show range start/end labels on the outside of the ring
|
|
139
|
+
*
|
|
140
|
+
* @defaultValue false
|
|
141
|
+
*/
|
|
142
|
+
readonly showRangeLabelsOutside: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
143
|
+
protected dim: {
|
|
144
|
+
width: number;
|
|
145
|
+
height: number;
|
|
146
|
+
};
|
|
147
|
+
protected center: Coordinate;
|
|
148
|
+
protected radius: number;
|
|
149
|
+
protected additionalHeight: number;
|
|
150
|
+
protected backgroundPath: string;
|
|
151
|
+
protected internalSeries: InternalSeries[];
|
|
152
|
+
protected ticks: Tick[];
|
|
153
|
+
protected totalSum: number;
|
|
154
|
+
protected totalSumString: string;
|
|
155
|
+
protected valignMiddle: boolean;
|
|
156
|
+
protected internalSegments: InternalGaugeSegment[];
|
|
157
|
+
private locale;
|
|
158
|
+
private numberFormat;
|
|
159
|
+
private axisNumberFormat;
|
|
160
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
161
|
+
ngOnInit(): void;
|
|
162
|
+
protected init(): void;
|
|
163
|
+
private calc;
|
|
164
|
+
private reset;
|
|
165
|
+
private calcSeriesSum;
|
|
166
|
+
private calcSeriesSingle;
|
|
167
|
+
private addTick;
|
|
168
|
+
private makeTickPath;
|
|
169
|
+
private addInternalSeries;
|
|
170
|
+
private pushInternalSeries;
|
|
171
|
+
private containAngle;
|
|
172
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SiNChartGaugeComponent, never>;
|
|
173
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SiNChartGaugeComponent, "si-nchart-gauge", never, { "startAngle": { "alias": "startAngle"; "required": false; "isSignal": true; }; "endAngle": { "alias": "endAngle"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "series": { "alias": "series"; "required": false; "isSignal": true; }; "segments": { "alias": "segments"; "required": false; "isSignal": true; }; "unit": { "alias": "unit"; "required": false; "isSignal": true; }; "minNumberOfDecimals": { "alias": "minNumberOfDecimals"; "required": false; "isSignal": true; }; "maxNumberOfDecimals": { "alias": "maxNumberOfDecimals"; "required": false; "isSignal": true; }; "axisNumberOfDecimals": { "alias": "axisNumberOfDecimals"; "required": false; "isSignal": true; }; "showTicks": { "alias": "showTicks"; "required": false; "isSignal": true; }; "showLegend": { "alias": "showLegend"; "required": false; "isSignal": true; }; "legendPosition": { "alias": "legendPosition"; "required": false; "isSignal": true; }; "showRangeLabelsOutside": { "alias": "showRangeLabelsOutside"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
174
|
+
}
|
|
175
|
+
export {};
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, numberAttribute, booleanAttribute, inject, LOCALE_ID, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Copyright Siemens 2016 - 2025.
|
|
6
|
+
* SPDX-License-Identifier: MIT
|
|
7
|
+
*/
|
|
8
|
+
/* eslint-disable prefer-arrow/prefer-arrow-functions */
|
|
9
|
+
/**
|
|
10
|
+
* Converts a polar coordinate to a cartesian
|
|
11
|
+
* @param center - Center point of circle in cartesian coordinate
|
|
12
|
+
* @param radius - Radius of circle
|
|
13
|
+
* @param angleDeg - Angle in degrees
|
|
14
|
+
* @returns cartesian coordinate
|
|
15
|
+
*/
|
|
16
|
+
function polarToCartesian(center, radius, angleDeg) {
|
|
17
|
+
const angleRad = ((angleDeg - 90) * Math.PI) / 180;
|
|
18
|
+
return {
|
|
19
|
+
x: center.x + radius * Math.cos(angleRad),
|
|
20
|
+
y: center.y + radius * Math.sin(angleRad)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Creates a SVG path representing an arc
|
|
25
|
+
* @param center - Center of circle in cartesian coordinate
|
|
26
|
+
* @param radius - Radius of circle
|
|
27
|
+
* @param startAngle - Start angel in degrees
|
|
28
|
+
* @param endAngle - End angel in degrees
|
|
29
|
+
* @returns SVG path string
|
|
30
|
+
*/
|
|
31
|
+
function makeArc(center, radius, startAngle, endAngle) {
|
|
32
|
+
// special case for full circle
|
|
33
|
+
if ((endAngle - startAngle) % 360 === 0) {
|
|
34
|
+
return (`M ${center.x} ${center.y - radius} ` +
|
|
35
|
+
`A ${radius} ${radius} 0 1 0 ${center.x} ${center.y + radius} ` +
|
|
36
|
+
`A ${radius} ${radius} 0 1 0 ${center.x} ${center.y - radius} z`);
|
|
37
|
+
}
|
|
38
|
+
// normal arc
|
|
39
|
+
const start = polarToCartesian(center, radius, endAngle);
|
|
40
|
+
const end = polarToCartesian(center, radius, startAngle);
|
|
41
|
+
const largeArc = endAngle - startAngle <= 180 ? '0' : '1';
|
|
42
|
+
return `M ${start.x} ${start.y} A ${radius} ${radius} 0 ${largeArc} 0 ${end.x} ${end.y}`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates a SVG path representing a line
|
|
46
|
+
* @param start - Start coordinate
|
|
47
|
+
* @param end - End coordinate
|
|
48
|
+
* @returns SVG path string
|
|
49
|
+
*/
|
|
50
|
+
function makeLine(start, end) {
|
|
51
|
+
return `M ${start.x} ${start.y} L ${end.x} ${end.y}`;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Calculates the relative angle for a given value
|
|
55
|
+
* @param minAngle - min/start angle in degrees
|
|
56
|
+
* @param maxAngle - max/end angle in degrees
|
|
57
|
+
* @param min - Min value
|
|
58
|
+
* @param max - Max value
|
|
59
|
+
* @param value - Value
|
|
60
|
+
* @returns Relative (from minAngle) angle in degrees
|
|
61
|
+
*/
|
|
62
|
+
function valueToRelativeAngle(minAngle, maxAngle, min, max, value) {
|
|
63
|
+
value = Math.max(min, Math.min(max, value));
|
|
64
|
+
return (value * (maxAngle - minAngle)) / (max - min);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Copyright Siemens 2016 - 2025.
|
|
69
|
+
* SPDX-License-Identifier: MIT
|
|
70
|
+
*/
|
|
71
|
+
class SiNChartGaugeComponent {
|
|
72
|
+
/**
|
|
73
|
+
* Start angle in degrees
|
|
74
|
+
*
|
|
75
|
+
* @defaultValue -90
|
|
76
|
+
*/
|
|
77
|
+
startAngle = input(-90, { transform: numberAttribute });
|
|
78
|
+
/**
|
|
79
|
+
* End angle in degrees
|
|
80
|
+
*
|
|
81
|
+
* @defaultValue 90
|
|
82
|
+
*/
|
|
83
|
+
endAngle = input(90, { transform: numberAttribute });
|
|
84
|
+
/**
|
|
85
|
+
* Min value, can be negative
|
|
86
|
+
*
|
|
87
|
+
* @defaultValue -100
|
|
88
|
+
*/
|
|
89
|
+
min = input(-100, { transform: numberAttribute });
|
|
90
|
+
/**
|
|
91
|
+
* Max value, can be negative
|
|
92
|
+
*
|
|
93
|
+
* @defaultValue 100
|
|
94
|
+
*/
|
|
95
|
+
max = input(100, { transform: numberAttribute });
|
|
96
|
+
/**
|
|
97
|
+
* Display mode: `sum` to sum up multiple series or `single` for a single value with optional
|
|
98
|
+
* segmented display.
|
|
99
|
+
*
|
|
100
|
+
* @defaultValue 'sum'
|
|
101
|
+
*/
|
|
102
|
+
mode = input('sum');
|
|
103
|
+
/**
|
|
104
|
+
* Series
|
|
105
|
+
*
|
|
106
|
+
* @defaultValue []
|
|
107
|
+
*/
|
|
108
|
+
series = input([]);
|
|
109
|
+
/**
|
|
110
|
+
* Colored segments.
|
|
111
|
+
*
|
|
112
|
+
* @defaultValue []
|
|
113
|
+
*/
|
|
114
|
+
segments = input([]);
|
|
115
|
+
/**
|
|
116
|
+
* Unit
|
|
117
|
+
*
|
|
118
|
+
* @defaultValue ''
|
|
119
|
+
*/
|
|
120
|
+
unit = input('');
|
|
121
|
+
/**
|
|
122
|
+
* Min number of decimals.
|
|
123
|
+
* @defaultValue 0
|
|
124
|
+
*/
|
|
125
|
+
minNumberOfDecimals = input(0);
|
|
126
|
+
/**
|
|
127
|
+
* Max number of decimals.
|
|
128
|
+
* @defaultValue 2
|
|
129
|
+
*/
|
|
130
|
+
maxNumberOfDecimals = input(2);
|
|
131
|
+
/**
|
|
132
|
+
* Number of decimals on the axis.
|
|
133
|
+
* @defaultValue 0
|
|
134
|
+
*/
|
|
135
|
+
axisNumberOfDecimals = input(0);
|
|
136
|
+
/**
|
|
137
|
+
* Whether to show ticks
|
|
138
|
+
*
|
|
139
|
+
* @defaultValue true
|
|
140
|
+
*/
|
|
141
|
+
showTicks = input(true, { transform: booleanAttribute });
|
|
142
|
+
/**
|
|
143
|
+
* Whether to show the legend
|
|
144
|
+
*
|
|
145
|
+
* @defaultValue true
|
|
146
|
+
*/
|
|
147
|
+
showLegend = input(true, { transform: booleanAttribute });
|
|
148
|
+
/**
|
|
149
|
+
* Legend position:
|
|
150
|
+
* - `column`: chart and legend form a column, i.e. the legend is below the chart.
|
|
151
|
+
* The chart size is driven by the available width.
|
|
152
|
+
* - `row`: chart and legend form a row, i.e. the legend is besides the chart. The
|
|
153
|
+
* The chart size is driven by the available height.
|
|
154
|
+
*
|
|
155
|
+
* @defaultValue 'row'
|
|
156
|
+
*/
|
|
157
|
+
legendPosition = input('row');
|
|
158
|
+
/**
|
|
159
|
+
* Whether to show range start/end labels on the outside of the ring
|
|
160
|
+
*
|
|
161
|
+
* @defaultValue false
|
|
162
|
+
*/
|
|
163
|
+
showRangeLabelsOutside = input(false, { transform: booleanAttribute });
|
|
164
|
+
dim = { width: 100, height: 60 };
|
|
165
|
+
center = { x: 50, y: 50 };
|
|
166
|
+
radius = 40;
|
|
167
|
+
additionalHeight = 10;
|
|
168
|
+
backgroundPath = '';
|
|
169
|
+
internalSeries = [];
|
|
170
|
+
ticks = [];
|
|
171
|
+
totalSum = 0;
|
|
172
|
+
totalSumString = '0';
|
|
173
|
+
valignMiddle = false;
|
|
174
|
+
internalSegments = [];
|
|
175
|
+
locale = inject(LOCALE_ID).toString();
|
|
176
|
+
numberFormat = new Intl.NumberFormat(this.locale, { maximumFractionDigits: 2 });
|
|
177
|
+
axisNumberFormat = new Intl.NumberFormat(this.locale, {
|
|
178
|
+
minimumFractionDigits: this.axisNumberOfDecimals(),
|
|
179
|
+
maximumFractionDigits: this.axisNumberOfDecimals()
|
|
180
|
+
});
|
|
181
|
+
ngOnChanges(changes) {
|
|
182
|
+
let calc = false;
|
|
183
|
+
if (changes.minNumberOfDecimals || changes.maxNumberOfDecimals) {
|
|
184
|
+
this.numberFormat = new Intl.NumberFormat(this.locale, {
|
|
185
|
+
minimumFractionDigits: this.minNumberOfDecimals(),
|
|
186
|
+
maximumFractionDigits: Math.max(this.minNumberOfDecimals(), this.maxNumberOfDecimals())
|
|
187
|
+
});
|
|
188
|
+
calc = true;
|
|
189
|
+
}
|
|
190
|
+
if (changes.axisNumberOfDecimals) {
|
|
191
|
+
this.axisNumberFormat = new Intl.NumberFormat(this.locale, {
|
|
192
|
+
minimumFractionDigits: this.axisNumberOfDecimals(),
|
|
193
|
+
maximumFractionDigits: this.axisNumberOfDecimals()
|
|
194
|
+
});
|
|
195
|
+
calc = true;
|
|
196
|
+
}
|
|
197
|
+
if (changes.startAngle || changes.endAngle) {
|
|
198
|
+
this.init();
|
|
199
|
+
calc = true;
|
|
200
|
+
}
|
|
201
|
+
if (changes.series ||
|
|
202
|
+
changes.min ||
|
|
203
|
+
changes.max ||
|
|
204
|
+
changes.showTicks ||
|
|
205
|
+
changes.showRangeLabelsOutside ||
|
|
206
|
+
changes.segments) {
|
|
207
|
+
calc = true;
|
|
208
|
+
}
|
|
209
|
+
if (calc) {
|
|
210
|
+
this.calc();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
ngOnInit() {
|
|
214
|
+
this.init();
|
|
215
|
+
this.calc();
|
|
216
|
+
}
|
|
217
|
+
init() {
|
|
218
|
+
this.backgroundPath = makeArc(this.center, this.radius, this.startAngle(), this.endAngle());
|
|
219
|
+
// auto adjust height
|
|
220
|
+
const maxAngle = Math.max(Math.abs(this.startAngle()), Math.abs(this.endAngle()));
|
|
221
|
+
const height = Math.max(50, polarToCartesian(this.center, this.radius, maxAngle).y);
|
|
222
|
+
this.dim.height = height + this.additionalHeight;
|
|
223
|
+
this.valignMiddle = height > 50;
|
|
224
|
+
}
|
|
225
|
+
calc() {
|
|
226
|
+
if (this.mode() === 'sum') {
|
|
227
|
+
this.calcSeriesSum();
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
this.calcSeriesSingle();
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
reset() {
|
|
234
|
+
this.totalSum = 0;
|
|
235
|
+
this.internalSeries = [];
|
|
236
|
+
this.internalSegments = [];
|
|
237
|
+
this.ticks = [];
|
|
238
|
+
}
|
|
239
|
+
calcSeriesSum() {
|
|
240
|
+
this.reset();
|
|
241
|
+
const zeroValueAngle = this.startAngle() +
|
|
242
|
+
valueToRelativeAngle(this.startAngle(), this.endAngle(), this.min(), this.max(), -this.min());
|
|
243
|
+
this.addTick(this.startAngle(), this.min(), true);
|
|
244
|
+
if (this.min() !== 0) {
|
|
245
|
+
this.addTick(zeroValueAngle, 0, false);
|
|
246
|
+
}
|
|
247
|
+
this.addTick(this.endAngle(), this.max(), true);
|
|
248
|
+
let nextPosAngle = zeroValueAngle;
|
|
249
|
+
let nextNegAngle = zeroValueAngle;
|
|
250
|
+
for (const series of this.series()) {
|
|
251
|
+
if (series.value >= 0) {
|
|
252
|
+
nextPosAngle = this.addInternalSeries(nextPosAngle, series);
|
|
253
|
+
}
|
|
254
|
+
else if (series.value < 0) {
|
|
255
|
+
nextNegAngle = this.addInternalSeries(nextNegAngle, series, true);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
this.totalSumString = this.numberFormat.format(this.totalSum);
|
|
259
|
+
}
|
|
260
|
+
calcSeriesSingle() {
|
|
261
|
+
this.reset();
|
|
262
|
+
let angle = this.startAngle();
|
|
263
|
+
let value = this.min();
|
|
264
|
+
for (const segment of this.segments()) {
|
|
265
|
+
const nextAngle = valueToRelativeAngle(this.startAngle(), this.endAngle(), this.min(), this.max(), segment.endValue - value) + angle;
|
|
266
|
+
this.internalSegments.push({
|
|
267
|
+
segment,
|
|
268
|
+
colorVar: `var(--${segment.colorToken})`,
|
|
269
|
+
path: makeArc(this.center, this.radius - 3.5, angle, nextAngle)
|
|
270
|
+
});
|
|
271
|
+
if (segment.endValue !== this.max()) {
|
|
272
|
+
this.addTick(nextAngle, segment.endValue, false);
|
|
273
|
+
}
|
|
274
|
+
angle = nextAngle;
|
|
275
|
+
value = segment.endValue;
|
|
276
|
+
}
|
|
277
|
+
this.addTick(this.startAngle(), this.min(), true);
|
|
278
|
+
this.addTick(this.endAngle(), this.max(), true);
|
|
279
|
+
const series = this.series()[0];
|
|
280
|
+
if (!series) {
|
|
281
|
+
this.totalSumString = '-';
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
const activeSegment = this.segments().find((s, i) => series.value < s.endValue || i == this.segments().length - 1);
|
|
285
|
+
this.addInternalSeries(this.startAngle(), series, false, activeSegment?.colorToken);
|
|
286
|
+
this.totalSumString = this.numberFormat.format(this.totalSum);
|
|
287
|
+
}
|
|
288
|
+
addTick(angle, title, boundary) {
|
|
289
|
+
const segmentOffset = this.mode() === 'single' && this.segments().length ? 1.25 : 0;
|
|
290
|
+
const textRadiusOffset = boundary && this.showRangeLabelsOutside()
|
|
291
|
+
? 0
|
|
292
|
+
: this.showTicks()
|
|
293
|
+
? 10 + segmentOffset
|
|
294
|
+
: 8 + segmentOffset;
|
|
295
|
+
const textPos = polarToCartesian(this.center, this.radius - textRadiusOffset, angle);
|
|
296
|
+
if (boundary && this.showRangeLabelsOutside()) {
|
|
297
|
+
textPos.y += 6;
|
|
298
|
+
}
|
|
299
|
+
this.ticks.push({
|
|
300
|
+
path: this.showTicks() ? this.makeTickPath(angle) : '',
|
|
301
|
+
label: this.axisNumberFormat.format(title),
|
|
302
|
+
textPos
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
makeTickPath(angle) {
|
|
306
|
+
const startRadius = this.mode() === 'single' && this.segments().length ? this.radius - 5.5 : this.radius - 4;
|
|
307
|
+
const start = polarToCartesian(this.center, startRadius, angle);
|
|
308
|
+
const end = polarToCartesian(this.center, this.radius + 2, angle);
|
|
309
|
+
return makeLine(start, end);
|
|
310
|
+
}
|
|
311
|
+
addInternalSeries(startAngle, series, reverse = false, color) {
|
|
312
|
+
let nextAngle = valueToRelativeAngle(this.startAngle(), this.endAngle(), this.min(), this.max(), series.value) + startAngle;
|
|
313
|
+
const returnNextAngle = nextAngle;
|
|
314
|
+
if (reverse) {
|
|
315
|
+
[startAngle, nextAngle] = [nextAngle, startAngle];
|
|
316
|
+
}
|
|
317
|
+
startAngle = this.containAngle(startAngle);
|
|
318
|
+
nextAngle = this.containAngle(nextAngle);
|
|
319
|
+
if (startAngle !== nextAngle) {
|
|
320
|
+
this.pushInternalSeries(series, makeArc(this.center, this.radius, startAngle, nextAngle), color);
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
this.pushInternalSeries(series, '', color);
|
|
324
|
+
}
|
|
325
|
+
this.totalSum += series.value;
|
|
326
|
+
return returnNextAngle;
|
|
327
|
+
}
|
|
328
|
+
pushInternalSeries(series, path, color) {
|
|
329
|
+
color ??= series.colorToken;
|
|
330
|
+
this.internalSeries.push({
|
|
331
|
+
series,
|
|
332
|
+
path,
|
|
333
|
+
colorVar: `var(--${color})`,
|
|
334
|
+
valueString: this.numberFormat.format(series.value),
|
|
335
|
+
highlight: false
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
containAngle(angle) {
|
|
339
|
+
return Math.max(this.startAngle(), Math.min(this.endAngle(), angle));
|
|
340
|
+
}
|
|
341
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiNChartGaugeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
342
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.6", type: SiNChartGaugeComponent, isStandalone: true, selector: "si-nchart-gauge", inputs: { startAngle: { classPropertyName: "startAngle", publicName: "startAngle", isSignal: true, isRequired: false, transformFunction: null }, endAngle: { classPropertyName: "endAngle", publicName: "endAngle", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null }, segments: { classPropertyName: "segments", publicName: "segments", isSignal: true, isRequired: false, transformFunction: null }, unit: { classPropertyName: "unit", publicName: "unit", isSignal: true, isRequired: false, transformFunction: null }, minNumberOfDecimals: { classPropertyName: "minNumberOfDecimals", publicName: "minNumberOfDecimals", isSignal: true, isRequired: false, transformFunction: null }, maxNumberOfDecimals: { classPropertyName: "maxNumberOfDecimals", publicName: "maxNumberOfDecimals", isSignal: true, isRequired: false, transformFunction: null }, axisNumberOfDecimals: { classPropertyName: "axisNumberOfDecimals", publicName: "axisNumberOfDecimals", isSignal: true, isRequired: false, transformFunction: null }, showTicks: { classPropertyName: "showTicks", publicName: "showTicks", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, legendPosition: { classPropertyName: "legendPosition", publicName: "legendPosition", isSignal: true, isRequired: false, transformFunction: null }, showRangeLabelsOutside: { classPropertyName: "showRangeLabelsOutside", publicName: "showRangeLabelsOutside", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "\"legend-\" + legendPosition()" } }, usesOnChanges: true, ngImport: i0, template: "<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", styles: [":host{display:flex}:host.legend-column{flex-direction:column}:host.legend-column .chart{block-size:auto;inline-size:100%;min-block-size:120px;max-block-size:320px}:host.legend-row .chart{block-size:100%;inline-size:auto;min-inline-size:200px}.chart .background,.chart .data{stroke-width:4;fill:none}.chart .background,.chart .ticks{stroke:var(--element-ui-4)}.chart .ticks{stroke-width:.5}.chart .segments{stroke-width:.75;fill:none}.chart .tick-labels,.chart .value{fill:currentColor}.chart .data>.highlight{stroke-width:6}.chart .value{font-size:80%}.chart tspan.unit{font-size:40%}.chart .tick-labels{font-size:25%}.legend-table{border-collapse:collapse;align-self:center}.legend-table td{padding-block:8px;padding-inline:8px}.legend-table .value{text-align:end;white-space:nowrap}.legend-table .name{inline-size:100%;min-inline-size:64px;max-inline-size:0}.legend-table .descr{color:var(--element-text-secondary)}.color{position:relative;flex:0 0 auto;block-size:16px;inline-size:16px}.color:after{content:\"\";position:absolute;inset:2px;background:currentColor;border-radius:50%}.color.highlight:after{inset:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
343
|
+
}
|
|
344
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SiNChartGaugeComponent, decorators: [{
|
|
345
|
+
type: Component,
|
|
346
|
+
args: [{ selector: 'si-nchart-gauge', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
347
|
+
'[class]': '"legend-" + legendPosition()'
|
|
348
|
+
}, template: "<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", styles: [":host{display:flex}:host.legend-column{flex-direction:column}:host.legend-column .chart{block-size:auto;inline-size:100%;min-block-size:120px;max-block-size:320px}:host.legend-row .chart{block-size:100%;inline-size:auto;min-inline-size:200px}.chart .background,.chart .data{stroke-width:4;fill:none}.chart .background,.chart .ticks{stroke:var(--element-ui-4)}.chart .ticks{stroke-width:.5}.chart .segments{stroke-width:.75;fill:none}.chart .tick-labels,.chart .value{fill:currentColor}.chart .data>.highlight{stroke-width:6}.chart .value{font-size:80%}.chart tspan.unit{font-size:40%}.chart .tick-labels{font-size:25%}.legend-table{border-collapse:collapse;align-self:center}.legend-table td{padding-block:8px;padding-inline:8px}.legend-table .value{text-align:end;white-space:nowrap}.legend-table .name{inline-size:100%;min-inline-size:64px;max-inline-size:0}.legend-table .descr{color:var(--element-text-secondary)}.color{position:relative;flex:0 0 auto;block-size:16px;inline-size:16px}.color:after{content:\"\";position:absolute;inset:2px;background:currentColor;border-radius:50%}.color.highlight:after{inset:0}\n"] }]
|
|
349
|
+
}] });
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Copyright Siemens 2016 - 2025.
|
|
353
|
+
* SPDX-License-Identifier: MIT
|
|
354
|
+
*/
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Copyright Siemens 2016 - 2025.
|
|
358
|
+
* SPDX-License-Identifier: MIT
|
|
359
|
+
*/
|
|
360
|
+
class ElementNativeChartsNgModule {
|
|
361
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ElementNativeChartsNgModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
362
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: ElementNativeChartsNgModule, imports: [SiNChartGaugeComponent], exports: [SiNChartGaugeComponent] });
|
|
363
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ElementNativeChartsNgModule });
|
|
364
|
+
}
|
|
365
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ElementNativeChartsNgModule, decorators: [{
|
|
366
|
+
type: NgModule,
|
|
367
|
+
args: [{
|
|
368
|
+
imports: [SiNChartGaugeComponent],
|
|
369
|
+
exports: [SiNChartGaugeComponent]
|
|
370
|
+
}]
|
|
371
|
+
}] });
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Copyright Siemens 2016 - 2025.
|
|
375
|
+
* SPDX-License-Identifier: MIT
|
|
376
|
+
*/
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Generated bundle index. Do not edit.
|
|
380
|
+
*/
|
|
381
|
+
|
|
382
|
+
export { ElementNativeChartsNgModule, SiNChartGaugeComponent };
|
|
383
|
+
//# sourceMappingURL=siemens-native-charts-ng.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"siemens-native-charts-ng.mjs","sources":["../../../../projects/native-charts-ng/src/utils/svg-math.ts","../../../../projects/native-charts-ng/src/components/si-nchart-gauge/si-nchart-gauge.component.ts","../../../../projects/native-charts-ng/src/components/si-nchart-gauge/si-nchart-gauge.component.html","../../../../projects/native-charts-ng/src/components/index.ts","../../../../projects/native-charts-ng/src/public-api.module.ts","../../../../projects/native-charts-ng/src/public-api.ts","../../../../projects/native-charts-ng/src/siemens-native-charts-ng.ts"],"sourcesContent":["/**\n * Copyright Siemens 2016 - 2025.\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 * 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 (value * (maxAngle - minAngle)) / (max - min);\n}\n","/**\n * Copyright Siemens 2016 - 2025.\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';\n\nimport {\n Coordinate,\n makeArc,\n makeLine,\n polarToCartesian,\n valueToRelativeAngle\n} from '../../utils/svg-math';\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 * Series\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 * @defaultValue 0\n */\n readonly minNumberOfDecimals = input(0);\n /**\n * Max number of decimals.\n * @defaultValue 2\n */\n readonly maxNumberOfDecimals = input(2);\n /**\n * Number of decimals on the axis.\n * @defaultValue 0\n */\n readonly axisNumberOfDecimals = input(0);\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): 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 ) {\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.numberFormat.format(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.numberFormat.format(this.totalSum);\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 this.ticks.push({\n path: this.showTicks() ? this.makeTickPath(angle) : '',\n label: 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 Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nexport * from './si-nchart-gauge/si-nchart-gauge.component';\n","/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\nimport { NgModule } from '@angular/core';\n\nimport { SiNChartGaugeComponent } from './components/si-nchart-gauge/si-nchart-gauge.component';\n\n@NgModule({\n imports: [SiNChartGaugeComponent],\n exports: [SiNChartGaugeComponent]\n})\nexport class ElementNativeChartsNgModule {}\n","/**\n * Copyright Siemens 2016 - 2025.\n * SPDX-License-Identifier: MIT\n */\n\nexport * from './components/index';\n\nexport * from './public-api.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-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AAA,CAAA,gmCAAA,CAAA,EAAA;;;AE/EH;;;AAGG;;ACHH;;;AAGG;MASU,2BAA2B,CAAA;uGAA3B,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;wGAA3B,2BAA2B,EAAA,OAAA,EAAA,CAH5B,sBAAsB,CAAA,EAAA,OAAA,EAAA,CACtB,sBAAsB,CAAA,EAAA,CAAA;wGAErB,2BAA2B,EAAA,CAAA;;2FAA3B,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAJvC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,sBAAsB,CAAC;oBACjC,OAAO,EAAE,CAAC,sBAAsB;AACjC,iBAAA;;;ACXD;;;AAGG;;ACHH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@siemens/native-charts-ng",
|
|
3
|
+
"description": "Element Native charts library.",
|
|
4
|
+
"version": "47.5.0",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+ssh://git@github.com/siemens/element.git"
|
|
10
|
+
},
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "Siemens AG",
|
|
13
|
+
"email": "info@siemens.com"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/siemens/element",
|
|
16
|
+
"bugs": "https://github.com/siemens/element/issues/new",
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@angular/common": "19 - 20",
|
|
22
|
+
"@angular/core": "19 - 20"
|
|
23
|
+
},
|
|
24
|
+
"exports": {
|
|
25
|
+
"./docs.json": {
|
|
26
|
+
"default": "./docs.json"
|
|
27
|
+
},
|
|
28
|
+
"./package.json": {
|
|
29
|
+
"default": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./index.d.ts",
|
|
33
|
+
"default": "./fesm2022/siemens-native-charts-ng.mjs"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"module": "fesm2022/siemens-native-charts-ng.mjs",
|
|
37
|
+
"typings": "index.d.ts",
|
|
38
|
+
"sideEffects": false,
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"tslib": "^2.3.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
package/public-api.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./components/si-nchart-gauge/si-nchart-gauge.component";
|
|
3
|
+
export declare class ElementNativeChartsNgModule {
|
|
4
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ElementNativeChartsNgModule, never>;
|
|
5
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ElementNativeChartsNgModule, never, [typeof i1.SiNChartGaugeComponent], [typeof i1.SiNChartGaugeComponent]>;
|
|
6
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<ElementNativeChartsNgModule>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Siemens 2016 - 2025.
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Cartesian coordinate
|
|
7
|
+
*/
|
|
8
|
+
export interface Coordinate {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Converts a polar coordinate to a cartesian
|
|
14
|
+
* @param center - Center point of circle in cartesian coordinate
|
|
15
|
+
* @param radius - Radius of circle
|
|
16
|
+
* @param angleDeg - Angle in degrees
|
|
17
|
+
* @returns cartesian coordinate
|
|
18
|
+
*/
|
|
19
|
+
export declare function polarToCartesian(center: Coordinate, radius: number, angleDeg: number): Coordinate;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a SVG path representing an arc
|
|
22
|
+
* @param center - Center of circle in cartesian coordinate
|
|
23
|
+
* @param radius - Radius of circle
|
|
24
|
+
* @param startAngle - Start angel in degrees
|
|
25
|
+
* @param endAngle - End angel in degrees
|
|
26
|
+
* @returns SVG path string
|
|
27
|
+
*/
|
|
28
|
+
export declare function makeArc(center: Coordinate, radius: number, startAngle: number, endAngle: number): string;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a SVG path representing a line
|
|
31
|
+
* @param start - Start coordinate
|
|
32
|
+
* @param end - End coordinate
|
|
33
|
+
* @returns SVG path string
|
|
34
|
+
*/
|
|
35
|
+
export declare function makeLine(start: Coordinate, end: Coordinate): string;
|
|
36
|
+
/**
|
|
37
|
+
* Calculates the relative angle for a given value
|
|
38
|
+
* @param minAngle - min/start angle in degrees
|
|
39
|
+
* @param maxAngle - max/end angle in degrees
|
|
40
|
+
* @param min - Min value
|
|
41
|
+
* @param max - Max value
|
|
42
|
+
* @param value - Value
|
|
43
|
+
* @returns Relative (from minAngle) angle in degrees
|
|
44
|
+
*/
|
|
45
|
+
export declare function valueToRelativeAngle(minAngle: number, maxAngle: number, min: number, max: number, value: number): number;
|