scichart 3.1.333 → 3.1.348

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 (41) hide show
  1. package/Charting/ChartModifiers/RolloverModifier.d.ts +11 -0
  2. package/Charting/ChartModifiers/RolloverModifier.js +59 -46
  3. package/Charting/ChartModifiers/ZoomExtentsModifier.js +2 -2
  4. package/Charting/ChartModifiers/ZoomPanModifier.js +2 -0
  5. package/Charting/Model/BaseDataSeries.js +3 -6
  6. package/Charting/Model/HlcDataSeries.js +4 -5
  7. package/Charting/Model/OhlcDataSeries.js +2 -3
  8. package/Charting/Model/XyyDataSeries.js +2 -2
  9. package/Charting/Services/ChartTitleRenderer.js +1 -8
  10. package/Charting/Services/TitleRenderer.d.ts +5 -4
  11. package/Charting/Services/TitleRenderer.js +24 -19
  12. package/Charting/Visuals/Annotations/OverviewCustomResizableAnnotation.js +2 -0
  13. package/Charting/Visuals/Axis/AxisCore.d.ts +17 -11
  14. package/Charting/Visuals/Axis/AxisCore.js +14 -9
  15. package/Charting/Visuals/Axis/AxisTitleRenderer.d.ts +3 -3
  16. package/Charting/Visuals/Axis/AxisTitleRenderer.js +2 -8
  17. package/Charting/Visuals/Axis/IAxisCoreOptions.d.ts +2 -2
  18. package/Charting/Visuals/RenderableSeries/HitTest/BandSeriesHitTestProvider.js +11 -4
  19. package/Charting/Visuals/RenderableSeries/HitTest/BaseHitTestProvider.js +11 -4
  20. package/Charting/Visuals/RenderableSeries/HitTest/LineSeriesHitTestProvider.js +11 -4
  21. package/Charting/Visuals/SciChartSurface.js +1 -1
  22. package/Charting3D/Model/DataSeries/UniformGridDataSeries3D.d.ts +1 -1
  23. package/Charting3D/Model/DataSeries/UniformGridDataSeries3D.js +1 -1
  24. package/Core/BuildStamp.d.ts +1 -1
  25. package/Core/BuildStamp.js +2 -2
  26. package/Core/ObservableArray.d.ts +11 -5
  27. package/Core/ObservableArray.js +25 -6
  28. package/_wasm/scichart.browser.js +1 -1
  29. package/_wasm/scichart2d.js +7 -7
  30. package/_wasm/scichart2d.wasm +0 -0
  31. package/_wasm/scichart3d.js +16 -16
  32. package/_wasm/scichart3d.wasm +0 -0
  33. package/index.d.ts +2 -0
  34. package/index.js +13 -11
  35. package/index.min.js +1 -1
  36. package/package.json +1 -1
  37. package/types/TextStyle.d.ts +2 -0
  38. package/types/TextStyle.js +1 -1
  39. package/utils/date.js +2 -0
  40. package/utils/text.d.ts +3 -2
  41. package/utils/text.js +45 -2
@@ -222,6 +222,17 @@ export declare class RolloverModifier extends ChartModifierBase2D implements IIn
222
222
  type: string;
223
223
  options: Required<Omit<IChartModifierBaseOptions, never>>;
224
224
  };
225
+ /**
226
+ * Called internally to adjust the positions of tooltips if there are overlaps, or if it is a vertical chart
227
+ * @param tooltipArray
228
+ * @param allowTooltipOverlapping
229
+ * @param spacing
230
+ * @param seriesViewRect
231
+ * @param pixelRatio
232
+ * @param isVerticalChart
233
+ * @returns TTooltipProps[]
234
+ */
235
+ protected CalculateTooltipPositions(tooltipArray: TTooltipProps[], allowTooltipOverlapping: boolean, spacing: number, seriesViewRect: Rect, pixelRatio: number, isVerticalChart?: boolean): TTooltipProps[];
225
236
  /** @inheritDoc */
226
237
  protected notifyPropertyChanged(propertyName: string): void;
227
238
  private isVerticalChart;
@@ -389,6 +389,20 @@ var RolloverModifier = /** @class */ (function (_super) {
389
389
  Object.assign(json.options, options);
390
390
  return json;
391
391
  };
392
+ /**
393
+ * Called internally to adjust the positions of tooltips if there are overlaps, or if it is a vertical chart
394
+ * @param tooltipArray
395
+ * @param allowTooltipOverlapping
396
+ * @param spacing
397
+ * @param seriesViewRect
398
+ * @param pixelRatio
399
+ * @param isVerticalChart
400
+ * @returns TTooltipProps[]
401
+ */
402
+ RolloverModifier.prototype.CalculateTooltipPositions = function (tooltipArray, allowTooltipOverlapping, spacing, seriesViewRect, pixelRatio, isVerticalChart) {
403
+ if (isVerticalChart === void 0) { isVerticalChart = false; }
404
+ return (0, exports.calcTooltipPositions)(tooltipArray, allowTooltipOverlapping, spacing, seriesViewRect, pixelRatio, isVerticalChart);
405
+ };
392
406
  /** @inheritDoc */
393
407
  RolloverModifier.prototype.notifyPropertyChanged = function (propertyName) {
394
408
  _super.prototype.notifyPropertyChanged.call(this, propertyName);
@@ -546,12 +560,10 @@ var RolloverModifier = /** @class */ (function (_super) {
546
560
  }
547
561
  var tooltipArray = [];
548
562
  rsList.forEach(function (rs, index) {
549
- var visibleYMin = rs.yAxis.visibleRange.min;
550
- var visibleYMax = rs.yAxis.visibleRange.max;
551
563
  var hitTestInfo = _this.hitTestRenderableSeries(rs, _this.mousePoint);
552
564
  if (hitTestInfo) {
553
565
  if (rs.type !== SeriesType_1.ESeriesType.StackedColumnSeries || hitTestInfo.isHit) {
554
- var isVisible = visibleYMin <= hitTestInfo.yValue && hitTestInfo.yValue <= visibleYMax;
566
+ var isVisible = 0 <= hitTestInfo.yCoord && hitTestInfo.yCoord <= _this.parentSurface.seriesViewRect.height;
555
567
  if (isVisible) {
556
568
  var absoluteXCoord = _this.isVerticalChart() ? hitTestInfo.yCoord : hitTestInfo.xCoord;
557
569
  var absoluteYCoord = _this.isVerticalChart() ? hitTestInfo.xCoord : hitTestInfo.yCoord;
@@ -561,7 +573,7 @@ var RolloverModifier = /** @class */ (function (_super) {
561
573
  }
562
574
  }
563
575
  if (rs.type === SeriesType_1.ESeriesType.BandSeries) {
564
- var isVisibleY1 = visibleYMin <= hitTestInfo.y1Value && hitTestInfo.y1Value <= visibleYMax;
576
+ var isVisibleY1 = 0 <= hitTestInfo.y1Coord && hitTestInfo.y1Coord <= _this.parentSurface.seriesViewRect.height;
565
577
  if (isVisibleY1) {
566
578
  var absoluteXCoord = _this.isVerticalChart() ? hitTestInfo.y1Coord : hitTestInfo.xCoord;
567
579
  var absoluteYCoord = _this.isVerticalChart() ? hitTestInfo.xCoord : hitTestInfo.y1Coord;
@@ -575,7 +587,7 @@ var RolloverModifier = /** @class */ (function (_super) {
575
587
  var orderedTooltipArray = tooltipArray.sort(function (a, b) {
576
588
  return a.yCoord > b.yCoord ? 1 : b.yCoord > a.yCoord ? -1 : 0;
577
589
  });
578
- var tooltipPositions = (0, exports.calcTooltipPositions)(orderedTooltipArray, this.allowTooltipOverlapping, TOOLTIP_SPACING * DpiHelper_1.DpiHelper.PIXEL_RATIO, this.parentSurface.seriesViewRect, DpiHelper_1.DpiHelper.PIXEL_RATIO, this.isVerticalChart());
590
+ var tooltipPositions = this.CalculateTooltipPositions(orderedTooltipArray, this.allowTooltipOverlapping, TOOLTIP_SPACING * DpiHelper_1.DpiHelper.PIXEL_RATIO, this.parentSurface.seriesViewRect, DpiHelper_1.DpiHelper.PIXEL_RATIO, this.isVerticalChart());
579
591
  tooltipPositions.forEach(function (el) {
580
592
  var rs = rsList[el.index];
581
593
  var showTooltip = _this.showTooltip && el.seriesInfo.isHit;
@@ -661,50 +673,51 @@ exports.RolloverModifier = RolloverModifier;
661
673
  var calcTooltipProps = function (index, rs, rolloverProps, seriesViewRect, xValue, yValue, absoluteXCoord, absoluteYCoord, hitTestInfo, pixelRatio, isY1, isVerticalChart) {
662
674
  if (isY1 === void 0) { isY1 = false; }
663
675
  if (isVerticalChart === void 0) { isVerticalChart = false; }
664
- var visibleRange = rs.yAxis.visibleRange;
665
- var isVisible = visibleRange.min <= yValue && yValue <= visibleRange.max;
666
- if (isVisible) {
667
- var seriesInfo = rs.getSeriesInfo(hitTestInfo);
668
- var width = rolloverProps.tooltip.width;
669
- var scaledWidth = width * pixelRatio;
670
- var height = rolloverProps.tooltip.height;
671
- var scaledHeight = height * pixelRatio;
672
- var distTop = absoluteYCoord;
673
- var distBottom = seriesViewRect.height - absoluteYCoord;
674
- var defaultVerticalShift = 5 * pixelRatio;
675
- var xCoordShift = seriesViewRect.width - absoluteXCoord < scaledWidth ? -width : 5;
676
- var yCoordShift = isVerticalChart ? defaultVerticalShift : -height / 2;
677
- if (isVerticalChart) {
678
- if (distBottom < scaledHeight + defaultVerticalShift) {
679
- yCoordShift = ((scaledHeight + defaultVerticalShift) / pixelRatio) * -1;
680
- }
676
+ // This check is done in calling code
677
+ // const visibleRange = rs.yAxis.visibleRange;
678
+ // const isVisible = visibleRange.min <= yValue && yValue <= visibleRange.max);
679
+ // if (isVisible) {
680
+ var seriesInfo = rs.getSeriesInfo(hitTestInfo);
681
+ var width = rolloverProps.tooltip.width;
682
+ var scaledWidth = width * pixelRatio;
683
+ var height = rolloverProps.tooltip.height;
684
+ var scaledHeight = height * pixelRatio;
685
+ var distTop = absoluteYCoord;
686
+ var distBottom = seriesViewRect.height - absoluteYCoord;
687
+ var defaultVerticalShift = 5 * pixelRatio;
688
+ var xCoordShift = seriesViewRect.width - absoluteXCoord < scaledWidth ? -width : 5;
689
+ var yCoordShift = isVerticalChart ? defaultVerticalShift : -height / 2;
690
+ if (isVerticalChart) {
691
+ if (distBottom < scaledHeight + defaultVerticalShift) {
692
+ yCoordShift = ((scaledHeight + defaultVerticalShift) / pixelRatio) * -1;
681
693
  }
682
- else {
683
- if (distTop < scaledHeight / 2) {
684
- yCoordShift = -distTop / pixelRatio;
685
- }
686
- else if (distBottom < scaledHeight / 2) {
687
- yCoordShift = -(scaledHeight - distBottom) / pixelRatio;
688
- }
694
+ }
695
+ else {
696
+ if (distTop < scaledHeight / 2) {
697
+ yCoordShift = -distTop / pixelRatio;
698
+ }
699
+ else if (distBottom < scaledHeight / 2) {
700
+ yCoordShift = -(scaledHeight - distBottom) / pixelRatio;
689
701
  }
690
- var newRecord = {
691
- index: index,
692
- isY1: isY1,
693
- xValue: xValue,
694
- yValue: yValue,
695
- xCoord: absoluteXCoord,
696
- yCoord: absoluteYCoord,
697
- hitTestPointValues: hitTestInfo.hitTestPointValues,
698
- isCategoryAxis: hitTestInfo.isCategoryAxis,
699
- xCoordShift: xCoordShift,
700
- yCoordShift: yCoordShift,
701
- height: scaledHeight,
702
- width: scaledWidth,
703
- seriesInfo: seriesInfo
704
- };
705
- return newRecord;
706
702
  }
707
- return undefined;
703
+ var newRecord = {
704
+ index: index,
705
+ isY1: isY1,
706
+ xValue: xValue,
707
+ yValue: yValue,
708
+ xCoord: absoluteXCoord,
709
+ yCoord: absoluteYCoord,
710
+ hitTestPointValues: hitTestInfo.hitTestPointValues,
711
+ isCategoryAxis: hitTestInfo.isCategoryAxis,
712
+ xCoordShift: xCoordShift,
713
+ yCoordShift: yCoordShift,
714
+ height: scaledHeight,
715
+ width: scaledWidth,
716
+ seriesInfo: seriesInfo
717
+ };
718
+ return newRecord;
719
+ // }
720
+ // return undefined;
708
721
  };
709
722
  exports.calcTooltipProps = calcTooltipProps;
710
723
  /**
@@ -125,11 +125,11 @@ var ZoomExtentsModifier = /** @class */ (function (_super) {
125
125
  activeAxes.forEach(function (axis) {
126
126
  if (axis.isXAxis) {
127
127
  var maxXRange = axis.getMaximumRange();
128
- scs.addAnimation(axis.animateVisibleRange(maxXRange, animationDuration, _this.easingFunction));
128
+ axis.animateVisibleRange(maxXRange, animationDuration, _this.easingFunction);
129
129
  }
130
130
  else {
131
131
  var yRange = axis.getWindowedYRange(undefined);
132
- scs.addAnimation(axis.animateVisibleRange(yRange, animationDuration, _this.easingFunction));
132
+ axis.animateVisibleRange(yRange, animationDuration, _this.easingFunction);
133
133
  }
134
134
  });
135
135
  }
@@ -75,6 +75,8 @@ var ZoomPanModifier = /** @class */ (function (_super) {
75
75
  }
76
76
  /** @inheritDoc */
77
77
  ZoomPanModifier.prototype.modifierMouseDown = function (args) {
78
+ // handles default browser dragging behavior when canvas was selected with Ctrl + A
79
+ args.nativeEvent.preventDefault();
78
80
  _super.prototype.modifierMouseDown.call(this, args);
79
81
  if (this.executeOn !== args.button) {
80
82
  return;
@@ -535,10 +535,10 @@ isSorted) {
535
535
  // TODO: getPositiveRange
536
536
  var count = xValues.size();
537
537
  // if one point
538
+ // We will expand zero width ranges in the axis
538
539
  if (count === 1) {
539
- var min = yValues.get(0) - 1;
540
- var max = yValues.get(0) + 1;
541
- return new NumberRange_1.NumberRange(min, max);
540
+ var y = yValues.get(0);
541
+ return new NumberRange_1.NumberRange(y, y);
542
542
  }
543
543
  var indicesRange = isXCategoryAxis ? xRange : (0, exports.getIndicesRange)(webAssemblyContext, xValues, xRange, isSorted);
544
544
  var iMin = Math.max(Math.floor(indicesRange.min), 0);
@@ -552,9 +552,6 @@ isSorted) {
552
552
  if (!(0, isRealNumber_1.isRealNumber)(minMax.minD) || !(0, isRealNumber_1.isRealNumber)(minMax.maxD)) {
553
553
  return undefined;
554
554
  }
555
- if (minMax.minD === minMax.maxD) {
556
- return new NumberRange_1.NumberRange(minMax.minD - 1, minMax.minD + 1);
557
- }
558
555
  return new NumberRange_1.NumberRange(minMax.minD, minMax.maxD);
559
556
  }
560
557
  finally {
@@ -394,13 +394,12 @@ var HlcDataSeries = /** @class */ (function (_super) {
394
394
  // if one point
395
395
  if (this.count() === 1 && !isHorizontalDirection) {
396
396
  if (isHorizontalDirection) {
397
- var min = yValues.get(0) - 1;
398
- var max = yValues.get(0) + 1;
399
- return new NumberRange_1.NumberRange(min, max);
397
+ var y = yValues.get(0);
398
+ return new NumberRange_1.NumberRange(y, y);
400
399
  }
401
400
  else {
402
- var min = Math.min(hValues.get(0), lValues.get(0)) - 1;
403
- var max = Math.max(hValues.get(0), lValues.get(0)) + 1;
401
+ var min = Math.min(hValues.get(0), lValues.get(0));
402
+ var max = Math.max(hValues.get(0), lValues.get(0));
404
403
  return new NumberRange_1.NumberRange(min, max);
405
404
  }
406
405
  }
@@ -352,9 +352,8 @@ var OhlcDataSeries = /** @class */ (function (_super) {
352
352
  if (dataSeriesValueType === void 0) { dataSeriesValueType = IDataSeries_1.EDataSeriesValueType.Default; }
353
353
  var _a = this.getOHLCValues(dataSeriesValueType), closeValues = _a.closeValues, highValues = _a.highValues, lowValues = _a.lowValues;
354
354
  if (this.count() === 1) {
355
- var min = closeValues.get(0) - 1;
356
- var max = closeValues.get(0) + 1;
357
- return new NumberRange_1.NumberRange(min, max);
355
+ var y = closeValues.get(0);
356
+ return new NumberRange_1.NumberRange(y, y);
358
357
  }
359
358
  var indicesRange = isXCategoryAxis ? xRange : this.getIndicesRange(xRange);
360
359
  var yMin = Number.MAX_VALUE;
@@ -288,8 +288,8 @@ var XyyDataSeries = /** @class */ (function (_super) {
288
288
  // TODO: getPositiveRange
289
289
  // if one point
290
290
  if (this.count() === 1) {
291
- var min = Math.min(yValues.get(0), y1Values.get(0)) - 1;
292
- var max = Math.max(yValues.get(0), y1Values.get(0)) + 1;
291
+ var min = Math.min(yValues.get(0), y1Values.get(0));
292
+ var max = Math.max(yValues.get(0), y1Values.get(0));
293
293
  return new NumberRange_1.NumberRange(min, max);
294
294
  }
295
295
  var indicesRange = isXCategoryAxis ? xRange : this.getIndicesRange(xRange);
@@ -107,14 +107,7 @@ var ChartTitleRenderer = /** @class */ (function (_super) {
107
107
  };
108
108
  ChartTitleRenderer.prototype.getTitleTexture = function () {
109
109
  var position = this.textStyle.position;
110
- var adjRotation = 0;
111
- // let adjRotation = this.textStyle.rotation;
112
- if (position === TextStyle_1.ETitlePosition.Left) {
113
- adjRotation += -90;
114
- }
115
- else if (position === TextStyle_1.ETitlePosition.Right) {
116
- adjRotation += 90;
117
- }
110
+ var adjRotation = (0, TitleRenderer_1.getAdjustedRotation)(this.textStyle.rotation, position);
118
111
  var titleText = Array.isArray(this.text) ? this.text : this.text.split("\n");
119
112
  var texture = this.textureManager.createTextTexture(titleText,
120
113
  // @ts-ignore mismatch with TTextStyle
@@ -4,7 +4,7 @@ import { Rect } from "../../Core/Rect";
4
4
  import { Thickness } from "../../Core/Thickness";
5
5
  import { ETextAlignment, ETitlePosition, TChartTitleStyle } from "../../types/TextStyle";
6
6
  import { WebGlRenderContext2D } from "../Drawing/WebGlRenderContext2D";
7
- import { TTextStyle } from "../Visuals/Axis/AxisCore";
7
+ import { TAxisTitleStyle } from "../Visuals/Axis/AxisCore";
8
8
  import { TSciChart } from "../Visuals/SciChartSurface";
9
9
  import { INotifyOnDpiChanged, TDpiChangedEventArgs } from "../Visuals/TextureManager/DpiHelper";
10
10
  import { TextureManager, TTextureObject } from "../Visuals/TextureManager/TextureManager";
@@ -18,7 +18,7 @@ export interface IChartTitleRenderer extends ITitleRenderer {
18
18
  titleOffset: Thickness;
19
19
  measure(title: string | string[], originalTextStyle: Required<TChartTitleStyle>, renderContext: WebGlRenderContext2D): void;
20
20
  }
21
- export declare class TitleRendererBase<TextStyleType extends TTextStyle | TChartTitleStyle> implements ITitleRenderer {
21
+ export declare class TitleRendererBase<TextStyleType extends TAxisTitleStyle | TChartTitleStyle> implements ITitleRenderer {
22
22
  /**
23
23
  * Defines a bounding {@link Rect} containing the title text
24
24
  */
@@ -63,8 +63,8 @@ export declare class TitleRendererBase<TextStyleType extends TTextStyle | TChart
63
63
  protected texture: TTextureObject;
64
64
  /** The line spacing for native text calculated during measure */
65
65
  protected nativeLineSpacing: number;
66
- /** The height of the first line above baseline for native text, calculated during measure*/
67
- protected firstLineAscent: number;
66
+ protected nativeTextShiftX: number;
67
+ protected nativeTextShiftY: number;
68
68
  protected useNativeTextProperty: boolean;
69
69
  protected titlePosition: ETitlePosition;
70
70
  constructor(webAssemblyContext: TSciChart);
@@ -96,3 +96,4 @@ export declare class TitleRendererBase<TextStyleType extends TTextStyle | TChart
96
96
  */
97
97
  private getAlignmentAdjustmentDelta;
98
98
  }
99
+ export declare const getAdjustedRotation: (rotation: number, position: ETitlePosition) => number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TitleRendererBase = void 0;
3
+ exports.getAdjustedRotation = exports.TitleRendererBase = void 0;
4
4
  var app_1 = require("../../constants/app");
5
5
  var Deleter_1 = require("../../Core/Deleter");
6
6
  var Rect_1 = require("../../Core/Rect");
@@ -103,20 +103,9 @@ var TitleRendererBase = /** @class */ (function () {
103
103
  var nativeFont = renderContext.getFont(this.textStyle, true);
104
104
  // calculate start coordinates for native text drawing;
105
105
  // the start point is the beginning of alphabetic text baseline
106
- var tx = this.viewRect.left + this.textStyle.padding.left;
107
- var ty = this.viewRect.top + this.textStyle.padding.top + this.firstLineAscent;
108
- var adjRotation = 0;
109
- // let adjRotation = this.textStyle.rotation;
110
- if (position === TextStyle_1.ETitlePosition.Left) {
111
- adjRotation += -90;
112
- tx = this.viewRect.left + this.textStyle.padding.top + this.firstLineAscent;
113
- ty = this.viewRect.bottom - this.textStyle.padding.left;
114
- }
115
- else if (position === TextStyle_1.ETitlePosition.Right) {
116
- adjRotation += 90;
117
- tx = this.viewRect.right - this.textStyle.padding.top - this.firstLineAscent;
118
- ty = this.viewRect.top + this.textStyle.padding.left;
119
- }
106
+ var tx = this.viewRect.left + this.nativeTextShiftX;
107
+ var ty = this.viewRect.top + this.nativeTextShiftY;
108
+ var adjRotation = (0, exports.getAdjustedRotation)(this.textStyle.rotation, position);
120
109
  var rotationRad = -(adjRotation * Math.PI) / 180;
121
110
  var nativeMultilineAlignment = (0, TextPosition_1.convertMultiLineAlignment)(this.textStyle.multilineAlignment, this.webAssemblyContext);
122
111
  var textColor = (0, parseColor_1.parseColorToUIntArgb)(this.textStyle.color);
@@ -157,11 +146,13 @@ var TitleRendererBase = /** @class */ (function () {
157
146
  // @ts-ignore mismatch with TTextStyle
158
147
  var nativeFont = renderContext.getFont(textStyle, !hasHorizontalPlacement);
159
148
  var titleString = Array.isArray(title) ? title.join("\n") : title;
160
- var _a = (0, text_1.getNativeTextSize)(titleString, nativeFont, textStyle, this.webAssemblyContext), textHeight = _a.textHeight, textWidth = _a.textWidth, nativeLineSpacing = _a.nativeLineSpacing, firstLineAscent = _a.firstLineAscent;
161
- this.textHeight = textHeight;
162
- this.textWidth = textWidth;
149
+ var adjRotation = (0, exports.getAdjustedRotation)(textStyle.rotation, this.titlePosition);
150
+ var _a = (0, text_1.getNativeTextSize)(titleString, nativeFont, textStyle, this.webAssemblyContext, adjRotation), textHeight = _a.textHeight, textWidth = _a.textWidth, nativeLineSpacing = _a.nativeLineSpacing, deltaX = _a.deltaX, deltaY = _a.deltaY;
151
+ this.textHeight = hasHorizontalPlacement ? textHeight : textWidth;
152
+ this.textWidth = hasHorizontalPlacement ? textWidth : textHeight;
163
153
  this.nativeLineSpacing = nativeLineSpacing;
164
- this.firstLineAscent = firstLineAscent;
154
+ this.nativeTextShiftX = deltaX;
155
+ this.nativeTextShiftY = deltaY;
165
156
  this.desiredHeightProperty = hasHorizontalPlacement ? this.textHeight : this.textWidth;
166
157
  this.desiredWidthProperty = hasHorizontalPlacement ? this.textWidth : this.textHeight;
167
158
  }
@@ -247,3 +238,17 @@ var TitleRendererBase = /** @class */ (function () {
247
238
  return TitleRendererBase;
248
239
  }());
249
240
  exports.TitleRendererBase = TitleRendererBase;
241
+ var getAdjustedRotation = function (rotation, position) {
242
+ if (rotation !== undefined) {
243
+ return (rotation + 360) % 360;
244
+ }
245
+ var adjustedRotation = 0;
246
+ if (position === TextStyle_1.ETitlePosition.Left) {
247
+ adjustedRotation += -90;
248
+ }
249
+ else if (position === TextStyle_1.ETitlePosition.Right) {
250
+ adjustedRotation += 90;
251
+ }
252
+ return (adjustedRotation + 360) % 360;
253
+ };
254
+ exports.getAdjustedRotation = getAdjustedRotation;
@@ -175,6 +175,8 @@ var OverviewCustomResizableAnnotation = /** @class */ (function (_super) {
175
175
  */
176
176
  OverviewCustomResizableAnnotation.prototype.onDragStarted = function (args) {
177
177
  var _a;
178
+ // handles default browser dragging behavior when canvas was selected with Ctrl + A
179
+ args.nativeEvent.preventDefault();
178
180
  (_a = this.dragStarted) === null || _a === void 0 ? void 0 : _a.raiseEvent();
179
181
  var _b = this.getAnnotationBorders(true), x1 = _b.x1, x2 = _b.x2, y1 = _b.y1, y2 = _b.y2;
180
182
  var xyMousePoint = (0, translate_1.translateFromCanvasToSeriesViewRect)(new Point_1.Point(args.mousePoint.x, args.mousePoint.y), this.parentSurface.seriesViewRect, true);
@@ -69,6 +69,10 @@ export declare type TTextStyle = {
69
69
  /** Horizontal text alignment for multiline text. */
70
70
  multilineAlignment?: EMultiLineAlignment;
71
71
  };
72
+ export declare type TAxisTitleStyle = TTextStyle & {
73
+ /** Text rotation in degrees. */
74
+ rotation?: number;
75
+ };
72
76
  /**
73
77
  * Interface to minimal set of parameters which define an {@link AxisCore | Axis} in SciChart
74
78
  */
@@ -82,7 +86,7 @@ export interface IAxisParams {
82
86
  * axis.visibleRange = new NumberRange(15, 25);
83
87
  * ```
84
88
  * @remarks
85
- * The visibleRange is a data-value for {@link NumericAxis}, @{link NumericAxis3D} but refers to an **index** to the data
89
+ * The visibleRange is a data-value for {@link NumericAxis}, {@link NumericAxis3D} but refers to an **index** to the data
86
90
  * for {@link CategoryAxis} types.
87
91
  */
88
92
  visibleRange: NumberRange;
@@ -147,6 +151,8 @@ export declare abstract class AxisCore implements IAxisParams, IDeletable {
147
151
  visibleRangeChanged: EventHandler<VisibleRangeChangedArgs>;
148
152
  /** A flag to indicate if measure has been called this frame. Properties updated after measure must trigger a redraw */
149
153
  isMeasured: boolean;
154
+ /** If the diff of the visibleRange is 0, this growby fraction will be applied */
155
+ ZeroRangeGrowBy: number;
150
156
  /**
151
157
  * Internal backing property for {@link AxisCore.id}. To fire {@link AxisCore.invalidateParentCallback}, set the public property
152
158
  */
@@ -246,7 +252,7 @@ export declare abstract class AxisCore implements IAxisParams, IDeletable {
246
252
  /**
247
253
  * Internal backing property for {@link AxisCore.axisTitleStyle}. To fire {@link AxisCore.invalidateParentCallback}, set the public property
248
254
  */
249
- protected axisTitleStyleProperty: TTextStyle;
255
+ protected axisTitleStyleProperty: TAxisTitleStyle;
250
256
  /**
251
257
  * Internal backing property for {@link AxisCore.tickProvider}. To fire {@link AxisCore.invalidateParentCallback}, set the public property
252
258
  */
@@ -401,7 +407,7 @@ export declare abstract class AxisCore implements IAxisParams, IDeletable {
401
407
  * axis.visibleRange = new NumberRange(15, 25);
402
408
  * ```
403
409
  * @remarks
404
- * The visibleRange is a data-value for {@link NumericAxis}, @{link NumericAxis3D} but refers to an **index** to the data
410
+ * The visibleRange is a data-value for {@link NumericAxis}, {@link NumericAxis3D} but refers to an **index** to the data
405
411
  * for {@link CategoryAxis} types.
406
412
  */
407
413
  get visibleRange(): NumberRange;
@@ -414,7 +420,7 @@ export declare abstract class AxisCore implements IAxisParams, IDeletable {
414
420
  * axis.visibleRange = new NumberRange(15, 25);
415
421
  * ```
416
422
  * @remarks
417
- * The visibleRange is a data-value for {@link NumericAxis}, @{link NumericAxis3D} but refers to an **index** to the data
423
+ * The visibleRange is a data-value for {@link NumericAxis}, {@link NumericAxis3D} but refers to an **index** to the data
418
424
  * for {@link CategoryAxis} types.
419
425
  */
420
426
  set visibleRange(visibleRange: NumberRange);
@@ -597,12 +603,12 @@ export declare abstract class AxisCore implements IAxisParams, IDeletable {
597
603
  */
598
604
  set drawLabels(drawLabels: boolean);
599
605
  /**
600
- * When true, axis coordinates are flipped, e.g. a {@link NumericAxis} with @{link AxisCore.visibleRange | VisibleRange}
606
+ * When true, axis coordinates are flipped, e.g. a {@link NumericAxis} with {@link AxisCore.visibleRange | VisibleRange}
601
607
  * 0..10 will render from 10 to 0
602
608
  */
603
609
  get flippedCoordinates(): boolean;
604
610
  /**
605
- * When true, axis coordinates are flipped, e.g. a {@link NumericAxis} with @{link AxisCore.visibleRange | VisibleRange}
611
+ * When true, axis coordinates are flipped, e.g. a {@link NumericAxis} with {@link AxisCore.visibleRange | VisibleRange}
606
612
  * 0..10 will render from 10 to 0
607
613
  */
608
614
  set flippedCoordinates(flippedCoordinates: boolean);
@@ -669,17 +675,17 @@ export declare abstract class AxisCore implements IAxisParams, IDeletable {
669
675
  /**
670
676
  * Gets the {@link axisTitleStyle} adjusted for current DPI / Browser zoom level
671
677
  */
672
- get dpiAdjustedAxisTitleStyle(): TTextStyle;
678
+ get dpiAdjustedAxisTitleStyle(): TAxisTitleStyle;
673
679
  /**
674
680
  * @summary Gets or sets the Axis Title style
675
- * @remarks See {@link TTextStyle} for the type which contains style options
681
+ * @remarks See {@link TAxisTitleStyle} for the type which contains style options
676
682
  */
677
- get axisTitleStyle(): TTextStyle;
683
+ get axisTitleStyle(): TAxisTitleStyle;
678
684
  /**
679
685
  * @summary Gets or sets the Axis Title style
680
- * @remarks See {@link TTextStyle} for the type which contains style options
686
+ * @remarks See {@link TAxisTitleStyle} for the type which contains style options
681
687
  */
682
- set axisTitleStyle(textStyle: TTextStyle);
688
+ set axisTitleStyle(textStyle: TAxisTitleStyle);
683
689
  /**
684
690
  * Gets or sets the Axis title string
685
691
  * Use an array to create a multiLine title
@@ -24,8 +24,6 @@ var SciChartSurfaceBase_1 = require("../SciChartSurfaceBase");
24
24
  var DpiHelper_1 = require("../TextureManager/DpiHelper");
25
25
  var constants_1 = require("./constants");
26
26
  var VisibleRangeChangedArgs_1 = require("./VisibleRangeChangedArgs");
27
- /** @ignore */
28
- var ZeroRangeGrowBy = 0.01;
29
27
  /**
30
28
  * The base class for Axis within SciChart - High Performance {@link https://www.scichart.com/javascript-chart-features | JavaScript Charts}.
31
29
  * @description
@@ -52,6 +50,8 @@ var AxisCore = /** @class */ (function () {
52
50
  this.visibleRangeChanged = new EventHandler_1.EventHandler();
53
51
  /** A flag to indicate if measure has been called this frame. Properties updated after measure must trigger a redraw */
54
52
  this.isMeasured = false;
53
+ /** If the diff of the visibleRange is 0, this growby fraction will be applied */
54
+ this.ZeroRangeGrowBy = 0.01;
55
55
  /**
56
56
  * Internal backing property for {@link AxisCore.id}. To fire {@link AxisCore.invalidateParentCallback}, set the public property
57
57
  */
@@ -357,7 +357,7 @@ var AxisCore = /** @class */ (function () {
357
357
  * axis.visibleRange = new NumberRange(15, 25);
358
358
  * ```
359
359
  * @remarks
360
- * The visibleRange is a data-value for {@link NumericAxis}, @{link NumericAxis3D} but refers to an **index** to the data
360
+ * The visibleRange is a data-value for {@link NumericAxis}, {@link NumericAxis3D} but refers to an **index** to the data
361
361
  * for {@link CategoryAxis} types.
362
362
  */
363
363
  get: function () {
@@ -372,7 +372,7 @@ var AxisCore = /** @class */ (function () {
372
372
  * axis.visibleRange = new NumberRange(15, 25);
373
373
  * ```
374
374
  * @remarks
375
- * The visibleRange is a data-value for {@link NumericAxis}, @{link NumericAxis3D} but refers to an **index** to the data
375
+ * The visibleRange is a data-value for {@link NumericAxis}, {@link NumericAxis3D} but refers to an **index** to the data
376
376
  * for {@link CategoryAxis} types.
377
377
  */
378
378
  set: function (visibleRange) {
@@ -670,14 +670,14 @@ var AxisCore = /** @class */ (function () {
670
670
  });
671
671
  Object.defineProperty(AxisCore.prototype, "flippedCoordinates", {
672
672
  /**
673
- * When true, axis coordinates are flipped, e.g. a {@link NumericAxis} with @{link AxisCore.visibleRange | VisibleRange}
673
+ * When true, axis coordinates are flipped, e.g. a {@link NumericAxis} with {@link AxisCore.visibleRange | VisibleRange}
674
674
  * 0..10 will render from 10 to 0
675
675
  */
676
676
  get: function () {
677
677
  return this.flippedCoordinatesProperty;
678
678
  },
679
679
  /**
680
- * When true, axis coordinates are flipped, e.g. a {@link NumericAxis} with @{link AxisCore.visibleRange | VisibleRange}
680
+ * When true, axis coordinates are flipped, e.g. a {@link NumericAxis} with {@link AxisCore.visibleRange | VisibleRange}
681
681
  * 0..10 will render from 10 to 0
682
682
  */
683
683
  set: function (flippedCoordinates) {
@@ -817,14 +817,14 @@ var AxisCore = /** @class */ (function () {
817
817
  Object.defineProperty(AxisCore.prototype, "axisTitleStyle", {
818
818
  /**
819
819
  * @summary Gets or sets the Axis Title style
820
- * @remarks See {@link TTextStyle} for the type which contains style options
820
+ * @remarks See {@link TAxisTitleStyle} for the type which contains style options
821
821
  */
822
822
  get: function () {
823
823
  return this.axisTitleStyleProperty;
824
824
  },
825
825
  /**
826
826
  * @summary Gets or sets the Axis Title style
827
- * @remarks See {@link TTextStyle} for the type which contains style options
827
+ * @remarks See {@link TAxisTitleStyle} for the type which contains style options
828
828
  */
829
829
  set: function (textStyle) {
830
830
  this.axisTitleStyleProperty = __assign(__assign({}, this.axisTitleStyle), textStyle);
@@ -1006,7 +1006,12 @@ var AxisCore = /** @class */ (function () {
1006
1006
  AxisCore.prototype.coerceZeroVisibleRange = function (range) {
1007
1007
  Guard_1.Guard.notNull(range, "range");
1008
1008
  if (range.isZero()) {
1009
- return range.growBy(new NumberRange_1.NumberRange(ZeroRangeGrowBy, ZeroRangeGrowBy));
1009
+ if (range.min === 0) {
1010
+ return new NumberRange_1.NumberRange(-1, 1);
1011
+ }
1012
+ else {
1013
+ return range.growBy(new NumberRange_1.NumberRange(this.ZeroRangeGrowBy, this.ZeroRangeGrowBy));
1014
+ }
1010
1015
  }
1011
1016
  return range;
1012
1017
  };
@@ -3,11 +3,11 @@ import { EAxisAlignment } from "../../../types/AxisAlignment";
3
3
  import { WebGlRenderContext2D } from "../../Drawing/WebGlRenderContext2D";
4
4
  import { TitleRendererBase } from "../../Services/TitleRenderer";
5
5
  import { SciChartSurface } from "../SciChartSurface";
6
- import { TTextStyle } from "./AxisCore";
6
+ import { TAxisTitleStyle } from "./AxisCore";
7
7
  /**
8
8
  * Draws an axis title using our WebGL Rendering engine
9
9
  */
10
- export declare class AxisTitleRenderer extends TitleRendererBase<TTextStyle> {
10
+ export declare class AxisTitleRenderer extends TitleRendererBase<TAxisTitleStyle> {
11
11
  lineSpacing: number;
12
12
  /** For internal use */
13
13
  parentSurface: SciChartSurface;
@@ -15,7 +15,7 @@ export declare class AxisTitleRenderer extends TitleRendererBase<TTextStyle> {
15
15
  private previousLineSpacing;
16
16
  private previousNativeTextMode;
17
17
  private previousAxisAlignment;
18
- measure(text: string | string[], textStyle: TTextStyle, axisAlignment: EAxisAlignment): void;
18
+ measure(text: string | string[], textStyle: TAxisTitleStyle, axisAlignment: EAxisAlignment): void;
19
19
  get useNativeText(): boolean;
20
20
  set useNativeText(value: boolean);
21
21
  get desiredHeight(): number;
@@ -95,14 +95,7 @@ var AxisTitleRenderer = /** @class */ (function (_super) {
95
95
  };
96
96
  AxisTitleRenderer.prototype.getTitleTexture = function () {
97
97
  var position = this.titlePosition;
98
- var adjRotation = 0;
99
- // let adjRotation = this.textStyle.rotation;
100
- if (position === TextStyle_1.ETitlePosition.Left) {
101
- adjRotation += -90;
102
- }
103
- else if (position === TextStyle_1.ETitlePosition.Right) {
104
- adjRotation += 90;
105
- }
98
+ var adjRotation = (0, TitleRenderer_1.getAdjustedRotation)(this.textStyle.rotation, position);
106
99
  var titleText = Array.isArray(this.text) ? this.text : this.text.split("\n");
107
100
  var texture = this.textureManager.createTextTexture(titleText,
108
101
  // @ts-ignore mismatch with TTextStyle
@@ -127,6 +120,7 @@ var checkAreEqualTextStyles = function (style1, style2) {
127
120
  style1.fontStyle === style2.fontStyle &&
128
121
  style1.fontWeight === style2.fontWeight &&
129
122
  style1.alignment === style2.alignment &&
123
+ style1.rotation === style2.rotation &&
130
124
  style1.multilineAlignment === style2.multilineAlignment &&
131
125
  ((style1.padding === undefined && style2.padding === undefined) || style1.padding.equals(style2.padding)));
132
126
  };
@@ -19,7 +19,7 @@ export interface IAxisCoreOptions {
19
19
  * axis.visibleRange = new NumberRange(15, 25);
20
20
  * ```
21
21
  * @remarks
22
- * The visibleRange is a data-value for {@link NumericAxis}, @{link NumericAxis3D} but refers to an **index** to the data
22
+ * The visibleRange is a data-value for {@link NumericAxis}, {@link NumericAxis3D} but refers to an **index** to the data
23
23
  * for {@link CategoryAxis} types.
24
24
  */
25
25
  visibleRange?: NumberRange;
@@ -152,7 +152,7 @@ export interface IAxisCoreOptions {
152
152
  */
153
153
  axisBandsFill?: string;
154
154
  /**
155
- * When true, axis coordinates are flipped, e.g. a {@link NumericAxis} with @{link AxisCore.visibleRange | VisibleRange}
155
+ * When true, axis coordinates are flipped, e.g. a {@link NumericAxis} with {@link AxisCore.visibleRange | VisibleRange}
156
156
  * 0..10 will render from 10 to 0
157
157
  */
158
158
  flippedCoordinates?: boolean;