1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143 | 1×
1×
1×
1×
1×
117×
117×
117×
117×
117×
117×
117×
117×
117×
14×
32×
32×
26×
14×
14×
14×
103×
103×
117×
1062×
1062×
1×
1098×
1098×
1098×
1098×
1098×
1000×
133×
867×
1000×
1000×
1000×
1000×
1000×
1000×
1000×
1000×
36×
36×
1000×
1000×
1000×
1000×
1000×
54×
1000×
1000×
36×
1×
2×
2×
2×
2×
2×
2×
2×
2×
2×
1×
1×
1×
1×
1×
1×
1×
1×
1×
2×
36×
36×
36×
36×
1×
1×
41538×
1×
22×
22×
22×
22×
22×
205×
205×
6×
199×
199×
1×
1×
| define(["require", "exports", "../../common/utils/helper", "@syncfusion/ej2-svg-base", "../../common/utils/helper", "../../common/model/constants"], function (require, exports, helper_1, ej2_svg_base_1, helper_2, constants_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BubbleSeries = (function () {
function BubbleSeries() {
}
BubbleSeries.prototype.render = function (series, xAxis, yAxis, isInverted) {
var visiblePoints = series.points;
var radius;
var value = Math.max(series.chart.initialClipRect.height, series.chart.initialClipRect.width);
var percentChange = value / 100;
var maxRadius = series.maxRadius * percentChange;
var minRadius = series.minRadius * percentChange;
var maximumSize = null;
var maxValue = null;
if ((series.maxRadius === null || series.minRadius === null)) {
for (var _i = 0, _a = series.chart.visibleSeries; _i < _a.length; _i++) {
var value_1 = _a[_i];
if (value_1.type === 'Bubble' && value_1.visible === true && (value_1.maxRadius === null || value_1.minRadius === null)) {
maximumSize = value_1.sizeMax > maximumSize ? value_1.sizeMax : maximumSize;
}
}
maxValue = (value / 5) / 2;
minRadius = maxRadius = 1;
radius = maxValue * maxRadius;
}
else {
maximumSize = series.sizeMax;
radius = maxRadius - minRadius;
}
for (var _b = 0, visiblePoints_1 = visiblePoints; _b < visiblePoints_1.length; _b++) {
var bubblePoint = visiblePoints_1[_b];
this.renderPoint(series, bubblePoint, isInverted, radius, maximumSize, minRadius, visiblePoints);
}
};
BubbleSeries.prototype.renderPoint = function (series, bubblePoint, isInverted, radius, maximumSize, minRadius, visiblePoints, pointUpdate) {
var startLocation = series.chart.redraw && bubblePoint.symbolLocations ? bubblePoint.symbolLocations[0] : null;
bubblePoint.symbolLocations = [];
bubblePoint.regions = [];
var segmentRadius;
if (bubblePoint.visible &&
helper_1.withInRange(visiblePoints[bubblePoint.index - 1], bubblePoint, visiblePoints[bubblePoint.index + 1], series)) {
if ((series.maxRadius === null || series.minRadius === null)) {
segmentRadius = radius * Math.abs(+bubblePoint.size / maximumSize);
}
else {
segmentRadius = minRadius + radius * Math.abs(+bubblePoint.size / maximumSize);
}
segmentRadius = segmentRadius || minRadius;
var argsData = {
cancel: false, name: constants_1.pointRender, series: series, point: bubblePoint,
fill: series.setPointColor(bubblePoint, series.interior),
border: series.setBorderColor(bubblePoint, { width: series.border.width, color: series.border.color }),
height: 2 * segmentRadius, width: 2 * segmentRadius
};
series.chart.trigger(constants_1.pointRender, argsData);
Eif (!argsData.cancel) {
bubblePoint.symbolLocations.push(helper_1.getPoint(bubblePoint.xValue, bubblePoint.yValue, series.xAxis, series.yAxis, isInverted));
bubblePoint.color = argsData.fill;
var shapeOption = new ej2_svg_base_1.PathOption(series.chart.element.id + '_Series_' + series.index + '_Point_' + bubblePoint.index, argsData.fill, argsData.border.width, argsData.border.color, series.opacity, series.border.dashArray);
if (pointUpdate && helper_1.getElement(shapeOption.id)) {
var markerElement = helper_1.getElement(shapeOption.id);
startLocation = {
x: +markerElement.getAttribute('cx'), y: +markerElement.getAttribute('cy')
};
}
var element = helper_1.drawSymbol(bubblePoint.symbolLocations[0], 'Circle', new ej2_svg_base_1.Size(argsData.width, argsData.height), series.marker.imageUrl, shapeOption, bubblePoint.x.toString() + ':' + bubblePoint.yValue.toString(), series.chart.svgRenderer, series.clipRect);
helper_2.appendChildElement(series.chart.enableCanvas, series.seriesElement, element, series.chart.redraw, true, 'cx', 'cy', startLocation, null, false, false, null, series.chart.duration, true);
bubblePoint.regions.push(new ej2_svg_base_1.Rect(bubblePoint.symbolLocations[0].x - segmentRadius, bubblePoint.symbolLocations[0].y - segmentRadius, 2 * segmentRadius, 2 * segmentRadius));
bubblePoint.marker = {
border: argsData.border, fill: argsData.fill,
height: argsData.height, visible: true,
shape: 'Circle', width: argsData.width
};
if (series.chart.enableCanvas) {
series.chart.markerRender.render(series);
}
startLocation = series.chart.redraw && !startLocation ? bubblePoint.symbolLocations[0] : startLocation;
if (series.chart.redraw) {
helper_2.animateRedrawElement(element, series.chart.duration ? series.chart.duration : 300, startLocation, bubblePoint.symbolLocations[0], 'cx', 'cy');
}
}
else {
bubblePoint.marker = { visible: false };
}
}
};
BubbleSeries.prototype.updateDirection = function (series, point, isInverted) {
var visiblePoints = series.points;
var radius;
var value = Math.max(series.chart.initialClipRect.height, series.chart.initialClipRect.width);
var percentChange = value / 100;
var maxRadius = series.maxRadius * percentChange;
var minRadius = series.minRadius * percentChange;
var maximumSize = null;
var maxValue = null;
if ((series.maxRadius === null || series.minRadius === null)) {
for (var _i = 0, _a = series.chart.visibleSeries; _i < _a.length; _i++) {
var value_2 = _a[_i];
Eif (value_2.type === 'Bubble' && value_2.visible === true && (value_2.maxRadius === null || value_2.minRadius === null)) {
maximumSize = value_2.sizeMax > maximumSize ? value_2.sizeMax : maximumSize;
}
}
maxValue = (value / 5) / 2;
minRadius = maxRadius = 1;
radius = maxValue * maxRadius;
}
else {
maximumSize = series.sizeMax;
radius = maxRadius - minRadius;
}
for (var i = 0; i < point.length; i++) {
this.renderPoint(series, series.points[point[i]], isInverted, radius, maximumSize, minRadius, visiblePoints, true);
Eif (series.marker.dataLabel.visible && series.chart.dataLabelModule) {
series.chart.dataLabelModule.commonId = series.chart.element.id + '_Series_' + series.index + '_Point_';
series.chart.dataLabelModule.renderDataLabel(series, series.points[point[i]], null, series.marker.dataLabel);
}
}
};
BubbleSeries.prototype.destroy = function () {
};
BubbleSeries.prototype.getModuleName = function () {
return 'BubbleSeries';
};
BubbleSeries.prototype.doAnimation = function (series) {
var duration = series.animation.duration;
var delay = series.animation.delay;
var rectElements = series.seriesElement.childNodes;
var count = 1;
for (var _i = 0, _a = series.points; _i < _a.length; _i++) {
var bubblePoint = _a[_i];
if (!bubblePoint.symbolLocations.length) {
continue;
}
helper_2.markerAnimate(rectElements[count], delay, duration, series, bubblePoint.index, bubblePoint.symbolLocations[0], false);
count++;
}
};
return BubbleSeries;
}());
exports.BubbleSeries = BubbleSeries;
});
|