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
|
@@ -39,6 +39,8 @@ export interface ICursorModifierOptions extends IChartModifierBaseOptions {
|
|
|
39
39
|
tooltipContainerBackground?: string;
|
|
40
40
|
/** Sets the tooltip text color as an HTML Color code */
|
|
41
41
|
tooltipTextStroke?: string;
|
|
42
|
+
/** Sets the tooltip shadow color as an HTML Color code */
|
|
43
|
+
tooltipShadow?: string;
|
|
42
44
|
/** Sets whether we should display the tooltip. Default is false */
|
|
43
45
|
showTooltip?: boolean;
|
|
44
46
|
/** Sets whether we should display axis labels. Default is true */
|
|
@@ -165,6 +167,7 @@ export declare class CursorModifier extends ChartModifierBase2D implements IIncl
|
|
|
165
167
|
protected tooltipAnnotation: CursorTooltipSvgAnnotation | undefined;
|
|
166
168
|
protected mousePosition: EMousePosition;
|
|
167
169
|
protected crosshairStrokeProperty: string;
|
|
170
|
+
protected tooltipShadowProperty: string;
|
|
168
171
|
protected tooltipDataTemplateProperty?: TCursorTooltipDataTemplate | undefined;
|
|
169
172
|
protected includedSeriesMap: Map<IRenderableSeries, boolean>;
|
|
170
173
|
protected placementDivIdProperty: string | undefined;
|
|
@@ -219,6 +222,14 @@ export declare class CursorModifier extends ChartModifierBase2D implements IIncl
|
|
|
219
222
|
* Gets or sets the crosshair line Stroke color as an HTML Color code
|
|
220
223
|
*/
|
|
221
224
|
set crosshairStroke(value: string);
|
|
225
|
+
/**
|
|
226
|
+
* Gets or sets the tooltip shadow color as an HTML Color code
|
|
227
|
+
*/
|
|
228
|
+
get tooltipShadow(): string;
|
|
229
|
+
/**
|
|
230
|
+
* Gets or sets the tooltip shadow color as an HTML Color code
|
|
231
|
+
*/
|
|
232
|
+
set tooltipShadow(value: string);
|
|
222
233
|
/**
|
|
223
234
|
* Gets or sets whether we should display the X Line. Default is true
|
|
224
235
|
*/
|
|
@@ -21,6 +21,7 @@ var Deleter_1 = require("../../Core/Deleter");
|
|
|
21
21
|
var BaseType_1 = require("../../types/BaseType");
|
|
22
22
|
var ChartModifierType_1 = require("../../types/ChartModifierType");
|
|
23
23
|
var MousePosition_1 = require("../../types/MousePosition");
|
|
24
|
+
var parseColor_1 = require("../../utils/parseColor");
|
|
24
25
|
var translate_1 = require("../../utils/translate");
|
|
25
26
|
var IDataSeries_1 = require("../Model/IDataSeries");
|
|
26
27
|
var AnnotationBase_1 = require("../Visuals/Annotations/AnnotationBase");
|
|
@@ -53,7 +54,7 @@ var CursorModifier = /** @class */ (function (_super) {
|
|
|
53
54
|
*/
|
|
54
55
|
function CursorModifier(options) {
|
|
55
56
|
var _this = this;
|
|
56
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
57
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
57
58
|
_this = _super.call(this, options) || this;
|
|
58
59
|
_this.type = ChartModifierType_1.EChart2DModifierType.Cursor;
|
|
59
60
|
/**
|
|
@@ -125,6 +126,7 @@ var CursorModifier = /** @class */ (function (_super) {
|
|
|
125
126
|
_this.hitTestRadius = 0;
|
|
126
127
|
_this.mousePosition = MousePosition_1.EMousePosition.OutOfCanvas;
|
|
127
128
|
_this.crosshairStrokeProperty = SciChartSurfaceBase_1.SciChartSurfaceBase.DEFAULT_THEME.cursorLineBrush;
|
|
129
|
+
_this.tooltipShadowProperty = SciChartSurfaceBase_1.SciChartSurfaceBase.DEFAULT_THEME.shadowEffectColor;
|
|
128
130
|
_this.includedSeriesMap = new Map();
|
|
129
131
|
_this.showXLineProperty = true;
|
|
130
132
|
_this.showYLineProperty = true;
|
|
@@ -142,15 +144,16 @@ var CursorModifier = /** @class */ (function (_super) {
|
|
|
142
144
|
_this.crosshairStroke = (_d = options === null || options === void 0 ? void 0 : options.crosshairStroke) !== null && _d !== void 0 ? _d : _this.crosshairStroke;
|
|
143
145
|
_this.tooltipContainerBackground = (_e = options === null || options === void 0 ? void 0 : options.tooltipContainerBackground) !== null && _e !== void 0 ? _e : _this.tooltipContainerBackground;
|
|
144
146
|
_this.tooltipTextStroke = (_f = options === null || options === void 0 ? void 0 : options.tooltipTextStroke) !== null && _f !== void 0 ? _f : _this.tooltipTextStroke;
|
|
145
|
-
_this.
|
|
146
|
-
_this.
|
|
147
|
-
_this.
|
|
148
|
-
_this.
|
|
149
|
-
_this.
|
|
150
|
-
_this.
|
|
151
|
-
_this.
|
|
152
|
-
_this.
|
|
153
|
-
_this.
|
|
147
|
+
_this.tooltipShadow = (_g = options === null || options === void 0 ? void 0 : options.tooltipShadow) !== null && _g !== void 0 ? _g : _this.tooltipShadowProperty;
|
|
148
|
+
_this.showTooltip = (_h = options === null || options === void 0 ? void 0 : options.showTooltip) !== null && _h !== void 0 ? _h : _this.showTooltip;
|
|
149
|
+
_this.showAxisLabels = (_j = options === null || options === void 0 ? void 0 : options.showAxisLabels) !== null && _j !== void 0 ? _j : _this.showAxisLabels;
|
|
150
|
+
_this.axisLabelFill = (_k = options === null || options === void 0 ? void 0 : options.axisLabelFill) !== null && _k !== void 0 ? _k : _this.axisLabelFill;
|
|
151
|
+
_this.axisLabelStroke = (_l = options === null || options === void 0 ? void 0 : options.axisLabelStroke) !== null && _l !== void 0 ? _l : _this.axisLabelStroke;
|
|
152
|
+
_this.xAxisLabelStroke = (_m = options === null || options === void 0 ? void 0 : options.xAxisLabelStroke) !== null && _m !== void 0 ? _m : _this.xAxisLabelStroke;
|
|
153
|
+
_this.xAxisLabelFill = (_o = options === null || options === void 0 ? void 0 : options.xAxisLabelFill) !== null && _o !== void 0 ? _o : _this.xAxisLabelFill;
|
|
154
|
+
_this.yAxisLabelStroke = (_p = options === null || options === void 0 ? void 0 : options.yAxisLabelStroke) !== null && _p !== void 0 ? _p : _this.yAxisLabelStroke;
|
|
155
|
+
_this.yAxisLabelFill = (_q = options === null || options === void 0 ? void 0 : options.yAxisLabelFill) !== null && _q !== void 0 ? _q : _this.yAxisLabelFill;
|
|
156
|
+
_this.placementDivIdProperty = (_r = options === null || options === void 0 ? void 0 : options.placementDivId) !== null && _r !== void 0 ? _r : _this.placementDivIdProperty;
|
|
154
157
|
if (options === null || options === void 0 ? void 0 : options.tooltipLegendTemplate) {
|
|
155
158
|
if (typeof options.tooltipLegendTemplate === "string") {
|
|
156
159
|
_this.typeMap.set("tooltipLegendTemplate", options.tooltipLegendTemplate);
|
|
@@ -159,9 +162,9 @@ var CursorModifier = /** @class */ (function (_super) {
|
|
|
159
162
|
}
|
|
160
163
|
}
|
|
161
164
|
_this.tooltipLegendTemplate =
|
|
162
|
-
(
|
|
163
|
-
_this.tooltipLegendOffsetX = (
|
|
164
|
-
_this.tooltipLegendOffsetY = (
|
|
165
|
+
(_s = options === null || options === void 0 ? void 0 : options.tooltipLegendTemplate) !== null && _s !== void 0 ? _s : _this.tooltipLegendTemplate;
|
|
166
|
+
_this.tooltipLegendOffsetX = (_t = options === null || options === void 0 ? void 0 : options.tooltipLegendOffsetX) !== null && _t !== void 0 ? _t : _this.tooltipLegendOffsetX;
|
|
167
|
+
_this.tooltipLegendOffsetY = (_u = options === null || options === void 0 ? void 0 : options.tooltipLegendOffsetY) !== null && _u !== void 0 ? _u : _this.tooltipLegendOffsetY;
|
|
165
168
|
if (options === null || options === void 0 ? void 0 : options.tooltipDataTemplate) {
|
|
166
169
|
if (typeof options.tooltipDataTemplate === "string") {
|
|
167
170
|
_this.typeMap.set("tooltipDataTemplate", options.tooltipDataTemplate);
|
|
@@ -170,10 +173,10 @@ var CursorModifier = /** @class */ (function (_super) {
|
|
|
170
173
|
}
|
|
171
174
|
}
|
|
172
175
|
_this.tooltipDataTemplateProperty =
|
|
173
|
-
(
|
|
174
|
-
_this.showXLine = (
|
|
175
|
-
_this.showYLine = (
|
|
176
|
-
_this.hitTestRadius = (
|
|
176
|
+
(_v = options === null || options === void 0 ? void 0 : options.tooltipDataTemplate) !== null && _v !== void 0 ? _v : _this.tooltipDataTemplateProperty;
|
|
177
|
+
_this.showXLine = (_w = options === null || options === void 0 ? void 0 : options.showXLine) !== null && _w !== void 0 ? _w : _this.showXLine;
|
|
178
|
+
_this.showYLine = (_x = options === null || options === void 0 ? void 0 : options.showYLine) !== null && _x !== void 0 ? _x : _this.showYLine;
|
|
179
|
+
_this.hitTestRadius = (_y = options === null || options === void 0 ? void 0 : options.hitTestRadius) !== null && _y !== void 0 ? _y : _this.hitTestRadius;
|
|
177
180
|
return _this;
|
|
178
181
|
}
|
|
179
182
|
/**
|
|
@@ -183,6 +186,9 @@ var CursorModifier = /** @class */ (function (_super) {
|
|
|
183
186
|
if (!this.testPropertyChanged(constants_1.PROPERTY.CROSSHAIR_STROKE)) {
|
|
184
187
|
this.crosshairStroke = themeProvider.cursorLineBrush;
|
|
185
188
|
}
|
|
189
|
+
if (!this.testPropertyChanged(constants_1.PROPERTY.TOOLTIP_SHADOW)) {
|
|
190
|
+
this.tooltipShadow = themeProvider.shadowEffectColor;
|
|
191
|
+
}
|
|
186
192
|
};
|
|
187
193
|
/**
|
|
188
194
|
* @inheritDoc
|
|
@@ -292,8 +298,29 @@ var CursorModifier = /** @class */ (function (_super) {
|
|
|
292
298
|
* Gets or sets the crosshair line Stroke color as an HTML Color code
|
|
293
299
|
*/
|
|
294
300
|
set: function (value) {
|
|
295
|
-
this.crosshairStrokeProperty
|
|
296
|
-
|
|
301
|
+
if (this.crosshairStrokeProperty !== value) {
|
|
302
|
+
this.crosshairStrokeProperty = value;
|
|
303
|
+
this.notifyPropertyChanged(constants_1.PROPERTY.CROSSHAIR_STROKE);
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
enumerable: false,
|
|
307
|
+
configurable: true
|
|
308
|
+
});
|
|
309
|
+
Object.defineProperty(CursorModifier.prototype, "tooltipShadow", {
|
|
310
|
+
/**
|
|
311
|
+
* Gets or sets the tooltip shadow color as an HTML Color code
|
|
312
|
+
*/
|
|
313
|
+
get: function () {
|
|
314
|
+
return this.tooltipShadowProperty;
|
|
315
|
+
},
|
|
316
|
+
/**
|
|
317
|
+
* Gets or sets the tooltip shadow color as an HTML Color code
|
|
318
|
+
*/
|
|
319
|
+
set: function (value) {
|
|
320
|
+
if (this.tooltipShadowProperty !== value) {
|
|
321
|
+
this.tooltipShadowProperty = value;
|
|
322
|
+
this.notifyPropertyChanged(constants_1.PROPERTY.TOOLTIP_SHADOW);
|
|
323
|
+
}
|
|
297
324
|
},
|
|
298
325
|
enumerable: false,
|
|
299
326
|
configurable: true
|
|
@@ -487,7 +514,8 @@ var CursorModifier = /** @class */ (function (_super) {
|
|
|
487
514
|
tooltipLegendOffsetY: this.tooltipLegendOffsetY,
|
|
488
515
|
tooltipLegendTemplate: this.typeMap.get("tooltipLegendTemplate"),
|
|
489
516
|
tooltipSvgTemplate: this.typeMap.get("tooltipSvgTemplate"),
|
|
490
|
-
tooltipTextStroke: this.tooltipTextStroke
|
|
517
|
+
tooltipTextStroke: this.tooltipTextStroke,
|
|
518
|
+
tooltipShadow: this.tooltipShadow
|
|
491
519
|
};
|
|
492
520
|
Object.assign(json.options, options);
|
|
493
521
|
return json;
|
|
@@ -689,23 +717,38 @@ var defaultTooltipTemplate = function (seriesInfos, svgAnnotation) {
|
|
|
689
717
|
return "<svg></svg>";
|
|
690
718
|
}
|
|
691
719
|
// tooltip size
|
|
692
|
-
var _b = (0, exports.calcTooltipSize)(valuesWithLabels), width = _b.width, height = _b.height;
|
|
720
|
+
var _b = (0, exports.calcTooltipSize)(valuesWithLabels, 13), width = _b.width, height = _b.height;
|
|
693
721
|
// adjust position
|
|
694
722
|
(0, exports.adjustTooltipPosition)(width, height, svgAnnotation);
|
|
695
723
|
var valuesBlock = "";
|
|
696
724
|
valuesWithLabels.forEach(function (val, index) {
|
|
697
725
|
valuesBlock += "<tspan x=\"8\" dy=\"1.2em\">".concat(val, "</tspan>");
|
|
698
726
|
});
|
|
727
|
+
var rectHeight = "95%";
|
|
728
|
+
if (svgAnnotation.yCoordShift < 0) {
|
|
729
|
+
// Fix the issue where the rect would be too small if the height was enormous
|
|
730
|
+
var maxHeight = (0, translate_1.translateToNotScaled)(svgAnnotation.parentSurface.seriesViewRect.height) - svgAnnotation.y1;
|
|
731
|
+
if (height > maxHeight) {
|
|
732
|
+
rectHeight = (height - 5).toFixed(0);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
699
735
|
var tooltipFill = svgAnnotation.containerBackground;
|
|
700
736
|
var tooltipStroke = svgAnnotation.textStroke;
|
|
701
|
-
|
|
737
|
+
var shadowColor = svgAnnotation.cursorModifier.tooltipShadow;
|
|
738
|
+
console.log(shadowColor);
|
|
739
|
+
var blur = "<feGaussianBlur result=\"blurOut\" in=\"offOut\" stdDeviation=\"3\" />";
|
|
740
|
+
if (shadowColor !== undefined) {
|
|
741
|
+
var shadowRGBA = (0, parseColor_1.parseColorToTArgb)(shadowColor);
|
|
742
|
+
blur = "<feColorMatrix result=\"matrixOut\" in=\"offOut\" type=\"matrix\"\n values=\"0 0 0 0 ".concat(shadowRGBA.red / 255, "\n 0 0 0 0 ").concat(shadowRGBA.green / 255, "\n 0 0 0 0 ").concat(shadowRGBA.blue / 255, "\n 0 0 0 ").concat(shadowRGBA.opacity / 255, " 0\" />\n <feGaussianBlur result=\"blurOut\" in=\"matrixOut\" stdDeviation=\"3\" />");
|
|
743
|
+
}
|
|
744
|
+
return "<svg class=\"scichart__cursor-tooltip\" width=\"".concat(width, "\" height=\"").concat(height, "\">\n <defs>\n <filter id=\"").concat(id, "\" x=\"0\" y=\"0\" width=\"200%\" height=\"200%\">\n <feOffset result=\"offOut\" in=\"SourceAlpha\" dx=\"3\" dy=\"3\" />\n ").concat(blur, "\n <feBlend in=\"SourceGraphic\" in2=\"blurOut\" mode=\"normal\" />\n </filter>\n </defs>\n <rect rx=\"4\" ry=\"4\" width=\"95%\" height=\"").concat(rectHeight, "\" fill=\"").concat(tooltipFill, "\" filter=\"url(#").concat(id, ")\" />\n <svg width=\"100%\">\n <text x=\"8\" y=\"3\" font-size=\"13\" font-family=\"Verdana\" dy=\"0\" fill=\"").concat(tooltipStroke, "\">").concat(valuesBlock, "</text>\n </svg>\n </svg>");
|
|
702
745
|
};
|
|
703
746
|
/** Calculate the width and height of the tooltip based on the content array */
|
|
704
747
|
var calcTooltipSize = function (valuesWithLabels, fontSize) {
|
|
705
748
|
if (fontSize === void 0) { fontSize = 13; }
|
|
706
749
|
var textLength = valuesWithLabels.reduce(function (prev, cur) { return (cur.length > prev ? cur.length : prev); }, 0);
|
|
707
750
|
var width = textLength * 8 + 20;
|
|
708
|
-
var height =
|
|
751
|
+
var height = fontSize * 1.2 * valuesWithLabels.length + 16;
|
|
709
752
|
return { width: width, height: height };
|
|
710
753
|
};
|
|
711
754
|
exports.calcTooltipSize = calcTooltipSize;
|
|
@@ -585,7 +585,7 @@ var RolloverModifier = /** @class */ (function (_super) {
|
|
|
585
585
|
rsList.forEach(function (rs, index) {
|
|
586
586
|
var hitTestInfo = _this.hitTestRenderableSeries(rs, _this.mousePoint);
|
|
587
587
|
if (hitTestInfo) {
|
|
588
|
-
if (rs.type !== SeriesType_1.ESeriesType.StackedColumnSeries || hitTestInfo.isHit) {
|
|
588
|
+
if ((rs.type !== SeriesType_1.ESeriesType.StackedColumnSeries && _this.hitTestRadius === 0) || hitTestInfo.isHit) {
|
|
589
589
|
var isVisible = 0 <= hitTestInfo.yCoord && hitTestInfo.yCoord <= height;
|
|
590
590
|
if (isVisible) {
|
|
591
591
|
_this.absoluteXCoord = _this.isVerticalChart() ? hitTestInfo.yCoord : hitTestInfo.xCoord;
|
|
@@ -607,9 +607,13 @@ var RolloverModifier = /** @class */ (function (_super) {
|
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
609
|
});
|
|
610
|
-
var orderedTooltipArray
|
|
611
|
-
|
|
612
|
-
|
|
610
|
+
var orderedTooltipArray;
|
|
611
|
+
if (this.isVerticalChart()) {
|
|
612
|
+
orderedTooltipArray = tooltipArray.sort(function (a, b) { return (a.xCoord > b.xCoord ? 1 : b.xCoord > a.xCoord ? -1 : 0); });
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
orderedTooltipArray = tooltipArray.sort(function (a, b) { return (a.yCoord > b.yCoord ? 1 : b.yCoord > a.yCoord ? -1 : 0); });
|
|
616
|
+
}
|
|
613
617
|
var tooltipPositions = this.CalculateTooltipPositions(orderedTooltipArray, this.allowTooltipOverlapping, exports.TOOLTIP_SPACING * DpiHelper_1.DpiHelper.PIXEL_RATIO, this.parentSurface.seriesViewRect, DpiHelper_1.DpiHelper.PIXEL_RATIO, this.isVerticalChart());
|
|
614
618
|
tooltipPositions.forEach(function (el) {
|
|
615
619
|
var rs = rsList[el.index];
|
|
@@ -756,6 +760,15 @@ exports.calcTooltipProps = calcTooltipProps;
|
|
|
756
760
|
var calcTooltipPositions = function (tooltipArray, allowTooltipOverlapping, spacing, seriesViewRect, pixelRatio, isVerticalChart) {
|
|
757
761
|
if (isVerticalChart === void 0) { isVerticalChart = false; }
|
|
758
762
|
var positionProperties = (0, tooltip_1.getTooltipPositionProperties)(isVerticalChart);
|
|
763
|
+
// centering for vertical charts
|
|
764
|
+
if (isVerticalChart) {
|
|
765
|
+
tooltipArray.forEach(function (tooltip) {
|
|
766
|
+
var halfWidth = tooltip.width / 2 / pixelRatio;
|
|
767
|
+
if (tooltip.xCoord > halfWidth) {
|
|
768
|
+
tooltip[positionProperties.shiftPropertyName] = -(tooltip.width / 2) / pixelRatio;
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
}
|
|
759
772
|
var hasOverlap = (0, tooltip_1.checkHasOverlap)(tooltipArray, spacing, pixelRatio, positionProperties);
|
|
760
773
|
var length = tooltipArray.length;
|
|
761
774
|
if (!allowTooltipOverlapping && length >= 2 && hasOverlap) {
|
|
@@ -764,12 +777,6 @@ var calcTooltipPositions = function (tooltipArray, allowTooltipOverlapping, spac
|
|
|
764
777
|
tooltip[positionProperties.shiftPropertyName] = spreadMap_1.get(tooltip.index);
|
|
765
778
|
});
|
|
766
779
|
}
|
|
767
|
-
// centering for vertical charts without overlapping
|
|
768
|
-
if (isVerticalChart && !hasOverlap) {
|
|
769
|
-
tooltipArray.forEach(function (tooltip) {
|
|
770
|
-
return (tooltip[positionProperties.shiftPropertyName] = -(tooltip.width / 2) / pixelRatio);
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
780
|
return tooltipArray;
|
|
774
781
|
};
|
|
775
782
|
exports.calcTooltipPositions = calcTooltipPositions;
|
|
@@ -791,6 +798,7 @@ var createAnnotations = function (rs, rolloverModifierProps, rolloverModifierPro
|
|
|
791
798
|
if (!rolloverModifierProps.tooltip) {
|
|
792
799
|
rolloverModifierProps.tooltipTitle = (_b = (_a = rolloverModifierProps.tooltipTitle) !== null && _a !== void 0 ? _a : rs.getDataSeriesName()) !== null && _b !== void 0 ? _b : "";
|
|
793
800
|
rolloverModifierProps.tooltipColor = rolloverModifierProps.tooltipColor;
|
|
801
|
+
rolloverModifierProps.shadowColor = rs.parentSurface.themeProvider.shadowEffectColor;
|
|
794
802
|
rolloverModifierProps.tooltip = new RolloverTooltipSvgAnnotation_1.RolloverTooltipSvgAnnotation(rolloverModifierProps, {
|
|
795
803
|
seriesType: rs.type,
|
|
796
804
|
placementDivId: placementDivId
|
|
@@ -29,5 +29,6 @@ export declare enum PROPERTY {
|
|
|
29
29
|
X_COORDINATE_MODE = "X_COORDINATE_MODE",
|
|
30
30
|
IS_DRAGGABLE = "IS_DRAGGABLE",
|
|
31
31
|
LINE_ANNOTATIONS_OPTIONS = "LINE_ANNOTATIONS_OPTIONS",
|
|
32
|
-
LINE_SELECTION_COLOR = "LINE_SELECTION_COLOR"
|
|
32
|
+
LINE_SELECTION_COLOR = "LINE_SELECTION_COLOR",
|
|
33
|
+
TOOLTIP_SHADOW = "TOOLTIP_SHADOW"
|
|
33
34
|
}
|
|
@@ -34,4 +34,5 @@ var PROPERTY;
|
|
|
34
34
|
PROPERTY["IS_DRAGGABLE"] = "IS_DRAGGABLE";
|
|
35
35
|
PROPERTY["LINE_ANNOTATIONS_OPTIONS"] = "LINE_ANNOTATIONS_OPTIONS";
|
|
36
36
|
PROPERTY["LINE_SELECTION_COLOR"] = "LINE_SELECTION_COLOR";
|
|
37
|
+
PROPERTY["TOOLTIP_SHADOW"] = "TOOLTIP_SHADOW";
|
|
37
38
|
})(PROPERTY = exports.PROPERTY || (exports.PROPERTY = {}));
|
|
@@ -30,6 +30,7 @@ var SeriesInfo = /** @class */ (function () {
|
|
|
30
30
|
this.point2yCoordinate = hitTestInfo.point2yCoord;
|
|
31
31
|
this.pointMetadata = hitTestInfo.metadata;
|
|
32
32
|
this.point2metadata = hitTestInfo.point2metadata;
|
|
33
|
+
this.distance = hitTestInfo.distance;
|
|
33
34
|
if (renderableSeries.type === SeriesType_1.ESeriesType.ColumnSeries) {
|
|
34
35
|
this.fill = renderableSeries.fill;
|
|
35
36
|
}
|
|
@@ -16,15 +16,46 @@ export interface ICustomAnnotationOptions extends ISvgAnnotationBaseOptions {
|
|
|
16
16
|
export declare class CustomAnnotation extends SvgAnnotationBase {
|
|
17
17
|
/** @inheritDoc */
|
|
18
18
|
readonly type = EAnnotationType.SVGCustomAnnotation;
|
|
19
|
-
|
|
20
|
-
* SVG dom element string provided by the user
|
|
21
|
-
*/
|
|
22
|
-
svgStringProperty: string;
|
|
19
|
+
private svgStringProperty;
|
|
23
20
|
/**
|
|
24
21
|
* Creates an instance of the {@link CustomAnnotation}
|
|
25
22
|
* @param options The {@link ICustomAnnotationOptions} which contain optional parameters
|
|
26
23
|
*/
|
|
27
24
|
constructor(options?: ICustomAnnotationOptions);
|
|
25
|
+
/**
|
|
26
|
+
* SVG dom element string provided by the user
|
|
27
|
+
*/
|
|
28
|
+
get svgString(): string;
|
|
29
|
+
/**
|
|
30
|
+
* SVG dom element string provided by the user
|
|
31
|
+
*/
|
|
32
|
+
set svgString(value: string);
|
|
33
|
+
/** This is called to get the svg string to use. Override this to customise the svg string for each render */
|
|
34
|
+
getSvgString(annotation: CustomAnnotation): string;
|
|
35
|
+
/**
|
|
36
|
+
* This is called on the svg element immediately after it is created. Use this to do adjustments or additions to it which require knowlege of its size.
|
|
37
|
+
* For instance, this method adds a bounding rectangle to the existing svg
|
|
38
|
+
* ```ts
|
|
39
|
+
* updateSvg(annotation: CustomAnnotation, svg: SVGSVGElement) {
|
|
40
|
+
* const annotationRect = svg.getBoundingClientRect();
|
|
41
|
+
* const padding = 5;
|
|
42
|
+
* // Offset the existing element by the padding
|
|
43
|
+
* (svg.firstChild as SVGElement).setAttribute("x", padding.toString());
|
|
44
|
+
* (svg.firstChild as SVGElement).setAttribute("y", padding.toString());
|
|
45
|
+
* const rectWidth = annotationRect.width + padding + padding;
|
|
46
|
+
* const rectHeight = annotationRect.height + padding + padding;
|
|
47
|
+
* const namespace = "http://www.w3.org/2000/svg";
|
|
48
|
+
* const newRect = document.createElementNS(namespace, "rect");
|
|
49
|
+
* newRect.setAttribute("x", "0");
|
|
50
|
+
* newRect.setAttribute("y", "0");
|
|
51
|
+
* newRect.setAttribute("width", `${rectWidth}`);
|
|
52
|
+
* newRect.setAttribute("height", `${rectHeight}`);
|
|
53
|
+
* newRect.setAttribute("fill", `red`);
|
|
54
|
+
* return svg;
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
updateSvg(annotation: CustomAnnotation, svg: SVGSVGElement): SVGSVGElement;
|
|
28
59
|
/** @inheritDoc */
|
|
29
60
|
toJSON(): {
|
|
30
61
|
type: EAnnotationType;
|
|
@@ -32,6 +63,4 @@ export declare class CustomAnnotation extends SvgAnnotationBase {
|
|
|
32
63
|
};
|
|
33
64
|
/** @inheritDoc */
|
|
34
65
|
protected create(xCalc: CoordinateCalculatorBase, yCalc: CoordinateCalculatorBase, xCoordSvgTrans: number, yCoordSvgTrans: number): void;
|
|
35
|
-
get svgString(): string;
|
|
36
|
-
set svgString(value: string);
|
|
37
66
|
}
|
|
@@ -37,11 +37,61 @@ var CustomAnnotation = /** @class */ (function (_super) {
|
|
|
37
37
|
_this.svgStringProperty = (_a = options === null || options === void 0 ? void 0 : options.svgString) !== null && _a !== void 0 ? _a : undefined;
|
|
38
38
|
return _this;
|
|
39
39
|
}
|
|
40
|
+
Object.defineProperty(CustomAnnotation.prototype, "svgString", {
|
|
41
|
+
/**
|
|
42
|
+
* SVG dom element string provided by the user
|
|
43
|
+
*/
|
|
44
|
+
get: function () {
|
|
45
|
+
return this.svgStringProperty;
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* SVG dom element string provided by the user
|
|
49
|
+
*/
|
|
50
|
+
set: function (value) {
|
|
51
|
+
if (this.svgStringProperty !== value) {
|
|
52
|
+
this.clear();
|
|
53
|
+
this.svgStringProperty = value;
|
|
54
|
+
this.notifyPropertyChanged("svgString");
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
enumerable: false,
|
|
58
|
+
configurable: true
|
|
59
|
+
});
|
|
60
|
+
/** This is called to get the svg string to use. Override this to customise the svg string for each render */
|
|
61
|
+
CustomAnnotation.prototype.getSvgString = function (annotation) {
|
|
62
|
+
return annotation.svgString;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* This is called on the svg element immediately after it is created. Use this to do adjustments or additions to it which require knowlege of its size.
|
|
66
|
+
* For instance, this method adds a bounding rectangle to the existing svg
|
|
67
|
+
* ```ts
|
|
68
|
+
* updateSvg(annotation: CustomAnnotation, svg: SVGSVGElement) {
|
|
69
|
+
* const annotationRect = svg.getBoundingClientRect();
|
|
70
|
+
* const padding = 5;
|
|
71
|
+
* // Offset the existing element by the padding
|
|
72
|
+
* (svg.firstChild as SVGElement).setAttribute("x", padding.toString());
|
|
73
|
+
* (svg.firstChild as SVGElement).setAttribute("y", padding.toString());
|
|
74
|
+
* const rectWidth = annotationRect.width + padding + padding;
|
|
75
|
+
* const rectHeight = annotationRect.height + padding + padding;
|
|
76
|
+
* const namespace = "http://www.w3.org/2000/svg";
|
|
77
|
+
* const newRect = document.createElementNS(namespace, "rect");
|
|
78
|
+
* newRect.setAttribute("x", "0");
|
|
79
|
+
* newRect.setAttribute("y", "0");
|
|
80
|
+
* newRect.setAttribute("width", `${rectWidth}`);
|
|
81
|
+
* newRect.setAttribute("height", `${rectHeight}`);
|
|
82
|
+
* newRect.setAttribute("fill", `red`);
|
|
83
|
+
* return svg;
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
CustomAnnotation.prototype.updateSvg = function (annotation, svg) {
|
|
88
|
+
return svg;
|
|
89
|
+
};
|
|
40
90
|
/** @inheritDoc */
|
|
41
91
|
CustomAnnotation.prototype.toJSON = function () {
|
|
42
92
|
var json = _super.prototype.toJSON.call(this);
|
|
43
93
|
var options = {
|
|
44
|
-
svgString: this.
|
|
94
|
+
svgString: this.svgString
|
|
45
95
|
};
|
|
46
96
|
Object.assign(json.options, options);
|
|
47
97
|
return json;
|
|
@@ -60,9 +110,10 @@ var CustomAnnotation = /** @class */ (function (_super) {
|
|
|
60
110
|
this.prevX1Coordinate = this.getX1Coordinate(xCalc, yCalc);
|
|
61
111
|
this.prevY1Coordinate = this.getY1Coordinate(xCalc, yCalc);
|
|
62
112
|
if (this.svg) {
|
|
63
|
-
this.
|
|
113
|
+
this.clear();
|
|
64
114
|
}
|
|
65
|
-
|
|
115
|
+
var svg = annotationHelpers_1.annotationHelpers.createSvg(this.getSvgString(this), this.svgRoot);
|
|
116
|
+
this.setSvg(this.updateSvg(this, svg));
|
|
66
117
|
this.calcAndSetAnnotationBorders(xCalc, yCalc);
|
|
67
118
|
this.updateAdornerInner();
|
|
68
119
|
this.prevIsSelected = this.isSelected;
|
|
@@ -75,17 +126,6 @@ var CustomAnnotation = /** @class */ (function (_super) {
|
|
|
75
126
|
this.prevIsSelected = this.isSelected;
|
|
76
127
|
}
|
|
77
128
|
};
|
|
78
|
-
Object.defineProperty(CustomAnnotation.prototype, "svgString", {
|
|
79
|
-
get: function () {
|
|
80
|
-
return this.svgStringProperty;
|
|
81
|
-
},
|
|
82
|
-
set: function (value) {
|
|
83
|
-
this.delete();
|
|
84
|
-
this.svgStringProperty = value;
|
|
85
|
-
},
|
|
86
|
-
enumerable: false,
|
|
87
|
-
configurable: true
|
|
88
|
-
});
|
|
89
129
|
return CustomAnnotation;
|
|
90
130
|
}(SvgAnnotationBase_1.SvgAnnotationBase));
|
|
91
131
|
exports.CustomAnnotation = CustomAnnotation;
|
|
@@ -88,6 +88,7 @@ var NativeTextAnnotation = /** @class */ (function (_super) {
|
|
|
88
88
|
_this.initialWidth = Math.abs(_this.x2 - _this.x1);
|
|
89
89
|
_this.scaleOnResize = (_m = options === null || options === void 0 ? void 0 : options.scaleOnResize) !== null && _m !== void 0 ? _m : _this.scaleOnResize;
|
|
90
90
|
return _this;
|
|
91
|
+
// this.fill = options?.fill ?? this.fillProperty;
|
|
91
92
|
}
|
|
92
93
|
Object.defineProperty(NativeTextAnnotation.prototype, "textColor", {
|
|
93
94
|
/**
|
|
@@ -107,6 +108,21 @@ var NativeTextAnnotation = /** @class */ (function (_super) {
|
|
|
107
108
|
configurable: true
|
|
108
109
|
});
|
|
109
110
|
Object.defineProperty(NativeTextAnnotation.prototype, "fontSize", {
|
|
111
|
+
// /**
|
|
112
|
+
// * Gets the fill for the {@link NativeTextAnnotation}
|
|
113
|
+
// * @remarks Acceptable values include RGB format e.g. ```#FF0000```, RGBA format e.g. ```#FF000077`` and RGBA format e.g. ```rgba(255,0,0,0.5)```
|
|
114
|
+
// */
|
|
115
|
+
// public get fill(): string {
|
|
116
|
+
// return this.fillProperty;
|
|
117
|
+
// }
|
|
118
|
+
// /**
|
|
119
|
+
// * Sets the fill for the {@link NativeTextAnnotation}
|
|
120
|
+
// * @remarks Acceptable values include RGB format e.g. ```#FF0000```, RGBA format e.g. ```#FF000077`` and RGBA format e.g. ```rgba(255,0,0,0.5)```
|
|
121
|
+
// */
|
|
122
|
+
// public set fill(htmlColorCode: string) {
|
|
123
|
+
// this.fillProperty = htmlColorCode;
|
|
124
|
+
// this.notifyPropertyChanged(PROPERTY.FILL);
|
|
125
|
+
// }
|
|
110
126
|
/**
|
|
111
127
|
* Gets the fontSize for the {@link NativeTextAnnotation}
|
|
112
128
|
*/
|
|
@@ -291,10 +307,16 @@ var NativeTextAnnotation = /** @class */ (function (_super) {
|
|
|
291
307
|
configurable: true
|
|
292
308
|
});
|
|
293
309
|
/** @inheritDoc */
|
|
294
|
-
NativeTextAnnotation.prototype.delete = function () {
|
|
310
|
+
NativeTextAnnotation.prototype.delete = function () {
|
|
311
|
+
// this.fillBrushCache = deleteSafe(this.fillBrushCache);
|
|
312
|
+
};
|
|
295
313
|
/** @inheritDoc */
|
|
296
314
|
NativeTextAnnotation.prototype.onAttach = function (scs) {
|
|
297
315
|
_super.prototype.onAttach.call(this, scs);
|
|
316
|
+
// if (!this.fillBrushCache) {
|
|
317
|
+
// this.fillBrushCache = new BrushCache(scs.webAssemblyContext2D);
|
|
318
|
+
// }
|
|
319
|
+
// createBrushInCache(this.fillBrushCache, this.fill, this.opacity);
|
|
298
320
|
};
|
|
299
321
|
/** Calculate the center point for a rotation */
|
|
300
322
|
NativeTextAnnotation.prototype.getRotationCenter = function (x, y, bounds) {
|
|
@@ -371,6 +393,14 @@ var NativeTextAnnotation = /** @class */ (function (_super) {
|
|
|
371
393
|
(textBounds.GetLineBounds(0).m_fHeight - textBounds.GetLineBounds(0).m_fOffsetY) *
|
|
372
394
|
(textBounds.GetLinesCount() - 1);
|
|
373
395
|
}
|
|
396
|
+
// TODO use for text background when rect rotation is implemented
|
|
397
|
+
// const padding = Thickness.fromNumber(0);
|
|
398
|
+
// const x = x1 + viewRect.x + padding.left;
|
|
399
|
+
// const y = y1 + viewRect.y + padding.top;
|
|
400
|
+
// let borderX1 = x1;
|
|
401
|
+
// let borderY1 = y1 - textBounds.GetLineBounds(0).m_fHeight - padding.top - padding.bottom;
|
|
402
|
+
// let borderX2 = x1 + textBounds.m_fWidth + padding.left + padding.right;
|
|
403
|
+
// let borderY2 = borderY1 + textBounds.m_fHeight + padding.top;
|
|
374
404
|
var x = x1 + viewRect.x;
|
|
375
405
|
var y = y1 + viewRect.y;
|
|
376
406
|
var borderX1 = x1;
|
|
@@ -403,6 +433,15 @@ var NativeTextAnnotation = /** @class */ (function (_super) {
|
|
|
403
433
|
scaleChanged = true;
|
|
404
434
|
}
|
|
405
435
|
this.setAnnotationBorders(borderX1, borderX1 + (borderX2 - borderX1) * this.scale, borderY1, borderY1 + (borderY2 - borderY1) * this.scale);
|
|
436
|
+
// const strokePen: WebGlPen = undefined;
|
|
437
|
+
// const fillBrush = this.fill ? getWebGlBrushFromCache(this.fillBrushCache) : undefined;
|
|
438
|
+
// fillBrush?.setOpacity(this.opacity);
|
|
439
|
+
// const rect = Rect.createWithPoints(new Point(borderX1, borderY1), new Point(borderX2, borderY2));
|
|
440
|
+
// // Temporary HAX! drawRect is rubbish with large strokeThickness, whereas the columnDrawingProvider does a nice
|
|
441
|
+
// // outlined rectangle, but the code is ugly. In 2.3 we will improve the native drawRect to do the outline properly.
|
|
442
|
+
// if (!IS_TEST_ENV) {
|
|
443
|
+
// renderContext.drawRect(rect, viewRect, strokePen, fillBrush);
|
|
444
|
+
// }
|
|
406
445
|
font.DrawStringAdvanced(text, colorNum, Math.round(x), Math.round(y), rotationVector, alignMode, spacing);
|
|
407
446
|
if (scaleChanged) {
|
|
408
447
|
font.SetScale(oldScale);
|
|
@@ -532,6 +571,7 @@ var NativeTextAnnotation = /** @class */ (function (_super) {
|
|
|
532
571
|
fontFamily: this.fontFamily,
|
|
533
572
|
fontSize: this.fontSize,
|
|
534
573
|
textColor: this.textColor,
|
|
574
|
+
// fill: this.fill,
|
|
535
575
|
rotation: this.rotation,
|
|
536
576
|
text: this.text
|
|
537
577
|
};
|
|
@@ -542,6 +582,13 @@ var NativeTextAnnotation = /** @class */ (function (_super) {
|
|
|
542
582
|
var _a = this.getAnnotationBorders(true), x1 = _a.x1, x2 = _a.x2, y1 = _a.y1, y2 = _a.y2;
|
|
543
583
|
return (0, pointUtil_1.testIsInBounds)(x, y, x1, y2, x2, y1);
|
|
544
584
|
};
|
|
585
|
+
// protected notifyPropertyChanged(propertyName: string): void {
|
|
586
|
+
// super.notifyPropertyChanged(propertyName);
|
|
587
|
+
// const fillBrushRelatedProperties = [PROPERTY.FILL, PROPERTY.OPACITY];
|
|
588
|
+
// if (this.fillBrushCache && fillBrushRelatedProperties.includes(propertyName as PROPERTY)) {
|
|
589
|
+
// createBrushInCache(this.fillBrushCache, this.fill, this.opacity);
|
|
590
|
+
// }
|
|
591
|
+
// }
|
|
545
592
|
NativeTextAnnotation.prototype.updateAdornerInner = function () {
|
|
546
593
|
this.deleteAdorner();
|
|
547
594
|
if (this.isSelected) {
|
|
@@ -7,6 +7,7 @@ export declare class RolloverMarkerSvgAnnotation extends SvgAnnotationBase {
|
|
|
7
7
|
readonly type = EAnnotationType.SVG;
|
|
8
8
|
private tooltipProps;
|
|
9
9
|
private previousMousePosition;
|
|
10
|
+
private currentColor;
|
|
10
11
|
constructor(renderableSeriesProps: RolloverModifierRenderableSeriesProps);
|
|
11
12
|
/** @inheritDoc */
|
|
12
13
|
update(xCalc: CoordinateCalculatorBase, yCalc: CoordinateCalculatorBase, xCoordSvgTrans: number, yCoordSvgTrans: number): void;
|
|
@@ -45,13 +45,17 @@ var RolloverMarkerSvgAnnotation = /** @class */ (function (_super) {
|
|
|
45
45
|
};
|
|
46
46
|
/** @inheritDoc */
|
|
47
47
|
RolloverMarkerSvgAnnotation.prototype.create = function (xCalc, yCalc, xCoordSvgTrans, yCoordSvgTrans) {
|
|
48
|
-
|
|
48
|
+
var _a = this.tooltipProps, tooltipColor = _a.tooltipColor, markerColor = _a.markerColor;
|
|
49
|
+
var color = markerColor !== null && markerColor !== void 0 ? markerColor : tooltipColor;
|
|
50
|
+
if (this.svg && this.currentColor !== color) {
|
|
49
51
|
this.clear();
|
|
50
52
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
if (!this.svg) {
|
|
54
|
+
this.currentColor === color;
|
|
55
|
+
var svgString = tooltipSvgTemplate(color);
|
|
56
|
+
var svgNode = annotationHelpers_1.annotationHelpers.createSvg(svgString, this.svgRoot);
|
|
57
|
+
this.setSvg(svgNode);
|
|
58
|
+
}
|
|
55
59
|
};
|
|
56
60
|
return RolloverMarkerSvgAnnotation;
|
|
57
61
|
}(SvgAnnotationBase_1.SvgAnnotationBase));
|
|
@@ -23,6 +23,7 @@ var annotationHelpers_1 = require("./annotationHelpers");
|
|
|
23
23
|
var constants_1 = require("./constants");
|
|
24
24
|
var IAnnotation_1 = require("./IAnnotation");
|
|
25
25
|
var SvgAnnotationBase_1 = require("./SvgAnnotationBase");
|
|
26
|
+
var parseColor_1 = require("../../../utils/parseColor");
|
|
26
27
|
// TODO: Rename to RolloverTooltipSvgAnnotation
|
|
27
28
|
/**
|
|
28
29
|
* A Tooltip Annotation which provides an SVG tooltip over the chart. Used by the {@link RolloverModifier}
|
|
@@ -238,7 +239,7 @@ var defaultTooltipTemplate = function (id, seriesInfo, rolloverTooltip) {
|
|
|
238
239
|
var _a, _b, _c, _d, _e;
|
|
239
240
|
var valuesBlock = "";
|
|
240
241
|
var tooltipProps = rolloverTooltip.tooltipProps;
|
|
241
|
-
var tooltipTitle = tooltipProps.tooltipTitle, tooltipColor = tooltipProps.tooltipColor, tooltipTextColor = tooltipProps.tooltipTextColor, tooltipLabelX = tooltipProps.tooltipLabelX, tooltipLabelY = tooltipProps.tooltipLabelY;
|
|
242
|
+
var tooltipTitle = tooltipProps.tooltipTitle, tooltipColor = tooltipProps.tooltipColor, tooltipTextColor = tooltipProps.tooltipTextColor, tooltipLabelX = tooltipProps.tooltipLabelX, tooltipLabelY = tooltipProps.tooltipLabelY, shadowColor = tooltipProps.shadowColor;
|
|
242
243
|
var tooltipDataTemplate = (_c = (_a = rolloverTooltip.tooltipProps.tooltipDataTemplate) !== null && _a !== void 0 ? _a : (_b = rolloverTooltip.tooltipProps.rolloverModifier) === null || _b === void 0 ? void 0 : _b.tooltipDataTemplate) !== null && _c !== void 0 ? _c : defaultTooltipDataTemplate;
|
|
243
244
|
var valuesWithLabels = tooltipDataTemplate(seriesInfo, tooltipTitle, tooltipLabelX, tooltipLabelY);
|
|
244
245
|
// tooltip width
|
|
@@ -249,7 +250,12 @@ var defaultTooltipTemplate = function (id, seriesInfo, rolloverTooltip) {
|
|
|
249
250
|
valuesWithLabels.forEach(function (val, index) {
|
|
250
251
|
valuesBlock += "<tspan x=\"8\" dy=\"1.2em\">".concat(val, "</tspan>");
|
|
251
252
|
});
|
|
252
|
-
|
|
253
|
+
var blur = "<feGaussianBlur result=\"blurOut\" in=\"offOut\" stdDeviation=\"3\" />";
|
|
254
|
+
if (shadowColor !== undefined) {
|
|
255
|
+
var shadowRGBA = (0, parseColor_1.parseColorToTArgb)(shadowColor);
|
|
256
|
+
blur = "<feColorMatrix result=\"matrixOut\" in=\"offOut\" type=\"matrix\"\n values=\"0 0 0 0 ".concat(shadowRGBA.red / 255, "\n 0 0 0 0 ").concat(shadowRGBA.green / 255, "\n 0 0 0 0 ").concat(shadowRGBA.blue / 255, "\n 0 0 0 ").concat(shadowRGBA.opacity / 255, " 0\" />\n <feGaussianBlur result=\"blurOut\" in=\"matrixOut\" stdDeviation=\"3\" />");
|
|
257
|
+
}
|
|
258
|
+
return "<svg class=\"scichart__rollover-tooltip\" width=\"".concat(width, "\" height=\"").concat(height, "\">\n <defs>\n <filter id=\"").concat(id, "\" x=\"0\" y=\"0\" width=\"200%\" height=\"200%\">\n <feOffset result=\"offOut\" in=\"SourceAlpha\" dx=\"3\" dy=\"3\" />\n ").concat(blur, "\n <feBlend in=\"SourceGraphic\" in2=\"blurOut\" mode=\"normal\" />\n </filter>\n </defs>\n <rect rx=\"4\" ry=\"4\" width=\"90%\" height=\"90%\" fill=\"").concat(tooltipColor, "\" filter=\"url(#").concat(id, ")\" />\n <svg width=\"100%\">\n <text x=\"8\" y=\"3\" font-size=\"13\" font-family=\"Verdana\" dy=\"0\" fill=\"").concat(tooltipTextColor, "\">").concat(valuesBlock, "</text>\n </svg>\n </svg>");
|
|
253
259
|
};
|
|
254
260
|
/** @ignore */
|
|
255
261
|
var calcTooltipWidth = function (textLength, fontSize) {
|