@oicl/openbridge-webcomponents 2.0.0-next.94 → 2.0.0-next.96
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/bundle/openbridge-webcomponents.bundle.js +15137 -14794
- package/bundle/openbridge-webcomponents.bundle.js.map +1 -1
- package/custom-elements.json +110 -70
- package/dist/alert-severity.d.ts +1 -1
- package/dist/alert-severity.d.ts.map +1 -1
- package/dist/alert-severity.js +4 -1
- package/dist/alert-severity.js.map +1 -1
- package/dist/building-blocks/chart-line/chart-line-base.d.ts +95 -33
- package/dist/building-blocks/chart-line/chart-line-base.d.ts.map +1 -1
- package/dist/building-blocks/chart-line/chart-line-base.js +88 -23
- package/dist/building-blocks/chart-line/chart-line-base.js.map +1 -1
- package/dist/charthelpers/index.d.ts +1 -0
- package/dist/charthelpers/index.d.ts.map +1 -1
- package/dist/charthelpers/index.js +4 -0
- package/dist/charthelpers/index.js.map +1 -1
- package/dist/charthelpers/x-value.d.ts +72 -0
- package/dist/charthelpers/x-value.d.ts.map +1 -0
- package/dist/charthelpers/x-value.js +60 -0
- package/dist/charthelpers/x-value.js.map +1 -0
- package/dist/components/alert-button/alert-button.js +1 -1
- package/dist/components/alert-button/alert-button.js.map +1 -1
- package/dist/components/alert-icon/alert-icon.d.ts +30 -7
- package/dist/components/alert-icon/alert-icon.d.ts.map +1 -1
- package/dist/components/alert-icon/alert-icon.js +234 -67
- package/dist/components/alert-icon/alert-icon.js.map +1 -1
- package/dist/components/alert-icon/icons/icon-critical-acknowledged.d.ts +2 -0
- package/dist/components/alert-icon/icons/icon-critical-acknowledged.d.ts.map +1 -0
- package/dist/components/alert-icon/icons/icon-critical-acknowledged.js +17 -0
- package/dist/components/alert-icon/icons/icon-critical-acknowledged.js.map +1 -0
- package/dist/components/alert-icon/icons/icon-critical-rectified.d.ts +3 -0
- package/dist/components/alert-icon/icons/icon-critical-rectified.d.ts.map +1 -0
- package/dist/components/alert-icon/icons/icon-critical-rectified.js +28 -0
- package/dist/components/alert-icon/icons/icon-critical-rectified.js.map +1 -0
- package/dist/components/alert-icon/icons/icon-critical-silenced.d.ts +3 -0
- package/dist/components/alert-icon/icons/icon-critical-silenced.d.ts.map +1 -0
- package/dist/components/alert-icon/icons/{icon-warning-silenced.js → icon-critical-silenced.js} +26 -13
- package/dist/components/alert-icon/icons/icon-critical-silenced.js.map +1 -0
- package/dist/components/alert-icon/icons/icon-critical-unacknowledged.d.ts +3 -0
- package/dist/components/alert-icon/icons/icon-critical-unacknowledged.d.ts.map +1 -0
- package/dist/components/alert-icon/icons/icon-critical-unacknowledged.js +28 -0
- package/dist/components/alert-icon/icons/icon-critical-unacknowledged.js.map +1 -0
- package/dist/components/alert-icon/icons/icon-low-acknowledged.d.ts +2 -0
- package/dist/components/alert-icon/icons/icon-low-acknowledged.d.ts.map +1 -0
- package/dist/components/alert-icon/icons/icon-low-acknowledged.js +11 -0
- package/dist/components/alert-icon/icons/icon-low-acknowledged.js.map +1 -0
- package/dist/components/alert-icon/icons/icon-low-rectified.d.ts +3 -0
- package/dist/components/alert-icon/icons/icon-low-rectified.d.ts.map +1 -0
- package/dist/components/alert-icon/icons/icon-low-rectified.js +16 -0
- package/dist/components/alert-icon/icons/icon-low-rectified.js.map +1 -0
- package/dist/components/alert-icon/icons/icon-low-silenced.d.ts +3 -0
- package/dist/components/alert-icon/icons/icon-low-silenced.d.ts.map +1 -0
- package/dist/components/alert-icon/icons/icon-low-silenced.js +18 -0
- package/dist/components/alert-icon/icons/icon-low-silenced.js.map +1 -0
- package/dist/components/alert-icon/icons/icon-low-unacknowledged.d.ts +3 -0
- package/dist/components/alert-icon/icons/icon-low-unacknowledged.d.ts.map +1 -0
- package/dist/components/alert-icon/icons/icon-low-unacknowledged.js +16 -0
- package/dist/components/alert-icon/icons/icon-low-unacknowledged.js.map +1 -0
- package/dist/navigation-instruments/gauge-trend/gauge-trend.d.ts +16 -1
- package/dist/navigation-instruments/gauge-trend/gauge-trend.d.ts.map +1 -1
- package/dist/navigation-instruments/gauge-trend/gauge-trend.js +12 -0
- package/dist/navigation-instruments/gauge-trend/gauge-trend.js.map +1 -1
- package/dist/pages/alert-detail-page/alert-detail-page.d.ts.map +1 -1
- package/dist/pages/alert-detail-page/alert-detail-page.js +1 -2
- package/dist/pages/alert-detail-page/alert-detail-page.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/alert-icon/icons/icon-alarm-rectified.d.ts +0 -3
- package/dist/components/alert-icon/icons/icon-alarm-rectified.d.ts.map +0 -1
- package/dist/components/alert-icon/icons/icon-alarm-rectified.js +0 -15
- package/dist/components/alert-icon/icons/icon-alarm-rectified.js.map +0 -1
- package/dist/components/alert-icon/icons/icon-alarm-silenced.d.ts +0 -3
- package/dist/components/alert-icon/icons/icon-alarm-silenced.d.ts.map +0 -1
- package/dist/components/alert-icon/icons/icon-alarm-silenced.js +0 -17
- package/dist/components/alert-icon/icons/icon-alarm-silenced.js.map +0 -1
- package/dist/components/alert-icon/icons/icon-alarm-unack.d.ts +0 -3
- package/dist/components/alert-icon/icons/icon-alarm-unack.d.ts.map +0 -1
- package/dist/components/alert-icon/icons/icon-alarm-unack.js +0 -15
- package/dist/components/alert-icon/icons/icon-alarm-unack.js.map +0 -1
- package/dist/components/alert-icon/icons/icon-warning-rectified.d.ts +0 -3
- package/dist/components/alert-icon/icons/icon-warning-rectified.d.ts.map +0 -1
- package/dist/components/alert-icon/icons/icon-warning-rectified.js +0 -15
- package/dist/components/alert-icon/icons/icon-warning-rectified.js.map +0 -1
- package/dist/components/alert-icon/icons/icon-warning-silenced.d.ts +0 -3
- package/dist/components/alert-icon/icons/icon-warning-silenced.d.ts.map +0 -1
- package/dist/components/alert-icon/icons/icon-warning-silenced.js.map +0 -1
- package/dist/components/alert-icon/icons/icon-warning-unack.d.ts +0 -3
- package/dist/components/alert-icon/icons/icon-warning-unack.d.ts.map +0 -1
- package/dist/components/alert-icon/icons/icon-warning-unack.js +0 -15
- package/dist/components/alert-icon/icons/icon-warning-unack.js.map +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
2
2
|
import { ChartOptions, ChartDataset } from 'chart.js';
|
|
3
3
|
import { InstrumentState, FrameStyle, BorderRadiusPosition, Priority } from '../../navigation-instruments/types.js';
|
|
4
|
+
import { XValueMode } from '../../charthelpers/index.js';
|
|
5
|
+
import { ChartXValue } from '../../charthelpers/x-value.js';
|
|
4
6
|
/**
|
|
5
7
|
* Dimension information reported by external scale components.
|
|
6
8
|
* Dispatched via 'scale-dimensions-changed' event from slotted scale elements.
|
|
@@ -11,9 +13,11 @@ export interface ExternalScaleDimensions {
|
|
|
11
13
|
/** Natural thickness in pixels (width for vertical, height for horizontal) */
|
|
12
14
|
thickness: number;
|
|
13
15
|
}
|
|
16
|
+
export type { ChartXValue, TemporalLike } from '../../charthelpers/x-value.js';
|
|
14
17
|
export declare enum XAxisType {
|
|
15
18
|
category = "category",
|
|
16
|
-
time = "time"
|
|
19
|
+
time = "time",
|
|
20
|
+
number = "number"
|
|
17
21
|
}
|
|
18
22
|
export declare enum YAxisPosition {
|
|
19
23
|
left = "left",
|
|
@@ -28,8 +32,19 @@ export declare enum TimeDisplay {
|
|
|
28
32
|
minutes = "minutes",
|
|
29
33
|
date = "date"
|
|
30
34
|
}
|
|
35
|
+
export type ChartLinePoint = number | {
|
|
36
|
+
x: ChartXValue;
|
|
37
|
+
y: number;
|
|
38
|
+
};
|
|
31
39
|
export type ChartLineDataItem = {
|
|
32
|
-
label
|
|
40
|
+
/** Category label. Used when `xAxisType='category'` (the default). */
|
|
41
|
+
label?: string;
|
|
42
|
+
/**
|
|
43
|
+
* X-coordinate for `xAxisType='time'` (epoch ms, ISO string, Date, or
|
|
44
|
+
* Temporal object) or `xAxisType='number'` (plain number). When absent,
|
|
45
|
+
* `label` is parsed as a fallback.
|
|
46
|
+
*/
|
|
47
|
+
x?: ChartXValue;
|
|
33
48
|
value: number;
|
|
34
49
|
};
|
|
35
50
|
export type ChartLineYAxisConfig = {
|
|
@@ -44,7 +59,9 @@ export type ChartLineYAxisConfig = {
|
|
|
44
59
|
*
|
|
45
60
|
* ## Features
|
|
46
61
|
* - **Single or multi-series**: Use `data` for simple single-series or `datasets` for multi-series charts
|
|
47
|
-
* - **
|
|
62
|
+
* - **Category, time and number axes**: `category` (labels, evenly spaced), `time` (epoch ms,
|
|
63
|
+
* ISO strings, `Date` or Temporal objects — positioned proportionally, so uneven intervals
|
|
64
|
+
* render unevenly) and `number` (plain numeric x-values on a linear scale)
|
|
48
65
|
* - **Line styles**: Choose `smooth` (curved), `straight`, or `stepped` line rendering
|
|
49
66
|
* - **Fill modes**: Area fills with `semitransparent`, `solid`, or `threshold` (red/blue above/below midpoint)
|
|
50
67
|
* - **Stacked charts**: Enable `stacked` for multi-series datasets to stack values on y-axis
|
|
@@ -93,6 +110,36 @@ export type ChartLineYAxisConfig = {
|
|
|
93
110
|
* </script>
|
|
94
111
|
* ```
|
|
95
112
|
*
|
|
113
|
+
* Single-series with time axis (uneven intervals position proportionally;
|
|
114
|
+
* x accepts epoch ms, ISO strings, Date or Temporal objects):
|
|
115
|
+
* ```html
|
|
116
|
+
* <obc-line-graph></obc-line-graph>
|
|
117
|
+
* <script>
|
|
118
|
+
* const chart = document.querySelector('obc-line-graph');
|
|
119
|
+
* chart.xAxisType = 'time';
|
|
120
|
+
* chart.timeDisplay = 'minutes';
|
|
121
|
+
* chart.data = [
|
|
122
|
+
* {x: '2026-07-06T10:00:00Z', value: 10},
|
|
123
|
+
* {x: new Date('2026-07-06T10:03:00Z'), value: 14},
|
|
124
|
+
* {x: Temporal.Instant.from('2026-07-06T10:15:00Z'), value: 12}
|
|
125
|
+
* ];
|
|
126
|
+
* </script>
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* Single-series with numeric x-axis:
|
|
130
|
+
* ```html
|
|
131
|
+
* <obc-line-graph></obc-line-graph>
|
|
132
|
+
* <script>
|
|
133
|
+
* const chart = document.querySelector('obc-line-graph');
|
|
134
|
+
* chart.xAxisType = 'number';
|
|
135
|
+
* chart.data = [
|
|
136
|
+
* {x: 0, value: 2},
|
|
137
|
+
* {x: 2.5, value: 3},
|
|
138
|
+
* {x: 10, value: 6}
|
|
139
|
+
* ];
|
|
140
|
+
* </script>
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
96
143
|
* Stacked area chart with solid fill:
|
|
97
144
|
* ```html
|
|
98
145
|
* <obc-line-graph></obc-line-graph>
|
|
@@ -137,12 +184,12 @@ export type ChartLineYAxisConfig = {
|
|
|
137
184
|
* </script>
|
|
138
185
|
* ```
|
|
139
186
|
*
|
|
140
|
-
* @property {Array<{label
|
|
141
|
-
* @property {ChartDataset<'line', (number | {x: string|
|
|
187
|
+
* @property {Array<{label?: string, x?: number|string|Date|TemporalLike, value: number}>} data - Single-series data array. In `category` mode each item needs `label`; in `time`/`number` mode each item needs `x` (epoch ms, ISO string, Date, or Temporal object — `label` is parsed as a fallback). Used when `datasets` is not provided. Points are drawn in array order (no sorting); Temporal Plain* values are interpreted in the system time zone.
|
|
188
|
+
* @property {ChartDataset<'line', (number | {x: number|string|Date|TemporalLike; y: number})[]>[]} datasets - Multi-series Chart.js datasets. Takes precedence over `data`. Each dataset can have `label`, `data` (numeric array or `{x, y}` points), and visual properties like `borderColor`, `backgroundColor`, `fill`, etc. In `time`/`number` mode point x-values are normalized like single-series `x`.
|
|
142
189
|
* @property {(string|number)[]} labels - Explicit labels for category x-axis. If omitted, labels are derived from `data` property or dataset x-values.
|
|
143
190
|
* @property {string[]} colors - Custom color palette (CSS variable names or color strings). Falls back to theme default colors if not provided.
|
|
144
|
-
* @property {'category'|'time'} xAxisType - X-axis mode. `'category'` for labeled data points
|
|
145
|
-
* @property {'minutes'|'date'} timeDisplay - Time axis label format when `xAxisType='time'`. `'date'` shows
|
|
191
|
+
* @property {'category'|'time'|'number'} xAxisType - X-axis mode. `'category'` for labeled, evenly spaced data points; `'time'` for time-based data positioned proportionally (numbers are always epoch ms — `xStepSize`/`xTicksLimit` operate in ms); `'number'` for plain numeric x-values. Default: `'category'`.
|
|
192
|
+
* @property {'minutes'|'date'} timeDisplay - Time axis label format when `xAxisType='time'`. `'date'` shows a locale date, `'minutes'` shows minutes relative to the latest data point. Default: `'date'`.
|
|
146
193
|
* @property {'left'|'right'} yAxisPosition - Single y-axis position. Use this for simple charts with one y-axis. For multiple y-axes, use `yAxes` property instead. Default: `'left'`.
|
|
147
194
|
* @property {Array<{id?: string; position?: 'left'|'right'; min?: number; max?: number; grid?: boolean}>} yAxes - Multiple y-axis definitions for complex charts. Each axis can specify `id` (referenced by dataset `yAxisID`), `position`, `min`/`max` range, and `grid` visibility.
|
|
148
195
|
* @property {boolean} showGrid - Show vertical grid lines (x-axis). When combined with `showGridX` and `showGridY`, controls full grid visibility. Default: `false`.
|
|
@@ -167,13 +214,14 @@ export type ChartLineYAxisConfig = {
|
|
|
167
214
|
* @experimental
|
|
168
215
|
*/
|
|
169
216
|
export declare class ObcChartLineBase extends LitElement {
|
|
170
|
-
/**
|
|
217
|
+
/**
|
|
218
|
+
* Simple single-series data. `{label, value}` items for the category axis;
|
|
219
|
+
* `{x, value}` items for time/number axes (x: epoch ms, ISO string, Date,
|
|
220
|
+
* or Temporal object). Points are drawn in array order (no sorting).
|
|
221
|
+
*/
|
|
171
222
|
data: ChartLineDataItem[];
|
|
172
223
|
/** Chart.js-style datasets for multi-series use. If provided, takes precedence over `data`. */
|
|
173
|
-
datasets?: ChartDataset<'line',
|
|
174
|
-
x: string | number | Date;
|
|
175
|
-
y: number;
|
|
176
|
-
})[]>[];
|
|
224
|
+
datasets?: ChartDataset<'line', ChartLinePoint[]>[];
|
|
177
225
|
/** Optional explicit labels for the x-axis (category mode). If omitted labels are derived from `data` */
|
|
178
226
|
labels?: (string | number)[];
|
|
179
227
|
/** Custom color palette (CSS variable names or color strings). */
|
|
@@ -200,7 +248,11 @@ export declare class ObcChartLineBase extends LitElement {
|
|
|
200
248
|
* Default: 384 (matches Figma design baseline).
|
|
201
249
|
*/
|
|
202
250
|
scaleReferenceSize: number;
|
|
203
|
-
/**
|
|
251
|
+
/**
|
|
252
|
+
* X-axis mode: 'category' for labeled, evenly spaced data points; 'time'
|
|
253
|
+
* for time-based data positioned proportionally; 'number' for plain
|
|
254
|
+
* numeric x-values.
|
|
255
|
+
*/
|
|
204
256
|
xAxisType: XAxisType;
|
|
205
257
|
/** Single y-axis position ('left' or 'right'). For multiple y-axes, use yAxes instead. */
|
|
206
258
|
yAxisPosition: YAxisPosition;
|
|
@@ -238,6 +290,14 @@ export declare class ObcChartLineBase extends LitElement {
|
|
|
238
290
|
* because a `true`-default boolean cannot work as an HTML boolean attribute.
|
|
239
291
|
*/
|
|
240
292
|
hasLabelPadding: boolean;
|
|
293
|
+
/** @internal - True when the x-axis positions points by numeric value. */
|
|
294
|
+
protected get isNumericXAxis(): boolean;
|
|
295
|
+
/** @internal - Normalization mode for the current x-axis type. */
|
|
296
|
+
protected get xValueMode(): XValueMode;
|
|
297
|
+
/** @internal - Last data/datasets reference already warned about. */
|
|
298
|
+
private lastWarnedXSource?;
|
|
299
|
+
/** @internal - Warn once per data assignment about unparseable x-values. */
|
|
300
|
+
private warnOnInvalidX;
|
|
241
301
|
private readonly DEFAULT_TENSION;
|
|
242
302
|
private readonly POINT_RADIUS;
|
|
243
303
|
/** Show point markers on data points. Default: false. */
|
|
@@ -463,34 +523,36 @@ export declare class ObcChartLineBase extends LitElement {
|
|
|
463
523
|
* @param totalCount - Total number of datasets (used for stacked divider logic)
|
|
464
524
|
* @returns Fully configured Chart.js dataset
|
|
465
525
|
*/
|
|
466
|
-
protected buildDataset(data: number[] |
|
|
467
|
-
x:
|
|
526
|
+
protected buildDataset(data: number[] | {
|
|
527
|
+
x: number;
|
|
468
528
|
y: number;
|
|
469
|
-
}
|
|
470
|
-
x: string | number | Date;
|
|
471
|
-
y: number;
|
|
472
|
-
})[]>;
|
|
529
|
+
}[] | ChartDataset<'line', ChartLinePoint[]>, index: number, chartColors: string[], totalCount?: number): ChartDataset<'line', ChartLinePoint[]>;
|
|
473
530
|
/**
|
|
474
|
-
* Create threshold mode datasets: invisible baseline + main dataset with
|
|
531
|
+
* Create threshold mode datasets: invisible baseline + main dataset with
|
|
532
|
+
* above/below fills. Accepts plain values (category mode) or {x, y} points
|
|
533
|
+
* (time/number mode); the baseline mirrors the input x-positions.
|
|
475
534
|
*/
|
|
476
|
-
protected createThresholdDatasets(values: number[]
|
|
535
|
+
protected createThresholdDatasets(values: number[] | {
|
|
536
|
+
x: number;
|
|
537
|
+
y: number;
|
|
538
|
+
}[], chartColors: string[]): ChartDataset<'line', ChartLinePoint[]>[];
|
|
477
539
|
/**
|
|
478
|
-
* Prepare normalized datasets for multi-series charts
|
|
540
|
+
* Prepare normalized datasets for multi-series charts.
|
|
541
|
+
* In time/number mode every point's x is normalized (epoch ms / number)
|
|
542
|
+
* so strings, Dates and Temporal objects position correctly.
|
|
479
543
|
*/
|
|
480
|
-
protected prepareMultiSeriesDatasets(): ChartDataset<"line",
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
})[]>[];
|
|
544
|
+
protected prepareMultiSeriesDatasets(): ChartDataset<"line", ChartLinePoint[]>[];
|
|
545
|
+
/** @internal - Return a copy of the dataset with normalized point x-values. */
|
|
546
|
+
private normalizeDatasetX;
|
|
484
547
|
/**
|
|
485
|
-
* Prepare datasets for single-series charts
|
|
486
|
-
*
|
|
548
|
+
* Prepare datasets for single-series charts.
|
|
549
|
+
* Category mode: labels + numeric values (unchanged legacy path).
|
|
550
|
+
* Time/number mode: normalized {x, y} points on a linear scale.
|
|
551
|
+
* Handles both regular and threshold fill modes.
|
|
487
552
|
*/
|
|
488
553
|
protected prepareSingleSeriesDatasets(): {
|
|
489
|
-
datasets: ChartDataset<"line",
|
|
490
|
-
|
|
491
|
-
y: number;
|
|
492
|
-
})[]>[];
|
|
493
|
-
labels: string[];
|
|
554
|
+
datasets: ChartDataset<"line", ChartLinePoint[]>[];
|
|
555
|
+
labels: (string | number)[];
|
|
494
556
|
};
|
|
495
557
|
/**
|
|
496
558
|
* Get Chart.js options with dynamic sizing and padding
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-line-base.d.ts","sourceRoot":"","sources":["../../../src/building-blocks/chart-line/chart-line-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,cAAc,EAAkB,MAAM,KAAK,CAAC;AAkBhE,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAqB,MAAM,UAAU,CAAC;AAC7E,OAAO,EACL,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACT,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"chart-line-base.d.ts","sourceRoot":"","sources":["../../../src/building-blocks/chart-line/chart-line-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,cAAc,EAAkB,MAAM,KAAK,CAAC;AAkBhE,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAqB,MAAM,UAAU,CAAC;AAC7E,OAAO,EACL,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACT,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAiBL,UAAU,EACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAqB/D;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,6CAA6C;IAC7C,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IAC1C,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;CACnB;AA0BD,YAAY,EAAC,WAAW,EAAE,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAE7E,oBAAY,SAAS;IACnB,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,KAAK,UAAU;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1C,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EAAE,EACrB,UAAU,SAAI,GACb,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;IAuEzC;;;;OAIG;IACH,SAAS,CAAC,uBAAuB,CAC/B,MAAM,EAAE,MAAM,EAAE,GAAG;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,EAAE,EAC3C,WAAW,EAAE,MAAM,EAAE,GACpB,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,EAAE;IAwC3C;;;;OAIG;IACH,SAAS,CAAC,0BAA0B;IAiCpC,+EAA+E;IAC/E,OAAO,CAAC,iBAAiB;IAYzB;;;;;OAKG;IACH,SAAS,CAAC,2BAA2B;;gBA0BD,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE;;IAcvD;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,YAAY,CAAC,MAAM,CAAC;IAwIjD;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAyC5B;;;;;;;;OAQG;IACH,SAAS,CAAC,iBAAiB,CACzB,IAAI,CAAC,EAAE,MAAM,EACb,UAAU,UAAQ,EAClB,aAAa,UAAO,GA2HG,YAAY,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC;IAGvD;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAUjC,OAAO,CAAC,WAAW;IA2BnB,OAAO,CAAC,WAAW;IAmBnB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAczB;;OAEG;IACH,OAAO,CAAC,YAAY;IAqDX,MAAM;IAgCf,OAAgB,MAAM,4BAKpB;CACH"}
|
|
@@ -12,6 +12,7 @@ import { observeThemeChanges } from "../../charthelpers/theme.js";
|
|
|
12
12
|
import { formatNumericValue } from "../../charthelpers/canvas-layout.js";
|
|
13
13
|
import { getChartTooltipOptions } from "../../charthelpers/tooltip.js";
|
|
14
14
|
import { generateLegendHTML } from "../../charthelpers/legend.js";
|
|
15
|
+
import { XValueMode, normalizeXValue, formatXValue } from "../../charthelpers/x-value.js";
|
|
15
16
|
import { readExternalScaleBorderRadiusPx, ScaleType, startExternalScaleBorderRadiusObserver, EXTERNAL_SCALE_BORDER_RADIUS_CSS_VAR } from "../external-scale/external-scale.js";
|
|
16
17
|
var __defProp = Object.defineProperty;
|
|
17
18
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -36,6 +37,7 @@ Chart.register(
|
|
|
36
37
|
var XAxisType = /* @__PURE__ */ ((XAxisType2) => {
|
|
37
38
|
XAxisType2["category"] = "category";
|
|
38
39
|
XAxisType2["time"] = "time";
|
|
40
|
+
XAxisType2["number"] = "number";
|
|
39
41
|
return XAxisType2;
|
|
40
42
|
})(XAxisType || {});
|
|
41
43
|
var YAxisPosition = /* @__PURE__ */ ((YAxisPosition2) => {
|
|
@@ -178,6 +180,23 @@ const _ObcChartLineBase = class _ObcChartLineBase extends LitElement {
|
|
|
178
180
|
}, 16);
|
|
179
181
|
};
|
|
180
182
|
}
|
|
183
|
+
/** @internal - True when the x-axis positions points by numeric value. */
|
|
184
|
+
get isNumericXAxis() {
|
|
185
|
+
return this.xAxisType === "time" || this.xAxisType === "number";
|
|
186
|
+
}
|
|
187
|
+
/** @internal - Normalization mode for the current x-axis type. */
|
|
188
|
+
get xValueMode() {
|
|
189
|
+
return this.xAxisType === "number" ? XValueMode.number : XValueMode.time;
|
|
190
|
+
}
|
|
191
|
+
/** @internal - Warn once per data assignment about unparseable x-values. */
|
|
192
|
+
warnOnInvalidX(xValues, sourceRef) {
|
|
193
|
+
const invalid = xValues.filter((x) => !Number.isFinite(x)).length;
|
|
194
|
+
if (invalid === 0 || this.lastWarnedXSource === sourceRef) return;
|
|
195
|
+
this.lastWarnedXSource = sourceRef;
|
|
196
|
+
console.warn(
|
|
197
|
+
`[obc-chart] ${invalid} x value(s) could not be parsed for xAxisType='${this.xAxisType}'; the points render as gaps.`
|
|
198
|
+
);
|
|
199
|
+
}
|
|
181
200
|
/**
|
|
182
201
|
* Should fill be applied to this chart?
|
|
183
202
|
* Line graph returns false, area graph returns true.
|
|
@@ -1014,8 +1033,8 @@ const _ObcChartLineBase = class _ObcChartLineBase extends LitElement {
|
|
|
1014
1033
|
*/
|
|
1015
1034
|
buildDataset(data, index, chartColors, totalCount = 1) {
|
|
1016
1035
|
const currentColor = chartColors[index % chartColors.length];
|
|
1017
|
-
const existingDataset =
|
|
1018
|
-
const values =
|
|
1036
|
+
const existingDataset = Array.isArray(data) ? null : data;
|
|
1037
|
+
const values = Array.isArray(data) ? data : null;
|
|
1019
1038
|
const borderColor = existingDataset?.borderColor ?? currentColor;
|
|
1020
1039
|
const fillFlag = existingDataset?.fill ?? this.shouldApplyFill();
|
|
1021
1040
|
const tension = this.lineMode === "smooth" ? this.DEFAULT_TENSION : 0;
|
|
@@ -1063,14 +1082,18 @@ const _ObcChartLineBase = class _ObcChartLineBase extends LitElement {
|
|
|
1063
1082
|
return result;
|
|
1064
1083
|
}
|
|
1065
1084
|
/**
|
|
1066
|
-
* Create threshold mode datasets: invisible baseline + main dataset with
|
|
1085
|
+
* Create threshold mode datasets: invisible baseline + main dataset with
|
|
1086
|
+
* above/below fills. Accepts plain values (category mode) or {x, y} points
|
|
1087
|
+
* (time/number mode); the baseline mirrors the input x-positions.
|
|
1067
1088
|
*/
|
|
1068
1089
|
createThresholdDatasets(values, chartColors) {
|
|
1069
|
-
const
|
|
1070
|
-
const minV =
|
|
1071
|
-
const maxV =
|
|
1090
|
+
const yValues = values.map((v) => typeof v === "number" ? v : v.y).filter((n) => Number.isFinite(n));
|
|
1091
|
+
const minV = yValues.length ? Math.min(...yValues) : 0;
|
|
1092
|
+
const maxV = yValues.length ? Math.max(...yValues) : 100;
|
|
1072
1093
|
const threshold = (minV + maxV) / 2;
|
|
1073
|
-
const baselineData =
|
|
1094
|
+
const baselineData = values.map(
|
|
1095
|
+
(v) => typeof v === "number" ? threshold : { x: v.x, y: threshold }
|
|
1096
|
+
);
|
|
1074
1097
|
const lowRaw = LINE_GRAPH_GRID_CONFIG.thresholdLowColorVar;
|
|
1075
1098
|
const highRaw = LINE_GRAPH_GRID_CONFIG.thresholdHighColorVar;
|
|
1076
1099
|
const highFill = applyAlphaToColor(this, highRaw, 0.35);
|
|
@@ -1096,7 +1119,9 @@ const _ObcChartLineBase = class _ObcChartLineBase extends LitElement {
|
|
|
1096
1119
|
return [baselineDataset, main];
|
|
1097
1120
|
}
|
|
1098
1121
|
/**
|
|
1099
|
-
* Prepare normalized datasets for multi-series charts
|
|
1122
|
+
* Prepare normalized datasets for multi-series charts.
|
|
1123
|
+
* In time/number mode every point's x is normalized (epoch ms / number)
|
|
1124
|
+
* so strings, Dates and Temporal objects position correctly.
|
|
1100
1125
|
*/
|
|
1101
1126
|
prepareMultiSeriesDatasets() {
|
|
1102
1127
|
const defaultPalette = this.priority === Priority.enhanced ? CHART_SECTOR_ENHANCED_COLORS : CHART_SECTOR_DEFAULT_COLORS;
|
|
@@ -1105,18 +1130,37 @@ const _ObcChartLineBase = class _ObcChartLineBase extends LitElement {
|
|
|
1105
1130
|
this.colors,
|
|
1106
1131
|
defaultPalette
|
|
1107
1132
|
);
|
|
1133
|
+
const normalized = this.datasets.map((ds) => this.normalizeDatasetX(ds));
|
|
1134
|
+
if (this.isNumericXAxis) {
|
|
1135
|
+
this.warnOnInvalidX(
|
|
1136
|
+
normalized.flatMap(
|
|
1137
|
+
(ds) => (ds.data ?? []).map(
|
|
1138
|
+
(pt) => pt && typeof pt === "object" ? pt.x : 0
|
|
1139
|
+
)
|
|
1140
|
+
),
|
|
1141
|
+
this.datasets
|
|
1142
|
+
);
|
|
1143
|
+
}
|
|
1108
1144
|
const totalCount = this.datasets.length;
|
|
1109
|
-
return
|
|
1145
|
+
return normalized.map(
|
|
1110
1146
|
(ds, i) => this.buildDataset(ds, i, chartColors, totalCount)
|
|
1111
1147
|
);
|
|
1112
1148
|
}
|
|
1149
|
+
/** @internal - Return a copy of the dataset with normalized point x-values. */
|
|
1150
|
+
normalizeDatasetX(ds) {
|
|
1151
|
+
if (!this.isNumericXAxis || !ds.data) return ds;
|
|
1152
|
+
const data = ds.data.map(
|
|
1153
|
+
(pt) => pt && typeof pt === "object" && "x" in pt ? { ...pt, x: normalizeXValue(pt.x, this.xValueMode) } : pt
|
|
1154
|
+
);
|
|
1155
|
+
return { ...ds, data };
|
|
1156
|
+
}
|
|
1113
1157
|
/**
|
|
1114
|
-
* Prepare datasets for single-series charts
|
|
1115
|
-
*
|
|
1158
|
+
* Prepare datasets for single-series charts.
|
|
1159
|
+
* Category mode: labels + numeric values (unchanged legacy path).
|
|
1160
|
+
* Time/number mode: normalized {x, y} points on a linear scale.
|
|
1161
|
+
* Handles both regular and threshold fill modes.
|
|
1116
1162
|
*/
|
|
1117
1163
|
prepareSingleSeriesDatasets() {
|
|
1118
|
-
const values = this.data.map((d) => d.value);
|
|
1119
|
-
const labels = this.data.map((d) => d.label);
|
|
1120
1164
|
const defaultPalette = this.priority === Priority.enhanced ? CHART_SECTOR_ENHANCED_COLORS : CHART_SECTOR_DEFAULT_COLORS;
|
|
1121
1165
|
const chartColors = getChartColorsOrDefault(
|
|
1122
1166
|
this,
|
|
@@ -1125,6 +1169,20 @@ const _ObcChartLineBase = class _ObcChartLineBase extends LitElement {
|
|
|
1125
1169
|
);
|
|
1126
1170
|
const fill = this.shouldApplyFill();
|
|
1127
1171
|
const fillMode = this.getFillMode();
|
|
1172
|
+
if (this.isNumericXAxis) {
|
|
1173
|
+
const points = this.data.map((d) => ({
|
|
1174
|
+
x: normalizeXValue(d.x ?? d.label ?? NaN, this.xValueMode),
|
|
1175
|
+
y: d.value
|
|
1176
|
+
}));
|
|
1177
|
+
this.warnOnInvalidX(
|
|
1178
|
+
points.map((p) => p.x),
|
|
1179
|
+
this.data
|
|
1180
|
+
);
|
|
1181
|
+
const datasets2 = fill && fillMode === "threshold" ? this.createThresholdDatasets(points, chartColors) : [this.buildDataset(points, 0, chartColors)];
|
|
1182
|
+
return { datasets: datasets2, labels: [] };
|
|
1183
|
+
}
|
|
1184
|
+
const values = this.data.map((d) => d.value);
|
|
1185
|
+
const labels = this.data.map((d) => d.label ?? String(d.x ?? ""));
|
|
1128
1186
|
const datasets = fill && fillMode === "threshold" ? this.createThresholdDatasets(values, chartColors) : [this.buildDataset(values, 0, chartColors)];
|
|
1129
1187
|
return { datasets, labels };
|
|
1130
1188
|
}
|
|
@@ -1189,10 +1247,15 @@ const _ObcChartLineBase = class _ObcChartLineBase extends LitElement {
|
|
|
1189
1247
|
callbacks: {
|
|
1190
1248
|
title: () => "",
|
|
1191
1249
|
label: (context) => {
|
|
1192
|
-
const label = context.label ?? "";
|
|
1193
1250
|
const value = typeof context.parsed === "object" && context.parsed !== null ? context.parsed.y : context.parsed;
|
|
1194
1251
|
const numericValue = formatNumericValue(value, 1, false, 0);
|
|
1195
1252
|
const unit = this.unit ? `${this.unit}` : "";
|
|
1253
|
+
let label = context.label ?? "";
|
|
1254
|
+
if (this.isNumericXAxis) {
|
|
1255
|
+
const x = typeof context.parsed === "object" && context.parsed !== null ? context.parsed.x : NaN;
|
|
1256
|
+
const relativeTo = this.timeDisplay === "minutes" ? refTs : void 0;
|
|
1257
|
+
label = formatXValue(x, this.xValueMode, relativeTo);
|
|
1258
|
+
}
|
|
1196
1259
|
return `${label} ${numericValue}${unit}`;
|
|
1197
1260
|
}
|
|
1198
1261
|
}
|
|
@@ -1207,18 +1270,23 @@ const _ObcChartLineBase = class _ObcChartLineBase extends LitElement {
|
|
|
1207
1270
|
* Returns earliest timestamp for 'date' mode, latest for 'minutes' mode.
|
|
1208
1271
|
*/
|
|
1209
1272
|
computeTimeReference() {
|
|
1273
|
+
if (this.xAxisType !== "time") return void 0;
|
|
1210
1274
|
const timestamps = [];
|
|
1211
1275
|
if (this.datasets?.length) {
|
|
1212
1276
|
this.datasets.forEach((ds) => {
|
|
1213
1277
|
if (!ds.data) return;
|
|
1214
1278
|
ds.data.forEach((pt) => {
|
|
1215
1279
|
if (pt && typeof pt === "object" && "x" in pt) {
|
|
1216
|
-
const
|
|
1217
|
-
const ts = typeof xVal === "string" ? new Date(String(xVal)).getTime() : Number(xVal);
|
|
1280
|
+
const ts = normalizeXValue(pt.x, XValueMode.time);
|
|
1218
1281
|
if (Number.isFinite(ts)) timestamps.push(ts);
|
|
1219
1282
|
}
|
|
1220
1283
|
});
|
|
1221
1284
|
});
|
|
1285
|
+
} else if (this.data?.length) {
|
|
1286
|
+
this.data.forEach((d) => {
|
|
1287
|
+
const ts = normalizeXValue(d.x ?? d.label ?? NaN, XValueMode.time);
|
|
1288
|
+
if (Number.isFinite(ts)) timestamps.push(ts);
|
|
1289
|
+
});
|
|
1222
1290
|
}
|
|
1223
1291
|
if (!timestamps.length && this.labels?.length) {
|
|
1224
1292
|
this.labels.forEach((l) => {
|
|
@@ -1268,7 +1336,7 @@ const _ObcChartLineBase = class _ObcChartLineBase extends LitElement {
|
|
|
1268
1336
|
const showTicks = showTickMarks && !isTooSmall && this.hasLabelPadding;
|
|
1269
1337
|
const fontConfig = { family: fontFamily, size: fontSize, weight: fontWeight };
|
|
1270
1338
|
const x = {
|
|
1271
|
-
type: this.xAxisType === "
|
|
1339
|
+
type: this.xAxisType === "category" ? "category" : "linear",
|
|
1272
1340
|
offset: false,
|
|
1273
1341
|
// Always edge-to-edge (no padding on x-axis)
|
|
1274
1342
|
grace: 0,
|
|
@@ -1292,14 +1360,11 @@ const _ObcChartLineBase = class _ObcChartLineBase extends LitElement {
|
|
|
1292
1360
|
maxTicksLimit: this.xTicksLimit,
|
|
1293
1361
|
stepSize: this.xStepSize,
|
|
1294
1362
|
callback: (value) => {
|
|
1295
|
-
if (this.
|
|
1363
|
+
if (!this.isNumericXAxis) return String(value);
|
|
1296
1364
|
const n = Number(value);
|
|
1297
1365
|
if (!Number.isFinite(n)) return String(value);
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
return `${minutes}min`;
|
|
1301
|
-
}
|
|
1302
|
-
return new Date(n).toLocaleDateString();
|
|
1366
|
+
const relativeTo = this.timeDisplay === "minutes" ? minX : void 0;
|
|
1367
|
+
return formatXValue(n, this.xValueMode, relativeTo);
|
|
1303
1368
|
}
|
|
1304
1369
|
},
|
|
1305
1370
|
border: {
|