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 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 13× 1× 20× 20× 20× 20× 20× 20× 20× 20× 1× 37× 37× 37× 37× 37× 37× 37× 37× 1× 57× 57× 57× 123× 123× 123× 57× 1× 60× 60× 57× 20× 37× 57× 3× 57× 1× 386× 1× 12× 1× 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 __()); }; })(); /* istanbul ignore next */ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; define(["require", "exports", "@syncfusion/ej2-svg-base", "@syncfusion/ej2-base"], function (require, exports, ej2_svg_base_1, ej2_base_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ColorStop = (function (_super) { __extends(ColorStop, _super); function ColorStop() { return _super !== null && _super.apply(this, arguments) || this; } __decorate([ ej2_base_1.Property('#000000') ], ColorStop.prototype, "color", void 0); __decorate([ ej2_base_1.Property(1) ], ColorStop.prototype, "opacity", void 0); __decorate([ ej2_base_1.Property('0%') ], ColorStop.prototype, "offset", void 0); __decorate([ ej2_base_1.Property('') ], ColorStop.prototype, "style", void 0); return ColorStop; }(ej2_base_1.ChildProperty)); exports.ColorStop = ColorStop; var GradientPosition = (function (_super) { __extends(GradientPosition, _super); function GradientPosition() { return _super !== null && _super.apply(this, arguments) || this; } __decorate([ ej2_base_1.Property('0%') ], GradientPosition.prototype, "x", void 0); __decorate([ ej2_base_1.Property('0%') ], GradientPosition.prototype, "y", void 0); return GradientPosition; }(ej2_base_1.ChildProperty)); exports.GradientPosition = GradientPosition; var LinearGradient = (function (_super) { __extends(LinearGradient, _super); function LinearGradient() { return _super !== null && _super.apply(this, arguments) || this; } __decorate([ ej2_base_1.Property('0%') ], LinearGradient.prototype, "startValue", void 0); __decorate([ ej2_base_1.Property('100%') ], LinearGradient.prototype, "endValue", void 0); __decorate([ ej2_base_1.Collection([{ color: '#000000', opacity: 1, offset: '0%', style: '' }], ColorStop) ], LinearGradient.prototype, "colorStop", void 0); return LinearGradient; }(ej2_base_1.ChildProperty)); exports.LinearGradient = LinearGradient; var RadialGradient = (function (_super) { __extends(RadialGradient, _super); function RadialGradient() { return _super !== null && _super.apply(this, arguments) || this; } __decorate([ ej2_base_1.Property('0%') ], RadialGradient.prototype, "radius", void 0); __decorate([ ej2_base_1.Complex({ x: '0%', y: '0%' }, GradientPosition) ], RadialGradient.prototype, "outerPosition", void 0); __decorate([ ej2_base_1.Complex({ x: '0%', y: '0%' }, GradientPosition) ], RadialGradient.prototype, "innerPosition", void 0); __decorate([ ej2_base_1.Collection([{ color: '#000000', opacity: 1, offset: '0%', style: '' }], ColorStop) ], RadialGradient.prototype, "colorStop", void 0); return RadialGradient; }(ej2_base_1.ChildProperty)); exports.RadialGradient = RadialGradient; var Gradient = (function () { function Gradient(control) { this.gauge = control; } Gradient.prototype.getLinearGradientColor = function (element) { var render = new ej2_svg_base_1.SvgRenderer(''); var colorStop = element.linearGradient.colorStop; var colors = this.getGradientColor(colorStop); var name = '_' + this.gauge.svgObject.id + '_' + this.gauge.gradientCount + '_' + 'linearGradient'; var gradientPosition = { id: name, x1: (element.linearGradient.startValue.indexOf('%') === -1 ? element.linearGradient.startValue : parseFloat(element.linearGradient.startValue).toString()) + '%', x2: (element.linearGradient.endValue.indexOf('%') === -1 ? element.linearGradient.endValue : parseFloat(element.linearGradient.endValue).toString()) + '%', y1: '0' + '%', y2: '0' + '%' }; var def = render.drawGradient('linearGradient', gradientPosition, colors); this.gauge.svgObject.appendChild(def); return 'url(#' + name + ')'; }; Gradient.prototype.getRadialGradientColor = function (element) { var render = new ej2_svg_base_1.SvgRenderer(''); var colorStop = element.radialGradient.colorStop; var colors = this.getGradientColor(colorStop); var name = '_' + this.gauge.svgObject.id + '_' + this.gauge.gradientCount + '_' + 'radialGradient'; var gradientPosition = { id: name, r: !ej2_base_1.isNullOrUndefined(element.radialGradient.radius) ? (element.radialGradient.radius.indexOf('%') === -1 ? element.radialGradient.radius : parseFloat(element.radialGradient.radius).toString()) + '%' : '0%', cx: element.radialGradient.outerPosition == null ? '0%' : (element.radialGradient.outerPosition.x.indexOf('%') === -1 ? element.radialGradient.outerPosition.x : parseFloat(element.radialGradient.outerPosition.x).toString()) + '%', cy: element.radialGradient.outerPosition == null ? '0%' : (element.radialGradient.outerPosition.y.indexOf('%') === -1 ? element.radialGradient.outerPosition.y : parseFloat(element.radialGradient.outerPosition.y).toString()) + '%', fx: element.radialGradient.innerPosition == null ? '0%' : (element.radialGradient.innerPosition.x.indexOf('%') === -1 ? element.radialGradient.innerPosition.y : parseFloat(element.radialGradient.innerPosition.x).toString()) + '%', fy: element.radialGradient.innerPosition == null ? '0%' : (element.radialGradient.innerPosition.y.indexOf('%') === -1 ? element.radialGradient.innerPosition.y : parseFloat(element.radialGradient.innerPosition.y).toString()) + '%' }; var def = render.drawGradient('radialGradient', gradientPosition, colors); this.gauge.svgObject.appendChild(def); return 'url(#' + name + ')'; }; Gradient.prototype.getGradientColor = function (colorStop) { var colors = []; var length = !ej2_base_1.isNullOrUndefined(colorStop) ? colorStop.length : 0; for (var j = 0; j < length; j++) { var gradientColorStop = colorStop[j]; var color = { color: gradientColorStop.color, colorStop: gradientColorStop.offset, opacity: gradientColorStop.opacity ? (gradientColorStop.opacity).toString() : '1', style: gradientColorStop.style }; colors.push(color); } return colors; }; Gradient.prototype.getGradientColorString = function (element) { var gradientColor; if ((element.linearGradient || element.radialGradient)) { if (element.linearGradient) { gradientColor = this.getLinearGradientColor(element); } else { gradientColor = this.getRadialGradientColor(element); } this.gauge.gradientCount += 1; } else { return null; } return gradientColor; }; Gradient.prototype.getModuleName = function () { return 'Gradient'; }; Gradient.prototype.destroy = function () { this.gauge = null; }; return Gradient; }()); exports.Gradient = Gradient; }); |