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
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+ Copyright (c) 2024 Alexander Sysoiev
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE
package/README.MD ADDED
@@ -0,0 +1,189 @@
1
+ # @tsichart/core - Time Series Interactive Charts
2
+
3
+ A powerful, flexible JavaScript library for visualizing time series data with **interactive** charts. Built with TypeScript and D3.js, this library provides a rich set of chart components including line charts, bar charts, pie charts, heatmaps, scatter plots, and more.
4
+
5
+ ## Features
6
+
7
+ ✨ **Rich Component Library** - 20+ pre-built, customizable chart components
8
+ 📊 **Interactive Visualizations** - Tooltips, zooming, panning, and dynamic data updates
9
+ 🎨 **Themeable** - Built-in light and dark themes with customization options
10
+ 📱 **Responsive** - Charts adapt to different screen sizes
11
+ 🎯 **TypeScript Support** - Full type definitions included
12
+ 🌳 **Tree-shakeable** - Import only the components you need
13
+ 📦 **Zero Configuration** - Works out of the box with sensible defaults
14
+
15
+ **Note:** This library is a community-maintained fork of the original Microsoft Time Series Insights Client, rebranded as **Time Series Interactive Charts** and updated for generic time series visualization use cases.
16
+
17
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/%40tsichart%2Fcore.svg)](https://badge.fury.io/js/@tsichart/core)
18
+
19
+ ## Installation
20
+
21
+ ### NPM
22
+
23
+ ```bash
24
+ npm install @tsichart/core
25
+ ```
26
+
27
+ ### Yarn
28
+
29
+ ```bash
30
+ yarn add @tsichart/core
31
+ ```
32
+
33
+ ### CDN
34
+
35
+ You can also load directly from a CDN:
36
+
37
+ ```html
38
+ <script src="https://unpkg.com/@tsichart/core@latest/tsiclient.js"></script>
39
+ <link rel="stylesheet" type="text/css" href="https://unpkg.com/@tsichart/core@latest/tsiclient.css">
40
+ ```
41
+
42
+ ## Quick Start
43
+
44
+ ### Import All Components
45
+
46
+ ```js
47
+ import TsiClient from "@tsichart/core";
48
+ import "@tsichart/core/tsiclient.css";
49
+
50
+ // Create a line chart
51
+ let tsiClient = new TsiClient();
52
+ let lineChart = new tsiClient.ux.LineChart(document.getElementById('chart'));
53
+
54
+ // Prepare your data
55
+ const data = [{
56
+ "Series1": {
57
+ "": {
58
+ "2023-01-01T00:00:00Z": { avg: 10 },
59
+ "2023-01-01T01:00:00Z": { avg: 15 },
60
+ "2023-01-01T02:00:00Z": { avg: 13 }
61
+ }
62
+ }
63
+ }];
64
+
65
+ // Render the chart
66
+ lineChart.render(data, { theme: 'light', legend: 'compact' });
67
+ ```
68
+
69
+ ### Import Individual Components (Recommended for Tree-shaking)
70
+
71
+ ```js
72
+ import LineChart from '@tsichart/core/LineChart';
73
+ import '@tsichart/core/tsiclient.css';
74
+
75
+ // Create and render chart
76
+ let lineChart = new LineChart(document.getElementById('chart'));
77
+ lineChart.render(data, { theme: 'light' });
78
+ ```
79
+
80
+ ## Available Components
81
+
82
+ **tsiclient** provides the following visualization components:
83
+
84
+ - **LineChart** - Render time series data as lines
85
+ - **BarChart** - Display time series data as bars with timestamp slider
86
+ - **PieChart** - Show time series data as pie charts with timestamp slider
87
+ - **Heatmap** - Visualize time series data as a heatmap
88
+ - **ScatterPlot** - Plot time series data points as a scatter plot
89
+ - **AvailabilityChart** - Display data availability over time
90
+ - **Grid** - Render time series data in a tabular format
91
+ - **Hierarchy** - Display hierarchical data structures
92
+ - **EventsTable** - Show events in a table format
93
+ - **DateTimePicker** - UI component for selecting date/time ranges
94
+ - **TimezonePicker** - UI component for timezone selection
95
+ - **Slider** - Time slider component
96
+ - **ModelSearch** - Search component for time series models
97
+ - **HierarchyNavigation** - Navigate hierarchical time series data
98
+ - **ProcessGraphic** - Display process graphics with data overlays
99
+ - **ColorPicker** - Color selection component
100
+ - And more...
101
+
102
+ For detailed usage examples and API documentation, see the [UX Components documentation](docs/UX.md).
103
+
104
+ ## Data Format
105
+
106
+ All components work with a consistent JSON data structure. Here's the basic format:
107
+
108
+ ```js
109
+ const data = [{
110
+ "SeriesName": {
111
+ "SplitByValue": { // Use empty string "" if no split
112
+ "2023-01-01T00:00:00Z": {
113
+ avg: 10, // Your metric values
114
+ min: 8,
115
+ max: 12
116
+ },
117
+ "2023-01-01T01:00:00Z": {
118
+ avg: 15,
119
+ min: 13,
120
+ max: 17
121
+ }
122
+ }
123
+ }
124
+ }];
125
+ ```
126
+
127
+ **You are responsible for:**
128
+ - Fetching time series data from your data source (API, database, etc.)
129
+ - Transforming your data into the expected format
130
+ - Handling any authentication/authorization
131
+
132
+ See the [UX Components documentation](docs/UX.md) for detailed format specifications for each chart type.
133
+
134
+ ## Resources
135
+
136
+ * [Full API Documentation](docs/UX.md)
137
+ * [Live Examples](pages/examples/) - Check the `pages/examples/` directory for working examples
138
+
139
+
140
+ ## Contributing
141
+
142
+ Contributions are welcome! This is a community-maintained project. Please feel free to:
143
+
144
+ - Report bugs and request features via [GitHub Issues](https://github.com/yourusername/tsichart-core/issues)
145
+ - Submit pull requests
146
+ - Improve documentation
147
+ - Share examples of your usage
148
+
149
+ ## License
150
+
151
+ MIT License - see [LICENSE](LICENSE) file for details.
152
+
153
+ Original work Copyright (c) Microsoft Corporation
154
+ Modified work Copyright (c) 2024 [Your Name]
155
+
156
+ ## Acknowledgments
157
+
158
+ This library is based on the original Microsoft Time Series Insights (TSI) JavaScript SDK, which has been deprecated. We've rebranded it as **Time Series Interactive Charts** and modernized it for generic time series visualization use cases.
159
+
160
+ **TSI** now stands for **Time Series Interactive** - reflecting the library's focus on interactive data visualization rather than a specific cloud service.
161
+
162
+ ## Migration from Original TSIClient
163
+
164
+ If you're migrating from the original Microsoft `tsiclient` package:
165
+
166
+ 1. **Package name change**: Update your imports from `tsiclient` to `@tsichart/core`
167
+ 2. **No breaking changes to component APIs**: The chart components work the same way
168
+ 3. **Remove server calls**: You'll need to handle data fetching yourself (Azure TSI service was retired)
169
+ 4. **Update documentation references**: Use the new documentation instead of Azure TSI docs
170
+ - The `tsiClient.server` object and all related methods have been removed
171
+ - Focus is now exclusively on client-side visualization components
172
+
173
+ **Version 1.3.0:**
174
+ Starting with version 1.3.0, discrete events and state transitions will be represented just like numeric time series in the LineChart component. This may be a breaking change for users representing non-numeric series in the line chart using the "events" and "states" Chart Options. For usage instructions, consult [this example](https://tsiclientsample.azurewebsites.net/noauth/multipleseriestypes.html) and the associated [documentation](https://github.com/microsoft/tsiclient/blob/master/docs/UX.md#line-chart).
175
+
176
+
177
+ ## Contributing
178
+
179
+ This project welcomes contributions and suggestions. Most contributions require you to agree to a
180
+ Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
181
+ the rights to use your contribution. For details, visit https://cla.microsoft.com.
182
+
183
+ When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
184
+ a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
185
+ provided by the bot. You will only need to do this once across all repos using our CLA.
186
+
187
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
188
+ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
189
+ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
@@ -0,0 +1,13 @@
1
+ import { C as ChartDataOptions } from './ChartDataOptions-DBS28b1-.js';
2
+ import './Interfaces-BKRQ685G.js';
3
+
4
+ declare class AggregateExpression extends ChartDataOptions {
5
+ measureObject: any;
6
+ splitByObject: any;
7
+ predicate: Object;
8
+ visibleSplitByCap: number;
9
+ constructor(predicateObject: any, measureObject: any, measureTypes: Array<string>, searchSpan: any, splitByObject: any, colorOrOptionsObject: any, alias?: string, contextMenu?: Array<any>);
10
+ toTsx(roundFromTo?: boolean): {};
11
+ }
12
+
13
+ export { AggregateExpression as default };
@@ -0,0 +1,70 @@
1
+ import { _ as __extends, a as __assign } from './_tslib-5_9pMg1F.js';
2
+ import { U as Utils } from './Utils-C_j8IgZh.js';
3
+ import { C as ChartDataOptions } from './ChartDataOptions-DRd8NHra.js';
4
+ import 'd3';
5
+ import 'moment-timezone';
6
+
7
+ var MAXCARD = 150000;
8
+ var AggregateExpression = /** @class */ (function (_super) {
9
+ __extends(AggregateExpression, _super);
10
+ function AggregateExpression(predicateObject, measureObject, measureTypes, searchSpan, splitByObject, colorOrOptionsObject, alias, contextMenu) {
11
+ if (splitByObject === void 0) { splitByObject = null; }
12
+ var _this = _super.call(this, (typeof (colorOrOptionsObject) === 'object' && !!colorOrOptionsObject) ? __assign(__assign({}, colorOrOptionsObject), { searchSpan: searchSpan, measureTypes: measureTypes }) : { color: colorOrOptionsObject, searchSpan: searchSpan, measureTypes: measureTypes, alias: alias, contextMenu: contextMenu }) || this;
13
+ _this.visibleSplitByCap = 10;
14
+ _this.predicate = predicateObject;
15
+ _this.splitByObject = splitByObject;
16
+ _this.measureObject = ((measureTypes.length == 1 && measureTypes[0] == 'count') || measureObject.property == 'Events Count') ? { count: {} } : { input: measureObject };
17
+ return _this;
18
+ }
19
+ AggregateExpression.prototype.toTsx = function (roundFromTo) {
20
+ var _this = this;
21
+ if (roundFromTo === void 0) { roundFromTo = false; }
22
+ var tsx = {};
23
+ var shiftMillis = Utils.parseShift(this.timeShift, this.startAt, this.searchSpan);
24
+ var fromMillis = this.searchSpan.from.valueOf() + shiftMillis;
25
+ var toMillis = this.searchSpan.to.valueOf() + shiftMillis;
26
+ var bucketSizeInMillis = Utils.parseTimeInput(this.searchSpan.bucketSize);
27
+ var roundedFromMillis = Math.floor((fromMillis + 62135596800000) / (bucketSizeInMillis)) * (bucketSizeInMillis) - 62135596800000;
28
+ var roundedToMillis = Math.ceil((toMillis + 62135596800000) / (bucketSizeInMillis)) * (bucketSizeInMillis) - 62135596800000;
29
+ if (roundFromTo) {
30
+ fromMillis = roundedFromMillis;
31
+ toMillis = roundedToMillis;
32
+ }
33
+ tsx['searchSpan'] = { from: (new Date(fromMillis)).toISOString(), to: (new Date(toMillis)).toISOString() };
34
+ // create aggregates
35
+ var measures = (this.measureObject.hasOwnProperty('count')) ? [{ count: {} }]
36
+ : this.measureTypes.reduce(function (p, c) {
37
+ var measureObject = {};
38
+ if (c == 'count')
39
+ measureObject = { count: {} };
40
+ else
41
+ measureObject[c] = _this['measureObject'];
42
+ p.push(measureObject);
43
+ return p;
44
+ }, []);
45
+ var aggregateObject = {};
46
+ var dimensionObject = { dateHistogram: { input: { builtInProperty: "$ts" }, breaks: { size: this.searchSpan.bucketSize } } };
47
+ if (this.splitByObject != null) {
48
+ var bucketsCeil = Math.ceil((roundedToMillis - roundedFromMillis) / bucketSizeInMillis);
49
+ aggregateObject['dimension'] = { uniqueValues: { input: this.splitByObject, take: Math.floor(MAXCARD / bucketsCeil) } };
50
+ aggregateObject['aggregate'] = { dimension: dimensionObject, measures: measures };
51
+ }
52
+ else {
53
+ aggregateObject['dimension'] = dimensionObject;
54
+ aggregateObject['measures'] = measures;
55
+ }
56
+ var aggregates = [aggregateObject];
57
+ tsx['aggregates'] = aggregates;
58
+ // create predicate
59
+ var predicate;
60
+ if (!this.measureObject.hasOwnProperty('count'))
61
+ predicate = { and: [this.predicate, { not: { eq: { left: this.measureObject.input, right: { 'double': null } } } }] };
62
+ else
63
+ predicate = this.predicate;
64
+ tsx['predicate'] = predicate;
65
+ return tsx;
66
+ };
67
+ return AggregateExpression;
68
+ }(ChartDataOptions));
69
+
70
+ export { AggregateExpression as default };