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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 265× 265× 265× 1× 1× 3× 1× 1× 17× 17× 17× 17× 17× 215× 215× 215× 17× 17× 1× 1× 42× 42× 42× 42× 42× 1× 1× 42× 42× 42× 42× 42× 42× 42× 42× 42× 1× 1× 5137× 5137× 267124× 5137× 1× 1× 265× 265× 265× 1× 1× 42× 42× 42× 42× 42× 42× 42× 42× 42× 42× 1× 1× 530× 528× 2× 1× 1× 1× 9296× 9296× 9296× 9296× 9296× 9296× 9296× 1× 1× 1× 1× 1× 3908× 3908× 3908× 3908× 3908× 3908× 1× 1× 1× 1× 1× 2615× 2615× 2615× 2615× 2615× 2615× 1× 1× 1× 23763× 23763× 203× 203× 23763× 23763× 23763× 23763× 23763× 23763× 23763× 23763× 23763× 23763× 23763× 23763× 1× 1× 1× 11949× 11949× 11949× 11949× 11949× 1× 1× 1× 669× 669× 1× 1× 3298× 1× 1× 28× 1× 1× 120× 120× 60× 60× 60× 60× 120× 1× 1× 11949× 11949× 11949× 11949× 11949× 11949× 1× | /* istanbul ignore next */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-svg-base", "@syncfusion/ej2-base", "../../smithchart/utils/utils"], function (require, exports, ej2_base_1, ej2_svg_base_1, ej2_base_2, utils_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function createSvg(smithchart) { smithchart.renderer = new ej2_svg_base_1.SvgRenderer(smithchart.element.id); calculateSize(smithchart); smithchart.svgObject = smithchart.renderer.createSvg({ id: smithchart.element.id + '_svg', width: smithchart.availableSize.width, height: smithchart.availableSize.height }); } exports.createSvg = createSvg; function getElement(id) { return document.getElementById(id); } exports.getElement = getElement; function textTrim(maximumWidth, text, font, themeFontStyle) { var label = text; var size = measureText(text, font, themeFontStyle).width; Eif (size > maximumWidth) { var textLength = text.length; for (var i = textLength - 1; i >= 0; --i) { label = text.substring(0, i) + '...'; size = measureText(label, font, themeFontStyle).width; if (size <= maximumWidth || label.length < 4) { Iif (label.length < 4) { label = ' '; } return label; } } } return label; } exports.textTrim = textTrim; function getTemplateFunction(templateString) { var templateFn = null; try { if (typeof templateString !== 'function' && document.querySelectorAll(templateString).length) { templateFn = ej2_base_1.compile(document.querySelector(templateString).innerHTML.trim()); } else { templateFn = ej2_base_1.compile(templateString); } } catch (e) { templateFn = ej2_base_1.compile(templateString); } return templateFn; } exports.getTemplateFunction = getTemplateFunction; function convertElementFromLabel(element, labelId, data) { var labelEle = element[0]; var templateHtml = labelEle.outerHTML; var properties = Object.keys(data); var regExp = RegExp; for (var i = 0; i < properties.length; i++) { templateHtml = templateHtml.replace(new regExp('{{:' + properties[i] + '}}', 'g'), data[properties[i].toString()]); } var templateElement = ej2_base_1.createElement('div', { id: labelId, styles: 'position: absolute' }); templateElement.innerText = templateHtml; return templateElement; } exports.convertElementFromLabel = convertElementFromLabel; function _getEpsilonValue() { var e = 1.0; while ((1.0 + 0.5 * e) !== 1.0) { e *= 0.5; } return e; } exports._getEpsilonValue = _getEpsilonValue; function calculateSize(smithchart) { var containerWidth = smithchart.element.clientWidth; var containerHeight = smithchart.element.clientHeight; smithchart.availableSize = new utils_1.SmithchartSize(stringToNumber(smithchart.width, containerWidth) || containerWidth || 600, stringToNumber(smithchart.height, containerHeight) || containerHeight || 450); } exports.calculateSize = calculateSize; function templateAnimate(smithchart, element, delay, duration, name) { var opacity = 0; var delta; var value; new ej2_base_2.Animation({}).animate(element, { duration: duration, delay: delay, name: name, progress: function (args) { delta = ((args.timeStamp - args.delay) / args.duration); value = opacity + (delta * 1); args.element.style.opacity = value.toString(); }, end: function (args) { var opacity = 1; args.element.style.opacity = opacity.toString(); smithchart.trigger('animationComplete', event); } }); } exports.templateAnimate = templateAnimate; function stringToNumber(value, containerSize) { if (value !== null && value !== undefined) { return value.indexOf('%') !== -1 ? (containerSize / 100) * parseInt(value, 10) : parseInt(value, 10); } return null; } exports.stringToNumber = stringToNumber; var PathOption = (function () { function PathOption(id, fill, width, color, opacity, dashArray, d) { this.id = id; this.opacity = opacity; this.fill = fill; this.stroke = color; this['stroke-width'] = width; this['stroke-dasharray'] = dashArray; this.d = d; } return PathOption; }()); exports.PathOption = PathOption; var RectOption = (function (_super) { __extends(RectOption, _super); function RectOption(id, fill, border, opacity, rect) { var _this = _super.call(this, id, fill, border.width, border.color, opacity) || this; _this.y = rect.y; _this.x = rect.x; _this.height = rect.height; _this.width = rect.width; return _this; } return RectOption; }(PathOption)); exports.RectOption = RectOption; var CircleOption = (function (_super) { __extends(CircleOption, _super); function CircleOption(id, fill, border, opacity, cx, cy, r, dashArray) { var _this = _super.call(this, id, fill, border.width, border.color, opacity) || this; _this.cy = cy; _this.cx = cx; _this.r = r; _this['stroke-dasharray'] = dashArray; return _this; } return CircleOption; }(PathOption)); exports.CircleOption = CircleOption; function measureText(text, font, themeFontStyle) { var htmlObject = document.getElementById('smithchartmeasuretext'); if (htmlObject === null) { htmlObject = ej2_base_1.createElement('text', { id: 'smithchartmeasuretext' }); document.body.appendChild(htmlObject); } htmlObject.innerText = text; htmlObject.style.position = 'absolute'; htmlObject.style.visibility = 'hidden'; htmlObject.style.left = '0'; htmlObject.style.top = '-100'; htmlObject.style.whiteSpace = 'nowrap'; htmlObject.style.fontSize = font.size || themeFontStyle.size; htmlObject.style.fontWeight = font.fontWeight || themeFontStyle.fontWeight; htmlObject.style.fontStyle = font.fontStyle || themeFontStyle.fontStyle; htmlObject.style.fontFamily = font.fontFamily || themeFontStyle.fontFamily; htmlObject.style.lineHeight = 'normal'; return new utils_1.SmithchartSize(htmlObject.clientWidth, htmlObject.clientHeight); } exports.measureText = measureText; var TextOption = (function () { function TextOption(id, x, y, anchor, text) { this.id = id; this.x = x; this.y = y; this.anchor = anchor; this.text = text; } return TextOption; }()); exports.TextOption = TextOption; function removeElement(id) { var element = document.getElementById(id); return element ? ej2_base_1.remove(element) : null; } exports.removeElement = removeElement; function linear(currentTime, startValue, endValue, duration) { return -endValue * Math.cos(currentTime / duration * (Math.PI / 2)) + endValue + startValue; } exports.linear = linear; function reverselinear(currentTime, startValue, endValue, duration) { return -startValue * Math.sin(currentTime / duration * (Math.PI / 2)) + endValue + startValue; } exports.reverselinear = reverselinear; function getAnimationFunction(effect) { var functionName; switch (effect) { case 'Linear': functionName = linear; break; case 'Reverse': functionName = reverselinear; break; } return functionName; } exports.getAnimationFunction = getAnimationFunction; function renderTextElement(options, font, color, parent, themeFontStyle) { var renderOptions = { 'id': options.id, 'x': options.x, 'y': options.y, 'fill': color, 'font-size': font.size || themeFontStyle.size, 'font-style': font.fontStyle || themeFontStyle.fontStyle, 'font-family': font.fontFamily || themeFontStyle.fontFamily, 'font-weight': font.fontWeight || themeFontStyle.fontWeight, 'text-anchor': options.anchor, 'opacity': font.opacity }; var text = options.text; var renderer = new ej2_svg_base_1.SvgRenderer(''); var htmlObject = renderer.createText(renderOptions, text); parent.appendChild(htmlObject); return htmlObject; } exports.renderTextElement = renderTextElement; }); |