scichart 3.2.516 → 3.2.528
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.
- package/Charting/ChartModifiers/CursorModifier.d.ts +11 -0
- package/Charting/ChartModifiers/CursorModifier.js +66 -23
- package/Charting/ChartModifiers/RolloverModifier.js +18 -10
- package/Charting/ChartModifiers/constants.d.ts +2 -1
- package/Charting/ChartModifiers/constants.js +1 -0
- package/Charting/Model/ChartData/SeriesInfo.d.ts +1 -0
- package/Charting/Model/ChartData/SeriesInfo.js +1 -0
- package/Charting/Visuals/Annotations/CustomAnnotation.d.ts +35 -6
- package/Charting/Visuals/Annotations/CustomAnnotation.js +54 -14
- package/Charting/Visuals/Annotations/NativeTextAnnotation.js +48 -1
- package/Charting/Visuals/Annotations/RolloverMarkerSvgAnnotation.d.ts +1 -0
- package/Charting/Visuals/Annotations/RolloverMarkerSvgAnnotation.js +9 -5
- package/Charting/Visuals/Annotations/RolloverTooltipSvgAnnotation.js +8 -2
- package/Charting/Visuals/Annotations/TextAnnotation.d.ts +42 -0
- package/Charting/Visuals/Annotations/TextAnnotation.js +91 -12
- package/Charting/Visuals/Annotations/constants.d.ts +1 -0
- package/Charting/Visuals/Annotations/constants.js +1 -0
- package/Charting/Visuals/Legend/SciChartLegend.js +8 -1
- package/Charting/Visuals/RenderableSeries/HitTest/BandSeriesHitTestProvider.js +2 -2
- package/Charting/Visuals/RenderableSeries/HitTest/BaseHitTestProvider.js +5 -5
- package/Charting/Visuals/RenderableSeries/HitTest/BubbleSeriesHitTestProvider.js +4 -4
- package/Charting/Visuals/RenderableSeries/HitTest/HitTestInfo.d.ts +4 -0
- package/Charting/Visuals/RenderableSeries/HitTest/HitTestInfo.js +13 -0
- package/Charting/Visuals/RenderableSeries/HitTest/ImpulseSeriesHitTestProvider.js +3 -3
- package/Charting/Visuals/RenderableSeries/HitTest/LineSeriesHitTestProvider.js +4 -4
- package/Charting/Visuals/RenderableSeries/HitTest/ScatterSeriesHitTestProvider.js +3 -3
- package/Charting/Visuals/RenderableSeries/HitTest/TextSeriesHitTestProvider.js +2 -2
- package/Charting/Visuals/RenderableSeries/HitTest/hitTestHelpers.d.ts +9 -3
- package/Charting/Visuals/RenderableSeries/HitTest/hitTestHelpers.js +39 -56
- package/Charting/Visuals/RenderableSeries/RolloverModifier/RolloverModifierRenderableSeriesProps.d.ts +3 -0
- package/Charting/Visuals/RenderableSeries/RolloverModifier/RolloverModifierRenderableSeriesProps.js +12 -0
- package/Charting/Visuals/RenderableSeries/RolloverModifier/constants.d.ts +2 -1
- package/Charting/Visuals/RenderableSeries/RolloverModifier/constants.js +1 -0
- package/Charting/Visuals/RubberBandSvgRect/RubberBandSvgRect.d.ts +1 -1
- package/Charting/Visuals/RubberBandSvgRect/RubberBandSvgRect.js +16 -4
- package/Charting/Visuals/SciChartSurface.d.ts +14 -0
- package/Charting/Visuals/SciChartSurface.js +18 -0
- package/Charting/Visuals/createMaster.d.ts +1 -3
- package/Charting/Visuals/createMaster.js +4 -5
- package/Core/BuildStamp.d.ts +1 -1
- package/Core/BuildStamp.js +2 -2
- package/Core/Mouse/MouseManager.js +2 -2
- package/_wasm/scichart.browser.js +1 -1
- package/_wasm/scichart2d.js +1 -1
- package/_wasm/scichart2d.wasm +0 -0
- package/_wasm/scichart3d.wasm +0 -0
- package/index.d.ts +1 -0
- package/index.dev.js +430 -165
- package/index.js +13 -11
- package/index.min.js +1 -1
- package/package.json +1 -1
- package/types/TSciChart.d.ts +9 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Thickness } from "../../../Core/Thickness";
|
|
1
2
|
import { CoordinateCalculatorBase } from "../../Numerics/CoordinateCalculators/CoordinateCalculatorBase";
|
|
2
3
|
import { EAnnotationType } from "./IAnnotation";
|
|
3
4
|
import { ISvgAnnotationBaseOptions, SvgAnnotationBase } from "./SvgAnnotationBase";
|
|
@@ -25,6 +26,18 @@ export interface ITextAnnotationOptions extends ISvgAnnotationBaseOptions {
|
|
|
25
26
|
* Font weight provided by the user
|
|
26
27
|
*/
|
|
27
28
|
fontWeight?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Text background color provided by the user
|
|
31
|
+
*/
|
|
32
|
+
background?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Text padding provided by the user
|
|
35
|
+
*/
|
|
36
|
+
padding?: Thickness;
|
|
37
|
+
/**
|
|
38
|
+
* Text SVG class provided by the user
|
|
39
|
+
*/
|
|
40
|
+
className?: string;
|
|
28
41
|
}
|
|
29
42
|
/**
|
|
30
43
|
* A TextAnnotation presents text information over the chart at specific {@link X1}, {@link Y1} coordinates
|
|
@@ -37,6 +50,9 @@ export declare class TextAnnotation extends SvgAnnotationBase {
|
|
|
37
50
|
protected fontSizeProperty?: number;
|
|
38
51
|
protected fontFamilyProperty?: string;
|
|
39
52
|
protected fontWeightProperty?: string;
|
|
53
|
+
protected backgroundProperty?: string;
|
|
54
|
+
protected paddingProperty?: Thickness;
|
|
55
|
+
protected classNameProperty: string;
|
|
40
56
|
protected isDirty: boolean;
|
|
41
57
|
/**
|
|
42
58
|
* Creates an instance of the {@link CustomAnnotation}
|
|
@@ -48,6 +64,30 @@ export declare class TextAnnotation extends SvgAnnotationBase {
|
|
|
48
64
|
*/
|
|
49
65
|
get text(): string;
|
|
50
66
|
set text(text: string);
|
|
67
|
+
/**
|
|
68
|
+
* Gets or sets the background of {@link TextAnnotation}
|
|
69
|
+
*/
|
|
70
|
+
get background(): string;
|
|
71
|
+
/**
|
|
72
|
+
* Gets or sets the background of {@link TextAnnotation}
|
|
73
|
+
*/
|
|
74
|
+
set background(value: string);
|
|
75
|
+
/**
|
|
76
|
+
* Gets or sets the padding of {@link TextAnnotation}
|
|
77
|
+
*/
|
|
78
|
+
get padding(): Thickness;
|
|
79
|
+
/**
|
|
80
|
+
* Gets or sets the padding of {@link TextAnnotation}
|
|
81
|
+
*/
|
|
82
|
+
set padding(value: Thickness);
|
|
83
|
+
/**
|
|
84
|
+
* Gets or sets the class on underlying SVG element of {@link TextAnnotation}
|
|
85
|
+
*/
|
|
86
|
+
get className(): string;
|
|
87
|
+
/**
|
|
88
|
+
* Gets or sets the class on underlying SVG element of {@link TextAnnotation}
|
|
89
|
+
*/
|
|
90
|
+
set className(value: string);
|
|
51
91
|
/**
|
|
52
92
|
* text color provided by the user
|
|
53
93
|
*/
|
|
@@ -80,4 +120,6 @@ export declare class TextAnnotation extends SvgAnnotationBase {
|
|
|
80
120
|
* @inheritDoc
|
|
81
121
|
*/
|
|
82
122
|
protected create(xCalc: CoordinateCalculatorBase, yCalc: CoordinateCalculatorBase, xCoordSvgTrans: number, yCoordSvgTrans: number): void;
|
|
123
|
+
protected createSvg(): SVGElement;
|
|
124
|
+
protected attachSvgBackgroundRect(svgRoot: SVGSVGElement, background: string, padding: Thickness): void;
|
|
83
125
|
}
|
|
@@ -16,6 +16,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.TextAnnotation = void 0;
|
|
19
|
+
var Thickness_1 = require("../../../Core/Thickness");
|
|
19
20
|
var annotationHelpers_1 = require("./annotationHelpers");
|
|
20
21
|
var constants_1 = require("./constants");
|
|
21
22
|
var IAnnotation_1 = require("./IAnnotation");
|
|
@@ -31,7 +32,7 @@ var TextAnnotation = /** @class */ (function (_super) {
|
|
|
31
32
|
*/
|
|
32
33
|
function TextAnnotation(options) {
|
|
33
34
|
var _this = this;
|
|
34
|
-
var _a, _b, _c, _d, _e;
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
35
36
|
_this = _super.call(this, options) || this;
|
|
36
37
|
/** @inheritDoc */
|
|
37
38
|
_this.type = IAnnotation_1.EAnnotationType.SVGTextAnnotation;
|
|
@@ -40,12 +41,17 @@ var TextAnnotation = /** @class */ (function (_super) {
|
|
|
40
41
|
_this.fontSizeProperty = 14;
|
|
41
42
|
_this.fontFamilyProperty = "Arial";
|
|
42
43
|
_this.fontWeightProperty = "Normal";
|
|
44
|
+
_this.paddingProperty = Thickness_1.Thickness.fromNumber(0);
|
|
45
|
+
_this.classNameProperty = "scichart__text-annotation";
|
|
43
46
|
_this.isDirty = true;
|
|
44
47
|
_this.textProperty = (_a = options === null || options === void 0 ? void 0 : options.text) !== null && _a !== void 0 ? _a : _this.textProperty;
|
|
45
48
|
_this.textColorProperty = (_b = options === null || options === void 0 ? void 0 : options.textColor) !== null && _b !== void 0 ? _b : _this.textColorProperty;
|
|
46
49
|
_this.fontSizeProperty = (_c = options === null || options === void 0 ? void 0 : options.fontSize) !== null && _c !== void 0 ? _c : _this.fontSizeProperty;
|
|
47
50
|
_this.fontFamilyProperty = (_d = options === null || options === void 0 ? void 0 : options.fontFamily) !== null && _d !== void 0 ? _d : _this.fontFamilyProperty;
|
|
48
|
-
_this.
|
|
51
|
+
_this.backgroundProperty = (_e = options === null || options === void 0 ? void 0 : options.background) !== null && _e !== void 0 ? _e : _this.backgroundProperty;
|
|
52
|
+
_this.paddingProperty = (_f = options === null || options === void 0 ? void 0 : options.padding) !== null && _f !== void 0 ? _f : _this.paddingProperty;
|
|
53
|
+
_this.classNameProperty = (_g = options === null || options === void 0 ? void 0 : options.className) !== null && _g !== void 0 ? _g : _this.classNameProperty;
|
|
54
|
+
_this.fontWeight = (_h = options === null || options === void 0 ? void 0 : options.fontWeight) !== null && _h !== void 0 ? _h : _this.fontWeight;
|
|
49
55
|
return _this;
|
|
50
56
|
}
|
|
51
57
|
Object.defineProperty(TextAnnotation.prototype, "text", {
|
|
@@ -64,6 +70,63 @@ var TextAnnotation = /** @class */ (function (_super) {
|
|
|
64
70
|
enumerable: false,
|
|
65
71
|
configurable: true
|
|
66
72
|
});
|
|
73
|
+
Object.defineProperty(TextAnnotation.prototype, "background", {
|
|
74
|
+
/**
|
|
75
|
+
* Gets or sets the background of {@link TextAnnotation}
|
|
76
|
+
*/
|
|
77
|
+
get: function () {
|
|
78
|
+
return this.backgroundProperty;
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Gets or sets the background of {@link TextAnnotation}
|
|
82
|
+
*/
|
|
83
|
+
set: function (value) {
|
|
84
|
+
if (this.backgroundProperty !== value) {
|
|
85
|
+
this.backgroundProperty = value;
|
|
86
|
+
this.notifyPropertyChanged(constants_1.PROPERTY.BACKGROUND_COLOR);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
enumerable: false,
|
|
90
|
+
configurable: true
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(TextAnnotation.prototype, "padding", {
|
|
93
|
+
/**
|
|
94
|
+
* Gets or sets the padding of {@link TextAnnotation}
|
|
95
|
+
*/
|
|
96
|
+
get: function () {
|
|
97
|
+
return this.paddingProperty;
|
|
98
|
+
},
|
|
99
|
+
/**
|
|
100
|
+
* Gets or sets the padding of {@link TextAnnotation}
|
|
101
|
+
*/
|
|
102
|
+
set: function (value) {
|
|
103
|
+
if (this.paddingProperty !== value) {
|
|
104
|
+
this.paddingProperty = value;
|
|
105
|
+
this.notifyPropertyChanged(constants_1.PROPERTY.PADDING);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
enumerable: false,
|
|
109
|
+
configurable: true
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(TextAnnotation.prototype, "className", {
|
|
112
|
+
/**
|
|
113
|
+
* Gets or sets the class on underlying SVG element of {@link TextAnnotation}
|
|
114
|
+
*/
|
|
115
|
+
get: function () {
|
|
116
|
+
return this.classNameProperty;
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* Gets or sets the class on underlying SVG element of {@link TextAnnotation}
|
|
120
|
+
*/
|
|
121
|
+
set: function (value) {
|
|
122
|
+
if (this.classNameProperty !== value) {
|
|
123
|
+
this.classNameProperty = value;
|
|
124
|
+
this.notifyPropertyChanged(constants_1.PROPERTY.CLASS_NAME);
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
enumerable: false,
|
|
128
|
+
configurable: true
|
|
129
|
+
});
|
|
67
130
|
Object.defineProperty(TextAnnotation.prototype, "textColor", {
|
|
68
131
|
/**
|
|
69
132
|
* text color provided by the user
|
|
@@ -149,7 +212,6 @@ var TextAnnotation = /** @class */ (function (_super) {
|
|
|
149
212
|
p !== constants_1.PROPERTY.Y_COORD_SHIFT &&
|
|
150
213
|
p !== constants_1.PROPERTY.HORIZONTAL_ANCHOR_POINT &&
|
|
151
214
|
p !== constants_1.PROPERTY.VERTICAL_ANCHOR_POINT &&
|
|
152
|
-
p !== constants_1.PROPERTY.IS_HIDDEN &&
|
|
153
215
|
p !== constants_1.PROPERTY.X1 &&
|
|
154
216
|
p !== constants_1.PROPERTY.X2 &&
|
|
155
217
|
p !== constants_1.PROPERTY.Y1 &&
|
|
@@ -169,20 +231,37 @@ var TextAnnotation = /** @class */ (function (_super) {
|
|
|
169
231
|
return;
|
|
170
232
|
}
|
|
171
233
|
if (this.svg) {
|
|
172
|
-
this.
|
|
234
|
+
this.clear();
|
|
173
235
|
}
|
|
174
|
-
this.setSvg(createSvg(
|
|
236
|
+
this.setSvg(this.createSvg());
|
|
175
237
|
this.calcAndSetAnnotationBorders(xCalc, yCalc);
|
|
176
238
|
this.updateAdornerInner();
|
|
177
239
|
this.isDirty = false;
|
|
178
240
|
};
|
|
241
|
+
TextAnnotation.prototype.createSvg = function () {
|
|
242
|
+
var x = this.padding.left;
|
|
243
|
+
var y = this.fontSize + this.padding.top;
|
|
244
|
+
//dominant-baseline="text-after-edge"
|
|
245
|
+
var svgString = "<svg id=\"scichart__text-annotation-".concat(this.id, "\" class=\"").concat(this.className, "\">\n <text x=\"").concat(x, "\" y=\"").concat(y, "\" fill=\"").concat(this.textColor, "\" font-size=\"").concat(this.fontSize, "\" font-family=\"").concat(this.fontFamily, "\" font-weight=\"").concat(this.fontWeight, "\">").concat(this.text, "</text>\n </svg>");
|
|
246
|
+
var svgNode = annotationHelpers_1.annotationHelpers.createSvg(svgString, this.svgRoot);
|
|
247
|
+
if (this.background) {
|
|
248
|
+
this.attachSvgBackgroundRect(svgNode, this.background, this.padding);
|
|
249
|
+
}
|
|
250
|
+
return svgNode;
|
|
251
|
+
};
|
|
252
|
+
TextAnnotation.prototype.attachSvgBackgroundRect = function (svgRoot, background, padding) {
|
|
253
|
+
var textAnnotationRect = svgRoot.getBoundingClientRect();
|
|
254
|
+
var rectWidth = textAnnotationRect.width + padding.left + padding.right;
|
|
255
|
+
var rectHeight = textAnnotationRect.height + padding.top + padding.bottom;
|
|
256
|
+
var namespace = "http://www.w3.org/2000/svg";
|
|
257
|
+
var newRect = document.createElementNS(namespace, "rect");
|
|
258
|
+
newRect.setAttribute("x", "0");
|
|
259
|
+
newRect.setAttribute("y", "0");
|
|
260
|
+
newRect.setAttribute("width", "".concat(rectWidth));
|
|
261
|
+
newRect.setAttribute("height", "".concat(rectHeight));
|
|
262
|
+
newRect.setAttribute("fill", "".concat(background));
|
|
263
|
+
svgRoot.insertBefore(newRect, svgRoot.firstChild);
|
|
264
|
+
};
|
|
179
265
|
return TextAnnotation;
|
|
180
266
|
}(SvgAnnotationBase_1.SvgAnnotationBase));
|
|
181
267
|
exports.TextAnnotation = TextAnnotation;
|
|
182
|
-
/** @ignore */
|
|
183
|
-
/** @ignore */
|
|
184
|
-
var createSvg = function (svgRoot, text, color, fontSize, fontFamily, fontWeight) {
|
|
185
|
-
var svgString = "<svg class=\"scichart__text-annotation\">\n <text x=\"0\" y=\"".concat(fontSize, "\" fill=\"").concat(color, "\" font-size=\"").concat(fontSize, "\" font-family=\"").concat(fontFamily, "\" font-weight=\"").concat(fontWeight, "\">").concat(text, "</text>\n </svg>");
|
|
186
|
-
var svgNode = annotationHelpers_1.annotationHelpers.createSvg(svgString, svgRoot);
|
|
187
|
-
return svgNode;
|
|
188
|
-
};
|
|
@@ -7,6 +7,7 @@ export declare enum PROPERTY {
|
|
|
7
7
|
AXIS_FONT_FAMILY = "AXIS_FONT_FAMILY",
|
|
8
8
|
AXIS_FONT_SIZE = "AXIS_FONT_SIZE",
|
|
9
9
|
BACKGROUND_COLOR = "BACKGROUND_COLOR",
|
|
10
|
+
CLASS_NAME = "CLASS_NAME",
|
|
10
11
|
COLOR = "COLOR",
|
|
11
12
|
CONTAINER_BACKGROUND = "CONTAINER_BACKGROUND",
|
|
12
13
|
FILL = "FILL",
|
|
@@ -11,6 +11,7 @@ var PROPERTY;
|
|
|
11
11
|
PROPERTY["AXIS_FONT_FAMILY"] = "AXIS_FONT_FAMILY";
|
|
12
12
|
PROPERTY["AXIS_FONT_SIZE"] = "AXIS_FONT_SIZE";
|
|
13
13
|
PROPERTY["BACKGROUND_COLOR"] = "BACKGROUND_COLOR";
|
|
14
|
+
PROPERTY["CLASS_NAME"] = "CLASS_NAME";
|
|
14
15
|
PROPERTY["COLOR"] = "COLOR";
|
|
15
16
|
PROPERTY["CONTAINER_BACKGROUND"] = "CONTAINER_BACKGROUND";
|
|
16
17
|
PROPERTY["FILL"] = "FILL";
|
|
@@ -101,11 +101,18 @@ var SciChartLegend = /** @class */ (function (_super) {
|
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
el.addEventListener("change", onChangeEventListener_1);
|
|
104
|
+
var visibilityChangeEventHandler_1 = function (data) {
|
|
105
|
+
_this.invalidateLegend();
|
|
106
|
+
};
|
|
107
|
+
rs.isVisibleChanged.subscribe(visibilityChangeEventHandler_1);
|
|
104
108
|
var eventSubscriptionItem = {
|
|
105
109
|
element: el,
|
|
106
110
|
eventType: "change",
|
|
107
111
|
eventListener: onChangeEventListener_1,
|
|
108
|
-
delete: function () {
|
|
112
|
+
delete: function () {
|
|
113
|
+
el.removeEventListener("change", onChangeEventListener_1);
|
|
114
|
+
rs.isVisibleChanged.unsubscribe(visibilityChangeEventHandler_1);
|
|
115
|
+
}
|
|
109
116
|
};
|
|
110
117
|
var eventListenersForRenderableSeries = this.eventListenersCollection.get(rs.id);
|
|
111
118
|
if (eventListenersForRenderableSeries) {
|
|
@@ -84,8 +84,8 @@ var BandSeriesHitTestProvider = /** @class */ (function (_super) {
|
|
|
84
84
|
if (!dataSeries) {
|
|
85
85
|
return HitTestInfo_1.HitTestInfo.empty();
|
|
86
86
|
}
|
|
87
|
-
var
|
|
88
|
-
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, dataSeries.getNativeXValues(), dataSeries.getNativeYValues(), xHitCoord, yHitCoord, nearestPointIndex, hitTestRadius);
|
|
87
|
+
var _b = hitTestHelpers_1.hitTestHelpers.getNearestXyyPoint(this.webAssemblyContext, xCoordinateCalculator, yCoordinateCalculator, dataSeries, xHitCoord, yHitCoord, hitTestRadius), nearestPointIndex = _b.nearestPointIndex, distance = _b.distance;
|
|
88
|
+
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, dataSeries.getNativeXValues(), dataSeries.getNativeYValues(), xHitCoord, yHitCoord, nearestPointIndex, hitTestRadius, distance);
|
|
89
89
|
if (nearestPointIndex >= 0) {
|
|
90
90
|
hitTestInfo.y1Value = dataSeries.getNativeY1Values().get(nearestPointIndex);
|
|
91
91
|
hitTestInfo.y1Coord = yCoordinateCalculator.getCoordinate(hitTestInfo.y1Value);
|
|
@@ -43,12 +43,12 @@ var BaseHitTestProvider = /** @class */ (function () {
|
|
|
43
43
|
if (!dataSeries) {
|
|
44
44
|
return HitTestInfo_1.HitTestInfo.empty();
|
|
45
45
|
}
|
|
46
|
-
var
|
|
46
|
+
var nearest = hitTestHelpers_1.hitTestHelpers.getNearestXyPoint(this.webAssemblyContext, xCoordinateCalculator, yCoordinateCalculator, dataSeries, xHitCoord, yHitCoord, hitTestRadius);
|
|
47
47
|
var xNativeValues = dataSeries.getNativeXValues();
|
|
48
48
|
var yNativeValues = dataSeries.getNativeYValues();
|
|
49
|
-
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearestPointIndex, hitTestRadius);
|
|
50
|
-
if (nearestPointIndex >= 0) {
|
|
51
|
-
hitTestInfo.isHit = hitTestHelpers_1.hitTestHelpers.testIsHitForPoint(xCoordinateCalculator, yCoordinateCalculator, xNativeValues, yNativeValues, nearestPointIndex, xHitCoord, yHitCoord, hitTestRadius);
|
|
49
|
+
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearest.nearestPointIndex, hitTestRadius, nearest.distance);
|
|
50
|
+
if (nearest.nearestPointIndex >= 0) {
|
|
51
|
+
hitTestInfo.isHit = hitTestHelpers_1.hitTestHelpers.testIsHitForPoint(xCoordinateCalculator, yCoordinateCalculator, xNativeValues, yNativeValues, nearest.nearestPointIndex, xHitCoord, yHitCoord, hitTestRadius);
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
54
54
|
hitTestInfo.isHit = false;
|
|
@@ -80,7 +80,7 @@ var BaseHitTestProvider = /** @class */ (function () {
|
|
|
80
80
|
var nearestPointIndex = hitTestHelpers_1.hitTestHelpers.getNearestXPoint(this.webAssemblyContext, xCoordinateCalculator, dataSeries, xHitCoord, dataSeries.dataDistributionCalculator.isSortedAscending);
|
|
81
81
|
var xNativeValues = dataSeries.getNativeXValues();
|
|
82
82
|
var yNativeValues = dataSeries.getNativeYValues();
|
|
83
|
-
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearestPointIndex, 0);
|
|
83
|
+
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearestPointIndex, 0, undefined);
|
|
84
84
|
hitTestInfo.isHit = hitTestInfo.isWithinDataBounds;
|
|
85
85
|
if (dataSeries.dataDistributionCalculator.isSortedAscending && nearestPointIndex >= 0) {
|
|
86
86
|
var dataSeriesCount = xNativeValues.size();
|
|
@@ -45,13 +45,13 @@ var BubbleSeriesHitTestProvider = /** @class */ (function (_super) {
|
|
|
45
45
|
if (!dataSeries) {
|
|
46
46
|
return HitTestInfo_1.HitTestInfo.empty();
|
|
47
47
|
}
|
|
48
|
-
var
|
|
48
|
+
var nearest = hitTestHelpers_1.hitTestHelpers.getNearestXyPoint(this.webAssemblyContext, xCoordinateCalculator, yCoordinateCalculator, dataSeries, xHitCoord, yHitCoord, hitTestRadius);
|
|
49
49
|
var xNativeValues = dataSeries.getNativeXValues();
|
|
50
50
|
var yNativeValues = dataSeries.getNativeYValues();
|
|
51
51
|
var zNativeValues = dataSeries.getNativeZValues();
|
|
52
|
-
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearestPointIndex, hitTestRadius);
|
|
53
|
-
if (nearestPointIndex >= 0) {
|
|
54
|
-
hitTestInfo.zValue = zNativeValues.get(nearestPointIndex);
|
|
52
|
+
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearest.nearestPointIndex, hitTestRadius);
|
|
53
|
+
if (nearest.nearestPointIndex >= 0) {
|
|
54
|
+
hitTestInfo.zValue = zNativeValues.get(nearest.nearestPointIndex);
|
|
55
55
|
var distance = (0, pointUtil_1.calcDistance)(xHitCoord, yHitCoord, hitTestInfo.xCoord, hitTestInfo.yCoord);
|
|
56
56
|
hitTestInfo.isHit = distance < (hitTestInfo.zValue * DpiHelper_1.DpiHelper.PIXEL_RATIO) / 2 + hitTestRadius;
|
|
57
57
|
var isCategoryAxis = xCoordinateCalculator.isCategoryCoordinateCalculator;
|
|
@@ -166,5 +166,9 @@ export declare class HitTestInfo {
|
|
|
166
166
|
* The point metadata for the second data point
|
|
167
167
|
*/
|
|
168
168
|
point2metadata: IPointMetadata;
|
|
169
|
+
private distanceProperty;
|
|
170
|
+
/** The distance from the hitTest coordinate to the point */
|
|
171
|
+
get distance(): number;
|
|
172
|
+
set distance(value: number);
|
|
169
173
|
constructor(renderableSeries: IRenderableSeries, isEmpty?: boolean);
|
|
170
174
|
}
|
|
@@ -25,6 +25,19 @@ var HitTestInfo = /** @class */ (function () {
|
|
|
25
25
|
var dy = ((_b = this.hitTestPoint) === null || _b === void 0 ? void 0 : _b.y) - this.yCoord;
|
|
26
26
|
return Math.sqrt(dx * dx + dy * dy);
|
|
27
27
|
};
|
|
28
|
+
Object.defineProperty(HitTestInfo.prototype, "distance", {
|
|
29
|
+
/** The distance from the hitTest coordinate to the point */
|
|
30
|
+
get: function () {
|
|
31
|
+
if (this.distanceProperty !== undefined)
|
|
32
|
+
return this.distanceProperty;
|
|
33
|
+
return this.getEuclideanDistance();
|
|
34
|
+
},
|
|
35
|
+
set: function (value) {
|
|
36
|
+
this.distanceProperty = value;
|
|
37
|
+
},
|
|
38
|
+
enumerable: false,
|
|
39
|
+
configurable: true
|
|
40
|
+
});
|
|
28
41
|
return HitTestInfo;
|
|
29
42
|
}());
|
|
30
43
|
exports.HitTestInfo = HitTestInfo;
|
|
@@ -45,15 +45,15 @@ var ImpulseSeriesHitTestProvider = /** @class */ (function (_super) {
|
|
|
45
45
|
if (!dataSeries) {
|
|
46
46
|
return HitTestInfo_1.HitTestInfo.empty();
|
|
47
47
|
}
|
|
48
|
-
var
|
|
48
|
+
var nearestXy = hitTestHelpers_1.hitTestHelpers.getNearestXyPoint(this.webAssemblyContext, xCoordinateCalculator, yCoordinateCalculator, dataSeries, xHitCoord, yHitCoord, hitTestRadius);
|
|
49
49
|
var nearestPointIndex = hitTestHelpers_1.hitTestHelpers.getNearestXPoint(this.webAssemblyContext, xCoordinateCalculator, dataSeries, xHitCoord, dataSeries.dataDistributionCalculator.isSortedAscending);
|
|
50
50
|
var xNativeValues = dataSeries.getNativeXValues();
|
|
51
51
|
var yNativeValues = dataSeries.getNativeYValues();
|
|
52
52
|
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearestPointIndex, 0);
|
|
53
|
-
if (nearestPointIndex >= 0 ||
|
|
53
|
+
if (nearestPointIndex >= 0 || nearestXy.nearestPointIndex >= 0) {
|
|
54
54
|
hitTestInfo.isHit =
|
|
55
55
|
hitTestHelpers_1.hitTestHelpers.testIsHitForImpulse(xCoordinateCalculator, yCoordinateCalculator, this.parentSeries, xNativeValues, yNativeValues, nearestPointIndex, xHitCoord, yHitCoord, hitTestRadius) ||
|
|
56
|
-
hitTestHelpers_1.hitTestHelpers.testIsHitForPoint(xCoordinateCalculator, yCoordinateCalculator, xNativeValues, yNativeValues,
|
|
56
|
+
hitTestHelpers_1.hitTestHelpers.testIsHitForPoint(xCoordinateCalculator, yCoordinateCalculator, xNativeValues, yNativeValues, nearestXy.nearestPointIndex, xHitCoord, yHitCoord, this.parentSeries.size);
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
59
|
hitTestInfo.isHit = false;
|
|
@@ -57,7 +57,7 @@ var LineSeriesHitTestProvider = /** @class */ (function (_super) {
|
|
|
57
57
|
var nearestPointIndex = hitTestHelpers_1.hitTestHelpers.getNearestXPoint(this.webAssemblyContext, xCoordinateCalculator, dataSeries, xHitCoord, dataSeries.dataDistributionCalculator.isSortedAscending);
|
|
58
58
|
var xNativeValues = dataSeries.getNativeXValues();
|
|
59
59
|
var yNativeValues = dataSeries.getNativeYValues();
|
|
60
|
-
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearestPointIndex, hitTestRadius);
|
|
60
|
+
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearestPointIndex, hitTestRadius, undefined);
|
|
61
61
|
if (nearestPointIndex >= 0) {
|
|
62
62
|
var dataSeriesCount = xNativeValues.size();
|
|
63
63
|
var nearestXCoord = xCoordinateCalculator.getCoordinate(xCoordinateCalculator.isCategoryCoordinateCalculator
|
|
@@ -95,11 +95,11 @@ var LineSeriesHitTestProvider = /** @class */ (function (_super) {
|
|
|
95
95
|
if (!dataSeries) {
|
|
96
96
|
return HitTestInfo_1.HitTestInfo.empty();
|
|
97
97
|
}
|
|
98
|
-
var
|
|
98
|
+
var nearest = hitTestHelpers_1.hitTestHelpers.getNearestXyPoint(this.webAssemblyContext, xCoordinateCalculator, yCoordinateCalculator, dataSeries, xHitCoord, yHitCoord, hitTestRadius);
|
|
99
99
|
var xNativeValues = dataSeries.getNativeXValues();
|
|
100
100
|
var yNativeValues = dataSeries.getNativeYValues();
|
|
101
|
-
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearestPointIndex, hitTestRadius);
|
|
102
|
-
if (nearestPointIndex >= 0) {
|
|
101
|
+
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearest.nearestPointIndex, hitTestRadius, nearest.distance);
|
|
102
|
+
if (nearest.nearestPointIndex >= 0) {
|
|
103
103
|
var dataSeriesCount = xNativeValues.size();
|
|
104
104
|
var minX = Number.MAX_VALUE;
|
|
105
105
|
var maxX = Number.MIN_VALUE;
|
|
@@ -44,11 +44,11 @@ var ScatterSeriesHitTestProvider = /** @class */ (function (_super) {
|
|
|
44
44
|
if (!dataSeries) {
|
|
45
45
|
return HitTestInfo_1.HitTestInfo.empty();
|
|
46
46
|
}
|
|
47
|
-
var
|
|
47
|
+
var nearest = hitTestHelpers_1.hitTestHelpers.getNearestXyPoint(this.webAssemblyContext, xCoordinateCalculator, yCoordinateCalculator, dataSeries, xHitCoord, yHitCoord, hitTestRadius);
|
|
48
48
|
var xNativeValues = dataSeries.getNativeXValues();
|
|
49
49
|
var yNativeValues = dataSeries.getNativeYValues();
|
|
50
|
-
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearestPointIndex, hitTestRadius);
|
|
51
|
-
if (nearestPointIndex >= 0) {
|
|
50
|
+
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearest.nearestPointIndex, hitTestRadius);
|
|
51
|
+
if (nearest.nearestPointIndex >= 0) {
|
|
52
52
|
var _b = this.parentSeries.pointMarker, width = _b.width, height = _b.height;
|
|
53
53
|
var isCategoryAxis = xCoordinateCalculator.isCategoryCoordinateCalculator;
|
|
54
54
|
var xFirstValue = isCategoryAxis ? 0 : xNativeValues.get(0);
|
|
@@ -34,10 +34,10 @@ var TextSeriesHitTestProvider = /** @class */ (function (_super) {
|
|
|
34
34
|
var xHitCoord = isVerticalChart ? hitTestPoint.y : hitTestPoint.x;
|
|
35
35
|
var yHitCoord = isVerticalChart ? hitTestPoint.x : hitTestPoint.y;
|
|
36
36
|
var dataSeries = this.parentSeries.dataSeries;
|
|
37
|
-
var
|
|
37
|
+
var nearest = hitTestHelpers_1.hitTestHelpers.getNearestXyPoint(this.webAssemblyContext, xCoordinateCalculator, yCoordinateCalculator, dataSeries, xHitCoord, yHitCoord, hitTestRadius);
|
|
38
38
|
var xNativeValues = dataSeries.getNativeXValues();
|
|
39
39
|
var yNativeValues = dataSeries.getNativeYValues();
|
|
40
|
-
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearestPointIndex, hitTestRadius);
|
|
40
|
+
var hitTestInfo = hitTestHelpers_1.hitTestHelpers.createHitTestInfo(this.parentSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearest.nearestPointIndex, hitTestRadius, nearest.distance);
|
|
41
41
|
var labels = this.parentSeries.dataLabelProvider.dataLabels;
|
|
42
42
|
var isHit = false;
|
|
43
43
|
for (var _i = 0, labels_1 = labels; _i < labels_1.length; _i++) {
|
|
@@ -14,10 +14,16 @@ import { FastImpulseRenderableSeries } from "../FastImpulseRenderableSeries";
|
|
|
14
14
|
import { IRenderableSeries } from "../IRenderableSeries";
|
|
15
15
|
import { HitTestInfo } from "./HitTestInfo";
|
|
16
16
|
export declare const hitTestHelpers: {
|
|
17
|
-
createHitTestInfo: (renderableSeries: IRenderableSeries, xCoordinateCalculator: CoordinateCalculatorBase, yCoordinateCalculator: CoordinateCalculatorBase, isVerticalChart: boolean, dataSeries: BaseDataSeries, xNativeValues: SCRTDoubleVector, yNativeValues: SCRTDoubleVector, xHitCoord: number, yHitCoord: number, nearestPointIndex: number, hitTestRadius: number) => HitTestInfo;
|
|
17
|
+
createHitTestInfo: (renderableSeries: IRenderableSeries, xCoordinateCalculator: CoordinateCalculatorBase, yCoordinateCalculator: CoordinateCalculatorBase, isVerticalChart: boolean, dataSeries: BaseDataSeries, xNativeValues: SCRTDoubleVector, yNativeValues: SCRTDoubleVector, xHitCoord: number, yHitCoord: number, nearestPointIndex: number, hitTestRadius: number, distance?: number) => HitTestInfo;
|
|
18
18
|
getNearestXPoint: (webAssemblyContext: TSciChart, xCoordinateCalculator: CoordinateCalculatorBase, dataSeries: IDataSeries, xHitCoord: number, isSorted: boolean) => number;
|
|
19
|
-
getNearestXyPoint: (xCoordinateCalculator: CoordinateCalculatorBase, yCoordinateCalculator: CoordinateCalculatorBase, dataSeries: IDataSeries, xHitCoord: number, yHitCoord: number) =>
|
|
20
|
-
|
|
19
|
+
getNearestXyPoint: (webassemblyContext: TSciChart, xCoordinateCalculator: CoordinateCalculatorBase, yCoordinateCalculator: CoordinateCalculatorBase, dataSeries: IDataSeries, xHitCoord: number, yHitCoord: number, hitTestRadius: number) => {
|
|
20
|
+
nearestPointIndex: number;
|
|
21
|
+
distance: number;
|
|
22
|
+
};
|
|
23
|
+
getNearestXyyPoint: (webassemblyContext: TSciChart, xCoordinateCalculator: CoordinateCalculatorBase, yCoordinateCalculator: CoordinateCalculatorBase, dataSeries: XyyDataSeries, xHitCoord: number, yHitCoord: number, hitTestRadius: number) => {
|
|
24
|
+
nearestPointIndex: number;
|
|
25
|
+
distance: number;
|
|
26
|
+
};
|
|
21
27
|
getNearestUniformHeatmapPoint: (xCoordinateCalculator: CoordinateCalculatorBase, yCoordinateCalculator: CoordinateCalculatorBase, heatmapDataSeries: UniformHeatmapDataSeries, xHitCoord: number, yHitCoord: number) => {
|
|
22
28
|
xIndex: number;
|
|
23
29
|
yIndex: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hitTestHelpers = void 0;
|
|
4
|
+
var Deleter_1 = require("../../../../Core/Deleter");
|
|
4
5
|
var Point_1 = require("../../../../Core/Point");
|
|
5
6
|
var ErrorDirection_1 = require("../../../../types/ErrorDirection");
|
|
6
7
|
var pointUtil_1 = require("../../../../utils/pointUtil");
|
|
@@ -23,7 +24,7 @@ var interpolateLinear = function (x, x1, y1, x2, y2) {
|
|
|
23
24
|
* @param nearestPointIndex
|
|
24
25
|
* @param hitTestRadius
|
|
25
26
|
*/
|
|
26
|
-
var createHitTestInfo = function (renderableSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearestPointIndex, hitTestRadius) {
|
|
27
|
+
var createHitTestInfo = function (renderableSeries, xCoordinateCalculator, yCoordinateCalculator, isVerticalChart, dataSeries, xNativeValues, yNativeValues, xHitCoord, yHitCoord, nearestPointIndex, hitTestRadius, distance) {
|
|
27
28
|
var isCategoryAxis = xCoordinateCalculator.isCategoryCoordinateCalculator;
|
|
28
29
|
var hitTestInfo = new HitTestInfo_1.HitTestInfo(renderableSeries);
|
|
29
30
|
hitTestInfo.dataSeriesName = dataSeries.dataSeriesName;
|
|
@@ -35,6 +36,7 @@ var createHitTestInfo = function (renderableSeries, xCoordinateCalculator, yCoor
|
|
|
35
36
|
hitTestInfo.dataSeriesIndex = nearestPointIndex;
|
|
36
37
|
hitTestInfo.hitTestRadius = hitTestRadius;
|
|
37
38
|
hitTestInfo.isCategoryAxis = isCategoryAxis;
|
|
39
|
+
hitTestInfo.distance = distance;
|
|
38
40
|
// If there is no data, don't attempt to access it.
|
|
39
41
|
if (nearestPointIndex >= 0) {
|
|
40
42
|
var xValue = isCategoryAxis ? nearestPointIndex : xNativeValues.get(nearestPointIndex);
|
|
@@ -74,70 +76,51 @@ var createHitTestInfo = function (renderableSeries, xCoordinateCalculator, yCoor
|
|
|
74
76
|
return hitTestInfo;
|
|
75
77
|
};
|
|
76
78
|
var getNearestXPoint = function (webAssemblyContext, xCoordinateCalculator, dataSeries, xHitCoord, isSorted) {
|
|
77
|
-
var
|
|
79
|
+
var result = getNearestXyPoint(webAssemblyContext, xCoordinateCalculator, xCoordinateCalculator, dataSeries, xHitCoord, 0, 0);
|
|
80
|
+
return result.nearestPointIndex;
|
|
81
|
+
};
|
|
82
|
+
var getNearestXyPoint = function (webassemblyContext, xCoordinateCalculator, yCoordinateCalculator, dataSeries, xHitCoord, yHitCoord, hitTestRadius) {
|
|
78
83
|
var isCategoryAxis = xCoordinateCalculator.isCategoryCoordinateCalculator;
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
var dataX = isCategoryAxis ? dataSeries.getNativeIndexes() : dataSeries.getNativeXValues();
|
|
85
|
+
var dataY = dataSeries.getNativeYValues();
|
|
86
|
+
var result;
|
|
87
|
+
try {
|
|
88
|
+
result = webassemblyContext.SCRTHitTestHelper.GetNearestXyPoint(xCoordinateCalculator.nativeCalculator, yCoordinateCalculator.nativeCalculator, dataX, dataY, dataSeries.dataDistributionCalculator.isSortedAscending, xHitCoord, yHitCoord, hitTestRadius !== null && hitTestRadius !== void 0 ? hitTestRadius : 1 // Default to 1 here so unsorted data will get nearest by x and y
|
|
89
|
+
);
|
|
90
|
+
return { nearestPointIndex: result.minD, distance: result.maxD };
|
|
82
91
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var nearestPointIndex = -1;
|
|
86
|
-
var currentDistance = Number.MAX_VALUE;
|
|
87
|
-
for (var i = 0; i < dataLength; i++) {
|
|
88
|
-
var xValue = xValues.get(i);
|
|
89
|
-
var distance = Math.abs(xHitValue - xValue);
|
|
90
|
-
if (distance < currentDistance) {
|
|
91
|
-
nearestPointIndex = i;
|
|
92
|
-
currentDistance = distance;
|
|
93
|
-
}
|
|
92
|
+
finally {
|
|
93
|
+
(0, Deleter_1.deleteSafe)(result);
|
|
94
94
|
}
|
|
95
|
-
return nearestPointIndex;
|
|
96
95
|
};
|
|
97
|
-
var
|
|
98
|
-
var dataLength = dataSeries.count();
|
|
99
|
-
// TODO: if isSorted
|
|
100
|
-
var nearestPointIndex = -1;
|
|
101
|
-
var currentDistance = Number.MAX_VALUE;
|
|
96
|
+
var getNearestXyyPoint = function (webassemblyContext, xCoordinateCalculator, yCoordinateCalculator, dataSeries, xHitCoord, yHitCoord, hitTestRadius) {
|
|
102
97
|
var isCategoryAxis = xCoordinateCalculator.isCategoryCoordinateCalculator;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
98
|
+
var dataX = isCategoryAxis ? dataSeries.getNativeIndexes() : dataSeries.getNativeXValues();
|
|
99
|
+
var dataY = dataSeries.getNativeYValues();
|
|
100
|
+
var result;
|
|
101
|
+
var nearestY;
|
|
102
|
+
var distanceY;
|
|
103
|
+
try {
|
|
104
|
+
result = webassemblyContext.SCRTHitTestHelper.GetNearestXyPoint(xCoordinateCalculator.nativeCalculator, yCoordinateCalculator.nativeCalculator, dataX, dataY, dataSeries.dataDistributionCalculator.isSortedAscending, xHitCoord, yHitCoord, hitTestRadius !== null && hitTestRadius !== void 0 ? hitTestRadius : 1);
|
|
105
|
+
nearestY = result.minD;
|
|
106
|
+
distanceY = result.maxD;
|
|
113
107
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
for (var i = 0; i < dataLength; i++) {
|
|
123
|
-
var dataX = isCategoryAxis ? i : dataSeries.getNativeXValues().get(i);
|
|
124
|
-
var dataY = dataSeries.getNativeYValues().get(i);
|
|
125
|
-
var dataY1 = dataSeries.getNativeY1Values().get(i);
|
|
126
|
-
var coordX = xCoordinateCalculator.getCoordinate(dataX);
|
|
127
|
-
var coordY = yCoordinateCalculator.getCoordinate(dataY);
|
|
128
|
-
var coordY1 = yCoordinateCalculator.getCoordinate(dataY1);
|
|
129
|
-
var distance = (0, pointUtil_1.calcDistance)(xHitCoord, yHitCoord, coordX, coordY);
|
|
130
|
-
var distance1 = (0, pointUtil_1.calcDistance)(xHitCoord, yHitCoord, coordX, coordY1);
|
|
131
|
-
if (distance < currentDistance) {
|
|
132
|
-
nearestPointIndex = i;
|
|
133
|
-
currentDistance = distance;
|
|
108
|
+
finally {
|
|
109
|
+
(0, Deleter_1.deleteSafe)(result);
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
result = webassemblyContext.SCRTHitTestHelper.GetNearestXyPoint(xCoordinateCalculator.nativeCalculator, yCoordinateCalculator.nativeCalculator, dataX, dataSeries.getNativeY1Values(), dataSeries.dataDistributionCalculator.isSortedAscending, xHitCoord, yHitCoord, hitTestRadius !== null && hitTestRadius !== void 0 ? hitTestRadius : 1);
|
|
113
|
+
if (distanceY < result.maxD) {
|
|
114
|
+
// Y is nearer
|
|
115
|
+
return { nearestPointIndex: nearestY, distance: distanceY };
|
|
134
116
|
}
|
|
135
|
-
|
|
136
|
-
nearestPointIndex
|
|
137
|
-
currentDistance = distance1;
|
|
117
|
+
else {
|
|
118
|
+
return { nearestPointIndex: result.minD, distance: result.maxD };
|
|
138
119
|
}
|
|
139
120
|
}
|
|
140
|
-
|
|
121
|
+
finally {
|
|
122
|
+
(0, Deleter_1.deleteSafe)(result);
|
|
123
|
+
}
|
|
141
124
|
};
|
|
142
125
|
var getNearestUniformHeatmapPoint = function (xCoordinateCalculator, yCoordinateCalculator, heatmapDataSeries, xHitCoord, yHitCoord) {
|
|
143
126
|
var xHitValue = xCoordinateCalculator.getDataValue(xHitCoord);
|
|
@@ -29,6 +29,7 @@ export declare class RolloverModifierRenderableSeriesProps {
|
|
|
29
29
|
private tooltipTextColorProperty;
|
|
30
30
|
private tooltipTitleProperty;
|
|
31
31
|
private markerColorProperty;
|
|
32
|
+
private shadowColorProperty;
|
|
32
33
|
private tooltipDataTemplateProperty?;
|
|
33
34
|
private isY1;
|
|
34
35
|
constructor(renderableSeries: IRenderableSeries, isY1?: boolean);
|
|
@@ -43,6 +44,8 @@ export declare class RolloverModifierRenderableSeriesProps {
|
|
|
43
44
|
set tooltipTitle(value: string);
|
|
44
45
|
get markerColor(): string;
|
|
45
46
|
set markerColor(value: string);
|
|
47
|
+
get shadowColor(): string;
|
|
48
|
+
set shadowColor(value: string);
|
|
46
49
|
get tooltipDataTemplate(): TRolloverTooltipDataTemplate;
|
|
47
50
|
set tooltipDataTemplate(value: TRolloverTooltipDataTemplate);
|
|
48
51
|
get tooltipLegendTemplate(): (tooltipProps: RolloverModifierRenderableSeriesProps, seriesInfo: SeriesInfo) => string;
|
package/Charting/Visuals/RenderableSeries/RolloverModifier/RolloverModifierRenderableSeriesProps.js
CHANGED
|
@@ -26,6 +26,7 @@ var RolloverModifierRenderableSeriesProps = /** @class */ (function () {
|
|
|
26
26
|
to.tooltipTemplate = from.tooltipTemplate;
|
|
27
27
|
to.tooltipTextColorProperty = from.tooltipTextColorProperty;
|
|
28
28
|
to.tooltipTitleProperty = from.tooltipTitle;
|
|
29
|
+
to.shadowColorProperty = from.shadowColorProperty;
|
|
29
30
|
to.invalidateParentCallback = from.invalidateParentCallback;
|
|
30
31
|
};
|
|
31
32
|
RolloverModifierRenderableSeriesProps.prototype.setInvalidateParentCallback = function (callback) {
|
|
@@ -102,6 +103,17 @@ var RolloverModifierRenderableSeriesProps = /** @class */ (function () {
|
|
|
102
103
|
enumerable: false,
|
|
103
104
|
configurable: true
|
|
104
105
|
});
|
|
106
|
+
Object.defineProperty(RolloverModifierRenderableSeriesProps.prototype, "shadowColor", {
|
|
107
|
+
get: function () {
|
|
108
|
+
return this.shadowColorProperty;
|
|
109
|
+
},
|
|
110
|
+
set: function (value) {
|
|
111
|
+
this.shadowColorProperty = value;
|
|
112
|
+
this.notifyPropertyChanged(constants_1.PROPERTY.TOOLTIP_SHADOW_COLOR);
|
|
113
|
+
},
|
|
114
|
+
enumerable: false,
|
|
115
|
+
configurable: true
|
|
116
|
+
});
|
|
105
117
|
Object.defineProperty(RolloverModifierRenderableSeriesProps.prototype, "tooltipDataTemplate", {
|
|
106
118
|
get: function () {
|
|
107
119
|
return this.tooltipDataTemplateProperty;
|