tsichart-core 1.0.5 → 2.0.0-beta.1

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 (135) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +80 -0
  3. package/dist/index.d.ts +1744 -0
  4. package/dist/index.js +14284 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.mjs +14209 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/dist/{tsiclient.css → styles/index.css} +9498 -9497
  9. package/dist/styles/index.css.map +1 -0
  10. package/package.json +115 -124
  11. package/README.MD +0 -171
  12. package/dist/AggregateExpression.d.ts +0 -13
  13. package/dist/AggregateExpression.js +0 -70
  14. package/dist/AvailabilityChart-C8ewvn3T.js +0 -488
  15. package/dist/AvailabilityChart.d.ts +0 -59
  16. package/dist/AvailabilityChart.js +0 -26
  17. package/dist/ChartComponent-Dg8P-BTZ.js +0 -302
  18. package/dist/ChartComponent-ONNW31RL.d.ts +0 -80
  19. package/dist/ChartComponentData-DBW8_FnY.d.ts +0 -47
  20. package/dist/ChartDataOptions-CNTSB636.js +0 -49
  21. package/dist/ChartDataOptions-D0BJuRZy.d.ts +0 -38
  22. package/dist/ChartVisualizationComponent-CTs5Q_sg.js +0 -23
  23. package/dist/ChartVisualizationComponent-CpR8xZla.d.ts +0 -8
  24. package/dist/ColorPicker-0p6vkATj.js +0 -120
  25. package/dist/ColorPicker.d.ts +0 -28
  26. package/dist/ColorPicker.js +0 -6
  27. package/dist/Component-BgifJdKl.js +0 -401
  28. package/dist/Component-DXwYPoSo.d.ts +0 -226
  29. package/dist/ContextMenu-wqGGgAzp.js +0 -197
  30. package/dist/DateTimeButton-D7N8XG0S.js +0 -38
  31. package/dist/DateTimeButton-DfJL5kvr.d.ts +0 -16
  32. package/dist/DateTimeButtonRange-BM_J646m.js +0 -71
  33. package/dist/DateTimeButtonRange.d.ts +0 -19
  34. package/dist/DateTimeButtonRange.js +0 -15
  35. package/dist/DateTimeButtonSingle-BxMSitQG.js +0 -48
  36. package/dist/DateTimeButtonSingle.d.ts +0 -17
  37. package/dist/DateTimeButtonSingle.js +0 -14
  38. package/dist/DateTimePicker-BgTi-DY9.js +0 -532
  39. package/dist/DateTimePicker.d.ts +0 -69
  40. package/dist/DateTimePicker.js +0 -13
  41. package/dist/EllipsisMenu-CxJ0LoVm.js +0 -116
  42. package/dist/EllipsisMenu.d.ts +0 -20
  43. package/dist/EllipsisMenu.js +0 -6
  44. package/dist/Enums-DWpaQlXk.d.ts +0 -12
  45. package/dist/EventsTable-CsnBvvIW.js +0 -553
  46. package/dist/EventsTable.d.ts +0 -34
  47. package/dist/EventsTable.js +0 -10
  48. package/dist/GeoProcessGraphic-CUBMHIHX.js +0 -145
  49. package/dist/GeoProcessGraphic.d.ts +0 -34
  50. package/dist/GeoProcessGraphic.js +0 -7
  51. package/dist/Grid-uoHKTet9.js +0 -874
  52. package/dist/Grid.d.ts +0 -43
  53. package/dist/Grid.js +0 -6
  54. package/dist/GroupedBarChart-Bc3cGhgz.js +0 -579
  55. package/dist/GroupedBarChart.d.ts +0 -22
  56. package/dist/GroupedBarChart.js +0 -17
  57. package/dist/GroupedBarChartData-B7BTM9JH.d.ts +0 -20
  58. package/dist/GroupedBarChartData-Ml5JJimg.js +0 -121
  59. package/dist/Heatmap-5gFc_AVW.js +0 -524
  60. package/dist/Heatmap.d.ts +0 -31
  61. package/dist/Heatmap.js +0 -14
  62. package/dist/Hierarchy-C5ueDsus.js +0 -260
  63. package/dist/Hierarchy.d.ts +0 -39
  64. package/dist/Hierarchy.js +0 -6
  65. package/dist/HierarchyNavigation-C3Pwt0D6.js +0 -336
  66. package/dist/HierarchyNavigation.d.ts +0 -34
  67. package/dist/HierarchyNavigation.js +0 -6
  68. package/dist/HistoryPlayback-D09bter3.js +0 -175
  69. package/dist/HistoryPlayback-DmJ6u7lU.d.ts +0 -68
  70. package/dist/Interfaces-R_1l9lIT.d.ts +0 -6
  71. package/dist/Legend-gCIrAytG.js +0 -497
  72. package/dist/LineChart-CzDp5ULB.js +0 -3181
  73. package/dist/LineChart.d.ts +0 -163
  74. package/dist/LineChart.js +0 -18
  75. package/dist/ModelAutocomplete-lU71Ndju.js +0 -100
  76. package/dist/ModelAutocomplete.d.ts +0 -12
  77. package/dist/ModelAutocomplete.js +0 -7
  78. package/dist/ModelSearch-OF4DygOJ.js +0 -189
  79. package/dist/ModelSearch.d.ts +0 -23
  80. package/dist/ModelSearch.js +0 -9
  81. package/dist/PieChart-XLc9Itne.js +0 -258
  82. package/dist/PieChart.d.ts +0 -26
  83. package/dist/PieChart.js +0 -17
  84. package/dist/PlaybackControls-DbG9gExy.js +0 -195
  85. package/dist/PlaybackControls.d.ts +0 -39
  86. package/dist/PlaybackControls.js +0 -13
  87. package/dist/ProcessGraphic-Cft1b4Mf.js +0 -154
  88. package/dist/ProcessGraphic.d.ts +0 -31
  89. package/dist/ProcessGraphic.js +0 -7
  90. package/dist/ScatterPlot-CdnqSHq2.js +0 -924
  91. package/dist/ScatterPlot.d.ts +0 -115
  92. package/dist/ScatterPlot.js +0 -17
  93. package/dist/SingleDateTimePicker-Ddr-ogTk.js +0 -213
  94. package/dist/SingleDateTimePicker.d.ts +0 -45
  95. package/dist/SingleDateTimePicker.js +0 -12
  96. package/dist/Slider-CX0nvlqx.js +0 -186
  97. package/dist/Slider.d.ts +0 -31
  98. package/dist/Slider.js +0 -6
  99. package/dist/TemporalXAxisComponent-DXmMekYq.js +0 -129
  100. package/dist/TemporalXAxisComponent-PIeiJYUr.d.ts +0 -23
  101. package/dist/TimezonePicker-CQpXR5eb.js +0 -58
  102. package/dist/TimezonePicker.d.ts +0 -16
  103. package/dist/TimezonePicker.js +0 -10
  104. package/dist/Tooltip-C13k0eeH.js +0 -104
  105. package/dist/TsqExpression.d.ts +0 -36
  106. package/dist/TsqExpression.js +0 -89
  107. package/dist/UXClient-Bn1afElm.js +0 -230
  108. package/dist/UXClient.d.ts +0 -74
  109. package/dist/UXClient.js +0 -47
  110. package/dist/Utils-BcQeZOM3.d.ts +0 -104
  111. package/dist/Utils-DDGqSryb.js +0 -1138
  112. package/dist/Utils.d.ts +0 -7
  113. package/dist/Utils.js +0 -7
  114. package/dist/_tslib-BYFmvNeL.js +0 -96
  115. package/dist/pikaday-jh_aVtJs.js +0 -1252
  116. package/dist/tsiclient.cjs.js +0 -3
  117. package/dist/tsiclient.cjs.js.LICENSE.txt +0 -19
  118. package/dist/tsiclient.cjs.js.map +0 -1
  119. package/dist/tsiclient.d.ts +0 -46
  120. package/dist/tsiclient.esm.js +0 -3
  121. package/dist/tsiclient.esm.js.LICENSE.txt +0 -19
  122. package/dist/tsiclient.esm.js.map +0 -1
  123. package/dist/tsiclient.js +0 -58
  124. package/dist/tsiclient.min.css +0 -6
  125. package/dist/tsiclient.min.css.map +0 -1
  126. package/dist/tsiclient.umd.js +0 -3
  127. package/dist/tsiclient.umd.js.LICENSE.txt +0 -19
  128. package/dist/tsiclient.umd.js.map +0 -1
  129. package/dist/tsiclient.umd.min.js +0 -3
  130. package/dist/tsiclient.umd.min.js.LICENSE.txt +0 -19
  131. package/dist/tsiclient.umd.min.js.map +0 -1
  132. package/tsiclient.css +0 -17323
  133. package/tsiclient.d.ts +0 -46
  134. package/tsiclient.js +0 -58
  135. package/tsiclient.min.css +0 -6
@@ -1,524 +0,0 @@
1
- import { _ as __extends, a as __assign } from './_tslib-BYFmvNeL.js';
2
- import * as d3 from 'd3';
3
- import { U as Utils } from './Utils-DDGqSryb.js';
4
- import { L as Legend } from './Legend-gCIrAytG.js';
5
- import { C as ChartComponent } from './ChartComponent-Dg8P-BTZ.js';
6
- import { T as TemporalXAxisComponent } from './TemporalXAxisComponent-DXmMekYq.js';
7
- import { E as EllipsisMenu } from './EllipsisMenu-CxJ0LoVm.js';
8
-
9
- var HeatmapData = /** @class */ (function () {
10
- function HeatmapData(chartComponentData, aggKey) {
11
- var _this = this;
12
- this.visibleSBs = [];
13
- this.timeStamps = [];
14
- this.numRows = 0;
15
- this.numCols = 0;
16
- this.aggKey = aggKey;
17
- this.chartComponentData = chartComponentData;
18
- this.chartComponentData.isFromHeatmap = true;
19
- this.visibleSBs = Object.keys(this.chartComponentData.displayState[aggKey].splitBys).filter(function (sb) {
20
- return (_this.chartComponentData.getSplitByVisible(aggKey, sb));
21
- });
22
- this.numRows = this.visibleSBs.length;
23
- this.from = new Date(chartComponentData.displayState[aggKey].aggregateExpression.searchSpan.from);
24
- this.to = new Date(chartComponentData.displayState[aggKey].aggregateExpression.searchSpan.to);
25
- this.bucketSize = Utils.parseTimeInput(chartComponentData.displayState[aggKey].aggregateExpression.searchSpan.bucketSize);
26
- this.createTimeValues();
27
- }
28
- HeatmapData.prototype.adjustStartTime = function () {
29
- return new Date(Utils.adjustStartMillisToAbsoluteZero(new Date(this.from).valueOf(), this.bucketSize));
30
- };
31
- HeatmapData.prototype.createTimeValues = function () {
32
- var _this = this;
33
- this.timeValues = {};
34
- this.allValues = [];
35
- //turn time array into an object keyed by timestamp
36
- var colI = 0;
37
- var adjustedStartTime = this.adjustStartTime();
38
- for (var currTime = adjustedStartTime; (currTime.valueOf() < this.to.valueOf()); currTime = new Date(currTime.valueOf() + this.bucketSize)) {
39
- this.timeValues[currTime.toISOString()] = this.visibleSBs.reduce(function (obj, splitBy, splitByI) {
40
- obj[splitBy] = {
41
- colI: colI,
42
- rowI: splitByI,
43
- value: null
44
- };
45
- return obj;
46
- }, {});
47
- colI += 1;
48
- }
49
- this.numCols = Object.keys(this.timeValues).length;
50
- this.visibleSBs.forEach(function (splitBy, rowI) {
51
- _this.chartComponentData.timeArrays[_this.aggKey][splitBy].forEach(function (valueObject, colI) {
52
- var timestamp = new Date(valueObject.dateTime.valueOf()).toISOString();
53
- var visibleMeasure = _this.chartComponentData.getVisibleMeasure(_this.aggKey, splitBy);
54
- if (_this.timeValues[timestamp]) {
55
- _this.timeValues[timestamp][splitBy].value = valueObject.measures ? valueObject.measures[visibleMeasure] : null;
56
- if (Utils.safeNotNullOrUndefined(function () { return valueObject.measures[visibleMeasure]; }))
57
- _this.allValues.push(valueObject.measures[visibleMeasure]);
58
- }
59
- });
60
- });
61
- };
62
- return HeatmapData;
63
- }());
64
-
65
- var HeatmapCanvas = /** @class */ (function (_super) {
66
- __extends(HeatmapCanvas, _super);
67
- function HeatmapCanvas(renderTarget) {
68
- var _this = _super.call(this, renderTarget) || this;
69
- _this.gradientWidth = 8;
70
- _this.focusedXIndex = -1;
71
- _this.focusedYIndex = -1;
72
- _this.legendWidth = 80;
73
- return _this;
74
- }
75
- HeatmapCanvas.prototype.renderScale = function (aggColor, isOnlyAgg) {
76
- var _this = this;
77
- this.colorLegend.selectAll("*").remove();
78
- if (this.colorScale.domain() === null || isNaN(this.colorScale.domain()[0]) || isNaN(this.colorScale.domain()[1])) {
79
- return;
80
- }
81
- var gradientGuid = Utils.guid();
82
- var gradient = this.colorLegend.append("defs")
83
- .append("linearGradient")
84
- .attr("id", "gradient" + this.aggI + gradientGuid)
85
- .attr("x1", "0%")
86
- .attr("y1", "100%")
87
- .attr("x2", "0%")
88
- .attr("y2", "0%");
89
- var percentileCalc = function (i) { return i * (_this.colorScale.domain()[1] - _this.colorScale.domain()[0]) + _this.colorScale.domain()[0]; };
90
- for (var i = 0; i <= 20; i++) {
91
- var color = this.getColor(aggColor, percentileCalc(i / 20), isOnlyAgg);
92
- gradient.append("stop")
93
- .attr("offset", (i * 5) + "%")
94
- .attr("stop-color", color)
95
- .attr("stop-opacity", 1);
96
- }
97
- var gradientRect = this.colorLegend.append("rect")
98
- .attr("x", this.legendWidth - this.gradientWidth)
99
- .attr("y", 6)
100
- .attr("width", this.gradientWidth)
101
- .attr("height", Math.max(0, this.height - 12))
102
- .style("fill", "url(#gradient" + String(this.aggI) + gradientGuid + ")");
103
- var highlightedValueY = null;
104
- var range = this.colorScale.domain()[1] - this.colorScale.domain()[0];
105
- var highlightedText = this.colorLegend.append("text").attr("class", "highlightedValueText");
106
- var highlightedLine = this.colorLegend.append("line").attr("class", "highlightedValueLine");
107
- var minText = this.colorLegend.append("text");
108
- var maxText = this.colorLegend.append("text");
109
- var setHighlightedValueLineAndText = function (line, text) {
110
- var percentile;
111
- if (range == 0) {
112
- percentile = .5;
113
- }
114
- else {
115
- percentile = (_this.highlightedValue != null) ? (_this.highlightedValue - _this.colorScale.domain()[0]) / range : 0;
116
- }
117
- highlightedValueY = (_this.height - 6) + (12 - _this.height) * percentile;
118
- text.attr("x", _this.legendWidth - _this.gradientWidth - 10)
119
- .attr("y", highlightedValueY)
120
- .style("stroke-width", 2)
121
- .text(Utils.formatYAxisNumber(_this.highlightedValue));
122
- line.attr("x1", _this.legendWidth - _this.gradientWidth - 5)
123
- .attr("x2", _this.legendWidth)
124
- .attr("y1", highlightedValueY)
125
- .attr("y2", highlightedValueY)
126
- .style("stroke-width", 2);
127
- minText.attr("fill-opacity", ((highlightedValueY == null) || highlightedValueY < _this.height - 18) ? 1 : 0);
128
- maxText.attr("fill-opacity", ((highlightedValueY == null) || highlightedValueY > 18) ? 1 : 0);
129
- };
130
- minText.attr("x", this.legendWidth - this.gradientWidth - 5)
131
- .attr("y", this.height - 6)
132
- .text(Utils.formatYAxisNumber(this.colorScale.domain()[0]))
133
- .attr("fill-width", ((highlightedValueY == null) || highlightedValueY < this.height - 18) ? 1 : 0);
134
- maxText.attr("x", this.legendWidth - this.gradientWidth - 5)
135
- .attr("y", 6)
136
- .text(Utils.formatYAxisNumber(this.colorScale.domain()[1]))
137
- .attr("fill-opacity", ((highlightedValueY == null) || highlightedValueY > 18) ? 1 : 0);
138
- //render highlightedValue text and line IF there is a highlighted time and split by, OR IF there is an
139
- // artificially produced value from hovering over the color gradient
140
- if (this.highlightedTime && this.highlightedSplitBy != null && this.highlightedValue != null) {
141
- setHighlightedValueLineAndText(highlightedLine, highlightedText);
142
- minText.attr("fill-opacity", ((highlightedValueY == null) || highlightedValueY < this.height - 18) ? 1 : 0);
143
- maxText.attr("fill-opacity", ((highlightedValueY == null) || highlightedValueY > 18) ? 1 : 0);
144
- }
145
- var self = this;
146
- gradientRect.on("mousemove", function (event) {
147
- var yPos = d3.pointer(event)[1];
148
- var percentile = 1 - ((yPos - 6) / (self.height - 12));
149
- self.highlightedValue = self.colorScale.domain()[0] + (range * percentile);
150
- setHighlightedValueLineAndText(highlightedLine, highlightedText);
151
- })
152
- .on("mouseleave", function () {
153
- _this.render(_this.data, _this.chartOptions, _this.aggKey, null, null, _this.onCellFocus, null, _this.isOnlyAgg);
154
- });
155
- };
156
- HeatmapCanvas.prototype.getExtent = function () {
157
- var rawExtent = d3.extent(this.heatmapData.allValues);
158
- var extent = rawExtent;
159
- if (rawExtent[0] === rawExtent[1]) {
160
- extent = [rawExtent[0] - .05, rawExtent[1] + .05];
161
- }
162
- return extent;
163
- };
164
- HeatmapCanvas.prototype.render = function (data, chartOptions, aggKey, highlightedSplitBy, highlightedTime, onCellFocus, aggI, isOnlyAgg) {
165
- var _this = this;
166
- if (highlightedSplitBy === void 0) { highlightedSplitBy = null; }
167
- if (highlightedTime === void 0) { highlightedTime = null; }
168
- this.chartOptions.setOptions(chartOptions);
169
- this.aggKey = aggKey;
170
- this.data = data;
171
- this.isOnlyAgg = isOnlyAgg;
172
- if (aggI != null) {
173
- this.aggI = aggI;
174
- }
175
- this.heatmapData = new HeatmapData(data, aggKey);
176
- var container = d3.select(this.renderTarget).classed("tsi-heatmapCanvasWrapper", true);
177
- _super.prototype.themify.call(this, container, this.chartOptions.theme);
178
- if (highlightedSplitBy != null)
179
- this.highlightedSplitBy = highlightedSplitBy;
180
- this.highlightedTime = highlightedTime;
181
- if (this.highlightedSplitBy != null && this.highlightedTime) {
182
- if (this.heatmapData.timeValues[this.highlightedTime.toISOString()][this.highlightedSplitBy] != null) {
183
- this.highlightedValue = this.heatmapData.timeValues[this.highlightedTime.toISOString()][this.highlightedSplitBy].value;
184
- }
185
- }
186
- if (onCellFocus)
187
- this.onCellFocus = onCellFocus;
188
- if (!container.select("canvas").empty())
189
- this.canvas = container.select("canvas");
190
- else
191
- this.canvas = container.append("canvas").attr("class", "tsi-heatmapCanvas");
192
- this.width = Math.floor(container.node().getBoundingClientRect().width - this.legendWidth - 10);
193
- this.height = Math.floor(container.node().getBoundingClientRect().height);
194
- this.canvas.attr("width", this.width);
195
- this.canvas.attr("height", this.height);
196
- this.ctx = this.canvas.node().getContext("2d");
197
- this.ctx.clearRect(0, 0, this.width, this.height);
198
- container.selectAll("svg").remove();
199
- var self = this;
200
- this.canvas.on("mousemove", function (event) {
201
- var mouseCoords = d3.pointer(event);
202
- var indexesChanged = false;
203
- var newXIndex = self.calcCellXIndex(mouseCoords[0]);
204
- var newYIndex = self.calcCellYIndex(mouseCoords[1]);
205
- var visibleSplitBys = Object.keys(self.data.displayState[aggKey].splitBys).filter(function (splitBy) {
206
- return self.data.isSplitByVisible(self.aggKey, splitBy);
207
- });
208
- if (newXIndex != self.focusedXIndex) {
209
- self.focusedXIndex = newXIndex;
210
- indexesChanged = true;
211
- }
212
- if (newYIndex != self.focusedYIndex) {
213
- self.focusedYIndex = newYIndex;
214
- indexesChanged = true;
215
- }
216
- var highlightedSplitBy = visibleSplitBys[self.focusedYIndex];
217
- if (indexesChanged && self.focusedXIndex >= 0 && self.focusedYIndex >= 0) {
218
- var cellX = self.calcCellX(self.focusedXIndex);
219
- var sortedDates = Object.keys(self.heatmapData.timeValues)
220
- .sort(function (a, b) {
221
- return ((new Date(a)).valueOf() < (new Date(b)).valueOf()) ? -1 : 1;
222
- });
223
- var startDate = new Date(sortedDates[self.focusedXIndex]);
224
- this.highlightedTime = startDate;
225
- self.onCellFocus(startDate, new Date(startDate.valueOf() + self.heatmapData.bucketSize), Math.max(0, cellX), cellX + self.calcCellWidth(self.focusedXIndex), self.calcCellY(self.focusedYIndex), highlightedSplitBy);
226
- }
227
- self.render(self.data, self.chartOptions, self.aggKey, highlightedSplitBy, this.highlightedTime, self.onCellFocus, null, self.isOnlyAgg);
228
- }).on("mouseout", function () {
229
- self.focusedXIndex = -1;
230
- self.focusedYIndex = -1;
231
- self.render(self.data, self.chartOptions, self.aggKey, null, null, self.onCellFocus, null, self.isOnlyAgg);
232
- });
233
- this.aggKey = aggKey;
234
- this.rawCellHeight = Math.floor(this.height / this.heatmapData.numRows);
235
- this.cellHeightMod = this.height % this.heatmapData.numRows;
236
- this.rawCellWidth = this.width / this.heatmapData.numCols;
237
- this.cellWidthMod = this.width % this.heatmapData.numCols;
238
- this.colorLegend = container.append("svg").attr("class", "tsi-heatmapColorLegend");
239
- this.colorLegend.attr("width", this.legendWidth)
240
- .attr("height", this.height)
241
- .style("left", (this.width) + "px");
242
- var aggColor = data.displayState[aggKey].color;
243
- if (isOnlyAgg) {
244
- this.colorScale = d3.scaleSequential(d3.interpolateViridis).domain(this.getExtent());
245
- }
246
- else {
247
- this.colorScale = d3.scaleLinear().domain(this.getExtent())
248
- .range([d3.hcl(aggColor).brighter().l, d3.hcl(aggColor).darker().l]);
249
- }
250
- this.renderScale(aggColor, isOnlyAgg);
251
- var sortedTimes = Object.keys(this.heatmapData.timeValues).sort(function (a, b) {
252
- return ((new Date(a)).valueOf() < (new Date(b)).valueOf()) ? -1 : 1;
253
- });
254
- sortedTimes.forEach(function (ts, tsI) {
255
- Object.keys(_this.heatmapData.timeValues[ts]).forEach(function (splitBy, sBI) {
256
- var cellData = _this.heatmapData.timeValues[ts][splitBy];
257
- if (cellData != null) {
258
- if (highlightedSplitBy && highlightedSplitBy != splitBy) {
259
- _this.drawCell(cellData.rowI, cellData.colI, cellData.value, aggColor, isOnlyAgg, true);
260
- }
261
- else {
262
- _this.drawCell(cellData.rowI, cellData.colI, cellData.value, aggColor, isOnlyAgg);
263
- }
264
- }
265
- });
266
- });
267
- };
268
- HeatmapCanvas.prototype.calcCellXIndex = function (x) {
269
- var xI = 0;
270
- while (Math.round(xI * this.rawCellWidth) < x) {
271
- xI++;
272
- }
273
- return Math.max(xI - 1, 0);
274
- };
275
- HeatmapCanvas.prototype.calcCellYIndex = function (y) {
276
- if (y < (this.cellHeightMod * (this.rawCellHeight + 1)))
277
- return Math.floor(y / (this.rawCellHeight + 1));
278
- var modOffset = this.cellHeightMod * (this.rawCellHeight + 1);
279
- return Math.floor((y - modOffset) / this.rawCellHeight) + this.cellHeightMod;
280
- };
281
- HeatmapCanvas.prototype.calcCellHeight = function (i) {
282
- return this.rawCellHeight + (i < this.cellHeightMod ? 1 : 0) - (this.rawCellWidth > 10 ? 1 : 0);
283
- };
284
- HeatmapCanvas.prototype.calcCellX = function (i) {
285
- return Math.round(this.rawCellWidth * i);
286
- };
287
- HeatmapCanvas.prototype.calcCellWidth = function (i) {
288
- return (Math.round(this.rawCellWidth * (i + 1)) - Math.round(this.rawCellWidth * i) - (this.rawCellWidth > 10 ? 1 : 0));
289
- };
290
- HeatmapCanvas.prototype.calcCellY = function (i) {
291
- return Math.min(i, this.cellHeightMod) + (this.rawCellHeight * i);
292
- };
293
- HeatmapCanvas.prototype.drawCell = function (rowI, colI, value, aggColor, isOnlyAgg, outOfFocus) {
294
- if (outOfFocus === void 0) { outOfFocus = false; }
295
- this.calcCellX(colI);
296
- this.calcCellY(rowI);
297
- this.ctx.fillStyle = value !== null ? this.getColor(aggColor, value, isOnlyAgg) : "transparent";
298
- this.ctx.globalAlpha = outOfFocus ? .3 : 1;
299
- this.ctx.fillRect(this.calcCellX(colI), this.calcCellY(rowI), this.calcCellWidth(colI), this.calcCellHeight(rowI));
300
- };
301
- HeatmapCanvas.prototype.getColor = function (aggColor, index, isOnlyAgg) {
302
- var color;
303
- if (isOnlyAgg) {
304
- color = this.colorScale(index);
305
- }
306
- else {
307
- var interpolatedColorLuminance = this.colorScale(index);
308
- var newColor = d3.hcl(aggColor);
309
- newColor.l = interpolatedColorLuminance;
310
- color = newColor.formatHex();
311
- }
312
- return color;
313
- };
314
- return HeatmapCanvas;
315
- }(ChartComponent));
316
-
317
- var Heatmap = /** @class */ (function (_super) {
318
- __extends(Heatmap, _super);
319
- function Heatmap(renderTarget) {
320
- var _this = _super.call(this, renderTarget) || this;
321
- _this.lineHeight = 12;
322
- _this.splitByLabelWidth = 140;
323
- _this.timeLabels = null;
324
- _this.timeLabelsHeight = 52;
325
- _this.visibleAggs = null;
326
- _this.mouseover = function (hoveredAggKey, hoveredSplitBy) {
327
- var heatmapCanvas = _this.heatmapCanvasMap[hoveredAggKey];
328
- if (heatmapCanvas)
329
- heatmapCanvas.render(_this.chartComponentData, _this.chartOptions, hoveredAggKey, hoveredSplitBy, null, null, null, _this.visibleAggs.length === 1);
330
- };
331
- _this.mouseout = function (selection, hoveredAggKey) {
332
- var heatmapCanvas = _this.heatmapCanvasMap[hoveredAggKey];
333
- if (heatmapCanvas)
334
- heatmapCanvas.render(_this.chartComponentData, _this.chartOptions, hoveredAggKey, null, null, null, null, _this.visibleAggs.length === 1);
335
- };
336
- _this.renderTimeLabels = function (focusStartTime, focusEndTime, focusX1, focusX2, focusY, yOffset, shiftMillis) {
337
- _this.timeLabels.selectAll(".tsi-heatmapTimeLabels").remove();
338
- _this.timeLabels.node().parentNode.appendChild(_this.timeLabels.node());
339
- _this.timeLabels.append("line").attr("class", "tsi-heatmapFocusLine tsi-heatmapTimeLabels")
340
- .attr("x1", focusX1)
341
- .attr("x2", focusX1)
342
- .attr("y1", focusY + yOffset)
343
- .attr("y2", _this.chartHeight - _this.timeLabelsHeight);
344
- _this.timeLabels.append("line").attr("class", "tsi-heatmapFocusLine tsi-heatmapTimeLabels")
345
- .attr("x1", focusX2)
346
- .attr("x2", focusX2)
347
- .attr("y1", focusY + yOffset)
348
- .attr("y2", _this.chartHeight - _this.timeLabelsHeight);
349
- var textBoxG = _this.timeLabels.append("g")
350
- .attr("class", "tsi-heatmapTimeLabelTextBox tsi-heatmapTimeLabels");
351
- var text = textBoxG.append("text");
352
- text.append("tspan").text(Utils.timeFormat(_this.chartComponentData.usesSeconds, _this.chartComponentData.usesMillis, _this.chartOptions.offset, _this.chartOptions.is24HourTime, shiftMillis, null, _this.chartOptions.dateLocale)(focusStartTime))
353
- .attr("x", 0)
354
- .attr("y", 16);
355
- text.append("tspan").text(Utils.timeFormat(_this.chartComponentData.usesSeconds, _this.chartComponentData.usesMillis, _this.chartOptions.offset, _this.chartOptions.is24HourTime, shiftMillis, null, _this.chartOptions.dateLocale)(focusEndTime))
356
- .attr("x", 0)
357
- .attr("y", 30);
358
- var textDimensions = text.node().getBoundingClientRect();
359
- textBoxG.append("rect")
360
- .attr("x", -(textDimensions.width / 2) - 5)
361
- .attr("y", 0)
362
- .attr("height", textDimensions.height + 12)
363
- .attr("width", textDimensions.width + 10);
364
- text.node().parentNode.appendChild(text.node());
365
- var rawOffset = (focusX1 + focusX2) / 2;
366
- var leftOffset = Math.floor(((rawOffset - ((textDimensions.width / 2) + 6)) > 0) ? rawOffset : ((textDimensions.width / 2) + 6));
367
- textBoxG.attr("transform", "translate(" + leftOffset + "," + (_this.chartHeight - _this.timeLabelsHeight - _this.chartMargins.bottom) + ")");
368
- };
369
- _this.chartMargins = {
370
- top: 0,
371
- bottom: 8,
372
- left: 40,
373
- right: 20
374
- };
375
- return _this;
376
- }
377
- Heatmap.prototype.focusOnEllipsis = function () {
378
- if (this.ellipsisContainer !== null) {
379
- this.ellipsisContainer.select(".tsi-ellipsisButton").node().focus();
380
- }
381
- };
382
- Heatmap.prototype.createControlsPanel = function () {
383
- this.chartControlsPanel = Utils.createControlPanel(this.renderTarget, this.CONTROLSWIDTH, 52, this.chartOptions);
384
- this.ellipsisContainer = this.chartControlsPanel.append("div")
385
- .attr("class", "tsi-ellipsisContainerDiv");
386
- this.ellipsisMenu = new EllipsisMenu(this.ellipsisContainer.node());
387
- };
388
- Heatmap.prototype.chartControlsExist = function () {
389
- return (this.ellipsisItemsExist() && !this.chartOptions.hideChartControlPanel);
390
- };
391
- Heatmap.prototype.addTimeLabels = function () {
392
- if (this.timeLabels === null || this.svgSelection === null) {
393
- this.svgSelection = this.heatmapWrapper.append('svg')
394
- .attr('class', 'tsi-heatmapSVG')
395
- .attr('title', this.getString('Heatmap'));
396
- this.timeLabels = this.svgSelection.append('g').attr("class", "tsi-heatmapTimeLabels")
397
- .attr('transform', 'translate(' + this.chartMargins.left + ',0)');
398
- }
399
- if (!this.chartOptions.xAxisHidden) {
400
- this.xAxis = this.timeLabels.selectAll(".xAxis").data([this.x]);
401
- this.drawXAxis(this.chartHeight - 60);
402
- this.xAxis.exit().remove();
403
- var xAxisBaseline = this.timeLabels.selectAll(".xAxisBaseline").data([this.x]);
404
- xAxisBaseline.enter().append("line")
405
- .attr("class", "xAxisBaseline")
406
- .attr("x1", .5)
407
- .merge(xAxisBaseline)
408
- .attr("y2", this.chartHeight - (this.chartMargins.bottom + this.timeLabelsHeight))
409
- .attr("y1", this.chartHeight - (this.chartMargins.bottom + this.timeLabelsHeight))
410
- .attr("x2", this.chartWidth - 90);
411
- xAxisBaseline.exit().remove();
412
- }
413
- if (this.timeLabels.selectAll(".xAxis").size() !== 0) {
414
- this.timeLabels.selectAll(".xAxis").style("visibility", ((!this.chartOptions.xAxisHidden) ? "visible" : "hidden"));
415
- }
416
- };
417
- Heatmap.prototype.render = function (data, chartOptions, aggregateExpressionOptions) {
418
- var _this = this;
419
- _super.prototype.render.call(this, data, chartOptions, aggregateExpressionOptions);
420
- // override visibleSplitByCap
421
- this.aggregateExpressionOptions = this.aggregateExpressionOptions.map(function (aE) {
422
- return __assign(__assign({}, aE), { visibleSplitByCap: 10000 });
423
- });
424
- this.chartOptions.setOptions(chartOptions);
425
- var targetElement = d3.select(this.renderTarget).classed("tsi-heatmapComponent", true);
426
- if (targetElement.style("position") == "static")
427
- targetElement.style("position", "relative");
428
- this.chartComponentData.mergeDataToDisplayStateAndTimeArrays(this.data, this.aggregateExpressionOptions);
429
- if (this.chartControlsExist() && this.chartControlsPanel === null) {
430
- this.createControlsPanel();
431
- }
432
- else if ((this.chartOptions.hideChartControlPanel || !this.ellipsisItemsExist()) && this.chartControlsPanel !== null) {
433
- this.chartControlsPanel.remove();
434
- this.chartControlsPanel = null;
435
- }
436
- if (this.chartControlsExist()) {
437
- this.chartControlsPanel.style("top", (16 + (this.chartOptions.legend === 'compact' ? 32 : 0)) + 'px');
438
- this.drawEllipsisMenu();
439
- }
440
- if (this.heatmapWrapper == null) {
441
- this.heatmapWrapper = targetElement.append('div')
442
- .attr("class", "tsi-heatmapWrapper");
443
- this.draw = function (isFromResize) {
444
- if (isFromResize === void 0) { isFromResize = false; }
445
- _this.height = Math.floor(Math.max(d3.select(_this.renderTarget).node().clientHeight, _this.MINHEIGHT));
446
- _this.chartHeight = _this.height - ((12 + (_this.chartControlsExist() ? 28 : 0) + (_this.chartOptions.legend === 'compact' ? 48 : 0)));
447
- _super.prototype.themify.call(_this, targetElement, _this.chartOptions.theme);
448
- _this.width = _this.getWidth();
449
- if (!isFromResize) {
450
- _this.chartWidth = _this.getChartWidth();
451
- }
452
- _this.x = d3.scaleTime()
453
- .rangeRound([0, _this.chartWidth - 90]); // HARDCODED to be the width of a heatmapCanvas
454
- var fromAndTo = _this.chartComponentData.setAllValuesAndVisibleTAs();
455
- _this.x.domain(fromAndTo);
456
- _this.heatmapWrapper.style("width", _this.chartWidth + (_this.chartMargins.left + _this.chartMargins.right) + "px")
457
- .style("height", _this.chartHeight + "px")
458
- .style("top", (20 + (_this.chartControlsExist() ? 36 : 0) + (_this.chartOptions.legend === 'compact' ? 40 : 0)) + "px");
459
- if (_this.chartControlsExist()) {
460
- _this.setControlsPanelWidth();
461
- }
462
- var canvasWrapperHeightTotal = _this.chartHeight - _this.timeLabelsHeight - _this.chartMargins.bottom;
463
- _this.heatmapCanvasMap = {};
464
- _this.visibleAggs = Object.keys(_this.chartComponentData.displayState).filter(function (aggKey) {
465
- return _this.chartComponentData.getAggVisible(aggKey);
466
- });
467
- var self = _this;
468
- var canvasWrappers = _this.heatmapWrapper.selectAll(".tsi-heatmapCanvasWrapper")
469
- .data(_this.visibleAggs);
470
- canvasWrappers.enter()
471
- .append("div")
472
- .merge(canvasWrappers)
473
- .attr("class", "tsi-heatmapCanvasWrapper")
474
- .style("width", _this.chartWidth + 'px')
475
- .style('left', _this.chartMargins.left + 'px')
476
- .style("height", function (d, i) {
477
- return (canvasWrapperHeightTotal * (1 / _this.visibleAggs.length)) + "px";
478
- })
479
- .style("top", function (d, i) {
480
- return ((canvasWrapperHeightTotal * (1 / _this.visibleAggs.length)) * i) + "px";
481
- }).each(function (aggKey, aggI) {
482
- var heatmapCanvas = new HeatmapCanvas(this);
483
- self.heatmapCanvasMap[aggKey] = heatmapCanvas;
484
- var renderHeatmapCanvas = function () {
485
- function onCellFocus(focusStartTime, focusEndTime, focusX1, focusX2, focusY, splitBy) {
486
- var shiftMillis = self.chartComponentData.getTemporalShiftMillis(aggKey);
487
- self.renderTimeLabels(focusStartTime, focusEndTime, focusX1, focusX2, focusY, (aggI * canvasWrapperHeightTotal / self.visibleAggs.length), shiftMillis);
488
- self.legendObject.triggerSplitByFocus(aggKey, splitBy);
489
- self.chartOptions.onMouseover(aggKey, splitBy);
490
- }
491
- heatmapCanvas.render(self.chartComponentData, self.chartOptions, aggKey, null, null, onCellFocus, aggI, self.visibleAggs.length === 1);
492
- };
493
- renderHeatmapCanvas();
494
- }).on("mouseleave", function () {
495
- self.timeLabels.selectAll(".tsi-heatmapTimeLabels").remove();
496
- self.legendObject.legendElement.selectAll('.tsi-splitByLabel').classed("inFocus", false);
497
- self.chartOptions.onMouseout();
498
- });
499
- canvasWrappers.exit().remove();
500
- _this.legendObject.draw(_this.chartOptions.legend, _this.chartComponentData, _this.mouseover, _this.heatmapWrapper, _this.chartOptions, _this.mouseout);
501
- //remove all the colorKeys
502
- _this.legendObject.legendElement.selectAll(".seriesLabel").selectAll(".tsi-splitByLabel").selectAll(".colorKey").style("display", "none");
503
- if (isFromResize) {
504
- _this.addTimeLabels();
505
- }
506
- };
507
- this.legendObject = new Legend(this.draw, this.renderTarget, this.CONTROLSWIDTH);
508
- }
509
- this.chartComponentData.mergeDataToDisplayStateAndTimeArrays(this.data, this.aggregateExpressionOptions);
510
- this.draw();
511
- this.gatedShowGrid();
512
- this.addTimeLabels();
513
- window.addEventListener("resize", function () {
514
- if (!_this.chartOptions.suppressResizeListener) {
515
- _this.draw();
516
- _this.addTimeLabels();
517
- }
518
- });
519
- this.legendPostRenderProcess(this.chartOptions.legend, this.heatmapWrapper, true);
520
- };
521
- return Heatmap;
522
- }(TemporalXAxisComponent));
523
-
524
- export { Heatmap as H };
package/dist/Heatmap.d.ts DELETED
@@ -1,31 +0,0 @@
1
- import { T as TemporalXAxisComponent } from './TemporalXAxisComponent-PIeiJYUr.js';
2
- import './ChartVisualizationComponent-CpR8xZla.js';
3
- import './ChartComponent-ONNW31RL.js';
4
- import './Enums-DWpaQlXk.js';
5
- import './Component-DXwYPoSo.js';
6
- import './Interfaces-R_1l9lIT.js';
7
- import './ChartComponentData-DBW8_FnY.js';
8
- import './EllipsisMenu.js';
9
-
10
- declare class Heatmap extends TemporalXAxisComponent {
11
- private lineHeight;
12
- private splitByLabelWidth;
13
- private heatmapWrapper;
14
- private splitByLabels;
15
- private heatmapCanvasMap;
16
- private timeLabels;
17
- private height;
18
- private timeLabelsHeight;
19
- private visibleAggs;
20
- constructor(renderTarget: Element);
21
- private focusOnEllipsis;
22
- private createControlsPanel;
23
- private chartControlsExist;
24
- private addTimeLabels;
25
- mouseover: (hoveredAggKey: any, hoveredSplitBy: any) => void;
26
- mouseout: (selection: any, hoveredAggKey: any) => void;
27
- render(data: any, chartOptions: any, aggregateExpressionOptions: any): void;
28
- renderTimeLabels: (focusStartTime: any, focusEndTime: any, focusX1: any, focusX2: any, focusY: any, yOffset: any, shiftMillis: any) => void;
29
- }
30
-
31
- export { Heatmap as default };
package/dist/Heatmap.js DELETED
@@ -1,14 +0,0 @@
1
- export { H as default } from './Heatmap-5gFc_AVW.js';
2
- import './_tslib-BYFmvNeL.js';
3
- import 'd3';
4
- import './Utils-DDGqSryb.js';
5
- import 'moment-timezone';
6
- import './Legend-gCIrAytG.js';
7
- import './Component-BgifJdKl.js';
8
- import './ChartComponent-Dg8P-BTZ.js';
9
- import './Grid-uoHKTet9.js';
10
- import 'split.js';
11
- import './EllipsisMenu-CxJ0LoVm.js';
12
- import './TemporalXAxisComponent-DXmMekYq.js';
13
- import './ChartVisualizationComponent-CTs5Q_sg.js';
14
- import './ChartDataOptions-CNTSB636.js';