scichart 2.1.2301 → 2.2.2351

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 (95) hide show
  1. package/Builder/buildModifiers.d.ts +2 -1
  2. package/Charting/ChartModifiers/CursorModifier.d.ts +5 -0
  3. package/Charting/ChartModifiers/CursorModifier.js +15 -10
  4. package/Charting/ChartModifiers/LegendModifier.d.ts +31 -0
  5. package/Charting/ChartModifiers/LegendModifier.js +22 -0
  6. package/Charting/ChartModifiers/RolloverModifier.d.ts +10 -0
  7. package/Charting/ChartModifiers/RolloverModifier.js +76 -19
  8. package/Charting/LayoutManager/LayoutManager.js +6 -1
  9. package/Charting/Model/BaseHeatmapDataSeries.d.ts +1 -0
  10. package/Charting/Model/BaseHeatmapDataSeries.js +4 -1
  11. package/Charting/Model/PointSeries/BasePointSeriesWrapped.d.ts +1 -1
  12. package/Charting/Model/PointSeries/BasePointSeriesWrapped.js +2 -2
  13. package/Charting/Model/PointSeries/XyyPointSeriesWrapped.d.ts +1 -1
  14. package/Charting/Model/PointSeries/XyyPointSeriesWrapped.js +3 -3
  15. package/Charting/Visuals/Annotations/AnnotationBase.d.ts +6 -1
  16. package/Charting/Visuals/Annotations/AnnotationBase.js +23 -2
  17. package/Charting/Visuals/Annotations/CursorTooltipSvgAnnotation.d.ts +6 -0
  18. package/Charting/Visuals/Annotations/CursorTooltipSvgAnnotation.js +46 -5
  19. package/Charting/Visuals/Annotations/CustomAnnotation.d.ts +3 -1
  20. package/Charting/Visuals/Annotations/CustomAnnotation.js +14 -3
  21. package/Charting/Visuals/Annotations/HorizontalLineAnnotation.d.ts +4 -0
  22. package/Charting/Visuals/Annotations/HorizontalLineAnnotation.js +3 -2
  23. package/Charting/Visuals/Annotations/RolloverLegendSvgAnnotation.d.ts +1 -1
  24. package/Charting/Visuals/Annotations/RolloverLegendSvgAnnotation.js +13 -3
  25. package/Charting/Visuals/Annotations/RolloverTooltipSvgAnnotation.d.ts +13 -0
  26. package/Charting/Visuals/Annotations/RolloverTooltipSvgAnnotation.js +63 -14
  27. package/Charting/Visuals/Annotations/VerticalLineAnnotation.d.ts +2 -0
  28. package/Charting/Visuals/Annotations/VerticalLineAnnotation.js +3 -2
  29. package/Charting/Visuals/Annotations/constants.d.ts +2 -1
  30. package/Charting/Visuals/Annotations/constants.js +1 -0
  31. package/Charting/Visuals/Axis/AxisBase2D.d.ts +10 -0
  32. package/Charting/Visuals/Axis/AxisBase2D.js +72 -1
  33. package/Charting/Visuals/Axis/LabelProvider/PieLabelProvider.d.ts +29 -0
  34. package/Charting/Visuals/Axis/LabelProvider/PieLabelProvider.js +77 -0
  35. package/Charting/Visuals/Axis/LabelProvider/SmartDateLabelProvider.d.ts +2 -2
  36. package/Charting/Visuals/Axis/LabelProvider/SmartDateLabelProvider.js +21 -4
  37. package/Charting/Visuals/Helpers/drawLabel.d.ts +3 -3
  38. package/Charting/Visuals/Helpers/drawLabel.js +38 -18
  39. package/Charting/Visuals/I2DSurfaceOptions.d.ts +6 -0
  40. package/Charting/Visuals/Legend/SciChartLegend.d.ts +4 -0
  41. package/Charting/Visuals/Legend/SciChartLegend.js +7 -1
  42. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.d.ts +16 -7
  43. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.js +56 -9
  44. package/Charting/Visuals/RenderableSeries/BaseStackedCollection.d.ts +3 -0
  45. package/Charting/Visuals/RenderableSeries/BaseStackedCollection.js +8 -0
  46. package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.d.ts +17 -166
  47. package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.js +35 -328
  48. package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.d.ts +5 -2
  49. package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.js +5 -3
  50. package/Charting/Visuals/RenderableSeries/IBaseRenderableSeriesOptions.d.ts +8 -0
  51. package/Charting/Visuals/RenderableSeries/IRenderableSeries.d.ts +6 -0
  52. package/Charting/Visuals/RenderableSeries/SeriesVisibleChangedArgs.d.ts +6 -0
  53. package/Charting/Visuals/RenderableSeries/SeriesVisibleChangedArgs.js +11 -0
  54. package/Charting/Visuals/RenderableSeries/StackedColumnRenderableSeries.d.ts +22 -0
  55. package/Charting/Visuals/RenderableSeries/StackedColumnRenderableSeries.js +38 -1
  56. package/Charting/Visuals/RenderableSeries/StackedMountainCollection.d.ts +2 -2
  57. package/Charting/Visuals/RenderableSeries/StackedMountainCollection.js +26 -45
  58. package/Charting/Visuals/RenderableSeries/StackedMountainRenderableSeries.d.ts +77 -18
  59. package/Charting/Visuals/RenderableSeries/StackedMountainRenderableSeries.js +139 -42
  60. package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.d.ts +5 -0
  61. package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.js +21 -1
  62. package/Charting/Visuals/RenderableSeries/constants.d.ts +2 -0
  63. package/Charting/Visuals/RenderableSeries/constants.js +2 -0
  64. package/Charting/Visuals/SciChartPieSurface/IPieSurfaceOptions.d.ts +24 -2
  65. package/Charting/Visuals/SciChartPieSurface/PieSegment/IPieSegment.d.ts +4 -1
  66. package/Charting/Visuals/SciChartPieSurface/PieSegment/PieSegment.d.ts +13 -2
  67. package/Charting/Visuals/SciChartPieSurface/PieSegment/PieSegment.js +66 -20
  68. package/Charting/Visuals/SciChartPieSurface/PieSegment/constants.d.ts +3 -1
  69. package/Charting/Visuals/SciChartPieSurface/PieSegment/constants.js +2 -0
  70. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.d.ts +66 -2
  71. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.js +304 -52
  72. package/Charting/Visuals/SciChartPieSurface/constants.d.ts +6 -1
  73. package/Charting/Visuals/SciChartPieSurface/constants.js +5 -0
  74. package/Charting/Visuals/SciChartSurface.d.ts +13 -2
  75. package/Charting/Visuals/SciChartSurface.js +39 -3
  76. package/Charting/Visuals/createMaster.js +2 -2
  77. package/Charting/Visuals/createSingle.js +2 -2
  78. package/Charting/Visuals/sciChartInitCommon.d.ts +2 -2
  79. package/Charting/Visuals/sciChartInitCommon.js +13 -9
  80. package/Charting3D/Visuals/Primitives/ScatterPointsSceneEntity.js +6 -2
  81. package/Core/BuildStamp.d.ts +1 -1
  82. package/Core/BuildStamp.js +2 -2
  83. package/_wasm/scichart.browser.js +1 -1
  84. package/_wasm/scichart2d.js +1 -1
  85. package/_wasm/scichart2d.wasm +0 -0
  86. package/_wasm/scichart3d.js +95 -95
  87. package/_wasm/scichart3d.wasm +0 -0
  88. package/package.json +1 -1
  89. package/types/Color.d.ts +1 -0
  90. package/types/Color.js +1 -0
  91. package/types/LabelPlacement.d.ts +8 -0
  92. package/types/LabelPlacement.js +11 -1
  93. package/types/LabelProviderType.d.ts +5 -1
  94. package/types/LabelProviderType.js +4 -0
  95. package/types/TSciChartSurfaceCanvases.d.ts +1 -0
@@ -13,6 +13,7 @@ export interface ICursorTooltipSvgAnnotationOptions extends ISvgAnnotationBaseOp
13
13
  tooltipLegendOffsetX?: number;
14
14
  tooltipLegendOffsetY?: number;
15
15
  cursorModifier: CursorModifier;
16
+ placementDivId?: string;
16
17
  }
17
18
  /**
18
19
  * A Tooltip Annotation which provides an SVG tooltip over the chart. Used by the {@link CursorModifier}
@@ -31,6 +32,8 @@ export declare class CursorTooltipSvgAnnotation extends SvgAnnotationBase {
31
32
  private tooltipLegendOffsetYProperty;
32
33
  private svgLegend;
33
34
  private previousMousePosition;
35
+ private placementDivId?;
36
+ private svgDivRoot?;
34
37
  /**
35
38
  * Creates an instance of the {@link CursorTooltipSvgAnnotation}
36
39
  * @param options
@@ -62,10 +65,13 @@ export declare class CursorTooltipSvgAnnotation extends SvgAnnotationBase {
62
65
  * @inheritDoc
63
66
  */
64
67
  update(xCalc: CoordinateCalculatorBase, yCalc: CoordinateCalculatorBase): void;
68
+ /** @inheritDoc */
69
+ delete(): void;
65
70
  /**
66
71
  * @inheritDoc
67
72
  */
68
73
  protected create(xCalc: CoordinateCalculatorBase, yCalc: CoordinateCalculatorBase): void;
69
74
  private updateTooltip;
70
75
  private updateLegendTooltip;
76
+ private updateExternalLegendTooltip;
71
77
  }
@@ -30,7 +30,7 @@ var CursorTooltipSvgAnnotation = /** @class */ (function (_super) {
30
30
  * @param options
31
31
  */
32
32
  function CursorTooltipSvgAnnotation(options) {
33
- var _a, _b, _c, _d, _e, _f, _g, _h;
33
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
34
34
  var _this = _super.call(this, options) || this;
35
35
  /** @inheritDoc */
36
36
  _this.type = IAnnotation_1.EAnnotationType.SVG;
@@ -45,6 +45,11 @@ var CursorTooltipSvgAnnotation = /** @class */ (function (_super) {
45
45
  _this.tooltipLegendOffsetXProperty = (_g = options === null || options === void 0 ? void 0 : options.tooltipLegendOffsetX) !== null && _g !== void 0 ? _g : _this.tooltipLegendOffsetXProperty;
46
46
  _this.tooltipLegendOffsetYProperty = (_h = options === null || options === void 0 ? void 0 : options.tooltipLegendOffsetY) !== null && _h !== void 0 ? _h : _this.tooltipLegendOffsetYProperty;
47
47
  _this.cursorModifier = options.cursorModifier;
48
+ _this.placementDivId = (_j = options === null || options === void 0 ? void 0 : options.placementDivId) !== null && _j !== void 0 ? _j : _this.placementDivId;
49
+ if (_this.placementDivId) {
50
+ var svgRoot = document.getElementById(_this.placementDivId);
51
+ _this.svgDivRoot = svgRoot;
52
+ }
48
53
  return _this;
49
54
  }
50
55
  Object.defineProperty(CursorTooltipSvgAnnotation.prototype, "seriesInfos", {
@@ -174,8 +179,25 @@ var CursorTooltipSvgAnnotation = /** @class */ (function (_super) {
174
179
  this.delete();
175
180
  }
176
181
  this.create(xCalc, yCalc);
177
- this.updateTooltip();
178
- this.updateLegendTooltip();
182
+ if (this.placementDivId) {
183
+ this.updateExternalLegendTooltip();
184
+ }
185
+ else {
186
+ this.updateTooltip();
187
+ this.updateLegendTooltip();
188
+ }
189
+ };
190
+ /** @inheritDoc */
191
+ CursorTooltipSvgAnnotation.prototype.delete = function () {
192
+ if (!this.parentSurface || this.parentSurface.isDeleted || !this.svg)
193
+ return;
194
+ if (this.placementDivId) {
195
+ this.svgDivRoot.removeChild(this.svg);
196
+ }
197
+ else {
198
+ this.svgRoot.removeChild(this.svg);
199
+ }
200
+ this.setSvg(undefined);
179
201
  };
180
202
  /**
181
203
  * @inheritDoc
@@ -185,8 +207,14 @@ var CursorTooltipSvgAnnotation = /** @class */ (function (_super) {
185
207
  throw Error("Please provide a tooltipSvgTemplate for CursorTooltipSvgAnnotation");
186
208
  var svgString = this.tooltipSvgTemplate(this.seriesInfos, this);
187
209
  var svgNode = document.createRange().createContextualFragment(svgString);
188
- this.svgRoot.appendChild(svgNode);
189
- this.setSvg(this.svgRoot.lastChild);
210
+ if (this.placementDivId) {
211
+ this.svgDivRoot.appendChild(svgNode);
212
+ this.setSvg(this.svgDivRoot.lastChild);
213
+ }
214
+ else {
215
+ this.svgRoot.appendChild(svgNode);
216
+ this.setSvg(this.svgRoot.lastChild);
217
+ }
190
218
  };
191
219
  CursorTooltipSvgAnnotation.prototype.updateTooltip = function () {
192
220
  var _a, _b, _c, _d;
@@ -218,6 +246,19 @@ var CursorTooltipSvgAnnotation = /** @class */ (function (_super) {
218
246
  this.svgLegend.setAttribute("y", this.tooltipLegendOffsetY.toString());
219
247
  }
220
248
  };
249
+ CursorTooltipSvgAnnotation.prototype.updateExternalLegendTooltip = function () {
250
+ if (this.tooltipLegendTemplate) {
251
+ var svgString = this.seriesInfos
252
+ ? this.tooltipLegendTemplate(this.seriesInfos, this)
253
+ : "<svg style='display: none'></svg>";
254
+ var svgNode = document.createRange().createContextualFragment(svgString);
255
+ if (this.svgLegend) {
256
+ this.svgLegend.removeChild(this.svgLegend);
257
+ }
258
+ this.svgDivRoot.appendChild(svgNode);
259
+ this.svgLegend = this.svgDivRoot.lastChild;
260
+ }
261
+ };
221
262
  return CursorTooltipSvgAnnotation;
222
263
  }(SvgAnnotationBase_1.SvgAnnotationBase));
223
264
  exports.CursorTooltipSvgAnnotation = CursorTooltipSvgAnnotation;
@@ -19,7 +19,7 @@ export declare class CustomAnnotation extends SvgAnnotationBase {
19
19
  /**
20
20
  * SVG dom element string provided by the user
21
21
  */
22
- svgString: string;
22
+ svgStringProperty: string;
23
23
  /**
24
24
  * Creates an instance of the {@link CustomAnnotation}
25
25
  * @param options The {@link ICustomAnnotationOptions} which contain optional parameters
@@ -32,4 +32,6 @@ export declare class CustomAnnotation extends SvgAnnotationBase {
32
32
  };
33
33
  /** @inheritDoc */
34
34
  protected create(xCalc: CoordinateCalculatorBase, yCalc: CoordinateCalculatorBase): void;
35
+ get svgString(): string;
36
+ set svgString(value: string);
35
37
  }
@@ -33,14 +33,14 @@ var CustomAnnotation = /** @class */ (function (_super) {
33
33
  var _this = _super.call(this, options) || this;
34
34
  /** @inheritDoc */
35
35
  _this.type = IAnnotation_1.EAnnotationType.SVGCustomAnnotation;
36
- _this.svgString = (_a = options === null || options === void 0 ? void 0 : options.svgString) !== null && _a !== void 0 ? _a : undefined;
36
+ _this.svgStringProperty = (_a = options === null || options === void 0 ? void 0 : options.svgString) !== null && _a !== void 0 ? _a : undefined;
37
37
  return _this;
38
38
  }
39
39
  /** @inheritDoc */
40
40
  CustomAnnotation.prototype.toJSON = function () {
41
41
  var json = _super.prototype.toJSON.call(this);
42
42
  var options = {
43
- svgString: this.svgString
43
+ svgString: this.svgStringProperty
44
44
  };
45
45
  Object.assign(json.options, options);
46
46
  return json;
@@ -61,7 +61,7 @@ var CustomAnnotation = /** @class */ (function (_super) {
61
61
  if (this.svg) {
62
62
  this.delete();
63
63
  }
64
- this.setSvg(annotationHelpers_1.annotationHelpers.createSvg(this.svgString, this.svgRoot));
64
+ this.setSvg(annotationHelpers_1.annotationHelpers.createSvg(this.svgStringProperty, this.svgRoot));
65
65
  this.calcAndSetAnnotationBorders(xCalc, yCalc);
66
66
  this.updateAdornerInner();
67
67
  this.prevIsSelected = this.isSelected;
@@ -74,6 +74,17 @@ var CustomAnnotation = /** @class */ (function (_super) {
74
74
  this.prevIsSelected = this.isSelected;
75
75
  }
76
76
  };
77
+ Object.defineProperty(CustomAnnotation.prototype, "svgString", {
78
+ get: function () {
79
+ return this.svgStringProperty;
80
+ },
81
+ set: function (value) {
82
+ this.delete();
83
+ this.svgStringProperty = value;
84
+ },
85
+ enumerable: false,
86
+ configurable: true
87
+ });
77
88
  return CustomAnnotation;
78
89
  }(SvgAnnotationBase_1.SvgAnnotationBase));
79
90
  exports.CustomAnnotation = CustomAnnotation;
@@ -1,4 +1,5 @@
1
1
  import { Rect } from "../../../Core/Rect";
2
+ import { EHorizontalAlignment, EVerticalAlignment } from "../../../types/LabelPlacement";
2
3
  import { ModifierMouseArgs } from "../../ChartModifiers/ModifierMouseArgs";
3
4
  import { WebGlRenderContext2D } from "../../Drawing/WebGlRenderContext2D";
4
5
  import { CoordinateCalculatorBase } from "../../Numerics/CoordinateCalculators/CoordinateCalculatorBase";
@@ -7,6 +8,8 @@ import { ILineAnnotationOptions, LineAnnotation } from "./LineAnnotation";
7
8
  export interface IHVLineAnnotationOptions extends ILineAnnotationOptions {
8
9
  dragOnLine?: boolean;
9
10
  dragOnLabel?: boolean;
11
+ horizontalAlignment?: EHorizontalAlignment;
12
+ verticalAlignment?: EVerticalAlignment;
10
13
  }
11
14
  /**
12
15
  * @summary The {@link HorizontalLineAnnotation} provides an {@link AnnotationBase | Annotation} which draws a horizontal line at
@@ -25,6 +28,7 @@ export declare class HorizontalLineAnnotation extends LineAnnotation {
25
28
  readonly type: EAnnotationType;
26
29
  dragOnLine: boolean;
27
30
  dragOnLabel: boolean;
31
+ horizontalAlignment: EHorizontalAlignment;
28
32
  private labelRect;
29
33
  /**
30
34
  * Create an instance of a HorizontalLineAnnotation
@@ -58,7 +58,7 @@ var HorizontalLineAnnotation = /** @class */ (function (_super) {
58
58
  * @param options Optional parameters of type {@link ILineAnnotationOptions} which configure the annotation upon construction
59
59
  */
60
60
  function HorizontalLineAnnotation(options) {
61
- var _a, _b;
61
+ var _a, _b, _c;
62
62
  var _this = _super.call(this, options) || this;
63
63
  /** @inheritDoc */
64
64
  _this.type = IAnnotation_1.EAnnotationType.RenderContextHorizontalLineAnnotation;
@@ -72,6 +72,7 @@ var HorizontalLineAnnotation = /** @class */ (function (_super) {
72
72
  }
73
73
  _this.dragOnLine = (_a = options === null || options === void 0 ? void 0 : options.dragOnLine) !== null && _a !== void 0 ? _a : _this.dragOnLine;
74
74
  _this.dragOnLabel = (_b = options === null || options === void 0 ? void 0 : options.dragOnLabel) !== null && _b !== void 0 ? _b : _this.dragOnLabel;
75
+ _this.horizontalAlignment = (_c = options === null || options === void 0 ? void 0 : options.horizontalAlignment) !== null && _c !== void 0 ? _c : _this.horizontalAlignment;
75
76
  return _this;
76
77
  }
77
78
  Object.defineProperty(HorizontalLineAnnotation.prototype, "y2", {
@@ -136,7 +137,7 @@ var HorizontalLineAnnotation = /** @class */ (function (_super) {
136
137
  var isLineAnnotationEdgeVisible = !isPartialLine || isLineAnnotationInHorizontalVisibleRange;
137
138
  if (isAxisLabelInVerticalVisibleRange && isLineAnnotationEdgeVisible) {
138
139
  var textStyle = __assign(__assign({}, verticalAxis.labelStyle), { color: this.axisLabelStroke, fontSize: this.axisFontSize * DpiHelper_1.DpiHelper.PIXEL_RATIO, fontFamily: this.axisFontFamily });
139
- var labelRect = (0, drawLabel_1.drawLineAnnotation)(verticalAxis, renderContext, this.labelPlacement, this.labelValue, borderX1, borderX2, borderY1, borderY2, textStyle, this.axisLabelFill, strokePen, viewRect, this.showLabel, this.opacity);
140
+ var labelRect = (0, drawLabel_1.drawLineAnnotation)(verticalAxis, renderContext, this.labelPlacement, this.labelValue, borderX1, borderX2, borderY1, borderY2, textStyle, this.axisLabelFill, strokePen, viewRect, this.showLabel, this.opacity, this.horizontalAlignment);
140
141
  if (labelRect) {
141
142
  var point1 = (0, translate_1.translateFromCanvasToSeriesViewRect)(new Point_1.Point(labelRect.left, labelRect.top), viewRect, true);
142
143
  var point2 = (0, translate_1.translateFromCanvasToSeriesViewRect)(new Point_1.Point(labelRect.right, labelRect.bottom), viewRect, true);
@@ -31,7 +31,7 @@ export declare class RolloverLegendSvgAnnotation extends SvgAnnotationBase {
31
31
  /**
32
32
  * Gets or sets seriesInfos {@link SeriesInfo} value on the tooltip
33
33
  */
34
- set seriesInfos(value: SeriesInfo[]);
34
+ set seriesInfos(newSeriesInfos: SeriesInfo[]);
35
35
  get tooltipLegendTemplate(): TRolloverLegendSvgTemplate;
36
36
  set tooltipLegendTemplate(value: TRolloverLegendSvgTemplate);
37
37
  get tooltipLegendOffsetX(): number;
@@ -50,9 +50,19 @@ var RolloverLegendSvgAnnotation = /** @class */ (function (_super) {
50
50
  /**
51
51
  * Gets or sets seriesInfos {@link SeriesInfo} value on the tooltip
52
52
  */
53
- set: function (value) {
54
- this.seriesInfosProperty = value;
55
- this.notifyPropertyChanged(constants_1.PROPERTY.SERIES_INFOS);
53
+ set: function (newSeriesInfos) {
54
+ if (this.seriesInfosProperty && newSeriesInfos) {
55
+ // Compare infos against the ones for the matching series. See if any are different
56
+ if (newSeriesInfos.length !== this.seriesInfosProperty.length ||
57
+ this.seriesInfosProperty
58
+ .map(function (seriesInfo) {
59
+ return seriesInfo.equals(newSeriesInfos.find(function (newSeriesInfo) { return newSeriesInfo.renderableSeries.id === seriesInfo.renderableSeries.id; }));
60
+ })
61
+ .some(function (sameSeriesInfo) { return sameSeriesInfo === false; })) {
62
+ this.seriesInfosProperty = newSeriesInfos;
63
+ this.notifyPropertyChanged(constants_1.PROPERTY.SERIES_INFOS);
64
+ }
65
+ }
56
66
  },
57
67
  enumerable: false,
58
68
  configurable: true
@@ -7,6 +7,7 @@ import { ISvgAnnotationBaseOptions, SvgAnnotationBase } from "./SvgAnnotationBas
7
7
  export interface IRolloverTooltipSvgAnnotationOptions extends ISvgAnnotationBaseOptions {
8
8
  height?: number;
9
9
  seriesType?: ESeriesType;
10
+ placementDivId?: string;
10
11
  }
11
12
  /**
12
13
  * A Tooltip Annotation which provides an SVG tooltip over the chart. Used by the {@link RolloverModifier}
@@ -20,6 +21,8 @@ export declare class RolloverTooltipSvgAnnotation extends SvgAnnotationBase {
20
21
  private svgLegend;
21
22
  private seriesInfoProperty;
22
23
  private previousMousePosition;
24
+ private placementDivIdProperty;
25
+ private svgDivRoot;
23
26
  /**
24
27
  * Creates an instance of the {@link RolloverTooltipSvgAnnotation}
25
28
  * @param renderableSeriesProps The {@link RolloverModifierRenderableSeriesProps | props} pass
@@ -44,5 +47,15 @@ export declare class RolloverTooltipSvgAnnotation extends SvgAnnotationBase {
44
47
  updateSize(width: number, height: number): void;
45
48
  /** @inheritDoc */
46
49
  protected create(xCalc: CoordinateCalculatorBase, yCalc: CoordinateCalculatorBase): void;
50
+ private generateSvgString;
47
51
  private updateLegendTooltip;
52
+ private updateExternalLegendTooltip;
53
+ /**
54
+ * Gets or sets the parent div element reference or id for the Tooltip
55
+ */
56
+ get placementDivId(): string;
57
+ /**
58
+ * Gets or sets the parent div element reference or id for the Tooltip
59
+ */
60
+ set placementDivId(value: string);
48
61
  }
@@ -34,7 +34,7 @@ var RolloverTooltipSvgAnnotation = /** @class */ (function (_super) {
34
34
  * @param options
35
35
  */
36
36
  function RolloverTooltipSvgAnnotation(renderableSeriesProps, options) {
37
- var _a;
37
+ var _a, _b;
38
38
  var _this = _super.call(this, options) || this;
39
39
  /** @inheritDoc */
40
40
  _this.type = IAnnotation_1.EAnnotationType.SVG;
@@ -46,6 +46,7 @@ var RolloverTooltipSvgAnnotation = /** @class */ (function (_super) {
46
46
  _this.yCoordinateMode = AnnotationBase_1.ECoordinateMode.DataValue;
47
47
  _this.isHidden = true;
48
48
  _this.updateSize = _this.updateSize.bind(_this);
49
+ _this.placementDivIdProperty = (_b = options === null || options === void 0 ? void 0 : options.placementDivId) !== null && _b !== void 0 ? _b : _this.placementDivIdProperty;
49
50
  return _this;
50
51
  }
51
52
  Object.defineProperty(RolloverTooltipSvgAnnotation.prototype, "seriesInfo", {
@@ -59,20 +60,28 @@ var RolloverTooltipSvgAnnotation = /** @class */ (function (_super) {
59
60
  * Gets or sets seriesInfo {@link SeriesInfo} value on the tooltip
60
61
  */
61
62
  set: function (value) {
62
- this.seriesInfoProperty = value;
63
- this.notifyPropertyChanged(constants_1.PROPERTY.SERIES_INFO);
63
+ if ((value && !this.seriesInfoProperty) || !this.seriesInfoProperty.equals(value)) {
64
+ this.seriesInfoProperty = value;
65
+ this.notifyPropertyChanged(constants_1.PROPERTY.SERIES_INFO);
66
+ }
64
67
  },
65
68
  enumerable: false,
66
69
  configurable: true
67
70
  });
68
71
  /** @inheritDoc */
69
72
  RolloverTooltipSvgAnnotation.prototype.delete = function () {
70
- var _a;
73
+ var _a, _b, _c, _d;
71
74
  if (!this.parentSurface || this.parentSurface.isDeleted)
72
75
  return;
73
- (_a = this.svgRoot) === null || _a === void 0 ? void 0 : _a.removeChild(this.svg);
76
+ if (this.svg) {
77
+ if (this.placementDivId) {
78
+ (_b = (_a = this.svg) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(this.svg);
79
+ return;
80
+ }
81
+ (_c = this.svgRoot) === null || _c === void 0 ? void 0 : _c.removeChild(this.svg);
82
+ }
74
83
  if (this.svgLegend) {
75
- this.svgRoot.removeChild(this.svgLegend);
84
+ (_d = this.svgLegend.parentNode) === null || _d === void 0 ? void 0 : _d.removeChild(this.svgLegend);
76
85
  }
77
86
  };
78
87
  /** @inheritDoc */
@@ -85,8 +94,13 @@ var RolloverTooltipSvgAnnotation = /** @class */ (function (_super) {
85
94
  if (this.svg) {
86
95
  this.delete();
87
96
  }
88
- _super.prototype.update.call(this, xCalc, yCalc);
89
- this.updateLegendTooltip();
97
+ if (this.placementDivId) {
98
+ this.updateExternalLegendTooltip();
99
+ }
100
+ else {
101
+ _super.prototype.update.call(this, xCalc, yCalc);
102
+ this.updateLegendTooltip();
103
+ }
90
104
  };
91
105
  /**
92
106
  * Updates size of the tooltip
@@ -97,22 +111,25 @@ var RolloverTooltipSvgAnnotation = /** @class */ (function (_super) {
97
111
  };
98
112
  /** @inheritDoc */
99
113
  RolloverTooltipSvgAnnotation.prototype.create = function (xCalc, yCalc) {
100
- var _a;
101
114
  var svgString;
102
115
  if (!this.seriesInfo) {
103
116
  svgString = "<svg></svg>";
104
117
  }
105
118
  else {
106
- var tooltipTitle = this.tooltipProps.tooltipTitle;
107
- var idTitle = ("" + tooltipTitle).replace(/\s/g, "");
108
- var id = "id".concat(Math.floor(this.y1), "_").concat(idTitle, "_").concat(Date.now());
109
- var tooltipTemplate = (_a = this.tooltipProps.tooltipTemplate) !== null && _a !== void 0 ? _a : defaultTooltipTemplate;
110
- svgString = tooltipTemplate(id, this.seriesInfo, this);
119
+ svgString = this.generateSvgString();
111
120
  }
112
121
  var svgNode = document.createRange().createContextualFragment(svgString);
113
122
  this.svgRoot.appendChild(svgNode);
114
123
  this.setSvg(this.svgRoot.lastChild);
115
124
  };
125
+ RolloverTooltipSvgAnnotation.prototype.generateSvgString = function () {
126
+ var _a;
127
+ var tooltipTitle = this.tooltipProps.tooltipTitle;
128
+ var idTitle = ("" + tooltipTitle).replace(/\s/g, "");
129
+ var id = "id".concat(Math.floor(this.y1), "_").concat(idTitle, "_").concat(Date.now());
130
+ var tooltipTemplate = (_a = this.tooltipProps.tooltipTemplate) !== null && _a !== void 0 ? _a : defaultTooltipTemplate;
131
+ return tooltipTemplate(id, this.seriesInfo, this);
132
+ };
116
133
  RolloverTooltipSvgAnnotation.prototype.updateLegendTooltip = function () {
117
134
  if (this.tooltipProps.tooltipLegendTemplate) {
118
135
  var svgString = this.seriesInfo
@@ -125,6 +142,38 @@ var RolloverTooltipSvgAnnotation = /** @class */ (function (_super) {
125
142
  this.svgLegend.setAttribute("y", this.tooltipProps.tooltipLegendOffsetY.toString());
126
143
  }
127
144
  };
145
+ RolloverTooltipSvgAnnotation.prototype.updateExternalLegendTooltip = function () {
146
+ var svgString;
147
+ if (!this.seriesInfo) {
148
+ svgString = "<svg style='display: none;'></svg>";
149
+ }
150
+ else {
151
+ svgString = this.generateSvgString();
152
+ }
153
+ var svgNode = document.createRange().createContextualFragment(svgString);
154
+ this.svgDivRoot = document.getElementById(this.placementDivId);
155
+ this.svgDivRoot.appendChild(svgNode);
156
+ this.setSvg(this.svgDivRoot.lastChild);
157
+ };
158
+ Object.defineProperty(RolloverTooltipSvgAnnotation.prototype, "placementDivId", {
159
+ /**
160
+ * Gets or sets the parent div element reference or id for the Tooltip
161
+ */
162
+ get: function () {
163
+ return this.placementDivIdProperty;
164
+ },
165
+ /**
166
+ * Gets or sets the parent div element reference or id for the Tooltip
167
+ */
168
+ set: function (value) {
169
+ if (this.placementDivIdProperty !== value) {
170
+ this.placementDivIdProperty = value;
171
+ this.notifyPropertyChanged(constants_1.PROPERTY.PLACEMENT_DIV_ID);
172
+ }
173
+ },
174
+ enumerable: false,
175
+ configurable: true
176
+ });
128
177
  return RolloverTooltipSvgAnnotation;
129
178
  }(SvgAnnotationBase_1.SvgAnnotationBase));
130
179
  exports.RolloverTooltipSvgAnnotation = RolloverTooltipSvgAnnotation;
@@ -1,4 +1,5 @@
1
1
  import { Rect } from "../../../Core/Rect";
2
+ import { EVerticalAlignment } from "../../../types/LabelPlacement";
2
3
  import { ModifierMouseArgs } from "../../ChartModifiers/ModifierMouseArgs";
3
4
  import { WebGlRenderContext2D } from "../../Drawing/WebGlRenderContext2D";
4
5
  import { CoordinateCalculatorBase } from "../../Numerics/CoordinateCalculators/CoordinateCalculatorBase";
@@ -22,6 +23,7 @@ export declare class VerticalLineAnnotation extends LineAnnotation {
22
23
  readonly type: EAnnotationType;
23
24
  dragOnLine: boolean;
24
25
  dragOnLabel: boolean;
26
+ verticalAlignment: EVerticalAlignment;
25
27
  private labelRect;
26
28
  /**
27
29
  * Create an instance of a LineAnnotation
@@ -58,7 +58,7 @@ var VerticalLineAnnotation = /** @class */ (function (_super) {
58
58
  * @param options Optional parameters of type {@link ILineAnnotationOptions} which configure the annotation upon construction
59
59
  */
60
60
  function VerticalLineAnnotation(options) {
61
- var _a, _b;
61
+ var _a, _b, _c;
62
62
  var _this = _super.call(this, options) || this;
63
63
  /** @inheritDoc */
64
64
  _this.type = IAnnotation_1.EAnnotationType.RenderContextVerticalLineAnnotation;
@@ -72,6 +72,7 @@ var VerticalLineAnnotation = /** @class */ (function (_super) {
72
72
  }
73
73
  _this.dragOnLine = (_a = options === null || options === void 0 ? void 0 : options.dragOnLine) !== null && _a !== void 0 ? _a : _this.dragOnLine;
74
74
  _this.dragOnLabel = (_b = options === null || options === void 0 ? void 0 : options.dragOnLabel) !== null && _b !== void 0 ? _b : _this.dragOnLabel;
75
+ _this.verticalAlignment = (_c = options === null || options === void 0 ? void 0 : options.verticalAlignment) !== null && _c !== void 0 ? _c : _this.verticalAlignment;
75
76
  return _this;
76
77
  }
77
78
  Object.defineProperty(VerticalLineAnnotation.prototype, "y2", {
@@ -138,7 +139,7 @@ var VerticalLineAnnotation = /** @class */ (function (_super) {
138
139
  var isLineAnnotationEdgeVisible = !isPartialLine || isLineAnnotationInVerticalVisibleRange;
139
140
  if (isAxisLabelInHorizontalVisibleRange && isLineAnnotationEdgeVisible) {
140
141
  var textStyle = __assign(__assign({}, verticalAxis.labelStyle), { color: this.axisLabelStroke, fontSize: this.axisFontSize * DpiHelper_1.DpiHelper.PIXEL_RATIO, fontFamily: this.axisFontFamily });
141
- var labelRect = (0, drawLabel_1.drawLineAnnotation)(horizontalAxis, renderContext, this.labelPlacement, this.labelValue, borderX1, borderX2, borderY1, borderY2, textStyle, this.axisLabelFill, strokePen, viewRect, this.showLabel, this.opacity);
142
+ var labelRect = (0, drawLabel_1.drawLineAnnotation)(horizontalAxis, renderContext, this.labelPlacement, this.labelValue, borderX1, borderX2, borderY1, borderY2, textStyle, this.axisLabelFill, strokePen, viewRect, this.showLabel, this.opacity, null, this.verticalAlignment);
142
143
  if (labelRect) {
143
144
  var point1 = (0, translate_1.translateFromCanvasToSeriesViewRect)(new Point_1.Point(labelRect.left, labelRect.top), viewRect, true);
144
145
  var point2 = (0, translate_1.translateFromCanvasToSeriesViewRect)(new Point_1.Point(labelRect.right, labelRect.bottom), viewRect, true);
@@ -51,7 +51,8 @@ export declare enum PROPERTY {
51
51
  Y2 = "Y2",
52
52
  YAXIS_ID = "YAXIS_ID",
53
53
  Y_COORDINATE_MODE = "Y_COORDINATE_MODE",
54
- Y_COORD_SHIFT = "Y_COORD_SHIFT"
54
+ Y_COORD_SHIFT = "Y_COORD_SHIFT",
55
+ PLACEMENT_DIV_ID = "PLACEMENT_DIV_ID"
55
56
  }
56
57
  export declare const ADORNER_GRIP_RADIUS = 10;
57
58
  export declare const DISTANCE_TO_LINE = 10;
@@ -56,6 +56,7 @@ var PROPERTY;
56
56
  PROPERTY["YAXIS_ID"] = "YAXIS_ID";
57
57
  PROPERTY["Y_COORDINATE_MODE"] = "Y_COORDINATE_MODE";
58
58
  PROPERTY["Y_COORD_SHIFT"] = "Y_COORD_SHIFT";
59
+ PROPERTY["PLACEMENT_DIV_ID"] = "PLACEMENT_DIV_ID";
59
60
  })(PROPERTY = exports.PROPERTY || (exports.PROPERTY = {}));
60
61
  exports.ADORNER_GRIP_RADIUS = 10;
61
62
  exports.DISTANCE_TO_LINE = 10;
@@ -144,6 +144,7 @@ export interface IAxisBase2dOptions extends IAxisCoreOptions {
144
144
  * Useful to align seriesViewRects for different charts
145
145
  */
146
146
  axisThickness?: number;
147
+ backgroundColor?: string;
147
148
  }
148
149
  /**
149
150
  * The base class for 2D Chart Axis within SciChart - High Performance {@link https://www.scichart.com/javascript-chart-features | JavaScript Charts}.
@@ -238,6 +239,14 @@ export declare abstract class AxisBase2D extends AxisCore implements IThemeable
238
239
  * This is only used to allow multiple primary axes, so that all stacked axes can draw gridlines
239
240
  */
240
241
  set isStackedAxis(value: boolean);
242
+ /**
243
+ * Gets the background color of separate Axis
244
+ */
245
+ get backgroundColor(): string;
246
+ /**
247
+ * Sets the background color of separate Axis
248
+ */
249
+ set backgroundColor(value: string);
241
250
  /** Gets or sets the length of a stacked axis as an absolute number or percentage, e.g. 100, or "30%".
242
251
  * A plain number will be interpreted as a number of pixels.
243
252
  * A number with % will take that percentage of the total length.
@@ -341,6 +350,7 @@ export declare abstract class AxisBase2D extends AxisCore implements IThemeable
341
350
  private axisLengthProperty;
342
351
  private offsetProperty;
343
352
  private tickCache;
353
+ private backgroundColorProperty;
344
354
  /**
345
355
  * Creates an instance of the {@link AxisBase2D}
346
356
  * @param webAssemblyContext The {@link TSciChart | SciChart 2D WebAssembly Context} containing native methods and
@@ -100,7 +100,7 @@ var AxisBase2D = /** @class */ (function (_super) {
100
100
  * @param options Optional parameters of type {@link IAxisBase2dOptions} used to configure the axis at instantiation time
101
101
  */
102
102
  function AxisBase2D(webAssemblyContext, options) {
103
- var _a, _b, _c, _d, _e, _f, _g, _h;
103
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
104
104
  var _this = _super.call(this, options) || this;
105
105
  /**
106
106
  * Gets the {@link AxisLayoutState} class which manages layout
@@ -157,6 +157,7 @@ var AxisBase2D = /** @class */ (function (_super) {
157
157
  }
158
158
  }
159
159
  _this.autoRangeAnimationProperty = options === null || options === void 0 ? void 0 : options.autoRangeAnimation;
160
+ _this.backgroundColor = (_j = options === null || options === void 0 ? void 0 : options.backgroundColor) !== null && _j !== void 0 ? _j : _this.backgroundColor;
160
161
  return _this;
161
162
  }
162
163
  Object.defineProperty(AxisBase2D.prototype, "labelProvider", {
@@ -348,6 +349,25 @@ var AxisBase2D = /** @class */ (function (_super) {
348
349
  enumerable: false,
349
350
  configurable: true
350
351
  });
352
+ Object.defineProperty(AxisBase2D.prototype, "backgroundColor", {
353
+ /**
354
+ * Gets the background color of separate Axis
355
+ */
356
+ get: function () {
357
+ return this.backgroundColorProperty;
358
+ },
359
+ /**
360
+ * Sets the background color of separate Axis
361
+ */
362
+ set: function (value) {
363
+ this.backgroundColorProperty = value;
364
+ if (this.invalidateParentCallback) {
365
+ this.invalidateParentCallback();
366
+ }
367
+ },
368
+ enumerable: false,
369
+ configurable: true
370
+ });
351
371
  Object.defineProperty(AxisBase2D.prototype, "stackedAxisLength", {
352
372
  /** Gets or sets the length of a stacked axis as an absolute number or percentage, e.g. 100, or "30%".
353
373
  * A plain number will be interpreted as a number of pixels.
@@ -590,6 +610,57 @@ var AxisBase2D = /** @class */ (function (_super) {
590
610
  }
591
611
  // make sure axes is drawn at the last stage
592
612
  renderContext.enqueueLayeredDraw(function () {
613
+ // Draw background
614
+ if (_this.backgroundColorProperty) {
615
+ var viewAxisRect = _this.axisRenderer.viewRect;
616
+ var viewTitleRect = _this.axisTitleRenderer.viewRect;
617
+ var brush = new _this.webAssemblyContext2D.SCRTSolidBrush((0, parseColor_1.parseColorToUIntArgb)(_this.backgroundColorProperty), false);
618
+ var nativeAxisRect = void 0;
619
+ var nativeTitleRect = void 0;
620
+ // Empty space covering for axis coloring
621
+ // let shift: number = 0;
622
+ // let additionalSize: number = 0;
623
+ // if (this.isHorizontalAxis) {
624
+ // this.parentSurface.yAxes.asArray().forEach((yAxis: AxisBase2D, index: number) => {
625
+ // const size: number = yAxis.axisRenderer.viewAxisRect.width + yAxis.axisTitleRenderer.viewAxisRect.width;
626
+ // if (index === 0) {
627
+ // shift += size;
628
+ // } else {
629
+ // additionalSize += size;
630
+ // }
631
+ // });
632
+ // nativeAxisRect = createNativeRect(this.webAssemblyContext2D, 0 - shift, 0, viewAxisRect.width + additionalSize, viewAxisRect.height);
633
+ // nativeTitleRect = createNativeRect(this.webAssemblyContext2D, 0 - shift, 0, viewTitleRect.width + additionalSize, viewTitleRect.height);
634
+ // } else {
635
+ // this.parentSurface.xAxes.asArray().forEach((xAxis: AxisBase2D, index: number) => {
636
+ // const size: number = xAxis.axisRenderer.viewAxisRect.height + xAxis.axisTitleRenderer.viewAxisRect.height;
637
+ // if (index === 0) {
638
+ // shift += size;
639
+ // } else {
640
+ // additionalSize += size;
641
+ // }
642
+ // });
643
+ // nativeAxisRect = createNativeRect(this.webAssemblyContext2D, 0, 0 - shift, viewAxisRect.width, viewAxisRect.height + additionalSize);
644
+ // nativeTitleRect = createNativeRect(this.webAssemblyContext2D, 0, 0 - shift, viewTitleRect.width, viewTitleRect.height + additionalSize);
645
+ // }
646
+ nativeAxisRect = (0, createNativeRect_1.createNativeRect)(_this.webAssemblyContext2D, 0, 0, viewAxisRect.width, viewAxisRect.height);
647
+ nativeTitleRect = (0, createNativeRect_1.createNativeRect)(_this.webAssemblyContext2D, 0, 0, viewTitleRect.width, viewTitleRect.height);
648
+ if (nativeAxisRect) {
649
+ var vecRects = new _this.webAssemblyContext2D.VectorRectVertex();
650
+ vecRects.push_back(nativeAxisRect);
651
+ renderContext.drawRects(vecRects, brush, viewAxisRect.left, viewAxisRect.top);
652
+ nativeAxisRect.delete();
653
+ vecRects.delete();
654
+ }
655
+ if (nativeTitleRect) {
656
+ var vecRects = new _this.webAssemblyContext2D.VectorRectVertex();
657
+ vecRects.push_back(nativeTitleRect);
658
+ renderContext.drawRects(vecRects, brush, viewTitleRect.left, viewTitleRect.top);
659
+ nativeTitleRect === null || nativeTitleRect === void 0 ? void 0 : nativeTitleRect.delete();
660
+ vecRects.delete();
661
+ }
662
+ brush.delete();
663
+ }
593
664
  // Draw axis labels
594
665
  if (_this.drawLabels) {
595
666
  if (SciChartSurfaceBase_1.DebugForDpi) {
@@ -0,0 +1,29 @@
1
+ import { ELabelProviderType } from "../../../../types/LabelProviderType";
2
+ import { IPieSegment } from "../../SciChartPieSurface/PieSegment/IPieSegment";
3
+ import { SciChartPieSurface } from "../../SciChartPieSurface/SciChartPieSurface";
4
+ import { ILabelOptions, LabelProvider } from "./LabelProvider";
5
+ /**
6
+ * @summary A Label Provider for use with Pie Charts to allow customizing of segment labels
7
+ */
8
+ export declare class PieLabelProvider extends LabelProvider {
9
+ readonly type = ELabelProviderType.Pie;
10
+ /**
11
+ * The parent {@link SciChartPieSurface}. This will be set once {@link attachedToSurface} is called
12
+ */
13
+ protected parentSurface: SciChartPieSurface;
14
+ /**
15
+ *
16
+ */
17
+ constructor(options?: ILabelOptions);
18
+ getSegmentText(segment: IPieSegment, total: number): string;
19
+ /**
20
+ * Called when the {@link LabelProvider} is attached to an {@link SciChartPieSurface }
21
+ * @param pieSurface The SciPieSurface we are attached to.
22
+ */
23
+ attachedToSurface(pieSurface: SciChartPieSurface): void;
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ onBeginAxisDraw(): void;
28
+ protected invalidateParent(): void;
29
+ }