tsichart-core 2.1.4 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -126,6 +126,29 @@ declare class ChartOptions {
126
126
  }>;
127
127
  stringsInstance: Strings;
128
128
  private getInterpolationFunction;
129
+ /**
130
+ * Apply adaptive heuristics to adjust chart options based on data characteristics.
131
+ * This method is called by chart components after data is available to optimize UX.
132
+ *
133
+ * @param dataContext - Information about the data being visualized
134
+ * @param dataContext.seriesCount - Number of series/aggregates in the data
135
+ * @param dataContext.totalDataPoints - Total number of data points across all series
136
+ * @param dataContext.hasEnvelope - Whether data contains min/max envelope information
137
+ * @param dataContext.hasUniformInterval - Whether timestamps are uniformly spaced
138
+ * @param dataContext.chartType - Type of chart ('line', 'bar', 'scatter', etc.)
139
+ */
140
+ applyAdaptiveHeuristics(dataContext?: {
141
+ seriesCount?: number;
142
+ totalDataPoints?: number;
143
+ hasEnvelope?: boolean;
144
+ hasUniformInterval?: boolean;
145
+ chartType?: string;
146
+ }): void;
147
+ /**
148
+ * Derive 24-hour time format preference from locale.
149
+ * Used internally when is24HourTime is not explicitly set.
150
+ */
151
+ private deriveTimeFormatFromLocale;
129
152
  setOptions(chartOptionsObj: any): void;
130
153
  private mergeStrings;
131
154
  private mergeValue;
@@ -174,7 +197,7 @@ declare class ChartOptions {
174
197
  brushHandlesVisible: boolean;
175
198
  hideChartControlPanel: boolean;
176
199
  offset: any;
177
- is24HourTime: () => boolean;
200
+ is24HourTime: boolean;
178
201
  includeTimezones: boolean;
179
202
  availabilityLeftMargin: number;
180
203
  onInstanceClick: (instance: any) => any;
@@ -588,6 +611,11 @@ declare class LineChart extends TemporalXAxisComponent {
588
611
  private overwriteSwimLanes;
589
612
  private getHorizontalMarkersWithYScales;
590
613
  private getAdditionalOffsetFromHorizontalMargin;
614
+ /**
615
+ * Calculate data context for adaptive heuristics.
616
+ * Analyzes current data to determine series count, data point density, and other characteristics.
617
+ */
618
+ private calculateDataContext;
591
619
  private drawHorizontalMarkers;
592
620
  private createSwimlaneLabels;
593
621
  render(data: any, options: ILineChartOptions, aggregateExpressionOptions: any): void;
@@ -620,8 +648,6 @@ declare class AvailabilityChart extends ChartComponent {
620
648
  private rawAvailability;
621
649
  private maxBuckets;
622
650
  private bucketSize;
623
- private dateTimePickerContainer;
624
- private dateTimePicker;
625
651
  constructor(renderTarget: Element);
626
652
  private getMinZoomedRange;
627
653
  private zoom;
@@ -796,17 +822,14 @@ declare class GroupedBarChart extends ChartVisualizationComponent {
796
822
  }
797
823
 
798
824
  declare class Grid extends Component {
825
+ private static readonly KEYS;
799
826
  private gridComponent;
800
- private rowLabelKey;
801
- private colorKey;
802
- private aggIndexKey;
803
827
  private chartComponentData;
804
- private draw;
805
828
  private closeButton;
806
829
  private filteredTimestamps;
830
+ private timestampCache;
807
831
  private table;
808
832
  private tableHeaderRow;
809
- private tableContentRows;
810
833
  usesSeconds: boolean;
811
834
  usesMillis: boolean;
812
835
  constructor(renderTarget: Element);
@@ -818,15 +841,17 @@ declare class Grid extends Component {
818
841
  action: () => void;
819
842
  description: string;
820
843
  };
821
- Grid(): void;
822
844
  private cellClass;
823
- focus: (rowIdx: any, colIdx: any) => void;
824
- renderFromAggregates(data: any, options: any, aggregateExpressionOptions: any, chartComponentData: any): void;
845
+ focus: (rowIdx: number, colIdx: number) => void;
846
+ renderFromAggregates(data: any, options: any, aggregateExpressionOptions: any, chartComponentData: ChartComponentData): void;
825
847
  private getRowData;
826
848
  private convertSeriesToGridData;
827
849
  private getFormattedDate;
850
+ private getRowColor;
828
851
  private setFilteredTimestamps;
829
852
  private addHeaderCells;
853
+ private renderRowHeader;
854
+ private renderValueCells;
830
855
  private addValueCells;
831
856
  render(data: any, options: any, aggregateExpressionOptions: any, chartComponentData?: ChartComponentData): void;
832
857
  private arrowNavigate;
@@ -1001,6 +1026,8 @@ declare class ModelSearch extends Component {
1001
1026
  private getInstanceHtml;
1002
1027
  }
1003
1028
 
1029
+ type OnSetCallback$4 = (fromMillis: number, toMillis: number, offset: string, isRelative: boolean, quickTime: number) => void;
1030
+ type OnCancelCallback$1 = () => void;
1004
1031
  declare class DateTimePicker extends ChartComponent {
1005
1032
  private calendar;
1006
1033
  private calendarPicker;
@@ -1024,16 +1051,38 @@ declare class DateTimePicker extends ChartComponent {
1024
1051
  private endRange;
1025
1052
  private anchorDate;
1026
1053
  private offsetName;
1054
+ private dateFormatter;
1027
1055
  private fromInput;
1028
1056
  private toInput;
1029
1057
  private quickTimeArray;
1030
1058
  constructor(renderTarget: Element);
1059
+ /**
1060
+ * Get the currently selected quick time value
1061
+ * @returns The quick time in milliseconds, or -1 if not a quick time selection
1062
+ * @private
1063
+ */
1031
1064
  private getCurrentQuickTime;
1032
- getQuickTimeText(quickTimeMillis: any): any;
1065
+ /**
1066
+ * Get the display text for a quick time selection
1067
+ * @param quickTimeMillis - The quick time value in milliseconds
1068
+ * @returns The display text, or null if not found
1069
+ */
1070
+ getQuickTimeText(quickTimeMillis: number): string | null;
1033
1071
  private convertToCalendarDate;
1034
1072
  private setNewOffset;
1035
1073
  private onSaveOrCancel;
1036
- render(chartOptions: any, minMillis: number, maxMillis: number, fromMillis?: number, toMillis?: number, onSet?: any, onCancel?: any): void;
1074
+ /**
1075
+ * Render the date/time picker with range selection
1076
+ *
1077
+ * @param chartOptions - Configuration options
1078
+ * @param minMillis - Minimum selectable time
1079
+ * @param maxMillis - Maximum selectable time
1080
+ * @param fromMillis - Start time of range (defaults to 24 hours before maxMillis)
1081
+ * @param toMillis - End time of range (defaults to maxMillis)
1082
+ * @param onSet - Callback when user saves selection
1083
+ * @param onCancel - Callback when user cancels
1084
+ */
1085
+ render(chartOptions: any, minMillis: number, maxMillis: number, fromMillis?: number, toMillis?: number, onSet?: OnSetCallback$4, onCancel?: OnCancelCallback$1): void;
1037
1086
  private updateDisplayedDateTimes;
1038
1087
  private setFromQuickTimes;
1039
1088
  private buildQuickTimesPanel;
@@ -1043,6 +1092,11 @@ declare class DateTimePicker extends ChartComponent {
1043
1092
  private createTimezonePicker;
1044
1093
  private roundDay;
1045
1094
  private setTimeRange;
1095
+ /**
1096
+ * Create and configure the Pikaday calendar component
1097
+ * Uses the DateFormatter utility to generate locale-specific month and weekday names
1098
+ * @private
1099
+ */
1046
1100
  private createCalendar;
1047
1101
  private setSelectedQuickTimes;
1048
1102
  private setFromDate;
@@ -2358,28 +2412,88 @@ declare class HierarchyNavigation extends Component {
2358
2412
  return Pikaday;
2359
2413
  }));
2360
2414
 
2361
- declare class SingleDateTimePicker extends ChartComponent {
2415
+ type OnSetCallback$3 = (fromMillis: number, toMillis?: number, offset?: string, isRelative?: boolean, quickTime?: number) => void;
2416
+ declare class DateTimeButton extends ChartComponent {
2417
+ protected dateTimePicker: DateTimePicker;
2418
+ protected minMillis: number;
2419
+ protected maxMillis: number;
2420
+ protected onSet: OnSetCallback$3;
2421
+ protected dateTimeButton: d3.Selection<HTMLButtonElement, unknown, null, undefined>;
2422
+ protected dateTimePickerContainer: d3.Selection<HTMLDivElement, unknown, null, undefined>;
2423
+ constructor(renderTarget: Element);
2424
+ protected buttonDateTimeFormat(millis: number): string;
2425
+ protected initializeDateTimeButton(chartOptions: any, minMillis: number, maxMillis: number, onSet?: OnSetCallback$3): void;
2426
+ private getTimezoneFromOffset;
2427
+ }
2428
+
2429
+ type OnSetCallback$2 = (millis: number) => void;
2430
+ declare class SingleDateTimePicker extends DateTimeButton {
2362
2431
  private calendar;
2363
2432
  private calendarPicker;
2364
2433
  private timeControls;
2365
- private minMillis;
2366
- private maxMillis;
2434
+ protected minMillis: number;
2435
+ protected maxMillis: number;
2367
2436
  private millis;
2368
2437
  private minutes;
2369
2438
  private hours;
2370
- private onSet;
2439
+ protected onSet: OnSetCallback$2 | null;
2371
2440
  private targetElement;
2372
2441
  private isValid;
2373
2442
  private offsetName;
2374
2443
  private date;
2375
2444
  private timeInput;
2376
2445
  private saveButton;
2446
+ private dateFormatter;
2377
2447
  constructor(renderTarget: Element);
2448
+ /**
2449
+ * Get the currently selected time in milliseconds
2450
+ * @returns The selected time in milliseconds since epoch
2451
+ */
2378
2452
  getMillis(): number;
2379
- render(chartOptions: any, minMillis: number, maxMillis: number, millis?: number, onSet?: any): void;
2453
+ /**
2454
+ * Render the single date/time picker component
2455
+ *
2456
+ * @param chartOptions - Configuration options for the component
2457
+ * @param minMillis - Minimum selectable time in milliseconds
2458
+ * @param maxMillis - Maximum selectable time in milliseconds
2459
+ * @param millis - Initially selected time (defaults to maxMillis if null)
2460
+ * @param onSet - Callback function invoked when user saves a selection
2461
+ */
2462
+ render(chartOptions: any, minMillis: number, maxMillis: number, millis?: number, onSet?: OnSetCallback$2): void;
2463
+ /**
2464
+ * Set up keyboard event handlers for the component
2465
+ * Handles arrow keys and escape key navigation
2466
+ * @private
2467
+ */
2468
+ private _setupEventHandlers;
2469
+ /**
2470
+ * Create the DOM structure for the date/time picker
2471
+ * Includes time controls, calendar container, save button, and error message container
2472
+ * @private
2473
+ */
2474
+ private _createDOM;
2475
+ /**
2476
+ * Round a date to midnight (zero out hours, minutes, seconds, milliseconds)
2477
+ * Takes timezone offset into account
2478
+ *
2479
+ * @param d - The date to round
2480
+ * @returns A new date at midnight in the specified timezone
2481
+ * @private
2482
+ */
2380
2483
  private roundDay;
2484
+ /**
2485
+ * Update the calendar and time input to reflect a newly selected date
2486
+ *
2487
+ * @param d - The selected date
2488
+ * @private
2489
+ */
2381
2490
  private setSelectedDate;
2382
- private createCalendar;
2491
+ /**
2492
+ * Create and configure the Pikaday calendar component
2493
+ * Uses the DateFormatter utility to generate locale-specific month and weekday names
2494
+ * @private
2495
+ */
2496
+ private _createCalendar;
2383
2497
  private setDate;
2384
2498
  private setIsValid;
2385
2499
  private setMillis;
@@ -2393,22 +2507,10 @@ declare class SingleDateTimePicker extends ChartComponent {
2393
2507
  private createTimeString;
2394
2508
  private convertToLocal;
2395
2509
  private createTimePicker;
2510
+ private _createTimePicker;
2396
2511
  }
2397
2512
 
2398
- declare class DateTimeButton extends ChartComponent {
2399
- protected dateTimePicker: any;
2400
- private pickerIsVisible;
2401
- protected minMillis: number;
2402
- protected maxMillis: number;
2403
- protected onSet: any;
2404
- protected dateTimeButton: any;
2405
- protected dateTimePickerContainer: any;
2406
- constructor(renderTarget: Element);
2407
- protected buttonDateTimeFormat(millis: any): string;
2408
- render(chartOptions: any, minMillis: any, maxMillis: any, onSet?: any): void;
2409
- private getTimezoneFromOffset;
2410
- }
2411
-
2513
+ type OnSetCallback$1 = (millis: number) => void;
2412
2514
  declare class DateTimeButtonSingle extends DateTimeButton {
2413
2515
  private selectedMillis;
2414
2516
  private clickOutsideHandler;
@@ -2417,20 +2519,63 @@ declare class DateTimeButtonSingle extends DateTimeButton {
2417
2519
  private removeClickOutsideHandler;
2418
2520
  private setupClickOutsideHandler;
2419
2521
  private sDTPOnSet;
2420
- render(chartOptions: any, minMillis: number, maxMillis: number, selectedMillis?: number, onSet?: any): void;
2522
+ render(chartOptions: any, minMillis: number, maxMillis: number, selectedMillis?: number, onSet?: OnSetCallback$1): void;
2421
2523
  }
2422
2524
 
2525
+ type OnSetCallback = (fromMillis: number, toMillis?: number, offset?: string, isRelative?: boolean, quickTime?: number) => void;
2526
+ type OnCancelCallback = () => void;
2423
2527
  declare class DateTimeButtonRange extends DateTimeButton {
2424
2528
  private onCancel;
2425
2529
  private fromMillis;
2426
2530
  private toMillis;
2427
2531
  private clickOutsideHandler;
2428
2532
  constructor(renderTarget: Element);
2533
+ /**
2534
+ * Set the button text to display the selected date/time range
2535
+ *
2536
+ * @param fromMillis - Start time in milliseconds
2537
+ * @param toMillis - End time in milliseconds
2538
+ * @param isRelative - Whether this is a relative time range (e.g., "Last 24 Hours")
2539
+ * @param quickTime - Quick time selection in milliseconds (if applicable)
2540
+ * @private
2541
+ */
2429
2542
  private setButtonText;
2543
+ /**
2544
+ * Close the date/time picker and return focus to the button
2545
+ * @private
2546
+ */
2430
2547
  private onClose;
2548
+ /**
2549
+ * Remove the click outside event handler if it exists
2550
+ * @private
2551
+ */
2431
2552
  private removeClickOutsideHandler;
2553
+ /**
2554
+ * Set up click outside handler to close the picker when clicking outside
2555
+ * Uses a small delay to prevent the opening click from immediately closing the picker
2556
+ * @private
2557
+ */
2432
2558
  private setupClickOutsideHandler;
2433
- render(chartOptions: any, minMillis: number, maxMillis: number, fromMillis?: number, toMillis?: number, onSet?: any, onCancel?: any): void;
2559
+ /**
2560
+ * Render the date/time button with range selection
2561
+ *
2562
+ * @param chartOptions - Configuration options for the component
2563
+ * @param minMillis - Minimum selectable time in milliseconds
2564
+ * @param maxMillis - Maximum selectable time in milliseconds
2565
+ * @param fromMillis - Start time of the range (defaults to 24 hours before maxMillis)
2566
+ * @param toMillis - End time of the range (defaults to maxMillis)
2567
+ * @param onSet - Callback invoked when user saves a selection
2568
+ * @param onCancel - Callback invoked when user cancels
2569
+ */
2570
+ render(chartOptions: any, minMillis: number, maxMillis: number, fromMillis?: number, toMillis?: number, onSet?: OnSetCallback, onCancel?: OnCancelCallback): void;
2571
+ /**
2572
+ * Open the date/time picker in modal mode
2573
+ *
2574
+ * @param minMillis - Minimum selectable time
2575
+ * @param maxMillis - Maximum selectable time
2576
+ * @private
2577
+ */
2578
+ private _openPicker;
2434
2579
  }
2435
2580
 
2436
2581
  interface IPlaybackSettings {
@@ -2517,23 +2662,20 @@ declare abstract class HistoryPlayback extends Component {
2517
2662
  protected graphicOriginalHeight: number;
2518
2663
  protected currentCancelTrigger: Function;
2519
2664
  protected availabilityInterval: number;
2520
- protected environmentFqdn: string;
2521
2665
  protected availability: TsqRange;
2522
- protected getAuthToken: () => Promise<string>;
2523
2666
  protected playbackRate: number;
2524
2667
  protected graphic: any;
2525
2668
  readonly numberOfBuckets = 1000;
2526
2669
  readonly defaultPlaybackRate = 3000;
2527
2670
  readonly fetchAvailabilityFrequency = 30000;
2528
2671
  readonly playbackSliderHeight = 88;
2529
- readonly previewApiFlag = "?api-version=2018-11-01-preview";
2530
2672
  constructor(renderTarget: Element);
2531
2673
  protected abstract loadResources(): Promise<any>;
2532
2674
  protected abstract draw(): any;
2533
2675
  protected abstract updateDataMarkers(data: Array<any>): void;
2534
2676
  protected abstract getDataPoints(data: Array<any>): void;
2535
2677
  protected onGraphicLoaded(): void;
2536
- protected renderBase(environmentFqdn: string, getToken: () => Promise<string>, data: Array<TsqExpression>, chartOptions: any): void;
2678
+ protected renderBase(data: Array<TsqExpression>, chartOptions: any): void;
2537
2679
  pauseAvailabilityUpdates(): void;
2538
2680
  private onSelecTimestamp;
2539
2681
  private calcQueryWindow;
@@ -2586,6 +2728,7 @@ declare class ColorPicker extends Component {
2586
2728
  }
2587
2729
 
2588
2730
  declare class GeoProcessGraphic extends HistoryPlayback {
2731
+ private dataSource;
2589
2732
  private azureMapsSubscriptionKey;
2590
2733
  private zoom;
2591
2734
  private width;
@@ -2597,14 +2740,29 @@ declare class GeoProcessGraphic extends HistoryPlayback {
2597
2740
  private maxZoom;
2598
2741
  private minZoom;
2599
2742
  private duration;
2743
+ private map;
2744
+ private tilesetId;
2745
+ private mapContainer;
2600
2746
  constructor(renderTarget: Element);
2601
- render(environmentFqdn: string, getToken: () => Promise<string>, data: Array<TsqExpression>, chartOptions: any): void;
2747
+ render(data: Array<TsqExpression>, chartOptions: any): void;
2748
+ protected renderBase(data: Array<TsqExpression>, chartOptions: any): void;
2749
+ private initializeAvaibility;
2750
+ private cleanup;
2751
+ private initializeComponent;
2602
2752
  protected loadResources(): Promise<any>;
2603
- protected draw(): void;
2753
+ private loadAzureMapsScript;
2754
+ private initializeMap;
2755
+ private initializeMapFeatures;
2756
+ private applyMapStyle;
2757
+ private createVehicleMarker;
2758
+ private getMapStyleForTileset;
2759
+ private createMarkerHtml;
2760
+ private renderFallback;
2761
+ protected draw(): Promise<any>;
2604
2762
  protected getDataPoints(results: Array<IGeoProcessGraphicLabelInfo>): void;
2605
- protected parseTsqResponse(response: any): {};
2763
+ protected parseTsqResponse(response: any): any;
2606
2764
  protected updateDataMarkers(dataPoints: Array<any>): void;
2607
- protected createTable(dataPointArr: any, idx: any): HTMLDivElement;
2765
+ private createPopupContent;
2608
2766
  }
2609
2767
  interface IGeoProcessGraphicLabelInfo {
2610
2768
  }