scichart 3.2.0-beta → 3.2.442

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 (123) hide show
  1. package/Builder/buildSurface.d.ts +2 -2
  2. package/Builder/chartBuilder.d.ts +4 -4
  3. package/Charting/ChartModifiers/ChartModifierBase.d.ts +5 -5
  4. package/Charting/ChartModifiers/ChartModifierBase.js +2 -3
  5. package/Charting/ChartModifiers/CursorModifier.d.ts +9 -9
  6. package/Charting/ChartModifiers/CursorModifier.js +1 -1
  7. package/Charting/ChartModifiers/DataPointSelectionModifier.d.ts +1 -0
  8. package/Charting/ChartModifiers/DataPointSelectionModifier.js +6 -1
  9. package/Charting/ChartModifiers/LegendModifier.d.ts +9 -24
  10. package/Charting/ChartModifiers/LegendModifier.js +9 -21
  11. package/Charting/ChartModifiers/MouseWheelZoomModifier.js +20 -11
  12. package/Charting/ChartModifiers/OverviewRangeSelectionModifier.d.ts +5 -5
  13. package/Charting/ChartModifiers/PinchZoomModifier.js +9 -9
  14. package/Charting/ChartModifiers/RubberBandXyZoomModifier.d.ts +4 -7
  15. package/Charting/ChartModifiers/RubberBandXyZoomModifier.js +6 -8
  16. package/Charting/ChartModifiers/SeriesSelectionModifier.js +10 -8
  17. package/Charting/ChartModifiers/XAxisDragModifier.d.ts +1 -1
  18. package/Charting/ChartModifiers/XAxisDragModifier.js +3 -3
  19. package/Charting/ChartModifiers/YAxisDragModifier.d.ts +2 -4
  20. package/Charting/ChartModifiers/YAxisDragModifier.js +7 -8
  21. package/Charting/Drawing/BaseCache.js +13 -8
  22. package/Charting/Model/BaseDataSeries.d.ts +2 -2
  23. package/Charting/Model/Filters/HlcFilterBase.d.ts +6 -2
  24. package/Charting/Model/Filters/HlcFilterBase.js +17 -1
  25. package/Charting/Model/Filters/IFilterBase.d.ts +24 -0
  26. package/Charting/Model/Filters/IFilterBase.js +2 -0
  27. package/Charting/Model/Filters/OhlcFilterBase.d.ts +6 -2
  28. package/Charting/Model/Filters/OhlcFilterBase.js +17 -1
  29. package/Charting/Model/Filters/XyFilterBase.d.ts +6 -5
  30. package/Charting/Model/Filters/XyFilterBase.js +17 -1
  31. package/Charting/Model/Filters/XyyFilterBase.d.ts +6 -2
  32. package/Charting/Model/Filters/XyyFilterBase.js +17 -1
  33. package/Charting/Model/Filters/XyzFilterBase.d.ts +6 -2
  34. package/Charting/Model/Filters/XyzFilterBase.js +17 -1
  35. package/Charting/Model/XyyDataSeries.js +15 -16
  36. package/Charting/Visuals/Annotations/CursorTooltipSvgAnnotation.js +0 -4
  37. package/Charting/Visuals/Annotations/NativeTextAnnotation.js +4 -0
  38. package/Charting/Visuals/Axis/AxisBase2D.d.ts +3 -3
  39. package/Charting/Visuals/Axis/AxisCore.d.ts +2 -2
  40. package/Charting/Visuals/Axis/DeltaCalculator/DateTimeDeltaCalculator.js +15 -1
  41. package/Charting/Visuals/Legend/ManualLegend.d.ts +57 -0
  42. package/Charting/Visuals/Legend/ManualLegend.js +150 -0
  43. package/Charting/Visuals/Legend/SciChartLegend.js +4 -3
  44. package/Charting/Visuals/Legend/SciChartLegendBase.d.ts +62 -3
  45. package/Charting/Visuals/Legend/SciChartLegendBase.js +70 -11
  46. package/Charting/Visuals/PointMarkers/BasePointMarker.js +13 -8
  47. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.d.ts +1 -1
  48. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.js +3 -3
  49. package/Charting/Visuals/RenderableSeries/BaseStackedCollection.js +8 -3
  50. package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.js +6 -10
  51. package/Charting/Visuals/RenderableSeries/DrawingProviders/BaseSeriesDrawingProvider.d.ts +14 -3
  52. package/Charting/Visuals/RenderableSeries/DrawingProviders/BaseSeriesDrawingProvider.js +34 -10
  53. package/Charting/Visuals/RenderableSeries/DrawingProviders/BubbleSeriesDrawingProvider.js +3 -8
  54. package/Charting/Visuals/RenderableSeries/DrawingProviders/ColumnSeriesDrawingProvider.js +5 -10
  55. package/Charting/Visuals/RenderableSeries/DrawingProviders/LineSeriesDrawingProvider.js +5 -10
  56. package/Charting/Visuals/RenderableSeries/DrawingProviders/MountainSeriesDrawingProvider.js +5 -9
  57. package/Charting/Visuals/RenderableSeries/DrawingProviders/OhlcSeriesDrawingProvider.js +3 -8
  58. package/Charting/Visuals/RenderableSeries/DrawingProviders/PointMarkerDrawingProvider.js +5 -9
  59. package/Charting/Visuals/RenderableSeries/HoveredChangedArgs.d.ts +6 -1
  60. package/Charting/Visuals/RenderableSeries/HoveredChangedArgs.js +2 -1
  61. package/Charting/Visuals/RenderableSeries/IRenderableSeries.d.ts +1 -1
  62. package/Charting/Visuals/RenderableSeries/SelectionChangedArgs.d.ts +6 -1
  63. package/Charting/Visuals/RenderableSeries/SelectionChangedArgs.js +2 -1
  64. package/Charting/Visuals/RenderableSeries/SplineBandRenderableSeries.js +43 -1
  65. package/Charting/Visuals/RenderableSeries/SplineLineRenderableSeries.js +6 -1
  66. package/Charting/Visuals/RenderableSeries/SplineMountainRenderableSeries.js +6 -1
  67. package/Charting/Visuals/RubberBandSvgRect/RubberBandSvgRect.d.ts +4 -0
  68. package/Charting/Visuals/RubberBandSvgRect/RubberBandSvgRect.js +8 -2
  69. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.d.ts +6 -0
  70. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.js +7 -0
  71. package/Charting/Visuals/SciChartSurface.d.ts +0 -5
  72. package/Charting/Visuals/SciChartSurface.js +11 -12
  73. package/Charting/Visuals/SciChartSurfaceBase.d.ts +19 -1
  74. package/Charting/Visuals/SciChartSurfaceBase.js +45 -23
  75. package/Charting/Visuals/createMaster.d.ts +3 -0
  76. package/Charting/Visuals/createMaster.js +54 -23
  77. package/Charting/Visuals/createSingle.js +2 -2
  78. package/Charting/Visuals/licenseManager2D.js +9 -4
  79. package/Charting3D/ChartModifiers/ResetCamera3DModifier.d.ts +1 -1
  80. package/Charting3D/ChartModifiers/ResetCamera3DModifier.js +1 -2
  81. package/Charting3D/ChartModifiers/TooltipModifier3D.d.ts +35 -0
  82. package/Charting3D/ChartModifiers/TooltipModifier3D.js +41 -5
  83. package/Charting3D/Model/DataSeries/BaseGridDataSeries3D.d.ts +1 -1
  84. package/Charting3D/Model/DataSeries/BaseGridDataSeries3D.js +2 -2
  85. package/Charting3D/Model/DataSeries/IPointMetadata3D.d.ts +7 -2
  86. package/Charting3D/Visuals/Axis/AxisBase3D.d.ts +8 -1
  87. package/Charting3D/Visuals/Axis/AxisBase3D.js +0 -2
  88. package/Charting3D/Visuals/Axis/NumericAxis3D.d.ts +3 -2
  89. package/Charting3D/Visuals/Axis/NumericAxis3D.js +7 -3
  90. package/Charting3D/Visuals/Primitives/PointLine3DSceneEntity.js +4 -2
  91. package/Charting3D/Visuals/Primitives/ScatterPointsSceneEntity.js +5 -2
  92. package/Charting3D/Visuals/Primitives/SurfaceMeshSceneEntity.js +2 -1
  93. package/Charting3D/Visuals/RenderableSeries/BaseRenderableSeries3D.d.ts +5 -0
  94. package/Charting3D/Visuals/RenderableSeries/BaseRenderableSeries3D.js +19 -5
  95. package/Charting3D/Visuals/SciChart3DRenderer.d.ts +0 -1
  96. package/Charting3D/Visuals/SciChart3DRenderer.js +3 -26
  97. package/Charting3D/Visuals/SciChart3DSurface.d.ts +12 -5
  98. package/Charting3D/Visuals/SciChart3DSurface.js +35 -6
  99. package/Charting3D/Visuals/createMaster3d.js +9 -4
  100. package/Core/BuildStamp.d.ts +1 -1
  101. package/Core/BuildStamp.js +2 -2
  102. package/Core/DeletableEntity.d.ts +11 -5
  103. package/Core/DeletableEntity.js +42 -45
  104. package/Core/Mouse/MouseManager.js +6 -0
  105. package/Core/OneTimePerformanceWarning.d.ts +1 -1
  106. package/Core/OneTimePerformanceWarning.js +2 -1
  107. package/_wasm/scichart.browser.js +1 -1
  108. package/_wasm/scichart2d.js +1 -1
  109. package/_wasm/scichart2d.wasm +0 -0
  110. package/_wasm/scichart3d.js +1 -1
  111. package/_wasm/scichart3d.wasm +0 -0
  112. package/constants/performanceWarnings.d.ts +1 -0
  113. package/constants/performanceWarnings.js +2 -1
  114. package/index.d.ts +5 -6
  115. package/index.dev.js +68886 -0
  116. package/index.js +13 -21
  117. package/index.min.js +1 -1
  118. package/package.json +1 -1
  119. package/utils/MemoryUsageHelper.d.ts +55 -8
  120. package/utils/MemoryUsageHelper.js +64 -14
  121. package/utils/colorUtil.d.ts +7 -0
  122. package/utils/colorUtil.js +13 -1
  123. package/utils/parseColor.js +19 -4
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "scichart",
3
3
  "description": "Fast WebGL JavaScript Charting Library and Framework",
4
4
  "homepage": "https://www.scichart.com",
5
- "version": "3.2.0-beta",
5
+ "version": "3.2.442",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
8
8
  "keywords": [
@@ -1,34 +1,65 @@
1
- declare type TWeakRef = {
2
- deref: () => any;
1
+ /** @ignore */
2
+ declare type TWeakRef<T = any> = {
3
+ deref: () => T;
3
4
  };
4
5
  /** @ignore */
5
6
  declare type TObjectEntryInfo = {
6
7
  isWasmObject: boolean;
7
8
  /** WeakRef for the original object */
8
9
  objectRef: TWeakRef;
10
+ /** WeakRef for the proxy of the object */
11
+ proxyRef?: TWeakRef;
12
+ /** revocableToken for the proxy of the object */
13
+ revocableTokenRef?: TWeakRef<ReturnType<ProxyConstructor["revocable"]>>;
14
+ };
15
+ /** @ignore */
16
+ declare type TObjectEntryOptions = {
17
+ isWasmObject?: boolean;
18
+ revocableToken?: ReturnType<ProxyConstructor["revocable"]>;
19
+ proxy?: any;
9
20
  };
21
+ /** ObjectRegistry represents a structure for storing object lifecycle info.
22
+ * Adding an object to the registry will place it into a category of undeleted until it is remove from the registry.
23
+ * Also the object will be placed into a category of uncollected until it is disposed by garbage collector.
24
+ */
10
25
  export declare class ObjectRegistry {
11
- protected weakMapRegistry: WeakMap<object, any>;
12
- protected undeletedObjectsMap: Map<string, TObjectEntryInfo>;
13
- protected uncollectedObjectsMap: Map<string, TObjectEntryInfo>;
26
+ weakMapRegistry: WeakMap<object, any>;
27
+ undeletedObjectsMap: Map<string, TObjectEntryInfo>;
28
+ uncollectedObjectsMap: Map<string, TObjectEntryInfo>;
14
29
  protected finalizationRegistry: any;
15
- add(obj: any, id: string, isWasmObject?: boolean): void;
30
+ /** Adds an object and its related info to the registry */
31
+ add(obj: any, id: string, options?: TObjectEntryOptions): void;
32
+ /** Removes the object from the undeleted objects collection */
16
33
  remove(id: string): boolean;
17
34
  getObjectId(obj: any): any;
18
- has(id: string): boolean;
35
+ /** Calls `delete` on instances of {@link IDeletable} objects within the registry */
19
36
  deleteIDeletableObjects(): void;
37
+ /** Calls `delete` on instances of Web Assembly objects within the registry */
20
38
  deleteWasmObjects(): void;
39
+ /** Outputs the state of registry to the console */
21
40
  log(): void;
22
- generateCurrentState(): any;
41
+ /** Returns the state of the registry */
42
+ getState(): any;
43
+ /** Calls `delete` on a specific object within the registry */
23
44
  protected deleteEntry(entry: TObjectEntryInfo, key: string): void;
45
+ /** The callback executed when an object is being garbage collected */
24
46
  protected onCollect(id: string): void;
25
47
  }
26
48
  /** @ignore */
27
49
  export declare const generateIdentifier: (entity: any) => string;
50
+ /** {@link MemoryUsageHelper} provides tools for tracking, debugging, and testing common issus related to lifecycle of SciChart entities. */
28
51
  export declare class MemoryUsageHelper {
29
52
  protected static isMemoryUsageDebugEnabledProperty: boolean;
30
53
  static objectRegistry: ObjectRegistry;
54
+ /** Gets or sets the `Memory Usage Debug Mode`.
55
+ * Enabling the mode, provides warnings about wrong usage or cleanup.
56
+ * Also it wraps SciChart entities and adds them to the {@link objectRegistry} to track their lifecycle
57
+ */
31
58
  static get isMemoryUsageDebugEnabled(): boolean;
59
+ /** Gets or sets the `Memory Usage Debug Mode`.
60
+ * Enabling the mode, provides warnings about wrong usage or cleanup.
61
+ * Also it wraps SciChart entities and adds them to the {@link objectRegistry} to track their lifecycle
62
+ */
32
63
  static set isMemoryUsageDebugEnabled(value: boolean);
33
64
  /**
34
65
  * Adds entity to the object registry to keep track of it being collected
@@ -36,10 +67,26 @@ export declare class MemoryUsageHelper {
36
67
  * @param id optional custom ID of the entity
37
68
  */
38
69
  static register(entity: any, id?: string): void;
70
+ /**
71
+ * Removes entity from the object registry
72
+ * @param id ID of the entity
73
+ */
39
74
  static unregister(id: string): void;
75
+ /**
76
+ * Calls `delete` on all 2D and 3D charts instantiated with {@link SciChartSurface.create} or {@link SciChart3DSurface.create}
77
+ */
40
78
  static destroyMultiChart(): void;
79
+ /**
80
+ * Calls `delete` on all 2D and 3D charts instantiated with {@link SciChartSurface.createSingle} or {@link SciChart3DSurface.createSingle}
81
+ */
41
82
  static destroySingleCharts(): void;
83
+ /**
84
+ * Calls `delete` on all charts instantiated with {@link SciChartPieSurface.create}
85
+ */
42
86
  static destroyPieCharts(): void;
87
+ /**
88
+ * Calls `delete` on all charts
89
+ */
43
90
  static destroyAllCharts(): void;
44
91
  }
45
92
  export {};
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MemoryUsageHelper = exports.generateIdentifier = exports.ObjectRegistry = void 0;
4
4
  var Globals_1 = require("../Core/Globals");
5
5
  var guid_1 = require("./guid");
6
+ /** ObjectRegistry represents a structure for storing object lifecycle info.
7
+ * Adding an object to the registry will place it into a category of undeleted until it is remove from the registry.
8
+ * Also the object will be placed into a category of uncollected until it is disposed by garbage collector.
9
+ */
6
10
  var ObjectRegistry = /** @class */ (function () {
7
11
  function ObjectRegistry() {
8
12
  var _this = this;
@@ -17,8 +21,11 @@ var ObjectRegistry = /** @class */ (function () {
17
21
  _this.onCollect(id);
18
22
  });
19
23
  }
20
- ObjectRegistry.prototype.add = function (obj, id, isWasmObject) {
21
- if (isWasmObject === void 0) { isWasmObject = false; }
24
+ /** Adds an object and its related info to the registry */
25
+ ObjectRegistry.prototype.add = function (obj, id, options) {
26
+ var _a, _b;
27
+ if (options === void 0) { options = { isWasmObject: false }; }
28
+ var isWasmObject = options.isWasmObject;
22
29
  if (this.weakMapRegistry.has(obj)) {
23
30
  console.warn("Adding existing entry to the registry!", id);
24
31
  }
@@ -27,14 +34,24 @@ var ObjectRegistry = /** @class */ (function () {
27
34
  }
28
35
  this.finalizationRegistry.register(obj, id);
29
36
  this.weakMapRegistry.set(obj, id);
37
+ var proxy = (_b = (_a = options === null || options === void 0 ? void 0 : options.revocableToken) === null || _a === void 0 ? void 0 : _a.proxy) !== null && _b !== void 0 ? _b : options === null || options === void 0 ? void 0 : options.proxy;
38
+ var revocableToken = options === null || options === void 0 ? void 0 : options.revocableToken;
39
+ if (proxy) {
40
+ this.weakMapRegistry.set(proxy, id);
41
+ }
30
42
  // @ts-ignore WeakRef
31
43
  var objectRef = new WeakRef(obj);
32
- var objInfo = { isWasmObject: isWasmObject, objectRef: objectRef };
44
+ // @ts-ignore WeakRef
45
+ var proxyRef = proxy && new WeakRef(proxy);
46
+ // @ts-ignore WeakRef
47
+ var revocableTokenRef = revocableToken && new WeakRef(revocableToken);
48
+ var objInfo = { isWasmObject: isWasmObject, objectRef: objectRef, proxyRef: proxyRef, revocableTokenRef: revocableTokenRef };
33
49
  if (obj.delete) {
34
50
  this.undeletedObjectsMap.set(id, objInfo);
35
51
  }
36
52
  this.uncollectedObjectsMap.set(id, objInfo);
37
53
  };
54
+ /** Removes the object from the undeleted objects collection */
38
55
  ObjectRegistry.prototype.remove = function (id) {
39
56
  if (!this.undeletedObjectsMap.has(id) && !this.uncollectedObjectsMap.has(id)) {
40
57
  console.warn("".concat(id, " was not found in the ObjectRegistry!"));
@@ -44,9 +61,7 @@ var ObjectRegistry = /** @class */ (function () {
44
61
  ObjectRegistry.prototype.getObjectId = function (obj) {
45
62
  return this.weakMapRegistry.get(obj);
46
63
  };
47
- ObjectRegistry.prototype.has = function (id) {
48
- return this.undeletedObjectsMap.has(id);
49
- };
64
+ /** Calls `delete` on instances of {@link IDeletable} objects within the registry */
50
65
  ObjectRegistry.prototype.deleteIDeletableObjects = function () {
51
66
  var _this = this;
52
67
  this.undeletedObjectsMap.forEach(function (entry, key) {
@@ -55,6 +70,7 @@ var ObjectRegistry = /** @class */ (function () {
55
70
  }
56
71
  });
57
72
  };
73
+ /** Calls `delete` on instances of Web Assembly objects within the registry */
58
74
  ObjectRegistry.prototype.deleteWasmObjects = function () {
59
75
  var _this = this;
60
76
  this.undeletedObjectsMap.forEach(function (entry, key) {
@@ -63,6 +79,7 @@ var ObjectRegistry = /** @class */ (function () {
63
79
  }
64
80
  });
65
81
  };
82
+ /** Outputs the state of registry to the console */
66
83
  ObjectRegistry.prototype.log = function () {
67
84
  var _this = this;
68
85
  var undeletedObjectsIds = Array.from(this.undeletedObjectsMap.keys());
@@ -77,7 +94,8 @@ var ObjectRegistry = /** @class */ (function () {
77
94
  console.log("weakMap", this.weakMapRegistry);
78
95
  console.log("Object Registry Log End");
79
96
  };
80
- ObjectRegistry.prototype.generateCurrentState = function () {
97
+ /** Returns the state of the registry */
98
+ ObjectRegistry.prototype.getState = function () {
81
99
  var undeletedObjectsIds = Array.from(this.undeletedObjectsMap.keys());
82
100
  var uncollectedObjectsIds = Array.from(this.uncollectedObjectsMap.keys());
83
101
  var state = {};
@@ -89,6 +107,7 @@ var ObjectRegistry = /** @class */ (function () {
89
107
  }
90
108
  return state;
91
109
  };
110
+ /** Calls `delete` on a specific object within the registry */
92
111
  ObjectRegistry.prototype.deleteEntry = function (entry, key) {
93
112
  var originalObject = entry.objectRef.deref();
94
113
  if (originalObject) {
@@ -99,6 +118,7 @@ var ObjectRegistry = /** @class */ (function () {
99
118
  console.warn("Looks like the ".concat(key, " has already been garbage collected, thus the proper cleanup could not be executed!"));
100
119
  }
101
120
  };
121
+ /** The callback executed when an object is being garbage collected */
102
122
  ObjectRegistry.prototype.onCollect = function (id) {
103
123
  // Override with custom behavior
104
124
  };
@@ -110,23 +130,37 @@ var generateIdentifier = function (entity) {
110
130
  return "".concat(entity === null || entity === void 0 ? void 0 : entity.constructor.name, "_").concat((0, guid_1.generateGuid)());
111
131
  };
112
132
  exports.generateIdentifier = generateIdentifier;
133
+ /** {@link MemoryUsageHelper} provides tools for tracking, debugging, and testing common issus related to lifecycle of SciChart entities. */
113
134
  var MemoryUsageHelper = /** @class */ (function () {
114
135
  function MemoryUsageHelper() {
115
136
  }
116
137
  Object.defineProperty(MemoryUsageHelper, "isMemoryUsageDebugEnabled", {
138
+ /** Gets or sets the `Memory Usage Debug Mode`.
139
+ * Enabling the mode, provides warnings about wrong usage or cleanup.
140
+ * Also it wraps SciChart entities and adds them to the {@link objectRegistry} to track their lifecycle
141
+ */
117
142
  get: function () {
118
143
  return this.isMemoryUsageDebugEnabledProperty;
119
144
  },
145
+ /** Gets or sets the `Memory Usage Debug Mode`.
146
+ * Enabling the mode, provides warnings about wrong usage or cleanup.
147
+ * Also it wraps SciChart entities and adds them to the {@link objectRegistry} to track their lifecycle
148
+ */
120
149
  set: function (value) {
121
- this.isMemoryUsageDebugEnabledProperty = value;
122
- if (process.env.NODE_ENV !== "production") {
123
- if (value && !MemoryUsageHelper.objectRegistry) {
124
- MemoryUsageHelper.objectRegistry = new ObjectRegistry();
150
+ if (value) {
151
+ console.warn("Memory usage debug enabled! Make sure to disable it for production build!");
152
+ }
153
+ try {
154
+ if (process.env.NODE_ENV !== "production") {
155
+ this.isMemoryUsageDebugEnabledProperty = value;
156
+ if (value && !MemoryUsageHelper.objectRegistry) {
157
+ MemoryUsageHelper.objectRegistry = new ObjectRegistry();
158
+ }
159
+ return;
125
160
  }
126
- return;
127
161
  }
128
- if (value) {
129
- console.warn("Memory usage debug enabled! Consider disabling it for production build 'MemoryUsageHelper.isMemoryUsageDebugEnabled = false'.");
162
+ catch (err) {
163
+ console.warn(err);
130
164
  }
131
165
  },
132
166
  enumerable: false,
@@ -145,21 +179,37 @@ var MemoryUsageHelper = /** @class */ (function () {
145
179
  }
146
180
  (_a = MemoryUsageHelper.objectRegistry) === null || _a === void 0 ? void 0 : _a.add(entity, id !== null && id !== void 0 ? id : (0, exports.generateIdentifier)(entity));
147
181
  };
182
+ /**
183
+ * Removes entity from the object registry
184
+ * @param id ID of the entity
185
+ */
148
186
  MemoryUsageHelper.unregister = function (id) {
149
187
  var _a;
150
188
  (_a = MemoryUsageHelper.objectRegistry) === null || _a === void 0 ? void 0 : _a.remove(id);
151
189
  };
190
+ /**
191
+ * Calls `delete` on all 2D and 3D charts instantiated with {@link SciChartSurface.create} or {@link SciChart3DSurface.create}
192
+ */
152
193
  MemoryUsageHelper.destroyMultiChart = function () {
153
194
  Globals_1.sciChartDestinations.forEach(function (destination) { return destination.sciChartSurface.delete(true); });
154
195
  Globals_1.sciChart3DDestinations.forEach(function (destination) { return destination.sciChartSurface.delete(true); });
155
196
  };
197
+ /**
198
+ * Calls `delete` on all 2D and 3D charts instantiated with {@link SciChartSurface.createSingle} or {@link SciChart3DSurface.createSingle}
199
+ */
156
200
  MemoryUsageHelper.destroySingleCharts = function () {
157
201
  Globals_1.sciChartSingleDestinations.forEach(function (destination) { return destination.sciChartSurface.delete(true); });
158
202
  Globals_1.sciChart3DSingleDestinations.forEach(function (destination) { return destination.sciChartSurface.delete(true); });
159
203
  };
204
+ /**
205
+ * Calls `delete` on all charts instantiated with {@link SciChartPieSurface.create}
206
+ */
160
207
  MemoryUsageHelper.destroyPieCharts = function () {
161
208
  Globals_1.sciChartPieDestinations.forEach(function (destination) { return destination.sciChartSurface.delete(true); });
162
209
  };
210
+ /**
211
+ * Calls `delete` on all charts
212
+ */
163
213
  MemoryUsageHelper.destroyAllCharts = function () {
164
214
  MemoryUsageHelper.destroyMultiChart();
165
215
  MemoryUsageHelper.destroySingleCharts();
@@ -31,3 +31,10 @@ export declare function uintArgbColorToAbgr(argbColor: number): number;
31
31
  export declare function uintArgbColorMultiplyOpacity(argbColor: number, opacity: number): number;
32
32
  export declare function uintArgbColorOverrideOpacity(argbColor: number, opacity: number): number;
33
33
  export declare function uintArgbColorIsTransparent(argbColor: number): boolean;
34
+ /**
35
+ * Applies the given opacity to an html color code or name, returning an html color code.
36
+ * @param color
37
+ * @param opacity
38
+ * @returns
39
+ */
40
+ export declare function applyOpacityToHtmlColor(color: string, opacity: number): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uintArgbColorIsTransparent = exports.uintArgbColorOverrideOpacity = exports.uintArgbColorMultiplyOpacity = exports.uintArgbColorToAbgr = exports.linearColorMapLerp = exports.uintArgbColorLerp = exports.uintArgbColorLerp24bit = void 0;
3
+ exports.applyOpacityToHtmlColor = exports.uintArgbColorIsTransparent = exports.uintArgbColorOverrideOpacity = exports.uintArgbColorMultiplyOpacity = exports.uintArgbColorToAbgr = exports.linearColorMapLerp = exports.uintArgbColorLerp = exports.uintArgbColorLerp24bit = void 0;
4
4
  var TLinearColorMap_1 = require("../types/TLinearColorMap");
5
5
  var parseColor_1 = require("./parseColor");
6
6
  /**
@@ -115,3 +115,15 @@ function uintArgbColorIsTransparent(argbColor) {
115
115
  return alpha !== 0xff000000;
116
116
  }
117
117
  exports.uintArgbColorIsTransparent = uintArgbColorIsTransparent;
118
+ /**
119
+ * Applies the given opacity to an html color code or name, returning an html color code.
120
+ * @param color
121
+ * @param opacity
122
+ * @returns
123
+ */
124
+ function applyOpacityToHtmlColor(color, opacity) {
125
+ var tarbg = (0, parseColor_1.parseColorToTArgb)(color);
126
+ tarbg.opacity = Math.floor(opacity * 256);
127
+ return (0, parseColor_1.parseTArgbToHtmlColor)(tarbg);
128
+ }
129
+ exports.applyOpacityToHtmlColor = applyOpacityToHtmlColor;
@@ -128,10 +128,10 @@ exports.parseArgbToHtmlColor = parseArgbToHtmlColor;
128
128
  * @param targb
129
129
  */
130
130
  var parseTArgbToHtmlColor = function (targb) {
131
- var r = targb.red.toString(16);
132
- var g = targb.green.toString(16);
133
- var b = targb.blue.toString(16);
134
- var a = targb.opacity.toString(16);
131
+ var r = convertComponent(targb.red);
132
+ var g = convertComponent(targb.green);
133
+ var b = convertComponent(targb.blue);
134
+ var a = convertComponent(targb.opacity);
135
135
  return ("#" + r + g + b + a).toUpperCase();
136
136
  };
137
137
  exports.parseTArgbToHtmlColor = parseTArgbToHtmlColor;
@@ -176,6 +176,21 @@ var convertOpacity = function (opacity) {
176
176
  }
177
177
  return Math.floor(opacity * 256);
178
178
  };
179
+ /**
180
+ * @ignore
181
+ * Converts number (color component) from 0 to 256 to hex string, with 0 padding
182
+ * @param component
183
+ */
184
+ var convertComponent = function (component) {
185
+ if (component >= 256) {
186
+ return "ff";
187
+ }
188
+ if (component <= 0) {
189
+ return "00";
190
+ }
191
+ var hex = component.toString(16);
192
+ return hex.length === 1 ? "0" + hex : hex;
193
+ };
179
194
  // https://www.w3schools.com/colors/colors_names.asp
180
195
  // https://en.wikipedia.org/wiki/Web_colors
181
196
  // http://www.colors.commutercreative.com/grid/