scichart 3.0.301 → 3.1.329

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 (59) hide show
  1. package/Charting/Drawing/Pen2DCache.d.ts +1 -1
  2. package/Charting/Drawing/Pen2DCache.js +3 -2
  3. package/Charting/Services/ChartTitleRenderer.d.ts +37 -0
  4. package/Charting/Services/ChartTitleRenderer.js +176 -0
  5. package/Charting/Services/SciChartRenderer.d.ts +7 -1
  6. package/Charting/Services/SciChartRenderer.js +60 -9
  7. package/Charting/Services/TitleRenderer.d.ts +91 -0
  8. package/Charting/Services/TitleRenderer.js +190 -0
  9. package/Charting/Themes/IThemeProvider.d.ts +16 -0
  10. package/Charting/Themes/SciChartJSDarkTheme.d.ts +2 -0
  11. package/Charting/Themes/SciChartJSDarkTheme.js +2 -0
  12. package/Charting/Themes/SciChartJSLightTheme.d.ts +2 -0
  13. package/Charting/Themes/SciChartJSLightTheme.js +2 -0
  14. package/Charting/Visuals/Annotations/AnnotationBase.d.ts +12 -1
  15. package/Charting/Visuals/Annotations/AnnotationBase.js +25 -2
  16. package/Charting/Visuals/Annotations/BoxAnnotation.js +1 -1
  17. package/Charting/Visuals/Annotations/NativeTextAnnotation.js +1 -5
  18. package/Charting/Visuals/Annotations/SvgAnnotationBase.js +2 -1
  19. package/Charting/Visuals/Axis/AxisBase2D.js +2 -2
  20. package/Charting/Visuals/Axis/AxisCore.d.ts +9 -1
  21. package/Charting/Visuals/Axis/AxisRenderer.d.ts +0 -1
  22. package/Charting/Visuals/Axis/AxisRenderer.js +7 -7
  23. package/Charting/Visuals/Axis/AxisTitleRenderer.d.ts +7 -2
  24. package/Charting/Visuals/Axis/AxisTitleRenderer.js +28 -2
  25. package/Charting/Visuals/Axis/LabelProvider/LabelProviderBase2D.d.ts +5 -12
  26. package/Charting/Visuals/Axis/LabelProvider/LabelProviderBase2D.js +8 -55
  27. package/Charting/Visuals/Axis/LabelProvider/TextLabelProvider.d.ts +0 -1
  28. package/Charting/Visuals/Axis/LabelProvider/TextLabelProvider.js +0 -60
  29. package/Charting/Visuals/I2DSurfaceOptions.d.ts +9 -0
  30. package/Charting/Visuals/RenderableSeries/FastColumnRenderableSeries.d.ts +2 -2
  31. package/Charting/Visuals/RenderableSeries/FastColumnRenderableSeries.js +2 -2
  32. package/Charting/Visuals/SciChartDefaults.d.ts +2 -3
  33. package/Charting/Visuals/SciChartDefaults.js +2 -3
  34. package/Charting/Visuals/SciChartSurface.d.ts +29 -0
  35. package/Charting/Visuals/SciChartSurface.js +100 -7
  36. package/Charting/Visuals/TextureManager/DpiHelper.js +1 -1
  37. package/Charting/Visuals/TextureManager/TextureManager.js +32 -17
  38. package/Charting3D/Visuals/SciChart3DSurface.js +6 -2
  39. package/Core/BuildStamp.d.ts +1 -1
  40. package/Core/BuildStamp.js +2 -2
  41. package/_wasm/scichart.browser.js +1 -1
  42. package/_wasm/scichart2d.js +7 -7
  43. package/_wasm/scichart2d.wasm +0 -0
  44. package/_wasm/scichart3d.js +16 -16
  45. package/_wasm/scichart3d.wasm +0 -0
  46. package/index.d.ts +14 -1
  47. package/index.js +21 -12
  48. package/index.min.js +1 -1
  49. package/package.json +1 -1
  50. package/types/NumberArray.js +2 -1
  51. package/types/TextStyle.d.ts +97 -0
  52. package/types/TextStyle.js +86 -0
  53. package/utils/imageUtil.js +1 -0
  54. package/utils/text.d.ts +8 -1
  55. package/utils/text.js +23 -1
  56. package/Charting/Services/Workers/TextureWorker.d.ts +0 -16
  57. package/Charting/Services/Workers/TextureWorker.js +0 -142
  58. package/Charting/Services/Workers/TextureWorkerSource.d.ts +0 -1
  59. package/Charting/Services/Workers/TextureWorkerSource.js +0 -133
@@ -75,12 +75,17 @@ var TextureManager = /** @class */ (function () {
75
75
  * @returns
76
76
  */
77
77
  TextureManager.prototype.createTextTexture = function (text, textStyle, rotation, lineSpacing, backgroundColor, opacity) {
78
+ var _a;
78
79
  if (app_1.IS_TEST_ENV) {
79
80
  return { bitmapTexture: undefined, textureWidth: 1, textureHeight: 1 };
80
81
  }
81
82
  var fontStyle = textStyle.fontStyle, fontWeight = textStyle.fontWeight, fontFamily = textStyle.fontFamily, fontSizePx = textStyle.fontSize, padding = textStyle.padding, alignment = textStyle.alignment, color = textStyle.color;
83
+ // Save state
84
+ this.ctx.save();
82
85
  this.ctx.globalAlpha = opacity !== null && opacity !== void 0 ? opacity : 1;
83
- this.ctx.textBaseline = "top";
86
+ this.ctx.textBaseline = "alphabetic";
87
+ // Switched this back to alphabetic because...reasons
88
+ // https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-textbaseline-alphabetic
84
89
  this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
85
90
  if (backgroundColor) {
86
91
  this.ctx.fillStyle = backgroundColor;
@@ -90,28 +95,36 @@ var TextureManager = /** @class */ (function () {
90
95
  this.ctx.font = (0, font_1.getFontString)(fontStyle, fontWeight, fontSizePx, fontFamily);
91
96
  var textureWidth = 0;
92
97
  // const fontSizePt = Math.ceil(fontSizePx * PX_TO_PT);
93
- var lineHeight = (0, exports.measureTextHeight)(fontSizePx);
94
- var extraLineHeight = lineHeight * (lineSpacing !== null && lineSpacing !== void 0 ? lineSpacing : 1.1);
95
- var textureHeight = lineHeight + padding.top + padding.bottom;
98
+ var textureHeight = padding.top + padding.bottom;
99
+ var maxLineHeight = 0;
100
+ var firstLineOffset = 0;
101
+ var lineHeights = [];
96
102
  for (var index = 0; index < text.length; index++) {
97
103
  var line = text[index];
98
- var lineWidth = (0, exports.measureTextWidth)(this.ctx, line) + padding.left + padding.right;
104
+ var textMeasure = this.ctx.measureText(line);
105
+ var lineHeight = Math.round(textMeasure.actualBoundingBoxAscent + textMeasure.actualBoundingBoxDescent);
106
+ lineHeights.push(lineHeight);
107
+ if (lineHeight > maxLineHeight) {
108
+ maxLineHeight = lineHeight;
109
+ }
110
+ if (index === 0) {
111
+ firstLineOffset = textMeasure.actualBoundingBoxAscent;
112
+ }
113
+ var lineWidth = Math.round(textMeasure.width + padding.left + padding.right);
99
114
  if (lineWidth > textureWidth) {
100
115
  textureWidth = lineWidth;
101
116
  }
102
- if (index > 0) {
103
- textureHeight += extraLineHeight;
104
- }
117
+ textureHeight += lineHeight;
105
118
  }
106
- var y = padding.top;
119
+ var lineSpacingPixels = Math.round(maxLineHeight * ((lineSpacing !== null && lineSpacing !== void 0 ? lineSpacing : 1.1) - 1));
120
+ textureHeight += (text.length - 1) * lineSpacingPixels;
121
+ var y = padding.top + firstLineOffset;
107
122
  var x = padding.left;
108
123
  if (!textureWidth || !textureHeight) {
109
124
  return { bitmapTexture: undefined, textureWidth: textureWidth, textureHeight: textureHeight };
110
125
  }
111
126
  var newTextureWidth = textureWidth;
112
127
  var newTextureHeight = textureHeight;
113
- // Save state
114
- this.ctx.save();
115
128
  if (rotation) {
116
129
  // convert to radians
117
130
  var rotationRad = (rotation * Math.PI) / 180;
@@ -124,17 +137,19 @@ var TextureManager = /** @class */ (function () {
124
137
  // translate to the new origin that is located in the left top center of the texture
125
138
  this.ctx.translate(-textureWidth / 2, -textureHeight / 2);
126
139
  }
127
- for (var _i = 0, text_1 = text; _i < text_1.length; _i++) {
128
- var line = text_1[_i];
129
- if (alignment === LabelAlignment_1.ELabelAlignment.Center || alignment === LabelAlignment_1.ELabelAlignment.Right) {
140
+ var multilineAlignment = (_a = textStyle.multilineAlignment) !== null && _a !== void 0 ? _a : alignment;
141
+ var maxLineTextWidth = textureWidth - padding.right - padding.left;
142
+ for (var index = 0; index < text.length; index++) {
143
+ var line = text[index];
144
+ if (multilineAlignment === LabelAlignment_1.ELabelAlignment.Center || multilineAlignment === LabelAlignment_1.ELabelAlignment.Right) {
130
145
  var lineWidth = (0, exports.measureTextWidth)(this.ctx, line);
131
146
  x =
132
- alignment === LabelAlignment_1.ELabelAlignment.Right
147
+ multilineAlignment === LabelAlignment_1.ELabelAlignment.Right
133
148
  ? textureWidth - lineWidth - padding.right
134
- : (textureWidth - lineWidth) / 2;
149
+ : (maxLineTextWidth - lineWidth) / 2 + padding.left;
135
150
  }
136
151
  this.ctx.fillText(line, Math.round(x), Math.round(y));
137
- y += extraLineHeight;
152
+ y += lineHeights[index] + lineSpacingPixels;
138
153
  }
139
154
  this.ctx.strokeStyle = color;
140
155
  this.ctx.restore();
@@ -512,7 +512,9 @@ var SciChart3DSurface = /** @class */ (function (_super) {
512
512
  this.webAssemblyContext3D.SCRT3DSetClearColor(0, 0, 0, 0);
513
513
  };
514
514
  SciChart3DSurface.prototype.detachSeries = function (renderableSeries) {
515
- this.rootEntity.children.remove(renderableSeries.sceneEntity);
515
+ if (this.rootEntity) {
516
+ this.rootEntity.children.remove(renderableSeries.sceneEntity);
517
+ }
516
518
  renderableSeries.onDetach();
517
519
  this.invalidateElement();
518
520
  };
@@ -521,7 +523,9 @@ var SciChart3DSurface = /** @class */ (function (_super) {
521
523
  if (!renderableSeries.sceneEntity) {
522
524
  throw new Error("IRenderableSeries3D.sceneEntity must be set before attaching to SciChart3DSurface");
523
525
  }
524
- this.rootEntity.children.add(renderableSeries.sceneEntity);
526
+ if (this.rootEntity) {
527
+ this.rootEntity.children.add(renderableSeries.sceneEntity);
528
+ }
525
529
  this.invalidateElement();
526
530
  };
527
531
  SciChart3DSurface.prototype.detachAxis = function (axis) {
@@ -1,4 +1,4 @@
1
1
  import { TSciChart } from "../types/TSciChart";
2
2
  import { TSciChart3D } from "../types/TSciChart3D";
3
- export declare const libraryVersion = "3.0.301";
3
+ export declare const libraryVersion = "3.1.329";
4
4
  export declare const checkBuildStamp: (wasmContext: TSciChart | TSciChart3D) => boolean;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkBuildStamp = exports.libraryVersion = void 0;
4
- var buildStamp = "2023-02-27T00:00:00";
4
+ var buildStamp = "2023-03-31T00:00:00";
5
5
  var result;
6
6
  // tslint:disable-next-line:no-var-requires
7
- exports.libraryVersion = "3.0.301";
7
+ exports.libraryVersion = "3.1.329";
8
8
  var checkBuildStamp = function (wasmContext) {
9
9
  if (result !== undefined)
10
10
  return result;