tsichart-core 1.0.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.
Files changed (126) hide show
  1. package/LICENSE +22 -0
  2. package/README.MD +189 -0
  3. package/dist/AggregateExpression.d.ts +13 -0
  4. package/dist/AggregateExpression.js +70 -0
  5. package/dist/AvailabilityChart-i_efwXCX.js +488 -0
  6. package/dist/AvailabilityChart.d.ts +59 -0
  7. package/dist/AvailabilityChart.js +26 -0
  8. package/dist/ChartComponent-DTcc6aED.d.ts +80 -0
  9. package/dist/ChartComponent-DnKLTxWe.js +302 -0
  10. package/dist/ChartComponentData-D5wuQmmZ.d.ts +47 -0
  11. package/dist/ChartDataOptions-DBS28b1-.d.ts +38 -0
  12. package/dist/ChartDataOptions-DRd8NHra.js +49 -0
  13. package/dist/ChartVisualizationComponent-CG7e5xlc.js +23 -0
  14. package/dist/ChartVisualizationComponent-DBjiqR1n.d.ts +8 -0
  15. package/dist/ColorPicker-CH__K8xm.js +120 -0
  16. package/dist/ColorPicker.d.ts +28 -0
  17. package/dist/ColorPicker.js +6 -0
  18. package/dist/Component-CofgyEw0.js +401 -0
  19. package/dist/Component-Rp30sSAW.d.ts +226 -0
  20. package/dist/ContextMenu-DABSkTA2.js +197 -0
  21. package/dist/DateTimeButton-CMcCxc8x.d.ts +16 -0
  22. package/dist/DateTimeButton-Ca1487GR.js +38 -0
  23. package/dist/DateTimeButtonRange-DpgfhHQt.js +71 -0
  24. package/dist/DateTimeButtonRange.d.ts +19 -0
  25. package/dist/DateTimeButtonRange.js +15 -0
  26. package/dist/DateTimeButtonSingle-C6cTx5VO.js +48 -0
  27. package/dist/DateTimeButtonSingle.d.ts +17 -0
  28. package/dist/DateTimeButtonSingle.js +14 -0
  29. package/dist/DateTimePicker-BH6qiVfQ.js +532 -0
  30. package/dist/DateTimePicker.d.ts +69 -0
  31. package/dist/DateTimePicker.js +13 -0
  32. package/dist/EllipsisMenu-30FNqoIv.js +116 -0
  33. package/dist/EllipsisMenu.d.ts +20 -0
  34. package/dist/EllipsisMenu.js +6 -0
  35. package/dist/Enums-ChUuTtHV.d.ts +12 -0
  36. package/dist/EventsTable-a0XLbsMF.js +553 -0
  37. package/dist/EventsTable.d.ts +34 -0
  38. package/dist/EventsTable.js +10 -0
  39. package/dist/GeoProcessGraphic-AVAzyF7k.js +145 -0
  40. package/dist/GeoProcessGraphic.d.ts +34 -0
  41. package/dist/GeoProcessGraphic.js +7 -0
  42. package/dist/Grid-DfFAkeeV.js +874 -0
  43. package/dist/Grid.d.ts +43 -0
  44. package/dist/Grid.js +6 -0
  45. package/dist/GroupedBarChart-BspwM8r2.js +579 -0
  46. package/dist/GroupedBarChart.d.ts +22 -0
  47. package/dist/GroupedBarChart.js +17 -0
  48. package/dist/GroupedBarChartData-BRCyDxbA.js +121 -0
  49. package/dist/GroupedBarChartData-C0YQydrP.d.ts +20 -0
  50. package/dist/Heatmap-D8ET8Ue8.js +524 -0
  51. package/dist/Heatmap.d.ts +31 -0
  52. package/dist/Heatmap.js +14 -0
  53. package/dist/Hierarchy-QkWLHkxo.js +260 -0
  54. package/dist/Hierarchy.d.ts +39 -0
  55. package/dist/Hierarchy.js +6 -0
  56. package/dist/HierarchyNavigation-CR6YUilh.js +336 -0
  57. package/dist/HierarchyNavigation.d.ts +34 -0
  58. package/dist/HierarchyNavigation.js +6 -0
  59. package/dist/HistoryPlayback-BmA-54lT.d.ts +68 -0
  60. package/dist/HistoryPlayback-SjeQbAPq.js +175 -0
  61. package/dist/Interfaces-BKRQ685G.d.ts +6 -0
  62. package/dist/Legend-DlSXQXHF.js +497 -0
  63. package/dist/LineChart-CExEyjZa.js +3181 -0
  64. package/dist/LineChart.d.ts +163 -0
  65. package/dist/LineChart.js +18 -0
  66. package/dist/ModelAutocomplete-TRD16egq.js +100 -0
  67. package/dist/ModelAutocomplete.d.ts +12 -0
  68. package/dist/ModelAutocomplete.js +7 -0
  69. package/dist/ModelSearch-WEa7Ud20.js +189 -0
  70. package/dist/ModelSearch.d.ts +23 -0
  71. package/dist/ModelSearch.js +9 -0
  72. package/dist/PieChart-B1ZXk13Q.js +258 -0
  73. package/dist/PieChart.d.ts +26 -0
  74. package/dist/PieChart.js +17 -0
  75. package/dist/PlaybackControls-Dwt6dif9.js +195 -0
  76. package/dist/PlaybackControls.d.ts +39 -0
  77. package/dist/PlaybackControls.js +13 -0
  78. package/dist/ProcessGraphic-CixT-zZl.js +154 -0
  79. package/dist/ProcessGraphic.d.ts +31 -0
  80. package/dist/ProcessGraphic.js +7 -0
  81. package/dist/README.MD +189 -0
  82. package/dist/ScatterPlot-DrPoHNDJ.js +924 -0
  83. package/dist/ScatterPlot.d.ts +115 -0
  84. package/dist/ScatterPlot.js +17 -0
  85. package/dist/SingleDateTimePicker-7anflEq8.js +213 -0
  86. package/dist/SingleDateTimePicker.d.ts +45 -0
  87. package/dist/SingleDateTimePicker.js +12 -0
  88. package/dist/Slider-BtSdC4fj.js +186 -0
  89. package/dist/Slider.d.ts +31 -0
  90. package/dist/Slider.js +6 -0
  91. package/dist/TemporalXAxisComponent-CyiM5EH0.d.ts +23 -0
  92. package/dist/TemporalXAxisComponent-DkyVvASs.js +129 -0
  93. package/dist/TimezonePicker-ClfP1lBL.js +58 -0
  94. package/dist/TimezonePicker.d.ts +16 -0
  95. package/dist/TimezonePicker.js +10 -0
  96. package/dist/Tooltip-Fa-0Xekn.js +104 -0
  97. package/dist/TsqExpression.d.ts +36 -0
  98. package/dist/TsqExpression.js +89 -0
  99. package/dist/UXClient-DydSPZwM.js +230 -0
  100. package/dist/UXClient.d.ts +74 -0
  101. package/dist/UXClient.js +47 -0
  102. package/dist/Utils-BsPLzJBC.d.ts +104 -0
  103. package/dist/Utils-C_j8IgZh.js +1138 -0
  104. package/dist/Utils.d.ts +7 -0
  105. package/dist/Utils.js +7 -0
  106. package/dist/_tslib-5_9pMg1F.js +96 -0
  107. package/dist/package.json +106 -0
  108. package/dist/pikaday-DMSzaLH6.js +1252 -0
  109. package/dist/tsiclient.cjs.js +3 -0
  110. package/dist/tsiclient.cjs.js.LICENSE.txt +19 -0
  111. package/dist/tsiclient.cjs.js.map +1 -0
  112. package/dist/tsiclient.css +17323 -0
  113. package/dist/tsiclient.d.ts +46 -0
  114. package/dist/tsiclient.esm.js +3 -0
  115. package/dist/tsiclient.esm.js.LICENSE.txt +19 -0
  116. package/dist/tsiclient.esm.js.map +1 -0
  117. package/dist/tsiclient.js +58 -0
  118. package/dist/tsiclient.min.css +6 -0
  119. package/dist/tsiclient.min.css.map +1 -0
  120. package/dist/tsiclient.umd.js +3 -0
  121. package/dist/tsiclient.umd.js.LICENSE.txt +19 -0
  122. package/dist/tsiclient.umd.js.map +1 -0
  123. package/dist/tsiclient.umd.min.js +3 -0
  124. package/dist/tsiclient.umd.min.js.LICENSE.txt +19 -0
  125. package/dist/tsiclient.umd.min.js.map +1 -0
  126. package/package.json +106 -0
@@ -0,0 +1,488 @@
1
+ import { _ as __extends, a as __assign } from './_tslib-5_9pMg1F.js';
2
+ import * as d3 from 'd3';
3
+ import { L as LineChart } from './LineChart-CExEyjZa.js';
4
+ import { D as DateTimePicker } from './DateTimePicker-BH6qiVfQ.js';
5
+ import { U as Utils } from './Utils-C_j8IgZh.js';
6
+ import { C as ChartComponent } from './ChartComponent-DnKLTxWe.js';
7
+ import AggregateExpression from './AggregateExpression.js';
8
+ import { D as DateTimeButtonRange } from './DateTimeButtonRange-DpgfhHQt.js';
9
+
10
+ var AvailabilityChart = /** @class */ (function (_super) {
11
+ __extends(AvailabilityChart, _super);
12
+ function AvailabilityChart(renderTarget) {
13
+ var _this = _super.call(this, renderTarget) || this;
14
+ _this.minBrushWidth = 5;
15
+ _this.minGhostWidth = 2;
16
+ _this.margins = {
17
+ left: 10,
18
+ right: 10
19
+ };
20
+ return _this;
21
+ }
22
+ //the most zoomed in possible
23
+ AvailabilityChart.prototype.getMinZoomedRange = function () {
24
+ var maxZoomFactor = (this.sparkLineChart.x.range()[1] - this.sparkLineChart.x.range()[0]) / this.minBrushWidth;
25
+ var totalTimeRange = this.toMillis - this.fromMillis;
26
+ return totalTimeRange / maxZoomFactor;
27
+ };
28
+ AvailabilityChart.prototype.zoom = function (event, direction, xPos) {
29
+ if (this.chartOptions.isCompact)
30
+ return;
31
+ var range = Math.max(this.getMinZoomedRange(), (this.zoomedToMillis - this.zoomedFromMillis));
32
+ var percentile = (xPos - this.sparkLineChart.x.range()[0]) /
33
+ (this.sparkLineChart.x.range()[1] - this.sparkLineChart.x.range()[0]);
34
+ var leftImpact = percentile * .2 * range;
35
+ var rightImpact = (1 - percentile) * .2 * range;
36
+ if (direction == 'out') {
37
+ this.zoomedFromMillis = Math.max(this.zoomedFromMillis - leftImpact, this.fromMillis);
38
+ this.zoomedToMillis = Math.min(this.zoomedToMillis + rightImpact, this.toMillis);
39
+ }
40
+ else {
41
+ var prospectiveFromMillis = Math.max(this.zoomedFromMillis + leftImpact, this.fromMillis);
42
+ var prospectiveToMillis = Math.min(this.zoomedToMillis - rightImpact, this.toMillis);
43
+ if (prospectiveToMillis - prospectiveFromMillis >= this.getMinZoomedRange()) {
44
+ this.zoomedFromMillis = prospectiveFromMillis;
45
+ this.zoomedToMillis = prospectiveToMillis;
46
+ }
47
+ else {
48
+ var offBy = this.getMinZoomedRange() - (prospectiveToMillis - prospectiveFromMillis);
49
+ this.zoomedFromMillis = prospectiveFromMillis - (percentile * offBy);
50
+ this.zoomedToMillis = prospectiveToMillis + ((1 - percentile) * offBy);
51
+ }
52
+ }
53
+ this.setAvailabilityRange(this.zoomedFromMillis, this.zoomedToMillis);
54
+ this.sparkLineChart.setBrushEndTime(new Date(this.zoomedToMillis));
55
+ this.sparkLineChart.setBrushStartTime(new Date(this.zoomedFromMillis));
56
+ this.sparkLineChart.setBrush();
57
+ this.timePickerLineChart.drawBrushRange();
58
+ event.preventDefault && event.preventDefault();
59
+ };
60
+ AvailabilityChart.prototype.setChartOptions = function (chartOptions) {
61
+ this.chartOptions.setOptions(__assign(__assign({}, chartOptions), {
62
+ keepBrush: true,
63
+ isArea: true,
64
+ noAnimate: true,
65
+ minutesForTimeLabels: true,
66
+ aggTopMargin: 0,
67
+ yAxisHidden: true,
68
+ focusHidden: true,
69
+ singleLineXAxisLabel: false
70
+ }));
71
+ };
72
+ AvailabilityChart.prototype.dateTimePickerAction = function (fromMillis, toMillis) {
73
+ this.setBrush(fromMillis, toMillis, true);
74
+ this.chartOptions.brushMoveEndAction(new Date(fromMillis), new Date(toMillis), this.chartOptions.offset, this.chartOptions.isRelative, this.chartOptions.currentQuickTime);
75
+ this.setTicks();
76
+ this.dateTimePickerContainer.style("display", "none");
77
+ };
78
+ //transformation of buckets created by the UX client to buckets for the availabilityChart
79
+ AvailabilityChart.prototype.createDisplayBuckets = function (fromMillis, toMillis) {
80
+ var _this = this;
81
+ var keysInRange = Object.keys(this.transformedAvailability[0].availabilityCount[""]).reduce(function (inRangeObj, timestamp, i, timestamps) {
82
+ var currTSMillis = (new Date(timestamp)).valueOf();
83
+ var nextTSMillis = currTSMillis + _this.bucketSize;
84
+ if (currTSMillis >= fromMillis && currTSMillis <= toMillis) {
85
+ inRangeObj[(new Date(currTSMillis)).toISOString()] = _this.transformedAvailability[0].availabilityCount[""][timestamp];
86
+ return inRangeObj;
87
+ }
88
+ if (currTSMillis < fromMillis && nextTSMillis > fromMillis) {
89
+ inRangeObj[(new Date(fromMillis)).toISOString()] = _this.transformedAvailability[0].availabilityCount[""][timestamp];
90
+ return inRangeObj;
91
+ }
92
+ return inRangeObj;
93
+ }, {});
94
+ var rawBucketCount = Math.ceil((toMillis - fromMillis) / this.bucketSize);
95
+ var bucketMultiplier = Math.ceil(rawBucketCount / this.maxBuckets);
96
+ var computedBucketSize = this.bucketSize * bucketMultiplier;
97
+ var createKey = function (millis) { return Math.round(Math.floor(millis / computedBucketSize) * computedBucketSize); };
98
+ var firstBucket = createKey(fromMillis);
99
+ var lastBucket = createKey(toMillis);
100
+ var buckets = [];
101
+ for (var i = firstBucket; i <= lastBucket; i += computedBucketSize) {
102
+ buckets[(new Date(i)).toISOString()] = { count: 0 };
103
+ }
104
+ Object.keys(keysInRange).sort().forEach(function (ts, i) {
105
+ var tsMillis = (new Date(ts)).valueOf();
106
+ var computedKey = createKey(tsMillis);
107
+ buckets[(new Date(computedKey)).toISOString()].count += (keysInRange[ts].count / bucketMultiplier);
108
+ });
109
+ if (fromMillis !== null && firstBucket !== null) {
110
+ buckets[(new Date(fromMillis)).toISOString()] = buckets[(new Date(firstBucket)).toISOString()];
111
+ }
112
+ if (toMillis !== null && lastBucket !== null) {
113
+ buckets[(new Date(toMillis)).toISOString()] = buckets[(new Date(lastBucket)).toISOString()];
114
+ }
115
+ // delete the bucket before the from time
116
+ if (firstBucket < fromMillis) {
117
+ delete buckets[(new Date(firstBucket)).toISOString()];
118
+ }
119
+ return [{ "availabilityCount": { "": buckets } }];
120
+ };
121
+ AvailabilityChart.prototype.setRangeVariables = function (rawAvailability) {
122
+ if (Utils.safeNotNullOrUndefined(function () { return rawAvailability.range.from || rawAvailability.range.to || rawAvailability.intervalSize; })) {
123
+ this.fromMillis = (new Date(rawAvailability.range.from)).valueOf();
124
+ this.toMillis = (new Date(rawAvailability.range.to)).valueOf();
125
+ this.bucketSize = Utils.parseTimeInput(rawAvailability.intervalSize);
126
+ }
127
+ else {
128
+ this.fromMillis = null;
129
+ this.toMillis = null;
130
+ this.bucketSize = null;
131
+ }
132
+ };
133
+ AvailabilityChart.prototype.render = function (transformedAvailability, chartOptions, rawAvailability) {
134
+ var _this = this;
135
+ if (rawAvailability === void 0) { rawAvailability = {}; }
136
+ this.setChartOptions(chartOptions);
137
+ this.rawAvailability = rawAvailability;
138
+ this.transformedAvailability = transformedAvailability;
139
+ this.color = this.chartOptions.color ? this.chartOptions.color : 'teal';
140
+ this.maxBuckets = (this.chartOptions.maxBuckets) ? this.chartOptions.maxBuckets : 500;
141
+ this.setRangeVariables(rawAvailability);
142
+ var startBucket = (this.fromMillis !== null && this.bucketSize !== null) ?
143
+ Math.round(Math.floor(this.fromMillis / this.bucketSize) * this.bucketSize) : null;
144
+ var endBucket = (this.toMillis !== null && this.bucketSize !== null) ?
145
+ Math.round(Math.floor(this.toMillis / this.bucketSize) * this.bucketSize) : null;
146
+ if (startBucket !== null && startBucket === endBucket) {
147
+ this.fromMillis = Math.floor(this.fromMillis / this.bucketSize) * this.bucketSize;
148
+ this.toMillis = this.fromMillis + this.bucketSize;
149
+ this.bucketSize = this.bucketSize / 60;
150
+ }
151
+ this.ae = [new AggregateExpression({ predicateString: "" }, { property: 'Count', type: "Double" }, ['count'], { from: new Date(this.fromMillis), to: new Date(this.toMillis) }, null, 'grey', 'Availability')];
152
+ this.targetElement = d3.select(this.renderTarget)
153
+ .classed("tsi-availabilityChart", true)
154
+ .classed("tsi-compact", this.chartOptions.isCompact)
155
+ .classed("tsi-withButton", this.chartOptions.persistDateTimeButtonRange);
156
+ this.chartOptions.yAxisHidden = true;
157
+ this.chartOptions.focusHidden = true;
158
+ this.chartOptions.singleLineXAxisLabel = true;
159
+ this.chartOptions.suppressResizeListener = true;
160
+ this.chartOptions.brushClearable = false;
161
+ this.chartOptions.minBrushWidth = 1;
162
+ this.chartOptions.brushHandlesVisible = true;
163
+ var brushMoveAction = this.chartOptions.brushMoveAction;
164
+ this.chartOptions.brushMoveAction = function (from, to) {
165
+ _this.setFromAndToTimes(from.valueOf(), to.valueOf());
166
+ _this.drawGhost();
167
+ if (_this.chartOptions.isCompact) {
168
+ _this.buildCompactFromAndTo();
169
+ }
170
+ if (brushMoveAction != null)
171
+ brushMoveAction(from, to);
172
+ };
173
+ _super.prototype.themify.call(this, this.targetElement, chartOptions.theme);
174
+ if (this.timePickerContainer == null) {
175
+ this.targetElement.html("");
176
+ this.timePickerContainer = this.targetElement.append("div")
177
+ .classed("tsi-timePickerContainer", true);
178
+ this.timePickerChart = this.timePickerContainer.append("div").classed("tsi-timePickerChart", true);
179
+ var sparkLineContainer = this.targetElement.append("div").classed("tsi-sparklineContainer", true);
180
+ this.timePickerTextContainer = this.targetElement.append("div").classed("tsi-timePickerTextContainer", true)
181
+ .style("margin-left", this.chartOptions.availabilityLeftMargin + this.margins.left);
182
+ this.timePickerLineChart = new LineChart(this.timePickerChart.node());
183
+ this.timePickerLineChart.chartMargins.left = (this.chartOptions.availabilityLeftMargin - this.margins.left);
184
+ this.buildFromAndToContainer();
185
+ this.sparkLineChart = new LineChart(sparkLineContainer.node());
186
+ this.sparkLineChart.chartMargins.left = (this.chartOptions.availabilityLeftMargin - this.margins.left);
187
+ this.dateTimePickerContainer = this.targetElement.append("div").classed("tsi-dateTimePickerContainer", true);
188
+ this.dateTimePicker = new DateTimePicker(this.dateTimePickerContainer.node());
189
+ window.addEventListener('resize', function () {
190
+ _this.timePickerLineChart.draw();
191
+ _this.setTicks();
192
+ _this.drawWarmRange();
193
+ if (_this.chartOptions.isCompact)
194
+ _this.buildCompactFromAndTo();
195
+ setTimeout(function () {
196
+ _this.drawGhost();
197
+ }, 100);
198
+ });
199
+ this.targetElement.selectAll(".tsi-dateTimePickerContainer, .tsi-dateTimePickerContainer *");
200
+ }
201
+ //clear the date time picker
202
+ this.dateTimePickerContainer.style("display", "none");
203
+ this.timePickerContainer.selectAll('.tsi-compactFromTo').remove();
204
+ if (this.chartOptions.isCompact) {
205
+ this.targetElement.select('.tsi-sparklineContainer').style("display", 'none');
206
+ if (!this.chartOptions.persistDateTimeButtonRange)
207
+ this.targetElement.select(".tsi-timePickerTextContainer").style('display', 'none');
208
+ this.targetElement.select('.tsi-zoomButtonContainer').style('display', 'none');
209
+ this.targetElement.select('.tsi-timePickerContainer').style('max-height', '68px').style('top', this.chartOptions.persistDateTimeButtonRange ? '6px' : '20px');
210
+ }
211
+ else {
212
+ this.targetElement.select('.tsi-sparklineContainer').style("display", 'flex');
213
+ this.targetElement.select(".tsi-timePickerTextContainer").style('display', 'inherit');
214
+ this.targetElement.select('.tsi-zoomButtonContainer').style('display', 'flex');
215
+ this.targetElement.select('.tsi-timePickerContainer').style('max-height', 'none').style('top', '0px');
216
+ }
217
+ var sparkLineOptions = this.createSparkLineOptions(chartOptions);
218
+ var visibileAvailability = this.createDisplayBuckets(this.fromMillis, this.toMillis);
219
+ this.sparkLineChart.render(visibileAvailability, sparkLineOptions, this.ae);
220
+ this.timePickerLineChart.render(visibileAvailability, this.chartOptions, this.ae);
221
+ this.setTicks();
222
+ this.drawWarmRange();
223
+ if (!this.chartOptions.preserveAvailabilityState) {
224
+ this.zoomedToMillis = this.toMillis;
225
+ this.zoomedFromMillis = this.chartOptions.defaultAvailabilityZoomRangeMillis ? Math.max(this.fromMillis, this.toMillis - this.chartOptions.defaultAvailabilityZoomRangeMillis) : this.fromMillis;
226
+ this.sparkLineChart.setBrushStartTime(new Date(this.zoomedFromMillis));
227
+ this.sparkLineChart.setBrushEndTime(new Date(this.zoomedToMillis));
228
+ this.setFromAndToTimes(Math.max(this.fromMillis, this.toMillis - (24 * 60 * 60 * 1000)), this.toMillis);
229
+ this.setBrush(Math.max(this.fromMillis, this.toMillis - (24 * 60 * 60 * 1000)), this.toMillis);
230
+ }
231
+ else {
232
+ if (this.zoomedFromMillis == null)
233
+ this.zoomedFromMillis = this.chartOptions.defaultAvailabilityZoomRangeMillis ? Math.max(this.fromMillis, this.toMillis - this.chartOptions.defaultAvailabilityZoomRangeMillis) : this.fromMillis;
234
+ if (this.zoomedToMillis == null)
235
+ this.zoomedToMillis = this.toMillis;
236
+ if (this.sparkLineChart.brushStartTime == null)
237
+ this.sparkLineChart.setBrushStartTime(new Date(this.zoomedFromMillis));
238
+ if (this.sparkLineChart.brushEndTime == null)
239
+ this.sparkLineChart.setBrushEndTime(new Date(this.zoomedToMillis));
240
+ if (this.selectedFromMillis == null || this.selectedToMillis == null)
241
+ this.setFromAndToTimes(this.toMillis - (24 * 60 * 60 * 1000), this.toMillis);
242
+ this.drawGhost();
243
+ this.setBrush(this.selectedFromMillis, this.selectedToMillis);
244
+ }
245
+ this.sparkLineChart.setBrush();
246
+ var self = this;
247
+ this.timePickerChart.select(".brushElem").on("wheel.zoom", function (event, d) {
248
+ var direction = event.deltaY > 0 ? 'out' : 'in';
249
+ var xPos = (d3.pointer(event)[0]);
250
+ self.zoom(event, direction, xPos);
251
+ });
252
+ if (!this.chartOptions.isCompact) {
253
+ this.buildZoomButtons();
254
+ }
255
+ else {
256
+ this.timePickerChart.select('.brushElem').select('.selection');
257
+ }
258
+ this.setAvailabilityRange(this.zoomedFromMillis, this.zoomedToMillis);
259
+ if (this.chartOptions.isCompact) {
260
+ this.buildCompactFromAndTo();
261
+ }
262
+ this.timePickerLineChart.drawBrushRange();
263
+ };
264
+ AvailabilityChart.prototype.buildZoomButtons = function () {
265
+ var _this = this;
266
+ this.targetElement.selectAll(".tsi-zoomButtonContainer").remove();
267
+ var midpoint = (this.sparkLineChart.x.range()[1] - this.sparkLineChart.x.range()[0]) / 2;
268
+ var buttonsDiv = this.targetElement.append("div")
269
+ .classed("tsi-zoomButtonContainer", true);
270
+ buttonsDiv.append("button")
271
+ .attr("class", "tsi-zoomButton tsi-zoomButtonIn")
272
+ .attr('aria-label', this.getString('A line chart zoom in'))
273
+ .attr('title', this.getString('zoom in'))
274
+ .on("click", function (event) {
275
+ _this.zoom(event, "in", midpoint);
276
+ });
277
+ buttonsDiv.append("button")
278
+ .attr("class", "tsi-zoomButton tsi-zoomButtonOut")
279
+ .attr('aria-label', this.getString('A line chart zoom out'))
280
+ .attr('title', this.getString('zoom out'))
281
+ .on("click", function (event) {
282
+ _this.zoom(event, "out", midpoint);
283
+ });
284
+ };
285
+ AvailabilityChart.prototype.setSelectedMillis = function (fromMillis, toMillis) {
286
+ this.selectedFromMillis = fromMillis;
287
+ this.selectedToMillis = toMillis;
288
+ this.timePickerLineChart.drawBrushRange();
289
+ };
290
+ AvailabilityChart.prototype.renderDateTimeButton = function () {
291
+ var _this = this;
292
+ this.fromMillis + (Utils.getOffsetMinutes(this.chartOptions.offset, this.fromMillis) * 60 * 1000);
293
+ this.toMillis + (Utils.getOffsetMinutes(this.chartOptions.offset, this.toMillis) * 60 * 1000);
294
+ this.selectedFromMillis + (Utils.getOffsetMinutes(this.chartOptions.offset, this.selectedFromMillis) * 60 * 1000);
295
+ this.selectedToMillis + (Utils.getOffsetMinutes(this.chartOptions.offset, this.selectedFromMillis) * 60 * 1000);
296
+ this.dateTimeButton.render(this.chartOptions, this.fromMillis, this.toMillis, this.selectedFromMillis, this.selectedToMillis, function (fromMillis, toMillis, offset, isRelative, currentQuickTime) {
297
+ _this.chartOptions.offset = offset;
298
+ _this.chartOptions.isRelative = isRelative;
299
+ _this.chartOptions.currentQuickTime = currentQuickTime;
300
+ _this.timePickerLineChart.chartOptions.offset = offset;
301
+ _this.sparkLineChart.chartOptions.offset = offset;
302
+ _this.dateTimePickerAction(fromMillis, toMillis);
303
+ d3.select(_this.renderTarget).select(".tsi-dateTimeContainer").node().focus();
304
+ }, function () {
305
+ _this.dateTimePickerContainer.style("display", "none");
306
+ d3.select(_this.renderTarget).select(".tsi-dateTimeContainer").node().focus();
307
+ });
308
+ };
309
+ AvailabilityChart.prototype.setFromAndToTimes = function (fromMillis, toMillis, isFromButton) {
310
+ if (isFromButton === void 0) { isFromButton = false; }
311
+ var timezone = Utils.parseTimezoneName(this.chartOptions.offset);
312
+ Utils.timezoneAbbreviation(timezone);
313
+ this.setSelectedMillis(fromMillis, toMillis);
314
+ if (!isFromButton) {
315
+ this.renderDateTimeButton();
316
+ }
317
+ };
318
+ AvailabilityChart.prototype.drawGhost = function () {
319
+ var svgGroup = this.targetElement.select('.tsi-sparklineContainer').select(".tsi-lineChartSVG").select(".svgGroup");
320
+ svgGroup.selectAll(".ghostRect").remove();
321
+ svgGroup.append("rect")
322
+ .classed("ghostRect", true)
323
+ .attr("x", Math.max(this.sparkLineChart.x.range()[0], this.sparkLineChart.x(new Date(this.selectedFromMillis))))
324
+ .attr("y", 0)
325
+ .attr("width", Math.min(Math.max(this.minGhostWidth, this.sparkLineChart.x(new Date(this.selectedToMillis)) - this.sparkLineChart.x(new Date(this.selectedFromMillis))), this.sparkLineChart.x.range()[1] - this.sparkLineChart.x.range()[0]))
326
+ .attr("height", 8)
327
+ .attr("fill", this.chartOptions.color ? this.chartOptions.color : 'dark-grey')
328
+ .attr("fill-opacity", .3)
329
+ .attr("pointer-events", "none");
330
+ };
331
+ AvailabilityChart.prototype.drawWarmRange = function () {
332
+ var svgGroup = this.targetElement.select('.tsi-timePickerContainer').select(".tsi-lineChartSVG").select(".svgGroup");
333
+ if (svgGroup.select('.tsi-warmRect').empty()) {
334
+ svgGroup.append("rect")
335
+ .classed("tsi-warmRect", true);
336
+ svgGroup.select('.brushElem').raise();
337
+ }
338
+ var warmRect = svgGroup.select(".tsi-warmRect");
339
+ var outOfRange = true;
340
+ if (this.chartOptions.warmStoreRange) {
341
+ var warmStart = new Date(this.chartOptions.warmStoreRange[0]);
342
+ var boundedWarmStart = new Date(Math.max(warmStart.valueOf(), this.zoomedFromMillis));
343
+ var warmEnd = new Date(this.chartOptions.warmStoreRange.length === 2 ? this.chartOptions.warmStoreRange[1] : this.toMillis);
344
+ var boundedWarmEnd = new Date(Math.min(warmEnd.valueOf(), this.zoomedToMillis));
345
+ if (boundedWarmStart < boundedWarmEnd) {
346
+ outOfRange = false;
347
+ warmRect.attr("x", Math.max(this.timePickerLineChart.x(boundedWarmStart)))
348
+ .attr("y", this.chartOptions.isCompact ? 12 : -8)
349
+ .attr("width", this.timePickerLineChart.x(boundedWarmEnd) - this.timePickerLineChart.x(boundedWarmStart))
350
+ .attr("height", this.chartOptions.isCompact ? 4 : Math.max((this.targetElement.select('.tsi-timePickerContainer').select(".tsi-lineChartSVG").node().getBoundingClientRect().height - 44), 0))
351
+ .attr("fill-opacity", this.chartOptions.isCompact ? .8 : .08)
352
+ .attr('stroke-opacity', this.chartOptions.isCompact ? 0 : .5)
353
+ .attr("pointer-events", "none");
354
+ }
355
+ }
356
+ if (outOfRange || this.chartOptions.warmStoreRange === null) {
357
+ warmRect.style('display', 'none');
358
+ }
359
+ else {
360
+ warmRect.style('display', 'block');
361
+ }
362
+ };
363
+ AvailabilityChart.prototype.buildCompactFromAndTo = function () {
364
+ this.timePickerContainer.selectAll('.tsi-compactFromTo').remove();
365
+ // if the view is compact and there is a datetimebuttonrange present, we don't need compact from and to
366
+ if (this.chartOptions.persistDateTimeButtonRange)
367
+ return;
368
+ var brushPositions = this.timePickerLineChart.getBrushPositions();
369
+ var leftTimeText = null;
370
+ var rightTimeText = null;
371
+ if (this.selectedFromMillis != null && this.selectedToMillis != null) {
372
+ leftTimeText = this.timePickerContainer.append('div')
373
+ .classed('tsi-compactFromTo', true)
374
+ .style('left', (brushPositions.leftPos != null ? Math.max(brushPositions.leftPos, 5) : 5) + 'px')
375
+ .text(Utils.timeFormat(false, false, this.chartOptions.offset, this.chartOptions.is24HourTime, null, null, this.chartOptions.dateLocale)(new Date(this.selectedFromMillis)));
376
+ var timezoneAbbreviation = ' (' + Utils.createTimezoneAbbreviation(this.chartOptions.offset) + ')';
377
+ rightTimeText = this.timePickerContainer.append('div')
378
+ .attr('class', 'tsi-compactFromTo')
379
+ .style('right', brushPositions.rightPos != null ? 'calc(100% - ' + brushPositions.rightPos + 'px)' : '5px')
380
+ .style('left', 'auto')
381
+ .text(Utils.timeFormat(false, false, this.chartOptions.offset, this.chartOptions.is24HourTime, null, null, this.chartOptions.dateLocale)(new Date(this.selectedToMillis)) + timezoneAbbreviation);
382
+ }
383
+ if (leftTimeText && rightTimeText) {
384
+ var rightSideOfLeft = leftTimeText.node().getBoundingClientRect().left + leftTimeText.node().getBoundingClientRect().width;
385
+ var leftSideOfRight = rightTimeText.node().getBoundingClientRect().left;
386
+ var totalWidth = this.timePickerContainer.node().getBoundingClientRect().width;
387
+ var minOffset = 40;
388
+ if (leftSideOfRight - rightSideOfLeft < minOffset) { // if there is overlap (or near overlap), correction needed
389
+ var correction = (rightSideOfLeft - leftSideOfRight + minOffset) / 2;
390
+ //if the correction puts either side off the edge of the container, weight the correction to the other side
391
+ var leftWeight = 1;
392
+ var rightWeight = 1;
393
+ var padding = 32;
394
+ if ((brushPositions.leftPos - correction) < padding) {
395
+ leftWeight = 1 - ((padding - (brushPositions.leftPos - correction)) / correction);
396
+ rightWeight = 2 - leftWeight;
397
+ }
398
+ if ((brushPositions.rightPos + correction) > (totalWidth - padding)) {
399
+ rightWeight = 1 - (padding - (totalWidth - brushPositions.rightPos - correction)) / correction;
400
+ leftWeight = 2 - rightWeight;
401
+ }
402
+ rightTimeText.style('right', 'calc(100% - ' + Math.round((brushPositions.rightPos + (rightWeight * correction))) + 'px)')
403
+ .style('left', 'auto');
404
+ leftTimeText.style('left', (brushPositions.leftPos - (leftWeight * correction)) + 'px');
405
+ }
406
+ }
407
+ };
408
+ AvailabilityChart.prototype.offsetUTC = function (date) {
409
+ date.setTime(date.getTime() + date.getTimezoneOffset() * 60 * 1000);
410
+ return date;
411
+ };
412
+ AvailabilityChart.prototype.buildFromAndToContainer = function () {
413
+ var dateTimeContainer = this.timePickerTextContainer.append('div').classed('tsi-dateTimeContainer', true);
414
+ dateTimeContainer.append("label").text(this.getString("Timeframe")).attr("id", "time-frame-label");
415
+ var dateTimeButtonContainer = dateTimeContainer.append("div")
416
+ .classed('tsi-dateTimeButtonContainer', true)
417
+ .attr("aria-labelledby", 'time-frame-label');
418
+ this.dateTimeButton = new DateTimeButtonRange(dateTimeButtonContainer.node());
419
+ };
420
+ AvailabilityChart.prototype.setTicks = function () {
421
+ this.timePickerLineChart.updateXAxis();
422
+ var forceFirst = (this.timePickerLineChart.zoomedFromMillis == this.timePickerLineChart.fromMillis) && (this.zoomedFromMillis == this.fromMillis);
423
+ var forceLast = (this.timePickerLineChart.zoomedToMillis == this.timePickerLineChart.toMillis) && (this.zoomedToMillis == this.toMillis);
424
+ this.timePickerLineChart.updateXAxis(forceFirst, forceLast);
425
+ var ticks = this.timePickerContainer.select('.tsi-timePickerChart')
426
+ .select('.xAxis')
427
+ .selectAll('.tick');
428
+ ticks.each(function (d, i) {
429
+ var elt = d3.select(this);
430
+ elt.classed((i === 0 && forceFirst ? 'tsi-fromTick' : (i === ticks.size() - 1 && forceLast ? 'tsi-toTick' : '')), true);
431
+ });
432
+ };
433
+ AvailabilityChart.prototype.setAvailabilityRange = function (fromMillis, toMillis) {
434
+ this.zoomedFromMillis = fromMillis;
435
+ this.zoomedToMillis = toMillis;
436
+ var visibileAvailability = this.createDisplayBuckets(fromMillis, toMillis);
437
+ this.chartOptions.keepBrush = true;
438
+ var aeWithNewTimeSpan = __assign(__assign({}, this.ae[0]), {
439
+ searchSpan: {
440
+ from: (new Date(fromMillis)),
441
+ to: (new Date(toMillis))
442
+ }
443
+ });
444
+ this.timePickerLineChart.render(visibileAvailability, this.chartOptions, [aeWithNewTimeSpan]);
445
+ this.setTicks();
446
+ this.drawWarmRange();
447
+ this.timePickerLineChart.setBrush();
448
+ };
449
+ AvailabilityChart.prototype.setBrush = function (fromMillis, toMillis, isFromButton) {
450
+ if (isFromButton === void 0) { isFromButton = false; }
451
+ this.timePickerLineChart.setBrushEndTime(new Date(toMillis));
452
+ this.timePickerLineChart.setBrushStartTime(new Date(fromMillis));
453
+ this.timePickerLineChart.setBrush();
454
+ this.setFromAndToTimes(fromMillis, toMillis, isFromButton);
455
+ this.drawGhost();
456
+ if (this.chartOptions.isCompact)
457
+ this.buildCompactFromAndTo();
458
+ };
459
+ AvailabilityChart.prototype.createSparkLineOptions = function (chartOptions) {
460
+ var _this = this;
461
+ return {
462
+ aggTopMargin: 0,
463
+ theme: chartOptions.theme,
464
+ grid: false,
465
+ tooltip: false,
466
+ legend: "hidden",
467
+ brushContextMenuActions: [],
468
+ snapBrush: false,
469
+ keepBrush: false,
470
+ xAxisHidden: true,
471
+ yAxisHidden: true,
472
+ focusHidden: true,
473
+ minBrushWidth: 5,
474
+ color: null,
475
+ brushHandlesVisible: true,
476
+ brushMoveAction: function (from, to) {
477
+ _this.setAvailabilityRange(from.valueOf(), to.valueOf());
478
+ },
479
+ brushClearable: false,
480
+ hideChartControlPanel: true,
481
+ brushRangeVisible: false,
482
+ isArea: true
483
+ };
484
+ };
485
+ return AvailabilityChart;
486
+ }(ChartComponent));
487
+
488
+ export { AvailabilityChart as A };
@@ -0,0 +1,59 @@
1
+ import { C as ChartComponent } from './ChartComponent-DTcc6aED.js';
2
+ import './Enums-ChUuTtHV.js';
3
+ import './Component-Rp30sSAW.js';
4
+ import './Interfaces-BKRQ685G.js';
5
+ import './ChartComponentData-D5wuQmmZ.js';
6
+ import './EllipsisMenu.js';
7
+
8
+ declare class AvailabilityChart extends ChartComponent {
9
+ private fromMillis;
10
+ private toMillis;
11
+ private selectedFromMillis;
12
+ private selectedToMillis;
13
+ private zoomedFromMillis;
14
+ private zoomedToMillis;
15
+ private minBrushWidth;
16
+ private color;
17
+ private transformedAvailability;
18
+ private minGhostWidth;
19
+ private timeContainer;
20
+ private dateTimeButton;
21
+ private margins;
22
+ private targetElement;
23
+ private brushMoveAction;
24
+ private brushContextMenuActions;
25
+ private timePickerLineChart;
26
+ private timePickerContainer;
27
+ private timePickerChart;
28
+ private timePickerTextContainer;
29
+ private sparkLineChart;
30
+ private ae;
31
+ private rawAvailability;
32
+ private maxBuckets;
33
+ private bucketSize;
34
+ private dateTimePickerContainer;
35
+ private dateTimePicker;
36
+ constructor(renderTarget: Element);
37
+ private getMinZoomedRange;
38
+ private zoom;
39
+ private setChartOptions;
40
+ private dateTimePickerAction;
41
+ private createDisplayBuckets;
42
+ private setRangeVariables;
43
+ render(transformedAvailability: any, chartOptions: any, rawAvailability?: any): void;
44
+ private buildZoomButtons;
45
+ private setSelectedMillis;
46
+ private renderDateTimeButton;
47
+ private setFromAndToTimes;
48
+ private drawGhost;
49
+ private drawWarmRange;
50
+ private buildCompactFromAndTo;
51
+ private offsetUTC;
52
+ private buildFromAndToContainer;
53
+ private setTicks;
54
+ private setAvailabilityRange;
55
+ setBrush(fromMillis: any, toMillis: any, isFromButton?: boolean): void;
56
+ private createSparkLineOptions;
57
+ }
58
+
59
+ export { AvailabilityChart as default };
@@ -0,0 +1,26 @@
1
+ export { A as default } from './AvailabilityChart-i_efwXCX.js';
2
+ import './_tslib-5_9pMg1F.js';
3
+ import 'd3';
4
+ import './LineChart-CExEyjZa.js';
5
+ import 'd3-voronoi';
6
+ import './Utils-C_j8IgZh.js';
7
+ import 'moment-timezone';
8
+ import './Legend-DlSXQXHF.js';
9
+ import './Component-CofgyEw0.js';
10
+ import './TemporalXAxisComponent-DkyVvASs.js';
11
+ import './ChartVisualizationComponent-CG7e5xlc.js';
12
+ import './ChartComponent-DnKLTxWe.js';
13
+ import './Grid-DfFAkeeV.js';
14
+ import 'split.js';
15
+ import './EllipsisMenu-30FNqoIv.js';
16
+ import './ChartDataOptions-DRd8NHra.js';
17
+ import './ContextMenu-DABSkTA2.js';
18
+ import './Tooltip-Fa-0Xekn.js';
19
+ import 'd3-interpolate-path';
20
+ import './DateTimePicker-BH6qiVfQ.js';
21
+ import './pikaday-DMSzaLH6.js';
22
+ import 'moment';
23
+ import './TimezonePicker-ClfP1lBL.js';
24
+ import './AggregateExpression.js';
25
+ import './DateTimeButtonRange-DpgfhHQt.js';
26
+ import './DateTimeButton-Ca1487GR.js';
@@ -0,0 +1,80 @@
1
+ import { T as TooltipMeasureFormat } from './Enums-ChUuTtHV.js';
2
+ import { C as Component } from './Component-Rp30sSAW.js';
3
+ import { C as ChartComponentData } from './ChartComponentData-D5wuQmmZ.js';
4
+ import EllipsisMenu from './EllipsisMenu.js';
5
+
6
+ declare class Legend extends Component {
7
+ drawChart: any;
8
+ legendElement: any;
9
+ legendWidth: number;
10
+ private legendState;
11
+ private stickySeriesAction;
12
+ private labelMouseover;
13
+ private labelMouseout;
14
+ private svgSelection;
15
+ private chartComponentData;
16
+ constructor(drawChart: any, renderTarget: Element, legendWidth: number);
17
+ private labelMouseoutWrapper;
18
+ private toggleSplitByVisible;
19
+ triggerSplitByFocus(aggKey: string, splitBy: string): void;
20
+ private getHeightPerSplitBy;
21
+ private createGradient;
22
+ private isNonNumeric;
23
+ private createNonNumericColorKey;
24
+ private createCategoricalColorKey;
25
+ private createEventsColorKey;
26
+ private renderSplitBys;
27
+ private toggleSticky;
28
+ draw(legendState: string, chartComponentData: any, labelMouseover: any, svgSelection: any, options: any, labelMouseoutAction?: any, stickySeriesAction?: any, event?: any): void;
29
+ }
30
+
31
+ declare class ChartComponent extends Component {
32
+ readonly MINWIDTH = 350;
33
+ protected MINHEIGHT: number;
34
+ readonly CONTROLSWIDTH = 200;
35
+ readonly GUTTERWIDTH = 6;
36
+ data: any;
37
+ aggregateExpressionOptions: any;
38
+ protected chartControlsPanel: any;
39
+ protected ellipsisContainer: any;
40
+ protected ellipsisMenu: EllipsisMenu;
41
+ protected legendObject: Legend;
42
+ protected width: number;
43
+ protected chartWidth: number;
44
+ protected svgSelection: any;
45
+ protected legendWidth: number;
46
+ draw: any;
47
+ chartComponentData: ChartComponentData;
48
+ chartMargins: any;
49
+ constructor(renderTarget: Element);
50
+ showGrid(): void;
51
+ gatedShowGrid(): void;
52
+ hideGrid(): void;
53
+ isGridVisible(): boolean;
54
+ protected drawEllipsisMenu(additionalEllipsisItems?: any[]): void;
55
+ downloadAsCSV: (isScatterPlot?: boolean) => void;
56
+ protected removeControlPanel(): void;
57
+ protected removeEllipsisMenu(): void;
58
+ protected getWidth(): number;
59
+ getVisibilityState(): any[];
60
+ protected ellipsisItemsExist(): boolean;
61
+ protected getDataType(aggKey: any): any;
62
+ protected getCDOFromAggKey(aggKey: any): any;
63
+ protected getFilteredMeasures(measureList: any, visibleMeasure: any, measureFormat: TooltipMeasureFormat, xyrMeasures?: any): any;
64
+ protected convertToTimeValueFormat(d: any): {
65
+ aggregateKey: any;
66
+ splitBy: any;
67
+ aggregateName: any;
68
+ measures: {};
69
+ };
70
+ protected formatDate(date: any, shiftMillis: any): string;
71
+ protected tooltipFormat(d: any, text: any, measureFormat: TooltipMeasureFormat, xyrMeasures?: any): void;
72
+ protected getSVGWidth(): any;
73
+ protected getChartWidth(legendWidth?: number): number;
74
+ protected calcSVGWidth(): any;
75
+ protected setControlsPanelWidth(): void;
76
+ protected legendPostRenderProcess(legendState: string, chartElement: any, shouldSetControlsWidth: boolean, splitLegendOnDrag?: any): void;
77
+ protected splitLegendAndSVG(chartElement: any, onDrag?: () => void): void;
78
+ }
79
+
80
+ export { ChartComponent as C };