1 | !function(modules) {
|
2 | function __webpack_require__(moduleId) {
|
3 | if (installedModules[moduleId]) return installedModules[moduleId].exports;
|
4 | var module = installedModules[moduleId] = {
|
5 | exports: {},
|
6 | id: moduleId,
|
7 | loaded: !1
|
8 | };
|
9 | return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__),
|
10 | module.loaded = !0, module.exports;
|
11 | }
|
12 | var installedModules = {};
|
13 | return __webpack_require__.m = modules, __webpack_require__.c = installedModules,
|
14 | __webpack_require__.p = "", __webpack_require__(0);
|
15 | }([ function(module, exports, __webpack_require__) {
|
16 | __webpack_require__(303), __webpack_require__(263), __webpack_require__(352), __webpack_require__(438),
|
17 | module.exports = __webpack_require__(90);
|
18 | }, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , function(module, exports, __webpack_require__) {
|
19 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
20 | window.jasmine, window.Microsoft;
|
21 | window.jsCommon = window.jsCommon || {}, window.powerbi = window.powerbi || {},
|
22 | window.debug = window.debug || {}, window.InJs = window.InJs || {}, window.Microsoft = window.Microsoft || {},
|
23 | __webpack_require__(91), __webpack_require__(92), __webpack_require__(93), __webpack_require__(94);
|
24 | }, function(module, exports) {}, function(module, exports) {}, function(module, exports, __webpack_require__) {
|
25 | module.exports = __webpack_require__.p + "images/locationButton.svg";
|
26 | }, function(module, exports, __webpack_require__) {
|
27 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
28 | window.jasmine, window.Microsoft;
|
29 | __webpack_require__(95), __webpack_require__(96), __webpack_require__(97), __webpack_require__(98),
|
30 | __webpack_require__(99), __webpack_require__(100), __webpack_require__(101), __webpack_require__(102),
|
31 | __webpack_require__(103), __webpack_require__(104), __webpack_require__(105), __webpack_require__(106),
|
32 | __webpack_require__(107), __webpack_require__(108), __webpack_require__(109), __webpack_require__(110),
|
33 | __webpack_require__(111), __webpack_require__(112), __webpack_require__(113), __webpack_require__(114),
|
34 | __webpack_require__(115), __webpack_require__(116), __webpack_require__(117), __webpack_require__(118),
|
35 | __webpack_require__(119), __webpack_require__(120), __webpack_require__(121), __webpack_require__(122),
|
36 | __webpack_require__(123), __webpack_require__(124), __webpack_require__(125), __webpack_require__(126),
|
37 | __webpack_require__(127), __webpack_require__(128), __webpack_require__(129), __webpack_require__(130),
|
38 | __webpack_require__(131), __webpack_require__(132), __webpack_require__(133), __webpack_require__(134),
|
39 | __webpack_require__(135), __webpack_require__(136), __webpack_require__(137), __webpack_require__(138),
|
40 | __webpack_require__(139), __webpack_require__(140), __webpack_require__(141), __webpack_require__(142),
|
41 | __webpack_require__(143), __webpack_require__(144), __webpack_require__(145), __webpack_require__(146),
|
42 | __webpack_require__(147), __webpack_require__(148), __webpack_require__(149), __webpack_require__(150),
|
43 | __webpack_require__(151), __webpack_require__(152), __webpack_require__(153), __webpack_require__(154),
|
44 | __webpack_require__(155), __webpack_require__(156), __webpack_require__(157), __webpack_require__(158),
|
45 | __webpack_require__(159), __webpack_require__(160), __webpack_require__(161), __webpack_require__(162),
|
46 | __webpack_require__(163), __webpack_require__(164), __webpack_require__(165), __webpack_require__(166),
|
47 | __webpack_require__(167), __webpack_require__(168), __webpack_require__(169), __webpack_require__(170),
|
48 | __webpack_require__(171), __webpack_require__(172), __webpack_require__(173), __webpack_require__(174),
|
49 | __webpack_require__(175), __webpack_require__(176), __webpack_require__(177), __webpack_require__(178),
|
50 | __webpack_require__(179), __webpack_require__(180), __webpack_require__(181), __webpack_require__(182),
|
51 | __webpack_require__(183), __webpack_require__(184), __webpack_require__(185), __webpack_require__(186),
|
52 | __webpack_require__(187), __webpack_require__(188), __webpack_require__(189), __webpack_require__(190),
|
53 | __webpack_require__(191), __webpack_require__(192), __webpack_require__(193), __webpack_require__(194),
|
54 | __webpack_require__(195), __webpack_require__(196), __webpack_require__(197), __webpack_require__(198),
|
55 | __webpack_require__(199), __webpack_require__(200), __webpack_require__(201), __webpack_require__(202),
|
56 | __webpack_require__(203), __webpack_require__(204), __webpack_require__(205), __webpack_require__(206),
|
57 | __webpack_require__(207), __webpack_require__(208), __webpack_require__(209), __webpack_require__(210),
|
58 | __webpack_require__(211), __webpack_require__(212), __webpack_require__(213), __webpack_require__(214),
|
59 | __webpack_require__(215), __webpack_require__(216), __webpack_require__(217), __webpack_require__(218),
|
60 | __webpack_require__(219), __webpack_require__(220), __webpack_require__(221), __webpack_require__(222),
|
61 | __webpack_require__(223), __webpack_require__(224), __webpack_require__(225), __webpack_require__(226),
|
62 | __webpack_require__(227), __webpack_require__(228), __webpack_require__(229), __webpack_require__(230),
|
63 | __webpack_require__(231), __webpack_require__(232), __webpack_require__(233), __webpack_require__(234),
|
64 | __webpack_require__(235), __webpack_require__(236), __webpack_require__(237), __webpack_require__(238),
|
65 | __webpack_require__(239), __webpack_require__(240), __webpack_require__(241), __webpack_require__(242),
|
66 | __webpack_require__(243), __webpack_require__(244), __webpack_require__(245), __webpack_require__(246),
|
67 | __webpack_require__(247), __webpack_require__(248), __webpack_require__(249), __webpack_require__(250),
|
68 | __webpack_require__(251), __webpack_require__(252), __webpack_require__(253), __webpack_require__(254),
|
69 | __webpack_require__(255), __webpack_require__(256), __webpack_require__(257), __webpack_require__(258),
|
70 | __webpack_require__(259), __webpack_require__(260), __webpack_require__(261), __webpack_require__(262);
|
71 | }, function(module, exports) {
|
72 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
73 | window.jasmine, window.Microsoft;
|
74 | }, function(module, exports) {
|
75 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
76 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
77 | !function(powerbi) {
|
78 | var visuals;
|
79 | !function(visuals) {
|
80 | var Point = function() {
|
81 | function Point(x, y) {
|
82 | this.x = x || 0, this.y = y || 0;
|
83 | }
|
84 | return Point;
|
85 | }();
|
86 | visuals.Point = Point;
|
87 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
88 | }(powerbi || (powerbi = {}));
|
89 | }, function(module, exports) {
|
90 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
91 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
92 | !function(powerbi) {
|
93 | var visuals;
|
94 | !function(visuals) {
|
95 | var Rect = function() {
|
96 | function Rect(left, top, width, height) {
|
97 | this.left = left || 0, this.top = top || 0, this.width = width || 0, this.height = height || 0;
|
98 | }
|
99 | return Rect;
|
100 | }();
|
101 | visuals.Rect = Rect;
|
102 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
103 | }(powerbi || (powerbi = {}));
|
104 | }, function(module, exports) {
|
105 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
106 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
107 | !function(powerbi) {
|
108 | var visuals;
|
109 | !function(visuals) {
|
110 | var Font;
|
111 | !function(Font) {
|
112 | var FamilyInfo = function() {
|
113 | function FamilyInfo(families) {
|
114 | this.families = families;
|
115 | }
|
116 | return Object.defineProperty(FamilyInfo.prototype, "family", {
|
117 | get: function() {
|
118 | return this.getFamily();
|
119 | },
|
120 | enumerable: !0,
|
121 | configurable: !0
|
122 | }), FamilyInfo.prototype.getFamily = function(regex) {
|
123 | return void 0 === regex && (regex = /^wf_/), this.families ? regex ? _.find(this.families, function(fontFamily) {
|
124 | return regex.test(fontFamily);
|
125 | }) : this.families[0] : null;
|
126 | }, Object.defineProperty(FamilyInfo.prototype, "css", {
|
127 | get: function() {
|
128 | return this.getCSS();
|
129 | },
|
130 | enumerable: !0,
|
131 | configurable: !0
|
132 | }), FamilyInfo.prototype.getCSS = function() {
|
133 | return this.families ? this.families.map(function(font) {
|
134 | return font.indexOf(" ") > 0 ? "'" + font + "'" : font;
|
135 | }).join(", ") : null;
|
136 | }, FamilyInfo;
|
137 | }();
|
138 | Font.FamilyInfo = FamilyInfo, Font.Family = {
|
139 | light: new FamilyInfo([ "Segoe UI Light", "wf_segoe-ui_light", "helvetica", "arial", "sans-serif" ]),
|
140 | semilight: new FamilyInfo([ "Segoe UI Semilight", "wf_segoe-ui_semilight", "helvetica", "arial", "sans-serif" ]),
|
141 | regular: new FamilyInfo([ "Segoe UI", "wf_segoe-ui_normal", "helvetica", "arial", "sans-serif" ]),
|
142 | semibold: new FamilyInfo([ "Segoe UI Semibold", "wf_segoe-ui_semibold", "helvetica", "arial", "sans-serif" ]),
|
143 | bold: new FamilyInfo([ "Segoe UI Bold", "wf_segoe-ui_bold", "helvetica", "arial", "sans-serif" ]),
|
144 | lightSecondary: new FamilyInfo([ "wf_standard-font_light", "helvetica", "arial", "sans-serif" ]),
|
145 | regularSecondary: new FamilyInfo([ "wf_standard-font", "helvetica", "arial", "sans-serif" ]),
|
146 | boldSecondary: new FamilyInfo([ "wf_standard-font_bold", "helvetica", "arial", "sans-serif" ])
|
147 | };
|
148 | }(Font = visuals.Font || (visuals.Font = {}));
|
149 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
150 | }(powerbi || (powerbi = {}));
|
151 | }, function(module, exports) {
|
152 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
153 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
154 | !function(powerbi) {
|
155 | var visuals;
|
156 | !function(visuals) {
|
157 | function createLegend(legendParentElement, interactive, interactivityService, isScrollable, legendPosition) {
|
158 | return void 0 === isScrollable && (isScrollable = !1), void 0 === legendPosition && (legendPosition = LegendPosition.Top),
|
159 | interactive ? new CartesianChartInteractiveLegend(legendParentElement) : new SVGLegend(legendParentElement, legendPosition, interactivityService, isScrollable);
|
160 | }
|
161 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter;
|
162 | !function(LegendIcon) {
|
163 | LegendIcon[LegendIcon.Box = 0] = "Box", LegendIcon[LegendIcon.Circle = 1] = "Circle",
|
164 | LegendIcon[LegendIcon.Line = 2] = "Line";
|
165 | }(visuals.LegendIcon || (visuals.LegendIcon = {}));
|
166 | visuals.LegendIcon;
|
167 | !function(LegendPosition) {
|
168 | LegendPosition[LegendPosition.Top = 0] = "Top", LegendPosition[LegendPosition.Bottom = 1] = "Bottom",
|
169 | LegendPosition[LegendPosition.Right = 2] = "Right", LegendPosition[LegendPosition.Left = 3] = "Left",
|
170 | LegendPosition[LegendPosition.None = 4] = "None", LegendPosition[LegendPosition.TopCenter = 5] = "TopCenter",
|
171 | LegendPosition[LegendPosition.BottomCenter = 6] = "BottomCenter", LegendPosition[LegendPosition.RightCenter = 7] = "RightCenter",
|
172 | LegendPosition[LegendPosition.LeftCenter = 8] = "LeftCenter";
|
173 | }(visuals.LegendPosition || (visuals.LegendPosition = {}));
|
174 | var LegendPosition = visuals.LegendPosition;
|
175 | visuals.legendProps = {
|
176 | show: "show",
|
177 | position: "position",
|
178 | titleText: "titleText",
|
179 | showTitle: "showTitle",
|
180 | labelColor: "labelColor",
|
181 | fontSize: "fontSize"
|
182 | }, visuals.createLegend = createLegend;
|
183 | var Legend;
|
184 | !function(Legend) {
|
185 | function isLeft(orientation) {
|
186 | switch (orientation) {
|
187 | case LegendPosition.Left:
|
188 | case LegendPosition.LeftCenter:
|
189 | return !0;
|
190 |
|
191 | default:
|
192 | return !1;
|
193 | }
|
194 | }
|
195 | function isTop(orientation) {
|
196 | switch (orientation) {
|
197 | case LegendPosition.Top:
|
198 | case LegendPosition.TopCenter:
|
199 | return !0;
|
200 |
|
201 | default:
|
202 | return !1;
|
203 | }
|
204 | }
|
205 | function positionChartArea(chartArea, legend) {
|
206 | var legendMargins = legend.getMargins(), legendOrientation = legend.getOrientation();
|
207 | chartArea.style({
|
208 | "margin-left": Legend.isLeft(legendOrientation) ? legendMargins.width + "px" : null,
|
209 | "margin-top": Legend.isTop(legendOrientation) ? legendMargins.height + "px" : null
|
210 | });
|
211 | }
|
212 | Legend.isLeft = isLeft, Legend.isTop = isTop, Legend.positionChartArea = positionChartArea;
|
213 | }(Legend = visuals.Legend || (visuals.Legend = {}));
|
214 | var SVGLegend = function() {
|
215 | function SVGLegend(element, legendPosition, interactivityService, isScrollable) {
|
216 | this.legendDataStartIndex = 0, this.arrowPosWindow = 1, this.lastCalculatedWidth = 0,
|
217 | this.visibleLegendWidth = 0, this.visibleLegendHeight = 0, this.legendFontSizeMarginDifference = 0,
|
218 | this.legendFontSizeMarginValue = 0, this.svg = d3.select(element.get(0)).append("svg").style("position", "absolute"),
|
219 | this.svg.style("display", "inherit"), this.svg.classed("legend", !0), interactivityService && (this.clearCatcher = visuals.appendClearCatcher(this.svg)),
|
220 | this.group = this.svg.append("g").attr("id", "legendGroup"), this.interactivityService = interactivityService,
|
221 | this.isScrollable = isScrollable, this.element = element, this.changeOrientation(legendPosition),
|
222 | this.parentViewport = {
|
223 | height: 0,
|
224 | width: 0
|
225 | }, this.calculateViewport(), this.updateLayout();
|
226 | }
|
227 | return SVGLegend.prototype.updateLayout = function() {
|
228 | var legendViewport = this.viewport, orientation = this.orientation;
|
229 | this.svg.attr({
|
230 | height: legendViewport.height || (orientation === LegendPosition.None ? 0 : this.parentViewport.height),
|
231 | width: legendViewport.width || (orientation === LegendPosition.None ? 0 : this.parentViewport.width)
|
232 | });
|
233 | var isRight = orientation === LegendPosition.Right || orientation === LegendPosition.RightCenter, isBottom = orientation === LegendPosition.Bottom || orientation === LegendPosition.BottomCenter;
|
234 | this.svg.style({
|
235 | "margin-left": isRight ? this.parentViewport.width - legendViewport.width + "px" : null,
|
236 | "margin-top": isBottom ? this.parentViewport.height - legendViewport.height + "px" : null
|
237 | });
|
238 | }, SVGLegend.prototype.calculateViewport = function() {
|
239 | switch (this.orientation) {
|
240 | case LegendPosition.Top:
|
241 | case LegendPosition.Bottom:
|
242 | case LegendPosition.TopCenter:
|
243 | case LegendPosition.BottomCenter:
|
244 | var pixelHeight = PixelConverter.fromPointToPixel(this.data && this.data.fontSize ? this.data.fontSize : SVGLegend.DefaultFontSizeInPt), fontHeightSize = SVGLegend.TopLegendHeight + (pixelHeight - SVGLegend.DefaultFontSizeInPt);
|
245 | return void (this.viewport = {
|
246 | height: fontHeightSize,
|
247 | width: 0
|
248 | });
|
249 |
|
250 | case LegendPosition.Right:
|
251 | case LegendPosition.Left:
|
252 | case LegendPosition.RightCenter:
|
253 | case LegendPosition.LeftCenter:
|
254 | var width = this.lastCalculatedWidth ? this.lastCalculatedWidth : this.parentViewport.width * SVGLegend.LegendMaxWidthFactor;
|
255 | return void (this.viewport = {
|
256 | height: 0,
|
257 | width: width
|
258 | });
|
259 |
|
260 | case LegendPosition.None:
|
261 | this.viewport = {
|
262 | height: 0,
|
263 | width: 0
|
264 | };
|
265 | }
|
266 | }, SVGLegend.prototype.getMargins = function() {
|
267 | return this.viewport;
|
268 | }, SVGLegend.prototype.isVisible = function() {
|
269 | return this.orientation !== LegendPosition.None;
|
270 | }, SVGLegend.prototype.changeOrientation = function(orientation) {
|
271 | orientation ? this.orientation = orientation : this.orientation = LegendPosition.Top,
|
272 | this.svg.attr("orientation", orientation);
|
273 | }, SVGLegend.prototype.getOrientation = function() {
|
274 | return this.orientation;
|
275 | }, SVGLegend.prototype.drawLegend = function(data, viewport) {
|
276 | for (var clonedData = powerbi.Prototype.inherit(data), newDataPoints = [], _i = 0, _a = data.dataPoints; _i < _a.length; _i++) {
|
277 | var dp = _a[_i];
|
278 | newDataPoints.push(powerbi.Prototype.inherit(dp));
|
279 | }
|
280 | clonedData.dataPoints = newDataPoints, this.setTooltipToLegendItems(clonedData),
|
281 | this.drawLegendInternal(clonedData, viewport, !0);
|
282 | }, SVGLegend.prototype.drawLegendInternal = function(data, viewport, autoWidth) {
|
283 | this.parentViewport = viewport, this.data = data, this.interactivityService && this.interactivityService.applySelectionStateToData(data.dataPoints),
|
284 | 0 === data.dataPoints.length && this.changeOrientation(LegendPosition.None), this.getOrientation() === LegendPosition.None && (data.dataPoints = []);
|
285 | var mapControl = this.element.children(".mapControl");
|
286 | mapControl.length > 0 && !this.isTopOrBottom(this.orientation) && mapControl.css("display", "inline-block"),
|
287 | this.calculateViewport();
|
288 | var layout = this.calculateLayout(data, autoWidth), titleLayout = layout.title, titleData = titleLayout ? [ titleLayout ] : [], hasSelection = this.interactivityService && powerbi.visuals.dataHasSelection(data.dataPoints), group = this.group;
|
289 | if (this.isCentered(this.orientation)) {
|
290 | var centerOffset = 0;
|
291 | this.isTopOrBottom(this.orientation) ? (centerOffset = Math.max(0, (this.parentViewport.width - this.visibleLegendWidth) / 2),
|
292 | group.attr("transform", visuals.SVGUtil.translate(centerOffset, 0))) : (centerOffset = Math.max((this.parentViewport.height - this.visibleLegendHeight) / 2),
|
293 | group.attr("transform", visuals.SVGUtil.translate(0, centerOffset)));
|
294 | } else group.attr("transform", null);
|
295 | var legendTitle = group.selectAll(SVGLegend.LegendTitle.selector).data(titleData);
|
296 | legendTitle.enter().append("text").classed(SVGLegend.LegendTitle["class"], !0),
|
297 | legendTitle.style({
|
298 | fill: data.labelColor,
|
299 | "font-size": PixelConverter.fromPoint(data.fontSize),
|
300 | "font-family": SVGLegend.DefaultTitleFontFamily
|
301 | }).text(function(d) {
|
302 | return d.text;
|
303 | }).attr({
|
304 | x: function(d) {
|
305 | return d.x;
|
306 | },
|
307 | y: function(d) {
|
308 | return d.y;
|
309 | }
|
310 | }).append("title").text(data.title), legendTitle.exit().remove();
|
311 | var virtualizedDataPoints = data.dataPoints.slice(this.legendDataStartIndex, this.legendDataStartIndex + layout.numberOfItems), iconRadius = powerbi.TextMeasurementService.estimateSvgTextHeight(SVGLegend.getTextProperties(!1, "", this.data.fontSize)) / SVGLegend.LegendIconRadiusFactor;
|
312 | iconRadius = this.legendFontSizeMarginValue > SVGLegend.DefaultTextMargin && iconRadius > SVGLegend.LegendIconRadius ? iconRadius : SVGLegend.LegendIconRadius;
|
313 | var legendItems = group.selectAll(SVGLegend.LegendItem.selector).data(virtualizedDataPoints, function(d) {
|
314 | return d.identity.getKey() + (null != d.layerNumber ? d.layerNumber : "");
|
315 | }), itemsEnter = legendItems.enter().append("g").classed(SVGLegend.LegendItem["class"], !0);
|
316 | if (itemsEnter.append("circle").classed(SVGLegend.LegendIcon["class"], !0), itemsEnter.append("text").classed(SVGLegend.LegendText["class"], !0),
|
317 | itemsEnter.append("title").text(function(d) {
|
318 | return d.tooltip;
|
319 | }), legendItems.select(SVGLegend.LegendIcon.selector).attr({
|
320 | cx: function(d, i) {
|
321 | return d.glyphPosition.x;
|
322 | },
|
323 | cy: function(d) {
|
324 | return d.glyphPosition.y;
|
325 | },
|
326 | r: iconRadius
|
327 | }).style({
|
328 | fill: function(d) {
|
329 | return hasSelection && !d.selected ? visuals.LegendBehavior.dimmedLegendColor : d.color;
|
330 | }
|
331 | }), legendItems.select("title").text(function(d) {
|
332 | return d.tooltip;
|
333 | }), legendItems.select(SVGLegend.LegendText.selector).attr({
|
334 | x: function(d) {
|
335 | return d.textPosition.x;
|
336 | },
|
337 | y: function(d) {
|
338 | return d.textPosition.y;
|
339 | }
|
340 | }).text(function(d) {
|
341 | return d.label;
|
342 | }).style({
|
343 | fill: data.labelColor,
|
344 | "font-size": PixelConverter.fromPoint(data.fontSize)
|
345 | }), this.interactivityService) {
|
346 | var iconsSelection = legendItems.select(SVGLegend.LegendIcon.selector), behaviorOptions = {
|
347 | legendItems: legendItems,
|
348 | legendIcons: iconsSelection,
|
349 | clearCatcher: this.clearCatcher
|
350 | };
|
351 | this.interactivityService.bind(data.dataPoints, new visuals.LegendBehavior(), behaviorOptions, {
|
352 | isLegend: !0
|
353 | });
|
354 | }
|
355 | legendItems.exit().remove(), this.drawNavigationArrows(layout.navigationArrows),
|
356 | this.updateLayout();
|
357 | }, SVGLegend.prototype.normalizePosition = function(points) {
|
358 | this.legendDataStartIndex >= points.length && (this.legendDataStartIndex = points.length - 1),
|
359 | this.legendDataStartIndex < 0 && (this.legendDataStartIndex = 0);
|
360 | }, SVGLegend.prototype.calculateTitleLayout = function(title) {
|
361 | var width = 0, hasTitle = !_.isEmpty(title);
|
362 | if (hasTitle) {
|
363 | var isHorizontal = this.isTopOrBottom(this.orientation), maxMeasureLength = void 0;
|
364 | if (isHorizontal) {
|
365 | var fontSizeMargin = this.legendFontSizeMarginValue > SVGLegend.DefaultTextMargin ? SVGLegend.TextAndIconPadding + this.legendFontSizeMarginDifference : SVGLegend.TextAndIconPadding, fixedHorizontalIconShift = SVGLegend.TextAndIconPadding + SVGLegend.LegendIconRadius, fixedHorizontalTextShift = SVGLegend.LegendIconRadius + fontSizeMargin + fixedHorizontalIconShift;
|
366 | maxMeasureLength = this.parentViewport.width * SVGLegend.LegendMaxWidthFactor - fixedHorizontalTextShift - SVGLegend.LegendEdgeMariginWidth;
|
367 | } else maxMeasureLength = this.legendFontSizeMarginValue < SVGLegend.DefaultTextMargin ? SVGLegend.MaxTitleLength : SVGLegend.MaxTitleLength + SVGLegend.DefaultMaxLegendFactor * this.legendFontSizeMarginDifference;
|
368 | var textProperties = SVGLegend.getTextProperties(!0, title, this.data.fontSize), text = title;
|
369 | return width = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties),
|
370 | width > maxMeasureLength && (text = powerbi.TextMeasurementService.getTailoredTextOrDefault(textProperties, maxMeasureLength),
|
371 | textProperties.text = text, width = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties)),
|
372 | isHorizontal ? width += SVGLegend.TitlePadding : text = powerbi.TextMeasurementService.getTailoredTextOrDefault(textProperties, this.viewport.width),
|
373 | {
|
374 | x: 0,
|
375 | y: 0,
|
376 | text: text,
|
377 | width: width,
|
378 | height: powerbi.TextMeasurementService.estimateSvgTextHeight(textProperties)
|
379 | };
|
380 | }
|
381 | return null;
|
382 | }, SVGLegend.prototype.calculateLayout = function(data, autoWidth) {
|
383 | var dataPoints = data.dataPoints;
|
384 | if (0 === data.dataPoints.length) return {
|
385 | numberOfItems: 0,
|
386 | title: null,
|
387 | navigationArrows: []
|
388 | };
|
389 | this.legendFontSizeMarginValue = PixelConverter.fromPointToPixel(this.data && void 0 !== this.data.fontSize ? this.data.fontSize : SVGLegend.DefaultFontSizeInPt),
|
390 | this.legendFontSizeMarginDifference = this.legendFontSizeMarginValue - SVGLegend.DefaultTextMargin,
|
391 | this.normalizePosition(dataPoints), this.legendDataStartIndex < dataPoints.length && (dataPoints = dataPoints.slice(this.legendDataStartIndex));
|
392 | var navArrows, numberOfItems, title = this.calculateTitleLayout(data.title);
|
393 | return this.isTopOrBottom(this.orientation) ? (navArrows = this.isScrollable ? this.calculateHorizontalNavigationArrowsLayout(title) : [],
|
394 | numberOfItems = this.calculateHorizontalLayout(dataPoints, title, navArrows)) : (navArrows = this.isScrollable ? this.calculateVerticalNavigationArrowsLayout(title) : [],
|
395 | numberOfItems = this.calculateVerticalLayout(dataPoints, title, navArrows, autoWidth)),
|
396 | {
|
397 | numberOfItems: numberOfItems,
|
398 | title: title,
|
399 | navigationArrows: navArrows
|
400 | };
|
401 | }, SVGLegend.prototype.updateNavigationArrowLayout = function(navigationArrows, remainingDataLength, visibleDataLength) {
|
402 | 0 === this.legendDataStartIndex && navigationArrows.shift();
|
403 | var lastWindow = this.arrowPosWindow;
|
404 | this.arrowPosWindow = visibleDataLength, navigationArrows && navigationArrows.length > 0 && this.arrowPosWindow === remainingDataLength && (this.arrowPosWindow = lastWindow,
|
405 | navigationArrows.length = navigationArrows.length - 1);
|
406 | }, SVGLegend.prototype.calculateHorizontalNavigationArrowsLayout = function(title) {
|
407 | var height = SVGLegend.LegendArrowHeight, width = SVGLegend.LegendArrowWidth, translateY = this.viewport.height / 2 - height / 2, data = [], rightShift = title ? title.x + title.width : 0, arrowLeft = visuals.SVGUtil.createArrow(width, height, 180), arrowRight = visuals.SVGUtil.createArrow(width, height, 0);
|
408 | return data.push({
|
409 | x: rightShift,
|
410 | y: translateY,
|
411 | path: arrowLeft.path,
|
412 | rotateTransform: arrowLeft.transform,
|
413 | type: 1
|
414 | }), data.push({
|
415 | x: this.parentViewport.width - width,
|
416 | y: translateY,
|
417 | path: arrowRight.path,
|
418 | rotateTransform: arrowRight.transform,
|
419 | type: 0
|
420 | }), data;
|
421 | }, SVGLegend.prototype.calculateVerticalNavigationArrowsLayout = function(title) {
|
422 | var height = SVGLegend.LegendArrowHeight, width = SVGLegend.LegendArrowWidth, verticalCenter = this.viewport.height / 2, data = [], rightShift = verticalCenter + height / 2, arrowTop = visuals.SVGUtil.createArrow(width, height, 270), arrowBottom = visuals.SVGUtil.createArrow(width, height, 90), titleHeight = title ? title.height : 0;
|
423 | return data.push({
|
424 | x: rightShift,
|
425 | y: width + titleHeight,
|
426 | path: arrowTop.path,
|
427 | rotateTransform: arrowTop.transform,
|
428 | type: 1
|
429 | }), data.push({
|
430 | x: rightShift,
|
431 | y: this.parentViewport.height - height,
|
432 | path: arrowBottom.path,
|
433 | rotateTransform: arrowBottom.transform,
|
434 | type: 0
|
435 | }), data;
|
436 | }, SVGLegend.calculateHorizontalLegendItemsWidths = function(dataPoints, availableWidth, iconPadding, fontSize) {
|
437 | var dataPointsLength = dataPoints.length, maxItemWidth = dataPointsLength > 0 ? availableWidth / dataPointsLength | 0 : 0, maxItemTextWidth = maxItemWidth - iconPadding;
|
438 | maxItemTextWidth < SVGLegend.MaxTextLength && (maxItemTextWidth = SVGLegend.MaxTextLength,
|
439 | maxItemWidth = maxItemTextWidth + iconPadding), maxItemWidth > availableWidth && (maxItemWidth = availableWidth,
|
440 | maxItemTextWidth = maxItemWidth - iconPadding);
|
441 | for (var occupiedWidth = 0, legendItems = [], _i = 0, dataPoints_1 = dataPoints; _i < dataPoints_1.length; _i++) {
|
442 | var dataPoint = dataPoints_1[_i], textProperties = SVGLegend.getTextProperties(!1, dataPoint.label, fontSize), itemTextWidth = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties), desiredWidth = itemTextWidth + iconPadding, overMaxWidth = desiredWidth > maxItemWidth, actualWidth = overMaxWidth ? maxItemWidth : desiredWidth;
|
443 | if (occupiedWidth += actualWidth, occupiedWidth >= availableWidth) {
|
444 | 0 === legendItems.length ? (legendItems.push({
|
445 | dataPoint: dataPoint,
|
446 | textProperties: textProperties,
|
447 | desiredWidth: desiredWidth,
|
448 | desiredOverMaxWidth: !0,
|
449 | width: desiredWidth
|
450 | }), occupiedWidth = availableWidth) : occupiedWidth -= actualWidth;
|
451 | break;
|
452 | }
|
453 | legendItems.push({
|
454 | dataPoint: dataPoint,
|
455 | textProperties: textProperties,
|
456 | desiredWidth: desiredWidth,
|
457 | desiredOverMaxWidth: overMaxWidth,
|
458 | width: desiredWidth
|
459 | });
|
460 | }
|
461 | var itemsOverMax = _.filter(legendItems, function(li) {
|
462 | return li.desiredOverMaxWidth;
|
463 | }), numItemsOverMax = itemsOverMax.length;
|
464 | if (numItemsOverMax > 0) for (var extraWidth = availableWidth - occupiedWidth, _a = 0, itemsOverMax_1 = itemsOverMax; _a < itemsOverMax_1.length; _a++) {
|
465 | var item = itemsOverMax_1[_a], extraWidthPerItem = extraWidth / numItemsOverMax, newMaxItemWidth = maxItemWidth + extraWidthPerItem, usedExtraWidth = void 0;
|
466 | item.desiredWidth <= newMaxItemWidth ? (item.desiredOverMaxWidth = !1, usedExtraWidth = item.desiredWidth - maxItemWidth) : (item.width = newMaxItemWidth,
|
467 | usedExtraWidth = newMaxItemWidth - maxItemWidth), extraWidth -= usedExtraWidth,
|
468 | numItemsOverMax--;
|
469 | }
|
470 | return legendItems;
|
471 | }, SVGLegend.prototype.calculateHorizontalLayout = function(dataPoints, title, navigationArrows) {
|
472 | var HorizontalTextShift = 4 + SVGLegend.LegendIconRadius, fontSizeBiggerThanDefault = this.legendFontSizeMarginDifference > 0, fontSizeMargin = fontSizeBiggerThanDefault ? SVGLegend.TextAndIconPadding + this.legendFontSizeMarginDifference : SVGLegend.TextAndIconPadding, fixedTextShift = fontSizeMargin / (SVGLegend.LegendIconRadiusFactor / 2) + HorizontalTextShift, occupiedWidth = 0, iconTotalItemPadding = 2 * SVGLegend.LegendIconRadius + 1.5 * fontSizeMargin, numberOfItems = dataPoints.length, defaultTextProperties = SVGLegend.getTextProperties(!1, "", this.data.fontSize), verticalCenter = this.viewport.height / 2, textYCoordinate = verticalCenter + powerbi.TextMeasurementService.estimateSvgTextHeight(defaultTextProperties) / 2 - powerbi.TextMeasurementService.estimateSvgTextBaselineDelta(defaultTextProperties);
|
473 | title && (occupiedWidth += title.width, title.y = verticalCenter + title.height / 2 - powerbi.TextMeasurementService.estimateSvgTextBaselineDelta(SVGLegend.getTextProperties(!0, title.text, this.data.fontSize))),
|
474 | this.legendDataStartIndex > 0 && (occupiedWidth += SVGLegend.LegendArrowOffset);
|
475 | var dataPointsLength = dataPoints.length, availableWidth = this.parentViewport.width - occupiedWidth, legendItems = SVGLegend.calculateHorizontalLegendItemsWidths(dataPoints, availableWidth, iconTotalItemPadding, this.data.fontSize);
|
476 | numberOfItems = legendItems.length, numberOfItems !== dataPointsLength && (availableWidth -= SVGLegend.LegendArrowOffset,
|
477 | legendItems = SVGLegend.calculateHorizontalLegendItemsWidths(dataPoints, availableWidth, iconTotalItemPadding, this.data.fontSize),
|
478 | numberOfItems = legendItems.length);
|
479 | for (var _i = 0, legendItems_1 = legendItems; _i < legendItems_1.length; _i++) {
|
480 | var legendItem = legendItems_1[_i], dataPoint = legendItem.dataPoint;
|
481 | if (dataPoint.glyphPosition = {
|
482 | x: occupiedWidth + SVGLegend.LegendIconRadius + this.legendFontSizeMarginDifference / SVGLegend.LegendIconRadiusFactor,
|
483 | y: this.viewport.height * SVGLegend.LegendIconYRatio
|
484 | }, dataPoint.textPosition = {
|
485 | x: occupiedWidth + fixedTextShift,
|
486 | y: textYCoordinate
|
487 | }, legendItem.desiredOverMaxWidth) {
|
488 | var textWidth = legendItem.width - iconTotalItemPadding, text = powerbi.TextMeasurementService.getTailoredTextOrDefault(legendItem.textProperties, textWidth);
|
489 | dataPoint.label = text;
|
490 | }
|
491 | occupiedWidth += legendItem.width;
|
492 | }
|
493 | return this.visibleLegendWidth = occupiedWidth, this.updateNavigationArrowLayout(navigationArrows, dataPointsLength, numberOfItems),
|
494 | numberOfItems;
|
495 | }, SVGLegend.prototype.calculateVerticalLayout = function(dataPoints, title, navigationArrows, autoWidth) {
|
496 | var _this = this, fontSizeBiggerThenDefault = this.legendFontSizeMarginDifference > 0, fontFactor = fontSizeBiggerThenDefault ? this.legendFontSizeMarginDifference : 0, verticalLegendHeight = 20 + fontFactor, spaceNeededByTitle = 15 + fontFactor, extraShiftForTextAlignmentToIcon = 4 + fontFactor, totalSpaceOccupiedThusFar = verticalLegendHeight, fixedHorizontalIconShift = SVGLegend.TextAndIconPadding + SVGLegend.LegendIconRadius + this.legendFontSizeMarginDifference / SVGLegend.LegendIconRadiusFactor, fixedHorizontalTextShift = 2 * fixedHorizontalIconShift, maxHorizontalSpaceAvaliable = autoWidth ? this.parentViewport.width * SVGLegend.LegendMaxWidthFactor - fixedHorizontalTextShift - SVGLegend.LegendEdgeMariginWidth : this.lastCalculatedWidth - fixedHorizontalTextShift - SVGLegend.LegendEdgeMariginWidth, numberOfItems = dataPoints.length, maxHorizontalSpaceUsed = 0, parentHeight = this.parentViewport.height;
|
497 | title && (totalSpaceOccupiedThusFar += spaceNeededByTitle, title.x = SVGLegend.TextAndIconPadding,
|
498 | title.y = spaceNeededByTitle, maxHorizontalSpaceUsed = title.width || 0), this.legendDataStartIndex > 0 && (totalSpaceOccupiedThusFar += SVGLegend.LegendArrowOffset);
|
499 | for (var dataPointsLength = dataPoints.length, i = 0; dataPointsLength > i; i++) {
|
500 | var dp = dataPoints[i], textProperties = SVGLegend.getTextProperties(!1, dp.label, this.data.fontSize);
|
501 | dp.glyphPosition = {
|
502 | x: fixedHorizontalIconShift,
|
503 | y: totalSpaceOccupiedThusFar + extraShiftForTextAlignmentToIcon - powerbi.TextMeasurementService.estimateSvgTextBaselineDelta(textProperties)
|
504 | }, dp.textPosition = {
|
505 | x: fixedHorizontalTextShift,
|
506 | y: totalSpaceOccupiedThusFar + extraShiftForTextAlignmentToIcon
|
507 | };
|
508 | var width = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties);
|
509 | if (width > maxHorizontalSpaceUsed && (maxHorizontalSpaceUsed = width), width > maxHorizontalSpaceAvaliable) {
|
510 | var text = powerbi.TextMeasurementService.getTailoredTextOrDefault(textProperties, maxHorizontalSpaceAvaliable);
|
511 | dp.label = text;
|
512 | }
|
513 | if (totalSpaceOccupiedThusFar += verticalLegendHeight, totalSpaceOccupiedThusFar > parentHeight) {
|
514 | numberOfItems = i;
|
515 | break;
|
516 | }
|
517 | }
|
518 | return autoWidth ? maxHorizontalSpaceAvaliable > maxHorizontalSpaceUsed ? this.lastCalculatedWidth = this.viewport.width = Math.ceil(maxHorizontalSpaceUsed + fixedHorizontalTextShift + SVGLegend.LegendEdgeMariginWidth) : this.lastCalculatedWidth = this.viewport.width = Math.ceil(this.parentViewport.width * SVGLegend.LegendMaxWidthFactor) : this.viewport.width = this.lastCalculatedWidth,
|
519 | this.visibleLegendHeight = totalSpaceOccupiedThusFar, navigationArrows.forEach(function(d) {
|
520 | return d.x = _this.lastCalculatedWidth / 2;
|
521 | }), this.updateNavigationArrowLayout(navigationArrows, dataPointsLength, numberOfItems),
|
522 | numberOfItems;
|
523 | }, SVGLegend.prototype.drawNavigationArrows = function(layout) {
|
524 | var _this = this, arrows = this.group.selectAll(SVGLegend.NavigationArrow.selector).data(layout);
|
525 | arrows.enter().append("g").on("click", function(d) {
|
526 | var pos = _this.legendDataStartIndex;
|
527 | _this.legendDataStartIndex = 0 === d.type ? pos + _this.arrowPosWindow : pos - _this.arrowPosWindow,
|
528 | _this.drawLegendInternal(_this.data, _this.parentViewport, !1);
|
529 | }).classed(SVGLegend.NavigationArrow["class"], !0).append("path"), arrows.attr("transform", function(d) {
|
530 | return visuals.SVGUtil.translate(d.x, d.y);
|
531 | }).select("path").attr({
|
532 | d: function(d) {
|
533 | return d.path;
|
534 | },
|
535 | transform: function(d) {
|
536 | return d.rotateTransform;
|
537 | }
|
538 | }), arrows.exit().remove();
|
539 | }, SVGLegend.prototype.isTopOrBottom = function(orientation) {
|
540 | switch (orientation) {
|
541 | case LegendPosition.Top:
|
542 | case LegendPosition.Bottom:
|
543 | case LegendPosition.BottomCenter:
|
544 | case LegendPosition.TopCenter:
|
545 | return !0;
|
546 |
|
547 | default:
|
548 | return !1;
|
549 | }
|
550 | }, SVGLegend.prototype.isCentered = function(orientation) {
|
551 | switch (orientation) {
|
552 | case LegendPosition.BottomCenter:
|
553 | case LegendPosition.LeftCenter:
|
554 | case LegendPosition.RightCenter:
|
555 | case LegendPosition.TopCenter:
|
556 | return !0;
|
557 |
|
558 | default:
|
559 | return !1;
|
560 | }
|
561 | }, SVGLegend.prototype.reset = function() {}, SVGLegend.getTextProperties = function(isTitle, text, fontSize) {
|
562 | return {
|
563 | text: text,
|
564 | fontFamily: isTitle ? SVGLegend.DefaultTitleFontFamily : SVGLegend.DefaultFontFamily,
|
565 | fontSize: PixelConverter.fromPoint(fontSize || SVGLegend.DefaultFontSizeInPt)
|
566 | };
|
567 | }, SVGLegend.prototype.setTooltipToLegendItems = function(data) {
|
568 | for (var _i = 0, _a = data.dataPoints; _i < _a.length; _i++) {
|
569 | var dataPoint = _a[_i];
|
570 | dataPoint.tooltip = dataPoint.label;
|
571 | }
|
572 | }, SVGLegend.DefaultFontSizeInPt = 8, SVGLegend.LegendIconRadius = 5, SVGLegend.LegendIconRadiusFactor = 5,
|
573 | SVGLegend.MaxTextLength = 60, SVGLegend.MaxTitleLength = 80, SVGLegend.TextAndIconPadding = 5,
|
574 | SVGLegend.TitlePadding = 15, SVGLegend.LegendEdgeMariginWidth = 10, SVGLegend.LegendMaxWidthFactor = .3,
|
575 | SVGLegend.TopLegendHeight = 24, SVGLegend.DefaultTextMargin = PixelConverter.fromPointToPixel(SVGLegend.DefaultFontSizeInPt),
|
576 | SVGLegend.DefaultMaxLegendFactor = SVGLegend.MaxTitleLength / SVGLegend.DefaultTextMargin,
|
577 | SVGLegend.LegendIconYRatio = .52, SVGLegend.LegendArrowOffset = 10, SVGLegend.LegendArrowHeight = 15,
|
578 | SVGLegend.LegendArrowWidth = 7.5, SVGLegend.DefaultFontFamily = visuals.Font.Family.regular.css,
|
579 | SVGLegend.DefaultTitleFontFamily = visuals.Font.Family.semibold.css, SVGLegend.LegendItem = createClassAndSelector("legendItem"),
|
580 | SVGLegend.LegendText = createClassAndSelector("legendText"), SVGLegend.LegendIcon = createClassAndSelector("legendIcon"),
|
581 | SVGLegend.LegendTitle = createClassAndSelector("legendTitle"), SVGLegend.NavigationArrow = createClassAndSelector("navArrow"),
|
582 | SVGLegend;
|
583 | }();
|
584 | visuals.SVGLegend = SVGLegend;
|
585 | var LegendData, CartesianChartInteractiveLegend = function() {
|
586 | function CartesianChartInteractiveLegend(element) {
|
587 | this.legendContainerParent = d3.select(element.get(0));
|
588 | }
|
589 | return CartesianChartInteractiveLegend.prototype.getMargins = function() {
|
590 | return {
|
591 | height: CartesianChartInteractiveLegend.LegendHeight,
|
592 | width: 0
|
593 | };
|
594 | }, CartesianChartInteractiveLegend.prototype.drawLegend = function(legendData) {
|
595 | var data = legendData.dataPoints;
|
596 | if (!(data.length < 1)) {
|
597 | var legendContainerDiv = this.legendContainerParent.select(CartesianChartInteractiveLegend.LegendContainerSelector);
|
598 | if (legendContainerDiv.empty()) {
|
599 | if (!data.length) return;
|
600 | var divToPrepend = $("<div></div>").height(this.getMargins().height).addClass(CartesianChartInteractiveLegend.LegendContainerClass);
|
601 | $(this.legendContainerParent[0]).prepend(divToPrepend), legendContainerDiv = d3.select(divToPrepend.get(0));
|
602 | }
|
603 | this.legendContainerDiv = legendContainerDiv, this.drawTitle(data), this.drawLegendItems(data);
|
604 | }
|
605 | }, CartesianChartInteractiveLegend.prototype.reset = function() {
|
606 | this.legendContainerDiv && (this.legendContainerDiv.remove(), this.legendContainerDiv = null);
|
607 | }, CartesianChartInteractiveLegend.prototype.isVisible = function() {
|
608 | return !0;
|
609 | }, CartesianChartInteractiveLegend.prototype.changeOrientation = function(orientation) {},
|
610 | CartesianChartInteractiveLegend.prototype.getOrientation = function() {
|
611 | return LegendPosition.Top;
|
612 | }, CartesianChartInteractiveLegend.prototype.drawTitle = function(data) {
|
613 | var titleDiv = this.legendContainerDiv.selectAll("div." + CartesianChartInteractiveLegend.LegendTitleClass), item = titleDiv.data([ data[0] ]), itemEnter = item.enter(), titleDivEnter = itemEnter.append("div").attr("class", CartesianChartInteractiveLegend.LegendTitleClass);
|
614 | titleDivEnter.filter(function(d) {
|
615 | return d.iconOnlyOnLabel;
|
616 | }).append("span").attr("class", CartesianChartInteractiveLegend.legendIconClass).html(CartesianChartInteractiveLegend.legendPlaceSelector),
|
617 | titleDivEnter.append("span"), item.filter(function(d) {
|
618 | return d.iconOnlyOnLabel;
|
619 | }).select("span." + CartesianChartInteractiveLegend.legendIconClass).style(CartesianChartInteractiveLegend.legendColorCss, function(d) {
|
620 | return d.color;
|
621 | }), item.select("span:last-child").text(function(d) {
|
622 | return d.category;
|
623 | });
|
624 | }, CartesianChartInteractiveLegend.prototype.drawLegendItems = function(data) {
|
625 | this.ensureLegendTableCreated();
|
626 | var dataPointsMatrix = [ data ], legendItemsContainer = this.legendContainerDiv.select("tbody").selectAll("tr").data(dataPointsMatrix), legendItemsEnter = legendItemsContainer.enter(), rowEnter = legendItemsEnter.append("tr"), cellEnter = rowEnter.selectAll("td").data(function(d) {
|
627 | return d;
|
628 | }, function(d) {
|
629 | return d.label;
|
630 | }).enter().append("td").attr("class", CartesianChartInteractiveLegend.LegendItem), cellSpanEnter = cellEnter.append("span");
|
631 | cellSpanEnter.filter(function(d) {
|
632 | return !d.iconOnlyOnLabel;
|
633 | }).append("span").html(CartesianChartInteractiveLegend.legendPlaceSelector).attr("class", CartesianChartInteractiveLegend.legendIconClass).attr("white-space", "nowrap").style({
|
634 | "font-size": "20px",
|
635 | "margin-bottom": "7px"
|
636 | }), cellSpanEnter.append("span").attr("class", CartesianChartInteractiveLegend.legendItemNameClass),
|
637 | cellSpanEnter.append("span").attr("class", CartesianChartInteractiveLegend.legendItemMeasureClass);
|
638 | var legendCells = legendItemsContainer.selectAll("td").data(function(d) {
|
639 | return d;
|
640 | }, function(d) {
|
641 | return d.label;
|
642 | });
|
643 | legendCells.select("span." + CartesianChartInteractiveLegend.legendItemNameClass).html(function(d) {
|
644 | return powerbi.visuals.TextUtil.removeBreakingSpaces(d.label);
|
645 | }), legendCells.select("span." + CartesianChartInteractiveLegend.legendItemMeasureClass).html(function(d) {
|
646 | return " " + d.measure;
|
647 | }), legendCells.select("span." + CartesianChartInteractiveLegend.legendIconClass).style("color", function(d) {
|
648 | return d.color;
|
649 | }), legendCells.exit().remove();
|
650 | }, CartesianChartInteractiveLegend.prototype.ensureLegendTableCreated = function() {
|
651 | if (this.legendContainerDiv.select("div table").empty()) {
|
652 | var legendTable = this.legendContainerDiv.append("div").append("table");
|
653 | legendTable.style("table-layout", "fixed").append("tbody"), this.setPanGestureOnLegend(legendTable);
|
654 | }
|
655 | }, CartesianChartInteractiveLegend.prototype.setPanGestureOnLegend = function(legendTable) {
|
656 | var viewportWidth = $(this.legendContainerParent[0]).width(), xscale = d3.scale.linear().domain([ 0, viewportWidth ]).range([ 0, viewportWidth ]), zoom = d3.behavior.zoom().scaleExtent([ 1, 1 ]).x(xscale).on("zoom", function() {
|
657 | if ($(legendTable[0]).width() > viewportWidth) {
|
658 | var t = zoom.translate(), tx_1 = t[0], ty = t[1];
|
659 | tx_1 = Math.min(tx_1, 0), tx_1 = Math.max(tx_1, viewportWidth - $(legendTable[0]).width()),
|
660 | zoom.translate([ tx_1, ty ]), legendTable.style("-ms-transform", function() {
|
661 | return visuals.SVGUtil.translateXWithPixels(tx_1);
|
662 | }), legendTable.style("-webkit-transform", function() {
|
663 | return visuals.SVGUtil.translateXWithPixels(tx_1);
|
664 | }), legendTable.style("transform", function() {
|
665 | return visuals.SVGUtil.translateXWithPixels(tx_1);
|
666 | });
|
667 | }
|
668 | });
|
669 | this.legendContainerDiv ? this.legendContainerDiv.call(zoom) : legendTable.call(zoom);
|
670 | }, CartesianChartInteractiveLegend.LegendHeight = 70, CartesianChartInteractiveLegend.LegendContainerClass = "interactive-legend",
|
671 | CartesianChartInteractiveLegend.LegendContainerSelector = ".interactive-legend",
|
672 | CartesianChartInteractiveLegend.LegendTitleClass = "title", CartesianChartInteractiveLegend.LegendItem = "item",
|
673 | CartesianChartInteractiveLegend.legendPlaceSelector = "●", CartesianChartInteractiveLegend.legendIconClass = "icon",
|
674 | CartesianChartInteractiveLegend.legendColorCss = "color", CartesianChartInteractiveLegend.legendItemNameClass = "itemName",
|
675 | CartesianChartInteractiveLegend.legendItemMeasureClass = "itemMeasure", CartesianChartInteractiveLegend;
|
676 | }();
|
677 | !function(LegendData) {
|
678 | function update(legendData, legendObject) {
|
679 | if (null == legendObject[visuals.legendProps.show] && (legendObject[visuals.legendProps.show] = !0),
|
680 | legendObject[visuals.legendProps.show] === !1 && (legendData.dataPoints = []), legendObject[visuals.legendProps.show] === !0 && null == legendObject[visuals.legendProps.position] && (legendObject[visuals.legendProps.position] = visuals.legendPosition.top),
|
681 | void 0 !== legendObject[visuals.legendProps.fontSize] && (legendData.fontSize = legendObject[visuals.legendProps.fontSize]),
|
682 | void 0 !== legendObject[visuals.legendProps.labelColor]) {
|
683 | var fillColor = legendObject[visuals.legendProps.labelColor];
|
684 | null != fillColor && (legendData.labelColor = fillColor.solid.color);
|
685 | }
|
686 | legendObject[visuals.legendProps.showTitle] === !1 ? legendData.title = "" : void 0 !== legendObject[visuals.legendProps.titleText] && (legendData.title = legendObject[visuals.legendProps.titleText]);
|
687 | }
|
688 | LegendData.DefaultLegendLabelFillColor = "#666666", LegendData.update = update;
|
689 | }(LegendData = visuals.LegendData || (visuals.LegendData = {}));
|
690 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
691 | }(powerbi || (powerbi = {}));
|
692 | }, function(module, exports) {
|
693 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
694 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
695 | !function(powerbi) {
|
696 | var visuals;
|
697 | !function(visuals) {
|
698 | var axisScale;
|
699 | !function(axisScale) {
|
700 | axisScale.linear = "linear", axisScale.log = "log", axisScale.type = powerbi.createEnumType([ {
|
701 | value: axisScale.linear,
|
702 | displayName: function(resources) {
|
703 | return resources.get("Visual_Axis_Linear");
|
704 | }
|
705 | }, {
|
706 | value: axisScale.log,
|
707 | displayName: function(resources) {
|
708 | return resources.get("Visual_Axis_Log");
|
709 | }
|
710 | } ]);
|
711 | }(axisScale = visuals.axisScale || (visuals.axisScale = {}));
|
712 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
713 | }(powerbi || (powerbi = {}));
|
714 | }, function(module, exports) {
|
715 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
716 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
717 | !function(powerbi) {
|
718 | var visuals;
|
719 | !function(visuals) {
|
720 | var axisStyle;
|
721 | !function(axisStyle) {
|
722 | axisStyle.showBoth = "showBoth", axisStyle.showTitleOnly = "showTitleOnly", axisStyle.showUnitOnly = "showUnitOnly",
|
723 | axisStyle.type = powerbi.createEnumType([ {
|
724 | value: axisStyle.showTitleOnly,
|
725 | displayName: function(resources) {
|
726 | return resources.get("Visual_Axis_ShowTitleOnly");
|
727 | }
|
728 | }, {
|
729 | value: axisStyle.showUnitOnly,
|
730 | displayName: function(resources) {
|
731 | return resources.get("Visual_Axis_ShowUnitOnly");
|
732 | }
|
733 | }, {
|
734 | value: axisStyle.showBoth,
|
735 | displayName: function(resources) {
|
736 | return resources.get("Visual_Axis_ShowBoth");
|
737 | }
|
738 | } ]);
|
739 | }(axisStyle = visuals.axisStyle || (visuals.axisStyle = {}));
|
740 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
741 | }(powerbi || (powerbi = {}));
|
742 | }, function(module, exports) {
|
743 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
744 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
745 | !function(powerbi) {
|
746 | var visuals;
|
747 | !function(visuals) {
|
748 | var axisType;
|
749 | !function(axisType) {
|
750 | axisType.scalar = "Scalar", axisType.categorical = "Categorical", axisType.both = "Both",
|
751 | axisType.type = powerbi.createEnumType([ {
|
752 | value: axisType.scalar,
|
753 | displayName: function(resources) {
|
754 | return resources.get("Visual_Axis_Scalar");
|
755 | }
|
756 | }, {
|
757 | value: axisType.categorical,
|
758 | displayName: function(resources) {
|
759 | return resources.get("Visual_Axis_Categorical");
|
760 | }
|
761 | } ]);
|
762 | }(axisType = visuals.axisType || (visuals.axisType = {}));
|
763 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
764 | }(powerbi || (powerbi = {}));
|
765 | }, function(module, exports) {
|
766 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
767 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
768 | !function(powerbi) {
|
769 | var visuals;
|
770 | !function(visuals) {
|
771 | var basicShapeType;
|
772 | !function(basicShapeType) {
|
773 | basicShapeType.rectangle = "rectangle", basicShapeType.oval = "oval", basicShapeType.line = "line",
|
774 | basicShapeType.arrow = "arrow", basicShapeType.triangle = "triangle", basicShapeType.type = powerbi.createEnumType([ {
|
775 | value: basicShapeType.rectangle,
|
776 | displayName: "rectangle"
|
777 | }, {
|
778 | value: basicShapeType.oval,
|
779 | displayName: "oval"
|
780 | }, {
|
781 | value: basicShapeType.line,
|
782 | displayName: "line"
|
783 | }, {
|
784 | value: basicShapeType.arrow,
|
785 | displayName: "arrow"
|
786 | }, {
|
787 | value: basicShapeType.triangle,
|
788 | displayName: "triangle"
|
789 | } ]);
|
790 | }(basicShapeType = visuals.basicShapeType || (visuals.basicShapeType = {}));
|
791 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
792 | }(powerbi || (powerbi = {}));
|
793 | }, function(module, exports) {
|
794 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
795 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
796 | !function(powerbi) {
|
797 | var visuals;
|
798 | !function(visuals) {
|
799 | var imageScalingType;
|
800 | !function(imageScalingType) {
|
801 | imageScalingType.normal = "Normal", imageScalingType.fit = "Fit", imageScalingType.fill = "Fill",
|
802 | imageScalingType.type = powerbi.createEnumType([ {
|
803 | value: imageScalingType.normal,
|
804 | displayName: function(resources) {
|
805 | return resources.get("Visual_ImageScalingType_Normal");
|
806 | }
|
807 | }, {
|
808 | value: imageScalingType.fit,
|
809 | displayName: function(resources) {
|
810 | return resources.get("Visual_ImageScalingType_Fit");
|
811 | }
|
812 | }, {
|
813 | value: imageScalingType.fill,
|
814 | displayName: function(resources) {
|
815 | return resources.get("Visual_ImageScalingType_Fill");
|
816 | }
|
817 | } ]);
|
818 | }(imageScalingType = visuals.imageScalingType || (visuals.imageScalingType = {}));
|
819 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
820 | }(powerbi || (powerbi = {}));
|
821 | }, function(module, exports) {
|
822 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
823 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
824 | !function(powerbi) {
|
825 | var visuals;
|
826 | !function(visuals) {
|
827 | var labelPosition;
|
828 | !function(labelPosition) {
|
829 | labelPosition.insideEnd = "InsideEnd", labelPosition.insideCenter = "InsideCenter",
|
830 | labelPosition.outsideEnd = "OutsideEnd", labelPosition.insideBase = "InsideBase",
|
831 | labelPosition.type = powerbi.createEnumType([ {
|
832 | value: labelPosition.insideEnd,
|
833 | displayName: function(resources) {
|
834 | return resources.get("Visual_LabelPosition_InsideEnd");
|
835 | }
|
836 | }, {
|
837 | value: labelPosition.outsideEnd,
|
838 | displayName: function(resources) {
|
839 | return resources.get("Visual_LabelPosition_OutsideEnd");
|
840 | }
|
841 | }, {
|
842 | value: labelPosition.insideCenter,
|
843 | displayName: function(resources) {
|
844 | return resources.get("Visual_LabelPosition_InsideCenter");
|
845 | }
|
846 | }, {
|
847 | value: labelPosition.insideBase,
|
848 | displayName: function(resources) {
|
849 | return resources.get("Visual_LabelPosition_InsideBase");
|
850 | }
|
851 | } ]);
|
852 | }(labelPosition = visuals.labelPosition || (visuals.labelPosition = {}));
|
853 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
854 | }(powerbi || (powerbi = {}));
|
855 | }, function(module, exports) {
|
856 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
857 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
858 | !function(powerbi) {
|
859 | var visuals;
|
860 | !function(visuals) {
|
861 | var labelStyle;
|
862 | !function(labelStyle) {
|
863 | labelStyle.category = "Category", labelStyle.data = "Data", labelStyle.both = "Both",
|
864 | labelStyle.type = powerbi.createEnumType([ {
|
865 | value: labelStyle.category,
|
866 | displayName: function(resources) {
|
867 | return resources.get("Visual_LabelStyle_Category");
|
868 | }
|
869 | }, {
|
870 | value: labelStyle.data,
|
871 | displayName: function(resources) {
|
872 | return resources.get("Visual_LabelStyle_DataValue");
|
873 | }
|
874 | }, {
|
875 | value: labelStyle.both,
|
876 | displayName: function(resources) {
|
877 | return resources.get("Visual_LabelStyle_Both");
|
878 | }
|
879 | } ]);
|
880 | }(labelStyle = visuals.labelStyle || (visuals.labelStyle = {}));
|
881 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
882 | }(powerbi || (powerbi = {}));
|
883 | }, function(module, exports) {
|
884 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
885 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
886 | !function(powerbi) {
|
887 | var visuals;
|
888 | !function(visuals) {
|
889 | var legendPosition;
|
890 | !function(legendPosition) {
|
891 | legendPosition.top = "Top", legendPosition.bottom = "Bottom", legendPosition.left = "Left",
|
892 | legendPosition.right = "Right", legendPosition.topCenter = "TopCenter", legendPosition.bottomCenter = "BottomCenter",
|
893 | legendPosition.leftCenter = "LeftCenter", legendPosition.rightCenter = "RightCenter",
|
894 | legendPosition.type = powerbi.createEnumType([ {
|
895 | value: legendPosition.top,
|
896 | displayName: function(resources) {
|
897 | return resources.get("Visual_LegendPosition_Top");
|
898 | }
|
899 | }, {
|
900 | value: legendPosition.bottom,
|
901 | displayName: function(resources) {
|
902 | return resources.get("Visual_LegendPosition_Bottom");
|
903 | }
|
904 | }, {
|
905 | value: legendPosition.left,
|
906 | displayName: function(resources) {
|
907 | return resources.get("Visual_LegendPosition_Left");
|
908 | }
|
909 | }, {
|
910 | value: legendPosition.right,
|
911 | displayName: function(resources) {
|
912 | return resources.get("Visual_LegendPosition_Right");
|
913 | }
|
914 | }, {
|
915 | value: legendPosition.topCenter,
|
916 | displayName: function(resources) {
|
917 | return resources.get("Visual_LegendPosition_TopCenter");
|
918 | }
|
919 | }, {
|
920 | value: legendPosition.bottomCenter,
|
921 | displayName: function(resources) {
|
922 | return resources.get("Visual_LegendPosition_BottomCenter");
|
923 | }
|
924 | }, {
|
925 | value: legendPosition.leftCenter,
|
926 | displayName: function(resources) {
|
927 | return resources.get("Visual_LegendPosition_LeftCenter");
|
928 | }
|
929 | }, {
|
930 | value: legendPosition.rightCenter,
|
931 | displayName: function(resources) {
|
932 | return resources.get("Visual_LegendPosition_RightCenter");
|
933 | }
|
934 | } ]);
|
935 | }(legendPosition = visuals.legendPosition || (visuals.legendPosition = {}));
|
936 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
937 | }(powerbi || (powerbi = {}));
|
938 | }, function(module, exports) {
|
939 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
940 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
941 | !function(powerbi) {
|
942 | var visuals;
|
943 | !function(visuals) {
|
944 | var kpiDirection;
|
945 | !function(kpiDirection) {
|
946 | kpiDirection.positive = "Positive", kpiDirection.negative = "Negative", kpiDirection.type = powerbi.createEnumType([ {
|
947 | value: kpiDirection.positive,
|
948 | displayName: function(resources) {
|
949 | return resources.get("Visual_KPI_Direction_Positive");
|
950 | }
|
951 | }, {
|
952 | value: kpiDirection.negative,
|
953 | displayName: function(resources) {
|
954 | return resources.get("Visual_KPI_Direction_Negative");
|
955 | }
|
956 | } ]);
|
957 | }(kpiDirection = visuals.kpiDirection || (visuals.kpiDirection = {}));
|
958 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
959 | }(powerbi || (powerbi = {}));
|
960 | }, function(module, exports) {
|
961 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
962 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
963 | !function(powerbi) {
|
964 | var visuals;
|
965 | !function(visuals) {
|
966 | var lineStyle;
|
967 | !function(lineStyle) {
|
968 | lineStyle.dashed = "dashed", lineStyle.solid = "solid", lineStyle.dotted = "dotted",
|
969 | lineStyle.type = powerbi.createEnumType([ {
|
970 | value: lineStyle.dashed,
|
971 | displayName: function(resources) {
|
972 | return resources.get("Visual_LineStyle_Dashed");
|
973 | }
|
974 | }, {
|
975 | value: lineStyle.solid,
|
976 | displayName: function(resources) {
|
977 | return resources.get("Visual_LineStyle_Solid");
|
978 | }
|
979 | }, {
|
980 | value: lineStyle.dotted,
|
981 | displayName: function(resources) {
|
982 | return resources.get("Visual_LineStyle_Dotted");
|
983 | }
|
984 | } ]);
|
985 | }(lineStyle = visuals.lineStyle || (visuals.lineStyle = {}));
|
986 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
987 | }(powerbi || (powerbi = {}));
|
988 | }, function(module, exports) {
|
989 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
990 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
991 | !function(powerbi) {
|
992 | var visuals;
|
993 | !function(visuals) {
|
994 | var outline;
|
995 | !function(outline_1) {
|
996 | function showTop(outline) {
|
997 | return [ outline_1.topOnly, outline_1.topBottom, outline_1.frame ].some(function(o) {
|
998 | return o === outline;
|
999 | });
|
1000 | }
|
1001 | function showRight(outline) {
|
1002 | return [ outline_1.rightOnly, outline_1.leftRight, outline_1.frame ].some(function(o) {
|
1003 | return o === outline;
|
1004 | });
|
1005 | }
|
1006 | function showBottom(outline) {
|
1007 | return [ outline_1.bottomOnly, outline_1.topBottom, outline_1.frame ].some(function(o) {
|
1008 | return o === outline;
|
1009 | });
|
1010 | }
|
1011 | function showLeft(outline) {
|
1012 | return [ outline_1.leftOnly, outline_1.leftRight, outline_1.frame ].some(function(o) {
|
1013 | return o === outline;
|
1014 | });
|
1015 | }
|
1016 | outline_1.none = "None", outline_1.bottomOnly = "BottomOnly", outline_1.topOnly = "TopOnly",
|
1017 | outline_1.leftOnly = "LeftOnly", outline_1.rightOnly = "RightOnly", outline_1.topBottom = "TopBottom",
|
1018 | outline_1.leftRight = "LeftRight", outline_1.frame = "Frame", outline_1.showTop = showTop,
|
1019 | outline_1.showRight = showRight, outline_1.showBottom = showBottom, outline_1.showLeft = showLeft,
|
1020 | outline_1.type = powerbi.createEnumType([ {
|
1021 | value: outline_1.none,
|
1022 | displayName: function(resources) {
|
1023 | return resources.get("Visual_Outline_none");
|
1024 | }
|
1025 | }, {
|
1026 | value: outline_1.bottomOnly,
|
1027 | displayName: function(resources) {
|
1028 | return resources.get("Visual_Outline_bottom_only");
|
1029 | }
|
1030 | }, {
|
1031 | value: outline_1.topOnly,
|
1032 | displayName: function(resources) {
|
1033 | return resources.get("Visual_Outline_top_only");
|
1034 | }
|
1035 | }, {
|
1036 | value: outline_1.leftOnly,
|
1037 | displayName: function(resources) {
|
1038 | return resources.get("Visual_Outline_LeftOnly");
|
1039 | }
|
1040 | }, {
|
1041 | value: outline_1.rightOnly,
|
1042 | displayName: function(resources) {
|
1043 | return resources.get("Visual_Outline_RightOnly");
|
1044 | }
|
1045 | }, {
|
1046 | value: outline_1.topBottom,
|
1047 | displayName: function(resources) {
|
1048 | return resources.get("Visual_Outline_top_Bottom");
|
1049 | }
|
1050 | }, {
|
1051 | value: outline_1.leftRight,
|
1052 | displayName: function(resources) {
|
1053 | return resources.get("Visual_Outline_leftRight");
|
1054 | }
|
1055 | }, {
|
1056 | value: outline_1.frame,
|
1057 | displayName: function(resources) {
|
1058 | return resources.get("Visual_Outline_frame");
|
1059 | }
|
1060 | } ]);
|
1061 | }(outline = visuals.outline || (visuals.outline = {}));
|
1062 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1063 | }(powerbi || (powerbi = {}));
|
1064 | }, function(module, exports) {
|
1065 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
1066 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
1067 | !function(powerbi) {
|
1068 | var visuals;
|
1069 | !function(visuals) {
|
1070 | var referenceLinePosition;
|
1071 | !function(referenceLinePosition) {
|
1072 | referenceLinePosition.back = "back", referenceLinePosition.front = "front", referenceLinePosition.type = powerbi.createEnumType([ {
|
1073 | value: referenceLinePosition.back,
|
1074 | displayName: function(resources) {
|
1075 | return resources.get("Visual_Reference_Line_Behind");
|
1076 | }
|
1077 | }, {
|
1078 | value: referenceLinePosition.front,
|
1079 | displayName: function(resources) {
|
1080 | return resources.get("Visual_Reference_Line_InFront");
|
1081 | }
|
1082 | } ]);
|
1083 | }(referenceLinePosition = visuals.referenceLinePosition || (visuals.referenceLinePosition = {}));
|
1084 | var referenceLineDataLabelHorizontalPosition;
|
1085 | !function(referenceLineDataLabelHorizontalPosition) {
|
1086 | referenceLineDataLabelHorizontalPosition.left = "left", referenceLineDataLabelHorizontalPosition.right = "right",
|
1087 | referenceLineDataLabelHorizontalPosition.type = powerbi.createEnumType([ {
|
1088 | value: referenceLineDataLabelHorizontalPosition.left,
|
1089 | displayName: function(resources) {
|
1090 | return resources.get("Visual_Reference_Line_Data_Label_Left");
|
1091 | }
|
1092 | }, {
|
1093 | value: referenceLineDataLabelHorizontalPosition.right,
|
1094 | displayName: function(resources) {
|
1095 | return resources.get("Visual_Reference_Line_Data_Label_Right");
|
1096 | }
|
1097 | } ]);
|
1098 | }(referenceLineDataLabelHorizontalPosition = visuals.referenceLineDataLabelHorizontalPosition || (visuals.referenceLineDataLabelHorizontalPosition = {}));
|
1099 | var referenceLineDataLabelVerticalPosition;
|
1100 | !function(referenceLineDataLabelVerticalPosition) {
|
1101 | referenceLineDataLabelVerticalPosition.above = "above", referenceLineDataLabelVerticalPosition.under = "under",
|
1102 | referenceLineDataLabelVerticalPosition.type = powerbi.createEnumType([ {
|
1103 | value: referenceLineDataLabelVerticalPosition.above,
|
1104 | displayName: function(resources) {
|
1105 | return resources.get("Visual_Reference_Line_Data_Label_Above");
|
1106 | }
|
1107 | }, {
|
1108 | value: referenceLineDataLabelVerticalPosition.under,
|
1109 | displayName: function(resources) {
|
1110 | return resources.get("Visual_Reference_Line_Data_Label_Under");
|
1111 | }
|
1112 | } ]);
|
1113 | }(referenceLineDataLabelVerticalPosition = visuals.referenceLineDataLabelVerticalPosition || (visuals.referenceLineDataLabelVerticalPosition = {}));
|
1114 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1115 | }(powerbi || (powerbi = {}));
|
1116 | }, function(module, exports) {
|
1117 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
1118 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
1119 | !function(powerbi) {
|
1120 | var visuals;
|
1121 | !function(visuals) {
|
1122 | var slicerOrientation;
|
1123 | !function(slicerOrientation) {
|
1124 | slicerOrientation.type = powerbi.createEnumType([ {
|
1125 | value: 0,
|
1126 | displayName: function(resources) {
|
1127 | return resources.get("Slicer_Orientation_Vertical");
|
1128 | }
|
1129 | }, {
|
1130 | value: 1,
|
1131 | displayName: function(resources) {
|
1132 | return resources.get("Slicer_Orientation_Horizontal");
|
1133 | }
|
1134 | } ]);
|
1135 | }(slicerOrientation = visuals.slicerOrientation || (visuals.slicerOrientation = {}));
|
1136 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1137 | }(powerbi || (powerbi = {}));
|
1138 | }, function(module, exports) {
|
1139 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
1140 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
1141 | !function(powerbi) {
|
1142 | var visuals;
|
1143 | !function(visuals) {
|
1144 | var yAxisPosition;
|
1145 | !function(yAxisPosition) {
|
1146 | yAxisPosition.left = "Left", yAxisPosition.right = "Right", yAxisPosition.type = powerbi.createEnumType([ {
|
1147 | value: yAxisPosition.left,
|
1148 | displayName: function(resources) {
|
1149 | return resources.get("Visual_yAxis_Left");
|
1150 | }
|
1151 | }, {
|
1152 | value: yAxisPosition.right,
|
1153 | displayName: function(resources) {
|
1154 | return resources.get("Visual_yAxis_Right");
|
1155 | }
|
1156 | } ]);
|
1157 | }(yAxisPosition = visuals.yAxisPosition || (visuals.yAxisPosition = {}));
|
1158 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1159 | }(powerbi || (powerbi = {}));
|
1160 | }, function(module, exports) {
|
1161 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
1162 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
1163 | !function(powerbi) {
|
1164 | var visuals;
|
1165 | !function(visuals) {
|
1166 | var sliderMode;
|
1167 | !function(sliderMode) {
|
1168 | sliderMode.before = "Before", sliderMode.after = "After", sliderMode.between = "Between",
|
1169 | sliderMode.type = powerbi.createEnumType([ {
|
1170 | value: sliderMode.between,
|
1171 | displayName: function(resources) {
|
1172 | return resources.get("Visual_SliderMode_Between");
|
1173 | }
|
1174 | }, {
|
1175 | value: sliderMode.before,
|
1176 | displayName: function(resources) {
|
1177 | return resources.get("Visual_SliderMode_Before");
|
1178 | }
|
1179 | }, {
|
1180 | value: sliderMode.after,
|
1181 | displayName: function(resources) {
|
1182 | return resources.get("Visual_SliderMode_After");
|
1183 | }
|
1184 | } ]);
|
1185 | }(sliderMode = visuals.sliderMode || (visuals.sliderMode = {}));
|
1186 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1187 | }(powerbi || (powerbi = {}));
|
1188 | }, function(module, exports) {
|
1189 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
1190 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
1191 | !function(powerbi) {
|
1192 | var visuals;
|
1193 | !function(visuals) {
|
1194 | var AnimatorCommon;
|
1195 | !function(AnimatorCommon) {
|
1196 | function GetAnimationDuration(animator, suppressAnimations) {
|
1197 | return suppressAnimations || !animator ? 0 : animator.getDuration();
|
1198 | }
|
1199 | AnimatorCommon.MinervaAnimationDuration = 250, AnimatorCommon.MaxDataPointsToAnimate = 1e3,
|
1200 | AnimatorCommon.GetAnimationDuration = GetAnimationDuration;
|
1201 | }(AnimatorCommon = visuals.AnimatorCommon || (visuals.AnimatorCommon = {}));
|
1202 | var BaseAnimator = function() {
|
1203 | function BaseAnimator(options) {
|
1204 | options && options.duration && (this.animationDuration = options.duration), this.animationDuration = this.animationDuration >= 0 ? this.animationDuration : AnimatorCommon.MinervaAnimationDuration;
|
1205 | }
|
1206 | return BaseAnimator.prototype.getDuration = function() {
|
1207 | return this.animationDuration;
|
1208 | }, BaseAnimator.prototype.animate = function(options) {
|
1209 | return null;
|
1210 | }, BaseAnimator.prototype.getEasing = function() {
|
1211 | return "cubic-in-out";
|
1212 | }, BaseAnimator;
|
1213 | }();
|
1214 | visuals.BaseAnimator = BaseAnimator;
|
1215 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1216 | }(powerbi || (powerbi = {}));
|
1217 | }, function(module, exports) {
|
1218 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
1219 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
1220 | function __() {
|
1221 | this.constructor = d;
|
1222 | }
|
1223 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
1224 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1225 | });
|
1226 | !function(powerbi) {
|
1227 | var visuals;
|
1228 | !function(visuals) {
|
1229 | var WebColumnChartAnimator = function(_super) {
|
1230 | function WebColumnChartAnimator(options) {
|
1231 | _super.call(this, options);
|
1232 | }
|
1233 | return __extends(WebColumnChartAnimator, _super), WebColumnChartAnimator.prototype.animate = function(options) {
|
1234 | var result = {
|
1235 | failed: !0,
|
1236 | shapes: null
|
1237 | }, viewModel = options.viewModel, previousViewModel = this.previousViewModel, dataPointCount = viewModel.categories.length * viewModel.series.length;
|
1238 | return dataPointCount > visuals.AnimatorCommon.MaxDataPointsToAnimate ? result : (previousViewModel && (viewModel.hasHighlights && !previousViewModel.hasHighlights ? result = this.animateNormalToHighlighted(options) : viewModel.hasHighlights && previousViewModel.hasHighlights ? result = this.animateHighlightedToHighlighted(options) : !viewModel.hasHighlights && previousViewModel.hasHighlights && (result = this.animateHighlightedToNormal(options))),
|
1239 | this.previousViewModel = viewModel, result);
|
1240 | }, WebColumnChartAnimator.prototype.animateNormalToHighlighted = function(options) {
|
1241 | var data = options.viewModel, itemCS = options.itemCS, shapeSelection = options.series.selectAll(itemCS.selector), shapes = shapeSelection.data(function(d) {
|
1242 | return d.data;
|
1243 | }, function(d) {
|
1244 | return d.key;
|
1245 | }), hasHighlights = data.hasHighlights;
|
1246 | return shapes.enter().append("rect").attr("class", function(d) {
|
1247 | return itemCS["class"].concat(d.highlight ? " highlight" : "");
|
1248 | }).attr(options.layout.shapeLayoutWithoutHighlights), shapes.style("fill", function(d) {
|
1249 | return d.color;
|
1250 | }).style("fill-opacity", function(d) {
|
1251 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, !1, hasHighlights);
|
1252 | }).transition().duration(this.animationDuration).attr(options.layout.shapeLayout),
|
1253 | shapes.exit().remove(), {
|
1254 | failed: !1,
|
1255 | shapes: shapes
|
1256 | };
|
1257 | }, WebColumnChartAnimator.prototype.animateHighlightedToHighlighted = function(options) {
|
1258 | var shapes = this.animateDefaultShapes(options.viewModel, options.series, options.layout, options.itemCS);
|
1259 | return {
|
1260 | failed: !1,
|
1261 | shapes: shapes
|
1262 | };
|
1263 | }, WebColumnChartAnimator.prototype.animateHighlightedToNormal = function(options) {
|
1264 | var itemCS = options.itemCS, shapeSelection = options.series.selectAll(itemCS.selector), shapes = shapeSelection.data(function(d) {
|
1265 | return d.data;
|
1266 | }, function(d) {
|
1267 | return d.key;
|
1268 | }), hasSelection = options.interactivityService && options.interactivityService.hasSelection();
|
1269 | return shapes.enter().append("rect").attr("class", function(d) {
|
1270 | return itemCS["class"].concat(d.highlight ? " highlight" : "");
|
1271 | }), shapes.style("fill", function(d) {
|
1272 | return d.color;
|
1273 | }).style("fill-opacity", function(d) {
|
1274 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, d.selected, !d.selected);
|
1275 | }).transition().duration(this.animationDuration).attr(options.layout.shapeLayout).transition().duration(0).delay(this.animationDuration).style("fill-opacity", function(d) {
|
1276 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, !1);
|
1277 | }), shapes.exit().transition().duration(this.animationDuration).attr(hasSelection ? options.layout.zeroShapeLayout : options.layout.shapeLayoutWithoutHighlights).remove(),
|
1278 | {
|
1279 | failed: !1,
|
1280 | shapes: shapes
|
1281 | };
|
1282 | }, WebColumnChartAnimator.prototype.animateDefaultShapes = function(data, series, layout, itemCS) {
|
1283 | var shapeSelection = series.selectAll(itemCS.selector), shapes = shapeSelection.data(function(d) {
|
1284 | return d.data;
|
1285 | }, function(d) {
|
1286 | return d.key;
|
1287 | });
|
1288 | return shapes.enter().append("rect").attr("class", function(d) {
|
1289 | return itemCS["class"].concat(d.highlight ? " highlight" : "");
|
1290 | }), shapes.style("fill", function(d) {
|
1291 | return d.color;
|
1292 | }).style("fill-opacity", function(d) {
|
1293 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, !1, data.hasHighlights);
|
1294 | }).transition().duration(this.animationDuration).attr(layout.shapeLayout), shapes.exit().remove(),
|
1295 | shapes;
|
1296 | }, WebColumnChartAnimator;
|
1297 | }(visuals.BaseAnimator);
|
1298 | visuals.WebColumnChartAnimator = WebColumnChartAnimator;
|
1299 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1300 | }(powerbi || (powerbi = {}));
|
1301 | }, function(module, exports) {
|
1302 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
1303 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
1304 | function __() {
|
1305 | this.constructor = d;
|
1306 | }
|
1307 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
1308 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1309 | });
|
1310 | !function(powerbi) {
|
1311 | var visuals;
|
1312 | !function(visuals) {
|
1313 | var WebDonutChartAnimator = function(_super) {
|
1314 | function WebDonutChartAnimator(options) {
|
1315 | _super.call(this, options);
|
1316 | }
|
1317 | return __extends(WebDonutChartAnimator, _super), WebDonutChartAnimator.prototype.animate = function(options) {
|
1318 | var result = {
|
1319 | failed: !0,
|
1320 | shapes: null,
|
1321 | highlightShapes: null
|
1322 | }, viewModel = options.viewModel, previousViewModel = this.previousViewModel;
|
1323 | if (viewModel.highlightsOverflow || previousViewModel && previousViewModel.highlightsOverflow) return this.previousViewModel = viewModel,
|
1324 | result;
|
1325 | var previousHasHighlights = previousViewModel && previousViewModel.hasHighlights, currentHasHighlights = viewModel.hasHighlights;
|
1326 | return previousViewModel && (currentHasHighlights && !previousHasHighlights ? result = this.animateNormalToHighlighted(options) : currentHasHighlights && previousHasHighlights ? result = this.animateHighlightedToHighlighted(options) : !currentHasHighlights && previousHasHighlights && (result = this.animateHighlightedToNormal(options))),
|
1327 | this.previousViewModel = viewModel, result;
|
1328 | }, WebDonutChartAnimator.prototype.animateNormalToHighlighted = function(options) {
|
1329 | var shapes = this.animateDefaultShapes(options), highlightShapes = options.graphicsContext.select(".slices").selectAll("path.slice-highlight").data(options.viewModel.dataPoints.filter(function(value) {
|
1330 | return null != value.data.highlightRatio;
|
1331 | }), function(d) {
|
1332 | return d.data.identity.getKey();
|
1333 | });
|
1334 | return highlightShapes.enter().insert("path").classed("slice-highlight", !0).each(function(d) {
|
1335 | this._current = d;
|
1336 | }), visuals.DonutChart.isSingleColor(options.viewModel.dataPoints.filter(function(value) {
|
1337 | return null != value.data.highlightRatio;
|
1338 | })), highlightShapes.style("fill", function(d) {
|
1339 | return d.data.color ? d.data.color : options.colors.getNewColorScale().getColor(d.data.identity.getKey()).value;
|
1340 | }).style("fill-opacity", function(d) {
|
1341 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !0, !1, options.viewModel.hasHighlights);
|
1342 | }).style("stroke-dasharray", function(d) {
|
1343 | return visuals.DonutChart.drawStrokeForDonutChart(options.radius, options.innerArcRadiusRatio, d, options.sliceWidthRatio, d.data.highlightRatio);
|
1344 | }).style("stroke-width", function(d) {
|
1345 | return d.data.strokeWidth;
|
1346 | }).attr(options.layout.shapeLayout).transition().duration(this.animationDuration).attr(options.layout.highlightShapeLayout),
|
1347 | highlightShapes.exit().remove(), visuals.NewDataLabelUtils.drawDefaultLabels(options.labelGraphicsContext, options.labels, !1, !0, !0),
|
1348 | visuals.NewDataLabelUtils.drawLabelLeaderLines(options.labelGraphicsContext, options.labels),
|
1349 | {
|
1350 | failed: !1,
|
1351 | shapes: shapes,
|
1352 | highlightShapes: highlightShapes
|
1353 | };
|
1354 | }, WebDonutChartAnimator.prototype.animateHighlightedToHighlighted = function(options) {
|
1355 | var shapes = this.animateDefaultShapes(options), highlightShapes = this.animateDefaultHighlightShapes(options);
|
1356 | return visuals.NewDataLabelUtils.drawDefaultLabels(options.labelGraphicsContext, options.labels, !1, !0, !0),
|
1357 | visuals.NewDataLabelUtils.drawLabelLeaderLines(options.labelGraphicsContext, options.labels),
|
1358 | {
|
1359 | failed: !1,
|
1360 | shapes: shapes,
|
1361 | highlightShapes: highlightShapes
|
1362 | };
|
1363 | }, WebDonutChartAnimator.prototype.animateHighlightedToNormal = function(options) {
|
1364 | var hasSelection = options.interactivityService && options.interactivityService.hasSelection(), duration = this.animationDuration, shapes = options.graphicsContext.select(".slices").selectAll("path.slice").data(options.viewModel.dataPoints, function(d) {
|
1365 | return d.data.identity.getKey();
|
1366 | });
|
1367 | shapes.enter().insert("path").classed("slice", !0).each(function(d) {
|
1368 | this._current = d;
|
1369 | }), visuals.DonutChart.isSingleColor(options.viewModel.dataPoints), shapes.style("fill", function(d) {
|
1370 | return d.data.color ? d.data.color : options.colors.getNewColorScale().getColor(d.data.identity.getKey()).value;
|
1371 | }).style("fill-opacity", function(d) {
|
1372 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, d.data.selected, !d.data.selected);
|
1373 | }).style("stroke-dasharray", function(d) {
|
1374 | return visuals.DonutChart.drawStrokeForDonutChart(options.radius, options.innerArcRadiusRatio, d, options.sliceWidthRatio);
|
1375 | }).style("stroke-width", function(d) {
|
1376 | return d.data.strokeWidth;
|
1377 | }).transition().duration(duration).attr(options.layout.shapeLayout).transition().duration(0).delay(duration).style("fill-opacity", function(d) {
|
1378 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, hasSelection, !1);
|
1379 | }), shapes.exit().remove();
|
1380 | var highlightShapes = options.graphicsContext.select(".slices").selectAll("path.slice-highlight").data(options.viewModel.dataPoints.filter(function(value) {
|
1381 | return null != value.data.highlightRatio;
|
1382 | }), function(d) {
|
1383 | return d.data.identity.getKey();
|
1384 | });
|
1385 | return highlightShapes.enter().insert("path").classed("slice-highlight", !0).each(function(d) {
|
1386 | this._current = d;
|
1387 | }), visuals.DonutChart.isSingleColor(options.viewModel.dataPoints.filter(function(value) {
|
1388 | return null != value.data.highlightRatio;
|
1389 | })), highlightShapes.style("fill", function(d) {
|
1390 | return d.data.color ? d.data.color : options.colors.getNewColorScale().getColor(d.data.identity.getKey()).value;
|
1391 | }).style("fill-opacity", function(d) {
|
1392 | return visuals.ColumnUtil.getFillOpacity(!1, !0, !1, !0);
|
1393 | }).style("stroke-dasharray", function(d) {
|
1394 | return visuals.DonutChart.drawStrokeForDonutChart(options.radius, options.innerArcRadiusRatio, d, options.sliceWidthRatio, d.data.highlightRatio);
|
1395 | }).style("stroke-width", function(d) {
|
1396 | return d.data.strokeWidth;
|
1397 | }).transition().duration(duration).attr(hasSelection ? options.layout.zeroShapeLayout : options.layout.shapeLayout).remove(),
|
1398 | highlightShapes.exit().remove(), visuals.NewDataLabelUtils.drawDefaultLabels(options.labelGraphicsContext, options.labels, !1, !0, !0),
|
1399 | visuals.NewDataLabelUtils.drawLabelLeaderLines(options.labelGraphicsContext, options.labels),
|
1400 | {
|
1401 | failed: !1,
|
1402 | shapes: shapes,
|
1403 | highlightShapes: highlightShapes
|
1404 | };
|
1405 | }, WebDonutChartAnimator.prototype.animateDefaultShapes = function(options) {
|
1406 | var shapes = options.graphicsContext.select(".slices").selectAll("path.slice").data(options.viewModel.dataPoints, function(d) {
|
1407 | return d.data.identity.getKey();
|
1408 | });
|
1409 | return shapes.enter().insert("path").classed("slice", !0).each(function(d) {
|
1410 | this._current = d;
|
1411 | }), visuals.DonutChart.isSingleColor(options.viewModel.dataPoints), shapes.style("fill", function(d) {
|
1412 | return d.data.color ? d.data.color : options.colors.getNewColorScale().getColor(d.data.identity.getKey()).value;
|
1413 | }).style("fill-opacity", function(d) {
|
1414 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, !1, options.viewModel.hasHighlights);
|
1415 | }).style("stroke-dasharray", function(d) {
|
1416 | return visuals.DonutChart.drawStrokeForDonutChart(options.radius, options.innerArcRadiusRatio, d, options.sliceWidthRatio);
|
1417 | }).style("stroke-width", function(d) {
|
1418 | return d.data.strokeWidth;
|
1419 | }).transition().duration(this.animationDuration).attr(options.layout.shapeLayout),
|
1420 | shapes.exit().remove(), shapes;
|
1421 | }, WebDonutChartAnimator.prototype.animateDefaultHighlightShapes = function(options) {
|
1422 | var highlightShapes = options.graphicsContext.select(".slices").selectAll("path.slice-highlight").data(options.viewModel.dataPoints.filter(function(value) {
|
1423 | return null != value.data.highlightRatio;
|
1424 | }), function(d) {
|
1425 | return d.data.identity.getKey();
|
1426 | });
|
1427 | return highlightShapes.enter().insert("path").classed("slice-highlight", !0).each(function(d) {
|
1428 | this._current = d;
|
1429 | }), visuals.DonutChart.isSingleColor(options.viewModel.dataPoints.filter(function(value) {
|
1430 | return null != value.data.highlightRatio;
|
1431 | })), highlightShapes.style("fill", function(d) {
|
1432 | return d.data.color ? d.data.color : options.colors.getNewColorScale().getColor(d.data.identity.getKey()).value;
|
1433 | }).style("fill-opacity", function(d) {
|
1434 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !0, !1, options.viewModel.hasHighlights);
|
1435 | }).style("stroke-dasharray", function(d) {
|
1436 | return visuals.DonutChart.drawStrokeForDonutChart(options.radius, options.innerArcRadiusRatio, d, options.sliceWidthRatio, d.data.highlightRatio);
|
1437 | }).style("stroke-width", function(d) {
|
1438 | return d.data.strokeWidth;
|
1439 | }).transition().duration(this.animationDuration).attr(options.layout.highlightShapeLayout),
|
1440 | highlightShapes.exit().remove(), highlightShapes;
|
1441 | }, WebDonutChartAnimator;
|
1442 | }(visuals.BaseAnimator);
|
1443 | visuals.WebDonutChartAnimator = WebDonutChartAnimator;
|
1444 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1445 | }(powerbi || (powerbi = {}));
|
1446 | }, function(module, exports) {
|
1447 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
1448 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
1449 | function __() {
|
1450 | this.constructor = d;
|
1451 | }
|
1452 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
1453 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1454 | });
|
1455 | !function(powerbi) {
|
1456 | var visuals;
|
1457 | !function(visuals) {
|
1458 | var WebFunnelAnimator = function(_super) {
|
1459 | function WebFunnelAnimator(options) {
|
1460 | _super.call(this, options);
|
1461 | }
|
1462 | return __extends(WebFunnelAnimator, _super), WebFunnelAnimator.prototype.animate = function(options) {
|
1463 | var result = {
|
1464 | failed: !0,
|
1465 | shapes: null,
|
1466 | dataLabels: null
|
1467 | }, viewModel = options.viewModel, previousViewModel = this.previousViewModel;
|
1468 | return previousViewModel && (viewModel.hasHighlights && !previousViewModel.hasHighlights ? result = this.animateNormalToHighlighted(options) : viewModel.hasHighlights && previousViewModel.hasHighlights ? result = this.animateHighlightedToHighlighted(options) : !viewModel.hasHighlights && previousViewModel.hasHighlights && (result = this.animateHighlightedToNormal(options))),
|
1469 | this.previousViewModel = viewModel, result;
|
1470 | }, WebFunnelAnimator.prototype.animateNormalToHighlighted = function(options) {
|
1471 | var data = options.viewModel, layout = options.layout, hasHighlights = !0, hasSelection = !1;
|
1472 | this.animateDefaultAxis(options.axisGraphicsContext, options.axisOptions, options.isHidingPercentBars);
|
1473 | var shapes = options.shapeGraphicsContext.selectAll(visuals.FunnelChart.Selectors.funnel.bars.selector).data(data.dataPoints, function(d) {
|
1474 | return d.key;
|
1475 | });
|
1476 | shapes.enter().append("rect").attr("class", function(d) {
|
1477 | return d.highlight ? visuals.FunnelChart.FunnelBarHighlightClass : visuals.FunnelChart.Selectors.funnel.bars["class"];
|
1478 | }).attr(layout.shapeLayoutWithoutHighlights), shapes.style("fill", function(d) {
|
1479 | return d.color;
|
1480 | }).style("fill-opacity", function(d) {
|
1481 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, hasHighlights);
|
1482 | }).transition().duration(this.animationDuration).attr(layout.shapeLayout), shapes.exit().remove(),
|
1483 | this.animatePercentBars(options);
|
1484 | var dataLabels = visuals.NewDataLabelUtils.animateDefaultLabels(options.labelGraphicsContext, options.labelLayout, this.animationDuration);
|
1485 | return {
|
1486 | failed: !1,
|
1487 | shapes: shapes,
|
1488 | dataLabels: dataLabels
|
1489 | };
|
1490 | }, WebFunnelAnimator.prototype.animateHighlightedToHighlighted = function(options) {
|
1491 | var data = options.viewModel, layout = options.layout;
|
1492 | this.animateDefaultAxis(options.axisGraphicsContext, options.axisOptions, options.isHidingPercentBars);
|
1493 | var shapes = this.animateDefaultShapes(data, data.dataPoints, options.shapeGraphicsContext, layout);
|
1494 | this.animatePercentBars(options);
|
1495 | var dataLabels = visuals.NewDataLabelUtils.animateDefaultLabels(options.labelGraphicsContext, options.labelLayout, this.animationDuration);
|
1496 | return {
|
1497 | failed: !1,
|
1498 | shapes: shapes,
|
1499 | dataLabels: dataLabels
|
1500 | };
|
1501 | }, WebFunnelAnimator.prototype.animateHighlightedToNormal = function(options) {
|
1502 | var data = options.viewModel, layout = options.layout, hasSelection = options.interactivityService ? options.interactivityService.hasSelection() : !1;
|
1503 | this.animateDefaultAxis(options.axisGraphicsContext, options.axisOptions, options.isHidingPercentBars);
|
1504 | var shapes = options.shapeGraphicsContext.selectAll(visuals.FunnelChart.Selectors.funnel.bars.selector).data(data.dataPoints, function(d) {
|
1505 | return d.key;
|
1506 | });
|
1507 | shapes.enter().append("rect").attr("class", function(d) {
|
1508 | return d.highlight ? visuals.FunnelChart.FunnelBarHighlightClass : visuals.FunnelChart.Selectors.funnel.bars["class"];
|
1509 | }), shapes.style("fill", function(d) {
|
1510 | return d.color;
|
1511 | }).style("fill-opacity", function(d) {
|
1512 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, !d.selected);
|
1513 | }).transition().duration(this.animationDuration).attr(layout.shapeLayoutWithoutHighlights).transition().duration(0).delay(this.animationDuration).style("fill-opacity", function(d) {
|
1514 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, !1);
|
1515 | });
|
1516 | var exitShapes = shapes.exit();
|
1517 | exitShapes.transition().duration(this.animationDuration).attr(hasSelection ? layout.zeroShapeLayout : layout.shapeLayoutWithoutHighlights).remove(),
|
1518 | this.animatePercentBars(options);
|
1519 | var dataLabels = visuals.NewDataLabelUtils.animateDefaultLabels(options.labelGraphicsContext, options.labelLayout, this.animationDuration);
|
1520 | return {
|
1521 | failed: !1,
|
1522 | shapes: shapes,
|
1523 | dataLabels: dataLabels
|
1524 | };
|
1525 | }, WebFunnelAnimator.prototype.animateDefaultAxis = function(graphicsContext, axisOptions, isHidingPercentBars) {
|
1526 | var xScaleForAxis = d3.scale.ordinal().domain(axisOptions.categoryLabels).rangeBands([ axisOptions.rangeStart, axisOptions.rangeEnd ], axisOptions.barToSpaceRatio, isHidingPercentBars ? axisOptions.barToSpaceRatio : visuals.FunnelChart.PercentBarToBarRatio), xAxis = d3.svg.axis().scale(xScaleForAxis).orient("right").tickPadding(visuals.FunnelChart.TickPadding).innerTickSize(visuals.FunnelChart.InnerTickSize);
|
1527 | graphicsContext.classed("axis", !0).transition().duration(this.animationDuration).attr("transform", visuals.SVGUtil.translate(0, axisOptions.margin.top)).call(xAxis);
|
1528 | }, WebFunnelAnimator.prototype.animateDefaultShapes = function(data, dataPoints, graphicsContext, layout) {
|
1529 | var hasHighlights = data.hasHighlights, shapes = graphicsContext.selectAll(visuals.FunnelChart.Selectors.funnel.bars.selector).data(dataPoints, function(d) {
|
1530 | return d.key;
|
1531 | });
|
1532 | return shapes.enter().append("rect").attr("class", function(d) {
|
1533 | return d.highlight ? visuals.FunnelChart.FunnelBarHighlightClass : visuals.FunnelChart.Selectors.funnel.bars["class"];
|
1534 | }), shapes.style("fill", function(d) {
|
1535 | return d.color;
|
1536 | }).style("fill-opacity", function(d) {
|
1537 | return function(d) {
|
1538 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, !1, hasHighlights);
|
1539 | };
|
1540 | }).transition().duration(this.animationDuration).attr(layout.shapeLayout), shapes.exit().remove(),
|
1541 | shapes;
|
1542 | }, WebFunnelAnimator.prototype.animatePercentBars = function(options) {
|
1543 | var data = options.viewModel, isHidingPercentBars = options.isHidingPercentBars;
|
1544 | if (isHidingPercentBars || !data.dataPoints || (data.hasHighlights ? data.dataPoints.length / 2 : data.dataPoints.length) < 2) return void this.animatePercentBarComponents([], options);
|
1545 | var dataPoints = [ data.dataPoints[data.hasHighlights ? 1 : 0], data.dataPoints[data.dataPoints.length - 1] ], baseline = visuals.FunnelChart.getValueFromDataPoint(dataPoints[0]);
|
1546 | if (0 >= baseline) return void this.animatePercentBarComponents([], options);
|
1547 | var percentData = dataPoints.map(function(dataPoint, i) {
|
1548 | return {
|
1549 | value: visuals.FunnelChart.getValueFromDataPoint(dataPoint),
|
1550 | percent: 0 === i ? 1 : visuals.FunnelChart.getValueFromDataPoint(dataPoint) / baseline,
|
1551 | isTop: 0 === i
|
1552 | };
|
1553 | });
|
1554 | this.animatePercentBarComponents(percentData, options);
|
1555 | }, WebFunnelAnimator.prototype.animateToFunnelPercent = function(context, targetData, layout) {
|
1556 | return context.data(targetData).transition().duration(this.animationDuration).attr(layout);
|
1557 | }, WebFunnelAnimator.prototype.animatePercentBarComponents = function(data, options) {
|
1558 | var graphicsContext = options.percentGraphicsContext, layout = options.layout, zeroData = [ {
|
1559 | percent: 0,
|
1560 | value: 0,
|
1561 | isTop: !0
|
1562 | }, {
|
1563 | percent: 0,
|
1564 | value: 0,
|
1565 | isTop: !1
|
1566 | } ], mainLine = graphicsContext.selectAll(visuals.FunnelChart.Selectors.percentBar.mainLine.selector).data(data);
|
1567 | this.animateToFunnelPercent(mainLine.exit(), zeroData, layout.percentBarLayout.mainLine).remove(),
|
1568 | mainLine.enter().append("line").classed(visuals.FunnelChart.Selectors.percentBar.mainLine["class"], !0).data(zeroData).attr(layout.percentBarLayout.mainLine),
|
1569 | this.animateToFunnelPercent(mainLine, data, layout.percentBarLayout.mainLine);
|
1570 | var leftTick = graphicsContext.selectAll(visuals.FunnelChart.Selectors.percentBar.leftTick.selector).data(data);
|
1571 | this.animateToFunnelPercent(leftTick.exit(), zeroData, layout.percentBarLayout.leftTick).remove(),
|
1572 | leftTick.enter().append("line").classed(visuals.FunnelChart.Selectors.percentBar.leftTick["class"], !0).data(zeroData).attr(layout.percentBarLayout.leftTick),
|
1573 | this.animateToFunnelPercent(leftTick, data, layout.percentBarLayout.leftTick);
|
1574 | var rightTick = graphicsContext.selectAll(visuals.FunnelChart.Selectors.percentBar.rightTick.selector).data(data);
|
1575 | this.animateToFunnelPercent(rightTick.exit(), zeroData, layout.percentBarLayout.rightTick).remove(),
|
1576 | rightTick.enter().append("line").classed(visuals.FunnelChart.Selectors.percentBar.rightTick["class"], !0).data(zeroData).attr(layout.percentBarLayout.rightTick),
|
1577 | this.animateToFunnelPercent(rightTick, data, layout.percentBarLayout.rightTick);
|
1578 | var text = graphicsContext.selectAll(visuals.FunnelChart.Selectors.percentBar.text.selector).data(data);
|
1579 | this.animateToFunnelPercent(text.exit(), zeroData, layout.percentBarLayout.text).remove(),
|
1580 | text.enter().append("text").classed(visuals.FunnelChart.Selectors.percentBar.text["class"], !0).data(zeroData).attr(layout.percentBarLayout.text),
|
1581 | this.animateToFunnelPercent(text, data, layout.percentBarLayout.text).text(function(fp) {
|
1582 | return powerbi.formattingService.formatValue(fp.percent, visuals.valueFormatter.getLocalizedString("Percentage1"));
|
1583 | }), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(options.visualInitOptions);
|
1584 | }, WebFunnelAnimator;
|
1585 | }(visuals.BaseAnimator);
|
1586 | visuals.WebFunnelAnimator = WebFunnelAnimator;
|
1587 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1588 | }(powerbi || (powerbi = {}));
|
1589 | }, function(module, exports) {
|
1590 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
1591 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
1592 | function __() {
|
1593 | this.constructor = d;
|
1594 | }
|
1595 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
1596 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1597 | });
|
1598 | !function(powerbi) {
|
1599 | var visuals;
|
1600 | !function(visuals) {
|
1601 | var WebTreemapAnimator = function(_super) {
|
1602 | function WebTreemapAnimator(options) {
|
1603 | _super.call(this, options);
|
1604 | }
|
1605 | return __extends(WebTreemapAnimator, _super), WebTreemapAnimator.prototype.animate = function(options) {
|
1606 | var result = {
|
1607 | failed: !0,
|
1608 | shapes: null,
|
1609 | highlightShapes: null,
|
1610 | majorLabels: null,
|
1611 | minorLabels: null
|
1612 | }, viewModel = options.viewModel, previousViewModel = this.previousViewModel;
|
1613 | return previousViewModel && (viewModel.hasHighlights && !previousViewModel.hasHighlights ? result = this.animateNormalToHighlighted(options) : viewModel.hasHighlights && previousViewModel.hasHighlights ? result = this.animateHighlightedToHighlighted(options) : !viewModel.hasHighlights && previousViewModel.hasHighlights && (result = this.animateHighlightedToNormal(options))),
|
1614 | this.previousViewModel = viewModel, result;
|
1615 | }, WebTreemapAnimator.prototype.animateNormalToHighlighted = function(options) {
|
1616 | var hasSelection = !1, hasHighlights = !0, shapes = this.animateDefaultShapes(options.shapeGraphicsContext, options.nodes, hasSelection, hasHighlights, options.layout), highlightShapes = options.shapeGraphicsContext.selectAll("." + visuals.Treemap.HighlightNodeClassName).data(options.highlightNodes, function(d) {
|
1617 | return d.key + "highlight";
|
1618 | });
|
1619 | highlightShapes.enter().append("rect").attr("class", options.layout.highlightShapeClass).attr(options.layout.shapeLayout),
|
1620 | highlightShapes.style("fill", function(d) {
|
1621 | return visuals.Treemap.getFill(d, !0);
|
1622 | }).style("fill-opacity", function(d) {
|
1623 | return visuals.Treemap.getFillOpacity(d, hasSelection, hasHighlights, !0);
|
1624 | }).transition().duration(this.animationDuration).attr(options.layout.highlightShapeLayout),
|
1625 | highlightShapes.exit().remove();
|
1626 | var majorLabels = this.animateDefaultMajorLabels(options.labelGraphicsContext, options.majorLabeledNodes, options.labelSettings, options.layout), minorLabels = this.animateDefaultMinorLabels(options.labelGraphicsContext, options.minorLabeledNodes, options.labelSettings, options.layout);
|
1627 | return {
|
1628 | failed: !1,
|
1629 | shapes: shapes,
|
1630 | highlightShapes: highlightShapes,
|
1631 | majorLabels: majorLabels,
|
1632 | minorLabels: minorLabels
|
1633 | };
|
1634 | }, WebTreemapAnimator.prototype.animateHighlightedToHighlighted = function(options) {
|
1635 | var hasSelection = !1, hasHighlights = !0, shapes = this.animateDefaultShapes(options.shapeGraphicsContext, options.nodes, hasSelection, hasHighlights, options.layout);
|
1636 | options.shapeGraphicsContext.selectAll("." + visuals.Treemap.HighlightNodeClassName).data(options.highlightNodes, function(d) {
|
1637 | return d.key + "highlight";
|
1638 | });
|
1639 | var highlightShapes = this.animateDefaultHighlightShapes(options.shapeGraphicsContext, options.highlightNodes, hasSelection, hasHighlights, options.layout), majorLabels = this.animateDefaultMajorLabels(options.labelGraphicsContext, options.majorLabeledNodes, options.labelSettings, options.layout), minorLabels = this.animateDefaultMinorLabels(options.labelGraphicsContext, options.minorLabeledNodes, options.labelSettings, options.layout);
|
1640 | return {
|
1641 | failed: !1,
|
1642 | shapes: shapes,
|
1643 | highlightShapes: highlightShapes,
|
1644 | majorLabels: majorLabels,
|
1645 | minorLabels: minorLabels
|
1646 | };
|
1647 | }, WebTreemapAnimator.prototype.animateHighlightedToNormal = function(options) {
|
1648 | var hasSelection = options.interactivityService ? options.interactivityService.hasSelection() : !1, shapes = options.shapeGraphicsContext.selectAll("." + visuals.Treemap.TreemapNodeClassName).data(options.nodes, function(d) {
|
1649 | return d.key;
|
1650 | });
|
1651 | shapes.enter().append("rect").attr("class", options.layout.shapeClass), shapes.transition().duration(this.animationDuration).style("fill", function(d) {
|
1652 | return visuals.Treemap.getFill(d, !1);
|
1653 | }).style("fill-opacity", function(d) {
|
1654 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, d.selected, !d.selected);
|
1655 | }).attr(options.layout.shapeLayout).transition().duration(0).delay(this.animationDuration).style("fill-opacity", function(d) {
|
1656 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
1657 | }), shapes.exit().remove();
|
1658 | var highlightShapes = options.shapeGraphicsContext.selectAll("." + visuals.Treemap.HighlightNodeClassName).data(options.nodes, function(d) {
|
1659 | return d.key + "highlight";
|
1660 | });
|
1661 | highlightShapes.enter().append("rect").attr("class", options.layout.highlightShapeClass),
|
1662 | highlightShapes.style("fill", function(d) {
|
1663 | return visuals.Treemap.getFill(d, !0);
|
1664 | }).style("fill-opacity", function(d) {
|
1665 | return visuals.ColumnUtil.getFillOpacity(d.selected, !0, d.selected, !d.selected);
|
1666 | }).transition().duration(this.animationDuration).attr(hasSelection ? options.layout.zeroShapeLayout : options.layout.shapeLayout).remove(),
|
1667 | highlightShapes.exit().remove();
|
1668 | var majorLabels = this.animateDefaultMajorLabels(options.labelGraphicsContext, options.majorLabeledNodes, options.labelSettings, options.layout), minorLabels = this.animateDefaultMinorLabels(options.labelGraphicsContext, options.minorLabeledNodes, options.labelSettings, options.layout);
|
1669 | return {
|
1670 | failed: !1,
|
1671 | shapes: shapes,
|
1672 | highlightShapes: highlightShapes,
|
1673 | majorLabels: majorLabels,
|
1674 | minorLabels: minorLabels
|
1675 | };
|
1676 | }, WebTreemapAnimator.prototype.animateDefaultShapes = function(context, nodes, hasSelection, hasHighlights, layout) {
|
1677 | var isHighlightShape = !1, shapes = context.selectAll("." + visuals.Treemap.TreemapNodeClassName).data(nodes, function(d) {
|
1678 | return d.key;
|
1679 | });
|
1680 | return shapes.enter().append("rect").attr("class", layout.shapeClass), shapes.transition().duration(this.animationDuration).style("fill", function(d) {
|
1681 | return visuals.Treemap.getFill(d, isHighlightShape);
|
1682 | }).style("fill-opacity", function(d) {
|
1683 | return visuals.Treemap.getFillOpacity(d, hasSelection, hasHighlights, isHighlightShape);
|
1684 | }).attr(layout.shapeLayout), shapes.exit().remove(), shapes;
|
1685 | }, WebTreemapAnimator.prototype.animateDefaultHighlightShapes = function(context, nodes, hasSelection, hasHighlights, layout) {
|
1686 | var isHighlightShape = !0, highlightShapes = context.selectAll("." + visuals.Treemap.HighlightNodeClassName).data(nodes, function(d) {
|
1687 | return d.key + "highlight";
|
1688 | });
|
1689 | return highlightShapes.enter().append("rect").attr("class", layout.highlightShapeClass),
|
1690 | highlightShapes.transition().duration(this.animationDuration).style("fill", function(d) {
|
1691 | return visuals.Treemap.getFill(d, isHighlightShape);
|
1692 | }).style("fill-opacity", function(d) {
|
1693 | return visuals.Treemap.getFillOpacity(d, hasSelection, hasHighlights, isHighlightShape);
|
1694 | }).attr(layout.highlightShapeLayout), highlightShapes.exit().remove(), highlightShapes;
|
1695 | }, WebTreemapAnimator.prototype.animateDefaultMajorLabels = function(context, nodes, labelSettings, layout) {
|
1696 | var labels = context.selectAll("." + visuals.Treemap.MajorLabelClassName).data(nodes, function(d) {
|
1697 | return d.key;
|
1698 | });
|
1699 | return labels.enter().append("text").attr("class", layout.majorLabelClass), labels.text(layout.majorLabelText).style("fill", function() {
|
1700 | return labelSettings.labelColor;
|
1701 | }).transition().duration(this.animationDuration).attr(layout.majorLabelLayout),
|
1702 | labels.exit().remove(), labels;
|
1703 | }, WebTreemapAnimator.prototype.animateDefaultMinorLabels = function(context, nodes, labelSettings, layout) {
|
1704 | var labels = context.selectAll("." + visuals.Treemap.MinorLabelClassName).data(nodes, function(d) {
|
1705 | return d.key;
|
1706 | });
|
1707 | return labels.enter().append("text").attr("class", layout.minorLabelClass), labels.text(layout.minorLabelText).style("fill", function() {
|
1708 | return labelSettings.labelColor;
|
1709 | }).transition().duration(this.animationDuration).attr(layout.minorLabelLayout),
|
1710 | labels.exit().remove(), labels;
|
1711 | }, WebTreemapAnimator;
|
1712 | }(visuals.BaseAnimator);
|
1713 | visuals.WebTreemapAnimator = WebTreemapAnimator;
|
1714 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1715 | }(powerbi || (powerbi = {}));
|
1716 | }, function(module, exports) {
|
1717 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
1718 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
1719 | !function(powerbi) {
|
1720 | var visuals;
|
1721 | !function(visuals) {
|
1722 | visuals.StandardObjectProperties = {
|
1723 | axisEnd: {
|
1724 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_End"),
|
1725 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_EndDescription"),
|
1726 | placeHolderText: powerbi.data.createDisplayNameGetter("Visual_Precision_Auto"),
|
1727 | type: {
|
1728 | numeric: !0
|
1729 | },
|
1730 | suppressFormatPainterCopy: !0
|
1731 | },
|
1732 | axisScale: {
|
1733 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Scale"),
|
1734 | type: {
|
1735 | enumeration: visuals.axisScale.type
|
1736 | }
|
1737 | },
|
1738 | axisStart: {
|
1739 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Start"),
|
1740 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_StartDescription"),
|
1741 | placeHolderText: powerbi.data.createDisplayNameGetter("Visual_Precision_Auto"),
|
1742 | type: {
|
1743 | numeric: !0
|
1744 | },
|
1745 | suppressFormatPainterCopy: !0
|
1746 | },
|
1747 | axisStyle: {
|
1748 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Style"),
|
1749 | type: {
|
1750 | enumeration: visuals.axisStyle.type
|
1751 | }
|
1752 | },
|
1753 | axisType: {
|
1754 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Type"),
|
1755 | type: {
|
1756 | enumeration: visuals.axisType.type
|
1757 | }
|
1758 | },
|
1759 | backColor: {
|
1760 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColor"),
|
1761 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColor_Desc"),
|
1762 | type: {
|
1763 | fill: {
|
1764 | solid: {
|
1765 | color: !0
|
1766 | }
|
1767 | }
|
1768 | }
|
1769 | },
|
1770 | dataColor: {
|
1771 | displayName: powerbi.data.createDisplayNameGetter("Visual_LabelsFill"),
|
1772 | description: powerbi.data.createDisplayNameGetter("Visual_LabelsFillDescription"),
|
1773 | type: {
|
1774 | fill: {
|
1775 | solid: {
|
1776 | color: !0
|
1777 | }
|
1778 | }
|
1779 | }
|
1780 | },
|
1781 | dataLabelColor: {
|
1782 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Label_Color"),
|
1783 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Label_Color_Description"),
|
1784 | type: {
|
1785 | fill: {
|
1786 | solid: {
|
1787 | color: !0
|
1788 | }
|
1789 | }
|
1790 | }
|
1791 | },
|
1792 | dataLabelDecimalPoints: {
|
1793 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Decimal_Points"),
|
1794 | placeHolderText: powerbi.data.createDisplayNameGetter("Visual_Precision_Auto"),
|
1795 | type: {
|
1796 | numeric: !0
|
1797 | }
|
1798 | },
|
1799 | dataLabelDisplayUnits: {
|
1800 | displayName: powerbi.data.createDisplayNameGetter("Visual_DisplayUnits"),
|
1801 | description: powerbi.data.createDisplayNameGetter("Visual_DisplayUnitsDescription"),
|
1802 | type: {
|
1803 | formatting: {
|
1804 | labelDisplayUnits: !0
|
1805 | }
|
1806 | },
|
1807 | suppressFormatPainterCopy: !0
|
1808 | },
|
1809 | dataLabelHorizontalPosition: {
|
1810 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Horizontal_Position"),
|
1811 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Label_Horizontal_Position_Description"),
|
1812 | type: {
|
1813 | enumeration: visuals.referenceLineDataLabelHorizontalPosition.type
|
1814 | }
|
1815 | },
|
1816 | dataLabelShow: {
|
1817 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Label"),
|
1818 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Label_Show_Description"),
|
1819 | type: {
|
1820 | bool: !0
|
1821 | }
|
1822 | },
|
1823 | dataLabelVerticalPosition: {
|
1824 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Vertical_Position"),
|
1825 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Label_Vertical_Position_Description"),
|
1826 | type: {
|
1827 | enumeration: visuals.referenceLineDataLabelVerticalPosition.type
|
1828 | }
|
1829 | },
|
1830 | defaultColor: {
|
1831 | displayName: powerbi.data.createDisplayNameGetter("Visual_DefaultColor"),
|
1832 | type: {
|
1833 | fill: {
|
1834 | solid: {
|
1835 | color: !0
|
1836 | }
|
1837 | }
|
1838 | }
|
1839 | },
|
1840 | fill: {
|
1841 | displayName: powerbi.data.createDisplayNameGetter("Visual_Fill"),
|
1842 | type: {
|
1843 | fill: {
|
1844 | solid: {
|
1845 | color: !0
|
1846 | }
|
1847 | }
|
1848 | }
|
1849 | },
|
1850 | fontColor: {
|
1851 | displayName: powerbi.data.createDisplayNameGetter("Visual_FontColor"),
|
1852 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColor_Desc"),
|
1853 | type: {
|
1854 | fill: {
|
1855 | solid: {
|
1856 | color: !0
|
1857 | }
|
1858 | }
|
1859 | }
|
1860 | },
|
1861 | fontSize: {
|
1862 | displayName: powerbi.data.createDisplayNameGetter("Visual_TextSize"),
|
1863 | type: {
|
1864 | formatting: {
|
1865 | fontSize: !0
|
1866 | }
|
1867 | }
|
1868 | },
|
1869 | formatString: {
|
1870 | type: {
|
1871 | formatting: {
|
1872 | formatString: !0
|
1873 | }
|
1874 | }
|
1875 | },
|
1876 | image: {
|
1877 | type: {
|
1878 | image: {}
|
1879 | }
|
1880 | },
|
1881 | labelColor: {
|
1882 | displayName: powerbi.data.createDisplayNameGetter("Visual_LegendTitleColor"),
|
1883 | type: {
|
1884 | fill: {
|
1885 | solid: {
|
1886 | color: !0
|
1887 | }
|
1888 | }
|
1889 | }
|
1890 | },
|
1891 | labelDisplayUnits: {
|
1892 | displayName: powerbi.data.createDisplayNameGetter("Visual_DisplayUnits"),
|
1893 | description: powerbi.data.createDisplayNameGetter("Visual_DisplayUnitsDescription"),
|
1894 | type: {
|
1895 | formatting: {
|
1896 | labelDisplayUnits: !0
|
1897 | }
|
1898 | }
|
1899 | },
|
1900 | labelPrecision: {
|
1901 | displayName: powerbi.data.createDisplayNameGetter("Visual_Precision"),
|
1902 | description: powerbi.data.createDisplayNameGetter("Visual_PrecisionDescription"),
|
1903 | placeHolderText: powerbi.data.createDisplayNameGetter("Visual_Precision_Auto"),
|
1904 | type: {
|
1905 | numeric: !0
|
1906 | }
|
1907 | },
|
1908 | legendPosition: {
|
1909 | displayName: powerbi.data.createDisplayNameGetter("Visual_LegendPosition"),
|
1910 | description: powerbi.data.createDisplayNameGetter("Visual_LegendPositionDescription"),
|
1911 | type: {
|
1912 | enumeration: visuals.legendPosition.type
|
1913 | }
|
1914 | },
|
1915 | legendTitle: {
|
1916 | displayName: powerbi.data.createDisplayNameGetter("Visual_LegendName"),
|
1917 | description: powerbi.data.createDisplayNameGetter("Visual_LegendNameDescription"),
|
1918 | type: {
|
1919 | text: !0
|
1920 | }
|
1921 | },
|
1922 | lineColor: {
|
1923 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Color"),
|
1924 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Color_Description"),
|
1925 | type: {
|
1926 | fill: {
|
1927 | solid: {
|
1928 | color: !0
|
1929 | }
|
1930 | }
|
1931 | }
|
1932 | },
|
1933 | outline: {
|
1934 | displayName: powerbi.data.createDisplayNameGetter("Visual_Outline"),
|
1935 | type: {
|
1936 | enumeration: visuals.outline.type
|
1937 | }
|
1938 | },
|
1939 | outlineColor: {
|
1940 | displayName: powerbi.data.createDisplayNameGetter("Visual_OutlineColor"),
|
1941 | description: powerbi.data.createDisplayNameGetter("Visual_OutlineColor_Desc"),
|
1942 | type: {
|
1943 | fill: {
|
1944 | solid: {
|
1945 | color: !0
|
1946 | }
|
1947 | }
|
1948 | }
|
1949 | },
|
1950 | outlineWeight: {
|
1951 | displayName: powerbi.data.createDisplayNameGetter("Visual_OutlineWeight"),
|
1952 | description: powerbi.data.createDisplayNameGetter("Visual_OutlineWeight_Desc"),
|
1953 | type: {
|
1954 | numeric: !0
|
1955 | }
|
1956 | },
|
1957 | show: {
|
1958 | displayName: powerbi.data.createDisplayNameGetter("Visual_Show"),
|
1959 | type: {
|
1960 | bool: !0
|
1961 | }
|
1962 | },
|
1963 | showAllDataPoints: {
|
1964 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint_Show_All"),
|
1965 | type: {
|
1966 | bool: !0
|
1967 | }
|
1968 | },
|
1969 | showLegendTitle: {
|
1970 | displayName: powerbi.data.createDisplayNameGetter("Visual_LegendShowTitle"),
|
1971 | description: powerbi.data.createDisplayNameGetter("Visual_LegendShowTitleDescription"),
|
1972 | type: {
|
1973 | bool: !0
|
1974 | }
|
1975 | },
|
1976 | referenceLinePosition: {
|
1977 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Arrange"),
|
1978 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Arrange_Description"),
|
1979 | type: {
|
1980 | enumeration: visuals.referenceLinePosition.type
|
1981 | }
|
1982 | },
|
1983 | referenceLineStyle: {
|
1984 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Style"),
|
1985 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Style_Description"),
|
1986 | type: {
|
1987 | enumeration: visuals.lineStyle.type
|
1988 | }
|
1989 | },
|
1990 | transparency: {
|
1991 | displayName: powerbi.data.createDisplayNameGetter("Visual_Background_Transparency"),
|
1992 | description: powerbi.data.createDisplayNameGetter("Visual_Background_TransparencyDescription"),
|
1993 | type: {
|
1994 | numeric: !0
|
1995 | }
|
1996 | },
|
1997 | yAxisPosition: {
|
1998 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis_Position"),
|
1999 | description: powerbi.data.createDisplayNameGetter("Visual_YAxis_PositionDescription"),
|
2000 | type: {
|
2001 | enumeration: visuals.yAxisPosition.type
|
2002 | }
|
2003 | }
|
2004 | };
|
2005 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
2006 | }(powerbi || (powerbi = {}));
|
2007 | }, function(module, exports) {
|
2008 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
2009 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
2010 | !function(powerbi) {
|
2011 | var visuals;
|
2012 | !function(visuals) {
|
2013 | visuals.animatedTextObjectDescs = {
|
2014 | general: {
|
2015 | properties: {
|
2016 | formatString: visuals.StandardObjectProperties.formatString
|
2017 | }
|
2018 | }
|
2019 | }, visuals.animatedNumberCapabilities = {
|
2020 | objects: visuals.animatedTextObjectDescs,
|
2021 | dataViewMappings: [ {
|
2022 | single: {
|
2023 | role: "Values"
|
2024 | }
|
2025 | } ],
|
2026 | supportsSelection: !1
|
2027 | };
|
2028 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
2029 | }(powerbi || (powerbi = {}));
|
2030 | }, function(module, exports) {
|
2031 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
2032 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
2033 | !function(powerbi) {
|
2034 | var visuals;
|
2035 | !function(visuals) {
|
2036 | visuals.basicShapeCapabilities = {
|
2037 | objects: {
|
2038 | line: {
|
2039 | displayName: powerbi.data.createDisplayNameGetter("Visual_BasicShape_Line"),
|
2040 | properties: {
|
2041 | lineColor: {
|
2042 | displayName: powerbi.data.createDisplayNameGetter("Visual_BasicShape_LineColor"),
|
2043 | type: {
|
2044 | fill: {
|
2045 | solid: {
|
2046 | color: !0
|
2047 | }
|
2048 | }
|
2049 | }
|
2050 | },
|
2051 | transparency: visuals.StandardObjectProperties.transparency,
|
2052 | weight: {
|
2053 | displayName: powerbi.data.createDisplayNameGetter("Visual_BasicShape_Weight"),
|
2054 | type: {
|
2055 | numeric: !0
|
2056 | }
|
2057 | },
|
2058 | roundEdge: {
|
2059 | displayName: powerbi.data.createDisplayNameGetter("Visual_BasicShape_RoundEdges"),
|
2060 | type: {
|
2061 | numeric: !0
|
2062 | }
|
2063 | }
|
2064 | }
|
2065 | },
|
2066 | fill: {
|
2067 | displayName: powerbi.data.createDisplayNameGetter("Visual_Fill"),
|
2068 | properties: {
|
2069 | show: visuals.StandardObjectProperties.show,
|
2070 | fillColor: {
|
2071 | displayName: powerbi.data.createDisplayNameGetter("Visual_BasicShape_FillColor"),
|
2072 | type: {
|
2073 | fill: {
|
2074 | solid: {
|
2075 | color: !0
|
2076 | }
|
2077 | }
|
2078 | }
|
2079 | },
|
2080 | transparency: visuals.StandardObjectProperties.transparency
|
2081 | }
|
2082 | },
|
2083 | rotation: {
|
2084 | displayName: powerbi.data.createDisplayNameGetter("Visual_BasicShape_Rotate"),
|
2085 | properties: {
|
2086 | angle: {
|
2087 | displayName: powerbi.data.createDisplayNameGetter("Visual_BasicShape_Rotate"),
|
2088 | type: {
|
2089 | numeric: !0
|
2090 | }
|
2091 | }
|
2092 | }
|
2093 | },
|
2094 | general: {
|
2095 | properties: {
|
2096 | shapeType: {
|
2097 | type: {
|
2098 | text: !0
|
2099 | },
|
2100 | suppressFormatPainterCopy: !0
|
2101 | }
|
2102 | }
|
2103 | }
|
2104 | },
|
2105 | suppressDefaultTitle: !0,
|
2106 | suppressDefaultPadding: !0,
|
2107 | canRotate: !1,
|
2108 | supportsSelection: !1
|
2109 | }, visuals.basicShapeProps = {
|
2110 | general: {
|
2111 | shapeType: {
|
2112 | objectName: "general",
|
2113 | propertyName: "shapeType"
|
2114 | }
|
2115 | },
|
2116 | line: {
|
2117 | transparency: {
|
2118 | objectName: "line",
|
2119 | propertyName: "transparency"
|
2120 | },
|
2121 | weight: {
|
2122 | objectName: "line",
|
2123 | propertyName: "weight"
|
2124 | },
|
2125 | roundEdge: {
|
2126 | objectName: "line",
|
2127 | propertyName: "roundEdge"
|
2128 | },
|
2129 | lineColor: {
|
2130 | objectName: "line",
|
2131 | propertyName: "lineColor"
|
2132 | }
|
2133 | },
|
2134 | fill: {
|
2135 | transparency: {
|
2136 | objectName: "fill",
|
2137 | propertyName: "transparency"
|
2138 | },
|
2139 | fillColor: {
|
2140 | objectName: "fill",
|
2141 | propertyName: "fillColor"
|
2142 | },
|
2143 | show: {
|
2144 | objectName: "fill",
|
2145 | propertyName: "show"
|
2146 | }
|
2147 | },
|
2148 | rotation: {
|
2149 | angle: {
|
2150 | objectName: "rotation",
|
2151 | propertyName: "angle"
|
2152 | }
|
2153 | }
|
2154 | };
|
2155 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
2156 | }(powerbi || (powerbi = {}));
|
2157 | }, function(module, exports) {
|
2158 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
2159 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
2160 | !function(powerbi) {
|
2161 | var visuals;
|
2162 | !function(visuals) {
|
2163 | function getColumnChartCapabilities(transposeAxes) {
|
2164 | return void 0 === transposeAxes && (transposeAxes = !1), {
|
2165 | dataRoles: [ {
|
2166 | name: "Category",
|
2167 | kind: powerbi.VisualDataRoleKind.Grouping,
|
2168 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Axis"),
|
2169 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_AxisDescription"),
|
2170 | cartesianKind: 0
|
2171 | }, {
|
2172 | name: "Series",
|
2173 | kind: powerbi.VisualDataRoleKind.Grouping,
|
2174 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Legend"),
|
2175 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LegendDescription")
|
2176 | }, {
|
2177 | name: "Y",
|
2178 | kind: powerbi.VisualDataRoleKind.Measure,
|
2179 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Value"),
|
2180 | requiredTypes: [ {
|
2181 | numeric: !0
|
2182 | }, {
|
2183 | integer: !0
|
2184 | } ],
|
2185 | cartesianKind: 1
|
2186 | }, {
|
2187 | name: "Gradient",
|
2188 | kind: powerbi.VisualDataRoleKind.Measure,
|
2189 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Gradient"),
|
2190 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GradientDescription"),
|
2191 | requiredTypes: [ {
|
2192 | numeric: !0
|
2193 | }, {
|
2194 | integer: !0
|
2195 | } ],
|
2196 | joinPredicate: 0
|
2197 | } ],
|
2198 | objects: {
|
2199 | general: {
|
2200 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
2201 | properties: {
|
2202 | formatString: visuals.StandardObjectProperties.formatString
|
2203 | }
|
2204 | },
|
2205 | legend: {
|
2206 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
2207 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
2208 | properties: {
|
2209 | show: visuals.StandardObjectProperties.show,
|
2210 | position: visuals.StandardObjectProperties.legendPosition,
|
2211 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
2212 | titleText: $.extend({}, visuals.StandardObjectProperties.legendTitle, {
|
2213 | suppressFormatPainterCopy: !0
|
2214 | }),
|
2215 | labelColor: visuals.StandardObjectProperties.labelColor,
|
2216 | fontSize: visuals.StandardObjectProperties.fontSize
|
2217 | }
|
2218 | },
|
2219 | categoryAxis: {
|
2220 | displayName: transposeAxes ? powerbi.data.createDisplayNameGetter("Visual_YAxis") : powerbi.data.createDisplayNameGetter("Visual_XAxis"),
|
2221 | properties: {
|
2222 | show: visuals.StandardObjectProperties.show,
|
2223 | position: visuals.StandardObjectProperties.yAxisPosition,
|
2224 | axisScale: visuals.StandardObjectProperties.axisScale,
|
2225 | start: visuals.StandardObjectProperties.axisStart,
|
2226 | end: visuals.StandardObjectProperties.axisEnd,
|
2227 | axisType: visuals.StandardObjectProperties.axisType,
|
2228 | showAxisTitle: {
|
2229 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
2230 | description: transposeAxes ? powerbi.data.createDisplayNameGetter("Visual_Axis_YTitleDescription") : powerbi.data.createDisplayNameGetter("Visual_Axis_XTitleDescription"),
|
2231 | type: {
|
2232 | bool: !0
|
2233 | }
|
2234 | },
|
2235 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
2236 | labelColor: visuals.StandardObjectProperties.labelColor,
|
2237 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
2238 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
2239 | }
|
2240 | },
|
2241 | valueAxis: {
|
2242 | displayName: transposeAxes ? powerbi.data.createDisplayNameGetter("Visual_XAxis") : powerbi.data.createDisplayNameGetter("Visual_YAxis"),
|
2243 | properties: {
|
2244 | show: visuals.StandardObjectProperties.show,
|
2245 | position: visuals.StandardObjectProperties.yAxisPosition,
|
2246 | axisScale: visuals.StandardObjectProperties.axisScale,
|
2247 | start: visuals.StandardObjectProperties.axisStart,
|
2248 | end: visuals.StandardObjectProperties.axisEnd,
|
2249 | intersection: {
|
2250 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Intersection"),
|
2251 | type: {
|
2252 | numeric: !0
|
2253 | },
|
2254 | placeHolderText: powerbi.data.createDisplayNameGetter("Visual_Precision_Auto")
|
2255 | },
|
2256 | showAxisTitle: {
|
2257 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
2258 | description: transposeAxes ? powerbi.data.createDisplayNameGetter("Visual_Axis_YTitleDescription") : powerbi.data.createDisplayNameGetter("Visual_Axis_XTitleDescription"),
|
2259 | type: {
|
2260 | bool: !0
|
2261 | }
|
2262 | },
|
2263 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
2264 | labelColor: visuals.StandardObjectProperties.labelColor,
|
2265 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
2266 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
2267 | }
|
2268 | },
|
2269 | y1AxisReferenceLine: {
|
2270 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line"),
|
2271 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Description"),
|
2272 | properties: {
|
2273 | show: visuals.StandardObjectProperties.show,
|
2274 | value: {
|
2275 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value"),
|
2276 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value_Description"),
|
2277 | type: {
|
2278 | numeric: !0
|
2279 | }
|
2280 | },
|
2281 | lineColor: visuals.StandardObjectProperties.lineColor,
|
2282 | transparency: {
|
2283 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency"),
|
2284 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency_Description"),
|
2285 | type: {
|
2286 | numeric: !0
|
2287 | }
|
2288 | },
|
2289 | style: visuals.StandardObjectProperties.referenceLineStyle,
|
2290 | position: visuals.StandardObjectProperties.referenceLinePosition,
|
2291 | dataLabelShow: visuals.StandardObjectProperties.dataLabelShow,
|
2292 | dataLabelColor: visuals.StandardObjectProperties.dataLabelColor,
|
2293 | dataLabelDecimalPoints: visuals.StandardObjectProperties.dataLabelDecimalPoints,
|
2294 | dataLabelHorizontalPosition: visuals.StandardObjectProperties.dataLabelHorizontalPosition,
|
2295 | dataLabelVerticalPosition: visuals.StandardObjectProperties.dataLabelVerticalPosition,
|
2296 | dataLabelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits
|
2297 | }
|
2298 | },
|
2299 | dataPoint: {
|
2300 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
2301 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
2302 | properties: {
|
2303 | defaultColor: visuals.StandardObjectProperties.defaultColor,
|
2304 | showAllDataPoints: visuals.StandardObjectProperties.showAllDataPoints,
|
2305 | fill: visuals.StandardObjectProperties.fill,
|
2306 | fillRule: {
|
2307 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gradient"),
|
2308 | type: {
|
2309 | fillRule: {}
|
2310 | },
|
2311 | rule: {
|
2312 | inputRole: "Gradient",
|
2313 | output: {
|
2314 | property: "fill",
|
2315 | selector: [ "Category" ]
|
2316 | }
|
2317 | }
|
2318 | }
|
2319 | }
|
2320 | },
|
2321 | trend: {
|
2322 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line"),
|
2323 | properties: {
|
2324 | show: {
|
2325 | type: {
|
2326 | bool: !0
|
2327 | }
|
2328 | },
|
2329 | lineColor: {
|
2330 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color"),
|
2331 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color_Description"),
|
2332 | type: {
|
2333 | fill: {
|
2334 | solid: {
|
2335 | color: !0
|
2336 | }
|
2337 | }
|
2338 | }
|
2339 | },
|
2340 | transparency: {
|
2341 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency"),
|
2342 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency_Description"),
|
2343 | type: {
|
2344 | numeric: !0
|
2345 | }
|
2346 | },
|
2347 | style: {
|
2348 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style"),
|
2349 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style_Description"),
|
2350 | type: {
|
2351 | enumeration: visuals.lineStyle.type
|
2352 | }
|
2353 | },
|
2354 | combineSeries: {
|
2355 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series"),
|
2356 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series_Description"),
|
2357 | type: {
|
2358 | bool: !0
|
2359 | }
|
2360 | },
|
2361 | useHighlightValues: {
|
2362 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_UseHighlightValues"),
|
2363 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_UseHighlightValues_Description"),
|
2364 | type: {
|
2365 | bool: !0
|
2366 | }
|
2367 | }
|
2368 | }
|
2369 | },
|
2370 | labels: {
|
2371 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
2372 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabelsDescription"),
|
2373 | properties: {
|
2374 | show: visuals.StandardObjectProperties.show,
|
2375 | showSeries: {
|
2376 | displayName: powerbi.data.createDisplayNameGetter("Visual_Show"),
|
2377 | type: {
|
2378 | bool: !0
|
2379 | }
|
2380 | },
|
2381 | color: visuals.StandardObjectProperties.dataColor,
|
2382 | labelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits,
|
2383 | labelPrecision: $.extend({}, visuals.StandardObjectProperties.labelPrecision, {
|
2384 | suppressFormatPainterCopy: !0
|
2385 | }),
|
2386 | showAll: {
|
2387 | displayName: powerbi.data.createDisplayNameGetter("Visual_LabelSeriesShowAll"),
|
2388 | type: {
|
2389 | bool: !0
|
2390 | }
|
2391 | },
|
2392 | fontSize: visuals.StandardObjectProperties.fontSize
|
2393 | }
|
2394 | },
|
2395 | plotArea: {
|
2396 | displayName: powerbi.data.createDisplayNameGetter("Visual_Plot"),
|
2397 | properties: {
|
2398 | transparency: visuals.StandardObjectProperties.transparency,
|
2399 | image: visuals.StandardObjectProperties.image
|
2400 | }
|
2401 | }
|
2402 | },
|
2403 | dataViewMappings: [ {
|
2404 | conditions: [ {
|
2405 | Category: {
|
2406 | max: 1
|
2407 | },
|
2408 | Series: {
|
2409 | max: 0
|
2410 | },
|
2411 | Gradient: {
|
2412 | max: 0
|
2413 | }
|
2414 | }, {
|
2415 | Category: {
|
2416 | max: 1
|
2417 | },
|
2418 | Series: {
|
2419 | min: 1,
|
2420 | max: 1
|
2421 | },
|
2422 | Y: {
|
2423 | max: 1
|
2424 | },
|
2425 | Gradient: {
|
2426 | max: 0
|
2427 | }
|
2428 | }, {
|
2429 | Category: {
|
2430 | max: 1
|
2431 | },
|
2432 | Series: {
|
2433 | max: 0
|
2434 | },
|
2435 | Y: {
|
2436 | min: 0,
|
2437 | max: 1
|
2438 | },
|
2439 | Gradient: {
|
2440 | max: 1
|
2441 | }
|
2442 | } ],
|
2443 | categorical: {
|
2444 | categories: {
|
2445 | "for": {
|
2446 | "in": "Category"
|
2447 | },
|
2448 | dataReductionAlgorithm: {
|
2449 | top: {}
|
2450 | }
|
2451 | },
|
2452 | values: {
|
2453 | group: {
|
2454 | by: "Series",
|
2455 | select: [ {
|
2456 | "for": {
|
2457 | "in": "Y"
|
2458 | }
|
2459 | }, {
|
2460 | bind: {
|
2461 | to: "Gradient"
|
2462 | }
|
2463 | } ],
|
2464 | dataReductionAlgorithm: {
|
2465 | top: {}
|
2466 | }
|
2467 | }
|
2468 | },
|
2469 | rowCount: {
|
2470 | preferred: {
|
2471 | min: 2
|
2472 | },
|
2473 | supported: {
|
2474 | min: 0
|
2475 | }
|
2476 | }
|
2477 | }
|
2478 | }, {
|
2479 | conditions: [ {
|
2480 | Category: {
|
2481 | max: 1
|
2482 | },
|
2483 | Series: {
|
2484 | max: 0
|
2485 | },
|
2486 | Gradient: {
|
2487 | max: 0
|
2488 | }
|
2489 | }, {
|
2490 | Category: {
|
2491 | max: 1
|
2492 | },
|
2493 | Series: {
|
2494 | min: 1,
|
2495 | max: 1
|
2496 | },
|
2497 | Y: {
|
2498 | max: 1
|
2499 | },
|
2500 | Gradient: {
|
2501 | max: 0
|
2502 | }
|
2503 | }, {
|
2504 | Category: {
|
2505 | max: 1
|
2506 | },
|
2507 | Series: {
|
2508 | max: 0
|
2509 | },
|
2510 | Y: {
|
2511 | min: 0,
|
2512 | max: 1
|
2513 | },
|
2514 | Gradient: {
|
2515 | max: 1
|
2516 | }
|
2517 | } ],
|
2518 | requiredProperties: [ {
|
2519 | objectName: "trend",
|
2520 | propertyName: "show"
|
2521 | } ],
|
2522 | usage: {
|
2523 | regression: {
|
2524 | combineSeries: {
|
2525 | objectName: "trend",
|
2526 | propertyName: "combineSeries"
|
2527 | }
|
2528 | }
|
2529 | },
|
2530 | categorical: {
|
2531 | categories: {
|
2532 | "for": {
|
2533 | "in": "regression.X"
|
2534 | }
|
2535 | },
|
2536 | values: {
|
2537 | group: {
|
2538 | by: "regression.Series",
|
2539 | select: [ {
|
2540 | "for": {
|
2541 | "in": "regression.Y"
|
2542 | }
|
2543 | } ]
|
2544 | }
|
2545 | }
|
2546 | }
|
2547 | } ],
|
2548 | supportsHighlight: !0,
|
2549 | sorting: {
|
2550 | "default": {}
|
2551 | },
|
2552 | drilldown: {
|
2553 | roles: [ "Category" ]
|
2554 | }
|
2555 | };
|
2556 | }
|
2557 | visuals.getColumnChartCapabilities = getColumnChartCapabilities, visuals.columnChartProps = {
|
2558 | dataPoint: {
|
2559 | defaultColor: {
|
2560 | objectName: "dataPoint",
|
2561 | propertyName: "defaultColor"
|
2562 | },
|
2563 | fill: {
|
2564 | objectName: "dataPoint",
|
2565 | propertyName: "fill"
|
2566 | },
|
2567 | showAllDataPoints: {
|
2568 | objectName: "dataPoint",
|
2569 | propertyName: "showAllDataPoints"
|
2570 | }
|
2571 | },
|
2572 | general: {
|
2573 | formatString: {
|
2574 | objectName: "general",
|
2575 | propertyName: "formatString"
|
2576 | }
|
2577 | },
|
2578 | categoryAxis: {
|
2579 | axisType: {
|
2580 | objectName: "categoryAxis",
|
2581 | propertyName: "axisType"
|
2582 | }
|
2583 | },
|
2584 | legend: {
|
2585 | labelColor: {
|
2586 | objectName: "legend",
|
2587 | propertyName: "labelColor"
|
2588 | }
|
2589 | },
|
2590 | plotArea: {
|
2591 | image: {
|
2592 | objectName: "plotArea",
|
2593 | propertyName: "image"
|
2594 | },
|
2595 | transparency: {
|
2596 | objectName: "plotArea",
|
2597 | propertyName: "transparency"
|
2598 | }
|
2599 | }
|
2600 | };
|
2601 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
2602 | }(powerbi || (powerbi = {}));
|
2603 | }, function(module, exports) {
|
2604 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
2605 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
2606 | !function(powerbi) {
|
2607 | var visuals;
|
2608 | !function(visuals) {
|
2609 | visuals.comboChartCapabilities = {
|
2610 | dataRoles: [ {
|
2611 | name: "Category",
|
2612 | kind: powerbi.VisualDataRoleKind.Grouping,
|
2613 | displayName: powerbi.data.createDisplayNameGetter("Role_ComboChart_Category"),
|
2614 | description: powerbi.data.createDisplayNameGetter("Role_ComboChart_CategoryDescription"),
|
2615 | cartesianKind: 0
|
2616 | }, {
|
2617 | name: "Series",
|
2618 | kind: powerbi.VisualDataRoleKind.Grouping,
|
2619 | displayName: powerbi.data.createDisplayNameGetter("Role_ComboChart_Series")
|
2620 | }, {
|
2621 | name: "Y",
|
2622 | kind: powerbi.VisualDataRoleKind.Measure,
|
2623 | displayName: powerbi.data.createDisplayNameGetter("Role_ComboChart_Y"),
|
2624 | description: powerbi.data.createDisplayNameGetter("Role_ComboChart_YDescription"),
|
2625 | requiredTypes: [ {
|
2626 | numeric: !0
|
2627 | }, {
|
2628 | integer: !0
|
2629 | } ],
|
2630 | cartesianKind: 1
|
2631 | }, {
|
2632 | name: "Y2",
|
2633 | kind: powerbi.VisualDataRoleKind.Measure,
|
2634 | displayName: powerbi.data.createDisplayNameGetter("Role_ComboChart_Y2"),
|
2635 | description: powerbi.data.createDisplayNameGetter("Role_ComboChart_Y2Description"),
|
2636 | requiredTypes: [ {
|
2637 | numeric: !0
|
2638 | }, {
|
2639 | integer: !0
|
2640 | } ],
|
2641 | cartesianKind: 1
|
2642 | } ],
|
2643 | objects: {
|
2644 | general: {
|
2645 | properties: {
|
2646 | formatString: visuals.StandardObjectProperties.formatString,
|
2647 | visualType1: {
|
2648 | type: {
|
2649 | text: !0
|
2650 | }
|
2651 | },
|
2652 | visualType2: {
|
2653 | type: {
|
2654 | text: !0
|
2655 | }
|
2656 | }
|
2657 | }
|
2658 | },
|
2659 | legend: {
|
2660 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
2661 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
2662 | properties: {
|
2663 | show: visuals.StandardObjectProperties.show,
|
2664 | position: visuals.StandardObjectProperties.legendPosition,
|
2665 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
2666 | titleText: $.extend({}, visuals.StandardObjectProperties.legendTitle, {
|
2667 | suppressFormatPainterCopy: !0
|
2668 | }),
|
2669 | labelColor: visuals.StandardObjectProperties.labelColor,
|
2670 | fontSize: visuals.StandardObjectProperties.fontSize
|
2671 | }
|
2672 | },
|
2673 | categoryAxis: {
|
2674 | displayName: powerbi.data.createDisplayNameGetter("Visual_XAxis"),
|
2675 | properties: {
|
2676 | show: visuals.StandardObjectProperties.show,
|
2677 | axisScale: visuals.StandardObjectProperties.axisScale,
|
2678 | start: visuals.StandardObjectProperties.axisStart,
|
2679 | end: visuals.StandardObjectProperties.axisEnd,
|
2680 | axisType: visuals.StandardObjectProperties.axisType,
|
2681 | showAxisTitle: {
|
2682 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
2683 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_XTitleDescription"),
|
2684 | type: {
|
2685 | bool: !0
|
2686 | }
|
2687 | },
|
2688 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
2689 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
2690 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
2691 | }
|
2692 | },
|
2693 | valueAxis: {
|
2694 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis"),
|
2695 | properties: {
|
2696 | show: visuals.StandardObjectProperties.show,
|
2697 | axisLabel: {
|
2698 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis_ColumnTitle"),
|
2699 | type: {
|
2700 | none: !0
|
2701 | }
|
2702 | },
|
2703 | position: visuals.StandardObjectProperties.yAxisPosition,
|
2704 | axisScale: visuals.StandardObjectProperties.axisScale,
|
2705 | start: visuals.StandardObjectProperties.axisStart,
|
2706 | end: visuals.StandardObjectProperties.axisEnd,
|
2707 | showAxisTitle: {
|
2708 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
2709 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_YTitleDescription"),
|
2710 | type: {
|
2711 | bool: !0
|
2712 | }
|
2713 | },
|
2714 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
2715 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
2716 | labelPrecision: visuals.StandardObjectProperties.labelPrecision,
|
2717 | secShow: {
|
2718 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis_ShowSecondary"),
|
2719 | type: {
|
2720 | bool: !0
|
2721 | }
|
2722 | },
|
2723 | secAxisLabel: {
|
2724 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis_LineTitle"),
|
2725 | type: {
|
2726 | none: !0
|
2727 | }
|
2728 | },
|
2729 | secPosition: {
|
2730 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis_Position"),
|
2731 | type: {
|
2732 | enumeration: visuals.yAxisPosition.type
|
2733 | }
|
2734 | },
|
2735 | secAxisScale: visuals.StandardObjectProperties.axisScale,
|
2736 | secStart: {
|
2737 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Start"),
|
2738 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_StartDescription"),
|
2739 | type: {
|
2740 | numeric: !0
|
2741 | }
|
2742 | },
|
2743 | secEnd: {
|
2744 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_End"),
|
2745 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_EndDescription"),
|
2746 | type: {
|
2747 | numeric: !0
|
2748 | }
|
2749 | },
|
2750 | secShowAxisTitle: {
|
2751 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
2752 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_YTitleDescription"),
|
2753 | type: {
|
2754 | bool: !0
|
2755 | }
|
2756 | },
|
2757 | secAxisStyle: visuals.StandardObjectProperties.axisStyle,
|
2758 | secLabelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
2759 | secLabelPrecision: visuals.StandardObjectProperties.labelPrecision
|
2760 | }
|
2761 | },
|
2762 | dataPoint: {
|
2763 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
2764 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
2765 | properties: {
|
2766 | defaultColor: $.extend({}, visuals.StandardObjectProperties.defaultColor, {
|
2767 | displayName: powerbi.data.createDisplayNameGetter("Visual_DefaultColumnColor")
|
2768 | }),
|
2769 | showAllDataPoints: visuals.StandardObjectProperties.showAllDataPoints,
|
2770 | fill: visuals.StandardObjectProperties.fill,
|
2771 | fillRule: {
|
2772 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gradient"),
|
2773 | type: {
|
2774 | fillRule: {}
|
2775 | },
|
2776 | rule: {
|
2777 | inputRole: "Gradient",
|
2778 | output: {
|
2779 | property: "fill",
|
2780 | selector: [ "Category" ]
|
2781 | }
|
2782 | }
|
2783 | }
|
2784 | }
|
2785 | },
|
2786 | labels: {
|
2787 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
2788 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabelsDescription"),
|
2789 | properties: {
|
2790 | show: visuals.StandardObjectProperties.show,
|
2791 | color: visuals.StandardObjectProperties.dataColor,
|
2792 | labelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits,
|
2793 | labelPrecision: $.extend({}, visuals.StandardObjectProperties.labelPrecision, {
|
2794 | suppressFormatPainterCopy: !0
|
2795 | }),
|
2796 | fontSize: visuals.StandardObjectProperties.fontSize,
|
2797 | labelDensity: {
|
2798 | displayName: powerbi.data.createDisplayNameGetter("Visual_LabelDensity"),
|
2799 | type: {
|
2800 | formatting: {
|
2801 | labelDensity: !0
|
2802 | }
|
2803 | }
|
2804 | }
|
2805 | }
|
2806 | },
|
2807 | plotArea: {
|
2808 | displayName: powerbi.data.createDisplayNameGetter("Visual_Plot"),
|
2809 | properties: {
|
2810 | transparency: visuals.StandardObjectProperties.transparency,
|
2811 | image: visuals.StandardObjectProperties.image
|
2812 | }
|
2813 | },
|
2814 | trend: {
|
2815 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line"),
|
2816 | properties: {
|
2817 | show: {
|
2818 | type: {
|
2819 | bool: !0
|
2820 | }
|
2821 | },
|
2822 | lineColor: {
|
2823 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color"),
|
2824 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color_Description"),
|
2825 | type: {
|
2826 | fill: {
|
2827 | solid: {
|
2828 | color: !0
|
2829 | }
|
2830 | }
|
2831 | }
|
2832 | },
|
2833 | transparency: {
|
2834 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency"),
|
2835 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency_Description"),
|
2836 | type: {
|
2837 | numeric: !0
|
2838 | }
|
2839 | },
|
2840 | style: {
|
2841 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style"),
|
2842 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style_Description"),
|
2843 | type: {
|
2844 | enumeration: visuals.lineStyle.type
|
2845 | }
|
2846 | },
|
2847 | combineSeries: {
|
2848 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series"),
|
2849 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series_Description"),
|
2850 | type: {
|
2851 | bool: !0
|
2852 | }
|
2853 | },
|
2854 | useHighlightValues: {
|
2855 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_UseHighlightValues"),
|
2856 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_UseHighlightValues_Description"),
|
2857 | type: {
|
2858 | bool: !0
|
2859 | }
|
2860 | }
|
2861 | }
|
2862 | }
|
2863 | },
|
2864 | dataViewMappings: [ {
|
2865 | conditions: [ {
|
2866 | Category: {
|
2867 | max: 1
|
2868 | },
|
2869 | Series: {
|
2870 | max: 0
|
2871 | }
|
2872 | }, {
|
2873 | Category: {
|
2874 | max: 1
|
2875 | },
|
2876 | Series: {
|
2877 | min: 1,
|
2878 | max: 1
|
2879 | },
|
2880 | Y: {
|
2881 | max: 1
|
2882 | }
|
2883 | } ],
|
2884 | categorical: {
|
2885 | categories: {
|
2886 | "for": {
|
2887 | "in": "Category"
|
2888 | },
|
2889 | dataReductionAlgorithm: {
|
2890 | top: {}
|
2891 | }
|
2892 | },
|
2893 | values: {
|
2894 | group: {
|
2895 | by: "Series",
|
2896 | select: [ {
|
2897 | "for": {
|
2898 | "in": "Y"
|
2899 | }
|
2900 | } ],
|
2901 | dataReductionAlgorithm: {
|
2902 | top: {}
|
2903 | }
|
2904 | }
|
2905 | },
|
2906 | rowCount: {
|
2907 | preferred: {
|
2908 | min: 2
|
2909 | },
|
2910 | supported: {
|
2911 | min: 0
|
2912 | }
|
2913 | }
|
2914 | }
|
2915 | }, {
|
2916 | conditions: [ {
|
2917 | Category: {
|
2918 | max: 1
|
2919 | },
|
2920 | Series: {
|
2921 | max: 0
|
2922 | },
|
2923 | Y2: {
|
2924 | min: 1
|
2925 | }
|
2926 | }, {
|
2927 | Category: {
|
2928 | max: 1
|
2929 | },
|
2930 | Series: {
|
2931 | min: 1,
|
2932 | max: 1
|
2933 | },
|
2934 | Y: {
|
2935 | max: 1
|
2936 | },
|
2937 | Y2: {
|
2938 | min: 1
|
2939 | }
|
2940 | } ],
|
2941 | categorical: {
|
2942 | categories: {
|
2943 | "for": {
|
2944 | "in": "Category"
|
2945 | },
|
2946 | dataReductionAlgorithm: {
|
2947 | top: {}
|
2948 | }
|
2949 | },
|
2950 | values: {
|
2951 | select: [ {
|
2952 | "for": {
|
2953 | "in": "Y2"
|
2954 | }
|
2955 | } ]
|
2956 | },
|
2957 | rowCount: {
|
2958 | preferred: {
|
2959 | min: 2
|
2960 | },
|
2961 | supported: {
|
2962 | min: 0
|
2963 | }
|
2964 | }
|
2965 | }
|
2966 | }, {
|
2967 | conditions: [ {
|
2968 | Category: {
|
2969 | max: 1
|
2970 | },
|
2971 | Series: {
|
2972 | max: 0
|
2973 | }
|
2974 | }, {
|
2975 | Category: {
|
2976 | max: 1
|
2977 | },
|
2978 | Series: {
|
2979 | min: 1,
|
2980 | max: 1
|
2981 | },
|
2982 | Y: {
|
2983 | max: 1
|
2984 | }
|
2985 | } ],
|
2986 | requiredProperties: [ {
|
2987 | objectName: "trend",
|
2988 | propertyName: "show"
|
2989 | } ],
|
2990 | usage: {
|
2991 | regression: {
|
2992 | combineSeries: {
|
2993 | objectName: "trend",
|
2994 | propertyName: "combineSeries"
|
2995 | }
|
2996 | }
|
2997 | },
|
2998 | categorical: {
|
2999 | categories: {
|
3000 | "for": {
|
3001 | "in": "regression.X"
|
3002 | }
|
3003 | },
|
3004 | values: {
|
3005 | group: {
|
3006 | by: "regression.Series",
|
3007 | select: [ {
|
3008 | "for": {
|
3009 | "in": "regression.Y"
|
3010 | }
|
3011 | } ]
|
3012 | }
|
3013 | }
|
3014 | }
|
3015 | } ],
|
3016 | supportsHighlight: !0,
|
3017 | sorting: {
|
3018 | "default": {}
|
3019 | },
|
3020 | drilldown: {
|
3021 | roles: [ "Category" ]
|
3022 | }
|
3023 | }, visuals.comboChartProps = {
|
3024 | general: {
|
3025 | formatString: {
|
3026 | objectName: "general",
|
3027 | propertyName: "formatString"
|
3028 | }
|
3029 | },
|
3030 | valueAxis: {
|
3031 | secShow: {
|
3032 | objectName: "valueAxis",
|
3033 | propertyName: "secShow"
|
3034 | }
|
3035 | },
|
3036 | legend: {
|
3037 | labelColor: {
|
3038 | objectName: "legend",
|
3039 | propertyName: "labelColor"
|
3040 | }
|
3041 | },
|
3042 | dataPoint: {
|
3043 | showAllDataPoints: {
|
3044 | objectName: "dataPoint",
|
3045 | propertyName: "showAllDataPoints"
|
3046 | }
|
3047 | }
|
3048 | };
|
3049 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3050 | }(powerbi || (powerbi = {}));
|
3051 | }, function(module, exports) {
|
3052 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
3053 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
3054 | !function(powerbi) {
|
3055 | var visuals;
|
3056 | !function(visuals) {
|
3057 | visuals.donutChartCapabilities = {
|
3058 | dataRoles: [ {
|
3059 | name: "Category",
|
3060 | kind: powerbi.VisualDataRoleKind.Grouping,
|
3061 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Legend"),
|
3062 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LegendDescription")
|
3063 | }, {
|
3064 | name: "Series",
|
3065 | kind: powerbi.VisualDataRoleKind.Grouping,
|
3066 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Details"),
|
3067 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_DetailsDonutChartDescription")
|
3068 | }, {
|
3069 | name: "Y",
|
3070 | kind: powerbi.VisualDataRoleKind.Measure,
|
3071 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values"),
|
3072 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_ValuesDescription"),
|
3073 | requiredTypes: [ {
|
3074 | numeric: !0
|
3075 | }, {
|
3076 | integer: !0
|
3077 | } ]
|
3078 | } ],
|
3079 | objects: {
|
3080 | general: {
|
3081 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
3082 | properties: {
|
3083 | formatString: visuals.StandardObjectProperties.formatString
|
3084 | }
|
3085 | },
|
3086 | legend: {
|
3087 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
3088 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
3089 | properties: {
|
3090 | show: visuals.StandardObjectProperties.show,
|
3091 | position: visuals.StandardObjectProperties.legendPosition,
|
3092 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
3093 | titleText: $.extend({}, visuals.StandardObjectProperties.legendTitle, {
|
3094 | suppressFormatPainterCopy: !0
|
3095 | }),
|
3096 | labelColor: visuals.StandardObjectProperties.labelColor,
|
3097 | fontSize: visuals.StandardObjectProperties.fontSize
|
3098 | }
|
3099 | },
|
3100 | dataPoint: {
|
3101 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
3102 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
3103 | properties: {
|
3104 | defaultColor: visuals.StandardObjectProperties.defaultColor,
|
3105 | fill: visuals.StandardObjectProperties.fill
|
3106 | }
|
3107 | },
|
3108 | labels: {
|
3109 | displayName: powerbi.data.createDisplayNameGetter("Visual_DetailLabels"),
|
3110 | properties: {
|
3111 | show: visuals.StandardObjectProperties.show,
|
3112 | color: visuals.StandardObjectProperties.dataColor,
|
3113 | labelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits,
|
3114 | labelPrecision: $.extend({}, visuals.StandardObjectProperties.labelPrecision, {
|
3115 | suppressFormatPainterCopy: !0
|
3116 | }),
|
3117 | fontSize: $.extend({}, visuals.StandardObjectProperties.fontSize, {
|
3118 | suppressFormatPainterCopy: !0
|
3119 | }),
|
3120 | labelStyle: {
|
3121 | displayName: powerbi.data.createDisplayNameGetter("Visual_LabelStyle"),
|
3122 | type: {
|
3123 | enumeration: visuals.labelStyle.type
|
3124 | }
|
3125 | }
|
3126 | }
|
3127 | }
|
3128 | },
|
3129 | dataViewMappings: [ {
|
3130 | conditions: [ {
|
3131 | Category: {
|
3132 | max: 1
|
3133 | },
|
3134 | Series: {
|
3135 | max: 0
|
3136 | }
|
3137 | }, {
|
3138 | Category: {
|
3139 | max: 1
|
3140 | },
|
3141 | Series: {
|
3142 | min: 1,
|
3143 | max: 1
|
3144 | },
|
3145 | Y: {
|
3146 | max: 1
|
3147 | }
|
3148 | } ],
|
3149 | categorical: {
|
3150 | categories: {
|
3151 | "for": {
|
3152 | "in": "Category"
|
3153 | },
|
3154 | dataReductionAlgorithm: {
|
3155 | top: {}
|
3156 | }
|
3157 | },
|
3158 | values: {
|
3159 | group: {
|
3160 | by: "Series",
|
3161 | select: [ {
|
3162 | bind: {
|
3163 | to: "Y"
|
3164 | }
|
3165 | } ],
|
3166 | dataReductionAlgorithm: {
|
3167 | top: {}
|
3168 | }
|
3169 | }
|
3170 | },
|
3171 | rowCount: {
|
3172 | preferred: {
|
3173 | min: 2
|
3174 | },
|
3175 | supported: {
|
3176 | min: 1
|
3177 | }
|
3178 | }
|
3179 | }
|
3180 | } ],
|
3181 | sorting: {
|
3182 | "default": {}
|
3183 | },
|
3184 | supportsHighlight: !0,
|
3185 | drilldown: {
|
3186 | roles: [ "Category" ]
|
3187 | }
|
3188 | }, visuals.donutChartProps = {
|
3189 | general: {
|
3190 | formatString: {
|
3191 | objectName: "general",
|
3192 | propertyName: "formatString"
|
3193 | }
|
3194 | },
|
3195 | dataPoint: {
|
3196 | defaultColor: {
|
3197 | objectName: "dataPoint",
|
3198 | propertyName: "defaultColor"
|
3199 | },
|
3200 | fill: {
|
3201 | objectName: "dataPoint",
|
3202 | propertyName: "fill"
|
3203 | }
|
3204 | },
|
3205 | legend: {
|
3206 | show: {
|
3207 | objectName: "legend",
|
3208 | propertyName: "show"
|
3209 | },
|
3210 | position: {
|
3211 | objectName: "legend",
|
3212 | propertyName: "position"
|
3213 | },
|
3214 | showTitle: {
|
3215 | objectName: "legend",
|
3216 | propertyName: "showTitle"
|
3217 | },
|
3218 | titleText: {
|
3219 | objectName: "legend",
|
3220 | propertyName: "titleText"
|
3221 | },
|
3222 | labelColor: {
|
3223 | objectName: "legend",
|
3224 | propertyName: "labelColor"
|
3225 | }
|
3226 | }
|
3227 | };
|
3228 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3229 | }(powerbi || (powerbi = {}));
|
3230 | }, function(module, exports) {
|
3231 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
3232 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
3233 | !function(powerbi) {
|
3234 | var visuals;
|
3235 | !function(visuals) {
|
3236 | visuals.dataDotChartCapabilities = {
|
3237 | dataRoles: [ {
|
3238 | name: "Category",
|
3239 | kind: powerbi.VisualDataRoleKind.Grouping,
|
3240 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Axis"),
|
3241 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_AxisDescription")
|
3242 | }, {
|
3243 | name: "Y",
|
3244 | kind: powerbi.VisualDataRoleKind.Measure,
|
3245 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Value"),
|
3246 | requiredTypes: [ {
|
3247 | numeric: !0
|
3248 | }, {
|
3249 | integer: !0
|
3250 | } ]
|
3251 | } ],
|
3252 | objects: {
|
3253 | general: {
|
3254 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
3255 | properties: {
|
3256 | formatString: visuals.StandardObjectProperties.formatString
|
3257 | }
|
3258 | }
|
3259 | },
|
3260 | dataViewMappings: [ {
|
3261 | conditions: [ {
|
3262 | Category: {
|
3263 | max: 1
|
3264 | },
|
3265 | Y: {
|
3266 | max: 1
|
3267 | }
|
3268 | } ],
|
3269 | categorical: {
|
3270 | categories: {
|
3271 | "for": {
|
3272 | "in": "Category"
|
3273 | },
|
3274 | dataReductionAlgorithm: {
|
3275 | top: {}
|
3276 | }
|
3277 | },
|
3278 | values: {
|
3279 | select: [ {
|
3280 | "for": {
|
3281 | "in": "Y"
|
3282 | }
|
3283 | } ]
|
3284 | }
|
3285 | }
|
3286 | } ]
|
3287 | };
|
3288 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3289 | }(powerbi || (powerbi = {}));
|
3290 | }, function(module, exports) {
|
3291 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
3292 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
3293 | !function(powerbi) {
|
3294 | var visuals;
|
3295 | !function(visuals) {
|
3296 | visuals.filledMapCapabilities = {
|
3297 | dataRoles: [ {
|
3298 | name: "Category",
|
3299 | kind: powerbi.VisualDataRoleKind.Grouping,
|
3300 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Location"),
|
3301 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LocationFilledMapDescription"),
|
3302 | preferredTypes: [ {
|
3303 | geography: {
|
3304 | address: !0
|
3305 | }
|
3306 | }, {
|
3307 | geography: {
|
3308 | city: !0
|
3309 | }
|
3310 | }, {
|
3311 | geography: {
|
3312 | continent: !0
|
3313 | }
|
3314 | }, {
|
3315 | geography: {
|
3316 | country: !0
|
3317 | }
|
3318 | }, {
|
3319 | geography: {
|
3320 | county: !0
|
3321 | }
|
3322 | }, {
|
3323 | geography: {
|
3324 | place: !0
|
3325 | }
|
3326 | }, {
|
3327 | geography: {
|
3328 | postalCode: !0
|
3329 | }
|
3330 | }, {
|
3331 | geography: {
|
3332 | region: !0
|
3333 | }
|
3334 | }, {
|
3335 | geography: {
|
3336 | stateOrProvince: !0
|
3337 | }
|
3338 | } ]
|
3339 | }, {
|
3340 | name: "Series",
|
3341 | kind: powerbi.VisualDataRoleKind.Grouping,
|
3342 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Legend"),
|
3343 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LegendDescription")
|
3344 | }, {
|
3345 | name: "Y",
|
3346 | kind: powerbi.VisualDataRoleKind.Measure,
|
3347 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Latitude"),
|
3348 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LatitudeFilledMapDescription"),
|
3349 | preferredTypes: [ {
|
3350 | geography: {
|
3351 | latitude: !0
|
3352 | }
|
3353 | } ]
|
3354 | }, {
|
3355 | name: "X",
|
3356 | kind: powerbi.VisualDataRoleKind.Measure,
|
3357 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Longitude"),
|
3358 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LongitudeFilledMapDescription"),
|
3359 | preferredTypes: [ {
|
3360 | geography: {
|
3361 | longitude: !0
|
3362 | }
|
3363 | } ]
|
3364 | }, {
|
3365 | name: "Size",
|
3366 | kind: powerbi.VisualDataRoleKind.Measure,
|
3367 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Gradient"),
|
3368 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GradientDescription"),
|
3369 | requiredTypes: [ {
|
3370 | numeric: !0
|
3371 | }, {
|
3372 | integer: !0
|
3373 | } ]
|
3374 | } ],
|
3375 | objects: {
|
3376 | general: {
|
3377 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
3378 | properties: {
|
3379 | formatString: visuals.StandardObjectProperties.formatString
|
3380 | }
|
3381 | },
|
3382 | legend: {
|
3383 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
3384 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
3385 | properties: {
|
3386 | show: visuals.StandardObjectProperties.show,
|
3387 | position: visuals.StandardObjectProperties.legendPosition,
|
3388 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
3389 | titleText: visuals.StandardObjectProperties.legendTitle,
|
3390 | fontSize: visuals.StandardObjectProperties.fontSize
|
3391 | }
|
3392 | },
|
3393 | dataPoint: {
|
3394 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
3395 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
3396 | properties: {
|
3397 | defaultColor: visuals.StandardObjectProperties.defaultColor,
|
3398 | showAllDataPoints: visuals.StandardObjectProperties.showAllDataPoints,
|
3399 | fill: visuals.StandardObjectProperties.fill,
|
3400 | fillRule: {
|
3401 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values"),
|
3402 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_ValuesDescription"),
|
3403 | type: {
|
3404 | fillRule: {}
|
3405 | },
|
3406 | rule: {
|
3407 | inputRole: "Size",
|
3408 | output: {
|
3409 | property: "fill",
|
3410 | selector: [ "Category" ]
|
3411 | }
|
3412 | }
|
3413 | }
|
3414 | }
|
3415 | },
|
3416 | labels: {
|
3417 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
3418 | properties: {
|
3419 | show: visuals.StandardObjectProperties.show,
|
3420 | color: visuals.StandardObjectProperties.dataColor,
|
3421 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
3422 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
3423 | }
|
3424 | },
|
3425 | categoryLabels: {
|
3426 | displayName: powerbi.data.createDisplayNameGetter("Visual_CategoryLabels"),
|
3427 | properties: {
|
3428 | show: visuals.StandardObjectProperties.show
|
3429 | }
|
3430 | }
|
3431 | },
|
3432 | dataViewMappings: [ {
|
3433 | conditions: [ {
|
3434 | Category: {
|
3435 | max: 1
|
3436 | },
|
3437 | Series: {
|
3438 | max: 1
|
3439 | },
|
3440 | X: {
|
3441 | max: 1
|
3442 | },
|
3443 | Y: {
|
3444 | max: 1
|
3445 | },
|
3446 | Size: {
|
3447 | max: 1
|
3448 | }
|
3449 | }, {
|
3450 | Category: {
|
3451 | max: 1
|
3452 | },
|
3453 | Series: {
|
3454 | max: 0
|
3455 | },
|
3456 | X: {
|
3457 | max: 1
|
3458 | },
|
3459 | Y: {
|
3460 | max: 1
|
3461 | },
|
3462 | Size: {
|
3463 | max: 1
|
3464 | }
|
3465 | } ],
|
3466 | categorical: {
|
3467 | categories: {
|
3468 | "for": {
|
3469 | "in": "Category"
|
3470 | },
|
3471 | dataReductionAlgorithm: {
|
3472 | top: {}
|
3473 | }
|
3474 | },
|
3475 | values: {
|
3476 | group: {
|
3477 | by: "Series",
|
3478 | select: [ {
|
3479 | bind: {
|
3480 | to: "X"
|
3481 | }
|
3482 | }, {
|
3483 | bind: {
|
3484 | to: "Y"
|
3485 | }
|
3486 | }, {
|
3487 | bind: {
|
3488 | to: "Size"
|
3489 | }
|
3490 | } ],
|
3491 | dataReductionAlgorithm: {
|
3492 | top: {}
|
3493 | }
|
3494 | }
|
3495 | },
|
3496 | rowCount: {
|
3497 | preferred: {
|
3498 | min: 2
|
3499 | }
|
3500 | },
|
3501 | dataVolume: 4
|
3502 | }
|
3503 | } ],
|
3504 | sorting: {
|
3505 | custom: {},
|
3506 | implicit: {
|
3507 | clauses: [ {
|
3508 | role: "Size",
|
3509 | direction: 2
|
3510 | } ]
|
3511 | }
|
3512 | },
|
3513 | drilldown: {
|
3514 | roles: [ "Category" ]
|
3515 | }
|
3516 | }, visuals.filledMapProps = {
|
3517 | general: {
|
3518 | formatString: {
|
3519 | objectName: "general",
|
3520 | propertyName: "formatString"
|
3521 | }
|
3522 | },
|
3523 | dataPoint: {
|
3524 | defaultColor: {
|
3525 | objectName: "dataPoint",
|
3526 | propertyName: "defaultColor"
|
3527 | },
|
3528 | fill: {
|
3529 | objectName: "dataPoint",
|
3530 | propertyName: "fill"
|
3531 | },
|
3532 | showAllDataPoints: {
|
3533 | objectName: "dataPoint",
|
3534 | propertyName: "showAllDataPoints"
|
3535 | }
|
3536 | },
|
3537 | legend: {
|
3538 | show: {
|
3539 | objectName: "legend",
|
3540 | propertyName: "show"
|
3541 | },
|
3542 | position: {
|
3543 | objectName: "legend",
|
3544 | propertyName: "position"
|
3545 | },
|
3546 | showTitle: {
|
3547 | objectName: "legend",
|
3548 | propertyName: "showTitle"
|
3549 | },
|
3550 | titleText: {
|
3551 | objectName: "legend",
|
3552 | propertyName: "titleText"
|
3553 | }
|
3554 | },
|
3555 | labels: {
|
3556 | show: {
|
3557 | objectName: "labels",
|
3558 | propertyName: "show"
|
3559 | },
|
3560 | color: {
|
3561 | objectName: "labels",
|
3562 | propertyName: "color"
|
3563 | },
|
3564 | labelDisplayUnits: {
|
3565 | objectName: "labels",
|
3566 | propertyName: "labelDisplayUnits"
|
3567 | },
|
3568 | labelPrecision: {
|
3569 | objectName: "labels",
|
3570 | propertyName: "labelPrecision"
|
3571 | }
|
3572 | },
|
3573 | categoryLabels: {
|
3574 | show: {
|
3575 | objectName: "categoryLabels",
|
3576 | propertyName: "show"
|
3577 | }
|
3578 | }
|
3579 | };
|
3580 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3581 | }(powerbi || (powerbi = {}));
|
3582 | }, function(module, exports) {
|
3583 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
3584 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
3585 | !function(powerbi) {
|
3586 | var visuals;
|
3587 | !function(visuals) {
|
3588 | visuals.funnelChartCapabilities = {
|
3589 | dataRoles: [ {
|
3590 | name: "Category",
|
3591 | kind: powerbi.VisualDataRoleKind.Grouping,
|
3592 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Group"),
|
3593 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GroupFunnelDescription")
|
3594 | }, {
|
3595 | name: "Y",
|
3596 | kind: powerbi.VisualDataRoleKind.Measure,
|
3597 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values"),
|
3598 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_ValuesDescription"),
|
3599 | requiredTypes: [ {
|
3600 | numeric: !0
|
3601 | }, {
|
3602 | integer: !0
|
3603 | } ]
|
3604 | }, {
|
3605 | name: "Gradient",
|
3606 | kind: powerbi.VisualDataRoleKind.Measure,
|
3607 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Gradient"),
|
3608 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GradientDescription"),
|
3609 | requiredTypes: [ {
|
3610 | numeric: !0
|
3611 | }, {
|
3612 | integer: !0
|
3613 | } ],
|
3614 | joinPredicate: 0
|
3615 | } ],
|
3616 | dataViewMappings: [ {
|
3617 | conditions: [ {
|
3618 | Category: {
|
3619 | max: 0
|
3620 | },
|
3621 | Gradient: {
|
3622 | max: 0
|
3623 | }
|
3624 | }, {
|
3625 | Category: {
|
3626 | max: 1
|
3627 | },
|
3628 | Y: {
|
3629 | max: 1
|
3630 | },
|
3631 | Gradient: {
|
3632 | max: 1
|
3633 | }
|
3634 | } ],
|
3635 | categorical: {
|
3636 | categories: {
|
3637 | "for": {
|
3638 | "in": "Category"
|
3639 | },
|
3640 | dataReductionAlgorithm: {
|
3641 | top: {}
|
3642 | }
|
3643 | },
|
3644 | values: {
|
3645 | select: [ {
|
3646 | "for": {
|
3647 | "in": "Y"
|
3648 | }
|
3649 | }, {
|
3650 | bind: {
|
3651 | to: "Gradient"
|
3652 | }
|
3653 | } ]
|
3654 | },
|
3655 | rowCount: {
|
3656 | preferred: {
|
3657 | min: 1
|
3658 | }
|
3659 | }
|
3660 | }
|
3661 | } ],
|
3662 | objects: {
|
3663 | general: {
|
3664 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
3665 | properties: {
|
3666 | formatString: visuals.StandardObjectProperties.formatString
|
3667 | }
|
3668 | },
|
3669 | dataPoint: {
|
3670 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
3671 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
3672 | properties: {
|
3673 | defaultColor: visuals.StandardObjectProperties.defaultColor,
|
3674 | fill: visuals.StandardObjectProperties.fill,
|
3675 | fillRule: {
|
3676 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gradient"),
|
3677 | type: {
|
3678 | fillRule: {}
|
3679 | },
|
3680 | rule: {
|
3681 | inputRole: "Gradient",
|
3682 | output: {
|
3683 | property: "fill",
|
3684 | selector: [ "Category" ]
|
3685 | }
|
3686 | }
|
3687 | }
|
3688 | }
|
3689 | },
|
3690 | labels: {
|
3691 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
3692 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabelsDescription"),
|
3693 | properties: {
|
3694 | show: visuals.StandardObjectProperties.show,
|
3695 | color: visuals.StandardObjectProperties.dataColor,
|
3696 | labelPosition: {
|
3697 | displayName: powerbi.data.createDisplayNameGetter("Visual_Position"),
|
3698 | type: {
|
3699 | enumeration: visuals.labelPosition.type
|
3700 | },
|
3701 | suppressFormatPainterCopy: !0
|
3702 | },
|
3703 | labelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits,
|
3704 | labelPrecision: $.extend({}, visuals.StandardObjectProperties.labelPrecision, {
|
3705 | suppressFormatPainterCopy: !0
|
3706 | }),
|
3707 | fontSize: visuals.StandardObjectProperties.fontSize
|
3708 | }
|
3709 | },
|
3710 | percentBarLabel: {
|
3711 | displayName: powerbi.data.createDisplayNameGetter("Visual_PercentBarLabel"),
|
3712 | description: powerbi.data.createDisplayNameGetter("Visual_PercentBarLabelDescription"),
|
3713 | properties: {
|
3714 | show: visuals.StandardObjectProperties.show,
|
3715 | color: visuals.StandardObjectProperties.dataColor,
|
3716 | fontSize: visuals.StandardObjectProperties.fontSize
|
3717 | }
|
3718 | }
|
3719 | },
|
3720 | supportsHighlight: !0,
|
3721 | sorting: {
|
3722 | "default": {}
|
3723 | },
|
3724 | drilldown: {
|
3725 | roles: [ "Category" ]
|
3726 | }
|
3727 | }, visuals.funnelChartProps = {
|
3728 | general: {
|
3729 | formatString: {
|
3730 | objectName: "general",
|
3731 | propertyName: "formatString"
|
3732 | }
|
3733 | },
|
3734 | dataPoint: {
|
3735 | defaultColor: {
|
3736 | objectName: "dataPoint",
|
3737 | propertyName: "defaultColor"
|
3738 | },
|
3739 | fill: {
|
3740 | objectName: "dataPoint",
|
3741 | propertyName: "fill"
|
3742 | }
|
3743 | }
|
3744 | };
|
3745 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3746 | }(powerbi || (powerbi = {}));
|
3747 | }, function(module, exports) {
|
3748 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
3749 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
3750 | !function(powerbi) {
|
3751 | var visuals;
|
3752 | !function(visuals) {
|
3753 | visuals.gaugeRoleNames = {
|
3754 | y: "Y",
|
3755 | minValue: "MinValue",
|
3756 | maxValue: "MaxValue",
|
3757 | targetValue: "TargetValue"
|
3758 | }, visuals.gaugeCapabilities = {
|
3759 | dataRoles: [ {
|
3760 | name: visuals.gaugeRoleNames.y,
|
3761 | kind: powerbi.VisualDataRoleKind.Measure,
|
3762 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Value"),
|
3763 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_ValueDescription"),
|
3764 | requiredTypes: [ {
|
3765 | numeric: !0
|
3766 | }, {
|
3767 | integer: !0
|
3768 | } ]
|
3769 | }, {
|
3770 | name: visuals.gaugeRoleNames.minValue,
|
3771 | kind: powerbi.VisualDataRoleKind.Measure,
|
3772 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_MinValue"),
|
3773 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_MinValueDescription"),
|
3774 | requiredTypes: [ {
|
3775 | numeric: !0
|
3776 | }, {
|
3777 | integer: !0
|
3778 | } ]
|
3779 | }, {
|
3780 | name: visuals.gaugeRoleNames.maxValue,
|
3781 | kind: powerbi.VisualDataRoleKind.Measure,
|
3782 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_MaxValue"),
|
3783 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_MaxValueDescription"),
|
3784 | requiredTypes: [ {
|
3785 | numeric: !0
|
3786 | }, {
|
3787 | integer: !0
|
3788 | } ]
|
3789 | }, {
|
3790 | name: visuals.gaugeRoleNames.targetValue,
|
3791 | kind: powerbi.VisualDataRoleKind.Measure,
|
3792 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_TargetValue"),
|
3793 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_TargetValueDescription"),
|
3794 | requiredTypes: [ {
|
3795 | numeric: !0
|
3796 | }, {
|
3797 | integer: !0
|
3798 | } ]
|
3799 | } ],
|
3800 | objects: {
|
3801 | general: {
|
3802 | properties: {
|
3803 | formatString: visuals.StandardObjectProperties.formatString
|
3804 | }
|
3805 | },
|
3806 | axis: {
|
3807 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gauge_Axis"),
|
3808 | properties: {
|
3809 | min: {
|
3810 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gauge_Axis_Min"),
|
3811 | type: {
|
3812 | numeric: !0
|
3813 | }
|
3814 | },
|
3815 | max: {
|
3816 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gauge_Axis_Max"),
|
3817 | type: {
|
3818 | numeric: !0
|
3819 | }
|
3820 | },
|
3821 | target: {
|
3822 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gauge_Axis_Target"),
|
3823 | type: {
|
3824 | numeric: !0
|
3825 | }
|
3826 | }
|
3827 | }
|
3828 | },
|
3829 | labels: {
|
3830 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
3831 | properties: {
|
3832 | show: visuals.StandardObjectProperties.show,
|
3833 | color: visuals.StandardObjectProperties.dataColor,
|
3834 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
3835 | labelPrecision: visuals.StandardObjectProperties.labelPrecision,
|
3836 | fontSize: visuals.StandardObjectProperties.fontSize
|
3837 | }
|
3838 | },
|
3839 | calloutValue: {
|
3840 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gauge_CalloutValue"),
|
3841 | properties: {
|
3842 | show: visuals.StandardObjectProperties.show,
|
3843 | color: visuals.StandardObjectProperties.dataColor,
|
3844 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
3845 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
3846 | }
|
3847 | },
|
3848 | dataPoint: {
|
3849 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
3850 | properties: {
|
3851 | fill: visuals.StandardObjectProperties.fill,
|
3852 | target: {
|
3853 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gauge_Axis_Target"),
|
3854 | type: {
|
3855 | fill: {
|
3856 | solid: {
|
3857 | color: !0
|
3858 | }
|
3859 | }
|
3860 | }
|
3861 | }
|
3862 | }
|
3863 | }
|
3864 | },
|
3865 | dataViewMappings: [ {
|
3866 | conditions: [ {
|
3867 | Y: {
|
3868 | max: 1
|
3869 | },
|
3870 | MinValue: {
|
3871 | max: 1
|
3872 | },
|
3873 | MaxValue: {
|
3874 | max: 1
|
3875 | },
|
3876 | TargetValue: {
|
3877 | max: 1
|
3878 | }
|
3879 | } ],
|
3880 | categorical: {
|
3881 | values: {
|
3882 | select: [ {
|
3883 | bind: {
|
3884 | to: "Y"
|
3885 | }
|
3886 | }, {
|
3887 | bind: {
|
3888 | to: "MinValue"
|
3889 | }
|
3890 | }, {
|
3891 | bind: {
|
3892 | to: "MaxValue"
|
3893 | }
|
3894 | }, {
|
3895 | bind: {
|
3896 | to: "TargetValue"
|
3897 | }
|
3898 | } ]
|
3899 | }
|
3900 | }
|
3901 | } ],
|
3902 | supportsSelection: !1
|
3903 | }, visuals.gaugeProps = {
|
3904 | dataPoint: {
|
3905 | fill: {
|
3906 | objectName: "dataPoint",
|
3907 | propertyName: "fill"
|
3908 | },
|
3909 | target: {
|
3910 | objectName: "dataPoint",
|
3911 | propertyName: "target"
|
3912 | }
|
3913 | }
|
3914 | };
|
3915 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3916 | }(powerbi || (powerbi = {}));
|
3917 | }, function(module, exports) {
|
3918 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
3919 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
3920 | !function(powerbi) {
|
3921 | var visuals;
|
3922 | !function(visuals) {
|
3923 | visuals.imageVisualCapabilities = {
|
3924 | objects: {
|
3925 | general: {
|
3926 | properties: {
|
3927 | imageUrl: {
|
3928 | type: {
|
3929 | misc: {
|
3930 | imageUrl: !0
|
3931 | }
|
3932 | },
|
3933 | suppressFormatPainterCopy: !0
|
3934 | }
|
3935 | }
|
3936 | },
|
3937 | imageScaling: {
|
3938 | displayName: powerbi.data.createDisplayNameGetter("Visual_Image_Scaling_Type"),
|
3939 | properties: {
|
3940 | imageScalingType: {
|
3941 | displayName: powerbi.data.createDisplayNameGetter("Visual_Image_Scaling_Type"),
|
3942 | type: {
|
3943 | enumeration: visuals.imageScalingType.type
|
3944 | }
|
3945 | }
|
3946 | }
|
3947 | }
|
3948 | },
|
3949 | suppressDefaultTitle: !0,
|
3950 | supportsSelection: !1
|
3951 | };
|
3952 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3953 | }(powerbi || (powerbi = {}));
|
3954 | }, function(module, exports) {
|
3955 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
3956 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
3957 | !function(powerbi) {
|
3958 | var visuals;
|
3959 | !function(visuals) {
|
3960 | visuals.scriptVisualCapabilities = {
|
3961 | dataRoles: [ {
|
3962 | name: "Values",
|
3963 | kind: powerbi.VisualDataRoleKind.GroupingOrMeasure,
|
3964 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values")
|
3965 | } ],
|
3966 | dataViewMappings: [ {
|
3967 | scriptResult: {
|
3968 | dataInput: {
|
3969 | table: {
|
3970 | rows: {
|
3971 | "for": {
|
3972 | "in": "Values"
|
3973 | },
|
3974 | dataReductionAlgorithm: {
|
3975 | top: {}
|
3976 | }
|
3977 | }
|
3978 | }
|
3979 | },
|
3980 | script: {
|
3981 | source: {
|
3982 | objectName: "script",
|
3983 | propertyName: "source"
|
3984 | },
|
3985 | provider: {
|
3986 | objectName: "script",
|
3987 | propertyName: "provider"
|
3988 | }
|
3989 | }
|
3990 | }
|
3991 | } ],
|
3992 | objects: {
|
3993 | script: {
|
3994 | properties: {
|
3995 | provider: {
|
3996 | type: {
|
3997 | text: !0
|
3998 | }
|
3999 | },
|
4000 | source: {
|
4001 | type: {
|
4002 | scripting: {
|
4003 | source: !0
|
4004 | }
|
4005 | }
|
4006 | }
|
4007 | }
|
4008 | }
|
4009 | }
|
4010 | };
|
4011 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
4012 | }(powerbi || (powerbi = {}));
|
4013 | }, function(module, exports) {
|
4014 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
4015 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
4016 | !function(powerbi) {
|
4017 | var visuals;
|
4018 | !function(visuals) {
|
4019 | var samples;
|
4020 | !function(samples) {
|
4021 | samples.consoleWriterCapabilities = {
|
4022 | dataRoles: [ {
|
4023 | name: "Category",
|
4024 | kind: powerbi.VisualDataRoleKind.Grouping,
|
4025 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Axis"),
|
4026 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_AxisDescription")
|
4027 | }, {
|
4028 | name: "Y",
|
4029 | kind: powerbi.VisualDataRoleKind.Measure,
|
4030 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Y"),
|
4031 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_YDescription")
|
4032 | } ],
|
4033 | dataViewMappings: [ {
|
4034 | categorical: {
|
4035 | categories: {
|
4036 | "for": {
|
4037 | "in": "Category"
|
4038 | }
|
4039 | }
|
4040 | }
|
4041 | } ]
|
4042 | };
|
4043 | }(samples = visuals.samples || (visuals.samples = {}));
|
4044 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
4045 | }(powerbi || (powerbi = {}));
|
4046 | }, function(module, exports) {
|
4047 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
4048 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
4049 | !function(powerbi) {
|
4050 | var visuals;
|
4051 | !function(visuals) {
|
4052 | var samples;
|
4053 | !function(samples) {
|
4054 | var ConsoleWriter = function() {
|
4055 | function ConsoleWriter() {}
|
4056 | return ConsoleWriter.converter = function(dataView) {
|
4057 | return window.console.log("converter"), window.console.log(dataView), {};
|
4058 | }, ConsoleWriter.prototype.init = function(options) {
|
4059 | var div = d3.select(options.element.get(0)).append("div");
|
4060 | div.append("h1").text("ConsoleWriter"), div.append("p").text("This IVisual writes messages passed to it to the javscript console output. Check your console for the actual messages passed. For more information, click below");
|
4061 | var anchor = div.append("a");
|
4062 | anchor.attr("href", "http://microsoft.github.io/PowerBI-visuals/modules/powerbi.html").text("Online help"),
|
4063 | window.console.log("init"), window.console.log(options);
|
4064 | }, ConsoleWriter.prototype.onResizing = function(viewport) {}, ConsoleWriter.prototype.update = function(options) {
|
4065 | window.console.log("update"), window.console.log(options);
|
4066 | }, ConsoleWriter;
|
4067 | }();
|
4068 | samples.ConsoleWriter = ConsoleWriter;
|
4069 | }(samples = visuals.samples || (visuals.samples = {}));
|
4070 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
4071 | }(powerbi || (powerbi = {}));
|
4072 | }, function(module, exports) {
|
4073 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
4074 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
4075 | !function(powerbi) {
|
4076 | var visuals;
|
4077 | !function(visuals) {
|
4078 | visuals.lineChartCapabilities = {
|
4079 | dataRoles: [ {
|
4080 | name: "Category",
|
4081 | kind: powerbi.VisualDataRoleKind.Grouping,
|
4082 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Axis"),
|
4083 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_AxisDescription"),
|
4084 | cartesianKind: 0
|
4085 | }, {
|
4086 | name: "Series",
|
4087 | kind: powerbi.VisualDataRoleKind.Grouping,
|
4088 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Legend"),
|
4089 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LegendDescription")
|
4090 | }, {
|
4091 | name: "Y",
|
4092 | kind: powerbi.VisualDataRoleKind.Measure,
|
4093 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values"),
|
4094 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_ValuesDescription"),
|
4095 | requiredTypes: [ {
|
4096 | numeric: !0
|
4097 | }, {
|
4098 | integer: !0
|
4099 | } ],
|
4100 | cartesianKind: 1
|
4101 | } ],
|
4102 | objects: {
|
4103 | general: {
|
4104 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
4105 | properties: {
|
4106 | formatString: visuals.StandardObjectProperties.formatString
|
4107 | }
|
4108 | },
|
4109 | legend: {
|
4110 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
4111 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
4112 | properties: {
|
4113 | show: visuals.StandardObjectProperties.show,
|
4114 | position: visuals.StandardObjectProperties.legendPosition,
|
4115 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
4116 | titleText: $.extend({}, visuals.StandardObjectProperties.legendTitle, {
|
4117 | suppressFormatPainterCopy: !0
|
4118 | }),
|
4119 | labelColor: visuals.StandardObjectProperties.labelColor,
|
4120 | fontSize: visuals.StandardObjectProperties.fontSize
|
4121 | }
|
4122 | },
|
4123 | dataPoint: {
|
4124 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
4125 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
4126 | properties: {
|
4127 | defaultColor: visuals.StandardObjectProperties.defaultColor,
|
4128 | fill: visuals.StandardObjectProperties.fill
|
4129 | }
|
4130 | },
|
4131 | trend: {
|
4132 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line"),
|
4133 | properties: {
|
4134 | show: visuals.StandardObjectProperties.show,
|
4135 | lineColor: {
|
4136 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color"),
|
4137 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color_Description"),
|
4138 | type: {
|
4139 | fill: {
|
4140 | solid: {
|
4141 | color: !0
|
4142 | }
|
4143 | }
|
4144 | }
|
4145 | },
|
4146 | transparency: {
|
4147 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency"),
|
4148 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency_Description"),
|
4149 | type: {
|
4150 | numeric: !0
|
4151 | }
|
4152 | },
|
4153 | style: {
|
4154 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style"),
|
4155 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style_Description"),
|
4156 | type: {
|
4157 | enumeration: visuals.lineStyle.type
|
4158 | }
|
4159 | },
|
4160 | combineSeries: {
|
4161 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series"),
|
4162 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series_Description"),
|
4163 | type: {
|
4164 | bool: !0
|
4165 | }
|
4166 | },
|
4167 | useHighlightValues: {
|
4168 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_UseHighlightValues"),
|
4169 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_UseHighlightValues_Description"),
|
4170 | type: {
|
4171 | bool: !0
|
4172 | }
|
4173 | }
|
4174 | }
|
4175 | },
|
4176 | scalarKey: {
|
4177 | properties: {
|
4178 | min: {
|
4179 | type: {
|
4180 | dateTime: !0
|
4181 | }
|
4182 | }
|
4183 | }
|
4184 | },
|
4185 | categoryAxis: {
|
4186 | displayName: powerbi.data.createDisplayNameGetter("Visual_XAxis"),
|
4187 | properties: {
|
4188 | show: visuals.StandardObjectProperties.show,
|
4189 | axisScale: visuals.StandardObjectProperties.axisScale,
|
4190 | start: visuals.StandardObjectProperties.axisStart,
|
4191 | end: visuals.StandardObjectProperties.axisEnd,
|
4192 | axisType: visuals.StandardObjectProperties.axisType,
|
4193 | showAxisTitle: {
|
4194 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
4195 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_XTitleDescription"),
|
4196 | type: {
|
4197 | bool: !0
|
4198 | }
|
4199 | },
|
4200 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
4201 | labelColor: visuals.StandardObjectProperties.labelColor,
|
4202 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
4203 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
4204 | }
|
4205 | },
|
4206 | valueAxis: {
|
4207 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis"),
|
4208 | properties: {
|
4209 | show: visuals.StandardObjectProperties.show,
|
4210 | position: visuals.StandardObjectProperties.yAxisPosition,
|
4211 | axisScale: visuals.StandardObjectProperties.axisScale,
|
4212 | start: visuals.StandardObjectProperties.axisStart,
|
4213 | end: visuals.StandardObjectProperties.axisEnd,
|
4214 | showAxisTitle: {
|
4215 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
4216 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_YTitleDescription"),
|
4217 | type: {
|
4218 | bool: !0
|
4219 | }
|
4220 | },
|
4221 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
4222 | labelColor: visuals.StandardObjectProperties.labelColor,
|
4223 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
4224 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
4225 | }
|
4226 | },
|
4227 | y1AxisReferenceLine: {
|
4228 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line"),
|
4229 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Description"),
|
4230 | properties: {
|
4231 | show: visuals.StandardObjectProperties.show,
|
4232 | value: {
|
4233 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value"),
|
4234 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value_Description"),
|
4235 | type: {
|
4236 | numeric: !0
|
4237 | }
|
4238 | },
|
4239 | lineColor: visuals.StandardObjectProperties.lineColor,
|
4240 | transparency: {
|
4241 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency"),
|
4242 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency_Description"),
|
4243 | type: {
|
4244 | numeric: !0
|
4245 | }
|
4246 | },
|
4247 | style: visuals.StandardObjectProperties.referenceLineStyle,
|
4248 | position: visuals.StandardObjectProperties.referenceLinePosition,
|
4249 | dataLabelShow: visuals.StandardObjectProperties.dataLabelShow,
|
4250 | dataLabelColor: visuals.StandardObjectProperties.dataLabelColor,
|
4251 | dataLabelDecimalPoints: visuals.StandardObjectProperties.dataLabelDecimalPoints,
|
4252 | dataLabelHorizontalPosition: visuals.StandardObjectProperties.dataLabelHorizontalPosition,
|
4253 | dataLabelVerticalPosition: visuals.StandardObjectProperties.dataLabelVerticalPosition,
|
4254 | dataLabelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits
|
4255 | }
|
4256 | },
|
4257 | labels: {
|
4258 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
4259 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabelsDescription"),
|
4260 | properties: {
|
4261 | show: visuals.StandardObjectProperties.show,
|
4262 | showSeries: {
|
4263 | displayName: powerbi.data.createDisplayNameGetter("Visual_Show"),
|
4264 | type: {
|
4265 | bool: !0
|
4266 | }
|
4267 | },
|
4268 | color: visuals.StandardObjectProperties.dataColor,
|
4269 | labelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits,
|
4270 | labelPrecision: $.extend({}, visuals.StandardObjectProperties.labelPrecision, {
|
4271 | suppressFormatPainterCopy: !0
|
4272 | }),
|
4273 | showAll: {
|
4274 | displayName: powerbi.data.createDisplayNameGetter("Visual_LabelSeriesShowAll"),
|
4275 | type: {
|
4276 | bool: !0
|
4277 | }
|
4278 | },
|
4279 | fontSize: visuals.StandardObjectProperties.fontSize,
|
4280 | labelDensity: {
|
4281 | displayName: powerbi.data.createDisplayNameGetter("Visual_LabelDensity"),
|
4282 | type: {
|
4283 | formatting: {
|
4284 | labelDensity: !0
|
4285 | }
|
4286 | }
|
4287 | }
|
4288 | }
|
4289 | },
|
4290 | plotArea: {
|
4291 | displayName: powerbi.data.createDisplayNameGetter("Visual_Plot"),
|
4292 | properties: {
|
4293 | transparency: visuals.StandardObjectProperties.transparency,
|
4294 | image: visuals.StandardObjectProperties.image
|
4295 | }
|
4296 | }
|
4297 | },
|
4298 | dataViewMappings: [ {
|
4299 | conditions: [ {
|
4300 | Category: {
|
4301 | max: 1
|
4302 | },
|
4303 | Series: {
|
4304 | max: 0
|
4305 | }
|
4306 | }, {
|
4307 | Category: {
|
4308 | max: 1
|
4309 | },
|
4310 | Series: {
|
4311 | min: 1,
|
4312 | max: 1
|
4313 | },
|
4314 | Y: {
|
4315 | max: 1
|
4316 | }
|
4317 | } ],
|
4318 | categorical: {
|
4319 | categories: {
|
4320 | "for": {
|
4321 | "in": "Category"
|
4322 | },
|
4323 | dataReductionAlgorithm: {
|
4324 | top: {}
|
4325 | }
|
4326 | },
|
4327 | values: {
|
4328 | group: {
|
4329 | by: "Series",
|
4330 | select: [ {
|
4331 | "for": {
|
4332 | "in": "Y"
|
4333 | }
|
4334 | } ],
|
4335 | dataReductionAlgorithm: {
|
4336 | top: {}
|
4337 | }
|
4338 | }
|
4339 | }
|
4340 | }
|
4341 | }, {
|
4342 | conditions: [ {
|
4343 | Category: {
|
4344 | max: 1
|
4345 | },
|
4346 | Series: {
|
4347 | max: 0
|
4348 | }
|
4349 | }, {
|
4350 | Category: {
|
4351 | max: 1
|
4352 | },
|
4353 | Series: {
|
4354 | min: 1,
|
4355 | max: 1
|
4356 | },
|
4357 | Y: {
|
4358 | max: 1
|
4359 | }
|
4360 | } ],
|
4361 | requiredProperties: [ {
|
4362 | objectName: "trend",
|
4363 | propertyName: "show"
|
4364 | } ],
|
4365 | usage: {
|
4366 | regression: {
|
4367 | combineSeries: {
|
4368 | objectName: "trend",
|
4369 | propertyName: "combineSeries"
|
4370 | }
|
4371 | }
|
4372 | },
|
4373 | categorical: {
|
4374 | categories: {
|
4375 | "for": {
|
4376 | "in": "regression.X"
|
4377 | }
|
4378 | },
|
4379 | values: {
|
4380 | group: {
|
4381 | by: "regression.Series",
|
4382 | select: [ {
|
4383 | "for": {
|
4384 | "in": "regression.Y"
|
4385 | }
|
4386 | } ]
|
4387 | }
|
4388 | }
|
4389 | }
|
4390 | } ],
|
4391 | sorting: {
|
4392 | "default": {}
|
4393 | }
|
4394 | }, visuals.lineChartProps = {
|
4395 | general: {
|
4396 | formatString: {
|
4397 | objectName: "general",
|
4398 | propertyName: "formatString"
|
4399 | }
|
4400 | },
|
4401 | dataPoint: {
|
4402 | defaultColor: {
|
4403 | objectName: "dataPoint",
|
4404 | propertyName: "defaultColor"
|
4405 | },
|
4406 | fill: {
|
4407 | objectName: "dataPoint",
|
4408 | propertyName: "fill"
|
4409 | }
|
4410 | },
|
4411 | trend: {
|
4412 | show: {
|
4413 | objectName: "trend",
|
4414 | propertyName: "show"
|
4415 | }
|
4416 | },
|
4417 | scalarKey: {
|
4418 | scalarKeyMin: {
|
4419 | objectName: "scalarKey",
|
4420 | propertyName: "min"
|
4421 | }
|
4422 | },
|
4423 | categoryAxis: {
|
4424 | axisType: {
|
4425 | objectName: "categoryAxis",
|
4426 | propertyName: "axisType"
|
4427 | }
|
4428 | },
|
4429 | legend: {
|
4430 | labelColor: {
|
4431 | objectName: "legend",
|
4432 | propertyName: "labelColor"
|
4433 | }
|
4434 | },
|
4435 | labels: {
|
4436 | labelDensity: {
|
4437 | objectName: "labels",
|
4438 | propertyName: "labelDensity"
|
4439 | }
|
4440 | },
|
4441 | plotArea: {
|
4442 | image: {
|
4443 | objectName: "plotArea",
|
4444 | propertyName: "image"
|
4445 | },
|
4446 | transparency: {
|
4447 | objectName: "plotArea",
|
4448 | propertyName: "transparency"
|
4449 | }
|
4450 | }
|
4451 | };
|
4452 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
4453 | }(powerbi || (powerbi = {}));
|
4454 | }, function(module, exports) {
|
4455 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
4456 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
4457 | !function(powerbi) {
|
4458 | var visuals;
|
4459 | !function(visuals) {
|
4460 | visuals.mapCapabilities = {
|
4461 | dataRoles: [ {
|
4462 | name: "Category",
|
4463 | kind: powerbi.VisualDataRoleKind.Grouping,
|
4464 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Location"),
|
4465 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LocationMapDescription"),
|
4466 | preferredTypes: [ {
|
4467 | geography: {
|
4468 | address: !0
|
4469 | }
|
4470 | }, {
|
4471 | geography: {
|
4472 | city: !0
|
4473 | }
|
4474 | }, {
|
4475 | geography: {
|
4476 | continent: !0
|
4477 | }
|
4478 | }, {
|
4479 | geography: {
|
4480 | country: !0
|
4481 | }
|
4482 | }, {
|
4483 | geography: {
|
4484 | county: !0
|
4485 | }
|
4486 | }, {
|
4487 | geography: {
|
4488 | place: !0
|
4489 | }
|
4490 | }, {
|
4491 | geography: {
|
4492 | postalCode: !0
|
4493 | }
|
4494 | }, {
|
4495 | geography: {
|
4496 | region: !0
|
4497 | }
|
4498 | }, {
|
4499 | geography: {
|
4500 | stateOrProvince: !0
|
4501 | }
|
4502 | } ]
|
4503 | }, {
|
4504 | name: "Series",
|
4505 | kind: powerbi.VisualDataRoleKind.Grouping,
|
4506 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Legend"),
|
4507 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LegendDescription")
|
4508 | }, {
|
4509 | name: "Y",
|
4510 | kind: powerbi.VisualDataRoleKind.GroupingOrMeasure,
|
4511 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Latitude"),
|
4512 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LatitudeMapDescription"),
|
4513 | preferredTypes: [ {
|
4514 | geography: {
|
4515 | latitude: !0
|
4516 | }
|
4517 | } ]
|
4518 | }, {
|
4519 | name: "X",
|
4520 | kind: powerbi.VisualDataRoleKind.GroupingOrMeasure,
|
4521 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Longitude"),
|
4522 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LongitudeMapDescription"),
|
4523 | preferredTypes: [ {
|
4524 | geography: {
|
4525 | longitude: !0
|
4526 | }
|
4527 | } ]
|
4528 | }, {
|
4529 | name: "Size",
|
4530 | kind: powerbi.VisualDataRoleKind.Measure,
|
4531 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Size"),
|
4532 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_SizeDescription"),
|
4533 | requiredTypes: [ {
|
4534 | numeric: !0
|
4535 | }, {
|
4536 | integer: !0
|
4537 | } ]
|
4538 | }, {
|
4539 | name: "Gradient",
|
4540 | kind: powerbi.VisualDataRoleKind.Measure,
|
4541 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Gradient"),
|
4542 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GradientDescription"),
|
4543 | requiredTypes: [ {
|
4544 | numeric: !0
|
4545 | }, {
|
4546 | integer: !0
|
4547 | } ],
|
4548 | joinPredicate: 0
|
4549 | } ],
|
4550 | objects: {
|
4551 | general: {
|
4552 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
4553 | properties: {
|
4554 | formatString: visuals.StandardObjectProperties.formatString
|
4555 | }
|
4556 | },
|
4557 | legend: {
|
4558 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
4559 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
4560 | properties: {
|
4561 | show: visuals.StandardObjectProperties.show,
|
4562 | position: visuals.StandardObjectProperties.legendPosition,
|
4563 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
4564 | titleText: visuals.StandardObjectProperties.legendTitle,
|
4565 | fontSize: visuals.StandardObjectProperties.fontSize
|
4566 | }
|
4567 | },
|
4568 | dataPoint: {
|
4569 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
4570 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
4571 | properties: {
|
4572 | defaultColor: visuals.StandardObjectProperties.defaultColor,
|
4573 | showAllDataPoints: visuals.StandardObjectProperties.showAllDataPoints,
|
4574 | fill: visuals.StandardObjectProperties.fill,
|
4575 | fillRule: {
|
4576 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gradient"),
|
4577 | type: {
|
4578 | fillRule: {}
|
4579 | },
|
4580 | rule: {
|
4581 | inputRole: "Gradient",
|
4582 | output: {
|
4583 | property: "fill",
|
4584 | selector: [ "Category", "X", "Y" ]
|
4585 | }
|
4586 | }
|
4587 | }
|
4588 | }
|
4589 | },
|
4590 | categoryLabels: {
|
4591 | displayName: powerbi.data.createDisplayNameGetter("Visual_CategoryLabels"),
|
4592 | description: powerbi.data.createDisplayNameGetter("Visual_CategoryLabelsDescription"),
|
4593 | properties: {
|
4594 | show: visuals.StandardObjectProperties.show,
|
4595 | color: visuals.StandardObjectProperties.dataColor,
|
4596 | fontSize: visuals.StandardObjectProperties.fontSize
|
4597 | }
|
4598 | }
|
4599 | },
|
4600 | dataViewMappings: [ {
|
4601 | conditions: [ {
|
4602 | Category: {
|
4603 | min: 1,
|
4604 | max: 1
|
4605 | },
|
4606 | Series: {
|
4607 | max: 1
|
4608 | },
|
4609 | X: {
|
4610 | max: 1,
|
4611 | kind: powerbi.VisualDataRoleKind.Measure
|
4612 | },
|
4613 | Y: {
|
4614 | max: 1,
|
4615 | kind: powerbi.VisualDataRoleKind.Measure
|
4616 | },
|
4617 | Size: {
|
4618 | max: 1
|
4619 | },
|
4620 | Gradient: {
|
4621 | max: 0
|
4622 | }
|
4623 | }, {
|
4624 | Category: {
|
4625 | min: 1,
|
4626 | max: 1
|
4627 | },
|
4628 | Series: {
|
4629 | max: 0
|
4630 | },
|
4631 | X: {
|
4632 | max: 1,
|
4633 | kind: powerbi.VisualDataRoleKind.Measure
|
4634 | },
|
4635 | Y: {
|
4636 | max: 1,
|
4637 | kind: powerbi.VisualDataRoleKind.Measure
|
4638 | },
|
4639 | Size: {
|
4640 | max: 1
|
4641 | },
|
4642 | Gradient: {
|
4643 | max: 1
|
4644 | }
|
4645 | } ],
|
4646 | categorical: {
|
4647 | categories: {
|
4648 | "for": {
|
4649 | "in": "Category"
|
4650 | },
|
4651 | dataReductionAlgorithm: {
|
4652 | top: {}
|
4653 | }
|
4654 | },
|
4655 | values: {
|
4656 | group: {
|
4657 | by: "Series",
|
4658 | select: [ {
|
4659 | bind: {
|
4660 | to: "X"
|
4661 | }
|
4662 | }, {
|
4663 | bind: {
|
4664 | to: "Y"
|
4665 | }
|
4666 | }, {
|
4667 | bind: {
|
4668 | to: "Size"
|
4669 | }
|
4670 | }, {
|
4671 | bind: {
|
4672 | to: "Gradient"
|
4673 | }
|
4674 | } ],
|
4675 | dataReductionAlgorithm: {
|
4676 | top: {}
|
4677 | }
|
4678 | }
|
4679 | },
|
4680 | rowCount: {
|
4681 | preferred: {
|
4682 | min: 2
|
4683 | }
|
4684 | },
|
4685 | dataVolume: 4
|
4686 | }
|
4687 | }, {
|
4688 | conditions: [ {
|
4689 | Category: {
|
4690 | max: 0
|
4691 | },
|
4692 | Series: {
|
4693 | max: 1
|
4694 | },
|
4695 | X: {
|
4696 | max: 1,
|
4697 | kind: powerbi.VisualDataRoleKind.Grouping
|
4698 | },
|
4699 | Y: {
|
4700 | max: 1,
|
4701 | kind: powerbi.VisualDataRoleKind.Grouping
|
4702 | },
|
4703 | Size: {
|
4704 | max: 1
|
4705 | },
|
4706 | Gradient: {
|
4707 | max: 0
|
4708 | }
|
4709 | }, {
|
4710 | Category: {
|
4711 | max: 0
|
4712 | },
|
4713 | Series: {
|
4714 | max: 0
|
4715 | },
|
4716 | X: {
|
4717 | max: 1,
|
4718 | kind: powerbi.VisualDataRoleKind.Grouping
|
4719 | },
|
4720 | Y: {
|
4721 | max: 1,
|
4722 | kind: powerbi.VisualDataRoleKind.Grouping
|
4723 | },
|
4724 | Size: {
|
4725 | max: 1
|
4726 | },
|
4727 | Gradient: {
|
4728 | max: 1
|
4729 | }
|
4730 | } ],
|
4731 | categorical: {
|
4732 | categories: {
|
4733 | select: [ {
|
4734 | bind: {
|
4735 | to: "X"
|
4736 | }
|
4737 | }, {
|
4738 | bind: {
|
4739 | to: "Y"
|
4740 | }
|
4741 | } ],
|
4742 | dataReductionAlgorithm: {
|
4743 | top: {}
|
4744 | }
|
4745 | },
|
4746 | values: {
|
4747 | group: {
|
4748 | by: "Series",
|
4749 | select: [ {
|
4750 | bind: {
|
4751 | to: "Size"
|
4752 | }
|
4753 | }, {
|
4754 | bind: {
|
4755 | to: "Gradient"
|
4756 | }
|
4757 | } ],
|
4758 | dataReductionAlgorithm: {
|
4759 | top: {}
|
4760 | }
|
4761 | }
|
4762 | },
|
4763 | rowCount: {
|
4764 | preferred: {
|
4765 | min: 2
|
4766 | }
|
4767 | },
|
4768 | dataVolume: 4
|
4769 | }
|
4770 | } ],
|
4771 | sorting: {
|
4772 | custom: {},
|
4773 | implicit: {
|
4774 | clauses: [ {
|
4775 | role: "Size",
|
4776 | direction: 2
|
4777 | } ]
|
4778 | }
|
4779 | },
|
4780 | drilldown: {
|
4781 | roles: [ "Category" ]
|
4782 | }
|
4783 | }, visuals.mapProps = {
|
4784 | general: {
|
4785 | formatString: {
|
4786 | objectName: "general",
|
4787 | propertyName: "formatString"
|
4788 | }
|
4789 | },
|
4790 | dataPoint: {
|
4791 | defaultColor: {
|
4792 | objectName: "dataPoint",
|
4793 | propertyName: "defaultColor"
|
4794 | },
|
4795 | fill: {
|
4796 | objectName: "dataPoint",
|
4797 | propertyName: "fill"
|
4798 | },
|
4799 | showAllDataPoints: {
|
4800 | objectName: "dataPoint",
|
4801 | propertyName: "showAllDataPoints"
|
4802 | }
|
4803 | },
|
4804 | legend: {
|
4805 | show: {
|
4806 | objectName: "legend",
|
4807 | propertyName: "show"
|
4808 | },
|
4809 | position: {
|
4810 | objectName: "legend",
|
4811 | propertyName: "position"
|
4812 | },
|
4813 | showTitle: {
|
4814 | objectName: "legend",
|
4815 | propertyName: "showTitle"
|
4816 | },
|
4817 | titleText: {
|
4818 | objectName: "legend",
|
4819 | propertyName: "titleText"
|
4820 | }
|
4821 | }
|
4822 | };
|
4823 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
4824 | }(powerbi || (powerbi = {}));
|
4825 | }, function(module, exports) {
|
4826 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
4827 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
4828 | !function(powerbi) {
|
4829 | var visuals;
|
4830 | !function(visuals) {
|
4831 | visuals.multiRowCardCapabilities = {
|
4832 | dataRoles: [ {
|
4833 | name: "Values",
|
4834 | kind: powerbi.VisualDataRoleKind.GroupingOrMeasure,
|
4835 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Fields"),
|
4836 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_FieldsDescription")
|
4837 | } ],
|
4838 | objects: {
|
4839 | general: {
|
4840 | properties: {
|
4841 | formatString: visuals.StandardObjectProperties.formatString
|
4842 | }
|
4843 | },
|
4844 | cardTitle: {
|
4845 | displayName: powerbi.data.createDisplayNameGetter("Visual_CardTitle"),
|
4846 | description: powerbi.data.createDisplayNameGetter("Visual_CardTitleDescription"),
|
4847 | properties: {
|
4848 | color: visuals.StandardObjectProperties.dataColor,
|
4849 | fontSize: visuals.StandardObjectProperties.fontSize
|
4850 | }
|
4851 | },
|
4852 | dataLabels: {
|
4853 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
4854 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabelsDescription"),
|
4855 | properties: {
|
4856 | color: visuals.StandardObjectProperties.dataColor,
|
4857 | fontSize: visuals.StandardObjectProperties.fontSize
|
4858 | }
|
4859 | },
|
4860 | categoryLabels: {
|
4861 | displayName: powerbi.data.createDisplayNameGetter("Visual_CategoryLabels"),
|
4862 | description: powerbi.data.createDisplayNameGetter("Visual_CategoryLabelsDescription"),
|
4863 | properties: {
|
4864 | show: visuals.StandardObjectProperties.show,
|
4865 | color: visuals.StandardObjectProperties.dataColor,
|
4866 | fontSize: visuals.StandardObjectProperties.fontSize
|
4867 | }
|
4868 | },
|
4869 | card: {
|
4870 | displayName: powerbi.data.createDisplayNameGetter("Card_ToolTip"),
|
4871 | properties: {
|
4872 | outline: {
|
4873 | displayName: powerbi.data.createDisplayNameGetter("Visual_Outline"),
|
4874 | type: {
|
4875 | enumeration: visuals.outline.type
|
4876 | }
|
4877 | },
|
4878 | outlineColor: {
|
4879 | displayName: powerbi.data.createDisplayNameGetter("Visual_OutlineColor"),
|
4880 | description: powerbi.data.createDisplayNameGetter("Visual_OutlineColor_Desc"),
|
4881 | type: {
|
4882 | fill: {
|
4883 | solid: {
|
4884 | color: !0
|
4885 | }
|
4886 | }
|
4887 | }
|
4888 | },
|
4889 | outlineWeight: {
|
4890 | displayName: powerbi.data.createDisplayNameGetter("Visual_OutlineWeight"),
|
4891 | description: powerbi.data.createDisplayNameGetter("Visual_OutlineWeight_Desc"),
|
4892 | type: {
|
4893 | numeric: !0
|
4894 | }
|
4895 | },
|
4896 | barShow: {
|
4897 | displayName: powerbi.data.createDisplayNameGetter("Visual_MultiRowCard_BarShow"),
|
4898 | description: powerbi.data.createDisplayNameGetter("Visual_MultiRowCard_BarShow_Desc"),
|
4899 | type: {
|
4900 | bool: !0
|
4901 | }
|
4902 | },
|
4903 | barColor: {
|
4904 | displayName: powerbi.data.createDisplayNameGetter("Visual_MultiRowCard_BarColor"),
|
4905 | type: {
|
4906 | fill: {
|
4907 | solid: {
|
4908 | color: !0
|
4909 | }
|
4910 | }
|
4911 | }
|
4912 | },
|
4913 | barWeight: {
|
4914 | displayName: powerbi.data.createDisplayNameGetter("Visual_MultiRowCard_BarWeight"),
|
4915 | description: powerbi.data.createDisplayNameGetter("Visual_MultiRowCard_BarWeight_Desc"),
|
4916 | type: {
|
4917 | numeric: !0
|
4918 | }
|
4919 | },
|
4920 | cardPadding: {
|
4921 | displayName: powerbi.data.createDisplayNameGetter("Visual_MultiRowCard_CardPadding"),
|
4922 | description: powerbi.data.createDisplayNameGetter("Visual_MultiRowCard_CardBackground"),
|
4923 | type: {
|
4924 | numeric: !0
|
4925 | }
|
4926 | },
|
4927 | cardBackground: {
|
4928 | displayName: powerbi.data.createDisplayNameGetter("Visual_Background"),
|
4929 | type: {
|
4930 | fill: {
|
4931 | solid: {
|
4932 | color: !0
|
4933 | }
|
4934 | }
|
4935 | }
|
4936 | }
|
4937 | }
|
4938 | }
|
4939 | },
|
4940 | dataViewMappings: [ {
|
4941 | table: {
|
4942 | rows: {
|
4943 | "for": {
|
4944 | "in": "Values"
|
4945 | },
|
4946 | dataReductionAlgorithm: {
|
4947 | window: {}
|
4948 | }
|
4949 | },
|
4950 | rowCount: {
|
4951 | preferred: {
|
4952 | min: 1
|
4953 | }
|
4954 | }
|
4955 | }
|
4956 | } ],
|
4957 | sorting: {
|
4958 | "default": {}
|
4959 | },
|
4960 | suppressDefaultTitle: !0,
|
4961 | supportsSelection: !1,
|
4962 | disableVisualDetails: !0
|
4963 | }, visuals.multiRowCardProps = {
|
4964 | card: {
|
4965 | outline: {
|
4966 | objectName: "card",
|
4967 | propertyName: "outline"
|
4968 | },
|
4969 | outlineColor: {
|
4970 | objectName: "card",
|
4971 | propertyName: "outlineColor"
|
4972 | },
|
4973 | outlineWeight: {
|
4974 | objectName: "card",
|
4975 | propertyName: "outlineWeight"
|
4976 | },
|
4977 | barShow: {
|
4978 | objectName: "card",
|
4979 | propertyName: "barShow"
|
4980 | },
|
4981 | barColor: {
|
4982 | objectName: "card",
|
4983 | propertyName: "barColor"
|
4984 | },
|
4985 | barWeight: {
|
4986 | objectName: "card",
|
4987 | propertyName: "barWeight"
|
4988 | },
|
4989 | cardPadding: {
|
4990 | objectName: "card",
|
4991 | propertyName: "cardPadding"
|
4992 | },
|
4993 | cardBackground: {
|
4994 | objectName: "card",
|
4995 | propertyName: "cardBackground"
|
4996 | }
|
4997 | }
|
4998 | };
|
4999 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
5000 | }(powerbi || (powerbi = {}));
|
5001 | }, function(module, exports) {
|
5002 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
5003 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
5004 | !function(powerbi) {
|
5005 | var visuals;
|
5006 | !function(visuals) {
|
5007 | visuals.textboxCapabilities = {
|
5008 | objects: {
|
5009 | general: {
|
5010 | properties: {
|
5011 | paragraphs: {
|
5012 | type: {
|
5013 | paragraphs: {}
|
5014 | },
|
5015 | suppressFormatPainterCopy: !0
|
5016 | }
|
5017 | }
|
5018 | }
|
5019 | },
|
5020 | suppressDefaultTitle: !0,
|
5021 | supportsSelection: !1
|
5022 | };
|
5023 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
5024 | }(powerbi || (powerbi = {}));
|
5025 | }, function(module, exports) {
|
5026 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
5027 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
5028 | !function(powerbi) {
|
5029 | var visuals;
|
5030 | !function(visuals) {
|
5031 | visuals.cheerMeterCapabilities = {
|
5032 | dataRoles: [ {
|
5033 | name: "Category",
|
5034 | kind: powerbi.VisualDataRoleKind.Grouping,
|
5035 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Axis"),
|
5036 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_AxisDescription")
|
5037 | }, {
|
5038 | name: "Y",
|
5039 | kind: powerbi.VisualDataRoleKind.Measure,
|
5040 | requiredTypes: [ {
|
5041 | numeric: !0
|
5042 | }, {
|
5043 | integer: !0
|
5044 | } ],
|
5045 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Y"),
|
5046 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_YDescription")
|
5047 | } ],
|
5048 | dataViewMappings: [ {
|
5049 | categorical: {
|
5050 | categories: {
|
5051 | "for": {
|
5052 | "in": "Category"
|
5053 | }
|
5054 | }
|
5055 | }
|
5056 | } ],
|
5057 | objects: {
|
5058 | dataPoint: {
|
5059 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
5060 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
5061 | properties: {
|
5062 | fill: visuals.StandardObjectProperties.fill
|
5063 | }
|
5064 | }
|
5065 | }
|
5066 | };
|
5067 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
5068 | }(powerbi || (powerbi = {}));
|
5069 | }, function(module, exports) {
|
5070 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
5071 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
5072 | !function(powerbi) {
|
5073 | var visuals;
|
5074 | !function(visuals) {
|
5075 | visuals.scatterChartCapabilities = {
|
5076 | dataRoles: [ {
|
5077 | name: "Category",
|
5078 | kind: powerbi.VisualDataRoleKind.Grouping,
|
5079 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Details"),
|
5080 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_DetailsScatterChartDescription")
|
5081 | }, {
|
5082 | name: "Series",
|
5083 | kind: powerbi.VisualDataRoleKind.Grouping,
|
5084 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Legend"),
|
5085 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LegendDescription")
|
5086 | }, {
|
5087 | name: "X",
|
5088 | kind: powerbi.VisualDataRoleKind.Measure,
|
5089 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_X"),
|
5090 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_XScatterChartDescription"),
|
5091 | requiredTypes: [ {
|
5092 | numeric: !0
|
5093 | }, {
|
5094 | integer: !0
|
5095 | } ],
|
5096 | cartesianKind: 0
|
5097 | }, {
|
5098 | name: "Y",
|
5099 | kind: powerbi.VisualDataRoleKind.Measure,
|
5100 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Y"),
|
5101 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_YScatterChartDescription"),
|
5102 | requiredTypes: [ {
|
5103 | numeric: !0
|
5104 | }, {
|
5105 | integer: !0
|
5106 | } ],
|
5107 | cartesianKind: 1
|
5108 | }, {
|
5109 | name: "Size",
|
5110 | kind: powerbi.VisualDataRoleKind.Measure,
|
5111 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Size"),
|
5112 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_SizeDescription"),
|
5113 | requiredTypes: [ {
|
5114 | numeric: !0
|
5115 | }, {
|
5116 | integer: !0
|
5117 | } ]
|
5118 | }, {
|
5119 | name: "Gradient",
|
5120 | kind: powerbi.VisualDataRoleKind.Measure,
|
5121 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Gradient"),
|
5122 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GradientDescription"),
|
5123 | requiredTypes: [ {
|
5124 | numeric: !0
|
5125 | }, {
|
5126 | integer: !0
|
5127 | } ],
|
5128 | joinPredicate: 0
|
5129 | }, {
|
5130 | name: "Play",
|
5131 | kind: powerbi.VisualDataRoleKind.Grouping,
|
5132 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Play")
|
5133 | } ],
|
5134 | objects: {
|
5135 | dataPoint: {
|
5136 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
5137 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
5138 | properties: {
|
5139 | defaultColor: visuals.StandardObjectProperties.defaultColor,
|
5140 | showAllDataPoints: visuals.StandardObjectProperties.showAllDataPoints,
|
5141 | fill: visuals.StandardObjectProperties.fill,
|
5142 | fillRule: {
|
5143 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gradient"),
|
5144 | type: {
|
5145 | fillRule: {}
|
5146 | },
|
5147 | rule: {
|
5148 | inputRole: "Gradient",
|
5149 | output: {
|
5150 | property: "fill",
|
5151 | selector: [ "Category" ]
|
5152 | }
|
5153 | }
|
5154 | }
|
5155 | }
|
5156 | },
|
5157 | general: {
|
5158 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
5159 | properties: {
|
5160 | formatString: visuals.StandardObjectProperties.formatString
|
5161 | }
|
5162 | },
|
5163 | trend: {
|
5164 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line"),
|
5165 | properties: {
|
5166 | show: visuals.StandardObjectProperties.show,
|
5167 | lineColor: {
|
5168 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color"),
|
5169 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color_Description"),
|
5170 | type: {
|
5171 | fill: {
|
5172 | solid: {
|
5173 | color: !0
|
5174 | }
|
5175 | }
|
5176 | }
|
5177 | },
|
5178 | transparency: {
|
5179 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency"),
|
5180 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency_Description"),
|
5181 | type: {
|
5182 | numeric: !0
|
5183 | }
|
5184 | },
|
5185 | style: {
|
5186 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style"),
|
5187 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style_Description"),
|
5188 | type: {
|
5189 | enumeration: visuals.lineStyle.type
|
5190 | }
|
5191 | },
|
5192 | combineSeries: {
|
5193 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series"),
|
5194 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series_Description"),
|
5195 | type: {
|
5196 | bool: !0
|
5197 | }
|
5198 | }
|
5199 | }
|
5200 | },
|
5201 | categoryAxis: {
|
5202 | displayName: powerbi.data.createDisplayNameGetter("Visual_XAxis"),
|
5203 | properties: {
|
5204 | show: visuals.StandardObjectProperties.show,
|
5205 | axisScale: visuals.StandardObjectProperties.axisScale,
|
5206 | start: visuals.StandardObjectProperties.axisStart,
|
5207 | end: visuals.StandardObjectProperties.axisEnd,
|
5208 | showAxisTitle: {
|
5209 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
5210 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_XTitleDescription"),
|
5211 | type: {
|
5212 | bool: !0
|
5213 | }
|
5214 | },
|
5215 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
5216 | labelColor: visuals.StandardObjectProperties.labelColor,
|
5217 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
5218 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
5219 | }
|
5220 | },
|
5221 | valueAxis: {
|
5222 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis"),
|
5223 | properties: {
|
5224 | show: visuals.StandardObjectProperties.show,
|
5225 | position: visuals.StandardObjectProperties.yAxisPosition,
|
5226 | axisScale: visuals.StandardObjectProperties.axisScale,
|
5227 | start: visuals.StandardObjectProperties.axisStart,
|
5228 | end: visuals.StandardObjectProperties.axisEnd,
|
5229 | showAxisTitle: {
|
5230 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
5231 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_YTitleDescription"),
|
5232 | type: {
|
5233 | bool: !0
|
5234 | }
|
5235 | },
|
5236 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
5237 | labelColor: visuals.StandardObjectProperties.labelColor,
|
5238 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
5239 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
5240 | }
|
5241 | },
|
5242 | xAxisReferenceLine: {
|
5243 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_X"),
|
5244 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Description"),
|
5245 | properties: {
|
5246 | show: visuals.StandardObjectProperties.show,
|
5247 | value: {
|
5248 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value"),
|
5249 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value_Description"),
|
5250 | type: {
|
5251 | numeric: !0
|
5252 | }
|
5253 | },
|
5254 | lineColor: visuals.StandardObjectProperties.lineColor,
|
5255 | transparency: {
|
5256 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency"),
|
5257 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency_Description"),
|
5258 | type: {
|
5259 | numeric: !0
|
5260 | }
|
5261 | },
|
5262 | style: visuals.StandardObjectProperties.referenceLineStyle,
|
5263 | position: visuals.StandardObjectProperties.referenceLinePosition,
|
5264 | dataLabelShow: visuals.StandardObjectProperties.dataLabelShow,
|
5265 | dataLabelColor: visuals.StandardObjectProperties.dataLabelColor,
|
5266 | dataLabelDecimalPoints: visuals.StandardObjectProperties.dataLabelDecimalPoints,
|
5267 | dataLabelHorizontalPosition: visuals.StandardObjectProperties.dataLabelHorizontalPosition,
|
5268 | dataLabelVerticalPosition: visuals.StandardObjectProperties.dataLabelVerticalPosition,
|
5269 | dataLabelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits
|
5270 | }
|
5271 | },
|
5272 | y1AxisReferenceLine: {
|
5273 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Y"),
|
5274 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Description"),
|
5275 | properties: {
|
5276 | show: visuals.StandardObjectProperties.show,
|
5277 | value: {
|
5278 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value"),
|
5279 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value_Description"),
|
5280 | type: {
|
5281 | numeric: !0
|
5282 | }
|
5283 | },
|
5284 | lineColor: visuals.StandardObjectProperties.lineColor,
|
5285 | transparency: {
|
5286 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency"),
|
5287 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency_Description"),
|
5288 | type: {
|
5289 | numeric: !0
|
5290 | }
|
5291 | },
|
5292 | style: visuals.StandardObjectProperties.referenceLineStyle,
|
5293 | position: visuals.StandardObjectProperties.referenceLinePosition,
|
5294 | dataLabelShow: visuals.StandardObjectProperties.dataLabelShow,
|
5295 | dataLabelColor: visuals.StandardObjectProperties.dataLabelColor,
|
5296 | dataLabelDecimalPoints: visuals.StandardObjectProperties.dataLabelDecimalPoints,
|
5297 | dataLabelHorizontalPosition: visuals.StandardObjectProperties.dataLabelHorizontalPosition,
|
5298 | dataLabelVerticalPosition: visuals.StandardObjectProperties.dataLabelVerticalPosition,
|
5299 | dataLabelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits
|
5300 | }
|
5301 | },
|
5302 | legend: {
|
5303 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
5304 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
5305 | properties: {
|
5306 | show: visuals.StandardObjectProperties.show,
|
5307 | position: visuals.StandardObjectProperties.legendPosition,
|
5308 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
5309 | titleText: $.extend({}, visuals.StandardObjectProperties.legendTitle, {
|
5310 | suppressFormatPainterCopy: !0
|
5311 | }),
|
5312 | labelColor: visuals.StandardObjectProperties.labelColor,
|
5313 | fontSize: visuals.StandardObjectProperties.fontSize
|
5314 | }
|
5315 | },
|
5316 | categoryLabels: {
|
5317 | displayName: powerbi.data.createDisplayNameGetter("Visual_CategoryLabels"),
|
5318 | description: powerbi.data.createDisplayNameGetter("Visual_CategoryLabelsDescription"),
|
5319 | properties: {
|
5320 | show: visuals.StandardObjectProperties.show,
|
5321 | color: visuals.StandardObjectProperties.dataColor,
|
5322 | fontSize: visuals.StandardObjectProperties.fontSize
|
5323 | }
|
5324 | },
|
5325 | colorBorder: {
|
5326 | displayName: powerbi.data.createDisplayNameGetter("Visual_ColorBorder"),
|
5327 | properties: {
|
5328 | show: visuals.StandardObjectProperties.show
|
5329 | }
|
5330 | },
|
5331 | fillPoint: {
|
5332 | displayName: powerbi.data.createDisplayNameGetter("Visual_FillPoint"),
|
5333 | properties: {
|
5334 | show: visuals.StandardObjectProperties.show
|
5335 | }
|
5336 | },
|
5337 | colorByCategory: {
|
5338 | displayName: powerbi.data.createDisplayNameGetter("Visual_ColorByCategory"),
|
5339 | properties: {
|
5340 | show: visuals.StandardObjectProperties.show
|
5341 | }
|
5342 | },
|
5343 | currentFrameIndex: {
|
5344 | properties: {
|
5345 | index: {
|
5346 | type: {
|
5347 | numeric: !0
|
5348 | }
|
5349 | }
|
5350 | }
|
5351 | },
|
5352 | plotArea: {
|
5353 | displayName: powerbi.data.createDisplayNameGetter("Visual_Plot"),
|
5354 | properties: {
|
5355 | transparency: visuals.StandardObjectProperties.transparency,
|
5356 | image: visuals.StandardObjectProperties.image
|
5357 | }
|
5358 | }
|
5359 | },
|
5360 | dataViewMappings: [ {
|
5361 | conditions: [ {
|
5362 | Category: {
|
5363 | max: 1
|
5364 | },
|
5365 | Series: {
|
5366 | max: 1
|
5367 | },
|
5368 | X: {
|
5369 | max: 1
|
5370 | },
|
5371 | Y: {
|
5372 | max: 1
|
5373 | },
|
5374 | Size: {
|
5375 | max: 1
|
5376 | },
|
5377 | Gradient: {
|
5378 | max: 0
|
5379 | },
|
5380 | Play: {
|
5381 | max: 0
|
5382 | }
|
5383 | }, {
|
5384 | Category: {
|
5385 | max: 1
|
5386 | },
|
5387 | Series: {
|
5388 | max: 0
|
5389 | },
|
5390 | X: {
|
5391 | max: 1
|
5392 | },
|
5393 | Y: {
|
5394 | max: 1
|
5395 | },
|
5396 | Size: {
|
5397 | max: 1
|
5398 | },
|
5399 | Gradient: {
|
5400 | max: 1
|
5401 | },
|
5402 | Play: {
|
5403 | max: 0
|
5404 | }
|
5405 | } ],
|
5406 | categorical: {
|
5407 | categories: {
|
5408 | "for": {
|
5409 | "in": "Category"
|
5410 | }
|
5411 | },
|
5412 | values: {
|
5413 | group: {
|
5414 | by: "Series",
|
5415 | select: [ {
|
5416 | bind: {
|
5417 | to: "X"
|
5418 | }
|
5419 | }, {
|
5420 | bind: {
|
5421 | to: "Y"
|
5422 | }
|
5423 | }, {
|
5424 | bind: {
|
5425 | to: "Size"
|
5426 | }
|
5427 | }, {
|
5428 | bind: {
|
5429 | to: "Gradient"
|
5430 | }
|
5431 | } ]
|
5432 | }
|
5433 | },
|
5434 | rowCount: {
|
5435 | preferred: {
|
5436 | min: 2
|
5437 | }
|
5438 | },
|
5439 | dataReductionAlgorithm: {
|
5440 | sample: {}
|
5441 | },
|
5442 | dataVolume: 4
|
5443 | }
|
5444 | }, {
|
5445 | conditions: [ {
|
5446 | Category: {
|
5447 | max: 1
|
5448 | },
|
5449 | Series: {
|
5450 | max: 1
|
5451 | },
|
5452 | X: {
|
5453 | max: 1
|
5454 | },
|
5455 | Y: {
|
5456 | max: 1
|
5457 | },
|
5458 | Size: {
|
5459 | max: 1
|
5460 | },
|
5461 | Gradient: {
|
5462 | max: 0
|
5463 | },
|
5464 | Play: {
|
5465 | min: 1,
|
5466 | max: 1
|
5467 | }
|
5468 | }, {
|
5469 | Category: {
|
5470 | max: 1
|
5471 | },
|
5472 | Series: {
|
5473 | max: 0
|
5474 | },
|
5475 | X: {
|
5476 | max: 1
|
5477 | },
|
5478 | Y: {
|
5479 | max: 1
|
5480 | },
|
5481 | Size: {
|
5482 | max: 1
|
5483 | },
|
5484 | Gradient: {
|
5485 | max: 1
|
5486 | },
|
5487 | Play: {
|
5488 | min: 1,
|
5489 | max: 1
|
5490 | }
|
5491 | } ],
|
5492 | matrix: {
|
5493 | rows: {
|
5494 | select: [ {
|
5495 | bind: {
|
5496 | to: "Play"
|
5497 | }
|
5498 | }, {
|
5499 | bind: {
|
5500 | to: "Category"
|
5501 | }
|
5502 | } ],
|
5503 | dataReductionAlgorithm: {
|
5504 | bottom: {
|
5505 | count: 5e3
|
5506 | }
|
5507 | }
|
5508 | },
|
5509 | columns: {
|
5510 | "for": {
|
5511 | "in": "Series"
|
5512 | },
|
5513 | dataReductionAlgorithm: {
|
5514 | top: {
|
5515 | count: 60
|
5516 | }
|
5517 | }
|
5518 | },
|
5519 | values: {
|
5520 | select: [ {
|
5521 | bind: {
|
5522 | to: "X"
|
5523 | }
|
5524 | }, {
|
5525 | bind: {
|
5526 | to: "Y"
|
5527 | }
|
5528 | }, {
|
5529 | bind: {
|
5530 | to: "Size"
|
5531 | }
|
5532 | } ]
|
5533 | }
|
5534 | }
|
5535 | }, {
|
5536 | conditions: [ {
|
5537 | Category: {
|
5538 | max: 1
|
5539 | },
|
5540 | Series: {
|
5541 | max: 1
|
5542 | },
|
5543 | X: {
|
5544 | max: 1
|
5545 | },
|
5546 | Y: {
|
5547 | max: 1
|
5548 | },
|
5549 | Size: {
|
5550 | max: 0
|
5551 | },
|
5552 | Gradient: {
|
5553 | max: 0
|
5554 | },
|
5555 | Play: {
|
5556 | max: 0
|
5557 | }
|
5558 | }, {
|
5559 | Category: {
|
5560 | max: 1
|
5561 | },
|
5562 | Series: {
|
5563 | max: 0
|
5564 | },
|
5565 | X: {
|
5566 | max: 1
|
5567 | },
|
5568 | Y: {
|
5569 | max: 1
|
5570 | },
|
5571 | Size: {
|
5572 | max: 0
|
5573 | },
|
5574 | Gradient: {
|
5575 | max: 1
|
5576 | },
|
5577 | Play: {
|
5578 | max: 0
|
5579 | }
|
5580 | } ],
|
5581 | requiredProperties: [ {
|
5582 | objectName: "trend",
|
5583 | propertyName: "show"
|
5584 | } ],
|
5585 | usage: {
|
5586 | regression: {
|
5587 | combineSeries: {
|
5588 | objectName: "trend",
|
5589 | propertyName: "combineSeries"
|
5590 | }
|
5591 | }
|
5592 | },
|
5593 | categorical: {
|
5594 | categories: {
|
5595 | "for": {
|
5596 | "in": "regression.X"
|
5597 | }
|
5598 | },
|
5599 | values: {
|
5600 | group: {
|
5601 | by: "regression.Series",
|
5602 | select: [ {
|
5603 | "for": {
|
5604 | "in": "regression.Y"
|
5605 | }
|
5606 | } ]
|
5607 | }
|
5608 | },
|
5609 | dataReductionAlgorithm: {
|
5610 | sample: {}
|
5611 | },
|
5612 | dataVolume: 4
|
5613 | }
|
5614 | } ],
|
5615 | sorting: {
|
5616 | custom: {},
|
5617 | implicit: {
|
5618 | clauses: [ {
|
5619 | role: "Play",
|
5620 | direction: 1
|
5621 | } ]
|
5622 | }
|
5623 | },
|
5624 | drilldown: {
|
5625 | roles: [ "Category" ]
|
5626 | }
|
5627 | }, visuals.scatterChartProps = {
|
5628 | general: {
|
5629 | formatString: {
|
5630 | objectName: "general",
|
5631 | propertyName: "formatString"
|
5632 | }
|
5633 | },
|
5634 | dataPoint: {
|
5635 | defaultColor: {
|
5636 | objectName: "dataPoint",
|
5637 | propertyName: "defaultColor"
|
5638 | },
|
5639 | fill: {
|
5640 | objectName: "dataPoint",
|
5641 | propertyName: "fill"
|
5642 | }
|
5643 | },
|
5644 | trend: {
|
5645 | show: {
|
5646 | objectName: "trend",
|
5647 | propertyName: "show"
|
5648 | }
|
5649 | },
|
5650 | colorBorder: {
|
5651 | show: {
|
5652 | objectName: "colorBorder",
|
5653 | propertyName: "show"
|
5654 | }
|
5655 | },
|
5656 | fillPoint: {
|
5657 | show: {
|
5658 | objectName: "fillPoint",
|
5659 | propertyName: "show"
|
5660 | }
|
5661 | },
|
5662 | colorByCategory: {
|
5663 | show: {
|
5664 | objectName: "colorByCategory",
|
5665 | propertyName: "show"
|
5666 | }
|
5667 | },
|
5668 | currentFrameIndex: {
|
5669 | index: {
|
5670 | objectName: "currentFrameIndex",
|
5671 | propertyName: "index"
|
5672 | }
|
5673 | },
|
5674 | legend: {
|
5675 | labelColor: {
|
5676 | objectName: "legend",
|
5677 | propertyName: "labelColor"
|
5678 | }
|
5679 | },
|
5680 | plotArea: {
|
5681 | image: {
|
5682 | objectName: "plotArea",
|
5683 | propertyName: "image"
|
5684 | },
|
5685 | transparency: {
|
5686 | objectName: "plotArea",
|
5687 | propertyName: "transparency"
|
5688 | }
|
5689 | }
|
5690 | };
|
5691 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
5692 | }(powerbi || (powerbi = {}));
|
5693 | }, function(module, exports) {
|
5694 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
5695 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
5696 | !function(powerbi) {
|
5697 | var visuals;
|
5698 | !function(visuals) {
|
5699 | visuals.slicerCapabilities = {
|
5700 | dataRoles: [ {
|
5701 | name: "Values",
|
5702 | kind: powerbi.VisualDataRoleKind.Grouping,
|
5703 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Field"),
|
5704 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_FieldDescription")
|
5705 | } ],
|
5706 | objects: {
|
5707 | general: {
|
5708 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
5709 | properties: {
|
5710 | filter: {
|
5711 | type: {
|
5712 | filter: {}
|
5713 | }
|
5714 | },
|
5715 | selfFilter: {
|
5716 | type: {
|
5717 | filter: {
|
5718 | selfFilter: !0
|
5719 | }
|
5720 | }
|
5721 | },
|
5722 | defaultValue: {
|
5723 | type: {
|
5724 | expression: {
|
5725 | defaultValue: !0
|
5726 | }
|
5727 | }
|
5728 | },
|
5729 | formatString: visuals.StandardObjectProperties.formatString,
|
5730 | outlineColor: visuals.StandardObjectProperties.outlineColor,
|
5731 | outlineWeight: visuals.StandardObjectProperties.outlineWeight,
|
5732 | orientation: {
|
5733 | displayName: powerbi.data.createDisplayNameGetter("Slicer_Orientation"),
|
5734 | type: {
|
5735 | enumeration: visuals.slicerOrientation.type
|
5736 | }
|
5737 | },
|
5738 | count: {
|
5739 | type: {
|
5740 | integer: !0
|
5741 | }
|
5742 | },
|
5743 | selfFilterEnabled: {
|
5744 | type: {
|
5745 | operations: {
|
5746 | searchEnabled: !0
|
5747 | }
|
5748 | }
|
5749 | }
|
5750 | }
|
5751 | },
|
5752 | selection: {
|
5753 | displayName: powerbi.data.createDisplayNameGetter("Visual_SelectionControls"),
|
5754 | properties: {
|
5755 | selectAllCheckboxEnabled: {
|
5756 | displayName: powerbi.data.createDisplayNameGetter("Visual_SelectAll"),
|
5757 | type: {
|
5758 | bool: !0
|
5759 | }
|
5760 | },
|
5761 | singleSelect: {
|
5762 | displayName: powerbi.data.createDisplayNameGetter("Visual_SingleSelect"),
|
5763 | type: {
|
5764 | bool: !0
|
5765 | }
|
5766 | }
|
5767 | }
|
5768 | },
|
5769 | header: {
|
5770 | displayName: powerbi.data.createDisplayNameGetter("Visual_Header"),
|
5771 | properties: {
|
5772 | show: visuals.StandardObjectProperties.show,
|
5773 | fontColor: visuals.StandardObjectProperties.fontColor,
|
5774 | background: {
|
5775 | displayName: powerbi.data.createDisplayNameGetter("Visual_Background"),
|
5776 | type: {
|
5777 | fill: {
|
5778 | solid: {
|
5779 | color: !0
|
5780 | }
|
5781 | }
|
5782 | }
|
5783 | },
|
5784 | outline: visuals.StandardObjectProperties.outline,
|
5785 | textSize: {
|
5786 | displayName: powerbi.data.createDisplayNameGetter("Visual_TextSize"),
|
5787 | type: {
|
5788 | numeric: !0
|
5789 | }
|
5790 | }
|
5791 | }
|
5792 | },
|
5793 | items: {
|
5794 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Items"),
|
5795 | properties: {
|
5796 | fontColor: visuals.StandardObjectProperties.fontColor,
|
5797 | background: {
|
5798 | displayName: powerbi.data.createDisplayNameGetter("Visual_Background"),
|
5799 | type: {
|
5800 | fill: {
|
5801 | solid: {
|
5802 | color: !0
|
5803 | }
|
5804 | }
|
5805 | }
|
5806 | },
|
5807 | outline: visuals.StandardObjectProperties.outline,
|
5808 | textSize: {
|
5809 | displayName: powerbi.data.createDisplayNameGetter("Visual_TextSize"),
|
5810 | type: {
|
5811 | numeric: !0
|
5812 | }
|
5813 | }
|
5814 | }
|
5815 | }
|
5816 | },
|
5817 | dataViewMappings: [ {
|
5818 | conditions: [ {
|
5819 | Values: {
|
5820 | max: 1
|
5821 | }
|
5822 | } ],
|
5823 | categorical: {
|
5824 | categories: {
|
5825 | "for": {
|
5826 | "in": "Values"
|
5827 | },
|
5828 | dataReductionAlgorithm: {
|
5829 | window: {}
|
5830 | }
|
5831 | },
|
5832 | includeEmptyGroups: !0
|
5833 | }
|
5834 | } ],
|
5835 | sorting: {
|
5836 | "default": {}
|
5837 | },
|
5838 | suppressDefaultTitle: !0,
|
5839 | disableVisualDetails: !0
|
5840 | }, visuals.slicerProps = {
|
5841 | general: {
|
5842 | outlineColor: {
|
5843 | objectName: "general",
|
5844 | propertyName: "outlineColor"
|
5845 | },
|
5846 | outlineWeight: {
|
5847 | objectName: "general",
|
5848 | propertyName: "outlineWeight"
|
5849 | },
|
5850 | orientation: {
|
5851 | objectName: "general",
|
5852 | propertyName: "orientation"
|
5853 | },
|
5854 | count: {
|
5855 | objectName: "general",
|
5856 | propertyName: "count"
|
5857 | },
|
5858 | selfFilterEnabled: {
|
5859 | objectName: "general",
|
5860 | propertyName: "selfFilterEnabled"
|
5861 | }
|
5862 | },
|
5863 | selection: {
|
5864 | selectAllCheckboxEnabled: {
|
5865 | objectName: "selection",
|
5866 | propertyName: "selectAllCheckboxEnabled"
|
5867 | },
|
5868 | singleSelect: {
|
5869 | objectName: "selection",
|
5870 | propertyName: "singleSelect"
|
5871 | }
|
5872 | },
|
5873 | header: {
|
5874 | show: {
|
5875 | objectName: "header",
|
5876 | propertyName: "show"
|
5877 | },
|
5878 | fontColor: {
|
5879 | objectName: "header",
|
5880 | propertyName: "fontColor"
|
5881 | },
|
5882 | background: {
|
5883 | objectName: "header",
|
5884 | propertyName: "background"
|
5885 | },
|
5886 | outline: {
|
5887 | objectName: "header",
|
5888 | propertyName: "outline"
|
5889 | },
|
5890 | textSize: {
|
5891 | objectName: "header",
|
5892 | propertyName: "textSize"
|
5893 | }
|
5894 | },
|
5895 | items: {
|
5896 | fontColor: {
|
5897 | objectName: "items",
|
5898 | propertyName: "fontColor"
|
5899 | },
|
5900 | background: {
|
5901 | objectName: "items",
|
5902 | propertyName: "background"
|
5903 | },
|
5904 | outline: {
|
5905 | objectName: "items",
|
5906 | propertyName: "outline"
|
5907 | },
|
5908 | textSize: {
|
5909 | objectName: "items",
|
5910 | propertyName: "textSize"
|
5911 | }
|
5912 | },
|
5913 | filterPropertyIdentifier: {
|
5914 | objectName: "general",
|
5915 | propertyName: "filter"
|
5916 | },
|
5917 | selfFilterPropertyIdentifier: {
|
5918 | objectName: "general",
|
5919 | propertyName: "selfFilter"
|
5920 | },
|
5921 | formatString: {
|
5922 | objectName: "general",
|
5923 | propertyName: "formatString"
|
5924 | },
|
5925 | defaultValue: {
|
5926 | objectName: "general",
|
5927 | propertyName: "defaultValue"
|
5928 | }
|
5929 | };
|
5930 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
5931 | }(powerbi || (powerbi = {}));
|
5932 | }, function(module, exports) {
|
5933 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
5934 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
5935 | !function(powerbi) {
|
5936 | var visuals;
|
5937 | !function(visuals) {
|
5938 | visuals.tableCapabilities = {
|
5939 | dataRoles: [ {
|
5940 | name: "Values",
|
5941 | kind: powerbi.VisualDataRoleKind.GroupingOrMeasure,
|
5942 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values")
|
5943 | } ],
|
5944 | objects: {
|
5945 | general: {
|
5946 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
5947 | properties: {
|
5948 | formatString: visuals.StandardObjectProperties.formatString,
|
5949 | columnWidth: {
|
5950 | type: {
|
5951 | numeric: !0
|
5952 | }
|
5953 | },
|
5954 | totals: {
|
5955 | type: {
|
5956 | bool: !0
|
5957 | },
|
5958 | displayName: powerbi.data.createDisplayNameGetter("Visual_Totals"),
|
5959 | suppressFormatPainterCopy: !0
|
5960 | },
|
5961 | autoSizeColumnWidth: {
|
5962 | type: {
|
5963 | bool: !0
|
5964 | },
|
5965 | displayName: powerbi.data.createDisplayNameGetter("Visual_Adjust_Column_Width"),
|
5966 | suppressFormatPainterCopy: !0
|
5967 | },
|
5968 | textSize: {
|
5969 | displayName: powerbi.data.createDisplayNameGetter("Visual_TextSize"),
|
5970 | type: {
|
5971 | numeric: !0
|
5972 | }
|
5973 | }
|
5974 | }
|
5975 | },
|
5976 | grid: {
|
5977 | displayName: powerbi.data.createDisplayNameGetter("Visual_Grid"),
|
5978 | properties: {
|
5979 | outlineColor: visuals.StandardObjectProperties.outlineColor,
|
5980 | outlineWeight: visuals.StandardObjectProperties.outlineWeight,
|
5981 | gridVertical: {
|
5982 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridVertical"),
|
5983 | description: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Desc"),
|
5984 | type: {
|
5985 | bool: !0
|
5986 | }
|
5987 | },
|
5988 | gridVerticalColor: {
|
5989 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Color"),
|
5990 | description: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Color_Desc"),
|
5991 | type: {
|
5992 | fill: {
|
5993 | solid: {
|
5994 | color: !0
|
5995 | }
|
5996 | }
|
5997 | }
|
5998 | },
|
5999 | gridVerticalWeight: {
|
6000 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Weight"),
|
6001 | description: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Weight_Desc"),
|
6002 | type: {
|
6003 | numeric: !0
|
6004 | }
|
6005 | },
|
6006 | gridHorizontal: {
|
6007 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal"),
|
6008 | description: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Desc"),
|
6009 | type: {
|
6010 | bool: !0
|
6011 | }
|
6012 | },
|
6013 | gridHorizontalColor: {
|
6014 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Color"),
|
6015 | description: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Color_Desc"),
|
6016 | type: {
|
6017 | fill: {
|
6018 | solid: {
|
6019 | color: !0
|
6020 | }
|
6021 | }
|
6022 | }
|
6023 | },
|
6024 | gridHorizontalWeight: {
|
6025 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Weight"),
|
6026 | description: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Weight_Desc"),
|
6027 | type: {
|
6028 | numeric: !0
|
6029 | }
|
6030 | },
|
6031 | rowPadding: {
|
6032 | displayName: powerbi.data.createDisplayNameGetter("Visual_RowPadding"),
|
6033 | description: powerbi.data.createDisplayNameGetter("Visual_RowPadding_Desc"),
|
6034 | type: {
|
6035 | numeric: !0
|
6036 | }
|
6037 | },
|
6038 | imageHeight: {
|
6039 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_ImageHeight"),
|
6040 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_ImageHeight_Desc"),
|
6041 | type: {
|
6042 | numeric: !0
|
6043 | }
|
6044 | }
|
6045 | }
|
6046 | },
|
6047 | columnHeaders: {
|
6048 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_ColumnHeaders"),
|
6049 | properties: {
|
6050 | outline: visuals.StandardObjectProperties.outline,
|
6051 | fontColor: visuals.StandardObjectProperties.fontColor,
|
6052 | backColor: visuals.StandardObjectProperties.backColor
|
6053 | }
|
6054 | },
|
6055 | values: {
|
6056 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_Values"),
|
6057 | properties: {
|
6058 | outline: visuals.StandardObjectProperties.outline,
|
6059 | backColor: {
|
6060 | type: {
|
6061 | fill: {
|
6062 | solid: {
|
6063 | color: !0
|
6064 | }
|
6065 | }
|
6066 | }
|
6067 | },
|
6068 | fontColorPrimary: {
|
6069 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorPrimary"),
|
6070 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorPrimary_Desc"),
|
6071 | type: {
|
6072 | fill: {
|
6073 | solid: {
|
6074 | color: !0
|
6075 | }
|
6076 | }
|
6077 | }
|
6078 | },
|
6079 | backColorPrimary: {
|
6080 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorPrimary"),
|
6081 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorPrimary_Desc"),
|
6082 | type: {
|
6083 | fill: {
|
6084 | solid: {
|
6085 | color: !0
|
6086 | }
|
6087 | }
|
6088 | }
|
6089 | },
|
6090 | fontColorSecondary: {
|
6091 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorSecondary"),
|
6092 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorSecondary_Desc"),
|
6093 | type: {
|
6094 | fill: {
|
6095 | solid: {
|
6096 | color: !0
|
6097 | }
|
6098 | }
|
6099 | }
|
6100 | },
|
6101 | backColorSecondary: {
|
6102 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorSecondary"),
|
6103 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorSecondary_Desc"),
|
6104 | type: {
|
6105 | fill: {
|
6106 | solid: {
|
6107 | color: !0
|
6108 | }
|
6109 | }
|
6110 | }
|
6111 | },
|
6112 | urlIcon: {
|
6113 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_UrlIcon"),
|
6114 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_UrlIcon_Desc"),
|
6115 | type: {
|
6116 | bool: !0
|
6117 | }
|
6118 | }
|
6119 | }
|
6120 | },
|
6121 | total: {
|
6122 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_TotalGrand"),
|
6123 | properties: {
|
6124 | outline: visuals.StandardObjectProperties.outline,
|
6125 | fontColor: visuals.StandardObjectProperties.fontColor,
|
6126 | backColor: visuals.StandardObjectProperties.backColor
|
6127 | }
|
6128 | }
|
6129 | },
|
6130 | dataViewMappings: [ {
|
6131 | table: {
|
6132 | rows: {
|
6133 | "for": {
|
6134 | "in": "Values"
|
6135 | },
|
6136 | dataReductionAlgorithm: {
|
6137 | window: {
|
6138 | count: 500
|
6139 | }
|
6140 | }
|
6141 | },
|
6142 | rowCount: {
|
6143 | preferred: {
|
6144 | min: 1
|
6145 | }
|
6146 | }
|
6147 | }
|
6148 | } ],
|
6149 | sorting: {
|
6150 | custom: {}
|
6151 | },
|
6152 | suppressDefaultTitle: !0,
|
6153 | supportsSelection: !1,
|
6154 | disableVisualDetails: !0
|
6155 | };
|
6156 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
6157 | }(powerbi || (powerbi = {}));
|
6158 | }, function(module, exports) {
|
6159 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
6160 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
6161 | !function(powerbi) {
|
6162 | var visuals;
|
6163 | !function(visuals) {
|
6164 | visuals.matrixRoleNames = {
|
6165 | rows: "Rows",
|
6166 | columns: "Columns",
|
6167 | values: "Values"
|
6168 | }, visuals.matrixCapabilities = {
|
6169 | dataRoles: [ {
|
6170 | name: visuals.matrixRoleNames.rows,
|
6171 | kind: powerbi.VisualDataRoleKind.Grouping,
|
6172 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Rows"),
|
6173 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_RowsDescription")
|
6174 | }, {
|
6175 | name: visuals.matrixRoleNames.columns,
|
6176 | kind: powerbi.VisualDataRoleKind.Grouping,
|
6177 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Columns"),
|
6178 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_ColumnsDescription")
|
6179 | }, {
|
6180 | name: visuals.matrixRoleNames.values,
|
6181 | kind: powerbi.VisualDataRoleKind.Measure,
|
6182 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values")
|
6183 | } ],
|
6184 | objects: {
|
6185 | general: {
|
6186 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
6187 | properties: {
|
6188 | formatString: visuals.StandardObjectProperties.formatString,
|
6189 | columnWidth: {
|
6190 | type: {
|
6191 | numeric: !0
|
6192 | }
|
6193 | },
|
6194 | rowSubtotals: {
|
6195 | type: {
|
6196 | bool: !0
|
6197 | },
|
6198 | displayName: powerbi.data.createDisplayNameGetter("Visual_TotalRow"),
|
6199 | suppressFormatPainterCopy: !0
|
6200 | },
|
6201 | columnSubtotals: {
|
6202 | type: {
|
6203 | bool: !0
|
6204 | },
|
6205 | displayName: powerbi.data.createDisplayNameGetter("Visual_TotalColumn"),
|
6206 | suppressFormatPainterCopy: !0
|
6207 | },
|
6208 | autoSizeColumnWidth: {
|
6209 | type: {
|
6210 | bool: !0
|
6211 | },
|
6212 | displayName: powerbi.data.createDisplayNameGetter("Visual_Adjust_Column_Width"),
|
6213 | suppressFormatPainterCopy: !0
|
6214 | },
|
6215 | textSize: {
|
6216 | displayName: powerbi.data.createDisplayNameGetter("Visual_TextSize"),
|
6217 | type: {
|
6218 | numeric: !0
|
6219 | }
|
6220 | }
|
6221 | }
|
6222 | },
|
6223 | grid: {
|
6224 | displayName: powerbi.data.createDisplayNameGetter("Visual_Grid"),
|
6225 | properties: {
|
6226 | outlineColor: visuals.StandardObjectProperties.outlineColor,
|
6227 | outlineWeight: visuals.StandardObjectProperties.outlineWeight,
|
6228 | gridVertical: {
|
6229 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridVertical"),
|
6230 | description: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Desc"),
|
6231 | type: {
|
6232 | bool: !0
|
6233 | }
|
6234 | },
|
6235 | gridVerticalColor: {
|
6236 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Color"),
|
6237 | description: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Color_Desc"),
|
6238 | type: {
|
6239 | fill: {
|
6240 | solid: {
|
6241 | color: !0
|
6242 | }
|
6243 | }
|
6244 | }
|
6245 | },
|
6246 | gridVerticalWeight: {
|
6247 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Weight"),
|
6248 | description: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Weight_Desc"),
|
6249 | type: {
|
6250 | numeric: !0
|
6251 | }
|
6252 | },
|
6253 | gridHorizontal: {
|
6254 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal"),
|
6255 | description: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Desc"),
|
6256 | type: {
|
6257 | bool: !0
|
6258 | }
|
6259 | },
|
6260 | gridHorizontalColor: {
|
6261 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Color"),
|
6262 | description: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Color_Desc"),
|
6263 | type: {
|
6264 | fill: {
|
6265 | solid: {
|
6266 | color: !0
|
6267 | }
|
6268 | }
|
6269 | }
|
6270 | },
|
6271 | gridHorizontalWeight: {
|
6272 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Weight"),
|
6273 | description: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Weight_Desc"),
|
6274 | type: {
|
6275 | numeric: !0
|
6276 | }
|
6277 | },
|
6278 | rowPadding: {
|
6279 | displayName: powerbi.data.createDisplayNameGetter("Visual_RowPadding"),
|
6280 | description: powerbi.data.createDisplayNameGetter("Visual_RowPadding_Desc"),
|
6281 | type: {
|
6282 | numeric: !0
|
6283 | }
|
6284 | },
|
6285 | imageHeight: {
|
6286 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_ImageHeight"),
|
6287 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_ImageHeight_Desc"),
|
6288 | type: {
|
6289 | numeric: !0
|
6290 | }
|
6291 | }
|
6292 | }
|
6293 | },
|
6294 | columnHeaders: {
|
6295 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_ColumnHeaders"),
|
6296 | properties: {
|
6297 | outline: visuals.StandardObjectProperties.outline,
|
6298 | fontColor: visuals.StandardObjectProperties.fontColor,
|
6299 | backColor: visuals.StandardObjectProperties.backColor
|
6300 | }
|
6301 | },
|
6302 | rowHeaders: {
|
6303 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_RowHeaders"),
|
6304 | properties: {
|
6305 | outline: visuals.StandardObjectProperties.outline,
|
6306 | fontColor: visuals.StandardObjectProperties.fontColor,
|
6307 | backColor: visuals.StandardObjectProperties.backColor
|
6308 | }
|
6309 | },
|
6310 | values: {
|
6311 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_Values"),
|
6312 | properties: {
|
6313 | outline: visuals.StandardObjectProperties.outline,
|
6314 | fontColorPrimary: {
|
6315 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorPrimary"),
|
6316 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorPrimary_Desc"),
|
6317 | type: {
|
6318 | fill: {
|
6319 | solid: {
|
6320 | color: !0
|
6321 | }
|
6322 | }
|
6323 | }
|
6324 | },
|
6325 | backColorPrimary: {
|
6326 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorPrimary"),
|
6327 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorPrimary_Desc"),
|
6328 | type: {
|
6329 | fill: {
|
6330 | solid: {
|
6331 | color: !0
|
6332 | }
|
6333 | }
|
6334 | }
|
6335 | },
|
6336 | fontColorSecondary: {
|
6337 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorSecondary"),
|
6338 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorSecondary_Desc"),
|
6339 | type: {
|
6340 | fill: {
|
6341 | solid: {
|
6342 | color: !0
|
6343 | }
|
6344 | }
|
6345 | }
|
6346 | },
|
6347 | backColorSecondary: {
|
6348 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorSecondary"),
|
6349 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorSecondary_Desc"),
|
6350 | type: {
|
6351 | fill: {
|
6352 | solid: {
|
6353 | color: !0
|
6354 | }
|
6355 | }
|
6356 | }
|
6357 | }
|
6358 | }
|
6359 | },
|
6360 | subTotals: {
|
6361 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_TotalSub"),
|
6362 | properties: {
|
6363 | outline: visuals.StandardObjectProperties.outline,
|
6364 | fontColor: visuals.StandardObjectProperties.fontColor,
|
6365 | backColor: visuals.StandardObjectProperties.backColor
|
6366 | }
|
6367 | }
|
6368 | },
|
6369 | dataViewMappings: [ {
|
6370 | conditions: [ {
|
6371 | Rows: {
|
6372 | max: 0
|
6373 | },
|
6374 | Columns: {
|
6375 | max: 0
|
6376 | },
|
6377 | Values: {
|
6378 | min: 1
|
6379 | }
|
6380 | }, {
|
6381 | Rows: {
|
6382 | min: 1
|
6383 | },
|
6384 | Columns: {
|
6385 | min: 0
|
6386 | },
|
6387 | Values: {
|
6388 | min: 0
|
6389 | }
|
6390 | }, {
|
6391 | Rows: {
|
6392 | min: 0
|
6393 | },
|
6394 | Columns: {
|
6395 | min: 1
|
6396 | },
|
6397 | Values: {
|
6398 | min: 0
|
6399 | }
|
6400 | } ],
|
6401 | matrix: {
|
6402 | rows: {
|
6403 | "for": {
|
6404 | "in": "Rows"
|
6405 | },
|
6406 | dataReductionAlgorithm: {
|
6407 | window: {
|
6408 | count: 500
|
6409 | }
|
6410 | }
|
6411 | },
|
6412 | columns: {
|
6413 | "for": {
|
6414 | "in": "Columns"
|
6415 | },
|
6416 | dataReductionAlgorithm: {
|
6417 | top: {
|
6418 | count: 100
|
6419 | }
|
6420 | }
|
6421 | },
|
6422 | values: {
|
6423 | "for": {
|
6424 | "in": "Values"
|
6425 | }
|
6426 | }
|
6427 | }
|
6428 | } ],
|
6429 | filterMappings: {
|
6430 | measureFilter: {
|
6431 | targetRoles: [ visuals.matrixRoleNames.rows ]
|
6432 | }
|
6433 | },
|
6434 | sorting: {
|
6435 | custom: {}
|
6436 | },
|
6437 | suppressDefaultTitle: !0,
|
6438 | supportsSelection: !1,
|
6439 | disableVisualDetails: !0
|
6440 | };
|
6441 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
6442 | }(powerbi || (powerbi = {}));
|
6443 | }, function(module, exports) {
|
6444 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
6445 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
6446 | !function(powerbi) {
|
6447 | var visuals;
|
6448 | !function(visuals) {
|
6449 | visuals.treemapRoles = {
|
6450 | group: "Group",
|
6451 | details: "Details",
|
6452 | values: "Values",
|
6453 | gradient: "Gradient"
|
6454 | }, visuals.treemapCapabilities = {
|
6455 | dataRoles: [ {
|
6456 | name: "Group",
|
6457 | kind: powerbi.VisualDataRoleKind.Grouping,
|
6458 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Group"),
|
6459 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GroupTreemapDescription")
|
6460 | }, {
|
6461 | name: "Details",
|
6462 | kind: powerbi.VisualDataRoleKind.Grouping,
|
6463 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Details")
|
6464 | }, {
|
6465 | name: "Values",
|
6466 | kind: powerbi.VisualDataRoleKind.Measure,
|
6467 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values"),
|
6468 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_ValuesDescription"),
|
6469 | requiredTypes: [ {
|
6470 | numeric: !0
|
6471 | }, {
|
6472 | integer: !0
|
6473 | } ]
|
6474 | }, {
|
6475 | name: "Gradient",
|
6476 | kind: powerbi.VisualDataRoleKind.Measure,
|
6477 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Gradient"),
|
6478 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GradientDescription"),
|
6479 | requiredTypes: [ {
|
6480 | numeric: !0
|
6481 | }, {
|
6482 | integer: !0
|
6483 | } ],
|
6484 | joinPredicate: 0
|
6485 | } ],
|
6486 | objects: {
|
6487 | general: {
|
6488 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
6489 | properties: {
|
6490 | formatString: visuals.StandardObjectProperties.formatString
|
6491 | }
|
6492 | },
|
6493 | legend: {
|
6494 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
6495 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
6496 | properties: {
|
6497 | show: visuals.StandardObjectProperties.show,
|
6498 | position: visuals.StandardObjectProperties.legendPosition,
|
6499 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
6500 | titleText: visuals.StandardObjectProperties.legendTitle,
|
6501 | labelColor: visuals.StandardObjectProperties.labelColor,
|
6502 | fontSize: visuals.StandardObjectProperties.fontSize
|
6503 | }
|
6504 | },
|
6505 | dataPoint: {
|
6506 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
6507 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
6508 | properties: {
|
6509 | fill: {
|
6510 | type: {
|
6511 | fill: {
|
6512 | solid: {
|
6513 | color: !0
|
6514 | }
|
6515 | }
|
6516 | }
|
6517 | },
|
6518 | fillRule: {
|
6519 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gradient"),
|
6520 | type: {
|
6521 | fillRule: {}
|
6522 | },
|
6523 | rule: {
|
6524 | inputRole: "Gradient",
|
6525 | output: {
|
6526 | property: "fill",
|
6527 | selector: [ "Group" ]
|
6528 | }
|
6529 | }
|
6530 | }
|
6531 | }
|
6532 | },
|
6533 | labels: {
|
6534 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
6535 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabelsDescription"),
|
6536 | properties: {
|
6537 | show: visuals.StandardObjectProperties.show,
|
6538 | color: visuals.StandardObjectProperties.dataColor,
|
6539 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
6540 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
6541 | }
|
6542 | },
|
6543 | categoryLabels: {
|
6544 | displayName: powerbi.data.createDisplayNameGetter("Visual_CategoryLabels"),
|
6545 | description: powerbi.data.createDisplayNameGetter("Visual_CategoryLabelsDescription"),
|
6546 | properties: {
|
6547 | show: visuals.StandardObjectProperties.show
|
6548 | }
|
6549 | }
|
6550 | },
|
6551 | dataViewMappings: [ {
|
6552 | conditions: [ {
|
6553 | Group: {
|
6554 | max: 1
|
6555 | },
|
6556 | Details: {
|
6557 | max: 0
|
6558 | },
|
6559 | Gradient: {
|
6560 | max: 1
|
6561 | }
|
6562 | }, {
|
6563 | Group: {
|
6564 | max: 1
|
6565 | },
|
6566 | Details: {
|
6567 | min: 1,
|
6568 | max: 1
|
6569 | },
|
6570 | Values: {
|
6571 | max: 1
|
6572 | },
|
6573 | Gradient: {
|
6574 | max: 0
|
6575 | }
|
6576 | } ],
|
6577 | categorical: {
|
6578 | categories: {
|
6579 | "for": {
|
6580 | "in": "Group"
|
6581 | },
|
6582 | dataReductionAlgorithm: {
|
6583 | top: {}
|
6584 | }
|
6585 | },
|
6586 | values: {
|
6587 | group: {
|
6588 | by: "Details",
|
6589 | select: [ {
|
6590 | bind: {
|
6591 | to: "Values"
|
6592 | }
|
6593 | }, {
|
6594 | bind: {
|
6595 | to: "Gradient"
|
6596 | }
|
6597 | } ],
|
6598 | dataReductionAlgorithm: {
|
6599 | top: {}
|
6600 | }
|
6601 | }
|
6602 | },
|
6603 | rowCount: {
|
6604 | preferred: {
|
6605 | min: 2
|
6606 | }
|
6607 | }
|
6608 | }
|
6609 | } ],
|
6610 | supportsHighlight: !0,
|
6611 | sorting: {
|
6612 | custom: {},
|
6613 | implicit: {
|
6614 | clauses: [ {
|
6615 | role: "Values",
|
6616 | direction: 2
|
6617 | } ]
|
6618 | }
|
6619 | },
|
6620 | drilldown: {
|
6621 | roles: [ "Group" ]
|
6622 | }
|
6623 | }, visuals.treemapProps = {
|
6624 | general: {
|
6625 | formatString: {
|
6626 | objectName: "general",
|
6627 | propertyName: "formatString"
|
6628 | }
|
6629 | },
|
6630 | dataPoint: {
|
6631 | fill: {
|
6632 | objectName: "dataPoint",
|
6633 | propertyName: "fill"
|
6634 | }
|
6635 | },
|
6636 | legend: {
|
6637 | show: {
|
6638 | objectName: "legend",
|
6639 | propertyName: "show"
|
6640 | },
|
6641 | position: {
|
6642 | objectName: "legend",
|
6643 | propertyName: "position"
|
6644 | },
|
6645 | showTitle: {
|
6646 | objectName: "legend",
|
6647 | propertyName: "showTitle"
|
6648 | },
|
6649 | titleText: {
|
6650 | objectName: "legend",
|
6651 | propertyName: "titleText"
|
6652 | },
|
6653 | labelColor: {
|
6654 | objectName: "legend",
|
6655 | propertyName: "labelColor"
|
6656 | }
|
6657 | },
|
6658 | labels: {
|
6659 | show: {
|
6660 | objectName: "labels",
|
6661 | propertyName: "show"
|
6662 | },
|
6663 | color: {
|
6664 | objectName: "labels",
|
6665 | propertyName: "color"
|
6666 | },
|
6667 | labelDisplayUnits: {
|
6668 | objectName: "labels",
|
6669 | propertyName: "labelDisplayUnits"
|
6670 | },
|
6671 | labelPrecision: {
|
6672 | objectName: "labels",
|
6673 | propertyName: "labelPrecision"
|
6674 | }
|
6675 | },
|
6676 | categoryLabels: {
|
6677 | show: {
|
6678 | objectName: "categoryLabels",
|
6679 | propertyName: "show"
|
6680 | }
|
6681 | }
|
6682 | };
|
6683 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
6684 | }(powerbi || (powerbi = {}));
|
6685 | }, function(module, exports) {
|
6686 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
6687 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
6688 | !function(powerbi) {
|
6689 | var visuals;
|
6690 | !function(visuals) {
|
6691 | visuals.cardCapabilities = {
|
6692 | dataRoles: [ {
|
6693 | name: "Values",
|
6694 | kind: powerbi.VisualDataRoleKind.Measure,
|
6695 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Fields"),
|
6696 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_FieldsDescription")
|
6697 | } ],
|
6698 | objects: {
|
6699 | general: {
|
6700 | properties: {
|
6701 | formatString: visuals.StandardObjectProperties.formatString
|
6702 | }
|
6703 | },
|
6704 | labels: {
|
6705 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointLabel"),
|
6706 | properties: {
|
6707 | color: visuals.StandardObjectProperties.dataColor,
|
6708 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
6709 | labelPrecision: visuals.StandardObjectProperties.labelPrecision,
|
6710 | fontSize: visuals.StandardObjectProperties.fontSize
|
6711 | }
|
6712 | },
|
6713 | categoryLabels: {
|
6714 | displayName: powerbi.data.createDisplayNameGetter("Visual_CategoryLabel"),
|
6715 | properties: {
|
6716 | show: visuals.StandardObjectProperties.show,
|
6717 | color: visuals.StandardObjectProperties.dataColor,
|
6718 | fontSize: visuals.StandardObjectProperties.fontSize
|
6719 | }
|
6720 | },
|
6721 | wordWrap: {
|
6722 | displayName: powerbi.data.createDisplayNameGetter("Visual_WordWrap"),
|
6723 | properties: {
|
6724 | show: visuals.StandardObjectProperties.show
|
6725 | }
|
6726 | }
|
6727 | },
|
6728 | dataViewMappings: [ {
|
6729 | conditions: [ {
|
6730 | Values: {
|
6731 | max: 1
|
6732 | }
|
6733 | } ],
|
6734 | single: {
|
6735 | role: "Values"
|
6736 | }
|
6737 | } ],
|
6738 | suppressDefaultTitle: !0,
|
6739 | supportsSelection: !1
|
6740 | }, visuals.cardProps = {
|
6741 | categoryLabels: {
|
6742 | show: {
|
6743 | objectName: "categoryLabels",
|
6744 | propertyName: "show"
|
6745 | },
|
6746 | color: {
|
6747 | objectName: "categoryLabels",
|
6748 | propertyName: "color"
|
6749 | },
|
6750 | fontSize: {
|
6751 | objectName: "categoryLabels",
|
6752 | propertyName: "fontSize"
|
6753 | }
|
6754 | },
|
6755 | labels: {
|
6756 | color: {
|
6757 | objectName: "labels",
|
6758 | propertyName: "color"
|
6759 | },
|
6760 | labelPrecision: {
|
6761 | objectName: "labels",
|
6762 | propertyName: "labelPrecision"
|
6763 | },
|
6764 | labelDisplayUnits: {
|
6765 | objectName: "labels",
|
6766 | propertyName: "labelDisplayUnits"
|
6767 | },
|
6768 | fontSize: {
|
6769 | objectName: "labels",
|
6770 | propertyName: "fontSize"
|
6771 | }
|
6772 | },
|
6773 | wordWrap: {
|
6774 | show: {
|
6775 | objectName: "wordWrap",
|
6776 | propertyName: "show"
|
6777 | }
|
6778 | }
|
6779 | };
|
6780 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
6781 | }(powerbi || (powerbi = {}));
|
6782 | }, function(module, exports) {
|
6783 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
6784 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
6785 | !function(powerbi) {
|
6786 | var visuals;
|
6787 | !function(visuals) {
|
6788 | visuals.waterfallChartCapabilities = {
|
6789 | dataRoles: [ {
|
6790 | name: "Category",
|
6791 | kind: powerbi.VisualDataRoleKind.Grouping,
|
6792 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Category"),
|
6793 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_CategoryWaterfallDescription")
|
6794 | }, {
|
6795 | name: "Y",
|
6796 | kind: powerbi.VisualDataRoleKind.Measure,
|
6797 | requiredTypes: [ {
|
6798 | numeric: !0
|
6799 | }, {
|
6800 | integer: !0
|
6801 | } ],
|
6802 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Y")
|
6803 | } ],
|
6804 | objects: {
|
6805 | general: {
|
6806 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
6807 | properties: {
|
6808 | formatString: visuals.StandardObjectProperties.formatString
|
6809 | }
|
6810 | },
|
6811 | legend: {
|
6812 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
6813 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
6814 | properties: {
|
6815 | show: visuals.StandardObjectProperties.show,
|
6816 | position: visuals.StandardObjectProperties.legendPosition,
|
6817 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
6818 | titleText: $.extend({}, visuals.StandardObjectProperties.legendTitle, {
|
6819 | suppressFormatPainterCopy: !0
|
6820 | }),
|
6821 | labelColor: visuals.StandardObjectProperties.labelColor,
|
6822 | fontSize: visuals.StandardObjectProperties.fontSize
|
6823 | }
|
6824 | },
|
6825 | labels: {
|
6826 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
6827 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabelsDescription"),
|
6828 | properties: {
|
6829 | show: visuals.StandardObjectProperties.show,
|
6830 | color: visuals.StandardObjectProperties.dataColor,
|
6831 | labelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits,
|
6832 | labelPrecision: $.extend({}, visuals.StandardObjectProperties.labelPrecision, {
|
6833 | suppressFormatPainterCopy: !0
|
6834 | }),
|
6835 | fontSize: visuals.StandardObjectProperties.fontSize
|
6836 | }
|
6837 | },
|
6838 | sentimentColors: {
|
6839 | displayName: powerbi.data.createDisplayNameGetter("Waterfall_SentimentColors"),
|
6840 | properties: {
|
6841 | increaseFill: {
|
6842 | displayName: powerbi.data.createDisplayNameGetter("Waterfall_IncreaseLabel"),
|
6843 | type: {
|
6844 | fill: {
|
6845 | solid: {
|
6846 | color: !0
|
6847 | }
|
6848 | }
|
6849 | }
|
6850 | },
|
6851 | decreaseFill: {
|
6852 | displayName: powerbi.data.createDisplayNameGetter("Waterfall_DecreaseLabel"),
|
6853 | type: {
|
6854 | fill: {
|
6855 | solid: {
|
6856 | color: !0
|
6857 | }
|
6858 | }
|
6859 | }
|
6860 | },
|
6861 | totalFill: {
|
6862 | displayName: powerbi.data.createDisplayNameGetter("Waterfall_TotalLabel"),
|
6863 | type: {
|
6864 | fill: {
|
6865 | solid: {
|
6866 | color: !0
|
6867 | }
|
6868 | }
|
6869 | }
|
6870 | }
|
6871 | }
|
6872 | },
|
6873 | categoryAxis: {
|
6874 | displayName: powerbi.data.createDisplayNameGetter("Visual_XAxis"),
|
6875 | properties: {
|
6876 | show: visuals.StandardObjectProperties.show,
|
6877 | showAxisTitle: {
|
6878 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
6879 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_XTitleDescription"),
|
6880 | type: {
|
6881 | bool: !0
|
6882 | }
|
6883 | },
|
6884 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
6885 | labelColor: visuals.StandardObjectProperties.labelColor
|
6886 | }
|
6887 | },
|
6888 | valueAxis: {
|
6889 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis"),
|
6890 | properties: {
|
6891 | show: visuals.StandardObjectProperties.show,
|
6892 | position: visuals.StandardObjectProperties.yAxisPosition,
|
6893 | start: visuals.StandardObjectProperties.axisStart,
|
6894 | end: visuals.StandardObjectProperties.axisEnd,
|
6895 | showAxisTitle: {
|
6896 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
6897 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_YTitleDescription"),
|
6898 | type: {
|
6899 | bool: !0
|
6900 | }
|
6901 | },
|
6902 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
6903 | labelColor: visuals.StandardObjectProperties.labelColor,
|
6904 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
6905 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
6906 | }
|
6907 | },
|
6908 | y1AxisReferenceLine: {
|
6909 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line"),
|
6910 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Description"),
|
6911 | properties: {
|
6912 | show: visuals.StandardObjectProperties.show,
|
6913 | value: {
|
6914 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value"),
|
6915 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value_Description"),
|
6916 | type: {
|
6917 | numeric: !0
|
6918 | }
|
6919 | },
|
6920 | lineColor: visuals.StandardObjectProperties.lineColor,
|
6921 | transparency: {
|
6922 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency"),
|
6923 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency_Description"),
|
6924 | type: {
|
6925 | numeric: !0
|
6926 | }
|
6927 | },
|
6928 | style: visuals.StandardObjectProperties.referenceLineStyle,
|
6929 | position: visuals.StandardObjectProperties.referenceLinePosition,
|
6930 | dataLabelShow: visuals.StandardObjectProperties.dataLabelShow,
|
6931 | dataLabelColor: visuals.StandardObjectProperties.dataLabelColor,
|
6932 | dataLabelDecimalPoints: visuals.StandardObjectProperties.dataLabelDecimalPoints,
|
6933 | dataLabelHorizontalPosition: visuals.StandardObjectProperties.dataLabelHorizontalPosition,
|
6934 | dataLabelVerticalPosition: visuals.StandardObjectProperties.dataLabelVerticalPosition,
|
6935 | dataLabelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits
|
6936 | }
|
6937 | },
|
6938 | plotArea: {
|
6939 | displayName: powerbi.data.createDisplayNameGetter("Visual_Plot"),
|
6940 | properties: {
|
6941 | transparency: visuals.StandardObjectProperties.transparency,
|
6942 | image: visuals.StandardObjectProperties.image
|
6943 | }
|
6944 | }
|
6945 | },
|
6946 | dataViewMappings: [ {
|
6947 | conditions: [ {
|
6948 | Category: {
|
6949 | max: 1
|
6950 | },
|
6951 | Y: {
|
6952 | max: 1
|
6953 | }
|
6954 | } ],
|
6955 | categorical: {
|
6956 | categories: {
|
6957 | "for": {
|
6958 | "in": "Category"
|
6959 | },
|
6960 | dataReductionAlgorithm: {
|
6961 | top: {}
|
6962 | }
|
6963 | },
|
6964 | values: {
|
6965 | select: [ {
|
6966 | bind: {
|
6967 | to: "Y"
|
6968 | }
|
6969 | } ]
|
6970 | }
|
6971 | }
|
6972 | } ],
|
6973 | sorting: {
|
6974 | "default": {}
|
6975 | },
|
6976 | drilldown: {
|
6977 | roles: [ "Category" ]
|
6978 | }
|
6979 | }, visuals.waterfallChartProps = {
|
6980 | general: {
|
6981 | formatString: {
|
6982 | objectName: "general",
|
6983 | propertyName: "formatString"
|
6984 | }
|
6985 | },
|
6986 | sentimentColors: {
|
6987 | increaseFill: {
|
6988 | objectName: "sentimentColors",
|
6989 | propertyName: "increaseFill"
|
6990 | },
|
6991 | decreaseFill: {
|
6992 | objectName: "sentimentColors",
|
6993 | propertyName: "decreaseFill"
|
6994 | },
|
6995 | totalFill: {
|
6996 | objectName: "sentimentColors",
|
6997 | propertyName: "totalFill"
|
6998 | }
|
6999 | },
|
7000 | legend: {
|
7001 | labelColor: {
|
7002 | objectName: "legend",
|
7003 | propertyName: "labelColor"
|
7004 | }
|
7005 | }
|
7006 | };
|
7007 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7008 | }(powerbi || (powerbi = {}));
|
7009 | }, function(module, exports) {
|
7010 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7011 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7012 | !function(powerbi) {
|
7013 | var visuals;
|
7014 | !function(visuals) {
|
7015 | visuals.KPIStatusWithHistoryCapabilities = {
|
7016 | dataRoles: [ {
|
7017 | name: "Indicator",
|
7018 | kind: powerbi.VisualDataRoleKind.Measure,
|
7019 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Indicator"),
|
7020 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_IndicatorDescription")
|
7021 | }, {
|
7022 | name: "TrendLine",
|
7023 | kind: powerbi.VisualDataRoleKind.Grouping,
|
7024 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_TrendLine"),
|
7025 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Trendline_Description")
|
7026 | }, {
|
7027 | name: "Goal",
|
7028 | kind: powerbi.VisualDataRoleKind.Measure,
|
7029 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Goal"),
|
7030 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_GoalDescription")
|
7031 | } ],
|
7032 | dataViewMappings: [ {
|
7033 | conditions: [ {
|
7034 | Indicator: {
|
7035 | max: 1
|
7036 | },
|
7037 | TrendLine: {
|
7038 | max: 1
|
7039 | },
|
7040 | Goal: {
|
7041 | max: 2
|
7042 | }
|
7043 | } ],
|
7044 | categorical: {
|
7045 | categories: {
|
7046 | "for": {
|
7047 | "in": "TrendLine"
|
7048 | },
|
7049 | dataReductionAlgorithm: {
|
7050 | top: {}
|
7051 | }
|
7052 | },
|
7053 | values: {
|
7054 | select: [ {
|
7055 | bind: {
|
7056 | to: "Indicator"
|
7057 | }
|
7058 | }, {
|
7059 | bind: {
|
7060 | to: "Goal"
|
7061 | }
|
7062 | } ]
|
7063 | }
|
7064 | }
|
7065 | } ],
|
7066 | objects: {
|
7067 | general: {
|
7068 | properties: {
|
7069 | formatString: visuals.StandardObjectProperties.formatString
|
7070 | }
|
7071 | },
|
7072 | indicator: {
|
7073 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Indicator"),
|
7074 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_IndicatorDescription"),
|
7075 | properties: {
|
7076 | indicatorDisplayUnits: {
|
7077 | displayName: powerbi.data.createDisplayNameGetter("Visual_DisplayUnits"),
|
7078 | description: powerbi.data.createDisplayNameGetter("Visual_DisplayUnitsDescription"),
|
7079 | type: {
|
7080 | formatting: {
|
7081 | labelDisplayUnits: !0
|
7082 | }
|
7083 | }
|
7084 | },
|
7085 | indicatorPrecision: {
|
7086 | displayName: powerbi.data.createDisplayNameGetter("Visual_Precision"),
|
7087 | description: powerbi.data.createDisplayNameGetter("Visual_PrecisionDescription"),
|
7088 | placeHolderText: powerbi.data.createDisplayNameGetter("Visual_Precision_Auto"),
|
7089 | type: {
|
7090 | numeric: !0
|
7091 | }
|
7092 | },
|
7093 | kpiFormat: {
|
7094 | displayName: powerbi.data.createDisplayNameGetter("TaskPane_Format"),
|
7095 | type: {
|
7096 | text: !0
|
7097 | }
|
7098 | }
|
7099 | }
|
7100 | },
|
7101 | trendline: {
|
7102 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_TrendLine"),
|
7103 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Trendline_Description"),
|
7104 | properties: {
|
7105 | show: visuals.StandardObjectProperties.show
|
7106 | }
|
7107 | },
|
7108 | goals: {
|
7109 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Goals"),
|
7110 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Goals"),
|
7111 | properties: {
|
7112 | showGoal: {
|
7113 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Show_Goal"),
|
7114 | type: {
|
7115 | bool: !0
|
7116 | }
|
7117 | },
|
7118 | showDistance: {
|
7119 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Show_Distance"),
|
7120 | type: {
|
7121 | bool: !0
|
7122 | }
|
7123 | }
|
7124 | }
|
7125 | },
|
7126 | status: {
|
7127 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Status"),
|
7128 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Status"),
|
7129 | properties: {
|
7130 | direction: {
|
7131 | displayName: powerbi.data.createDisplayNameGetter("Visual_KPI_Direction"),
|
7132 | type: {
|
7133 | enumeration: visuals.kpiDirection.type
|
7134 | }
|
7135 | }
|
7136 | }
|
7137 | }
|
7138 | }
|
7139 | };
|
7140 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7141 | }(powerbi || (powerbi = {}));
|
7142 | }, function(module, exports) {
|
7143 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7144 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7145 | !function(powerbi) {
|
7146 | var visuals;
|
7147 | !function(visuals) {
|
7148 | var capabilities;
|
7149 | !function(capabilities) {
|
7150 | capabilities.animatedNumber = powerbi.visuals.animatedNumberCapabilities, capabilities.areaChart = powerbi.visuals.lineChartCapabilities,
|
7151 | capabilities.barChart = powerbi.visuals.getColumnChartCapabilities(!0), capabilities.card = powerbi.visuals.cardCapabilities,
|
7152 | capabilities.multiRowCard = powerbi.visuals.multiRowCardCapabilities, capabilities.clusteredBarChart = powerbi.visuals.getColumnChartCapabilities(!0),
|
7153 | capabilities.clusteredColumnChart = powerbi.visuals.getColumnChartCapabilities(),
|
7154 | capabilities.columnChart = powerbi.visuals.getColumnChartCapabilities(), capabilities.comboChart = powerbi.visuals.comboChartCapabilities,
|
7155 | capabilities.dataDotChart = powerbi.visuals.dataDotChartCapabilities, capabilities.dataDotClusteredColumnComboChart = powerbi.visuals.comboChartCapabilities,
|
7156 | capabilities.dataDotStackedColumnComboChart = powerbi.visuals.comboChartCapabilities,
|
7157 | capabilities.donutChart = powerbi.visuals.donutChartCapabilities, capabilities.funnel = powerbi.visuals.funnelChartCapabilities,
|
7158 | capabilities.gauge = powerbi.visuals.gaugeCapabilities, capabilities.hundredPercentStackedBarChart = powerbi.visuals.getColumnChartCapabilities(!0),
|
7159 | capabilities.hundredPercentStackedColumnChart = powerbi.visuals.getColumnChartCapabilities(),
|
7160 | capabilities.image = powerbi.visuals.imageVisualCapabilities, capabilities.lineChart = powerbi.visuals.lineChartCapabilities,
|
7161 | capabilities.lineStackedColumnComboChart = powerbi.visuals.comboChartCapabilities,
|
7162 | capabilities.lineClusteredColumnComboChart = powerbi.visuals.comboChartCapabilities,
|
7163 | capabilities.map = powerbi.visuals.mapCapabilities, capabilities.filledMap = powerbi.visuals.filledMapCapabilities,
|
7164 | capabilities.treemap = powerbi.visuals.treemapCapabilities, capabilities.pieChart = powerbi.visuals.donutChartCapabilities,
|
7165 | capabilities.scatterChart = powerbi.visuals.scatterChartCapabilities, capabilities.table = powerbi.visuals.tableCapabilities,
|
7166 | capabilities.matrix = powerbi.visuals.matrixCapabilities, capabilities.slicer = powerbi.visuals.slicerCapabilities,
|
7167 | capabilities.textbox = powerbi.visuals.textboxCapabilities, capabilities.waterfallChart = powerbi.visuals.waterfallChartCapabilities,
|
7168 | capabilities.cheerMeter = powerbi.visuals.cheerMeterCapabilities, capabilities.scriptVisual = powerbi.visuals.scriptVisualCapabilities,
|
7169 | capabilities.kpi = powerbi.visuals.KPIStatusWithHistoryCapabilities;
|
7170 | }(capabilities = visuals.capabilities || (visuals.capabilities = {}));
|
7171 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7172 | }(powerbi || (powerbi = {}));
|
7173 | }, function(module, exports) {
|
7174 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7175 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7176 | !function(powerbi) {
|
7177 | var visuals;
|
7178 | !function(visuals) {
|
7179 | var ColumnChartWebBehavior = function() {
|
7180 | function ColumnChartWebBehavior() {}
|
7181 | return ColumnChartWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7182 | this.options = options;
|
7183 | var eventGroup = options.eventGroup;
|
7184 | eventGroup.on("click", function() {
|
7185 | var d = ColumnChartWebBehavior.getDatumForLastInputEvent();
|
7186 | selectionHandler.handleSelection(d, d3.event.ctrlKey);
|
7187 | }), eventGroup.on("contextmenu", function() {
|
7188 | if (!d3.event.ctrlKey) {
|
7189 | d3.event.preventDefault();
|
7190 | var d = ColumnChartWebBehavior.getDatumForLastInputEvent(), position = visuals.InteractivityUtils.getPositionOfLastInputEvent();
|
7191 | selectionHandler.handleContextMenu(d, position);
|
7192 | }
|
7193 | });
|
7194 | }, ColumnChartWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7195 | var options = this.options;
|
7196 | options.bars.style("fill-opacity", function(d) {
|
7197 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, !d.highlight && hasSelection, !d.selected && options.hasHighlights);
|
7198 | });
|
7199 | }, ColumnChartWebBehavior.getDatumForLastInputEvent = function() {
|
7200 | var target = d3.event.target;
|
7201 | return d3.select(target).datum();
|
7202 | }, ColumnChartWebBehavior;
|
7203 | }();
|
7204 | visuals.ColumnChartWebBehavior = ColumnChartWebBehavior;
|
7205 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7206 | }(powerbi || (powerbi = {}));
|
7207 | }, function(module, exports) {
|
7208 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7209 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7210 | !function(powerbi) {
|
7211 | var visuals;
|
7212 | !function(visuals) {
|
7213 | var DataDotChartWebBehavior = function() {
|
7214 | function DataDotChartWebBehavior() {}
|
7215 | return DataDotChartWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7216 | var dots = this.dots = options.dots, dotLabels = options.dotLabels;
|
7217 | visuals.InteractivityUtils.registerStandardInteractivityHandlers(dots, selectionHandler),
|
7218 | dotLabels && visuals.InteractivityUtils.registerStandardInteractivityHandlers(dotLabels, selectionHandler);
|
7219 | }, DataDotChartWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7220 | this.dots.style("fill-opacity", function(d) {
|
7221 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, !1);
|
7222 | });
|
7223 | }, DataDotChartWebBehavior;
|
7224 | }();
|
7225 | visuals.DataDotChartWebBehavior = DataDotChartWebBehavior;
|
7226 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7227 | }(powerbi || (powerbi = {}));
|
7228 | }, function(module, exports) {
|
7229 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7230 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7231 | !function(powerbi) {
|
7232 | var visuals;
|
7233 | !function(visuals) {
|
7234 | var DonutChartWebBehavior = function() {
|
7235 | function DonutChartWebBehavior() {}
|
7236 | return DonutChartWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7237 | var slices = this.slices = options.slices, highlightSlices = this.highlightSlices = options.highlightSlices, clearCatcher = options.clearCatcher;
|
7238 | this.hasHighlights = options.hasHighlights;
|
7239 | var clickHandler = function(d) {
|
7240 | selectionHandler.handleSelection(d.data, d3.event.ctrlKey);
|
7241 | }, contextMenuHandler = function(d) {
|
7242 | if (!d3.event.ctrlKey) {
|
7243 | var position = visuals.InteractivityUtils.getPositionOfLastInputEvent();
|
7244 | selectionHandler.handleContextMenu(d.data, position), d3.event.preventDefault();
|
7245 | }
|
7246 | };
|
7247 | slices.on("click", clickHandler), slices.on("contextmenu", contextMenuHandler),
|
7248 | highlightSlices.on("click", clickHandler), highlightSlices.on("contextmenu", contextMenuHandler),
|
7249 | clearCatcher.on("click", function() {
|
7250 | selectionHandler.handleClearSelection();
|
7251 | });
|
7252 | }, DonutChartWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7253 | var hasHighlights = this.hasHighlights;
|
7254 | this.slices.style("fill-opacity", function(d) {
|
7255 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, hasSelection, hasHighlights && !d.data.selected);
|
7256 | }), this.highlightSlices.style("fill-opacity", function(d) {
|
7257 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !0, !1, hasHighlights);
|
7258 | });
|
7259 | }, DonutChartWebBehavior;
|
7260 | }();
|
7261 | visuals.DonutChartWebBehavior = DonutChartWebBehavior;
|
7262 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7263 | }(powerbi || (powerbi = {}));
|
7264 | }, function(module, exports) {
|
7265 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7266 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7267 | !function(powerbi) {
|
7268 | var visuals;
|
7269 | !function(visuals) {
|
7270 | var FunnelWebBehavior = function() {
|
7271 | function FunnelWebBehavior() {}
|
7272 | return FunnelWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7273 | var bars = this.bars = options.bars, interactors = this.interactors = options.interactors, clearCatcher = options.clearCatcher;
|
7274 | this.hasHighlights = options.hasHighlights, visuals.InteractivityUtils.registerStandardInteractivityHandlers(bars, selectionHandler),
|
7275 | visuals.InteractivityUtils.registerStandardInteractivityHandlers(interactors, selectionHandler),
|
7276 | clearCatcher.on("click", function() {
|
7277 | selectionHandler.handleClearSelection();
|
7278 | });
|
7279 | }, FunnelWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7280 | var hasHighlights = this.hasHighlights;
|
7281 | this.bars.style("fill-opacity", function(d) {
|
7282 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, !d.highlight && hasSelection, !d.selected && hasHighlights);
|
7283 | });
|
7284 | }, FunnelWebBehavior;
|
7285 | }();
|
7286 | visuals.FunnelWebBehavior = FunnelWebBehavior;
|
7287 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7288 | }(powerbi || (powerbi = {}));
|
7289 | }, function(module, exports) {
|
7290 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
7291 | window.jasmine, window.Microsoft;
|
7292 | }, function(module, exports) {
|
7293 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7294 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7295 | !function(powerbi) {
|
7296 | var visuals;
|
7297 | !function(visuals) {
|
7298 | var LineChartWebBehavior = function() {
|
7299 | function LineChartWebBehavior() {}
|
7300 | return LineChartWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7301 | this.lines = options.lines;
|
7302 | var interactivityLines = options.interactivityLines, dots = this.dots = options.dots, areas = this.areas = options.areas, tooltipOverlay = this.tooltipOverlay = options.tooltipOverlay;
|
7303 | visuals.InteractivityUtils.registerStandardInteractivityHandlers(interactivityLines, selectionHandler),
|
7304 | visuals.InteractivityUtils.registerStandardInteractivityHandlers(dots, selectionHandler),
|
7305 | areas && visuals.InteractivityUtils.registerStandardInteractivityHandlers(areas, selectionHandler),
|
7306 | tooltipOverlay && tooltipOverlay.on("click", function() {
|
7307 | return selectionHandler.handleClearSelection();
|
7308 | });
|
7309 | }, LineChartWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7310 | this.lines.style("stroke-opacity", function(d) {
|
7311 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
7312 | }), this.dots.style("fill-opacity", function(d) {
|
7313 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
7314 | }), this.areas && this.areas.style("fill-opacity", function(d) {
|
7315 | return hasSelection && !d.selected ? visuals.LineChart.DimmedAreaFillOpacity : visuals.LineChart.AreaFillOpacity;
|
7316 | });
|
7317 | }, LineChartWebBehavior;
|
7318 | }();
|
7319 | visuals.LineChartWebBehavior = LineChartWebBehavior;
|
7320 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7321 | }(powerbi || (powerbi = {}));
|
7322 | }, function(module, exports) {
|
7323 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7324 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7325 | !function(powerbi) {
|
7326 | var visuals;
|
7327 | !function(visuals) {
|
7328 | var MapBehavior = function() {
|
7329 | function MapBehavior() {
|
7330 | this.mapPointerEventsDisabled = !1, this.mapPointerTimeoutSet = !1, this.viewChangedSinceLastClearMouseDown = !1,
|
7331 | this.receivedZoomOrPanEvent = !1;
|
7332 | }
|
7333 | return MapBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7334 | var _this = this, bubbles = this.bubbles = options.bubbles, slices = this.slices = options.slices, shapes = this.shapes = options.shapes, clearCatcher = options.clearCatcher, clickHandler = function() {
|
7335 | var target = d3.event.target, d = d3.select(target).datum();
|
7336 | bubbles && bubbles.style("pointer-events", "all"), shapes && shapes.style("pointer-events", "all"),
|
7337 | selectionHandler.handleSelection(d, d3.event.ctrlKey);
|
7338 | };
|
7339 | this.mapPointerEventsDisabled || (bubbles && bubbles.style("pointer-events", "all"),
|
7340 | slices && slices.style("pointer-events", "all"), shapes && shapes.style("pointer-events", "all")),
|
7341 | bubbles && (options.bubbleEventGroup.on("click", clickHandler), options.bubbleEventGroup.on("mousewheel", function() {
|
7342 | _this.mapPointerEventsDisabled || bubbles.style("pointer-events", "none"), _this.mapPointerEventsDisabled = !0,
|
7343 | _this.mapPointerTimeoutSet || (_this.mapPointerTimeoutSet = !0, setTimeout(function() {
|
7344 | bubbles && bubbles.style("pointer-events", "all"), _this.mapPointerEventsDisabled = !1,
|
7345 | _this.mapPointerTimeoutSet = !1;
|
7346 | }, 200));
|
7347 | }), visuals.InteractivityUtils.registerGroupContextMenuHandler(options.bubbleEventGroup, selectionHandler)),
|
7348 | slices && (options.sliceEventGroup.on("click", function() {
|
7349 | slices.style("pointer-events", "all"), _this.mapPointerEventsDisabled = !1;
|
7350 | var target = d3.event.target, d = d3.select(target).datum();
|
7351 | selectionHandler.handleSelection(d.data, d3.event.ctrlKey);
|
7352 | }), options.sliceEventGroup.on("mousewheel", function() {
|
7353 | _this.mapPointerEventsDisabled || slices.style("pointer-events", "none"), _this.mapPointerEventsDisabled = !0,
|
7354 | _this.mapPointerTimeoutSet || (_this.mapPointerTimeoutSet = !0, setTimeout(function() {
|
7355 | slices && slices.style("pointer-events", "all"), _this.mapPointerEventsDisabled = !1,
|
7356 | _this.mapPointerTimeoutSet = !1;
|
7357 | }, 200));
|
7358 | }), options.sliceEventGroup.on("contextmenu", function() {
|
7359 | if (!d3.event.ctrlKey) {
|
7360 | d3.event.preventDefault();
|
7361 | var position = visuals.InteractivityUtils.getPositionOfLastInputEvent(), target = d3.event.target, d = d3.select(target).datum();
|
7362 | selectionHandler.handleContextMenu(d.data, position);
|
7363 | }
|
7364 | })), shapes && (options.shapeEventGroup.on("click", clickHandler), options.shapeEventGroup.on("mousewheel", function() {
|
7365 | _this.mapPointerEventsDisabled || shapes.style("pointer-events", "none"), _this.mapPointerEventsDisabled = !0,
|
7366 | _this.mapPointerTimeoutSet || (_this.mapPointerTimeoutSet = !0, setTimeout(function() {
|
7367 | shapes && shapes.style("pointer-events", "all"), _this.mapPointerEventsDisabled = !1,
|
7368 | _this.mapPointerTimeoutSet = !1;
|
7369 | }, 200));
|
7370 | }), visuals.InteractivityUtils.registerGroupContextMenuHandler(options.shapeEventGroup, selectionHandler)),
|
7371 | clearCatcher.on("mouseup", function() {
|
7372 | _this.viewChangedSinceLastClearMouseDown || (selectionHandler.handleClearSelection(),
|
7373 | _this.receivedZoomOrPanEvent = !0);
|
7374 | }), clearCatcher.on("mousedown", function() {
|
7375 | _this.viewChangedSinceLastClearMouseDown = !1;
|
7376 | }), clearCatcher.on("mousewheel", function() {
|
7377 | _this.receivedZoomOrPanEvent = !0;
|
7378 | });
|
7379 | }, MapBehavior.prototype.renderSelection = function(hasSelection) {
|
7380 | this.bubbles && this.bubbles.style({
|
7381 | "fill-opacity": function(d) {
|
7382 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
7383 | },
|
7384 | "stroke-opacity": function(d) {
|
7385 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
7386 | }
|
7387 | }), this.slices && this.slices.style({
|
7388 | "fill-opacity": function(d) {
|
7389 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, hasSelection, !1);
|
7390 | },
|
7391 | "stroke-opacity": function(d) {
|
7392 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, hasSelection, !1);
|
7393 | }
|
7394 | }), this.shapes && this.shapes.style({
|
7395 | "fill-opacity": function(d) {
|
7396 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
7397 | },
|
7398 | "stroke-opacity": function(d) {
|
7399 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
7400 | }
|
7401 | });
|
7402 | }, MapBehavior.prototype.viewChanged = function() {
|
7403 | this.viewChangedSinceLastClearMouseDown = !0;
|
7404 | }, MapBehavior.prototype.resetZoomPan = function() {
|
7405 | this.receivedZoomOrPanEvent = !1;
|
7406 | }, MapBehavior.prototype.hasReceivedZoomOrPanEvent = function() {
|
7407 | return this.receivedZoomOrPanEvent;
|
7408 | }, MapBehavior;
|
7409 | }();
|
7410 | visuals.MapBehavior = MapBehavior;
|
7411 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7412 | }(powerbi || (powerbi = {}));
|
7413 | }, function(module, exports) {
|
7414 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
7415 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7416 | !function(powerbi) {
|
7417 | var visuals;
|
7418 | !function(visuals) {
|
7419 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, ScatterChartWebBehavior = function() {
|
7420 | function ScatterChartWebBehavior() {}
|
7421 | return ScatterChartWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7422 | var bubbles = this.bubbles = options.dataPointsSelection, data = options.data, eventGroup = options.eventGroup;
|
7423 | !this.playOptions || !this.playOptions.traceLineRenderer || options.playOptions && options.playOptions.traceLineRenderer || this.playOptions.traceLineRenderer.remove(),
|
7424 | this.playOptions = options.playOptions, this.shouldEnableFill = (!data.sizeRange || !data.sizeRange.min) && data.fillPoint,
|
7425 | this.colorBorder = data.colorBorder, eventGroup ? visuals.InteractivityUtils.registerGroupInteractivityHandlers(eventGroup, selectionHandler) : visuals.InteractivityUtils.registerStandardInteractivityHandlers(bubbles, selectionHandler);
|
7426 | }, ScatterChartWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7427 | var shouldEnableFill = this.shouldEnableFill, colorBorder = this.colorBorder;
|
7428 | if (this.bubbles.style("fill-opacity", function(d) {
|
7429 | return visuals.ScatterChart.getMarkerFillOpacity(null != d.size, shouldEnableFill, hasSelection, d.selected);
|
7430 | }), this.bubbles.style("stroke-opacity", function(d) {
|
7431 | return visuals.ScatterChart.getMarkerStrokeOpacity(null != d.size, colorBorder, hasSelection, d.selected);
|
7432 | }), this.playOptions && this.bubbles) {
|
7433 | var selectedPoints = this.bubbles.filter(function(d) {
|
7434 | return d.selected;
|
7435 | }).data(), traceLineRenderer = this.playOptions.traceLineRenderer;
|
7436 | selectedPoints && selectedPoints.length > 0 && null != traceLineRenderer ? traceLineRenderer.render(selectedPoints, !0) : traceLineRenderer.remove();
|
7437 | }
|
7438 | }, ScatterChartWebBehavior;
|
7439 | }();
|
7440 | visuals.ScatterChartWebBehavior = ScatterChartWebBehavior;
|
7441 | var ScatterChartMobileBehavior = function() {
|
7442 | function ScatterChartMobileBehavior() {}
|
7443 | return ScatterChartMobileBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7444 | this.setOptions(options), options.visualInitOptions && options.visualInitOptions.interactivity.isInteractiveLegend && (this.makeDataPointsSelectable(options.dataPointsSelection),
|
7445 | this.makeRootSelectable(options.root), this.makeDragable(options.root), this.disableDefaultTouchInteractions(options.root),
|
7446 | this.selectRoot());
|
7447 | }, ScatterChartMobileBehavior.prototype.renderSelection = function(HasSelection) {},
|
7448 | ScatterChartMobileBehavior.prototype.setSelectionHandler = function(selectionHandler) {},
|
7449 | ScatterChartMobileBehavior.prototype.makeDataPointsSelectable = function() {
|
7450 | for (var _this = this, selection = [], _i = 0; _i < arguments.length; _i++) selection[_i - 0] = arguments[_i];
|
7451 | for (var i = 0, len = selection.length; len > i; i++) {
|
7452 | var sel = selection[i];
|
7453 | sel.on("click", function(d, i) {
|
7454 | _this.select(i);
|
7455 | });
|
7456 | }
|
7457 | }, ScatterChartMobileBehavior.prototype.makeRootSelectable = function(selection) {
|
7458 | var _this = this;
|
7459 | selection.on("click", function(d, i) {
|
7460 | _this.selectRoot();
|
7461 | });
|
7462 | }, ScatterChartMobileBehavior.prototype.makeDragable = function() {
|
7463 | for (var _this = this, selection = [], _i = 0; _i < arguments.length; _i++) selection[_i - 0] = arguments[_i];
|
7464 | for (var i = 0, len = selection.length; len > i; i++) {
|
7465 | var sel = selection[i], drag = d3.behavior.drag().on("drag", function(d) {
|
7466 | _this.drag(0);
|
7467 | }).on("dragend", function(d) {
|
7468 | _this.drag(1);
|
7469 | });
|
7470 | sel.call(drag);
|
7471 | }
|
7472 | }, ScatterChartMobileBehavior.prototype.disableDefaultTouchInteractions = function(selection) {
|
7473 | selection.style("touch-action", "none");
|
7474 | }, ScatterChartMobileBehavior.prototype.setOptions = function(options) {
|
7475 | this.data = options.data, this.mainGraphicsContext = options.plotContext, this.xAxisProperties = options.xAxisProperties,
|
7476 | this.yAxisProperties = options.yAxisProperties, this.host = options.host;
|
7477 | }, ScatterChartMobileBehavior.prototype.select = function(index) {
|
7478 | this.selectDotByIndex(index);
|
7479 | }, ScatterChartMobileBehavior.prototype.selectRoot = function() {
|
7480 | var marker = jsCommon.PerformanceUtil.create("selectRoot");
|
7481 | this.onClick(), marker.end();
|
7482 | }, ScatterChartMobileBehavior.prototype.drag = function(t) {
|
7483 | switch (t) {
|
7484 | case 0:
|
7485 | this.onDrag();
|
7486 | break;
|
7487 |
|
7488 | case 1:
|
7489 | this.onClick();
|
7490 | }
|
7491 | }, ScatterChartMobileBehavior.prototype.onDrag = function() {
|
7492 | var xy = this.getMouseCoordinates();
|
7493 | this.moveCrosshairToXY(xy.x, xy.y);
|
7494 | var selectedIndex = this.findClosestDotIndex(xy.x, xy.y);
|
7495 | this.selectDot(selectedIndex), this.updateLegend(selectedIndex);
|
7496 | }, ScatterChartMobileBehavior.prototype.onClick = function() {
|
7497 | var xy = this.getMouseCoordinates(), selectedIndex = this.findClosestDotIndex(xy.x, xy.y);
|
7498 | -1 !== selectedIndex && this.selectDotByIndex(selectedIndex);
|
7499 | }, ScatterChartMobileBehavior.prototype.getMouseCoordinates = function() {
|
7500 | var mainGfxContext = this.mainGraphicsContext, x = 0, y = parseInt(mainGfxContext.attr("height"), 10);
|
7501 | y = y || 0;
|
7502 | try {
|
7503 | var mouse = d3.mouse(mainGfxContext.node());
|
7504 | x = mouse[0], y = mouse[1];
|
7505 | } catch (e) {}
|
7506 | return {
|
7507 | x: x,
|
7508 | y: y
|
7509 | };
|
7510 | }, ScatterChartMobileBehavior.prototype.selectDotByIndex = function(index) {
|
7511 | this.selectDot(index), this.moveCrosshairToIndexDot(index), this.updateLegend(index);
|
7512 | }, ScatterChartMobileBehavior.prototype.selectDot = function(dotIndex) {
|
7513 | var _this = this, root = this.mainGraphicsContext;
|
7514 | root.selectAll(ScatterChartMobileBehavior.ScatterChartCircleTagName + ScatterChartMobileBehavior.DotClassSelector).classed({
|
7515 | selected: !1,
|
7516 | notSelected: !0
|
7517 | }), root.selectAll(ScatterChartMobileBehavior.ScatterChartCircleTagName + ScatterChartMobileBehavior.DotClassSelector).filter(function(d, i) {
|
7518 | var dataPoints = _this.data.dataPoints, currentPoint = dataPoints[dotIndex];
|
7519 | return d.x === currentPoint.x && d.y === currentPoint.y;
|
7520 | }).classed({
|
7521 | selected: !0,
|
7522 | notSelected: !1
|
7523 | });
|
7524 | }, ScatterChartMobileBehavior.prototype.moveCrosshairToIndexDot = function(index) {
|
7525 | var dataPoints = this.data.dataPoints, root = this.mainGraphicsContext, x = this.xAxisProperties.scale(dataPoints[index].x), y = this.yAxisProperties.scale(dataPoints[index].y);
|
7526 | if (null == this.crosshair) {
|
7527 | var width = +root.attr("width"), height = +root.attr("height");
|
7528 | this.crosshair = this.drawCrosshair(root, x, y, width, height), this.crosshairHorizontal = this.crosshair.select(ScatterChartMobileBehavior.Horizontal.selector),
|
7529 | this.crosshairVertical = this.crosshair.select(ScatterChartMobileBehavior.Vertical.selector);
|
7530 | } else this.moveCrosshairToXY(x, y);
|
7531 | }, ScatterChartMobileBehavior.prototype.moveCrosshairToXY = function(x, y) {
|
7532 | this.crosshairHorizontal.attr({
|
7533 | y1: y,
|
7534 | y2: y
|
7535 | }), this.crosshairVertical.attr({
|
7536 | x1: x,
|
7537 | x2: x
|
7538 | });
|
7539 | }, ScatterChartMobileBehavior.prototype.drawCrosshair = function(addTo, x, y, width, height) {
|
7540 | var crosshair = addTo.append("g");
|
7541 | return crosshair.classed(ScatterChartMobileBehavior.CrosshairClassName, !0), crosshair.append("line").classed(ScatterChartMobileBehavior.Horizontal["class"], !0).attr({
|
7542 | x1: 0,
|
7543 | x2: width,
|
7544 | y1: y,
|
7545 | y2: y
|
7546 | }), crosshair.append("line").classed(ScatterChartMobileBehavior.Vertical["class"], !0).attr({
|
7547 | x1: x,
|
7548 | x2: x,
|
7549 | y1: height,
|
7550 | y2: 0
|
7551 | }), crosshair;
|
7552 | }, ScatterChartMobileBehavior.prototype.findClosestDotIndex = function(x, y) {
|
7553 | var selectedIndex = -1, minDistance = Number.MAX_VALUE, dataPoints = this.data.dataPoints, xAxisPropertiesScale = this.xAxisProperties.scale, yAxisPropertiesScale = this.yAxisProperties.scale;
|
7554 | for (var i in dataPoints) {
|
7555 | var currentPoint = dataPoints[i], circleX = xAxisPropertiesScale(currentPoint.x), circleY = yAxisPropertiesScale(currentPoint.y), horizontalDistance = circleX - x, verticalDistance = circleY - y, distanceSqrd = horizontalDistance * horizontalDistance + verticalDistance * verticalDistance;
|
7556 | minDistance === Number.MAX_VALUE ? (selectedIndex = i, minDistance = distanceSqrd) : minDistance && minDistance > distanceSqrd && (selectedIndex = i,
|
7557 | minDistance = distanceSqrd);
|
7558 | }
|
7559 | return selectedIndex;
|
7560 | }, ScatterChartMobileBehavior.prototype.updateLegend = function(dotIndex) {
|
7561 | if (null == this.lastDotIndex || this.lastDotIndex !== dotIndex) {
|
7562 | var legendItems = this.createLegendDataPoints(dotIndex);
|
7563 | this.host.updateLegend(legendItems), this.lastDotIndex = dotIndex;
|
7564 | }
|
7565 | }, ScatterChartMobileBehavior.prototype.createLegendDataPoints = function(dotIndex) {
|
7566 | var formatStringProp = visuals.scatterChartProps.general.formatString, legendItems = [], data = this.data, point = data.dataPoints[dotIndex], blank = visuals.valueFormatter.format(null), title = blank, legendData = data.legendData, legendDataPoints = legendData.dataPoints, category = point.formattedCategory.getValue();
|
7567 | return category !== blank ? (title = category, null != point && null != point.radius && null != point.radius.sizeMeasure && (title += "; " + visuals.valueFormatter.format(point.radius.sizeMeasure.source.groupName))) : null != point.radius.sizeMeasure ? title = visuals.valueFormatter.format(point.radius.sizeMeasure.source.groupName) : legendDataPoints.length >= dotIndex && legendDataPoints[dotIndex].label !== blank && (title = legendDataPoints[dotIndex].label),
|
7568 | null != data.xCol && legendItems.push({
|
7569 | category: title,
|
7570 | color: point.fill,
|
7571 | identity: visuals.SelectionIdBuilder.builder().withMeasure(data.xCol.queryName).createSelectionId(),
|
7572 | selected: point.selected,
|
7573 | icon: visuals.LegendIcon.Box,
|
7574 | label: visuals.valueFormatter.format(this.data.axesLabels.x),
|
7575 | measure: visuals.valueFormatter.format(point.x, visuals.valueFormatter.getFormatString(data.xCol, formatStringProp)),
|
7576 | iconOnlyOnLabel: !0
|
7577 | }), null != data.yCol && legendItems.push({
|
7578 | category: title,
|
7579 | color: point.fill,
|
7580 | identity: visuals.SelectionIdBuilder.builder().withMeasure(data.yCol.queryName).createSelectionId(),
|
7581 | selected: point.selected,
|
7582 | icon: visuals.LegendIcon.Box,
|
7583 | label: visuals.valueFormatter.format(data.axesLabels.y),
|
7584 | measure: visuals.valueFormatter.format(point.y, visuals.valueFormatter.getFormatString(data.yCol, formatStringProp)),
|
7585 | iconOnlyOnLabel: !0
|
7586 | }), null != data.size && legendItems.push({
|
7587 | category: title,
|
7588 | color: point.fill,
|
7589 | identity: visuals.SelectionIdBuilder.builder().withMeasure(data.size.queryName).createSelectionId(),
|
7590 | selected: point.selected,
|
7591 | icon: visuals.LegendIcon.Box,
|
7592 | label: visuals.valueFormatter.format(data.size.displayName),
|
7593 | measure: visuals.valueFormatter.format(point.radius.sizeMeasure.values[point.radius.index], visuals.valueFormatter.getFormatString(data.size, formatStringProp)),
|
7594 | iconOnlyOnLabel: !0
|
7595 | }), {
|
7596 | dataPoints: legendItems
|
7597 | };
|
7598 | }, ScatterChartMobileBehavior.CrosshairClassName = "crosshair", ScatterChartMobileBehavior.ScatterChartCircleTagName = "circle",
|
7599 | ScatterChartMobileBehavior.DotClassName = "dot", ScatterChartMobileBehavior.DotClassSelector = "." + ScatterChartMobileBehavior.DotClassName,
|
7600 | ScatterChartMobileBehavior.Horizontal = createClassAndSelector("horizontal"), ScatterChartMobileBehavior.Vertical = createClassAndSelector("vertical"),
|
7601 | ScatterChartMobileBehavior;
|
7602 | }();
|
7603 | visuals.ScatterChartMobileBehavior = ScatterChartMobileBehavior;
|
7604 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7605 | }(powerbi || (powerbi = {}));
|
7606 | }, function(module, exports) {
|
7607 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7608 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7609 | !function(powerbi) {
|
7610 | var visuals;
|
7611 | !function(visuals) {
|
7612 | var HorizontalSlicerWebBehavior = function() {
|
7613 | function HorizontalSlicerWebBehavior() {}
|
7614 | return HorizontalSlicerWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7615 | this.itemLabels = options.itemLabels, this.dataPoints = options.dataPoints, this.interactivityService = options.interactivityService,
|
7616 | this.slicerSettings = options.settings, visuals.SlicerWebBehavior.bindSlicerEvents(options.slicerContainer, this.itemLabels, options.clear, selectionHandler, this.slicerSettings, this.interactivityService, options.slicerValueHandler);
|
7617 | }, HorizontalSlicerWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7618 | visuals.SlicerWebBehavior.setSelectionOnSlicerItems(this.itemLabels, this.itemLabels, hasSelection, this.interactivityService, this.slicerSettings);
|
7619 | }, HorizontalSlicerWebBehavior;
|
7620 | }();
|
7621 | visuals.HorizontalSlicerWebBehavior = HorizontalSlicerWebBehavior;
|
7622 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7623 | }(powerbi || (powerbi = {}));
|
7624 | }, function(module, exports) {
|
7625 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7626 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7627 | !function(powerbi) {
|
7628 | var visuals;
|
7629 | !function(visuals) {
|
7630 | var VerticalSlicerWebBehavior = function() {
|
7631 | function VerticalSlicerWebBehavior() {}
|
7632 | return VerticalSlicerWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7633 | var slicers = options.itemContainers;
|
7634 | this.itemLabels = options.itemLabels, this.itemInputs = options.itemInputs, this.dataPoints = options.dataPoints,
|
7635 | this.interactivityService = options.interactivityService, this.settings = options.settings,
|
7636 | visuals.SlicerWebBehavior.bindSlicerEvents(options.slicerContainer, slicers, options.clear, selectionHandler, this.settings, this.interactivityService, options.slicerValueHandler, options.searchInput);
|
7637 | }, VerticalSlicerWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7638 | visuals.SlicerWebBehavior.setSelectionOnSlicerItems(this.itemInputs, this.itemLabels, hasSelection, this.interactivityService, this.settings);
|
7639 | }, VerticalSlicerWebBehavior;
|
7640 | }();
|
7641 | visuals.VerticalSlicerWebBehavior = VerticalSlicerWebBehavior;
|
7642 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7643 | }(powerbi || (powerbi = {}));
|
7644 | }, function(module, exports) {
|
7645 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
7646 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7647 | !function(powerbi) {
|
7648 | var visuals;
|
7649 | !function(visuals) {
|
7650 | var DOMConstants = jsCommon.DOMConstants, KeyUtils = jsCommon.KeyUtils, SlicerWebBehavior = function() {
|
7651 | function SlicerWebBehavior() {}
|
7652 | return SlicerWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7653 | this.behavior = this.createWebBehavior(options), this.behavior.bindEvents(options.behaviorOptions, selectionHandler);
|
7654 | }, SlicerWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7655 | this.behavior.renderSelection(hasSelection);
|
7656 | }, SlicerWebBehavior.bindSlicerEvents = function(slicerContainer, slicers, slicerClear, selectionHandler, slicerSettings, interactivityService, slicerValueHandler, slicerSearch) {
|
7657 | SlicerWebBehavior.bindSlicerItemSelectionEvent(slicers, selectionHandler, slicerSettings, interactivityService),
|
7658 | SlicerWebBehavior.bindSlicerClearEvent(slicerClear, selectionHandler), slicerSearch && SlicerWebBehavior.bindSlicerSearchEvent(slicerSearch, selectionHandler, slicerValueHandler),
|
7659 | SlicerWebBehavior.styleSlicerContainer(slicerContainer, interactivityService);
|
7660 | }, SlicerWebBehavior.setSelectionOnSlicerItems = function(selectableItems, itemLabel, hasSelection, interactivityService, slicerSettings) {
|
7661 | if (hasSelection || interactivityService.isSelectionModeInverted()) SlicerWebBehavior.styleSlicerItems(selectableItems, hasSelection, interactivityService.isSelectionModeInverted()); else {
|
7662 | selectableItems.filter(".selected").classed("selected", !1), selectableItems.filter(".partiallySelected").classed("partiallySelected", !1);
|
7663 | var input = selectableItems.selectAll("input");
|
7664 | input && input.property("checked", !1), itemLabel.style("color", slicerSettings.slicerText.color);
|
7665 | }
|
7666 | }, SlicerWebBehavior.styleSlicerItems = function(slicerItems, hasSelection, isSelectionInverted) {
|
7667 | slicerItems.each(function(d) {
|
7668 | var slicerItem = this, shouldCheck = !1;
|
7669 | d.isSelectAllDataPoint ? hasSelection ? (slicerItem.classList.add("partiallySelected"),
|
7670 | shouldCheck = !1) : (slicerItem.classList.remove("partiallySelected"), shouldCheck = isSelectionInverted) : shouldCheck = jsCommon.LogicExtensions.XOR(d.selected, isSelectionInverted),
|
7671 | shouldCheck ? slicerItem.classList.add("selected") : slicerItem.classList.remove("selected");
|
7672 | var input = slicerItem.getElementsByTagName("input")[0];
|
7673 | input && (input.checked = shouldCheck);
|
7674 | });
|
7675 | }, SlicerWebBehavior.bindSlicerItemSelectionEvent = function(slicers, selectionHandler, slicerSettings, interactivityService) {
|
7676 | slicers.on("click", function(d) {
|
7677 | d3.event.preventDefault(), d.isSelectAllDataPoint ? selectionHandler.toggleSelectionModeInversion() : selectionHandler.handleSelection(d, SlicerWebBehavior.isMultiSelect(d3.event, slicerSettings, interactivityService)),
|
7678 | selectionHandler.persistSelectionFilter(visuals.slicerProps.filterPropertyIdentifier);
|
7679 | });
|
7680 | }, SlicerWebBehavior.bindSlicerClearEvent = function(slicerClear, selectionHandler) {
|
7681 | slicerClear && slicerClear.on("click", function() {
|
7682 | selectionHandler.handleClearSelection(), selectionHandler.persistSelectionFilter(visuals.slicerProps.filterPropertyIdentifier);
|
7683 | });
|
7684 | }, SlicerWebBehavior.bindSlicerSearchEvent = function(slicerSearch, selectionHandler, slicerValueHandler) {
|
7685 | slicerSearch.empty() || slicerSearch.on(DOMConstants.keyDownEventName, function() {
|
7686 | d3.event.ctrlKey && KeyUtils.isCtrlDefaultKey(d3.event.keyCode) ? d3.event.stopPropagation() : KeyUtils.isArrowKey(d3.event.keyCode) || d3.event.keyCode === DOMConstants.deleteKeyCode ? d3.event.stopPropagation() : d3.event.keyCode === DOMConstants.escKeyCode ? (selectionHandler.persistSelfFilter(visuals.slicerProps.selfFilterPropertyIdentifier, null),
|
7687 | d3.event.stopPropagation()) : d3.event.keyCode === DOMConstants.enterKeyCode && (SlicerWebBehavior.startSearch(slicerSearch, selectionHandler, slicerValueHandler),
|
7688 | d3.event.stopPropagation());
|
7689 | }).on(DOMConstants.keyUpEventName, _.debounce(function() {
|
7690 | SlicerWebBehavior.startSearch(slicerSearch, selectionHandler, slicerValueHandler);
|
7691 | }, SlicerWebBehavior.searchInputTimeoutDuration));
|
7692 | }, SlicerWebBehavior.startSearch = function(slicerSearch, selectionHandler, slicerValueHandler) {
|
7693 | var element = slicerSearch.node(), searchKey = element && element.value;
|
7694 | if (searchKey = _.trim(searchKey), _.isEmpty(searchKey)) return void selectionHandler.persistSelfFilter(visuals.slicerProps.selfFilterPropertyIdentifier, null);
|
7695 | var updatedFilter = slicerValueHandler.getUpdatedSelfFilter(searchKey);
|
7696 | updatedFilter && selectionHandler.persistSelfFilter(visuals.slicerProps.selfFilterPropertyIdentifier, updatedFilter);
|
7697 | }, SlicerWebBehavior.styleSlicerContainer = function(slicerContainer, interactivityService) {
|
7698 | var hasSelection = interactivityService.hasSelection() && void 0 === interactivityService.isDefaultValueEnabled() || interactivityService.isDefaultValueEnabled() === !1;
|
7699 | slicerContainer.classed("hasSelection", hasSelection);
|
7700 | }, SlicerWebBehavior.isMultiSelect = function(event, settings, interactivityService) {
|
7701 | return interactivityService.isSelectionModeInverted() || !settings.selection.singleSelect || event.ctrlKey;
|
7702 | }, SlicerWebBehavior.prototype.createWebBehavior = function(options) {
|
7703 | var behavior, orientation = options.orientation;
|
7704 | switch (orientation) {
|
7705 | case 1:
|
7706 | behavior = new visuals.HorizontalSlicerWebBehavior();
|
7707 | break;
|
7708 |
|
7709 | case 0:
|
7710 | default:
|
7711 | behavior = new visuals.VerticalSlicerWebBehavior();
|
7712 | }
|
7713 | return behavior;
|
7714 | }, SlicerWebBehavior.searchInputTimeoutDuration = 500, SlicerWebBehavior;
|
7715 | }();
|
7716 | visuals.SlicerWebBehavior = SlicerWebBehavior;
|
7717 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7718 | }(powerbi || (powerbi = {}));
|
7719 | }, function(module, exports) {
|
7720 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7721 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7722 | !function(powerbi) {
|
7723 | var visuals;
|
7724 | !function(visuals) {
|
7725 | var LegendBehavior = function() {
|
7726 | function LegendBehavior() {}
|
7727 | return LegendBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7728 | var legendItems = options.legendItems;
|
7729 | this.legendIcons = options.legendIcons;
|
7730 | var clearCatcher = options.clearCatcher;
|
7731 | visuals.InteractivityUtils.registerStandardSelectionHandler(legendItems, selectionHandler),
|
7732 | clearCatcher.on("click", function() {
|
7733 | selectionHandler.handleClearSelection();
|
7734 | });
|
7735 | }, LegendBehavior.prototype.renderSelection = function(hasSelection) {
|
7736 | hasSelection ? this.legendIcons.style({
|
7737 | fill: function(d) {
|
7738 | return d.selected ? d.color : LegendBehavior.dimmedLegendColor;
|
7739 | }
|
7740 | }) : this.legendIcons.style({
|
7741 | fill: function(d) {
|
7742 | return d.color;
|
7743 | }
|
7744 | });
|
7745 | }, LegendBehavior.dimmedLegendColor = "#A6A6A6", LegendBehavior;
|
7746 | }();
|
7747 | visuals.LegendBehavior = LegendBehavior;
|
7748 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7749 | }(powerbi || (powerbi = {}));
|
7750 | }, function(module, exports) {
|
7751 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7752 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7753 | !function(powerbi) {
|
7754 | var visuals;
|
7755 | !function(visuals) {
|
7756 | var TreemapWebBehavior = function() {
|
7757 | function TreemapWebBehavior() {}
|
7758 | return TreemapWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7759 | var shapes = this.shapes = options.shapes, highlightShapes = this.highlightShapes = options.highlightShapes, majorLabels = options.majorLabels, minorLabels = options.minorLabels;
|
7760 | this.hasHighlights = options.hasHighlights, visuals.InteractivityUtils.registerStandardInteractivityHandlers(shapes, selectionHandler),
|
7761 | visuals.InteractivityUtils.registerStandardInteractivityHandlers(highlightShapes, selectionHandler),
|
7762 | majorLabels && visuals.InteractivityUtils.registerStandardInteractivityHandlers(majorLabels, selectionHandler),
|
7763 | minorLabels && visuals.InteractivityUtils.registerStandardInteractivityHandlers(minorLabels, selectionHandler);
|
7764 | }, TreemapWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7765 | var hasHighlights = this.hasHighlights;
|
7766 | this.shapes.style("fill", function(d) {
|
7767 | return visuals.Treemap.getFill(d, !1);
|
7768 | }).style("fill-opacity", function(d) {
|
7769 | return visuals.Treemap.getFillOpacity(d, hasSelection, !d.selected && hasHighlights, !1);
|
7770 | }), this.highlightShapes.style("fill", function(d) {
|
7771 | return visuals.Treemap.getFill(d, !0);
|
7772 | }).style("fill-opacity", function(d) {
|
7773 | return visuals.Treemap.getFillOpacity(d, hasSelection, !d.selected && hasHighlights, !0);
|
7774 | });
|
7775 | }, TreemapWebBehavior;
|
7776 | }();
|
7777 | visuals.TreemapWebBehavior = TreemapWebBehavior;
|
7778 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7779 | }(powerbi || (powerbi = {}));
|
7780 | }, function(module, exports) {
|
7781 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7782 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7783 | !function(powerbi) {
|
7784 | var visuals;
|
7785 | !function(visuals) {
|
7786 | var WaterfallChartWebBehavior = function() {
|
7787 | function WaterfallChartWebBehavior() {}
|
7788 | return WaterfallChartWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7789 | var bars = this.bars = options.bars;
|
7790 | bars.on("click", function(d) {
|
7791 | d.isTotal || selectionHandler.handleSelection(d, d3.event.ctrlKey);
|
7792 | }), bars.on("contextmenu", function(d) {
|
7793 | if (!d3.event.ctrlKey && (d3.event.preventDefault(), !d.isTotal)) {
|
7794 | var position = visuals.InteractivityUtils.getPositionOfLastInputEvent();
|
7795 | selectionHandler.handleContextMenu(d, position);
|
7796 | }
|
7797 | });
|
7798 | }, WaterfallChartWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7799 | this.bars.style("fill-opacity", function(d) {
|
7800 | return d.isTotal ? visuals.ColumnUtil.DefaultOpacity : visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, !1);
|
7801 | });
|
7802 | }, WaterfallChartWebBehavior;
|
7803 | }();
|
7804 | visuals.WaterfallChartWebBehavior = WaterfallChartWebBehavior;
|
7805 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7806 | }(powerbi || (powerbi = {}));
|
7807 | }, function(module, exports) {
|
7808 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7809 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7810 | !function(powerbi) {
|
7811 | var visuals;
|
7812 | !function(visuals) {
|
7813 | var LabelsBehavior = function() {
|
7814 | function LabelsBehavior() {}
|
7815 | return LabelsBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7816 | this.labelItems = options.labelItems, visuals.InteractivityUtils.registerStandardSelectionHandler(this.labelItems, selectionHandler);
|
7817 | }, LabelsBehavior.prototype.renderSelection = function(hasSelection) {
|
7818 | hasSelection ? this.labelItems.style({
|
7819 | opacity: function(d) {
|
7820 | return d.selected ? LabelsBehavior.DefaultLabelOpacity : LabelsBehavior.DimmedLabelOpacity;
|
7821 | }
|
7822 | }) : this.labelItems.style({
|
7823 | opacity: LabelsBehavior.DefaultLabelOpacity
|
7824 | });
|
7825 | }, LabelsBehavior.DefaultLabelOpacity = 1, LabelsBehavior.DimmedLabelOpacity = .6,
|
7826 | LabelsBehavior;
|
7827 | }();
|
7828 | visuals.LabelsBehavior = LabelsBehavior;
|
7829 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7830 | }(powerbi || (powerbi = {}));
|
7831 | }, function(module, exports) {
|
7832 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
7833 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7834 | !function(powerbi) {
|
7835 | var visuals;
|
7836 | !function(visuals) {
|
7837 | var CartesianChartBehavior = function() {
|
7838 | function CartesianChartBehavior(behaviors) {
|
7839 | this.behaviors = behaviors;
|
7840 | }
|
7841 | return CartesianChartBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7842 | for (var behaviors = this.behaviors, i = 0, ilen = behaviors.length; ilen > i; i++) behaviors[i].bindEvents(options.layerOptions[i], selectionHandler);
|
7843 | options.clearCatcher.on("click", function() {
|
7844 | selectionHandler.handleClearSelection();
|
7845 | });
|
7846 | }, CartesianChartBehavior.prototype.renderSelection = function(hasSelection) {
|
7847 | for (var _i = 0, _a = this.behaviors; _i < _a.length; _i++) {
|
7848 | var behavior = _a[_i];
|
7849 | behavior.renderSelection(hasSelection);
|
7850 | }
|
7851 | }, CartesianChartBehavior;
|
7852 | }();
|
7853 | visuals.CartesianChartBehavior = CartesianChartBehavior;
|
7854 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7855 | }(powerbi || (powerbi = {}));
|
7856 | }, function(module, exports) {
|
7857 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
7858 | window.jasmine, window.Microsoft;
|
7859 | }, function(module, exports) {
|
7860 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
7861 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
7862 | !function(powerbi) {
|
7863 | var visuals;
|
7864 | !function(visuals) {
|
7865 | visuals.emptyDomain = [ 0, 0 ];
|
7866 | var AxisHelper;
|
7867 | !function(AxisHelper) {
|
7868 | function getRecommendedNumberOfTicksForXAxis(availableWidth) {
|
7869 | return 300 > availableWidth ? 3 : 500 > availableWidth ? 5 : 8;
|
7870 | }
|
7871 | function getRecommendedNumberOfTicksForYAxis(availableWidth) {
|
7872 | return 150 > availableWidth ? 3 : 300 > availableWidth ? 5 : 8;
|
7873 | }
|
7874 | function getBestNumberOfTicks(min, max, valuesMetadata, maxTickCount, isDateTime) {
|
7875 | return isNaN(min) || isNaN(max) ? DefaultBestTickCount : 1 >= maxTickCount || 1 >= max && min >= -1 ? maxTickCount : min === max ? isDateTime ? 1 : DefaultBestTickCount : hasNonIntegerData(valuesMetadata) ? maxTickCount : Math.min(max - min + 1, maxTickCount);
|
7876 | }
|
7877 | function hasNonIntegerData(valuesMetadata) {
|
7878 | for (var i = 0, len = valuesMetadata.length; len > i; i++) {
|
7879 | var currentMetadata = valuesMetadata[i];
|
7880 | if (currentMetadata && currentMetadata.type && !currentMetadata.type.integer) return !0;
|
7881 | }
|
7882 | return !1;
|
7883 | }
|
7884 | function getRecommendedTickValues(maxTicks, scale, axisType, isScalar, minTickInterval) {
|
7885 | return !isScalar || isOrdinalScale(scale) ? getRecommendedTickValuesForAnOrdinalRange(maxTicks, scale.domain()) : isDateTime(axisType) ? getRecommendedTickValuesForADateTimeRange(maxTicks, scale.domain()) : getRecommendedTickValuesForAQuantitativeRange(maxTicks, scale, minTickInterval);
|
7886 | }
|
7887 | function getRecommendedTickValuesForAnOrdinalRange(maxTicks, labels) {
|
7888 | var tickLabels = [];
|
7889 | if (0 >= maxTicks) return tickLabels;
|
7890 | var len = labels.length;
|
7891 | if (maxTicks > len) return labels;
|
7892 | for (var i = 0, step = Math.ceil(len / maxTicks); len > i; i += step) tickLabels.push(labels[i]);
|
7893 | return tickLabels;
|
7894 | }
|
7895 | function getRecommendedTickValuesForAQuantitativeRange(maxTicks, scale, minInterval) {
|
7896 | var tickLabels = [];
|
7897 | if (0 === maxTicks) return tickLabels;
|
7898 | var quantitiveScale = scale;
|
7899 | if (quantitiveScale.ticks) {
|
7900 | if (tickLabels = quantitiveScale.ticks(maxTicks), tickLabels.length > maxTicks && maxTicks > 1 && (tickLabels = quantitiveScale.ticks(maxTicks - 1)),
|
7901 | tickLabels.length < MinTickCount && (tickLabels = quantitiveScale.ticks(maxTicks + 1)),
|
7902 | tickLabels = createTrueZeroTickLabel(tickLabels), minInterval && tickLabels.length > 1) {
|
7903 | for (var tickInterval = tickLabels[1] - tickLabels[0]; tickInterval > 0 && minInterval > tickInterval; ) {
|
7904 | for (var i = 1; i < tickLabels.length; i++) tickLabels.splice(i, 1);
|
7905 | tickInterval = 2 * tickInterval;
|
7906 | }
|
7907 | 1 === tickLabels.length && tickLabels.push(tickLabels[0] + minInterval);
|
7908 | }
|
7909 | return tickLabels;
|
7910 | }
|
7911 | return tickLabels;
|
7912 | }
|
7913 | function createTrueZeroTickLabel(ticks, epsilon) {
|
7914 | if (void 0 === epsilon && (epsilon = 1e-5), !ticks || ticks.length < 2) return ticks;
|
7915 | var closeZero = epsilon * Math.abs(ticks[1] - ticks[0]);
|
7916 | return ticks.map(function(tick) {
|
7917 | return Math.abs(tick) <= closeZero ? 0 : tick;
|
7918 | });
|
7919 | }
|
7920 | function getRecommendedTickValuesForADateTimeRange(maxTicks, dataDomain) {
|
7921 | var tickLabels = [];
|
7922 | if (0 === dataDomain[0] && 0 === dataDomain[1]) return [];
|
7923 | var dateTimeTickLabels = powerbi.DateTimeSequence.calculate(new Date(dataDomain[0]), new Date(dataDomain[1]), maxTicks).sequence;
|
7924 | return tickLabels = dateTimeTickLabels.map(function(d) {
|
7925 | return d.getTime();
|
7926 | }), tickLabels = ensureValuesInRange(tickLabels, dataDomain[0], dataDomain[1]);
|
7927 | }
|
7928 | function normalizeLinearDomain(domain) {
|
7929 | return isNaN(domain.min) || isNaN(domain.max) ? (domain.min = visuals.emptyDomain[0],
|
7930 | domain.max = visuals.emptyDomain[1]) : domain.min === domain.max ? (domain.min = domain.min < 0 ? 1.2 * domain.min : .8 * domain.min,
|
7931 | domain.max = domain.max < 0 ? .8 * domain.max : 1.2 * domain.max) : Math.abs(domain.min) < 1e-4 && domain.min / (domain.max - domain.min) < 1e-4 && (domain.min = 0),
|
7932 | domain;
|
7933 | }
|
7934 | function getMargin(availableWidth, availableHeight, xMargin, yMargin) {
|
7935 | return 0 === getRecommendedNumberOfTicksForXAxis(availableWidth - xMargin) || 0 === getRecommendedNumberOfTicksForYAxis(availableHeight - yMargin) ? {
|
7936 | top: 0,
|
7937 | right: xMargin,
|
7938 | bottom: yMargin,
|
7939 | left: 0
|
7940 | } : {
|
7941 | top: 20,
|
7942 | right: 30,
|
7943 | bottom: 40,
|
7944 | left: 30
|
7945 | };
|
7946 | }
|
7947 | function getTickLabelMargins(viewport, yMarginLimit, textWidthMeasurer, textHeightMeasurer, axes, bottomMarginLimit, properties, scrollbarVisible, showOnRight, renderXAxis, renderY1Axis, renderY2Axis) {
|
7948 | var xAxisProperties = axes.x, y1AxisProperties = axes.y1, y2AxisProperties = axes.y2, xLabels = xAxisProperties.values, y1Labels = y1AxisProperties.values, leftOverflow = 0, rightOverflow = 0, maxWidthY1 = 0, maxWidthY2 = 0, xMax = 0, ordinalLabelOffset = xAxisProperties.categoryThickness ? xAxisProperties.categoryThickness / 2 : 0, scaleIsOrdinal = isOrdinalScale(xAxisProperties.scale), xLabelOuterPadding = 0;
|
7949 | if (void 0 !== xAxisProperties.outerPadding ? xLabelOuterPadding = xAxisProperties.outerPadding : void 0 !== xAxisProperties.xLabelMaxWidth && (xLabelOuterPadding = Math.max(0, (viewport.width - xAxisProperties.xLabelMaxWidth * xLabels.length) / 2)),
|
7950 | 0 !== getRecommendedNumberOfTicksForXAxis(viewport.width) || 0 !== getRecommendedNumberOfTicksForYAxis(viewport.height)) {
|
7951 | var rotation = void 0;
|
7952 | if (rotation = scrollbarVisible ? LabelLayoutStrategy.DefaultRotationWithScrollbar : LabelLayoutStrategy.DefaultRotation,
|
7953 | renderY1Axis) for (var i = 0, len = y1Labels.length; len > i; i++) properties.text = y1Labels[i],
|
7954 | maxWidthY1 = Math.max(maxWidthY1, textWidthMeasurer(properties));
|
7955 | if (y2AxisProperties && renderY2Axis) for (var y2Labels = y2AxisProperties.values, i = 0, len = y2Labels.length; len > i; i++) properties.text = y2Labels[i],
|
7956 | maxWidthY2 = Math.max(maxWidthY2, textWidthMeasurer(properties));
|
7957 | var textHeight = textHeightMeasurer(properties), maxNumLines = Math.floor(bottomMarginLimit / textHeight), xScale = xAxisProperties.scale, xDomain = xScale.domain();
|
7958 | if (renderXAxis && xLabels.length > 0) {
|
7959 | for (var i = 0, len = xLabels.length; len > i; i++) {
|
7960 | var height = void 0;
|
7961 | properties.text = xLabels[i];
|
7962 | var width = textWidthMeasurer(properties);
|
7963 | if (xAxisProperties.willLabelsWordBreak) {
|
7964 | var wordBreaks = jsCommon.WordBreaker.splitByWidth(properties.text, properties, textWidthMeasurer, xAxisProperties.xLabelMaxWidth, maxNumLines);
|
7965 | height = wordBreaks.length * textHeight, width = xAxisProperties.xLabelMaxWidth;
|
7966 | } else !xAxisProperties.willLabelsFit && scaleIsOrdinal ? (height = width * rotation.sine,
|
7967 | width *= rotation.cosine) : height = TextHeightConstant;
|
7968 | if (0 === i) {
|
7969 | if (scaleIsOrdinal) leftOverflow = xAxisProperties.willLabelsFit ? width / 2 - ordinalLabelOffset - xLabelOuterPadding : width - ordinalLabelOffset - xLabelOuterPadding,
|
7970 | leftOverflow = Math.max(leftOverflow, 0); else if (xDomain.length > 1) {
|
7971 | var xPos = xScale(xDomain[0]);
|
7972 | leftOverflow = width / 2 - xPos, leftOverflow = Math.max(leftOverflow, 0);
|
7973 | }
|
7974 | } else if (i === len - 1) if (scaleIsOrdinal) (xAxisProperties.willLabelsFit || xAxisProperties.willLabelsWordBreak) && (rightOverflow = width / 2 - ordinalLabelOffset - xLabelOuterPadding,
|
7975 | rightOverflow = Math.max(rightOverflow, 0)); else if (xDomain.length > 1) {
|
7976 | var xPos = xScale(xDomain[1]);
|
7977 | rightOverflow = width / 2 - (viewport.width - xPos), rightOverflow = Math.max(rightOverflow, 0);
|
7978 | }
|
7979 | xMax = Math.max(xMax, height);
|
7980 | }
|
7981 | leftOverflow = Math.min(leftOverflow, XLabelMaxAllowedOverflow), rightOverflow = Math.min(rightOverflow, XLabelMaxAllowedOverflow);
|
7982 | }
|
7983 | }
|
7984 | var rightMargin = 0, leftMargin = 0, bottomMargin = Math.min(Math.ceil(xMax), bottomMarginLimit);
|
7985 | return showOnRight ? (leftMargin = Math.min(Math.max(leftOverflow, maxWidthY2), yMarginLimit),
|
7986 | rightMargin = Math.min(Math.max(rightOverflow, maxWidthY1), yMarginLimit)) : (leftMargin = Math.min(Math.max(leftOverflow, maxWidthY1), yMarginLimit),
|
7987 | rightMargin = Math.min(Math.max(rightOverflow, maxWidthY2), yMarginLimit)), {
|
7988 | xMax: Math.ceil(bottomMargin),
|
7989 | yLeft: Math.ceil(leftMargin),
|
7990 | yRight: Math.ceil(rightMargin)
|
7991 | };
|
7992 | }
|
7993 | function columnDataTypeHasValue(dataType) {
|
7994 | return dataType && (dataType.bool || dataType.numeric || dataType.text || dataType.dateTime);
|
7995 | }
|
7996 | function createOrdinalType() {
|
7997 | return powerbi.ValueType.fromDescriptor({
|
7998 | text: !0
|
7999 | });
|
8000 | }
|
8001 | function isOrdinal(type) {
|
8002 | return !(!type || !type.text && !type.bool);
|
8003 | }
|
8004 | function isOrdinalScale(scale) {
|
8005 | return "undefined" == typeof scale.invert;
|
8006 | }
|
8007 | function isDateTime(type) {
|
8008 | return !(!type || !type.dateTime);
|
8009 | }
|
8010 | function invertScale(scale, x) {
|
8011 | return isOrdinalScale(scale) ? invertOrdinalScale(scale, x) : scale.invert(x);
|
8012 | }
|
8013 | function extent(scale) {
|
8014 | return isOrdinalScale(scale) ? scale.rangeExtent() : scale.range();
|
8015 | }
|
8016 | function invertOrdinalScale(scale, x) {
|
8017 | var leftEdges = scale.range();
|
8018 | if (leftEdges.length < 2) return 0;
|
8019 | var j, width = scale.rangeBand(), halfInnerPadding = (leftEdges[1] - leftEdges[0] - width) / 2;
|
8020 | for (j = 0; x > leftEdges[j] + width + halfInnerPadding && j < leftEdges.length - 1; j++) ;
|
8021 | return scale.domain()[j];
|
8022 | }
|
8023 | function findClosestXAxisIndex(categoryValue, categoryAxisValues) {
|
8024 | var closestValueIndex = -1, minDistance = Number.MAX_VALUE;
|
8025 | for (var i in categoryAxisValues) {
|
8026 | var distance = Math.abs(categoryValue - categoryAxisValues[i].categoryValue);
|
8027 | minDistance > distance && (minDistance = distance, closestValueIndex = parseInt(i, 10));
|
8028 | }
|
8029 | return closestValueIndex;
|
8030 | }
|
8031 | function lookupOrdinalIndex(scale, pixelValue) {
|
8032 | var closestValueIndex = -1, minDistance = Number.MAX_VALUE, domain = scale.domain();
|
8033 | if (domain.length < 2) return 0;
|
8034 | var halfWidth = (scale(1) - scale(0)) / 2;
|
8035 | for (var idx in domain) {
|
8036 | var leftEdgeInPixels = scale(idx), midPoint = leftEdgeInPixels + halfWidth, distance = Math.abs(pixelValue - midPoint);
|
8037 | minDistance > distance && (minDistance = distance, closestValueIndex = parseInt(idx, 10));
|
8038 | }
|
8039 | return closestValueIndex;
|
8040 | }
|
8041 | function diffScaled(scale, value1, value2) {
|
8042 | var value = scale(value1) - scale(value2);
|
8043 | return 0 === value ? 0 : 0 > value ? Math.min(value, -1) : Math.max(value, 1);
|
8044 | }
|
8045 | function createDomain(data, axisType, isScalar, forcedScalarDomain, ensureDomain) {
|
8046 | if (isScalar && !isOrdinal(axisType)) {
|
8047 | var userMin = void 0, userMax = void 0;
|
8048 | return forcedScalarDomain && 2 === forcedScalarDomain.length && (userMin = forcedScalarDomain[0],
|
8049 | userMax = forcedScalarDomain[1]), createScalarDomain(data, userMin, userMax, axisType, ensureDomain);
|
8050 | }
|
8051 | return createOrdinalDomain(data);
|
8052 | }
|
8053 | function ensureValuesInRange(values, min, max) {
|
8054 | var filteredValues = values.filter(function(v) {
|
8055 | return v >= min && max >= v;
|
8056 | });
|
8057 | return filteredValues.length < 2 && (filteredValues = [ min, max ]), filteredValues;
|
8058 | }
|
8059 | function getCategoryValueType(metadataColumn, isScalar) {
|
8060 | return metadataColumn && columnDataTypeHasValue(metadataColumn.type) ? metadataColumn.type : isScalar ? powerbi.ValueType.fromDescriptor({
|
8061 | numeric: !0
|
8062 | }) : powerbi.ValueType.fromDescriptor({
|
8063 | text: !0
|
8064 | });
|
8065 | }
|
8066 | function createAxis(options) {
|
8067 | var pixelSpan = options.pixelSpan, dataDomain = options.dataDomain, metaDataColumn = options.metaDataColumn, formatString = options.formatString, outerPadding = options.outerPadding || 0, isCategoryAxis = !!options.isCategoryAxis, isScalar = !!options.isScalar, isVertical = !!options.isVertical, useTickIntervalForDisplayUnits = !!options.useTickIntervalForDisplayUnits, getValueFn = options.getValueFn, categoryThickness = options.categoryThickness, axisDisplayUnits = options.axisDisplayUnits, axisPrecision = options.axisPrecision, is100Pct = !!options.is100Pct, dataType = AxisHelper.getCategoryValueType(metaDataColumn, isScalar), scaleResult = AxisHelper.createScale(options), scale = scaleResult.scale, bestTickCount = scaleResult.bestTickCount, scaleDomain = scale.domain(), isLogScaleAllowed = AxisHelper.isLogScalePossible(dataDomain, dataType);
|
8068 | if (categoryThickness && isScalar && dataDomain && 2 === dataDomain.length) {
|
8069 | var oldSpan = dataDomain[1] - dataDomain[0], newSpan = scaleDomain[1] - scaleDomain[0];
|
8070 | oldSpan > 0 && newSpan > 0 && (categoryThickness = categoryThickness * oldSpan / newSpan);
|
8071 | }
|
8072 | var tickValues;
|
8073 | if (isScalar && 1 === bestTickCount) tickValues = [ dataDomain[0] ]; else {
|
8074 | var minTickInterval = isScalar ? getMinTickValueInterval(formatString, dataType, is100Pct) : void 0;
|
8075 | tickValues = getRecommendedTickValues(bestTickCount, scale, dataType, isScalar, minTickInterval);
|
8076 | }
|
8077 | options.scaleType && options.scaleType === visuals.axisScale.log && isLogScaleAllowed && (tickValues = tickValues.filter(function(d) {
|
8078 | return AxisHelper.powerOfTen(d);
|
8079 | }));
|
8080 | var formatter = createFormatter(scaleDomain, dataDomain, dataType, isScalar, formatString, bestTickCount, tickValues, getValueFn, useTickIntervalForDisplayUnits, axisDisplayUnits, axisPrecision), axis = d3.svg.axis().scale(scale).tickSize(6, 0).orient(isVertical ? "left" : "bottom").ticks(bestTickCount).tickValues(tickValues), formattedTickValues = [];
|
8081 | metaDataColumn && (formattedTickValues = formatAxisTickValues(axis, tickValues, formatter, dataType, getValueFn));
|
8082 | var xLabelMaxWidth;
|
8083 | return !isScalar && categoryThickness ? xLabelMaxWidth = Math.max(1, categoryThickness - 2 * visuals.CartesianChart.TickLabelPadding) : (xLabelMaxWidth = tickValues.length > 1 ? getScalarLabelMaxWidth(scale, tickValues) : pixelSpan,
|
8084 | xLabelMaxWidth -= 2 * ScalarTickLabelPadding), {
|
8085 | scale: scale,
|
8086 | axis: axis,
|
8087 | formatter: formatter,
|
8088 | values: formattedTickValues,
|
8089 | axisType: dataType,
|
8090 | axisLabel: null,
|
8091 | isCategoryAxis: isCategoryAxis,
|
8092 | xLabelMaxWidth: xLabelMaxWidth,
|
8093 | categoryThickness: categoryThickness,
|
8094 | outerPadding: outerPadding,
|
8095 | usingDefaultDomain: scaleResult.usingDefaultDomain,
|
8096 | isLogScaleAllowed: isLogScaleAllowed,
|
8097 | dataDomain: dataDomain
|
8098 | };
|
8099 | }
|
8100 | function getScalarLabelMaxWidth(scale, tickValues) {
|
8101 | return scale && !_.isEmpty(tickValues) ? Math.abs(scale(tickValues[1]) - scale(tickValues[0])) : 1;
|
8102 | }
|
8103 | function createScale(options) {
|
8104 | var pixelSpan = options.pixelSpan, dataDomain = options.dataDomain, metaDataColumn = options.metaDataColumn, outerPadding = options.outerPadding || 0, isScalar = !!options.isScalar, isVertical = !!options.isVertical, forcedTickCount = options.forcedTickCount, categoryThickness = options.categoryThickness, shouldClamp = !!options.shouldClamp, maxTickCount = options.maxTickCount, dataType = AxisHelper.getCategoryValueType(metaDataColumn, isScalar), maxTicks = isVertical ? getRecommendedNumberOfTicksForYAxis(pixelSpan) : getRecommendedNumberOfTicksForXAxis(pixelSpan);
|
8105 | maxTickCount && maxTicks > maxTickCount && (maxTicks = maxTickCount);
|
8106 | var scale, scalarDomain = dataDomain ? dataDomain.slice() : null, bestTickCount = maxTicks, usingDefaultDomain = !1;
|
8107 | if (null == dataDomain || 2 === dataDomain.length && null == dataDomain[0] && null == dataDomain[1] || 2 !== dataDomain.length && isScalar) usingDefaultDomain = !0,
|
8108 | dataDomain = dataType.dateTime || !isOrdinal(dataType) ? visuals.emptyDomain : [],
|
8109 | scale = isOrdinal(dataType) ? createOrdinalScale(pixelSpan, dataDomain, categoryThickness ? outerPadding / categoryThickness : 0) : createNumericalScale(options.scaleType, pixelSpan, dataDomain, dataType, outerPadding, bestTickCount); else {
|
8110 | if (isScalar && dataDomain.length > 0) {
|
8111 | bestTickCount = void 0 !== forcedTickCount ? 0 !== maxTicks ? forcedTickCount : 0 : AxisHelper.getBestNumberOfTicks(dataDomain[0], dataDomain[dataDomain.length - 1], [ metaDataColumn ], maxTicks, dataType.dateTime);
|
8112 | var normalizedRange = normalizeLinearDomain({
|
8113 | min: dataDomain[0],
|
8114 | max: dataDomain[dataDomain.length - 1]
|
8115 | });
|
8116 | scalarDomain = [ normalizedRange.min, normalizedRange.max ];
|
8117 | }
|
8118 | isScalar && dataType.numeric && !dataType.dateTime ? scale = createNumericalScale(options.scaleType, pixelSpan, scalarDomain, dataType, outerPadding, bestTickCount, shouldClamp) : isScalar && dataType.dateTime ? scale = createLinearScale(pixelSpan, scalarDomain, outerPadding, null, shouldClamp) : (dataType.text || dataType.dateTime || dataType.numeric || dataType.bool) && (scale = createOrdinalScale(pixelSpan, scalarDomain, categoryThickness ? outerPadding / categoryThickness : 0),
|
8119 | bestTickCount = 0 === maxTicks ? 0 : Math.min(scalarDomain.length, (pixelSpan - 2 * outerPadding) / visuals.CartesianChart.MinOrdinalRectThickness));
|
8120 | }
|
8121 | return isVertical && isScalar && scale.range(scale.range().reverse()), visuals.ColumnUtil.normalizeInfinityInScale(scale),
|
8122 | {
|
8123 | scale: scale,
|
8124 | bestTickCount: bestTickCount,
|
8125 | usingDefaultDomain: usingDefaultDomain
|
8126 | };
|
8127 | }
|
8128 | function createFormatter(scaleDomain, dataDomain, dataType, isScalar, formatString, bestTickCount, tickValues, getValueFn, useTickIntervalForDisplayUnits, axisDisplayUnits, axisPrecision) {
|
8129 | void 0 === useTickIntervalForDisplayUnits && (useTickIntervalForDisplayUnits = !1);
|
8130 | var formatter;
|
8131 | if (dataType.dateTime) if (isScalar) {
|
8132 | var value = new Date(scaleDomain[0]), value2 = new Date(scaleDomain[1]);
|
8133 | 1 === bestTickCount && (value = value2 = new Date(dataDomain[0])), formatter = visuals.valueFormatter.create({
|
8134 | format: formatString,
|
8135 | value: value,
|
8136 | value2: value2,
|
8137 | tickCount: bestTickCount
|
8138 | });
|
8139 | } else formatter = visuals.valueFormatter.createDefaultFormatter(formatString, !0); else if (useTickIntervalForDisplayUnits && isScalar && tickValues.length > 1) {
|
8140 | var value1 = axisDisplayUnits ? axisDisplayUnits : tickValues[1] - tickValues[0], options = {
|
8141 | format: formatString,
|
8142 | value: value1,
|
8143 | value2: 0,
|
8144 | allowFormatBeautification: !0
|
8145 | };
|
8146 | axisPrecision ? options.precision = axisPrecision : options.detectAxisPrecision = !0,
|
8147 | formatter = visuals.valueFormatter.create(options);
|
8148 | } else formatter = visuals.valueFormatter.createDefaultFormatter(formatString, !0);
|
8149 | return formatter;
|
8150 | }
|
8151 | function formatAxisTickValues(axis, tickValues, formatter, dataType, getValueFn) {
|
8152 | var formattedTickValues = [];
|
8153 | return getValueFn || (getValueFn = function(data) {
|
8154 | return data;
|
8155 | }), formatter ? (axis.tickFormat(function(d) {
|
8156 | return formatter.format(getValueFn(d, dataType));
|
8157 | }), formattedTickValues = tickValues.map(function(d) {
|
8158 | return formatter.format(getValueFn(d, dataType));
|
8159 | })) : formattedTickValues = tickValues.map(function(d) {
|
8160 | return getValueFn(d, dataType);
|
8161 | }), formattedTickValues;
|
8162 | }
|
8163 | function getMinTickValueInterval(formatString, columnType, is100Pct) {
|
8164 | var isCustomFormat = formatString && !powerbi.NumberFormat.isStandardFormat(formatString);
|
8165 | if (isCustomFormat) {
|
8166 | var precision = powerbi.NumberFormat.getCustomFormatMetadata(formatString, !0).precision;
|
8167 | return formatString.indexOf("%") > -1 && (precision += 2), Math.pow(10, -precision);
|
8168 | }
|
8169 | return is100Pct ? .01 : columnType.integer ? 1 : 0;
|
8170 | }
|
8171 | function createScalarDomain(data, userMin, userMax, axisType, ensureDomain) {
|
8172 | if (0 === data.length) return null;
|
8173 | var defaultMinX = d3.min(data, function(kv) {
|
8174 | return d3.min(kv.data, function(d) {
|
8175 | return d.categoryValue;
|
8176 | });
|
8177 | }), defaultMaxX = d3.max(data, function(kv) {
|
8178 | return d3.max(kv.data, function(d) {
|
8179 | return d.categoryValue;
|
8180 | });
|
8181 | });
|
8182 | return combineDomain([ userMin, userMax ], [ defaultMinX, defaultMaxX ], ensureDomain);
|
8183 | }
|
8184 | function createValueDomain(data, includeZero) {
|
8185 | if (0 === data.length) return null;
|
8186 | var minY = d3.min(data, function(kv) {
|
8187 | return d3.min(kv.data, function(d) {
|
8188 | return d.value;
|
8189 | });
|
8190 | }), maxY = d3.max(data, function(kv) {
|
8191 | return d3.max(kv.data, function(d) {
|
8192 | return d.value;
|
8193 | });
|
8194 | });
|
8195 | return includeZero ? [ Math.min(minY, 0), Math.max(maxY, 0) ] : [ minY, maxY ];
|
8196 | }
|
8197 | function createOrdinalDomain(data) {
|
8198 | if (_.isEmpty(data)) return [];
|
8199 | for (var domain = [], firstSeries = data[0], _i = 0, _a = firstSeries.data; _i < _a.length; _i++) {
|
8200 | var dp = _a[_i];
|
8201 | dp.highlight || domain.push(dp.categoryIndex);
|
8202 | }
|
8203 | return domain;
|
8204 | }
|
8205 | function createOrdinalScale(pixelSpan, dataDomain, outerPaddingRatio) {
|
8206 | void 0 === outerPaddingRatio && (outerPaddingRatio = 0);
|
8207 | var scale = d3.scale.ordinal().rangeBands([ 0, pixelSpan ], visuals.CartesianChart.InnerPaddingRatio, outerPaddingRatio).domain(dataDomain);
|
8208 | return scale;
|
8209 | }
|
8210 | function isLogScalePossible(domain, axisType) {
|
8211 | return null == domain ? !1 : isDateTime(axisType) ? !1 : domain[0] > 0 && domain[1] > 0 || domain[0] < 0 && domain[1] < 0;
|
8212 | }
|
8213 | function createNumericalScale(axisScaleType, pixelSpan, dataDomain, dataType, outerPadding, niceCount, shouldClamp) {
|
8214 | return void 0 === outerPadding && (outerPadding = 0), axisScaleType === visuals.axisScale.log && isLogScalePossible(dataDomain, dataType) ? createLogScale(pixelSpan, dataDomain, outerPadding, niceCount) : createLinearScale(pixelSpan, dataDomain, outerPadding, niceCount, shouldClamp);
|
8215 | }
|
8216 | function createLogScale(pixelSpan, dataDomain, outerPadding, niceCount) {
|
8217 | void 0 === outerPadding && (outerPadding = 0);
|
8218 | var scale = d3.scale.log().range([ outerPadding, pixelSpan - outerPadding ]).domain([ dataDomain[0], dataDomain[1] ]).clamp(!0);
|
8219 | return niceCount && scale.nice(niceCount), scale;
|
8220 | }
|
8221 | function createLinearScale(pixelSpan, dataDomain, outerPadding, niceCount, shouldClamp) {
|
8222 | void 0 === outerPadding && (outerPadding = 0);
|
8223 | var scale = d3.scale.linear().range([ outerPadding, pixelSpan - outerPadding ]).domain([ dataDomain[0], dataDomain[1] ]).clamp(shouldClamp);
|
8224 | return niceCount && scale.nice(niceCount), scale;
|
8225 | }
|
8226 | function getRangeForColumn(sizeColumn) {
|
8227 | var result = {};
|
8228 | return sizeColumn && (result.min = null == sizeColumn.min ? null == sizeColumn.minLocal ? d3.min(sizeColumn.values) : sizeColumn.minLocal : sizeColumn.min,
|
8229 | result.max = null == sizeColumn.max ? null == sizeColumn.maxLocal ? d3.max(sizeColumn.values) : sizeColumn.maxLocal : sizeColumn.max),
|
8230 | result;
|
8231 | }
|
8232 | function applyCustomizedDomain(customizedDomain, forcedDomain) {
|
8233 | var domain = [ void 0, void 0 ];
|
8234 | return forcedDomain && 2 === forcedDomain.length && (domain = [ forcedDomain[0], forcedDomain[1] ]),
|
8235 | customizedDomain && 2 === customizedDomain.length && (null != customizedDomain[0] && (domain[0] = customizedDomain[0]),
|
8236 | null != customizedDomain[1] && (domain[1] = customizedDomain[1])), null == domain[0] && null == domain[1] ? forcedDomain : null != domain[0] && null != domain[1] && domain[0] > domain[1] ? forcedDomain : domain;
|
8237 | }
|
8238 | function combineDomain(forcedDomain, domain, ensureDomain) {
|
8239 | var combinedDomain = domain ? [ domain[0], domain[1] ] : [];
|
8240 | ensureDomain && ((null == combinedDomain[0] || ensureDomain.min < combinedDomain[0]) && (combinedDomain[0] = ensureDomain.min),
|
8241 | (null == combinedDomain[1] || ensureDomain.max > combinedDomain[1]) && (combinedDomain[1] = ensureDomain.max));
|
8242 | var domainBeforeForced = [ combinedDomain[0], combinedDomain[1] ];
|
8243 | return forcedDomain && 2 === forcedDomain.length && (null != forcedDomain[0] && (combinedDomain[0] = forcedDomain[0]),
|
8244 | null != forcedDomain[1] && (combinedDomain[1] = forcedDomain[1]), combinedDomain[0] > combinedDomain[1] && (combinedDomain = domainBeforeForced)),
|
8245 | combinedDomain;
|
8246 | }
|
8247 | function createAxisLabel(properties, label, unitType, y2) {
|
8248 | void 0 === y2 && (y2 = !1);
|
8249 | var propertyName = y2 ? "secAxisStyle" : "axisStyle";
|
8250 | if (!properties || !properties[propertyName]) return label;
|
8251 | var modifiedLabel;
|
8252 | return modifiedLabel = properties[propertyName] === visuals.axisStyle.showBoth ? label + " (" + unitType + ")" : properties[propertyName] === visuals.axisStyle.showUnitOnly ? unitType : label;
|
8253 | }
|
8254 | function scaleShouldClamp(combinedDomain, domain) {
|
8255 | return !combinedDomain || !domain || combinedDomain.length < 2 || domain.length < 2 ? !1 : combinedDomain[0] !== domain[0] || combinedDomain[1] !== domain[1];
|
8256 | }
|
8257 | function normalizeNonFiniteNumber(value) {
|
8258 | return isNaN(value) ? null : value === Number.POSITIVE_INFINITY ? Number.MAX_VALUE : value === Number.NEGATIVE_INFINITY ? -Number.MAX_VALUE : value;
|
8259 | }
|
8260 | function powerOfTen(d) {
|
8261 | var value = Math.abs(d), log10 = Math.log(value) / Math.LN10;
|
8262 | return log10 = Math.ceil(log10 - 1e-12), value / Math.pow(10, log10) === 1;
|
8263 | }
|
8264 | var XLabelMaxAllowedOverflow = 35, TextHeightConstant = 10, MinTickCount = 2, DefaultBestTickCount = 3, LeftPadding = 10, ScalarTickLabelPadding = 3;
|
8265 | AxisHelper.getRecommendedNumberOfTicksForXAxis = getRecommendedNumberOfTicksForXAxis,
|
8266 | AxisHelper.getRecommendedNumberOfTicksForYAxis = getRecommendedNumberOfTicksForYAxis,
|
8267 | AxisHelper.getBestNumberOfTicks = getBestNumberOfTicks, AxisHelper.hasNonIntegerData = hasNonIntegerData,
|
8268 | AxisHelper.getRecommendedTickValues = getRecommendedTickValues, AxisHelper.getRecommendedTickValuesForAnOrdinalRange = getRecommendedTickValuesForAnOrdinalRange,
|
8269 | AxisHelper.getRecommendedTickValuesForAQuantitativeRange = getRecommendedTickValuesForAQuantitativeRange,
|
8270 | AxisHelper.getMargin = getMargin, AxisHelper.getTickLabelMargins = getTickLabelMargins,
|
8271 | AxisHelper.columnDataTypeHasValue = columnDataTypeHasValue, AxisHelper.createOrdinalType = createOrdinalType,
|
8272 | AxisHelper.isOrdinal = isOrdinal, AxisHelper.isOrdinalScale = isOrdinalScale, AxisHelper.isDateTime = isDateTime,
|
8273 | AxisHelper.invertScale = invertScale, AxisHelper.extent = extent, AxisHelper.invertOrdinalScale = invertOrdinalScale,
|
8274 | AxisHelper.findClosestXAxisIndex = findClosestXAxisIndex, AxisHelper.lookupOrdinalIndex = lookupOrdinalIndex,
|
8275 | AxisHelper.diffScaled = diffScaled, AxisHelper.createDomain = createDomain, AxisHelper.ensureValuesInRange = ensureValuesInRange,
|
8276 | AxisHelper.getCategoryValueType = getCategoryValueType, AxisHelper.createAxis = createAxis,
|
8277 | AxisHelper.createScale = createScale, AxisHelper.createFormatter = createFormatter,
|
8278 | AxisHelper.getMinTickValueInterval = getMinTickValueInterval, AxisHelper.createValueDomain = createValueDomain;
|
8279 | var LabelLayoutStrategy;
|
8280 | !function(LabelLayoutStrategy) {
|
8281 | function willLabelsFit(axisProperties, availableWidth, textMeasurer, properties) {
|
8282 | var labels = axisProperties.values;
|
8283 | if (0 === labels.length) return !1;
|
8284 | var labelMaxWidth = void 0 !== axisProperties.xLabelMaxWidth ? axisProperties.xLabelMaxWidth : availableWidth / labels.length;
|
8285 | return !labels.some(function(d) {
|
8286 | return properties.text = d, textMeasurer(properties) > labelMaxWidth;
|
8287 | });
|
8288 | }
|
8289 | function willLabelsWordBreak(axisProperties, margin, availableWidth, textWidthMeasurer, textHeightMeasurer, textTruncator, properties) {
|
8290 | var labels = axisProperties.values, labelMaxWidth = void 0 !== axisProperties.xLabelMaxWidth ? axisProperties.xLabelMaxWidth : availableWidth / labels.length, maxRotatedLength = margin.bottom / LabelLayoutStrategy.DefaultRotation.sine, height = textHeightMeasurer(properties), maxNumLines = Math.max(1, Math.floor(margin.bottom / height));
|
8291 | if (0 === labels.length) return !1;
|
8292 | var mustRotate = labels.some(function(label) {
|
8293 | return properties.text = label, !jsCommon.WordBreaker.hasBreakers(label) && textWidthMeasurer(properties) > labelMaxWidth;
|
8294 | });
|
8295 | if (mustRotate) return !1;
|
8296 | var moreWordBreakChars = labels.filter(function(label, index) {
|
8297 | var allowedLengthProjectedOnXAxis = margin.left + axisProperties.outerPadding + axisProperties.categoryThickness * (index + .5) - LeftPadding, allowedLength = allowedLengthProjectedOnXAxis / LabelLayoutStrategy.DefaultRotation.cosine, rotatedLength = Math.min(allowedLength, maxRotatedLength), wordBreakChars = jsCommon.WordBreaker.splitByWidth(label, properties, textWidthMeasurer, labelMaxWidth, maxNumLines, textTruncator).join(" ");
|
8298 | properties.text = label;
|
8299 | var rotateChars = textTruncator(properties, rotatedLength);
|
8300 | return visuals.TextUtil.removeEllipses(wordBreakChars).length >= visuals.TextUtil.removeEllipses(rotateChars).length;
|
8301 | });
|
8302 | return moreWordBreakChars.length >= Math.floor(labels.length / 2);
|
8303 | }
|
8304 | function rotate(labelSelection, maxBottomMargin, textTruncator, textProperties, needRotate, needEllipsis, axisProperties, margin, scrollbarVisible) {
|
8305 | var rotatedLength, defaultRotation;
|
8306 | defaultRotation = scrollbarVisible ? LabelLayoutStrategy.DefaultRotationWithScrollbar : LabelLayoutStrategy.DefaultRotation,
|
8307 | needRotate && (rotatedLength = maxBottomMargin / defaultRotation.sine), labelSelection.each(function() {
|
8308 | var axisLabel = d3.select(this), labelText = axisLabel.text();
|
8309 | if (textProperties.text = labelText, needRotate) {
|
8310 | var textContentIndex = axisProperties.values.indexOf(this.textContent), allowedLengthProjectedOnXAxis = margin.left + axisProperties.outerPadding + axisProperties.categoryThickness * (textContentIndex + .5);
|
8311 | scrollbarVisible || (allowedLengthProjectedOnXAxis -= LeftPadding);
|
8312 | var allowedLength = allowedLengthProjectedOnXAxis / defaultRotation.cosine;
|
8313 | (scrollbarVisible || needEllipsis || rotatedLength > allowedLength) && (labelText = textTruncator(textProperties, Math.min(allowedLength, rotatedLength)),
|
8314 | axisLabel.text(labelText)), axisLabel.style("text-anchor", "end").attr({
|
8315 | dx: "-0.5em",
|
8316 | dy: defaultRotation.dy,
|
8317 | transform: defaultRotation.transform
|
8318 | });
|
8319 | } else {
|
8320 | var newLabelText = textTruncator(textProperties, axisProperties.xLabelMaxWidth);
|
8321 | newLabelText !== labelText && axisLabel.text(newLabelText), axisLabel.style("text-anchor", "middle").attr({
|
8322 | dx: "0em",
|
8323 | dy: "1em",
|
8324 | transform: "rotate(0)"
|
8325 | });
|
8326 | }
|
8327 | });
|
8328 | }
|
8329 | function wordBreak(text, axisProperties, maxHeight) {
|
8330 | var allowedLength = axisProperties.xLabelMaxWidth;
|
8331 | text.each(function() {
|
8332 | var node = d3.select(this);
|
8333 | node.style("text-anchor", "middle").attr({
|
8334 | dx: "0em",
|
8335 | dy: "1em",
|
8336 | transform: "rotate(0)"
|
8337 | }), powerbi.TextMeasurementService.wordBreak(this, allowedLength, maxHeight);
|
8338 | });
|
8339 | }
|
8340 | function clip(text, availableWidth, svgEllipsis) {
|
8341 | 0 !== text.size() && text.each(function() {
|
8342 | var text = d3.select(this);
|
8343 | svgEllipsis(text[0][0], availableWidth);
|
8344 | });
|
8345 | }
|
8346 | LabelLayoutStrategy.willLabelsFit = willLabelsFit, LabelLayoutStrategy.willLabelsWordBreak = willLabelsWordBreak,
|
8347 | LabelLayoutStrategy.DefaultRotation = {
|
8348 | sine: Math.sin(Math.PI * (35 / 180)),
|
8349 | cosine: Math.cos(Math.PI * (35 / 180)),
|
8350 | tangent: Math.tan(Math.PI * (35 / 180)),
|
8351 | transform: "rotate(-35)",
|
8352 | dy: "-0.5em"
|
8353 | }, LabelLayoutStrategy.DefaultRotationWithScrollbar = {
|
8354 | sine: Math.sin(.5 * Math.PI),
|
8355 | cosine: Math.cos(.5 * Math.PI),
|
8356 | tangent: Math.tan(.5 * Math.PI),
|
8357 | transform: "rotate(-90)",
|
8358 | dy: "-0.8em"
|
8359 | }, LabelLayoutStrategy.rotate = rotate, LabelLayoutStrategy.wordBreak = wordBreak,
|
8360 | LabelLayoutStrategy.clip = clip;
|
8361 | }(LabelLayoutStrategy = AxisHelper.LabelLayoutStrategy || (AxisHelper.LabelLayoutStrategy = {})),
|
8362 | AxisHelper.createOrdinalScale = createOrdinalScale, AxisHelper.isLogScalePossible = isLogScalePossible,
|
8363 | AxisHelper.createNumericalScale = createNumericalScale, AxisHelper.createLinearScale = createLinearScale,
|
8364 | AxisHelper.getRangeForColumn = getRangeForColumn, AxisHelper.applyCustomizedDomain = applyCustomizedDomain,
|
8365 | AxisHelper.combineDomain = combineDomain, AxisHelper.createAxisLabel = createAxisLabel,
|
8366 | AxisHelper.scaleShouldClamp = scaleShouldClamp, AxisHelper.normalizeNonFiniteNumber = normalizeNonFiniteNumber,
|
8367 | AxisHelper.powerOfTen = powerOfTen;
|
8368 | }(AxisHelper = visuals.AxisHelper || (visuals.AxisHelper = {}));
|
8369 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
8370 | }(powerbi || (powerbi = {}));
|
8371 | }, function(module, exports) {
|
8372 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
8373 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
8374 | !function(powerbi) {
|
8375 | var visuals;
|
8376 | !function(visuals) {
|
8377 | var ShapeFactory;
|
8378 | !function(ShapeFactory) {
|
8379 | function createRectangle(data, viewportHeight, viewportWidth, selectedElement, degrees) {
|
8380 | var x = viewportWidth * ShapeFactoryConsts.PaddingConstRatio + data.lineWeight / 2, y = viewportHeight * ShapeFactoryConsts.PaddingConstRatio + data.lineWeight / 2, width = viewportWidth * ShapeFactoryConsts.ShapeConstRatio - data.lineWeight, height = viewportHeight * ShapeFactoryConsts.ShapeConstRatio - data.lineWeight, attrs = {
|
8381 | x: x,
|
8382 | y: y,
|
8383 | width: width,
|
8384 | height: height,
|
8385 | rx: data.roundEdge,
|
8386 | ry: data.roundEdge
|
8387 | }, scale = getScale(width, height, degrees);
|
8388 | createShape(data, viewportHeight, viewportWidth, selectedElement, degrees, scale, "rect", attrs);
|
8389 | }
|
8390 | function createOval(data, viewportHeight, viewportWidth, selectedElement, degrees) {
|
8391 | var widthForCircle = (viewportWidth / ShapeFactoryConsts.OvalRadiusConst).toString(), heightForCircle = (viewportHeight / ShapeFactoryConsts.OvalRadiusConst).toString(), radiusXForCircle = viewportWidth / (ShapeFactoryConsts.OvalRadiusConst + ShapeFactoryConsts.OvalRadiusConstPadding) - data.lineWeight, radiusYForCircle = viewportHeight / (ShapeFactoryConsts.OvalRadiusConst + ShapeFactoryConsts.OvalRadiusConstPadding) - data.lineWeight, attrs = {
|
8392 | cx: widthForCircle,
|
8393 | cy: heightForCircle,
|
8394 | rx: radiusXForCircle,
|
8395 | ry: radiusYForCircle
|
8396 | }, scale = getScale(viewportWidth, viewportHeight, degrees);
|
8397 | createShape(data, viewportHeight, viewportWidth, selectedElement, degrees, scale, "ellipse", attrs);
|
8398 | }
|
8399 | function createLine(data, viewportHeight, viewportWidth, selectedElement, degrees) {
|
8400 | var x1, y1, x2, y2, ratio, width = viewportWidth - ShapeFactoryConsts.SmallPaddingConstValue - ShapeFactoryConsts.SmallPaddingConstValue, height = viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue - ShapeFactoryConsts.SmallPaddingConstValue;
|
8401 | 45 >= degrees ? (ratio = degrees / 90, x1 = viewportWidth / 2 + width * ratio, y1 = ShapeFactoryConsts.SmallPaddingConstValue,
|
8402 | x2 = viewportWidth / 2 - width * ratio, y2 = viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue) : 135 >= degrees ? (ratio = (degrees - 45) / 90,
|
8403 | x1 = viewportWidth - ShapeFactoryConsts.SmallPaddingConstValue, y1 = ShapeFactoryConsts.SmallPaddingConstValue + height * ratio,
|
8404 | x2 = ShapeFactoryConsts.SmallPaddingConstValue, y2 = viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue - height * ratio) : 225 >= degrees ? (ratio = (degrees - 135) / 90,
|
8405 | x1 = viewportWidth - ShapeFactoryConsts.SmallPaddingConstValue - width * ratio,
|
8406 | y1 = viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue, x2 = ShapeFactoryConsts.SmallPaddingConstValue + width * ratio,
|
8407 | y2 = ShapeFactoryConsts.SmallPaddingConstValue) : 315 >= degrees ? (ratio = (degrees - 225) / 90,
|
8408 | x1 = ShapeFactoryConsts.SmallPaddingConstValue, y1 = viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue - height * ratio,
|
8409 | x2 = viewportWidth - ShapeFactoryConsts.SmallPaddingConstValue, y2 = ShapeFactoryConsts.SmallPaddingConstValue + height * ratio) : 360 >= degrees && (ratio = (degrees - 315) / 90,
|
8410 | x1 = ShapeFactoryConsts.SmallPaddingConstValue + width * ratio, y1 = ShapeFactoryConsts.SmallPaddingConstValue,
|
8411 | x2 = viewportWidth - ShapeFactoryConsts.SmallPaddingConstValue - width * ratio,
|
8412 | y2 = viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue), selectedElement.append("svg").attr({
|
8413 | width: viewportWidth,
|
8414 | height: viewportHeight
|
8415 | }).append("line").attr({
|
8416 | x1: x1,
|
8417 | y1: y1,
|
8418 | x2: x2,
|
8419 | y2: y2
|
8420 | }).style({
|
8421 | "vector-effect": "non-scaling-stroke",
|
8422 | "stroke-width": data.lineWeight + "px",
|
8423 | "stroke-opacity": (100 - data.lineTransparency) / 100,
|
8424 | stroke: data.lineColor
|
8425 | });
|
8426 | }
|
8427 | function createUpArrow(data, viewportHeight, viewportWidth, selectedElement, degrees) {
|
8428 | var lineWeight = data.lineWeight, viewportHeightWeight = viewportHeight - lineWeight, viewportWidthWeight = viewportWidth - lineWeight, arrowPoints = [ {
|
8429 | x: (viewportWidthWeight * ShapeFactoryConsts.ArrowLeftHeadPoint.x).toString(),
|
8430 | y: (viewportHeightWeight * ShapeFactoryConsts.ArrowLeftHeadPoint.y).toString()
|
8431 | }, {
|
8432 | x: (viewportWidthWeight * ShapeFactoryConsts.ArrowMiddleHeadPoint.x).toString(),
|
8433 | y: (viewportHeightWeight * ShapeFactoryConsts.ArrowMiddleHeadPoint.y).toString()
|
8434 | }, {
|
8435 | x: (viewportWidthWeight * ShapeFactoryConsts.ArrowRightHeadPoint.x).toString(),
|
8436 | y: (viewportHeightWeight * ShapeFactoryConsts.ArrowRightHeadPoint.y).toString()
|
8437 | }, {
|
8438 | x: (viewportWidthWeight * ShapeFactoryConsts.ArrowRightMiddleHeadPoint.x).toString(),
|
8439 | y: (viewportHeightWeight * ShapeFactoryConsts.ArrowRightMiddleHeadPoint.y).toString()
|
8440 | }, {
|
8441 | x: (viewportWidthWeight * ShapeFactoryConsts.ArrowBottomRightPoint.x).toString(),
|
8442 | y: (viewportHeightWeight * ShapeFactoryConsts.ArrowBottomRightPoint.y).toString()
|
8443 | }, {
|
8444 | x: (viewportWidthWeight * ShapeFactoryConsts.ArrowBottomLeftPoint.x).toString(),
|
8445 | y: (viewportHeightWeight * ShapeFactoryConsts.ArrowBottomLeftPoint.y).toString()
|
8446 | }, {
|
8447 | x: (viewportWidthWeight * ShapeFactoryConsts.ArrowLeftMiddleHeadPoint.x).toString(),
|
8448 | y: (viewportHeightWeight * ShapeFactoryConsts.ArrowLeftMiddleHeadPoint.y).toString()
|
8449 | } ];
|
8450 | createPathFromArray(data, arrowPoints, selectedElement, viewportHeight, viewportWidth, degrees);
|
8451 | }
|
8452 | function createTriangle(data, viewportHeight, viewportWidth, selectedElement, degrees) {
|
8453 | var lineWeight = data.lineWeight;
|
8454 | lineWeight > 3 && (lineWeight -= 3);
|
8455 | var firstPointX = (viewportWidth + lineWeight) * ShapeFactoryConsts.TrianglePaddingConstRatio, firstPointY = viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue - lineWeight < 0 ? viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue : viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue - lineWeight, secondPointY = (viewportHeight + lineWeight) * ShapeFactoryConsts.TrianglePaddingConstRatio, thirdPointX = (viewportWidth - lineWeight) * ShapeFactoryConsts.TriangleEndPaddingConstRatio < 0 ? viewportWidth * ShapeFactoryConsts.TriangleEndPaddingConstRatio : (viewportWidth - lineWeight) * ShapeFactoryConsts.TriangleEndPaddingConstRatio, thirdPointY = viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue - lineWeight < 0 ? viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue : viewportHeight - lineWeight - ShapeFactoryConsts.SmallPaddingConstValue, secondPointX = (firstPointX + thirdPointX) / 2;
|
8456 | 10 > firstPointX && (firstPointX = ShapeFactoryConsts.SmallPaddingConstValue), 10 > secondPointY && (secondPointY = ShapeFactoryConsts.SmallPaddingConstValue);
|
8457 | var trianglePoints = [ {
|
8458 | x: firstPointX,
|
8459 | y: firstPointY
|
8460 | }, {
|
8461 | x: secondPointX,
|
8462 | y: secondPointY
|
8463 | }, {
|
8464 | x: thirdPointX,
|
8465 | y: thirdPointY
|
8466 | } ];
|
8467 | createPathFromArray(data, trianglePoints, selectedElement, viewportHeight, viewportWidth, degrees);
|
8468 | }
|
8469 | function createPathFromArray(data, points, selectedElement, viewportHeight, viewportWidth, degrees) {
|
8470 | var lineFunction = d3.svg.line().x(function(d) {
|
8471 | return d.x;
|
8472 | }).y(function(d) {
|
8473 | return d.y;
|
8474 | }).interpolate("linear"), attrs = {
|
8475 | d: lineFunction(points) + " Z"
|
8476 | }, scale = getScale(viewportWidth, viewportHeight, degrees);
|
8477 | createShape(data, viewportHeight, viewportWidth, selectedElement, degrees, scale, "path", attrs);
|
8478 | }
|
8479 | function createShape(data, viewportHeight, viewportWidth, selectedElement, degrees, scale, shapeType, shapeAttrs) {
|
8480 | selectedElement.append("div").style({
|
8481 | transform: "rotate(" + degrees + "deg) scale(" + scale + ")",
|
8482 | "transform-origin": "center",
|
8483 | "-webkit-transform": "rotate(" + degrees + "deg) scale(" + scale + ")",
|
8484 | "-webkit-transform-origin": "center",
|
8485 | width: viewportWidth + "px",
|
8486 | height: viewportHeight + "px"
|
8487 | }).append("svg").attr({
|
8488 | width: viewportWidth,
|
8489 | height: viewportHeight
|
8490 | }).append(shapeType).attr(shapeAttrs).style({
|
8491 | "vector-effect": "non-scaling-stroke",
|
8492 | "stroke-width": data.lineWeight + "px",
|
8493 | stroke: data.lineColor,
|
8494 | "stroke-opacity": (100 - data.lineTransparency) / 100,
|
8495 | fill: data.fillColor,
|
8496 | "fill-opacity": data.showFill === !0 ? (100 - data.shapeTransparency) / 100 : 0
|
8497 | });
|
8498 | }
|
8499 | function getScale(width, height, degrees) {
|
8500 | var originalWidth = width, originalHeight = height, offsetAngle = Math.atan2(height, width), originalFactor = Math.sqrt(Math.pow(height, 2) + Math.pow(width, 2)), radians = degrees / 180 * Math.PI;
|
8501 | return width >= height ? (90 > degrees ? radians += offsetAngle : 180 > degrees ? radians -= offsetAngle : 270 > degrees ? radians += offsetAngle : radians -= offsetAngle,
|
8502 | originalHeight / Math.abs(Math.sin(radians)) / originalFactor) : (90 > degrees ? radians -= offsetAngle : 180 > degrees ? radians += offsetAngle : 270 > degrees ? radians -= offsetAngle : radians += offsetAngle,
|
8503 | originalWidth / Math.abs(Math.cos(radians)) / originalFactor);
|
8504 | }
|
8505 | var ShapeFactoryConsts;
|
8506 | !function(ShapeFactoryConsts) {
|
8507 | ShapeFactoryConsts.PaddingConstRatio = .01, ShapeFactoryConsts.TrianglePaddingConstRatio = .15,
|
8508 | ShapeFactoryConsts.TriangleEndPaddingConstRatio = .85, ShapeFactoryConsts.ShapeConstRatio = 1 - 2 * ShapeFactoryConsts.PaddingConstRatio,
|
8509 | ShapeFactoryConsts.SmallPaddingConstValue = 10, ShapeFactoryConsts.OvalRadiusConst = 2,
|
8510 | ShapeFactoryConsts.OvalRadiusConstPadding = .2, ShapeFactoryConsts.ArrowLeftHeadPoint = {
|
8511 | x: .05,
|
8512 | y: .42
|
8513 | }, ShapeFactoryConsts.ArrowMiddleHeadPoint = {
|
8514 | x: .5,
|
8515 | y: .016
|
8516 | }, ShapeFactoryConsts.ArrowRightHeadPoint = {
|
8517 | x: .95,
|
8518 | y: .42
|
8519 | }, ShapeFactoryConsts.ArrowRightMiddleHeadPoint = {
|
8520 | x: .764,
|
8521 | y: .42
|
8522 | }, ShapeFactoryConsts.ArrowBottomRightPoint = {
|
8523 | x: .764,
|
8524 | y: .993
|
8525 | }, ShapeFactoryConsts.ArrowBottomLeftPoint = {
|
8526 | x: .246,
|
8527 | y: .993
|
8528 | }, ShapeFactoryConsts.ArrowLeftMiddleHeadPoint = {
|
8529 | x: .246,
|
8530 | y: .42
|
8531 | };
|
8532 | }(ShapeFactoryConsts = ShapeFactory.ShapeFactoryConsts || (ShapeFactory.ShapeFactoryConsts = {})),
|
8533 | ShapeFactory.createRectangle = createRectangle, ShapeFactory.createOval = createOval,
|
8534 | ShapeFactory.createLine = createLine, ShapeFactory.createUpArrow = createUpArrow,
|
8535 | ShapeFactory.createTriangle = createTriangle;
|
8536 | }(ShapeFactory = visuals.ShapeFactory || (visuals.ShapeFactory = {}));
|
8537 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
8538 | }(powerbi || (powerbi = {}));
|
8539 | }, function(module, exports) {
|
8540 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
8541 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
8542 | !function(powerbi) {
|
8543 | var visuals;
|
8544 | !function(visuals) {
|
8545 | var CartesianHelper;
|
8546 | !function(CartesianHelper) {
|
8547 | function getCategoryAxisProperties(dataViewMetadata, axisTitleOnByDefault) {
|
8548 | var toReturn = {};
|
8549 | if (!dataViewMetadata) return toReturn;
|
8550 | var objects = dataViewMetadata.objects;
|
8551 | if (objects) {
|
8552 | var categoryAxisObject = objects.categoryAxis;
|
8553 | categoryAxisObject && (toReturn = {
|
8554 | show: categoryAxisObject.show,
|
8555 | axisType: categoryAxisObject.axisType,
|
8556 | axisScale: categoryAxisObject.axisScale,
|
8557 | start: categoryAxisObject.start,
|
8558 | end: categoryAxisObject.end,
|
8559 | showAxisTitle: null == categoryAxisObject.showAxisTitle ? axisTitleOnByDefault : categoryAxisObject.showAxisTitle,
|
8560 | axisStyle: categoryAxisObject.axisStyle,
|
8561 | labelColor: categoryAxisObject.labelColor,
|
8562 | labelDisplayUnits: categoryAxisObject.labelDisplayUnits,
|
8563 | labelPrecision: categoryAxisObject.labelPrecision,
|
8564 | duration: categoryAxisObject.duration
|
8565 | });
|
8566 | }
|
8567 | return toReturn;
|
8568 | }
|
8569 | function getValueAxisProperties(dataViewMetadata, axisTitleOnByDefault) {
|
8570 | var toReturn = {};
|
8571 | if (!dataViewMetadata) return toReturn;
|
8572 | var objects = dataViewMetadata.objects;
|
8573 | if (objects) {
|
8574 | var valueAxisObject = objects.valueAxis;
|
8575 | valueAxisObject && (toReturn = {
|
8576 | show: valueAxisObject.show,
|
8577 | position: valueAxisObject.position,
|
8578 | axisScale: valueAxisObject.axisScale,
|
8579 | start: valueAxisObject.start,
|
8580 | end: valueAxisObject.end,
|
8581 | showAxisTitle: null == valueAxisObject.showAxisTitle ? axisTitleOnByDefault : valueAxisObject.showAxisTitle,
|
8582 | axisStyle: valueAxisObject.axisStyle,
|
8583 | labelColor: valueAxisObject.labelColor,
|
8584 | labelDisplayUnits: valueAxisObject.labelDisplayUnits,
|
8585 | labelPrecision: valueAxisObject.labelPrecision,
|
8586 | secShow: valueAxisObject.secShow,
|
8587 | secPosition: valueAxisObject.secPosition,
|
8588 | secAxisScale: valueAxisObject.secAxisScale,
|
8589 | secStart: valueAxisObject.secStart,
|
8590 | secEnd: valueAxisObject.secEnd,
|
8591 | secShowAxisTitle: valueAxisObject.secShowAxisTitle,
|
8592 | secAxisStyle: valueAxisObject.secAxisStyle,
|
8593 | secLabelColor: valueAxisObject.secLabelColor,
|
8594 | secLabelDisplayUnits: valueAxisObject.secLabelDisplayUnits,
|
8595 | secLabelPrecision: valueAxisObject.secLabelPrecision
|
8596 | });
|
8597 | }
|
8598 | return toReturn;
|
8599 | }
|
8600 | function isScalar(isScalar, xAxisCardProperties) {
|
8601 | return isScalar && (isScalar = xAxisCardProperties && xAxisCardProperties.axisType ? xAxisCardProperties.axisType === visuals.axisType.scalar : !0),
|
8602 | isScalar;
|
8603 | }
|
8604 | function getPrecision(precision) {
|
8605 | return null != precision ? 0 > precision ? 0 : precision : null;
|
8606 | }
|
8607 | function lookupXValue(data, index, type, isScalar) {
|
8608 | var isDateTime = visuals.AxisHelper.isDateTime(type);
|
8609 | if (isScalar) return isDateTime ? new Date(index) : index;
|
8610 | if (type.text) return data.categories[index];
|
8611 | if (data && data.series && data.series.length > 0) {
|
8612 | var firstSeries = data.series[0];
|
8613 | if (firstSeries) {
|
8614 | var seriesValues = firstSeries.data;
|
8615 | if (seriesValues) {
|
8616 | data.hasHighlights && (index = 2 * index);
|
8617 | var dataAtIndex = seriesValues[index];
|
8618 | if (dataAtIndex) return isDateTime && null != dataAtIndex.categoryValue ? new Date(dataAtIndex.categoryValue) : dataAtIndex.categoryValue;
|
8619 | }
|
8620 | }
|
8621 | }
|
8622 | return index;
|
8623 | }
|
8624 | function findMaxCategoryIndex(series) {
|
8625 | if (_.isEmpty(series)) return 0;
|
8626 | for (var maxCategoryIndex = 0, _i = 0, series_1 = series; _i < series_1.length; _i++) {
|
8627 | var singleSeries = series_1[_i];
|
8628 | if (!_.isEmpty(singleSeries.data)) {
|
8629 | var lastIndex = singleSeries.data[singleSeries.data.length - 1].categoryIndex;
|
8630 | maxCategoryIndex = Math.max(lastIndex, maxCategoryIndex);
|
8631 | }
|
8632 | }
|
8633 | return maxCategoryIndex;
|
8634 | }
|
8635 | CartesianHelper.getCategoryAxisProperties = getCategoryAxisProperties, CartesianHelper.getValueAxisProperties = getValueAxisProperties,
|
8636 | CartesianHelper.isScalar = isScalar, CartesianHelper.getPrecision = getPrecision,
|
8637 | CartesianHelper.lookupXValue = lookupXValue, CartesianHelper.findMaxCategoryIndex = findMaxCategoryIndex;
|
8638 | }(CartesianHelper = visuals.CartesianHelper || (visuals.CartesianHelper = {}));
|
8639 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
8640 | }(powerbi || (powerbi = {}));
|
8641 | }, function(module, exports) {
|
8642 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
8643 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
8644 | !function(powerbi) {
|
8645 | var visuals;
|
8646 | !function(visuals) {
|
8647 | var SQExprShortSerializer = powerbi.data.SQExprShortSerializer, ColorHelper = function() {
|
8648 | function ColorHelper(colors, fillProp, defaultDataPointColor) {
|
8649 | this.colors = colors, this.fillProp = fillProp, this.defaultDataPointColor = defaultDataPointColor,
|
8650 | this.defaultColorScale = colors.getNewColorScale();
|
8651 | }
|
8652 | return ColorHelper.prototype.getColorForSeriesValue = function(objects, fieldIds, value) {
|
8653 | return this.fillProp && powerbi.DataViewObjects.getFillColor(objects, this.fillProp) || this.defaultDataPointColor || this.getColorScaleForSeries(fieldIds).getColor(value).value;
|
8654 | }, ColorHelper.prototype.getColorScaleForSeries = function(fieldIds) {
|
8655 | return this.colors.getColorScaleByKey(SQExprShortSerializer.serializeArray(fieldIds || []));
|
8656 | }, ColorHelper.prototype.getColorForMeasure = function(objects, measureKey) {
|
8657 | var scaleColor = this.defaultColorScale.getColor(measureKey).value;
|
8658 | return this.fillProp && powerbi.DataViewObjects.getFillColor(objects, this.fillProp) || this.defaultDataPointColor || scaleColor;
|
8659 | }, ColorHelper.normalizeSelector = function(selector, isSingleSeries) {
|
8660 | return selector && (isSingleSeries || selector.data) ? {
|
8661 | data: selector.data
|
8662 | } : selector;
|
8663 | }, ColorHelper;
|
8664 | }();
|
8665 | visuals.ColorHelper = ColorHelper;
|
8666 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
8667 | }(powerbi || (powerbi = {}));
|
8668 | }, function(module, exports) {
|
8669 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
8670 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
8671 | !function(powerbi) {
|
8672 | var visuals;
|
8673 | !function(visuals) {
|
8674 | var ColumnUtil, rectName = "rect";
|
8675 | !function(ColumnUtil) {
|
8676 | function applyUserMinMax(isScalar, dataView, xAxisCardProperties) {
|
8677 | if (isScalar) {
|
8678 | var min = xAxisCardProperties.start, max = xAxisCardProperties.end;
|
8679 | return ColumnUtil.transformDomain(dataView, min, max);
|
8680 | }
|
8681 | return dataView;
|
8682 | }
|
8683 | function transformDomain(dataView, min, max) {
|
8684 | if (!dataView.categories || !dataView.values || 0 === dataView.categories.length || 0 === dataView.values.length) return dataView;
|
8685 | if ("number" != typeof min && "number" != typeof max) return dataView;
|
8686 | var category = dataView.categories[0], categoryType = category ? category.source.type : null;
|
8687 | if (!visuals.AxisHelper.isOrdinal(categoryType)) {
|
8688 | var categoryValues = category.values, categoryObjects = category.objects;
|
8689 | if (!categoryValues || !categoryObjects) return dataView;
|
8690 | var newcategoryValues = [], newValues = [], newObjects = [];
|
8691 | if ("number" != typeof min && (min = categoryValues[0]), "number" != typeof max && (max = categoryValues[categoryValues.length - 1]),
|
8692 | min > max) return dataView;
|
8693 | for (var j = 0, len = dataView.values.length; len > j; j++) newValues.push([]);
|
8694 | for (var t = 0, len = categoryValues.length; len > t; t++) if (categoryValues[t] >= min && categoryValues[t] <= max && (newcategoryValues.push(categoryValues[t]),
|
8695 | categoryObjects && newObjects.push(categoryObjects[t]), dataView.values)) for (var k = 0; k < dataView.values.length; k++) newValues[k].push(dataView.values[k].values[t]);
|
8696 | var resultDataView = powerbi.Prototype.inherit(dataView), resultDataViewValues = resultDataView.values = powerbi.Prototype.inherit(resultDataView.values), resultDataViewCategories = resultDataView.categories = powerbi.Prototype.inherit(dataView.categories), resultDataViewCategories0 = resultDataView.categories[0] = powerbi.Prototype.inherit(resultDataViewCategories[0]);
|
8697 | resultDataViewCategories0.values = newcategoryValues, resultDataViewCategories0.objects && (resultDataViewCategories0.objects = newObjects);
|
8698 | for (var t = 0, len = dataView.values.length; len > t; t++) {
|
8699 | var measureArray = resultDataViewValues[t] = powerbi.Prototype.inherit(resultDataViewValues[t]);
|
8700 | measureArray.values = newValues[t];
|
8701 | }
|
8702 | return resultDataView;
|
8703 | }
|
8704 | }
|
8705 | function getCategoryAxis(data, size, layout, isVertical, forcedXMin, forcedXMax, axisScaleType, axisDisplayUnits, axisPrecision, ensureXDomain) {
|
8706 | var categoryThickness = layout.categoryThickness, isScalar = layout.isScalar, outerPaddingRatio = layout.outerPaddingRatio, domain = visuals.AxisHelper.createDomain(data.series, data.categoryMetadata ? data.categoryMetadata.type : powerbi.ValueType.fromDescriptor({
|
8707 | text: !0
|
8708 | }), isScalar, [ forcedXMin, forcedXMax ], ensureXDomain), axisProperties = visuals.AxisHelper.createAxis({
|
8709 | pixelSpan: size,
|
8710 | dataDomain: domain,
|
8711 | metaDataColumn: data.categoryMetadata,
|
8712 | formatString: visuals.valueFormatter.getFormatString(data.categoryMetadata, visuals.columnChartProps.general.formatString),
|
8713 | outerPadding: categoryThickness * outerPaddingRatio,
|
8714 | isCategoryAxis: !0,
|
8715 | isScalar: isScalar,
|
8716 | isVertical: isVertical,
|
8717 | categoryThickness: categoryThickness,
|
8718 | useTickIntervalForDisplayUnits: !0,
|
8719 | getValueFn: function(index, type) {
|
8720 | return visuals.CartesianHelper.lookupXValue(data, index, type, isScalar);
|
8721 | },
|
8722 | scaleType: axisScaleType,
|
8723 | axisDisplayUnits: axisDisplayUnits,
|
8724 | axisPrecision: axisPrecision
|
8725 | });
|
8726 | return layout.categoryThickness = axisProperties.categoryThickness, axisProperties;
|
8727 | }
|
8728 | function applyInteractivity(columns, onDragStart) {
|
8729 | onDragStart && columns.attr("draggable", "true").on("dragstart", onDragStart);
|
8730 | }
|
8731 | function getFillOpacity(selected, highlight, hasSelection, hasPartialHighlights) {
|
8732 | return hasPartialHighlights && !highlight || hasSelection && !selected ? ColumnUtil.DimmedOpacity : ColumnUtil.DefaultOpacity;
|
8733 | }
|
8734 | function getClosestColumnIndex(coordinate, columnsCenters) {
|
8735 | for (var currentIndex = 0, distance = Number.MAX_VALUE, i = 0, ilen = columnsCenters.length; ilen > i; i++) {
|
8736 | var currentDistance = Math.abs(coordinate - columnsCenters[i]);
|
8737 | distance > currentDistance && (distance = currentDistance, currentIndex = i);
|
8738 | }
|
8739 | return currentIndex;
|
8740 | }
|
8741 | function setChosenColumnOpacity(mainGraphicsContext, columnGroupSelector, selectedColumnIndex, lastColumnIndex) {
|
8742 | var series = mainGraphicsContext.selectAll(visuals.ColumnChart.SeriesClasses.selector), lastColumnUndefined = "undefined" == typeof lastColumnIndex;
|
8743 | series.selectAll(rectName + columnGroupSelector).filter(function(d) {
|
8744 | return d.categoryIndex !== selectedColumnIndex && (lastColumnUndefined || d.categoryIndex === lastColumnIndex);
|
8745 | }).transition().style("fill-opacity", ColumnUtil.DimmedOpacity), series.selectAll(rectName + columnGroupSelector).filter(function(d) {
|
8746 | return d.categoryIndex === selectedColumnIndex;
|
8747 | }).style("fill-opacity", ColumnUtil.DefaultOpacity);
|
8748 | }
|
8749 | function drawSeries(data, graphicsContext, axisOptions) {
|
8750 | var colGroupSelection = graphicsContext.selectAll(visuals.ColumnChart.SeriesClasses.selector), series = colGroupSelection.data(data.series, function(d) {
|
8751 | return d.key;
|
8752 | });
|
8753 | return series.enter().append("g").classed(visuals.ColumnChart.SeriesClasses["class"], !0),
|
8754 | series.style({
|
8755 | fill: function(d) {
|
8756 | return d.color;
|
8757 | }
|
8758 | }), series.exit().remove(), series;
|
8759 | }
|
8760 | function drawDefaultShapes(data, series, layout, itemCS, filterZeros, hasSelection) {
|
8761 | var dataSelector;
|
8762 | dataSelector = filterZeros ? function(d) {
|
8763 | var filteredData = _.filter(d.data, function(datapoint) {
|
8764 | return !!datapoint.value;
|
8765 | });
|
8766 | return filteredData;
|
8767 | } : function(d) {
|
8768 | return d.data;
|
8769 | };
|
8770 | var shapeSelection = series.selectAll(itemCS.selector), shapes = shapeSelection.data(dataSelector, function(d) {
|
8771 | return d.key;
|
8772 | });
|
8773 | return shapes.enter().append(rectName).attr("class", function(d) {
|
8774 | return itemCS["class"].concat(d.highlight ? " highlight" : "");
|
8775 | }), shapes.style("fill-opacity", function(d) {
|
8776 | return ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, data.hasHighlights);
|
8777 | }).style("fill", function(d) {
|
8778 | return d.color !== data.series[d.seriesIndex].color ? d.color : null;
|
8779 | }).attr(layout.shapeLayout), shapes.exit().remove(), shapes;
|
8780 | }
|
8781 | function drawDefaultLabels(series, context, layout, viewPort, isAnimator, animationDuration) {
|
8782 | if (void 0 === isAnimator && (isAnimator = !1), series) {
|
8783 | for (var seriesData = series.data(), dataPoints = [], i = 0, len = seriesData.length; len > i; i++) Array.prototype.push.apply(dataPoints, seriesData[i].data);
|
8784 | return visuals.dataLabelUtils.drawDefaultLabelsForDataPointChart(dataPoints, context, layout, viewPort, isAnimator, animationDuration);
|
8785 | }
|
8786 | visuals.dataLabelUtils.cleanDataLabels(context);
|
8787 | }
|
8788 | function normalizeInfinityInScale(scale) {
|
8789 | for (var scaledDomain = scale.domain(), i = 0, len = scaledDomain.length; len > i; ++i) scaledDomain[i] === Number.POSITIVE_INFINITY ? scaledDomain[i] = Number.MAX_VALUE : scaledDomain[i] === Number.NEGATIVE_INFINITY && (scaledDomain[i] = -Number.MAX_VALUE);
|
8790 | scale.domain(scaledDomain);
|
8791 | }
|
8792 | function calculatePosition(d, axisOptions) {
|
8793 | var xScale = axisOptions.xScale, yScale = axisOptions.yScale, scaledY0 = yScale(0), scaledX0 = xScale(0);
|
8794 | switch (d.chartType) {
|
8795 | case visuals.ColumnChartType.stackedBar:
|
8796 | case visuals.ColumnChartType.hundredPercentStackedBar:
|
8797 | return scaledX0 + Math.abs(visuals.AxisHelper.diffScaled(xScale, 0, d.valueAbsolute)) + visuals.AxisHelper.diffScaled(xScale, d.position - d.valueAbsolute, 0) + visuals.dataLabelUtils.defaultColumnLabelMargin;
|
8798 |
|
8799 | case visuals.ColumnChartType.clusteredBar:
|
8800 | return scaledX0 + visuals.AxisHelper.diffScaled(xScale, Math.max(0, d.value), 0) + visuals.dataLabelUtils.defaultColumnLabelMargin;
|
8801 |
|
8802 | case visuals.ColumnChartType.stackedColumn:
|
8803 | case visuals.ColumnChartType.hundredPercentStackedColumn:
|
8804 | return scaledY0 + visuals.AxisHelper.diffScaled(yScale, d.position, 0) - visuals.dataLabelUtils.defaultColumnLabelMargin;
|
8805 |
|
8806 | case visuals.ColumnChartType.clusteredColumn:
|
8807 | return scaledY0 + visuals.AxisHelper.diffScaled(yScale, Math.max(0, d.value), 0) - visuals.dataLabelUtils.defaultColumnLabelMargin;
|
8808 | }
|
8809 | }
|
8810 | ColumnUtil.DimmedOpacity = .4, ColumnUtil.DefaultOpacity = 1, ColumnUtil.applyUserMinMax = applyUserMinMax,
|
8811 | ColumnUtil.transformDomain = transformDomain, ColumnUtil.getCategoryAxis = getCategoryAxis,
|
8812 | ColumnUtil.applyInteractivity = applyInteractivity, ColumnUtil.getFillOpacity = getFillOpacity,
|
8813 | ColumnUtil.getClosestColumnIndex = getClosestColumnIndex, ColumnUtil.setChosenColumnOpacity = setChosenColumnOpacity,
|
8814 | ColumnUtil.drawSeries = drawSeries, ColumnUtil.drawDefaultShapes = drawDefaultShapes,
|
8815 | ColumnUtil.drawDefaultLabels = drawDefaultLabels, ColumnUtil.normalizeInfinityInScale = normalizeInfinityInScale,
|
8816 | ColumnUtil.calculatePosition = calculatePosition;
|
8817 | }(ColumnUtil = visuals.ColumnUtil || (visuals.ColumnUtil = {}));
|
8818 | var ClusteredUtil;
|
8819 | !function(ClusteredUtil) {
|
8820 | function clearColumns(mainGraphicsContext, itemCS) {
|
8821 | var cols = mainGraphicsContext.selectAll(itemCS.selector).data([]);
|
8822 | cols.exit().remove();
|
8823 | }
|
8824 | ClusteredUtil.clearColumns = clearColumns;
|
8825 | }(ClusteredUtil = visuals.ClusteredUtil || (visuals.ClusteredUtil = {}));
|
8826 | var StackedUtil;
|
8827 | !function(StackedUtil) {
|
8828 | function getSize(scale, size, zeroVal) {
|
8829 | return void 0 === zeroVal && (zeroVal = 0), visuals.AxisHelper.diffScaled(scale, zeroVal, size);
|
8830 | }
|
8831 | function calcValueDomain(data, is100pct) {
|
8832 | var defaultNumberRange = {
|
8833 | min: 0,
|
8834 | max: 10
|
8835 | };
|
8836 | if (0 === data.length) return defaultNumberRange;
|
8837 | var min = d3.min(data, function(d) {
|
8838 | return d3.min(d.data, function(e) {
|
8839 | return e.position - e.valueAbsolute;
|
8840 | });
|
8841 | }), max = d3.max(data, function(d) {
|
8842 | return d3.max(d.data, function(e) {
|
8843 | return e.position;
|
8844 | });
|
8845 | });
|
8846 | return is100pct && (min = powerbi.Double.roundToPrecision(min, PctRoundingError),
|
8847 | max = powerbi.Double.roundToPrecision(max, PctRoundingError)), {
|
8848 | min: min,
|
8849 | max: max
|
8850 | };
|
8851 | }
|
8852 | function getStackedMultiplier(dataView, rowIdx, seriesCount, categoryCount, converterStrategy) {
|
8853 | for (var pos = 0, neg = 0, i = 0; seriesCount > i; i++) {
|
8854 | var value = converterStrategy.getValueBySeriesAndCategory(i, rowIdx);
|
8855 | value = visuals.AxisHelper.normalizeNonFiniteNumber(value), value > 0 ? pos += value : 0 > value && (neg -= value);
|
8856 | }
|
8857 | var absTotal = pos + neg;
|
8858 | return {
|
8859 | pos: pos ? pos / absTotal / pos : 1,
|
8860 | neg: neg ? neg / absTotal / neg : 1
|
8861 | };
|
8862 | }
|
8863 | function clearColumns(mainGraphicsContext, itemCS) {
|
8864 | var bars = mainGraphicsContext.selectAll(itemCS.selector).data([]);
|
8865 | bars.exit().remove();
|
8866 | }
|
8867 | var PctRoundingError = 1e-4;
|
8868 | StackedUtil.getSize = getSize, StackedUtil.calcValueDomain = calcValueDomain, StackedUtil.getStackedMultiplier = getStackedMultiplier,
|
8869 | StackedUtil.clearColumns = clearColumns;
|
8870 | }(StackedUtil = visuals.StackedUtil || (visuals.StackedUtil = {}));
|
8871 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
8872 | }(powerbi || (powerbi = {}));
|
8873 | }, function(module, exports) {
|
8874 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
8875 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
8876 | !function(powerbi) {
|
8877 | var visuals;
|
8878 | !function(visuals) {
|
8879 | var converterHelper, DataRoleHelper = powerbi.data.DataRoleHelper;
|
8880 | !function(converterHelper) {
|
8881 | function categoryIsAlsoSeriesRole(dataView, seriesRoleName, categoryRoleName) {
|
8882 | if (dataView.categories && dataView.categories.length > 0) {
|
8883 | var category = dataView.categories[0];
|
8884 | return category.source && DataRoleHelper.hasRole(category.source, seriesRoleName) && DataRoleHelper.hasRole(category.source, categoryRoleName);
|
8885 | }
|
8886 | return !1;
|
8887 | }
|
8888 | function getPivotedCategories(dataView, formatStringProp) {
|
8889 | if (dataView.categories && dataView.categories.length > 0) {
|
8890 | var category = dataView.categories[0], categoryValues = category.values;
|
8891 | return category.values.length > 0 ? {
|
8892 | categories: categoryValues,
|
8893 | categoryFormatter: visuals.valueFormatter.create({
|
8894 | format: visuals.valueFormatter.getFormatString(category.source, formatStringProp),
|
8895 | value: categoryValues[0],
|
8896 | value2: categoryValues[categoryValues.length - 1],
|
8897 | displayUnitSystemType: powerbi.DisplayUnitSystemType.Verbose
|
8898 | }),
|
8899 | categoryIdentities: category.identity,
|
8900 | categoryObjects: category.objects
|
8901 | } : {
|
8902 | categories: [],
|
8903 | categoryFormatter: {
|
8904 | format: visuals.valueFormatter.format
|
8905 | }
|
8906 | };
|
8907 | }
|
8908 | return defaultCategories();
|
8909 | }
|
8910 | function getSeriesName(source) {
|
8911 | return void 0 !== source.groupName ? source.groupName : source.queryName;
|
8912 | }
|
8913 | function getFormattedLegendLabel(source, values, formatStringProp) {
|
8914 | var sourceForFormat = source, nameForFormat = source.displayName;
|
8915 | return void 0 !== source.groupName && (sourceForFormat = values.source, nameForFormat = source.groupName),
|
8916 | visuals.valueFormatter.format(nameForFormat, visuals.valueFormatter.getFormatString(sourceForFormat, formatStringProp));
|
8917 | }
|
8918 | function defaultCategories() {
|
8919 | return {
|
8920 | categories: [ null ],
|
8921 | categoryFormatter: {
|
8922 | format: visuals.valueFormatter.format
|
8923 | }
|
8924 | };
|
8925 | }
|
8926 | function createAxesLabels(categoryAxisProperties, valueAxisProperties, category, values) {
|
8927 | var xAxisLabel = null, yAxisLabel = null;
|
8928 | if (categoryAxisProperties && category && category.displayName && (xAxisLabel = category.displayName),
|
8929 | valueAxisProperties) {
|
8930 | var valuesNames = [];
|
8931 | values && (valuesNames = values.map(function(v) {
|
8932 | return v ? v.displayName : "";
|
8933 | }).filter(function(value, index, self) {
|
8934 | return "" !== value && self.indexOf(value) === index;
|
8935 | }), yAxisLabel = visuals.valueFormatter.formatListAnd(valuesNames));
|
8936 | }
|
8937 | return {
|
8938 | xAxisLabel: xAxisLabel,
|
8939 | yAxisLabel: yAxisLabel
|
8940 | };
|
8941 | }
|
8942 | function isImageUrlColumn(column) {
|
8943 | var misc = getMiscellaneousTypeDescriptor(column);
|
8944 | return null != misc && misc.imageUrl === !0;
|
8945 | }
|
8946 | function isWebUrlColumn(column) {
|
8947 | var misc = getMiscellaneousTypeDescriptor(column);
|
8948 | return null != misc && misc.webUrl === !0;
|
8949 | }
|
8950 | function getMiscellaneousTypeDescriptor(column) {
|
8951 | return column && column.type && column.type.misc;
|
8952 | }
|
8953 | function hasImageUrlColumn(dataView) {
|
8954 | return dataView && dataView.metadata && !_.isEmpty(dataView.metadata.columns) ? _.any(dataView.metadata.columns, function(column) {
|
8955 | return isImageUrlColumn(column) === !0;
|
8956 | }) : !1;
|
8957 | }
|
8958 | function formatFromMetadataColumn(value, column, formatStringProp) {
|
8959 | var formatString = visuals.valueFormatter.getFormatString(column, formatStringProp, !0);
|
8960 | return !formatString && column && (formatString = column.format), visuals.valueFormatter.format(value, formatString);
|
8961 | }
|
8962 | converterHelper.categoryIsAlsoSeriesRole = categoryIsAlsoSeriesRole, converterHelper.getPivotedCategories = getPivotedCategories,
|
8963 | converterHelper.getSeriesName = getSeriesName, converterHelper.getFormattedLegendLabel = getFormattedLegendLabel,
|
8964 | converterHelper.createAxesLabels = createAxesLabels, converterHelper.isImageUrlColumn = isImageUrlColumn,
|
8965 | converterHelper.isWebUrlColumn = isWebUrlColumn, converterHelper.hasImageUrlColumn = hasImageUrlColumn,
|
8966 | converterHelper.formatFromMetadataColumn = formatFromMetadataColumn;
|
8967 | }(converterHelper = visuals.converterHelper || (visuals.converterHelper = {}));
|
8968 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
8969 | }(powerbi || (powerbi = {}));
|
8970 | }, function(module, exports) {
|
8971 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
8972 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
8973 | !function(powerbi) {
|
8974 | var visuals;
|
8975 | !function(visuals) {
|
8976 | var dataLabelUtils, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter, LabelStyle = visuals.labelStyle;
|
8977 | !function(dataLabelUtils) {
|
8978 | function updateLabelSettingsFromLabelsObject(labelsObj, labelSettings) {
|
8979 | labelsObj && (void 0 !== labelsObj.show && (labelSettings.show = labelsObj.show),
|
8980 | void 0 !== labelsObj.showSeries && (labelSettings.show = labelsObj.showSeries),
|
8981 | void 0 !== labelsObj.color && (labelSettings.labelColor = labelsObj.color.solid.color),
|
8982 | void 0 !== labelsObj.labelDisplayUnits && (labelSettings.displayUnits = labelsObj.labelDisplayUnits),
|
8983 | void 0 !== labelsObj.labelPrecision && (labelSettings.precision = labelsObj.labelPrecision >= 0 ? labelsObj.labelPrecision : dataLabelUtils.defaultLabelPrecision),
|
8984 | void 0 !== labelsObj.fontSize && (labelSettings.fontSize = labelsObj.fontSize),
|
8985 | void 0 !== labelsObj.showAll && (labelSettings.showLabelPerSeries = labelsObj.showAll),
|
8986 | void 0 !== labelsObj.labelStyle && (labelSettings.labelStyle = labelsObj.labelStyle),
|
8987 | labelsObj.labelPosition && (labelSettings.position = labelsObj.labelPosition));
|
8988 | }
|
8989 | function updateLineChartLabelSettingsFromLabelsObject(labelsObj, labelSettings) {
|
8990 | updateLabelSettingsFromLabelsObject(labelsObj, labelSettings), labelsObj && void 0 !== labelsObj.labelDensity && (labelSettings.labelDensity = labelsObj.labelDensity);
|
8991 | }
|
8992 | function getDefaultLabelSettings(show, labelColor, fontSize) {
|
8993 | return void 0 === show && (show = !1), {
|
8994 | show: show,
|
8995 | position: 0,
|
8996 | displayUnits: 0,
|
8997 | precision: dataLabelUtils.defaultLabelPrecision,
|
8998 | labelColor: labelColor || dataLabelUtils.defaultLabelColor,
|
8999 | fontSize: fontSize || dataLabelUtils.DefaultFontSizeInPt
|
9000 | };
|
9001 | }
|
9002 | function getDefaultCardLabelSettings(labelColor, categoryLabelColor, fontSize) {
|
9003 | var labelSettings = getDefaultLabelSettings(!0, labelColor, fontSize);
|
9004 | return labelSettings.showCategory = !0, labelSettings.categoryLabelColor = categoryLabelColor,
|
9005 | labelSettings;
|
9006 | }
|
9007 | function getDefaultTreemapLabelSettings() {
|
9008 | return {
|
9009 | show: !1,
|
9010 | displayUnits: 0,
|
9011 | precision: dataLabelUtils.defaultLabelPrecision,
|
9012 | labelColor: dataLabelUtils.defaultInsideLabelColor,
|
9013 | showCategory: !0
|
9014 | };
|
9015 | }
|
9016 | function getDefaultSunburstLabelSettings() {
|
9017 | return {
|
9018 | show: !1,
|
9019 | labelColor: dataLabelUtils.defaultInsideLabelColor,
|
9020 | fontSize: dataLabelUtils.DefaultFontSizeInPt,
|
9021 | displayUnits: 0,
|
9022 | precision: dataLabelUtils.defaultLabelPrecision,
|
9023 | showCategory: !0
|
9024 | };
|
9025 | }
|
9026 | function getDefaultColumnLabelSettings(isLabelPositionInside) {
|
9027 | var labelSettings = getDefaultLabelSettings(!1, void 0);
|
9028 | return labelSettings.position = null, labelSettings.labelColor = void 0, labelSettings;
|
9029 | }
|
9030 | function getDefaultPointLabelSettings() {
|
9031 | return {
|
9032 | show: !1,
|
9033 | position: 0,
|
9034 | displayUnits: 0,
|
9035 | precision: dataLabelUtils.defaultLabelPrecision,
|
9036 | labelColor: dataLabelUtils.defaultLabelColor,
|
9037 | fontSize: dataLabelUtils.DefaultFontSizeInPt
|
9038 | };
|
9039 | }
|
9040 | function getDefaultLineChartLabelSettings(isComboChart) {
|
9041 | return {
|
9042 | show: !1,
|
9043 | position: 0,
|
9044 | displayUnits: 0,
|
9045 | precision: dataLabelUtils.defaultLabelPrecision,
|
9046 | labelColor: dataLabelUtils.defaultLabelColor,
|
9047 | fontSize: dataLabelUtils.DefaultFontSizeInPt,
|
9048 | labelDensity: dataLabelUtils.defaultLabelDensity
|
9049 | };
|
9050 | }
|
9051 | function getDefaultMapLabelSettings() {
|
9052 | return {
|
9053 | show: !1,
|
9054 | showCategory: !1,
|
9055 | position: 0,
|
9056 | displayUnits: 0,
|
9057 | precision: dataLabelUtils.defaultLabelPrecision,
|
9058 | labelColor: dataLabelUtils.defaultInsideLabelColor,
|
9059 | fontSize: dataLabelUtils.DefaultFontSizeInPt
|
9060 | };
|
9061 | }
|
9062 | function getDefaultDonutLabelSettings() {
|
9063 | var labelSettings = dataLabelUtils.getDefaultLabelSettings(!0, dataLabelUtils.defaultLabelColor, dataLabelUtils.DefaultFontSizeInPt);
|
9064 | return labelSettings.labelStyle = LabelStyle.category, labelSettings;
|
9065 | }
|
9066 | function getDefaultGaugeLabelSettings() {
|
9067 | return {
|
9068 | show: !0,
|
9069 | displayUnits: 0,
|
9070 | precision: dataLabelUtils.defaultLabelPrecision,
|
9071 | labelColor: null,
|
9072 | position: null,
|
9073 | fontSize: dataLabelUtils.minLabelFontSize
|
9074 | };
|
9075 | }
|
9076 | function getDefaultKpiLabelSettings() {
|
9077 | return {
|
9078 | show: !1,
|
9079 | displayUnits: 0,
|
9080 | precision: dataLabelUtils.defaultLabelPrecision,
|
9081 | labelColor: dataLabelUtils.defaultLabelColor,
|
9082 | position: null,
|
9083 | showCategory: !0
|
9084 | };
|
9085 | }
|
9086 | function getLabelPrecision(precision, format) {
|
9087 | if (precision !== dataLabelUtils.defaultLabelPrecision) return precision;
|
9088 | if ("g" !== format && "G" !== format) {
|
9089 | if (format) {
|
9090 | var positiveFormat = powerbi.NumberFormat.getComponents(format).positive, formatMetadata = powerbi.NumberFormat.getCustomFormatMetadata(positiveFormat, !0);
|
9091 | if (formatMetadata.hasDots) return formatMetadata.precision;
|
9092 | }
|
9093 | return defaultCountLabelPrecision;
|
9094 | }
|
9095 | }
|
9096 | function drawDefaultLabelsForDataPointChart(data, context, layout, viewport, isAnimator, animationDuration, hasSelection) {
|
9097 | void 0 === isAnimator && (isAnimator = !1);
|
9098 | var dataLabelManager = new powerbi.DataLabelManager(), filteredData = dataLabelManager.hideCollidedLabels(viewport, data, layout), hasAnimation = isAnimator && !!animationDuration, labels = selectLabels(filteredData, context, !1, hasAnimation);
|
9099 | return labels ? (hasAnimation ? (labels.text(function(d) {
|
9100 | return d.labeltext;
|
9101 | }).transition().duration(animationDuration).style(layout.style).style("opacity", hasSelection ? function(d) {
|
9102 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
9103 | } : 1).attr({
|
9104 | x: function(d) {
|
9105 | return d.labelX;
|
9106 | },
|
9107 | y: function(d) {
|
9108 | return d.labelY;
|
9109 | }
|
9110 | }), labels.exit().transition().duration(animationDuration).style("opacity", 0).remove()) : (labels.attr({
|
9111 | x: function(d) {
|
9112 | return d.labelX;
|
9113 | },
|
9114 | y: function(d) {
|
9115 | return d.labelY;
|
9116 | }
|
9117 | }).text(function(d) {
|
9118 | return d.labeltext;
|
9119 | }).style(layout.style), labels.exit().remove()), labels) : void 0;
|
9120 | }
|
9121 | function selectLabels(filteredData, context, isDonut, forAnimation) {
|
9122 | if (void 0 === isDonut && (isDonut = !1), void 0 === forAnimation && (forAnimation = !1),
|
9123 | 0 === filteredData.length) return cleanDataLabels(context, !0), null;
|
9124 | context.select(labelGraphicsContextClass.selector).empty() && context.append("g").classed(labelGraphicsContextClass["class"], !0);
|
9125 | var hasKey = null != filteredData[0].key, hasDataPointIdentity = null != filteredData[0].identity, getIdentifier = hasKey ? function(d) {
|
9126 | return d.key;
|
9127 | } : hasDataPointIdentity ? function(d) {
|
9128 | return d.identity.getKey();
|
9129 | } : void 0, labels = isDonut ? context.select(labelGraphicsContextClass.selector).selectAll(labelsClass.selector).data(filteredData, function(d) {
|
9130 | return d.data.identity.getKey();
|
9131 | }) : null != getIdentifier ? context.select(labelGraphicsContextClass.selector).selectAll(labelsClass.selector).data(filteredData, getIdentifier) : context.select(labelGraphicsContextClass.selector).selectAll(labelsClass.selector).data(filteredData), newLabels = labels.enter().append("text").classed(labelsClass["class"], !0);
|
9132 | return forAnimation && newLabels.style("opacity", 0), labels;
|
9133 | }
|
9134 | function cleanDataLabels(context, removeLines) {
|
9135 | void 0 === removeLines && (removeLines = !1);
|
9136 | var empty = [], labels = context.selectAll(labelsClass.selector).data(empty);
|
9137 | if (labels.exit().remove(), context.selectAll(labelGraphicsContextClass.selector).remove(),
|
9138 | removeLines) {
|
9139 | var lines = context.selectAll(lineClass.selector).data(empty);
|
9140 | lines.exit().remove(), context.selectAll(linesGraphicsContextClass.selector).remove();
|
9141 | }
|
9142 | }
|
9143 | function setHighlightedLabelsOpacity(context, hasSelection, hasHighlights) {
|
9144 | context.selectAll(labelsClass.selector).style("fill-opacity", function(d) {
|
9145 | var labelOpacity = visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, !d.highlight && hasSelection, !d.selected && hasHighlights) < 1 ? 0 : 1;
|
9146 | return labelOpacity;
|
9147 | });
|
9148 | }
|
9149 | function getLabelFormattedText(options) {
|
9150 | var properties = {
|
9151 | text: options.formatter ? options.formatter.format(options.label) : powerbi.formattingService.formatValue(options.label, options.format),
|
9152 | fontFamily: dataLabelUtils.LabelTextProperties.fontFamily,
|
9153 | fontSize: PixelConverter.fromPoint(options.fontSize),
|
9154 | fontWeight: dataLabelUtils.LabelTextProperties.fontWeight
|
9155 | };
|
9156 | return powerbi.TextMeasurementService.getTailoredTextOrDefault(properties, options.maxWidth ? options.maxWidth : dataLabelUtils.maxLabelWidth);
|
9157 | }
|
9158 | function getLabelLayoutXYForWaterfall(xAxisProperties, categoryWidth, yAxisProperties, dataDomain) {
|
9159 | return {
|
9160 | x: function(d) {
|
9161 | return xAxisProperties.scale(d.categoryIndex) + categoryWidth / 2;
|
9162 | },
|
9163 | y: function(d) {
|
9164 | return getWaterfallLabelYPosition(yAxisProperties.scale, d, dataDomain);
|
9165 | }
|
9166 | };
|
9167 | }
|
9168 | function getWaterfallLabelYPosition(scale, d, dataDomain) {
|
9169 | var yValue = scale(0) - scale(Math.abs(d.value)), yPos = scale(d.position), scaleMinDomain = scale(dataDomain[0]), endPosition = scale(d.position + d.value);
|
9170 | if (d.value < 0) {
|
9171 | var properties = {
|
9172 | text: d.labeltext,
|
9173 | fontFamily: dataLabelUtils.LabelTextProperties.fontFamily,
|
9174 | fontSize: dataLabelUtils.LabelTextProperties.fontSize,
|
9175 | fontWeight: dataLabelUtils.LabelTextProperties.fontWeight
|
9176 | }, outsideBelowPosition = yPos + yValue + powerbi.TextMeasurementService.estimateSvgTextHeight(properties);
|
9177 | if (scaleMinDomain > outsideBelowPosition) return outsideBelowPosition;
|
9178 | } else {
|
9179 | var outsideAbovePosition = yPos - yValue - dataLabelUtils.labelMargin;
|
9180 | if (outsideAbovePosition > 0) return outsideAbovePosition;
|
9181 | }
|
9182 | return d.isLabelInside = !0, getWaterfallInsideLabelYPosition(yPos, endPosition, scaleMinDomain);
|
9183 | }
|
9184 | function getWaterfallInsideLabelYPosition(startPosition, endPosition, scaleMinDomain) {
|
9185 | return startPosition = 0 > startPosition ? 0 : startPosition, startPosition = startPosition > scaleMinDomain ? scaleMinDomain : startPosition,
|
9186 | endPosition = 0 > endPosition ? 0 : endPosition, endPosition = endPosition > scaleMinDomain ? scaleMinDomain : endPosition,
|
9187 | Math.abs(endPosition - startPosition) / 2 + Math.min(startPosition, endPosition);
|
9188 | }
|
9189 | function doesDataLabelFitInShape(d, yAxisProperties, layout) {
|
9190 | if (null == d || null === d.value) return !1;
|
9191 | var properties = {
|
9192 | text: layout.labelText(d),
|
9193 | fontFamily: dataLabelUtils.LabelTextProperties.fontFamily,
|
9194 | fontSize: dataLabelUtils.LabelTextProperties.fontSize,
|
9195 | fontWeight: dataLabelUtils.LabelTextProperties.fontWeight
|
9196 | }, outsidePosition = visuals.WaterfallChart.getRectTop(yAxisProperties.scale, d.position, d.value) - dataLabelUtils.labelMargin;
|
9197 | if (outsidePosition > 0) return !0;
|
9198 | var textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties), shapeWidth = layout.categoryWidth, shapeHeight = Math.abs(visuals.AxisHelper.diffScaled(yAxisProperties.scale, Math.max(0, Math.abs(d.value)), 0));
|
9199 | return !(textWidth > shapeWidth || textHeight > shapeHeight);
|
9200 | }
|
9201 | function getMapLabelLayout(labelSettings) {
|
9202 | return {
|
9203 | labelText: function(d) {
|
9204 | return getLabelFormattedText({
|
9205 | label: d.labeltext,
|
9206 | fontSize: labelSettings.fontSize
|
9207 | });
|
9208 | },
|
9209 | labelLayout: {
|
9210 | x: function(d) {
|
9211 | return d.x;
|
9212 | },
|
9213 | y: function(d) {
|
9214 | var margin = d.radius + dataLabelUtils.labelMargin;
|
9215 | return 0 === labelSettings.position ? d.y - margin : d.y + margin;
|
9216 | }
|
9217 | },
|
9218 | filter: function(d) {
|
9219 | return null != d && null != d.labeltext;
|
9220 | },
|
9221 | style: {
|
9222 | fill: function(d) {
|
9223 | return d.labelFill;
|
9224 | },
|
9225 | "font-size": PixelConverter.fromPoint(labelSettings.fontSize)
|
9226 | }
|
9227 | };
|
9228 | }
|
9229 | function getColumnChartLabelLayout(data, labelLayoutXY, isColumn, isHundredPercent, axisFormatter, axisOptions, interactivityService, visualWidth) {
|
9230 | var formatOverride = isHundredPercent ? dataLabelUtils.hundredPercentFormat : null, formattersCache = createColumnFormatterCacheManager(), hasSelection = interactivityService ? interactivityService.hasSelection() : !1;
|
9231 | return {
|
9232 | labelText: function(d) {
|
9233 | var formatString = null != formatOverride ? formatOverride : d.labelFormatString, value2 = getDisplayUnitValueFromAxisFormatter(axisFormatter, d.labelSettings), formatter = formattersCache.getOrCreate(formatString, d.labelSettings, value2);
|
9234 | return getLabelFormattedText({
|
9235 | label: formatter.format(d.value),
|
9236 | maxWidth: dataLabelUtils.maxLabelWidth
|
9237 | });
|
9238 | },
|
9239 | labelLayout: labelLayoutXY,
|
9240 | filter: function(d) {
|
9241 | return dataLabelUtils.getColumnChartLabelFilter(d, hasSelection, data.hasHighlights, axisOptions, visualWidth);
|
9242 | },
|
9243 | style: {
|
9244 | fill: function(d) {
|
9245 | return d.labelFill;
|
9246 | },
|
9247 | "text-anchor": isColumn ? "middle" : "start"
|
9248 | }
|
9249 | };
|
9250 | }
|
9251 | function validateLabelsSize(d, axisOptions, visualWidth) {
|
9252 | var shapeWidth, shapeHeight, xScale = axisOptions.xScale, yScale = axisOptions.yScale, columnWidth = axisOptions.columnWidth, properties = {
|
9253 | text: d.labeltext,
|
9254 | fontFamily: dataLabelUtils.LabelTextProperties.fontFamily,
|
9255 | fontSize: dataLabelUtils.LabelTextProperties.fontSize,
|
9256 | fontWeight: dataLabelUtils.LabelTextProperties.fontWeight
|
9257 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties), inside = !1, outsidePosition = visuals.ColumnUtil.calculatePosition(d, axisOptions);
|
9258 | switch (d.chartType) {
|
9259 | case visuals.ColumnChartType.stackedBar:
|
9260 | case visuals.ColumnChartType.hundredPercentStackedBar:
|
9261 | (!d.lastSeries || outsidePosition + textWidth > visualWidth || d.chartType === visuals.ColumnChartType.hundredPercentStackedBar) && (shapeWidth = -visuals.StackedUtil.getSize(xScale, d.valueAbsolute),
|
9262 | shapeHeight = columnWidth, inside = !0);
|
9263 | break;
|
9264 |
|
9265 | case visuals.ColumnChartType.clusteredBar:
|
9266 | outsidePosition + textWidth > visualWidth && (shapeWidth = Math.abs(visuals.AxisHelper.diffScaled(xScale, 0, d.value)),
|
9267 | shapeHeight = columnWidth, inside = !0);
|
9268 | break;
|
9269 |
|
9270 | case visuals.ColumnChartType.stackedColumn:
|
9271 | case visuals.ColumnChartType.hundredPercentStackedColumn:
|
9272 | (!d.lastSeries || 0 >= outsidePosition || d.chartType === visuals.ColumnChartType.hundredPercentStackedColumn) && (shapeWidth = columnWidth,
|
9273 | shapeHeight = visuals.StackedUtil.getSize(yScale, d.valueAbsolute), inside = !0);
|
9274 | break;
|
9275 |
|
9276 | case visuals.ColumnChartType.clusteredColumn:
|
9277 | 0 >= outsidePosition && (shapeWidth = columnWidth, shapeHeight = Math.abs(visuals.AxisHelper.diffScaled(yScale, 0, d.value)),
|
9278 | inside = !0);
|
9279 | break;
|
9280 |
|
9281 | default:
|
9282 | return !0;
|
9283 | }
|
9284 | return !inside || !(textWidth > shapeWidth || textHeight > shapeHeight);
|
9285 | }
|
9286 | function getColumnChartLabelFilter(d, hasSelection, hasHighlights, axisOptions, visualWidth) {
|
9287 | var shapesOpacity = hasSelection ? visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, !d.highlight && hasSelection, !d.selected && hasHighlights) : visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, hasHighlights);
|
9288 | return null != d && null != d.value && validateLabelsSize(d, axisOptions, visualWidth) && 1 === shapesOpacity;
|
9289 | }
|
9290 | function getScatterChartLabelLayout(xScale, yScale, labelSettings, viewport, sizeRange) {
|
9291 | return {
|
9292 | labelText: function(d) {
|
9293 | return getLabelFormattedText({
|
9294 | label: d.formattedCategory.getValue(),
|
9295 | maxWidth: 2 * dataLabelUtils.maxLabelWidth
|
9296 | });
|
9297 | },
|
9298 | labelLayout: {
|
9299 | x: function(d) {
|
9300 | return xScale(d.x);
|
9301 | },
|
9302 | y: function(d) {
|
9303 | var margin = visuals.ScatterChart.getBubbleRadius(d.radius, sizeRange, viewport) + dataLabelUtils.labelMargin;
|
9304 | return 0 === labelSettings.position ? yScale(d.y) - margin : yScale(d.y) + margin;
|
9305 | }
|
9306 | },
|
9307 | filter: function(d) {
|
9308 | return null != d && null != d.formattedCategory.getValue();
|
9309 | },
|
9310 | style: {
|
9311 | fill: function(d) {
|
9312 | return d.labelFill;
|
9313 | }
|
9314 | }
|
9315 | };
|
9316 | }
|
9317 | function getLineChartLabelLayout(xScale, yScale, labelSettings, isScalar, axisFormatter) {
|
9318 | var formattersCache = createColumnFormatterCacheManager();
|
9319 | return {
|
9320 | labelText: function(d) {
|
9321 | var value2 = getDisplayUnitValueFromAxisFormatter(axisFormatter, d.labelSettings), formatter = formattersCache.getOrCreate(d.labelFormatString, d.labelSettings, value2);
|
9322 | return getLabelFormattedText({
|
9323 | label: formatter.format(d.value)
|
9324 | });
|
9325 | },
|
9326 | labelLayout: {
|
9327 | x: function(d) {
|
9328 | return xScale(isScalar ? d.categoryValue : d.categoryIndex);
|
9329 | },
|
9330 | y: function(d) {
|
9331 | return 0 === labelSettings.position ? yScale(d.value) - dataLabelUtils.labelMargin : yScale(d.value) + dataLabelUtils.labelMargin;
|
9332 | }
|
9333 | },
|
9334 | filter: function(d) {
|
9335 | return null != d && null != d.value;
|
9336 | },
|
9337 | style: {
|
9338 | fill: function(d) {
|
9339 | return d.labelFill;
|
9340 | },
|
9341 | "font-size": function(d) {
|
9342 | return PixelConverter.fromPoint(d.labelSettings.fontSize);
|
9343 | }
|
9344 | }
|
9345 | };
|
9346 | }
|
9347 | function enumerateDataLabels(options) {
|
9348 | if (options.dataLabelsSettings) {
|
9349 | var instance = {
|
9350 | objectName: "labels",
|
9351 | selector: options.selector,
|
9352 | properties: {}
|
9353 | };
|
9354 | if (options.show && options.selector ? instance.properties.showSeries = options.dataLabelsSettings.show : options.show && (instance.properties.show = options.dataLabelsSettings.show),
|
9355 | instance.properties.color = options.dataLabelsSettings.labelColor || dataLabelUtils.defaultLabelColor,
|
9356 | options.displayUnits && (instance.properties.labelDisplayUnits = options.dataLabelsSettings.displayUnits),
|
9357 | options.precision) {
|
9358 | var precision = options.dataLabelsSettings.precision;
|
9359 | instance.properties.labelPrecision = precision === dataLabelUtils.defaultLabelPrecision ? null : precision;
|
9360 | }
|
9361 | if (options.position && (instance.properties.labelPosition = options.dataLabelsSettings.position,
|
9362 | options.positionObject && (instance.validValues = {
|
9363 | labelPosition: options.positionObject
|
9364 | })), options.labelStyle && (instance.properties.labelStyle = options.dataLabelsSettings.labelStyle),
|
9365 | options.fontSize && (instance.properties.fontSize = options.dataLabelsSettings.fontSize),
|
9366 | options.labelDensity) {
|
9367 | var lineChartSettings = options.dataLabelsSettings;
|
9368 | lineChartSettings && (instance.properties.labelDensity = lineChartSettings.labelDensity);
|
9369 | }
|
9370 | return options.showAll && (instance.properties.showAll = options.dataLabelsSettings.showLabelPerSeries),
|
9371 | options.enumeration.pushInstance(instance);
|
9372 | }
|
9373 | }
|
9374 | function enumerateCategoryLabels(enumeration, dataLabelsSettings, withFill, isShowCategory, fontSize) {
|
9375 | void 0 === isShowCategory && (isShowCategory = !1);
|
9376 | var labelSettings = dataLabelsSettings ? dataLabelsSettings : getDefaultPointLabelSettings(), instance = {
|
9377 | objectName: "categoryLabels",
|
9378 | selector: null,
|
9379 | properties: {
|
9380 | show: isShowCategory ? labelSettings.showCategory : labelSettings.show,
|
9381 | fontSize: dataLabelsSettings ? dataLabelsSettings.fontSize : dataLabelUtils.DefaultFontSizeInPt
|
9382 | }
|
9383 | };
|
9384 | withFill && (instance.properties.color = labelSettings.categoryLabelColor ? labelSettings.categoryLabelColor : labelSettings.labelColor),
|
9385 | fontSize && (instance.properties.fontSize = fontSize), enumeration.pushInstance(instance);
|
9386 | }
|
9387 | function getDisplayUnitValueFromAxisFormatter(axisFormatter, labelSettings) {
|
9388 | return axisFormatter && axisFormatter.displayUnit && 0 === labelSettings.displayUnits ? axisFormatter.displayUnit.value : null;
|
9389 | }
|
9390 | function createColumnFormatterCacheManager() {
|
9391 | return {
|
9392 | cache: {
|
9393 | defaultFormatter: null
|
9394 | },
|
9395 | getOrCreate: function(formatString, labelSetting, value2) {
|
9396 | if (formatString) {
|
9397 | var cacheKeyObject = {
|
9398 | formatString: formatString,
|
9399 | displayUnits: labelSetting.displayUnits,
|
9400 | precision: getLabelPrecision(labelSetting.precision, formatString),
|
9401 | value2: value2
|
9402 | }, cacheKey = JSON.stringify(cacheKeyObject);
|
9403 | return this.cache[cacheKey] || (this.cache[cacheKey] = visuals.valueFormatter.create(getOptionsForLabelFormatter(labelSetting, formatString, value2, cacheKeyObject.precision))),
|
9404 | this.cache[cacheKey];
|
9405 | }
|
9406 | return this.cache.defaultFormatter || (this.cache.defaultFormatter = visuals.valueFormatter.create(getOptionsForLabelFormatter(labelSetting, formatString, value2, labelSetting.precision))),
|
9407 | this.cache.defaultFormatter;
|
9408 | }
|
9409 | };
|
9410 | }
|
9411 | function getOptionsForLabelFormatter(labelSetting, formatString, value2, precision) {
|
9412 | return {
|
9413 | displayUnitSystemType: powerbi.DisplayUnitSystemType.DataLabels,
|
9414 | format: formatString,
|
9415 | precision: precision,
|
9416 | value: labelSetting.displayUnits,
|
9417 | value2: value2,
|
9418 | allowFormatBeautification: !0
|
9419 | };
|
9420 | }
|
9421 | function isTextWidthOverflows(textWidth, maxTextWidth) {
|
9422 | return textWidth > maxTextWidth;
|
9423 | }
|
9424 | function isTextHeightOverflows(textHeight, innerChordLength) {
|
9425 | return textHeight > innerChordLength;
|
9426 | }
|
9427 | dataLabelUtils.minLabelFontSize = 8, dataLabelUtils.labelMargin = 8, dataLabelUtils.maxLabelWidth = 50,
|
9428 | dataLabelUtils.defaultColumnLabelMargin = 5, dataLabelUtils.defaultColumnHalfLabelHeight = 4,
|
9429 | dataLabelUtils.defaultLabelDensity = "50", dataLabelUtils.DefaultDy = "-0.15em",
|
9430 | dataLabelUtils.DefaultFontSizeInPt = 9, dataLabelUtils.StandardFontFamily = visuals.Font.Family.regular.css,
|
9431 | dataLabelUtils.LabelTextProperties = {
|
9432 | fontFamily: visuals.Font.Family.regularSecondary.css,
|
9433 | fontSize: PixelConverter.fromPoint(dataLabelUtils.DefaultFontSizeInPt),
|
9434 | fontWeight: "normal"
|
9435 | }, dataLabelUtils.defaultLabelColor = "#777777", dataLabelUtils.defaultInsideLabelColor = "#ffffff",
|
9436 | dataLabelUtils.hundredPercentFormat = "0.00 %;-0.00 %;0.00 %", dataLabelUtils.defaultLabelPrecision = void 0;
|
9437 | var defaultCountLabelPrecision = 0, labelGraphicsContextClass = createClassAndSelector("labels"), linesGraphicsContextClass = createClassAndSelector("lines"), labelsClass = createClassAndSelector("data-labels"), lineClass = createClassAndSelector("line-label");
|
9438 | dataLabelUtils.updateLabelSettingsFromLabelsObject = updateLabelSettingsFromLabelsObject,
|
9439 | dataLabelUtils.updateLineChartLabelSettingsFromLabelsObject = updateLineChartLabelSettingsFromLabelsObject,
|
9440 | dataLabelUtils.getDefaultLabelSettings = getDefaultLabelSettings, dataLabelUtils.getDefaultCardLabelSettings = getDefaultCardLabelSettings,
|
9441 | dataLabelUtils.getDefaultTreemapLabelSettings = getDefaultTreemapLabelSettings,
|
9442 | dataLabelUtils.getDefaultSunburstLabelSettings = getDefaultSunburstLabelSettings,
|
9443 | dataLabelUtils.getDefaultColumnLabelSettings = getDefaultColumnLabelSettings, dataLabelUtils.getDefaultPointLabelSettings = getDefaultPointLabelSettings,
|
9444 | dataLabelUtils.getDefaultLineChartLabelSettings = getDefaultLineChartLabelSettings,
|
9445 | dataLabelUtils.getDefaultMapLabelSettings = getDefaultMapLabelSettings, dataLabelUtils.getDefaultDonutLabelSettings = getDefaultDonutLabelSettings,
|
9446 | dataLabelUtils.getDefaultGaugeLabelSettings = getDefaultGaugeLabelSettings, dataLabelUtils.getDefaultKpiLabelSettings = getDefaultKpiLabelSettings,
|
9447 | dataLabelUtils.getLabelPrecision = getLabelPrecision, dataLabelUtils.drawDefaultLabelsForDataPointChart = drawDefaultLabelsForDataPointChart,
|
9448 | dataLabelUtils.cleanDataLabels = cleanDataLabels, dataLabelUtils.setHighlightedLabelsOpacity = setHighlightedLabelsOpacity,
|
9449 | dataLabelUtils.getLabelFormattedText = getLabelFormattedText, dataLabelUtils.getLabelLayoutXYForWaterfall = getLabelLayoutXYForWaterfall,
|
9450 | dataLabelUtils.doesDataLabelFitInShape = doesDataLabelFitInShape, dataLabelUtils.getMapLabelLayout = getMapLabelLayout,
|
9451 | dataLabelUtils.getColumnChartLabelLayout = getColumnChartLabelLayout, dataLabelUtils.getColumnChartLabelFilter = getColumnChartLabelFilter,
|
9452 | dataLabelUtils.getScatterChartLabelLayout = getScatterChartLabelLayout, dataLabelUtils.getLineChartLabelLayout = getLineChartLabelLayout,
|
9453 | dataLabelUtils.enumerateDataLabels = enumerateDataLabels, dataLabelUtils.enumerateCategoryLabels = enumerateCategoryLabels,
|
9454 | dataLabelUtils.createColumnFormatterCacheManager = createColumnFormatterCacheManager,
|
9455 | dataLabelUtils.getOptionsForLabelFormatter = getOptionsForLabelFormatter, dataLabelUtils.isTextWidthOverflows = isTextWidthOverflows,
|
9456 | dataLabelUtils.isTextHeightOverflows = isTextHeightOverflows;
|
9457 | }(dataLabelUtils = visuals.dataLabelUtils || (visuals.dataLabelUtils = {}));
|
9458 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
9459 | }(powerbi || (powerbi = {}));
|
9460 | }, function(module, exports) {
|
9461 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
9462 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
9463 | !function(powerbi) {
|
9464 | var visuals;
|
9465 | !function(visuals) {
|
9466 | var DonutLabelUtils;
|
9467 | !function(DonutLabelUtils) {
|
9468 | function getLabelLeaderLineForDonutChart(donutArcDescriptor, donutProperties, parentPoint, sliceArc) {
|
9469 | void 0 === sliceArc && (sliceArc = 0);
|
9470 | var textPoint, midPoint, chartPoint, innerLinePointMultiplier = 2.05;
|
9471 | if (sliceArc) {
|
9472 | var arc = sliceArc, outerRadius = donutProperties.radius * donutProperties.outerArcRadiusRatio, innerRadius = donutProperties.radius / 2 * donutProperties.innerArcRadiusRatio;
|
9473 | midPoint = [ Math.cos(arc) * outerRadius, Math.sin(arc) * outerRadius ], chartPoint = [ Math.cos(arc) * innerRadius, Math.sin(arc) * innerRadius ];
|
9474 | } else midPoint = donutProperties.outerArc.centroid(donutArcDescriptor), chartPoint = donutProperties.arc.centroid(donutArcDescriptor);
|
9475 | var textPointX = parentPoint.x, lineMargin = visuals.NewDataLabelUtils.maxLabelOffset / 2;
|
9476 | return textPointX += 0 > textPointX ? -lineMargin : lineMargin, textPoint = [ textPointX, parentPoint.y ],
|
9477 | chartPoint[0] *= innerLinePointMultiplier, chartPoint[1] *= innerLinePointMultiplier,
|
9478 | [ chartPoint, midPoint, textPoint ];
|
9479 | }
|
9480 | function getLabelLeaderLinesSizeForDonutChart(leaderLinePoints) {
|
9481 | if (leaderLinePoints && leaderLinePoints.length > 2) {
|
9482 | var diagonalLineSize = {
|
9483 | width: Math.abs(leaderLinePoints[1][0] - leaderLinePoints[0][0]),
|
9484 | height: Math.abs(leaderLinePoints[1][1] - leaderLinePoints[0][1])
|
9485 | }, horizontalLineSize = {
|
9486 | width: Math.abs(leaderLinePoints[2][0] - leaderLinePoints[1][0]),
|
9487 | height: DonutLabelUtils.LineStrokeWidth
|
9488 | };
|
9489 | return [ diagonalLineSize, horizontalLineSize ];
|
9490 | }
|
9491 | return null;
|
9492 | }
|
9493 | function getXPositionForDonutLabel(textPointX) {
|
9494 | var margin = 0 > textPointX ? -visuals.NewDataLabelUtils.maxLabelOffset : visuals.NewDataLabelUtils.maxLabelOffset;
|
9495 | return textPointX += margin;
|
9496 | }
|
9497 | function getSpaceAvailableForDonutLabels(labelXPos, viewport) {
|
9498 | return viewport.width / 2 - Math.abs(labelXPos) - visuals.NewDataLabelUtils.maxLabelOffset;
|
9499 | }
|
9500 | DonutLabelUtils.LineStrokeWidth = 1, DonutLabelUtils.DiagonalLineIndex = 0, DonutLabelUtils.HorizontalLineIndex = 1,
|
9501 | DonutLabelUtils.getLabelLeaderLineForDonutChart = getLabelLeaderLineForDonutChart,
|
9502 | DonutLabelUtils.getLabelLeaderLinesSizeForDonutChart = getLabelLeaderLinesSizeForDonutChart,
|
9503 | DonutLabelUtils.getXPositionForDonutLabel = getXPositionForDonutLabel, DonutLabelUtils.getSpaceAvailableForDonutLabels = getSpaceAvailableForDonutLabels;
|
9504 | }(DonutLabelUtils = visuals.DonutLabelUtils || (visuals.DonutLabelUtils = {}));
|
9505 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
9506 | }(powerbi || (powerbi = {}));
|
9507 | }, function(module, exports) {
|
9508 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
9509 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
9510 | !function(powerbi) {
|
9511 | var visuals;
|
9512 | !function(visuals) {
|
9513 | var NewDataLabelUtils, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter;
|
9514 | !function(NewDataLabelUtils) {
|
9515 | function drawDefaultLabels(context, dataLabels, numeric, twoRows, hasTooltip) {
|
9516 | void 0 === numeric && (numeric = !1), void 0 === twoRows && (twoRows = !1), void 0 === hasTooltip && (hasTooltip = !1);
|
9517 | var filteredDataLabels = _.filter(dataLabels, function(d) {
|
9518 | return d.isVisible;
|
9519 | }), labels = context.selectAll(labelsClass.selector).data(filteredDataLabels, labelKeyFunction);
|
9520 | labels.enter().append("text").classed(labelsClass["class"], !0);
|
9521 | var labelAttr = {
|
9522 | x: function(d) {
|
9523 | return d.boundingBox.left + d.boundingBox.width / 2;
|
9524 | },
|
9525 | y: function(d) {
|
9526 | return d.hasBackground ? d.boundingBox.top + d.boundingBox.height - NewDataLabelUtils.verticalLabelBackgroundPadding : d.boundingBox.top + d.boundingBox.height;
|
9527 | },
|
9528 | dy: "-0.15em"
|
9529 | };
|
9530 | numeric && (labelAttr.dy = void 0), labels.interrupt().text(function(d) {
|
9531 | return d.text;
|
9532 | }).attr(labelAttr).style({
|
9533 | fill: function(d) {
|
9534 | return d.fill;
|
9535 | },
|
9536 | "font-size": function(d) {
|
9537 | return PixelConverter.fromPoint(d.fontSize || NewDataLabelUtils.DefaultLabelFontSizeInPt);
|
9538 | },
|
9539 | "text-anchor": function(d) {
|
9540 | return d.textAnchor;
|
9541 | }
|
9542 | }), labels.exit().remove();
|
9543 | var filteredCategoryLabels = _.filter(twoRows ? dataLabels : [], function(d) {
|
9544 | return d.isVisible && !_.isEmpty(d.secondRowText);
|
9545 | }), secondLineLabels = context.selectAll(secondLineLabelClass.selector).data(filteredCategoryLabels, function(d, index) {
|
9546 | return d.identity ? d.identity.getKeyWithoutHighlight() : index;
|
9547 | });
|
9548 | return secondLineLabels.enter().append("text").classed(secondLineLabelClass["class"], !0),
|
9549 | labelAttr = {
|
9550 | x: function(d) {
|
9551 | return d.boundingBox.left + d.boundingBox.width / 2;
|
9552 | },
|
9553 | y: function(d) {
|
9554 | var boundingBoxHeight = void 0 !== d.text ? d.boundingBox.height / 2 : d.boundingBox.height;
|
9555 | return d.hasBackground ? d.boundingBox.top + boundingBoxHeight - NewDataLabelUtils.verticalLabelBackgroundPadding : d.boundingBox.top + boundingBoxHeight;
|
9556 | },
|
9557 | dy: "-0.15em"
|
9558 | }, numeric && (labelAttr.dy = void 0), secondLineLabels.interrupt().text(function(d) {
|
9559 | return d.secondRowText;
|
9560 | }).attr(labelAttr).style({
|
9561 | fill: function(d) {
|
9562 | return d.fill;
|
9563 | },
|
9564 | "font-size": function(d) {
|
9565 | return PixelConverter.fromPoint(d.fontSize || NewDataLabelUtils.DefaultLabelFontSizeInPt);
|
9566 | },
|
9567 | "text-anchor": function(d) {
|
9568 | return d.textAnchor;
|
9569 | }
|
9570 | }), secondLineLabels.exit().remove(), hasTooltip && (labels.append("title").text(function(d) {
|
9571 | return d.tooltip;
|
9572 | }), secondLineLabels.append("title").text(function(d) {
|
9573 | return d.tooltip;
|
9574 | }), labels.style("pointer-events", "all"), secondLineLabels.style("pointer-events", "all")),
|
9575 | labels;
|
9576 | }
|
9577 | function animateDefaultLabels(context, dataLabels, duration, numeric, easeType) {
|
9578 | void 0 === numeric && (numeric = !1), void 0 === easeType && (easeType = "cubic-in-out");
|
9579 | var labels = context.selectAll(labelsClass.selector).data(_.filter(dataLabels, function(d) {
|
9580 | return d.isVisible;
|
9581 | }), labelKeyFunction);
|
9582 | labels.enter().append("text").classed(labelsClass["class"], !0).style("opacity", 0);
|
9583 | var labelAttr = {
|
9584 | x: function(d) {
|
9585 | return d.boundingBox.left + d.boundingBox.width / 2;
|
9586 | },
|
9587 | y: function(d) {
|
9588 | return d.boundingBox.top + d.boundingBox.height;
|
9589 | },
|
9590 | dy: "-0.15em"
|
9591 | };
|
9592 | return numeric && (labelAttr.dy = void 0), labels.text(function(d) {
|
9593 | return d.text;
|
9594 | }).style({
|
9595 | fill: function(d) {
|
9596 | return d.fill;
|
9597 | },
|
9598 | "font-size": function(d) {
|
9599 | return PixelConverter.fromPoint(d.fontSize || NewDataLabelUtils.DefaultLabelFontSizeInPt);
|
9600 | }
|
9601 | }).transition().ease(easeType).duration(duration).attr(labelAttr).style("opacity", 1),
|
9602 | labels.exit().transition().duration(duration).style("opacity", 0).remove(), labels;
|
9603 | }
|
9604 | function drawLabelBackground(context, dataLabels, fill, fillOpacity) {
|
9605 | var labelRects = context.selectAll("rect").data(_.filter(dataLabels, function(d) {
|
9606 | return d.isVisible;
|
9607 | }), labelKeyFunction);
|
9608 | return labelRects.enter().append("rect"), labelRects.attr({
|
9609 | x: function(d) {
|
9610 | return d.boundingBox.left - NewDataLabelUtils.horizontalLabelBackgroundPadding;
|
9611 | },
|
9612 | y: function(d) {
|
9613 | return d.boundingBox.top - NewDataLabelUtils.verticalLabelBackgroundPadding;
|
9614 | },
|
9615 | rx: labelBackgroundRounding,
|
9616 | ry: labelBackgroundRounding,
|
9617 | width: function(d) {
|
9618 | return d.boundingBox.width + 2 * NewDataLabelUtils.horizontalLabelBackgroundPadding;
|
9619 | },
|
9620 | height: function(d) {
|
9621 | return void 0 === d.text && void 0 === d.secondRowText ? 0 : d.boundingBox.height + 2 * NewDataLabelUtils.verticalLabelBackgroundPadding;
|
9622 | }
|
9623 | }).style("fill", fill ? fill : "#000000").style("fill-opacity", null != fillOpacity ? fillOpacity : 1),
|
9624 | labelRects.exit().remove(), labelRects;
|
9625 | }
|
9626 | function drawLabelLeaderLines(context, filteredDataLabels, key, leaderLineColor) {
|
9627 | context.select(linesGraphicsContextClass.selector).empty() && context.append("g").classed(linesGraphicsContextClass["class"], !0);
|
9628 | var lines = context.select(linesGraphicsContextClass.selector).selectAll("polyline").data(filteredDataLabels, key);
|
9629 | lines.enter().append("polyline").classed(lineClass["class"], !0), lines.attr("points", function(d) {
|
9630 | return d.leaderLinePoints;
|
9631 | }).style({
|
9632 | stroke: function(d) {
|
9633 | return leaderLineColor ? leaderLineColor : d.fill;
|
9634 | },
|
9635 | "stroke-width": visuals.DonutLabelUtils.LineStrokeWidth
|
9636 | }), lines.exit().remove();
|
9637 | }
|
9638 | function getLabelFormattedText(label, format, formatter) {
|
9639 | return formatter ? formatter.format(label) : powerbi.formattingService.formatValue(label, format);
|
9640 | }
|
9641 | function getDisplayUnitValueFromAxisFormatter(axisFormatter, labelSettings) {
|
9642 | return axisFormatter && axisFormatter.displayUnit && 0 === labelSettings.displayUnits ? axisFormatter.displayUnit.value : null;
|
9643 | }
|
9644 | function getLabelPrecision(precision, format) {
|
9645 | if (precision !== defaultLabelPrecision) return precision;
|
9646 | if (format) {
|
9647 | var positiveFormat = format.split(";")[0], formatMetadata = powerbi.NumberFormat.getCustomFormatMetadata(positiveFormat, !0);
|
9648 | if (formatMetadata.hasDots) return formatMetadata.precision;
|
9649 | }
|
9650 | return defaultCountLabelPrecision;
|
9651 | }
|
9652 | function createColumnFormatterCacheManager() {
|
9653 | return {
|
9654 | cache: {
|
9655 | defaultFormatter: null
|
9656 | },
|
9657 | getOrCreate: function(formatString, labelSetting, value2) {
|
9658 | if (formatString) {
|
9659 | var cacheKeyObject = {
|
9660 | formatString: formatString,
|
9661 | displayUnits: labelSetting.displayUnits,
|
9662 | precision: getLabelPrecision(labelSetting.precision, formatString),
|
9663 | value2: value2
|
9664 | }, cacheKey = JSON.stringify(cacheKeyObject);
|
9665 | return this.cache[cacheKey] || (this.cache[cacheKey] = visuals.valueFormatter.create(getOptionsForLabelFormatter(labelSetting, formatString, value2, cacheKeyObject.precision))),
|
9666 | this.cache[cacheKey];
|
9667 | }
|
9668 | return this.cache.defaultFormatter || (this.cache.defaultFormatter = visuals.valueFormatter.create(getOptionsForLabelFormatter(labelSetting, formatString, value2, labelSetting.precision))),
|
9669 | this.cache.defaultFormatter;
|
9670 | }
|
9671 | };
|
9672 | }
|
9673 | function getOptionsForLabelFormatter(labelSetting, formatString, value2, precision) {
|
9674 | return {
|
9675 | displayUnitSystemType: powerbi.DisplayUnitSystemType.DataLabels,
|
9676 | format: formatString,
|
9677 | precision: precision,
|
9678 | value: labelSetting.displayUnits,
|
9679 | value2: value2,
|
9680 | allowFormatBeautification: !0
|
9681 | };
|
9682 | }
|
9683 | function removeDuplicates(labelDataPoints) {
|
9684 | for (var uniqueLabelDataPoints = [], labelDataPointMap = {}, sameParentIsInArray = function(newValue, array, parentIsRect) {
|
9685 | return array.some(function(arrayValue) {
|
9686 | return parentIsRect ? visuals.shapes.Rect.equals(newValue.parentShape.rect, arrayValue.rect) : visuals.shapes.Point.equals(newValue.parentShape.point, arrayValue.point);
|
9687 | });
|
9688 | }, _i = 0, labelDataPoints_1 = labelDataPoints; _i < labelDataPoints_1.length; _i++) {
|
9689 | var dataPoint = labelDataPoints_1[_i], parentIsRect = 1 === dataPoint.parentType, resultsFromMap = labelDataPointMap[dataPoint.text];
|
9690 | resultsFromMap ? sameParentIsInArray(dataPoint, resultsFromMap, parentIsRect) || (uniqueLabelDataPoints.push(dataPoint),
|
9691 | resultsFromMap.push(dataPoint.parentShape)) : (uniqueLabelDataPoints.push(dataPoint),
|
9692 | labelDataPointMap[dataPoint.text] = [ dataPoint.parentShape ]);
|
9693 | }
|
9694 | return uniqueLabelDataPoints;
|
9695 | }
|
9696 | function getDataLabelLayoutOptions(type) {
|
9697 | switch (type) {
|
9698 | case 9:
|
9699 | return {
|
9700 | maximumOffset: visuals.ScatterChart.dataLabelLayoutMaximumOffset,
|
9701 | startingOffset: visuals.ScatterChart.dataLabelLayoutStartingOffset,
|
9702 | offsetIterationDelta: visuals.ScatterChart.dataLabelLayoutOffsetIterationDelta,
|
9703 | allowLeaderLines: !0,
|
9704 | attemptToMoveLabelsIntoViewport: !0
|
9705 | };
|
9706 |
|
9707 | default:
|
9708 | return {
|
9709 | maximumOffset: NewDataLabelUtils.maxLabelOffset,
|
9710 | startingOffset: NewDataLabelUtils.startingLabelOffset,
|
9711 | attemptToMoveLabelsIntoViewport: !0
|
9712 | };
|
9713 | }
|
9714 | }
|
9715 | function getTextSize(text, fontSize) {
|
9716 | var labelTextProperties = NewDataLabelUtils.LabelTextProperties, properties = {
|
9717 | text: text,
|
9718 | fontFamily: labelTextProperties.fontFamily,
|
9719 | fontSize: jsCommon.PixelConverter.fromPoint(fontSize),
|
9720 | fontWeight: labelTextProperties.fontWeight
|
9721 | };
|
9722 | return {
|
9723 | width: powerbi.TextMeasurementService.measureSvgTextWidth(properties),
|
9724 | height: powerbi.TextMeasurementService.estimateSvgTextHeight(properties)
|
9725 | };
|
9726 | }
|
9727 | function labelKeyFunction(label, index) {
|
9728 | return label.key ? label.key : label.identity ? label.identity.getKeyWithoutHighlight() : index;
|
9729 | }
|
9730 | NewDataLabelUtils.DefaultLabelFontSizeInPt = 9, NewDataLabelUtils.MapPolylineOpacity = .5,
|
9731 | NewDataLabelUtils.LabelDensityBufferFactor = 3, NewDataLabelUtils.LabelDensityPadding = 6,
|
9732 | NewDataLabelUtils.startingLabelOffset = 8, NewDataLabelUtils.maxLabelOffset = 8,
|
9733 | NewDataLabelUtils.maxLabelWidth = 50, NewDataLabelUtils.hundredPercentFormat = "0.00 %;-0.00 %;0.00 %",
|
9734 | NewDataLabelUtils.LabelTextProperties = {
|
9735 | fontFamily: visuals.Font.Family.regularSecondary.css,
|
9736 | fontSize: PixelConverter.fromPoint(NewDataLabelUtils.DefaultLabelFontSizeInPt),
|
9737 | fontWeight: "normal"
|
9738 | }, NewDataLabelUtils.defaultLabelColor = "#777777", NewDataLabelUtils.defaultInsideLabelColor = "#ffffff",
|
9739 | NewDataLabelUtils.horizontalLabelBackgroundPadding = 4, NewDataLabelUtils.verticalLabelBackgroundPadding = 2;
|
9740 | var labelBackgroundRounding = 4, defaultLabelPrecision = void 0, defaultCountLabelPrecision = 0;
|
9741 | NewDataLabelUtils.labelGraphicsContextClass = createClassAndSelector("labelGraphicsContext"),
|
9742 | NewDataLabelUtils.labelBackgroundGraphicsContextClass = createClassAndSelector("labelBackgroundGraphicsContext");
|
9743 | var labelsClass = createClassAndSelector("label"), secondLineLabelClass = createClassAndSelector("label-second-line"), linesGraphicsContextClass = createClassAndSelector("leader-lines"), lineClass = createClassAndSelector("line-label");
|
9744 | NewDataLabelUtils.drawDefaultLabels = drawDefaultLabels, NewDataLabelUtils.animateDefaultLabels = animateDefaultLabels,
|
9745 | NewDataLabelUtils.drawLabelBackground = drawLabelBackground, NewDataLabelUtils.drawLabelLeaderLines = drawLabelLeaderLines,
|
9746 | NewDataLabelUtils.getLabelFormattedText = getLabelFormattedText, NewDataLabelUtils.getDisplayUnitValueFromAxisFormatter = getDisplayUnitValueFromAxisFormatter,
|
9747 | NewDataLabelUtils.createColumnFormatterCacheManager = createColumnFormatterCacheManager,
|
9748 | NewDataLabelUtils.removeDuplicates = removeDuplicates, NewDataLabelUtils.getDataLabelLayoutOptions = getDataLabelLayoutOptions,
|
9749 | NewDataLabelUtils.getTextSize = getTextSize;
|
9750 | }(NewDataLabelUtils = visuals.NewDataLabelUtils || (visuals.NewDataLabelUtils = {}));
|
9751 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
9752 | }(powerbi || (powerbi = {}));
|
9753 | }, function(module, exports) {
|
9754 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
9755 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
9756 | !function(powerbi) {
|
9757 | var visuals;
|
9758 | !function(visuals) {
|
9759 | var KpiUtil;
|
9760 | !function(KpiUtil) {
|
9761 | function getKpiIcon(kpi, value) {
|
9762 | var numValue = parseFloat(value);
|
9763 | if (kpi) {
|
9764 | var statusGraphicFormat = statusGraphicFormatStrings[kpi.graphic.toUpperCase()];
|
9765 | if (statusGraphicFormat && !isNaN(numValue)) {
|
9766 | var statusValues = statusGraphicFormat.statusValues;
|
9767 | kpi.normalizedFiveStateKpiRange && 5 === statusValues.length && (numValue = 2 * numValue);
|
9768 | var num = numValue + Math.floor(statusValues.length / 2);
|
9769 | return [ statusGraphicFormat.kpiIconClass, statusValues[num] ].join(" ").trim();
|
9770 | }
|
9771 | }
|
9772 | }
|
9773 | function getKpiIconClassName(kpiIcon, kpiImageSize) {
|
9774 | return kpiIcon ? 1 === kpiImageSize ? [ KPIImageClassName, BigImageClassName, kpiIcon ].join(" ") : [ KPIImageClassName, kpiIcon ].join(" ") : void 0;
|
9775 | }
|
9776 | function getClassForKpi(kpi, value, kpiImageSize) {
|
9777 | var kpiIcon = getKpiIcon(kpi, value);
|
9778 | return getKpiIconClassName(kpiIcon, kpiImageSize);
|
9779 | }
|
9780 | function getKpiImageMetadata(metaDataColumn, value, kpiImageSize) {
|
9781 | var kpi = metaDataColumn && metaDataColumn.kpi;
|
9782 | if (kpi) {
|
9783 | var kpiIcon = getKpiIcon(kpi, value);
|
9784 | if (kpiIcon) return {
|
9785 | caption: kpiIcon,
|
9786 | statusGraphic: kpi.graphic,
|
9787 | "class": getKpiIconClassName(kpiIcon, kpiImageSize)
|
9788 | };
|
9789 | }
|
9790 | }
|
9791 | var KPIImageClassName = "powervisuals-glyph", BigImageClassName = "big-kpi", RYGStatusIconClassNames = [ "kpi-red", "kpi-yellow", "kpi-green" ], threeLights = {
|
9792 | kpiIconClass: "circle",
|
9793 | statusValues: RYGStatusIconClassNames
|
9794 | }, roadSigns = {
|
9795 | kpiIconClass: "",
|
9796 | statusValues: [ "circle-x kpi-red", "circle-exclamation kpi-yellow", "circle-checkmark kpi-green" ]
|
9797 | }, trafficLight = {
|
9798 | kpiIconClass: "traffic-light",
|
9799 | statusValues: RYGStatusIconClassNames
|
9800 | }, shapes = {
|
9801 | kpiIconClass: "",
|
9802 | statusValues: [ "rhombus kpi-red", "triangle kpi-yellow", "circle kpi-green" ]
|
9803 | }, gauge = {
|
9804 | kpiIconClass: "",
|
9805 | statusValues: [ "circle-empty", "circle-one-quarter", "circle-half", "circle-three-quarters", "circle-full" ]
|
9806 | }, statusGraphicFormatStrings = {
|
9807 | "THREE CIRCLES COLORED": threeLights,
|
9808 | "TRAFFIC LIGHT - SINGLE": threeLights,
|
9809 | "THREE FLAGS COLORED": {
|
9810 | kpiIconClass: "flag",
|
9811 | statusValues: RYGStatusIconClassNames
|
9812 | },
|
9813 | "ROAD SIGNS": roadSigns,
|
9814 | "THREE SYMBOLS CIRCLED COLORED": roadSigns,
|
9815 | "TRAFFIC LIGHT": trafficLight,
|
9816 | "THREE TRAFFIC LIGHTS RIMMED COLORED": trafficLight,
|
9817 | "THREE SYMBOLS UNCIRCLED COLORED": {
|
9818 | kpiIconClass: "",
|
9819 | statusValues: [ "x kpi-red", "exclamation kpi-yellow", "checkmark kpi-green" ]
|
9820 | },
|
9821 | SHAPES: shapes,
|
9822 | "SMILEY FACE": shapes,
|
9823 | THERMOMETER: shapes,
|
9824 | CYLINDER: shapes,
|
9825 | "THREE SIGNS COLORED": shapes,
|
9826 | "THREE STARS COLORED": {
|
9827 | kpiIconClass: "star-stacked",
|
9828 | statusValues: [ "star-empty", "star-half-full", "star-full" ]
|
9829 | },
|
9830 | "FIVE BARS COLORED": {
|
9831 | kpiIconClass: "bars-stacked",
|
9832 | statusValues: [ "bars-zero", "bars-one", "bars-two", "bars-three", "bars-four" ]
|
9833 | },
|
9834 | "FIVE BOXES COLORED": {
|
9835 | kpiIconClass: "boxes-stacked",
|
9836 | statusValues: [ "boxes-zero", "boxes-one", "boxes-two", "boxes-three", "boxes-four" ]
|
9837 | },
|
9838 | "FIVE QUARTERS COLORED": gauge,
|
9839 | "GAUGE - ASCENDING": gauge,
|
9840 | "GAUGE - DESCENDING": {
|
9841 | kpiIconClass: "",
|
9842 | statusValues: [ "circle-full", "circle-three-quarters", "circle-half", "circle-one-quarter", "circle-empty" ]
|
9843 | },
|
9844 | "STANDARD ARROW": {
|
9845 | kpiIconClass: "",
|
9846 | statusValues: [ "arrow-down", "arrow-right-down", "arrow-right", "arrow-right-up", "arrow-up" ]
|
9847 | },
|
9848 | "VARIANCE ARROW": {
|
9849 | kpiIconClass: "",
|
9850 | statusValues: [ "arrow-down kpi-red", "arrow-right kpi-yellow", "arrow-up kpi-green" ]
|
9851 | },
|
9852 | "STATUS ARROW - ASCENDING": {
|
9853 | kpiIconClass: "",
|
9854 | statusValues: [ "arrow-down kpi-red", "arrow-right-down kpi-yellow", "arrow-right kpi-yellow", "arrow-right-up kpi-yellow", "arrow-up kpi-green" ]
|
9855 | },
|
9856 | "STATUS ARROW - DESCENDING": {
|
9857 | kpiIconClass: "",
|
9858 | statusValues: [ "arrow-up kpi-green", "arrow-right-up kpi-yellow", "arrow-right kpi-yellow", "arrow-right-down kpi-yellow", "arrow-down kpi-red" ]
|
9859 | }
|
9860 | };
|
9861 | KpiUtil.getClassForKpi = getClassForKpi, KpiUtil.getKpiImageMetadata = getKpiImageMetadata;
|
9862 | }(KpiUtil = visuals.KpiUtil || (visuals.KpiUtil = {}));
|
9863 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
9864 | }(powerbi || (powerbi = {}));
|
9865 | }, function(module, exports) {
|
9866 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
9867 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
9868 | !function(powerbi) {
|
9869 | var visuals;
|
9870 | !function(visuals) {
|
9871 | var DateUtil;
|
9872 | !function(DateUtil) {
|
9873 | function isEqual(date1, date2) {
|
9874 | return null == date1 && null == date2 ? !0 : null == date1 || null == date2 ? !1 : date1.getTime() === date2.getTime();
|
9875 | }
|
9876 | DateUtil.isEqual = isEqual;
|
9877 | }(DateUtil = visuals.DateUtil || (visuals.DateUtil = {}));
|
9878 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
9879 | }(powerbi || (powerbi = {}));
|
9880 | }, function(module, exports) {
|
9881 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
9882 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
9883 | !function(powerbi) {
|
9884 | var visuals;
|
9885 | !function(visuals) {
|
9886 | var MinMaxType;
|
9887 | !function(MinMaxType) {
|
9888 | MinMaxType[MinMaxType.Minimum = 0] = "Minimum", MinMaxType[MinMaxType.Maximum = 1] = "Maximum",
|
9889 | MinMaxType[MinMaxType.Neither = 2] = "Neither";
|
9890 | }(MinMaxType || (MinMaxType = {}));
|
9891 | var MinMaxLabelDataPointSorter = function() {
|
9892 | function MinMaxLabelDataPointSorter(options) {
|
9893 | this.unsortedLabelDataPointGroups = options.unsortedLabelDataPointGroups, this.series = options.series,
|
9894 | this.yScale = options.yAxisProperties.scale, this.viewport = options.viewport;
|
9895 | }
|
9896 | return MinMaxLabelDataPointSorter.prototype.getSortedDataLabels = function() {
|
9897 | for (var unsortedLabelDataPointGroups = this.unsortedLabelDataPointGroups, sortedLabelDataPointGroups = [], seriesIndex = 0, seriesCount = unsortedLabelDataPointGroups.length; seriesCount > seriesIndex; seriesIndex++) {
|
9898 | var unsortedLabelDataPointGroup = unsortedLabelDataPointGroups[seriesIndex], numberOfLabelsToSort = MinMaxLabelDataPointSorter.maxNumberToSortFactor * unsortedLabelDataPointGroup.maxNumberOfLabels;
|
9899 | if (!_.isEmpty(unsortedLabelDataPointGroup.labelDataPoints)) {
|
9900 | var unsortedLabelDataPoints = unsortedLabelDataPointGroup.labelDataPoints, sortedLabelDataPoints = [], data_1 = _.filter(this.series[seriesIndex].data, function(dataPoint) {
|
9901 | return null != dataPoint.value;
|
9902 | }), globalMinMaxInRange = MinMaxLabelDataPointSorter.getMinMaxInRange(0, data_1.length - 1, data_1), numberOfLabelsAdded = this.addFirstLastMaxMin(unsortedLabelDataPoints, sortedLabelDataPoints, globalMinMaxInRange.maxIndex, globalMinMaxInRange.minIndex), unsortedWeightedLabelDataPoints = void 0;
|
9903 | if (!(numberOfLabelsAdded >= numberOfLabelsToSort)) {
|
9904 | unsortedWeightedLabelDataPoints = this.calculateWeights(unsortedLabelDataPoints, data_1, numberOfLabelsToSort, globalMinMaxInRange);
|
9905 | var maximumnMinMaxesToAdd = Math.max(numberOfLabelsToSort - numberOfLabelsAdded, 0);
|
9906 | numberOfLabelsAdded += this.addLocalMinMaxes(unsortedWeightedLabelDataPoints, sortedLabelDataPoints, globalMinMaxInRange.maxIndex, globalMinMaxInRange.minIndex, maximumnMinMaxesToAdd);
|
9907 | }
|
9908 | if (!(numberOfLabelsAdded >= numberOfLabelsToSort)) {
|
9909 | var maximumNonMinMaxesToAdd = Math.max(numberOfLabelsToSort - numberOfLabelsAdded, 0);
|
9910 | this.addNonMinMaxes(unsortedWeightedLabelDataPoints, sortedLabelDataPoints, maximumNonMinMaxesToAdd);
|
9911 | }
|
9912 | sortedLabelDataPointGroups.push({
|
9913 | labelDataPoints: sortedLabelDataPoints,
|
9914 | maxNumberOfLabels: unsortedLabelDataPointGroup.maxNumberOfLabels
|
9915 | });
|
9916 | }
|
9917 | }
|
9918 | return sortedLabelDataPointGroups;
|
9919 | }, MinMaxLabelDataPointSorter.prototype.calculateWeights = function(labelDataPoints, data, numberOfLabelsToSort, globalMinMax) {
|
9920 | for (var previousMinMaxPoint, currentMinMaxPoint, categoryCount = data.length, yScale = this.yScale, minMaxPoints = this.findMinMaxesBasedOnSmoothedValues(labelDataPoints, data), totalValueDifference = Math.abs(yScale(globalMinMax.maxValue) - yScale(globalMinMax.minValue)), minMaxIndex = 0, minMaxCount = minMaxPoints.length; minMaxCount > minMaxIndex; minMaxIndex++) {
|
9921 | currentMinMaxPoint = minMaxPoints[minMaxIndex];
|
9922 | var weight = void 0;
|
9923 | if (previousMinMaxPoint) {
|
9924 | var valueWeight = Math.abs((yScale(previousMinMaxPoint.value) - yScale(currentMinMaxPoint.value)) / totalValueDifference), indexWeight = Math.abs(previousMinMaxPoint.index - currentMinMaxPoint.index) / (categoryCount - 1);
|
9925 | weight = (valueWeight + indexWeight) / 2;
|
9926 | }
|
9927 | if (null != weight && previousMinMaxPoint) {
|
9928 | var previousLabelDataPoint = labelDataPoints[previousMinMaxPoint.index];
|
9929 | null != previousLabelDataPoint.weight ? previousLabelDataPoint.weight = (previousLabelDataPoint.weight + weight) / 2 : previousLabelDataPoint.weight = weight,
|
9930 | labelDataPoints[currentMinMaxPoint.index].weight = weight;
|
9931 | }
|
9932 | previousMinMaxPoint = currentMinMaxPoint;
|
9933 | }
|
9934 | for (var _i = 0, labelDataPoints_1 = labelDataPoints; _i < labelDataPoints_1.length; _i++) {
|
9935 | var labelDataPoint = labelDataPoints_1[_i];
|
9936 | labelDataPoint.weight < MinMaxLabelDataPointSorter.minimumWeightToConsiderMinMax && (labelDataPoint.weight = void 0);
|
9937 | }
|
9938 | return labelDataPoints;
|
9939 | }, MinMaxLabelDataPointSorter.prototype.findMinMaxesBasedOnSmoothedValues = function(labelDataPoints, data) {
|
9940 | for (var minMaxPoints = [], windowSize = this.getWindowSize(data), halfWindowSize = Math.floor(windowSize / 2), scaledSmoothedValues = this.calculateSmoothedValues(data, windowSize), categoryIndex = 0, categoryCount = labelDataPoints.length; categoryCount > categoryIndex; categoryIndex++) {
|
9941 | var minMaxType = this.getMinMaxType(categoryIndex, scaledSmoothedValues);
|
9942 | if (minMaxType !== MinMaxType.Neither) {
|
9943 | var currentMinMaxPoint = {
|
9944 | index: categoryIndex,
|
9945 | type: minMaxType,
|
9946 | value: data[categoryIndex].value
|
9947 | };
|
9948 | minMaxPoints.push(currentMinMaxPoint);
|
9949 | }
|
9950 | }
|
9951 | for (var previousMinMax, currentMinMax, nextMinMax, minMaxIndex = 0, minMaxCount = minMaxPoints.length; minMaxCount > minMaxIndex; minMaxIndex++) if (previousMinMax = minMaxPoints[minMaxIndex - 1],
|
9952 | currentMinMax = minMaxPoints[minMaxIndex], nextMinMax = minMaxPoints[minMaxIndex + 1],
|
9953 | previousMinMax && nextMinMax) {
|
9954 | var actualMinMaxInRange = MinMaxLabelDataPointSorter.getMinMaxInRange(Math.max(previousMinMax.index, currentMinMax.index - halfWindowSize), Math.min(nextMinMax.index, currentMinMax.index + halfWindowSize), data);
|
9955 | if (currentMinMax.type === MinMaxType.Maximum) {
|
9956 | var actualIndex = actualMinMaxInRange.maxIndex;
|
9957 | currentMinMax.index = actualIndex, currentMinMax.value = data[actualIndex].value;
|
9958 | } else {
|
9959 | var actualIndex = actualMinMaxInRange.minIndex;
|
9960 | currentMinMax.index = actualIndex, currentMinMax.value = data[actualIndex].value;
|
9961 | }
|
9962 | }
|
9963 | return minMaxPoints;
|
9964 | }, MinMaxLabelDataPointSorter.getMinMaxInRange = function(startIndex, endIndex, data) {
|
9965 | for (var minValue, maxValue, minIndex, maxIndex, categoryIndex = startIndex, dataLength = data.length; endIndex >= categoryIndex && dataLength > categoryIndex; categoryIndex++) {
|
9966 | var value = data[categoryIndex].value;
|
9967 | null != value && ((void 0 === minValue || minValue > value) && (minValue = value,
|
9968 | minIndex = categoryIndex), (void 0 === maxValue || value > maxValue) && (maxValue = value,
|
9969 | maxIndex = categoryIndex));
|
9970 | }
|
9971 | return {
|
9972 | minIndex: minIndex,
|
9973 | minValue: minValue,
|
9974 | maxIndex: maxIndex,
|
9975 | maxValue: maxValue
|
9976 | };
|
9977 | }, MinMaxLabelDataPointSorter.prototype.getWindowSize = function(data) {
|
9978 | var idealSize = data.length / this.viewport.width * MinMaxLabelDataPointSorter.estimatedLabelWidth, actualsize = 2 * Math.floor(idealSize / 2) + 1;
|
9979 | return actualsize;
|
9980 | }, MinMaxLabelDataPointSorter.prototype.calculateSmoothedValues = function(data, windowSize) {
|
9981 | for (var gaussianValues = MinMaxLabelDataPointSorter.getGaussianDistribution(windowSize), scaledAndSmoothedValues = [], categoryIndex = 0, categoryCount = data.length; categoryCount > categoryIndex; categoryIndex++) if (1 === windowSize) scaledAndSmoothedValues.push(data[categoryIndex].value); else {
|
9982 | var scaledValue = this.getSmoothedValue(data, categoryIndex, windowSize, gaussianValues);
|
9983 | scaledAndSmoothedValues.push(scaledValue);
|
9984 | }
|
9985 | return scaledAndSmoothedValues;
|
9986 | }, MinMaxLabelDataPointSorter.getGaussianDistribution = function(windowSize) {
|
9987 | for (var gaussianDistribution = [], halfWayIndex = Math.floor(windowSize / 2), height = 1, maxPosition = halfWayIndex, standardDeviation = halfWayIndex / 2, i = 0; halfWayIndex > i; i++) {
|
9988 | var gaussianValue = height * Math.pow(Math.E, -1 * ((i - maxPosition) * (i - maxPosition)) / (2 * standardDeviation * standardDeviation));
|
9989 | gaussianDistribution.push(gaussianValue);
|
9990 | }
|
9991 | gaussianDistribution.push(1);
|
9992 | for (var i = halfWayIndex - 1; i >= 0; i--) gaussianDistribution.push(gaussianDistribution[i]);
|
9993 | return gaussianDistribution;
|
9994 | }, MinMaxLabelDataPointSorter.prototype.getSmoothedValue = function(data, categoryIndex, windowSize, gaussianValues) {
|
9995 | if (null == data[categoryIndex].value) return data[categoryIndex].value;
|
9996 | for (var halfWindowSize = Math.floor(windowSize / 2), startingIndex = categoryIndex - halfWindowSize, endingIndex = categoryIndex + halfWindowSize, totalValue = 0, totalValueCount = 0, lastDataIndex = data.length - 1, currentIndex = startingIndex, gaussianIndex = 0; endingIndex >= currentIndex; currentIndex++,
|
9997 | gaussianIndex++) {
|
9998 | var valueIndex = Math.max(0, Math.min(currentIndex, lastDataIndex)), value = data[valueIndex].value;
|
9999 | null != value && (totalValue += value * gaussianValues[gaussianIndex], totalValueCount++);
|
10000 | }
|
10001 | return totalValue / totalValueCount;
|
10002 | }, MinMaxLabelDataPointSorter.prototype.addFirstLastMaxMin = function(unsorted, sorted, maxIndex, minIndex) {
|
10003 | var labelsAdded = 0;
|
10004 | if (_.isEmpty(unsorted)) return labelsAdded;
|
10005 | sorted.push(unsorted[0]), labelsAdded++;
|
10006 | var lastIndex = unsorted.length - 1;
|
10007 | return 0 !== lastIndex && (sorted.push(unsorted[lastIndex]), labelsAdded++), 0 !== maxIndex && maxIndex !== lastIndex && (sorted.push(unsorted[maxIndex]),
|
10008 | labelsAdded++), 0 !== minIndex && minIndex !== lastIndex && (sorted.push(unsorted[minIndex]),
|
10009 | labelsAdded++), labelsAdded;
|
10010 | }, MinMaxLabelDataPointSorter.prototype.addLocalMinMaxes = function(unsorted, sorted, maxIndex, minIndex, maxNumberOfLabels) {
|
10011 | for (var lastIndex = unsorted.length - 1, localMinMaxes = _.filter(unsorted, function(labelDataPoint, index) {
|
10012 | return 0 === index || index === lastIndex || index === maxIndex || index === minIndex ? !1 : null != labelDataPoint.weight;
|
10013 | }), sortedMinMaxes = _.sortBy(localMinMaxes, function(weighedLabelDataPoint) {
|
10014 | return -weighedLabelDataPoint.weight;
|
10015 | }), labelsAdded = 0, i = 0, ilen = Math.min(sortedMinMaxes.length, maxNumberOfLabels); ilen > i; i++) sorted.push(sortedMinMaxes[i]),
|
10016 | labelsAdded++;
|
10017 | return labelsAdded;
|
10018 | }, MinMaxLabelDataPointSorter.prototype.addNonMinMaxes = function(unsorted, sorted, maxNumberOfLabels) {
|
10019 | for (var currentNonMinMaxSet, nonMinMaxSets = [], categoryIndex = 0, categoryCount = unsorted.length; categoryCount > categoryIndex; categoryIndex++) null == unsorted[categoryIndex].weight ? currentNonMinMaxSet ? currentNonMinMaxSet.count++ : currentNonMinMaxSet = {
|
10020 | startingIndex: categoryIndex,
|
10021 | count: 1
|
10022 | } : currentNonMinMaxSet && currentNonMinMaxSet.count > 0 && (nonMinMaxSets.push(currentNonMinMaxSet),
|
10023 | currentNonMinMaxSet = null);
|
10024 | for (var numberOfLabelsAdded = 0; nonMinMaxSets.length > 0 && maxNumberOfLabels > numberOfLabelsAdded; ) {
|
10025 | for (var currentMaxCount = 0, maxIndex = 0, i = 0, ilen = nonMinMaxSets.length; ilen > i; i++) {
|
10026 | var currentCount = nonMinMaxSets[i].count;
|
10027 | currentCount > currentMaxCount && (currentMaxCount = currentCount, maxIndex = i);
|
10028 | }
|
10029 | var setToSplit = nonMinMaxSets.splice(maxIndex, 1)[0];
|
10030 | if (1 === setToSplit.count) sorted.push(unsorted[setToSplit.startingIndex]); else {
|
10031 | var splitIndex = Math.floor(setToSplit.count / 2) + setToSplit.startingIndex;
|
10032 | sorted.push(unsorted[splitIndex]);
|
10033 | var leftCount = splitIndex - setToSplit.startingIndex;
|
10034 | leftCount > 0 && nonMinMaxSets.push({
|
10035 | startingIndex: setToSplit.startingIndex,
|
10036 | count: leftCount
|
10037 | });
|
10038 | var rightCount = setToSplit.startingIndex + setToSplit.count - splitIndex - 1;
|
10039 | rightCount > 0 && nonMinMaxSets.push({
|
10040 | startingIndex: splitIndex + 1,
|
10041 | count: rightCount
|
10042 | });
|
10043 | }
|
10044 | numberOfLabelsAdded++;
|
10045 | }
|
10046 | }, MinMaxLabelDataPointSorter.prototype.getMinMaxType = function(index, scaledDataPoints) {
|
10047 | var currentValue = scaledDataPoints[index];
|
10048 | if (null == scaledDataPoints[index]) return MinMaxType.Neither;
|
10049 | if (scaledDataPoints.length < 2) return MinMaxType.Neither;
|
10050 | if (null == scaledDataPoints[index - 1]) return scaledDataPoints[index + 1] > currentValue ? MinMaxType.Minimum : MinMaxType.Maximum;
|
10051 | if (null == scaledDataPoints[index + 1]) return scaledDataPoints[index - 1] > currentValue ? MinMaxType.Minimum : MinMaxType.Maximum;
|
10052 | var prevValue = scaledDataPoints[index - 1], nextValue = scaledDataPoints[index + 1];
|
10053 | return null == prevValue && null == nextValue ? MinMaxType.Neither : null == prevValue ? nextValue > currentValue ? MinMaxType.Minimum : MinMaxType.Maximum : null == nextValue ? prevValue > currentValue ? MinMaxType.Minimum : MinMaxType.Maximum : prevValue > currentValue && nextValue > currentValue ? MinMaxType.Minimum : currentValue > prevValue && currentValue > nextValue ? MinMaxType.Maximum : MinMaxType.Neither;
|
10054 | }, MinMaxLabelDataPointSorter.estimatedLabelWidth = 40, MinMaxLabelDataPointSorter.minimumWeightToConsiderMinMax = .015,
|
10055 | MinMaxLabelDataPointSorter.maxNumberToSortFactor = 2, MinMaxLabelDataPointSorter;
|
10056 | }();
|
10057 | visuals.MinMaxLabelDataPointSorter = MinMaxLabelDataPointSorter;
|
10058 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
10059 | }(powerbi || (powerbi = {}));
|
10060 | }, function(module, exports) {
|
10061 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
10062 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
10063 | !function(powerbi) {
|
10064 | var visuals;
|
10065 | !function(visuals) {
|
10066 | var ReferenceLineHelper;
|
10067 | !function(ReferenceLineHelper) {
|
10068 | function enumerateObjectInstances(enumeration, referenceLines, defaultColor, objectName) {
|
10069 | if (_.isEmpty(referenceLines)) {
|
10070 | var instance = {
|
10071 | selector: {
|
10072 | id: "0"
|
10073 | },
|
10074 | properties: {
|
10075 | show: !1,
|
10076 | value: "",
|
10077 | lineColor: {
|
10078 | solid: {
|
10079 | color: defaultColor
|
10080 | }
|
10081 | },
|
10082 | transparency: 50,
|
10083 | style: visuals.lineStyle.dashed,
|
10084 | position: visuals.referenceLinePosition.back,
|
10085 | dataLabelShow: !1
|
10086 | },
|
10087 | objectName: objectName
|
10088 | };
|
10089 | return void enumeration.pushInstance(instance);
|
10090 | }
|
10091 | for (var _i = 0, referenceLines_1 = referenceLines; _i < referenceLines_1.length; _i++) {
|
10092 | var referenceLine = referenceLines_1[_i], referenceLineProperties = referenceLine.object, show = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.show, !1), value = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.value), lineColor = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.lineColor, {
|
10093 | solid: {
|
10094 | color: defaultColor
|
10095 | }
|
10096 | }), transparency = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.transparency, 50), style = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.style, visuals.lineStyle.dashed), position = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.position, visuals.referenceLinePosition.back), dataLabelShow = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.dataLabelShow, !1), instance = {
|
10097 | selector: {
|
10098 | id: referenceLine.id
|
10099 | },
|
10100 | properties: {
|
10101 | show: show,
|
10102 | value: value,
|
10103 | lineColor: lineColor,
|
10104 | transparency: transparency,
|
10105 | style: style,
|
10106 | position: position,
|
10107 | dataLabelShow: dataLabelShow
|
10108 | },
|
10109 | objectName: objectName
|
10110 | };
|
10111 | if (dataLabelShow) {
|
10112 | var dataLabelColor = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.dataLabelColor, {
|
10113 | solid: {
|
10114 | color: defaultColor
|
10115 | }
|
10116 | }), dataLabelHorizontalPosition = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.dataLabelHorizontalPosition, visuals.referenceLineDataLabelHorizontalPosition.left), dataLabelVerticalPosition = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.dataLabelVerticalPosition, visuals.referenceLineDataLabelVerticalPosition.above), dataLabelDecimalPoints = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.dataLabelDecimalPoints, void 0) < 0 ? void 0 : powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.dataLabelDecimalPoints, void 0), dataLabelDisplayUnits = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.dataLabelDisplayUnits, 0);
|
10117 | instance.properties[ReferenceLineHelper.referenceLineProps.dataLabelColor] = dataLabelColor,
|
10118 | instance.properties[ReferenceLineHelper.referenceLineProps.dataLabelHorizontalPosition] = dataLabelHorizontalPosition,
|
10119 | instance.properties[ReferenceLineHelper.referenceLineProps.dataLabelVerticalPosition] = dataLabelVerticalPosition,
|
10120 | instance.properties[ReferenceLineHelper.referenceLineProps.dataLabelDisplayUnits] = dataLabelDisplayUnits,
|
10121 | instance.properties[ReferenceLineHelper.referenceLineProps.dataLabelDecimalPoints] = dataLabelDecimalPoints;
|
10122 | }
|
10123 | enumeration.pushInstance(instance);
|
10124 | }
|
10125 | }
|
10126 | function render(options) {
|
10127 | var graphicContext = options.graphicContext, axes = options.axes, referenceLineProperties = options.referenceLineProperties, isHorizontal = options.isHorizontal, viewport = options.viewport, classAndSelector = options.classAndSelector, xScale = axes.x.scale, yScale = axes.y1.scale, refValue = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.value, 0), lineColor = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.lineColor, {
|
10128 | solid: {
|
10129 | color: options.defaultColor
|
10130 | }
|
10131 | }), transparency = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.transparency), style = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.style, visuals.lineStyle.dashed), position = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.position, visuals.referenceLinePosition.back), refLine = graphicContext.select(classAndSelector.selector), index = $(refLine[0]).index(), currentPosition = index > 1 ? visuals.referenceLinePosition.front : visuals.referenceLinePosition.back, isRefLineExists = -1 !== index, isPositionChanged = currentPosition !== position;
|
10132 | isRefLineExists && isPositionChanged && refLine.remove(), isRefLineExists && !isPositionChanged || (refLine = position === visuals.referenceLinePosition.back ? graphicContext.insert("line", ":first-child") : graphicContext.append("line"));
|
10133 | var refLineX1 = isHorizontal ? 0 : xScale(refValue), refLineY1 = isHorizontal ? yScale(refValue) : 0, refLineX2 = isHorizontal ? viewport.width : xScale(refValue), refLineY2 = isHorizontal ? yScale(refValue) : viewport.height;
|
10134 | refLine.attr({
|
10135 | "class": classAndSelector["class"],
|
10136 | x1: refLineX1,
|
10137 | y1: refLineY1,
|
10138 | x2: refLineX2,
|
10139 | y2: refLineY2
|
10140 | }).style({
|
10141 | stroke: lineColor.solid.color
|
10142 | }), null != transparency && refLine.style("stroke-opacity", (100 - transparency) / 100),
|
10143 | style === visuals.lineStyle.dashed ? refLine.style("stroke-dasharray", "5, 5") : style === visuals.lineStyle.dotted ? refLine.style({
|
10144 | "stroke-dasharray": "1, 5",
|
10145 | "stroke-linecap": "round"
|
10146 | }) : style === visuals.lineStyle.solid && refLine.style({
|
10147 | "stroke-dasharray": null,
|
10148 | "stroke-linecap": null
|
10149 | });
|
10150 | }
|
10151 | function createLabelDataPoint(options) {
|
10152 | var offsetRefLine = 5, axes = options.axes, referenceLineProperties = options.referenceLineProperties, isHorizontal = options.isHorizontal, viewport = options.viewport, xScale = axes.x.scale, yScale = axes.y1.scale, refValue = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.value, 0), color = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.dataLabelColor, {
|
10153 | solid: {
|
10154 | color: options.defaultColor
|
10155 | }
|
10156 | }), decimalPoints = referenceLineProperties[ReferenceLineHelper.referenceLineProps.dataLabelDecimalPoints] < 0 ? void 0 : referenceLineProperties[ReferenceLineHelper.referenceLineProps.dataLabelDecimalPoints], horizontalPosition = referenceLineProperties[ReferenceLineHelper.referenceLineProps.dataLabelHorizontalPosition] || visuals.referenceLineDataLabelHorizontalPosition.left, verticalPosition = referenceLineProperties[ReferenceLineHelper.referenceLineProps.dataLabelVerticalPosition] || visuals.referenceLineDataLabelVerticalPosition.above, displayUnits = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.dataLabelDisplayUnits, 0), axisFormatter = isHorizontal ? axes.y1.formatter : axes.x.formatter, formatterForReferenceLineDataLabel = axisFormatter;
|
10157 | if (null != axisFormatter.options) {
|
10158 | var formatterOptions = powerbi.Prototype.inherit(axisFormatter.options);
|
10159 | formatterOptions.precision = decimalPoints, formatterOptions.value = displayUnits,
|
10160 | formatterOptions.detectAxisPrecision = !1, formatterForReferenceLineDataLabel = visuals.valueFormatter.create(formatterOptions);
|
10161 | }
|
10162 | var dataLabelX, dataLabelY, text = visuals.NewDataLabelUtils.getLabelFormattedText(formatterForReferenceLineDataLabel.format(refValue)), properties = {
|
10163 | text: text,
|
10164 | fontFamily: visuals.dataLabelUtils.LabelTextProperties.fontFamily,
|
10165 | fontSize: visuals.dataLabelUtils.LabelTextProperties.fontSize,
|
10166 | fontWeight: visuals.dataLabelUtils.LabelTextProperties.fontWeight
|
10167 | }, rectWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), rectHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties), x1 = isHorizontal ? 0 : xScale(refValue), y1 = isHorizontal ? yScale(refValue) : 0, x2 = isHorizontal ? viewport.width : xScale(refValue), y2 = isHorizontal ? yScale(refValue) : viewport.height, validPositions = [ 1 ];
|
10168 | isHorizontal ? (dataLabelX = horizontalPosition === visuals.referenceLineDataLabelHorizontalPosition.left ? x1 + offsetRefLine : x2 - rectWidth / 2 - offsetRefLine,
|
10169 | dataLabelY = y1, validPositions = verticalPosition === visuals.referenceLineDataLabelVerticalPosition.above ? [ 1 ] : [ 2 ]) : (dataLabelX = x1,
|
10170 | dataLabelY = verticalPosition === visuals.referenceLineDataLabelVerticalPosition.above ? y1 + rectHeight / 2 + offsetRefLine : y2 - rectHeight / 2 - offsetRefLine,
|
10171 | validPositions = horizontalPosition === visuals.referenceLineDataLabelHorizontalPosition.left ? [ 4 ] : [ 8 ]);
|
10172 | var parentShape, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties, !0);
|
10173 | return parentShape = {
|
10174 | point: {
|
10175 | x: dataLabelX,
|
10176 | y: dataLabelY
|
10177 | },
|
10178 | radius: 0,
|
10179 | validPositions: validPositions
|
10180 | }, {
|
10181 | isPreferred: !0,
|
10182 | text: text,
|
10183 | textSize: {
|
10184 | width: textWidth,
|
10185 | height: textHeight
|
10186 | },
|
10187 | outsideFill: color.solid.color,
|
10188 | insideFill: null,
|
10189 | parentShape: parentShape,
|
10190 | parentType: 0,
|
10191 | fontSize: 9,
|
10192 | identity: null,
|
10193 | secondRowText: null,
|
10194 | key: options.key
|
10195 | };
|
10196 | }
|
10197 | function extractReferenceLineValue(referenceLineProperties) {
|
10198 | var referenceLineValue = null;
|
10199 | return referenceLineProperties && powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.show, !1) && (referenceLineValue = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.value, null)),
|
10200 | referenceLineValue;
|
10201 | }
|
10202 | ReferenceLineHelper.referenceLineProps = {
|
10203 | show: "show",
|
10204 | lineColor: "lineColor",
|
10205 | transparency: "transparency",
|
10206 | value: "value",
|
10207 | style: "style",
|
10208 | position: "position",
|
10209 | dataLabelShow: "dataLabelShow",
|
10210 | dataLabelColor: "dataLabelColor",
|
10211 | dataLabelDecimalPoints: "dataLabelDecimalPoints",
|
10212 | dataLabelHorizontalPosition: "dataLabelHorizontalPosition",
|
10213 | dataLabelVerticalPosition: "dataLabelVerticalPosition",
|
10214 | dataLabelDisplayUnits: "dataLabelDisplayUnits"
|
10215 | }, ReferenceLineHelper.enumerateObjectInstances = enumerateObjectInstances, ReferenceLineHelper.render = render,
|
10216 | ReferenceLineHelper.createLabelDataPoint = createLabelDataPoint, ReferenceLineHelper.extractReferenceLineValue = extractReferenceLineValue;
|
10217 | }(ReferenceLineHelper = visuals.ReferenceLineHelper || (visuals.ReferenceLineHelper = {}));
|
10218 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
10219 | }(powerbi || (powerbi = {}));
|
10220 | }, function(module, exports) {
|
10221 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
10222 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
10223 | !function(powerbi) {
|
10224 | var visuals;
|
10225 | !function(visuals) {
|
10226 | var InteractivityUtils;
|
10227 | !function(InteractivityUtils) {
|
10228 | function getPositionOfLastInputEvent() {
|
10229 | return {
|
10230 | x: d3.event.clientX,
|
10231 | y: d3.event.clientY
|
10232 | };
|
10233 | }
|
10234 | function registerStandardInteractivityHandlers(selection, selectionHandler) {
|
10235 | registerStandardSelectionHandler(selection, selectionHandler), registerStandardContextMenuHandler(selection, selectionHandler);
|
10236 | }
|
10237 | function registerStandardSelectionHandler(selection, selectionHandler) {
|
10238 | selection.on("click", function(d) {
|
10239 | return handleSelection(d, selectionHandler);
|
10240 | });
|
10241 | }
|
10242 | function registerStandardContextMenuHandler(selection, selectionHandler) {
|
10243 | selection.on("contextmenu", function(d) {
|
10244 | return handleContextMenu(d, selectionHandler);
|
10245 | });
|
10246 | }
|
10247 | function registerGroupInteractivityHandlers(group, selectionHandler) {
|
10248 | registerGroupSelectionHandler(group, selectionHandler), registerGroupContextMenuHandler(group, selectionHandler);
|
10249 | }
|
10250 | function registerGroupSelectionHandler(group, selectionHandler) {
|
10251 | group.on("click", function() {
|
10252 | var target = d3.event.target, d = d3.select(target).datum();
|
10253 | handleSelection(d, selectionHandler);
|
10254 | });
|
10255 | }
|
10256 | function registerGroupContextMenuHandler(group, selectionHandler) {
|
10257 | group.on("contextmenu", function() {
|
10258 | var target = d3.event.target, d = d3.select(target).datum();
|
10259 | handleContextMenu(d, selectionHandler);
|
10260 | });
|
10261 | }
|
10262 | function handleContextMenu(d, selectionHandler) {
|
10263 | if (!d3.event.ctrlKey) {
|
10264 | d3.event.preventDefault();
|
10265 | var position = InteractivityUtils.getPositionOfLastInputEvent();
|
10266 | selectionHandler.handleContextMenu(d, position);
|
10267 | }
|
10268 | }
|
10269 | function handleSelection(d, selectionHandler) {
|
10270 | selectionHandler.handleSelection(d, d3.event.ctrlKey);
|
10271 | }
|
10272 | InteractivityUtils.getPositionOfLastInputEvent = getPositionOfLastInputEvent, InteractivityUtils.registerStandardInteractivityHandlers = registerStandardInteractivityHandlers,
|
10273 | InteractivityUtils.registerStandardSelectionHandler = registerStandardSelectionHandler,
|
10274 | InteractivityUtils.registerStandardContextMenuHandler = registerStandardContextMenuHandler,
|
10275 | InteractivityUtils.registerGroupInteractivityHandlers = registerGroupInteractivityHandlers,
|
10276 | InteractivityUtils.registerGroupSelectionHandler = registerGroupSelectionHandler,
|
10277 | InteractivityUtils.registerGroupContextMenuHandler = registerGroupContextMenuHandler;
|
10278 | }(InteractivityUtils = visuals.InteractivityUtils || (visuals.InteractivityUtils = {}));
|
10279 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
10280 | }(powerbi || (powerbi = {}));
|
10281 | }, function(module, exports) {
|
10282 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
10283 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
10284 | !function(powerbi) {
|
10285 | var visuals;
|
10286 | !function(visuals) {
|
10287 | function getInvalidValueWarnings(dataViews, supportsNaN, supportsNegativeInfinity, supportsPositiveInfinity) {
|
10288 | var checker = new InvalidDataValuesChecker(supportsNaN, supportsNegativeInfinity, supportsPositiveInfinity);
|
10289 | return checker.getWarningMessages(dataViews);
|
10290 | }
|
10291 | visuals.getInvalidValueWarnings = getInvalidValueWarnings;
|
10292 | var InvalidDataValuesChecker = function() {
|
10293 | function InvalidDataValuesChecker(supportsNaN, supportsNegativeInfinity, supportsPositiveInfinity) {
|
10294 | this.supportsNaN = supportsNaN, this.supportsNegativeInfinity = supportsNegativeInfinity,
|
10295 | this.supportsPositiveInfinity = supportsPositiveInfinity;
|
10296 | }
|
10297 | return InvalidDataValuesChecker.prototype.getWarningMessages = function(dataViews) {
|
10298 | this.loadWarningStatus(dataViews);
|
10299 | var warnings = [];
|
10300 | return this.hasNaN && !this.supportsNaN && warnings.push(new visuals.NaNNotSupportedWarning()),
|
10301 | (this.hasNegativeInfinity && !this.supportsNegativeInfinity || this.hasPositiveInfinity && !this.supportsPositiveInfinity) && warnings.push(new visuals.InfinityValuesNotSupportedWarning()),
|
10302 | this.hasOutOfRange && warnings.push(new visuals.ValuesOutOfRangeWarning()), warnings;
|
10303 | }, InvalidDataValuesChecker.prototype.loadWarningStatus = function(dataViews) {
|
10304 | this.hasNaN = !1, this.hasNegativeInfinity = !1, this.hasOutOfRange = !1, this.hasPositiveInfinity = !1;
|
10305 | for (var k = 0; k < dataViews.length; k++) {
|
10306 | var dataView = dataViews[k], values = dataView && dataView.categorical && dataView.categorical.values ? dataView.categorical.values : null;
|
10307 | if (!values) return;
|
10308 | for (var valueLength = values.length, i = 0; valueLength > i; i++) {
|
10309 | var value = values[i];
|
10310 | if (value.values) for (var valueValueLength = value.values.length, j = 0; valueValueLength > j; j++) {
|
10311 | var v = value.values[j];
|
10312 | isNaN(v) ? this.hasNaN = !0 : v === Number.POSITIVE_INFINITY ? this.hasPositiveInfinity = !0 : v === Number.NEGATIVE_INFINITY ? this.hasNegativeInfinity = !0 : (-1e300 > v || v > 1e300) && (this.hasOutOfRange = !0);
|
10313 | }
|
10314 | }
|
10315 | }
|
10316 | }, InvalidDataValuesChecker;
|
10317 | }();
|
10318 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
10319 | }(powerbi || (powerbi = {}));
|
10320 | }, function(module, exports) {
|
10321 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
10322 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
10323 | !function(powerbi) {
|
10324 | var visuals;
|
10325 | !function(visuals) {
|
10326 | var ListViewFactory;
|
10327 | !function(ListViewFactory) {
|
10328 | function createListView(options) {
|
10329 | return new ListView(options);
|
10330 | }
|
10331 | ListViewFactory.createListView = createListView;
|
10332 | }(ListViewFactory = visuals.ListViewFactory || (visuals.ListViewFactory = {}));
|
10333 | var ListView = function() {
|
10334 | function ListView(options) {
|
10335 | var _this = this;
|
10336 | this.options = $.extend(!0, {}, options), this.scrollbarInner = options.baseContainer.append("div").classed("scrollbar-inner", !0).on("scroll", function() {
|
10337 | return _this.renderImpl(_this.options.rowHeight);
|
10338 | }), this.scrollContainer = this.scrollbarInner.append("div").classed("scrollRegion", !0).on("touchstart", function() {
|
10339 | return _this.stopTouchPropagation();
|
10340 | }).on("touchmove", function() {
|
10341 | return _this.stopTouchPropagation();
|
10342 | }), this.visibleGroupContainer = this.scrollContainer.append("div").classed("visibleGroup", !0),
|
10343 | $(options.baseContainer.node()).find(".scroll-element").attr("drag-resize-disabled", "true"),
|
10344 | ListView.SetDefaultOptions(options);
|
10345 | }
|
10346 | return ListView.SetDefaultOptions = function(options) {
|
10347 | options.rowHeight = options.rowHeight || ListView.defaultRowHeight;
|
10348 | }, ListView.prototype.rowHeight = function(rowHeight) {
|
10349 | return this.options.rowHeight = Math.ceil(rowHeight), this;
|
10350 | }, ListView.prototype.data = function(data, getDatumIndex, dataReset) {
|
10351 | return void 0 === dataReset && (dataReset = !1), this._data = data, this.getDatumIndex = getDatumIndex,
|
10352 | this.setTotalRows(), dataReset && $(this.scrollbarInner.node()).scrollTop(0), this.render(),
|
10353 | this;
|
10354 | }, ListView.prototype.viewport = function(viewport) {
|
10355 | return this.options.viewport = viewport, this.render(), this;
|
10356 | }, ListView.prototype.empty = function() {
|
10357 | this._data = [], this.render();
|
10358 | }, ListView.prototype.render = function() {
|
10359 | var _this = this;
|
10360 | this.renderTimeoutId && window.clearTimeout(this.renderTimeoutId), this.renderTimeoutId = window.setTimeout(function() {
|
10361 | _this.getRowHeight().then(function(rowHeight) {
|
10362 | _this.renderImpl(rowHeight);
|
10363 | }), _this.renderTimeoutId = void 0;
|
10364 | }, 0);
|
10365 | }, ListView.prototype.renderImpl = function(rowHeight) {
|
10366 | var totalHeight = this.options.scrollEnabled ? Math.max(0, this._totalRows * rowHeight) : this.options.viewport.height;
|
10367 | this.scrollContainer.style("height", totalHeight + "px").attr("height", totalHeight),
|
10368 | this.scrollToFrame(!0);
|
10369 | }, ListView.prototype.stopTouchPropagation = function() {
|
10370 | if (this.options.isReadMode()) {
|
10371 | if ("touchstart" === d3.event.type) {
|
10372 | var event_1 = d3.event;
|
10373 | event_1.touches && 1 === event_1.touches.length && d3.event.stopPropagation();
|
10374 | }
|
10375 | "touchmove" === d3.event.type && d3.event.stopPropagation();
|
10376 | }
|
10377 | }, ListView.prototype.scrollToFrame = function(loadMoreData) {
|
10378 | var options = this.options, visibleGroupContainer = this.visibleGroupContainer, totalRows = this._totalRows, rowHeight = options.rowHeight || ListView.defaultRowHeight, visibleRows = this.getVisibleRows(), scrollTop = this.scrollbarInner.node().scrollTop, scrollPosition = 0 === scrollTop ? 0 : Math.floor(scrollTop / rowHeight), transformAttr = visuals.SVGUtil.translateWithPixels(0, scrollPosition * rowHeight);
|
10379 | visibleGroupContainer.style({
|
10380 | transform: function(d) {
|
10381 | return transformAttr;
|
10382 | },
|
10383 | "-webkit-transform": transformAttr
|
10384 | });
|
10385 | var position0 = Math.max(0, Math.min(scrollPosition, totalRows - visibleRows + 1)), position1 = position0 + visibleRows, rowSelection = visibleGroupContainer.selectAll(".row").data(this._data.slice(position0, Math.min(position1, totalRows)), this.getDatumIndex);
|
10386 | rowSelection.enter().append("div").classed("row", !0).call(function(d) {
|
10387 | return options.enter(d);
|
10388 | }), rowSelection.order();
|
10389 | var rowUpdateSelection = visibleGroupContainer.selectAll(".row:not(.transitioning)");
|
10390 | rowUpdateSelection.call(function(d) {
|
10391 | return options.update(d);
|
10392 | }), rowSelection.exit().call(function(d) {
|
10393 | return options.exit(d);
|
10394 | }).remove(), loadMoreData && visibleRows !== totalRows && position1 >= totalRows * ListView.loadMoreDataThreshold && options.loadMoreData();
|
10395 | }, ListView.prototype.setTotalRows = function() {
|
10396 | var data = this._data;
|
10397 | this._totalRows = data ? data.length : 0;
|
10398 | }, ListView.prototype.getVisibleRows = function() {
|
10399 | var minimumVisibleRows = 1, options = this.options, rowHeight = options.rowHeight, viewportHeight = options.viewport.height;
|
10400 | if (!rowHeight || 1 > rowHeight) return minimumVisibleRows;
|
10401 | var viewportRowCount = viewportHeight / rowHeight;
|
10402 | return this.options.scrollEnabled ? Math.min(Math.ceil(viewportRowCount) + 1, this._totalRows) || minimumVisibleRows : Math.min(Math.floor(viewportRowCount), this._totalRows) || minimumVisibleRows;
|
10403 | }, ListView.prototype.getRowHeight = function() {
|
10404 | var deferred = $.Deferred(), listView = this, options = listView.options;
|
10405 | if (this.cancelMeasurePass && this.cancelMeasurePass(), !(this._data && this._data.length && options)) return listView.rowHeight(ListView.defaultRowHeight),
|
10406 | deferred.resolve(options.rowHeight).promise();
|
10407 | this.scrollToFrame(!1);
|
10408 | var requestAnimationFrameId = window.requestAnimationFrame(function() {
|
10409 | var rows = listView.visibleGroupContainer.select(".row");
|
10410 | if (!rows.empty()) {
|
10411 | var firstRow = rows.node(), rowHeight = Math.max($(firstRow).outerHeight(!0), $(firstRow).children().first().outerHeight(!0));
|
10412 | listView.rowHeight(rowHeight), deferred.resolve(rowHeight);
|
10413 | }
|
10414 | listView.cancelMeasurePass = void 0, window.cancelAnimationFrame(requestAnimationFrameId);
|
10415 | });
|
10416 | return this.cancelMeasurePass = function() {
|
10417 | window.cancelAnimationFrame(requestAnimationFrameId), deferred.reject();
|
10418 | }, deferred.promise();
|
10419 | }, ListView.loadMoreDataThreshold = .8, ListView.defaultRowHeight = 1, ListView;
|
10420 | }();
|
10421 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
10422 | }(powerbi || (powerbi = {}));
|
10423 | }, function(module, exports) {
|
10424 | var powerbi, powerbi = (window.jsCommon, window.powerbi), Microsoft = (window.powerbitests,
|
10425 | window.InJs, window.debug, window.jasmine, window.Microsoft);
|
10426 | !function(powerbi) {
|
10427 | var visuals;
|
10428 | !function(visuals) {
|
10429 | var MapUtil, defaultLevelOfDetail = 11;
|
10430 | !function(MapUtil) {
|
10431 | function clip(n, minValue, maxValue) {
|
10432 | return Math.min(Math.max(n, minValue), maxValue);
|
10433 | }
|
10434 | function getMapSize(levelOfDetail) {
|
10435 | return 23 === levelOfDetail ? 2147483648 : Math.floor(levelOfDetail) === levelOfDetail ? 256 << levelOfDetail : 256 * Math.pow(2, levelOfDetail);
|
10436 | }
|
10437 | function latLongToPixelXYArray(latLongArray, levelOfDetail, buildString) {
|
10438 | void 0 === buildString && (buildString = !1);
|
10439 | for (var helperArray = [], result = {
|
10440 | array: new Float64Array(latLongArray.length),
|
10441 | arrayString: ""
|
10442 | }, i = 0; i < latLongArray.length; i += 2) {
|
10443 | var latitude = clip(latLongArray[i], MapUtil.MinAllowedLatitude, MapUtil.MaxAllowedLatitude), longitude = clip(latLongArray[i + 1], MapUtil.MinAllowedLongitude, MapUtil.MaxAllowedLongitude), x = (longitude + 180) / 360, sinLatitude = Math.sin(latitude * Math.PI / 180), y = .5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI), mapSize = getMapSize(levelOfDetail);
|
10444 | result.array[i] = clip(x * mapSize + .5, 0, mapSize - 1), result.array[i + 1] = clip(y * mapSize + .5, 0, mapSize - 1),
|
10445 | buildString && (helperArray.push(result.array[i], result.array[i + 1]), helperArray.length >= pointArrayChunkLength && (result.arrayString += helperArray.join(" ") + " ",
|
10446 | helperArray = []));
|
10447 | }
|
10448 | return buildString && (result.arrayString += helperArray.join(" ") + " "), result;
|
10449 | }
|
10450 | function getLocationBoundaries(latLongArray) {
|
10451 | for (var northWest = {
|
10452 | latitude: -90,
|
10453 | longitude: 180
|
10454 | }, southEast = {
|
10455 | latitude: 90,
|
10456 | longitude: -180
|
10457 | }, i = 0; i < latLongArray.length; i += 2) northWest.latitude = Math.max(latLongArray[i], northWest.latitude),
|
10458 | northWest.longitude = Math.min(latLongArray[i + 1], northWest.longitude), southEast.latitude = Math.min(latLongArray[i], southEast.latitude),
|
10459 | southEast.longitude = Math.max(latLongArray[i + 1], southEast.longitude);
|
10460 | return northWest.longitude = clip(northWest.longitude, -180, 180), southEast.longitude = clip(southEast.longitude, -180, 180),
|
10461 | Microsoft.Maps.LocationRect.fromCorners(new Microsoft.Maps.Location(northWest.latitude, northWest.longitude), new Microsoft.Maps.Location(southEast.latitude, southEast.longitude));
|
10462 | }
|
10463 | function parseEncodedSpatialValueArray(value) {
|
10464 | for (var list = [], index = 0, xsum = 0, ysum = 0, max = 4294967296; index < value.length; ) {
|
10465 | for (var n = 0, k = 0; ;) {
|
10466 | if (index >= value.length) return null;
|
10467 | var b = safeCharacters.indexOf(value.charAt(index++));
|
10468 | if (-1 === b) return null;
|
10469 | var tmp = (31 & b) * Math.pow(2, k), ht = tmp / max, lt = tmp % max, hn = n / max, ln = n % max, nl = (lt | ln) >>> 0;
|
10470 | if (n = (ht | hn) * max + nl, k += 5, 32 > b) break;
|
10471 | }
|
10472 | var diagonal = Math.floor((Math.sqrt(8 * n + 5) - 1) / 2);
|
10473 | n -= diagonal * (diagonal + 1) / 2;
|
10474 | var ny = Math.floor(n), nx = diagonal - ny;
|
10475 | nx = nx >> 1 ^ -(1 & nx), ny = ny >> 1 ^ -(1 & ny), xsum += nx, ysum += ny;
|
10476 | var lat = 1e-5 * ysum, lon = 1e-5 * xsum;
|
10477 | list.push(lat), list.push(lon);
|
10478 | }
|
10479 | return new Float64Array(list);
|
10480 | }
|
10481 | function calcGeoData(data) {
|
10482 | for (var locations = data.locations, i = 0; i < locations.length; i++) {
|
10483 | var location_1 = locations[i];
|
10484 | location_1.geographic || (location_1.geographic = MapUtil.parseEncodedSpatialValueArray(location_1.nativeBing));
|
10485 | var polygon = location_1.geographic;
|
10486 | if (polygon && !location_1.absolute) {
|
10487 | var result = MapUtil.latLongToPixelXYArray(polygon, MapUtil.DefaultLevelOfDetail, !0);
|
10488 | location_1.absolute = result.array, location_1.absoluteString = result.arrayString;
|
10489 | var geographicBounds = MapUtil.getLocationBoundaries(polygon);
|
10490 | location_1.absoluteBounds = MapUtil.locationRectToRectXY(geographicBounds, MapUtil.DefaultLevelOfDetail);
|
10491 | }
|
10492 | }
|
10493 | }
|
10494 | function locationToPixelXY(location, levelOfDetail) {
|
10495 | return latLongToPixelXY(location.latitude, location.longitude, levelOfDetail);
|
10496 | }
|
10497 | function locationRectToRectXY(locationRect, levelOfDetail) {
|
10498 | var topleft = locationToPixelXY(locationRect.getNorthwest(), levelOfDetail), bottomRight = locationToPixelXY(locationRect.getSoutheast(), levelOfDetail);
|
10499 | return new powerbi.visuals.Rect(topleft.x, topleft.y, bottomRight.x - topleft.x, bottomRight.y - topleft.y);
|
10500 | }
|
10501 | function latLongToPixelXY(latitude, longitude, levelOfDetail) {
|
10502 | var array = latLongToPixelXYArray(new Float64Array([ latitude, longitude ]), levelOfDetail).array;
|
10503 | return new powerbi.visuals.Point(array[0], array[1]);
|
10504 | }
|
10505 | function pixelXYToLocation(pixelX, pixelY, levelOfDetail) {
|
10506 | var mapSize = getMapSize(levelOfDetail), x = clip(pixelX, 0, mapSize - 1) / mapSize - .5, y = .5 - clip(pixelY, 0, mapSize - 1) / mapSize, latitude = 90 - 360 * Math.atan(Math.exp(2 * -y * Math.PI)) / Math.PI, longitude = 360 * x;
|
10507 | return new Microsoft.Maps.Location(latitude, longitude);
|
10508 | }
|
10509 | MapUtil.Settings = {
|
10510 | MaxBingRequest: 6,
|
10511 | MaxCacheSize: 3e3,
|
10512 | MaxCacheSizeOverflow: 100,
|
10513 | BingKey: "insert your key",
|
10514 | BingUrl: "https://dev.virtualearth.net/REST/v1/Locations",
|
10515 | BingUrlGeodata: "https://platform.bing.com/geo/spatial/v1/public/Geodata?",
|
10516 | UseDoubleArrayGeodataResult: !0,
|
10517 | UseDoubleArrayDequeueTimeout: 0
|
10518 | }, MapUtil.MinAllowedLatitude = -85.05112878, MapUtil.MaxAllowedLatitude = 85.05112878,
|
10519 | MapUtil.MinAllowedLongitude = -180, MapUtil.MaxAllowedLongitude = 180, MapUtil.TileSize = 256,
|
10520 | MapUtil.MaxLevelOfDetail = 23, MapUtil.MinLevelOfDetail = 1, MapUtil.MaxAutoZoomLevel = 5,
|
10521 | MapUtil.DefaultLevelOfDetail = 11, MapUtil.WorkerErrorName = "___error___", MapUtil.CategoryTypes = {
|
10522 | Address: "Address",
|
10523 | City: "City",
|
10524 | Continent: "Continent",
|
10525 | CountryRegion: "Country",
|
10526 | County: "County",
|
10527 | Longitude: "Longitude",
|
10528 | Latitude: "Latitude",
|
10529 | Place: "Place",
|
10530 | PostalCode: "PostalCode",
|
10531 | StateOrProvince: "StateOrProvince"
|
10532 | };
|
10533 | var safeCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
|
10534 | MapUtil.clip = clip, MapUtil.getMapSize = getMapSize;
|
10535 | var pointArrayChunkLength = 15e3;
|
10536 | MapUtil.latLongToPixelXYArray = latLongToPixelXYArray, MapUtil.getLocationBoundaries = getLocationBoundaries,
|
10537 | MapUtil.parseEncodedSpatialValueArray = parseEncodedSpatialValueArray, MapUtil.calcGeoData = calcGeoData,
|
10538 | MapUtil.locationToPixelXY = locationToPixelXY, MapUtil.locationRectToRectXY = locationRectToRectXY,
|
10539 | MapUtil.latLongToPixelXY = latLongToPixelXY, MapUtil.pixelXYToLocation = pixelXYToLocation;
|
10540 | var CurrentLocation;
|
10541 | !function(CurrentLocation) {
|
10542 | function createPushpin(location) {
|
10543 | var template = '<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle fill="#FF5F00" cx="12" cy="12" r="6"/><circle fill="none" stroke="#FF5F00" stroke-width="2" cx="12" cy="12" r="10"/></svg>', options = {
|
10544 | draggable: !1,
|
10545 | htmlContent: template,
|
10546 | height: 24,
|
10547 | width: 24
|
10548 | };
|
10549 | return new Microsoft.Maps.Pushpin(location, options);
|
10550 | }
|
10551 | CurrentLocation.createPushpin = createPushpin;
|
10552 | }(CurrentLocation = MapUtil.CurrentLocation || (MapUtil.CurrentLocation = {}));
|
10553 | }(MapUtil = visuals.MapUtil || (visuals.MapUtil = {}));
|
10554 | var MapPolygonInfo = function() {
|
10555 | function MapPolygonInfo() {
|
10556 | this._locationRect = new Microsoft.Maps.LocationRect(new Microsoft.Maps.Location(30, -30), 60, 60);
|
10557 | }
|
10558 | return MapPolygonInfo.prototype.reCalc = function(mapControl, width, height) {
|
10559 | var baseLocations = [ this._locationRect.getNorthwest(), this._locationRect.getSoutheast() ];
|
10560 | if (width /= 2, height /= 2, !this._baseRect) {
|
10561 | var l0 = MapUtil.locationToPixelXY(this._locationRect.getNorthwest(), defaultLevelOfDetail), l1 = MapUtil.locationToPixelXY(this._locationRect.getSoutheast(), defaultLevelOfDetail);
|
10562 | this._baseRect = new visuals.Rect(l0.x, l0.y, l1.x - l0.x, l1.y - l0.y);
|
10563 | }
|
10564 | var l = mapControl.tryLocationToPixel(baseLocations);
|
10565 | this._currentRect = new visuals.Rect(l[0].x + width, l[0].y + height, l[1].x - l[0].x, l[1].y - l[0].y);
|
10566 | }, Object.defineProperty(MapPolygonInfo.prototype, "scale", {
|
10567 | get: function() {
|
10568 | return this._baseRect ? this._currentRect.width / this._baseRect.width : 1;
|
10569 | },
|
10570 | enumerable: !0,
|
10571 | configurable: !0
|
10572 | }), Object.defineProperty(MapPolygonInfo.prototype, "transform", {
|
10573 | get: function() {
|
10574 | var base = this._baseRect, current = this._currentRect, transform = new visuals.Transform();
|
10575 | return transform.translate(current.left, current.top), transform.scale(current.width / base.width, current.height / base.height),
|
10576 | transform.translate(-base.left, -base.top), transform;
|
10577 | },
|
10578 | enumerable: !0,
|
10579 | configurable: !0
|
10580 | }), Object.defineProperty(MapPolygonInfo.prototype, "outherTransform", {
|
10581 | get: function() {
|
10582 | var base = this._baseRect, current = this._currentRect, transform = new visuals.Transform();
|
10583 | transform.translate(current.left, current.top);
|
10584 | var scale = Math.sqrt(current.width / base.width);
|
10585 | return transform.scale(scale, scale), transform;
|
10586 | },
|
10587 | enumerable: !0,
|
10588 | configurable: !0
|
10589 | }), MapPolygonInfo.prototype.setViewBox = function(svg) {
|
10590 | var rect = svg.getBoundingClientRect(), current = this._currentRect;
|
10591 | svg.setAttribute("viewBox", [ -current.left, -current.top, rect.width, rect.height ].join(" "));
|
10592 | }, Object.defineProperty(MapPolygonInfo.prototype, "innerTransform", {
|
10593 | get: function() {
|
10594 | var base = this._baseRect, current = this._currentRect, transform = new visuals.Transform(), scale = current.width / base.width;
|
10595 | return transform.scale(scale, scale), transform.translate(-base.left, -base.top),
|
10596 | transform;
|
10597 | },
|
10598 | enumerable: !0,
|
10599 | configurable: !0
|
10600 | }), MapPolygonInfo.prototype.transformToString = function(transform) {
|
10601 | var m = transform.matrix;
|
10602 | return "matrix(" + m.m00 + " " + m.m10 + " " + m.m01 + " " + m.m11 + " " + m.m02 + " " + m.m12 + ")";
|
10603 | }, MapPolygonInfo;
|
10604 | }();
|
10605 | visuals.MapPolygonInfo = MapPolygonInfo;
|
10606 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
10607 | }(powerbi || (powerbi = {}));
|
10608 | }, function(module, exports) {
|
10609 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
10610 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
10611 | !function(powerbi) {
|
10612 | var visuals;
|
10613 | !function(visuals) {
|
10614 | var utility;
|
10615 | !function(utility) {
|
10616 | var SelectionManager = function() {
|
10617 | function SelectionManager(options) {
|
10618 | this.hostServices = options.hostServices, this.selectedIds = [];
|
10619 | }
|
10620 | return SelectionManager.prototype.select = function(selectionId, multiSelect) {
|
10621 | void 0 === multiSelect && (multiSelect = !1);
|
10622 | var deferred = $.Deferred();
|
10623 | return this.hostServices.shouldRetainSelection() ? this.sendSelectionToHost([ selectionId ]) : (this.selectInternal(selectionId, multiSelect),
|
10624 | this.sendSelectionToHost(this.selectedIds)), deferred.resolve(this.selectedIds),
|
10625 | deferred;
|
10626 | }, SelectionManager.prototype.showContextMenu = function(selectionId, position) {
|
10627 | var deferred = $.Deferred();
|
10628 | return position = position || visuals.InteractivityUtils.getPositionOfLastInputEvent(),
|
10629 | this.sendContextMenuToHost(selectionId, position), deferred.resolve(), deferred;
|
10630 | }, SelectionManager.prototype.hasSelection = function() {
|
10631 | return this.selectedIds.length > 0;
|
10632 | }, SelectionManager.prototype.clear = function() {
|
10633 | var deferred = $.Deferred();
|
10634 | return this.selectedIds = [], this.sendSelectionToHost([]), deferred.resolve(),
|
10635 | deferred;
|
10636 | }, SelectionManager.prototype.getSelectionIds = function() {
|
10637 | return this.selectedIds;
|
10638 | }, SelectionManager.prototype.sendSelectionToHost = function(ids) {
|
10639 | var selectArgs = {
|
10640 | data: ids.filter(function(value) {
|
10641 | return value.hasIdentity();
|
10642 | }).map(function(value) {
|
10643 | return value.getSelector();
|
10644 | })
|
10645 | }, data2 = this.getSelectorsByColumn(ids);
|
10646 | _.isEmpty(data2) || (selectArgs.data2 = data2), this.hostServices.onSelect(selectArgs);
|
10647 | }, SelectionManager.prototype.sendContextMenuToHost = function(selectionId, position) {
|
10648 | var selectors = this.getSelectorsByColumn([ selectionId ]);
|
10649 | if (!_.isEmpty(selectors)) {
|
10650 | var args = {
|
10651 | data: selectors,
|
10652 | position: position
|
10653 | };
|
10654 | this.hostServices.onContextMenu(args);
|
10655 | }
|
10656 | }, SelectionManager.prototype.getSelectorsByColumn = function(selectionIds) {
|
10657 | return _(selectionIds).filter(function(value) {
|
10658 | return value.hasIdentity;
|
10659 | }).map(function(value) {
|
10660 | return value.getSelectorsByColumn();
|
10661 | }).compact().value();
|
10662 | }, SelectionManager.prototype.selectInternal = function(selectionId, multiSelect) {
|
10663 | SelectionManager.containsSelection(this.selectedIds, selectionId) ? this.selectedIds = multiSelect ? this.selectedIds.filter(function(d) {
|
10664 | return !powerbi.data.Selector.equals(d, selectionId);
|
10665 | }) : this.selectedIds.length > 1 ? [ selectionId ] : [] : multiSelect ? this.selectedIds.push(selectionId) : this.selectedIds = [ selectionId ];
|
10666 | }, SelectionManager.containsSelection = function(list, id) {
|
10667 | return list.some(function(d) {
|
10668 | return powerbi.data.Selector.equals(d.getSelector(), id.getSelector());
|
10669 | });
|
10670 | }, SelectionManager;
|
10671 | }();
|
10672 | utility.SelectionManager = SelectionManager;
|
10673 | }(utility = visuals.utility || (visuals.utility = {}));
|
10674 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
10675 | }(powerbi || (powerbi = {}));
|
10676 | }, function(module, exports) {
|
10677 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
10678 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
10679 | !function(powerbi) {
|
10680 | var visuals;
|
10681 | !function(visuals) {
|
10682 | "use strict";
|
10683 | var shapes;
|
10684 | !function(shapes) {
|
10685 | var Utility = jsCommon.Utility, Polygon = function() {
|
10686 | function Polygon(absolutePoints) {
|
10687 | this.polygonPoints = this.convertArrayPathToPoints(absolutePoints);
|
10688 | }
|
10689 | return Polygon.prototype.absoluteCentroid = function() {
|
10690 | return null == this._absoluteCentroid && (this._absoluteCentroid = this.calculatePolygonCentroid()),
|
10691 | this._absoluteCentroid;
|
10692 | }, Polygon.prototype.absoluteBoundingRect = function() {
|
10693 | return null == this._absoluteBoundingRect && (this._absoluteBoundingRect = this.calculateBoundingRect()),
|
10694 | this._absoluteBoundingRect;
|
10695 | }, Polygon.prototype.contains = function(rect) {
|
10696 | var topLeft = {
|
10697 | x: rect.left,
|
10698 | y: rect.top
|
10699 | }, topRight = {
|
10700 | x: rect.left + rect.width,
|
10701 | y: rect.top
|
10702 | }, bottomLeft = {
|
10703 | x: rect.left,
|
10704 | y: rect.top + rect.height
|
10705 | }, bottomRight = {
|
10706 | x: rect.left + rect.width,
|
10707 | y: rect.top + rect.height
|
10708 | };
|
10709 | return this.inside(topLeft) && this.inside(topRight) && this.inside(bottomLeft) && this.inside(bottomRight);
|
10710 | }, Polygon.prototype.conflicts = function(rect) {
|
10711 | if (!this.isConflictWithBoundingBox(rect)) return !1;
|
10712 | var topLeft = {
|
10713 | x: rect.left,
|
10714 | y: rect.top
|
10715 | }, topCenter = {
|
10716 | x: rect.left + rect.width / 2,
|
10717 | y: rect.top
|
10718 | }, topRight = {
|
10719 | x: rect.left + rect.width,
|
10720 | y: rect.top
|
10721 | }, bottomLeft = {
|
10722 | x: rect.left,
|
10723 | y: rect.top + rect.height
|
10724 | }, bottomCenter = {
|
10725 | x: rect.left + rect.width / 2,
|
10726 | y: rect.top + rect.height
|
10727 | }, bottomRight = {
|
10728 | x: rect.left + rect.width,
|
10729 | y: rect.top + rect.height
|
10730 | }, middleLeft = {
|
10731 | x: rect.left,
|
10732 | y: rect.top + rect.height / 2
|
10733 | }, middleRight = {
|
10734 | x: rect.left + rect.width,
|
10735 | y: rect.top + rect.height / 2
|
10736 | };
|
10737 | return this.inside(topLeft) || this.inside(topCenter) || this.inside(topRight) || this.inside(bottomLeft) || this.inside(bottomCenter) || this.inside(bottomRight) || this.inside(middleLeft) || this.inside(middleRight);
|
10738 | }, Polygon.prototype.lineIntersectionPoint = function(p0, p1) {
|
10739 | for (var i = 0; i < this.polygonPoints.length; i++) {
|
10740 | var p2 = this.polygonPoints[i], p3 = i === this.polygonPoints.length - 1 ? this.polygonPoints[0] : this.polygonPoints[i + 1], intersection = this.getLineIntersection(p0, p1, p2, p3);
|
10741 | if (null !== intersection) return intersection;
|
10742 | }
|
10743 | return null;
|
10744 | }, Polygon.calculateAbsolutePolygonArea = function(polygonPoints) {
|
10745 | var i, j = 1, area = 0;
|
10746 | for (i = 0; i < polygonPoints.length; i++) area += polygonPoints[i].x * polygonPoints[j].y - polygonPoints[j].x * polygonPoints[i].y,
|
10747 | j = (j + 1) % polygonPoints.length;
|
10748 | return area *= .5;
|
10749 | }, Polygon.prototype.isConflictWithBoundingBox = function(rect) {
|
10750 | return Rect.isIntersecting(this.absoluteBoundingRect(), rect);
|
10751 | }, Polygon.prototype.calculatePolygonCentroid = function() {
|
10752 | var area, tempPoint, cx, cy, i, j;
|
10753 | for (area = Polygon.calculateAbsolutePolygonArea(this.polygonPoints), cx = cy = 0,
|
10754 | j = 1, i = 0; i < this.polygonPoints.length; i++) tempPoint = this.polygonPoints[i].x * this.polygonPoints[j].y - this.polygonPoints[j].x * this.polygonPoints[i].y,
|
10755 | cx += (this.polygonPoints[i].x + this.polygonPoints[j].x) * tempPoint, cy += (this.polygonPoints[i].y + this.polygonPoints[j].y) * tempPoint,
|
10756 | j = (j + 1) % this.polygonPoints.length;
|
10757 | return cx /= 6 * area, cy /= 6 * area, {
|
10758 | x: cx,
|
10759 | y: cy
|
10760 | };
|
10761 | }, Polygon.prototype.calculateBoundingRect = function() {
|
10762 | for (var minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY, i = 0; i < this.polygonPoints.length; i++) this.polygonPoints[i].x < minX ? minX = this.polygonPoints[i].x : this.polygonPoints[i].x > maxX && (maxX = this.polygonPoints[i].x),
|
10763 | this.polygonPoints[i].y < minY ? minY = this.polygonPoints[i].y : this.polygonPoints[i].y > maxY && (maxY = this.polygonPoints[i].y);
|
10764 | return {
|
10765 | left: minX,
|
10766 | top: minY,
|
10767 | width: maxX - minX,
|
10768 | height: maxY - minY
|
10769 | };
|
10770 | }, Polygon.prototype.inside = function(point) {
|
10771 | for (var x = point.x, y = point.y, insideVar = !1, i = 0, j = this.polygonPoints.length - 1; i < this.polygonPoints.length; j = i++) {
|
10772 | var xi = this.polygonPoints[i].x, yi = this.polygonPoints[i].y, xj = this.polygonPoints[j].x, yj = this.polygonPoints[j].y, intersect = yi > y != yj > y && (xj - xi) * (y - yi) / (yj - yi) + xi > x;
|
10773 | intersect && (insideVar = !insideVar);
|
10774 | }
|
10775 | return insideVar;
|
10776 | }, Polygon.prototype.getLineIntersection = function(line0p1, line0p2, line1p1, line1p2) {
|
10777 | var p0_x = line0p1.x, p0_y = line0p1.y, p1_x = line0p2.x, p1_y = line0p2.y, p2_x = line1p1.x, p2_y = line1p1.y, p3_x = line1p2.x, p3_y = line1p2.y, s1_x = p1_x - p0_x, s1_y = p1_y - p0_y, s2_x = p3_x - p2_x, s2_y = p3_y - p2_y, s = (-s1_y * (p0_x - p2_x) + s1_x * (p0_y - p2_y)) / (-s2_x * s1_y + s1_x * s2_y), t = (s2_x * (p0_y - p2_y) - s2_y * (p0_x - p2_x)) / (-s2_x * s1_y + s1_x * s2_y);
|
10778 | return s >= 0 && 1 >= s && t >= 0 && 1 >= t ? {
|
10779 | x: p0_x + t * s1_x,
|
10780 | y: p0_y + t * s1_y
|
10781 | } : null;
|
10782 | }, Polygon.prototype.convertArrayPathToPoints = function(path) {
|
10783 | for (var pointsRes = [], i = 0; i < path.length; i += 2) {
|
10784 | var x = path[i], y = path[i + 1], newPoint = {
|
10785 | x: x,
|
10786 | y: y
|
10787 | };
|
10788 | pointsRes.push(newPoint);
|
10789 | }
|
10790 | return pointsRes;
|
10791 | }, Polygon;
|
10792 | }();
|
10793 | shapes.Polygon = Polygon;
|
10794 | var Point;
|
10795 | !function(Point) {
|
10796 | function offset(point, offsetX, offsetY) {
|
10797 | var newPointX = point.x + offsetX >= 0 ? point.x + offsetX : 0, newPointY = point.y + offsetY >= 0 ? point.y + offsetY : 0;
|
10798 | return {
|
10799 | x: newPointX,
|
10800 | y: newPointY
|
10801 | };
|
10802 | }
|
10803 | function equals(point, other) {
|
10804 | return void 0 !== point && null !== point && void 0 !== other && null !== other && point.x === other.x && point.y === other.y;
|
10805 | }
|
10806 | function clone(point) {
|
10807 | return null !== point ? {
|
10808 | x: point.x,
|
10809 | y: point.y
|
10810 | } : null;
|
10811 | }
|
10812 | function toString(point) {
|
10813 | return "{x:" + point.x + ", y:" + point.y + "}";
|
10814 | }
|
10815 | function serialize(point) {
|
10816 | return point.x + "," + point.y;
|
10817 | }
|
10818 | function getDistance(point, other) {
|
10819 | if (null === point || null === other) return null;
|
10820 | var diffX = other.x - point.x, diffY = other.y - point.y;
|
10821 | return Math.sqrt(diffX * diffX + diffY * diffY);
|
10822 | }
|
10823 | function equalWithPrecision(point1, point2) {
|
10824 | return point1 === point2 || void 0 !== point1 && void 0 !== point2 && powerbi.Double.equalWithPrecision(point1.x, point2.x) && powerbi.Double.equalWithPrecision(point1.y, point2.y);
|
10825 | }
|
10826 | function parsePoint(value, defaultValue) {
|
10827 | if (null === value) return void 0 === defaultValue ? null : defaultValue;
|
10828 | if (void 0 === value) return void 0 === defaultValue ? null : defaultValue;
|
10829 | if (2 === value.length) return {
|
10830 | x: Utility.parseNumber(value[0]),
|
10831 | y: Utility.parseNumber(value[1])
|
10832 | };
|
10833 | if ("string" == typeof value) {
|
10834 | var parts = value.split(",");
|
10835 | return 2 !== parts.length ? void 0 === defaultValue ? null : defaultValue : {
|
10836 | x: Utility.parseNumber(parts[0]),
|
10837 | y: Utility.parseNumber(parts[1])
|
10838 | };
|
10839 | }
|
10840 | return 2 !== value.length && "string" != typeof value ? void 0 === defaultValue ? null : defaultValue : {
|
10841 | x: Utility.parseNumber(value.x),
|
10842 | y: Utility.parseNumber(value.y)
|
10843 | };
|
10844 | }
|
10845 | Point.offset = offset, Point.equals = equals, Point.clone = clone, Point.toString = toString,
|
10846 | Point.serialize = serialize, Point.getDistance = getDistance, Point.equalWithPrecision = equalWithPrecision,
|
10847 | Point.parsePoint = parsePoint;
|
10848 | }(Point = shapes.Point || (shapes.Point = {}));
|
10849 | var Size;
|
10850 | !function(Size) {
|
10851 | function isEmpty(size) {
|
10852 | return 0 === size.width && 0 === size.height;
|
10853 | }
|
10854 | function equals(size, other) {
|
10855 | return void 0 !== size && null !== size && void 0 !== other && null !== other && size.width === other.width && size.height === other.height;
|
10856 | }
|
10857 | function clone(size) {
|
10858 | return null !== size ? {
|
10859 | width: size.width,
|
10860 | height: size.height
|
10861 | } : null;
|
10862 | }
|
10863 | function inflate(size, padding) {
|
10864 | var result = clone(size);
|
10865 | return padding && (result.width += padding.left + padding.right, result.height += padding.top + padding.bottom),
|
10866 | result;
|
10867 | }
|
10868 | function deflate(size, padding) {
|
10869 | var result = clone(size);
|
10870 | return padding && (result.width = result.width - padding.left - padding.right, result.width < 0 && (result.width = 0),
|
10871 | result.height = result.height - padding.top - padding.bottom, result.height < 0 && (result.height = 0)),
|
10872 | result;
|
10873 | }
|
10874 | function combine(size, other) {
|
10875 | return other && (size.width = Math.max(size.width, other.width), size.height = Math.max(size.height, other.height)),
|
10876 | size;
|
10877 | }
|
10878 | function toRect(size) {
|
10879 | return {
|
10880 | left: 0,
|
10881 | top: 0,
|
10882 | width: size.width,
|
10883 | height: size.height
|
10884 | };
|
10885 | }
|
10886 | function toString(size) {
|
10887 | return "{width:" + size.width + ", height:" + size.height + "}";
|
10888 | }
|
10889 | function equal(size1, size2) {
|
10890 | return size1 === size2 || void 0 !== size1 && void 0 !== size2 && size1.width === size2.width && size1.height === size2.height;
|
10891 | }
|
10892 | function equalWithPrecision(size1, size2) {
|
10893 | return size1 === size2 || void 0 !== size1 && void 0 !== size2 && powerbi.Double.equalWithPrecision(size1.width, size2.width) && powerbi.Double.equalWithPrecision(size1.height, size2.height);
|
10894 | }
|
10895 | function parseSize(value, defaultValue) {
|
10896 | if (null === value) return void 0 === defaultValue ? null : defaultValue;
|
10897 | if (void 0 === value) return void 0 === defaultValue ? null : defaultValue;
|
10898 | if (2 === value.length) return {
|
10899 | width: Utility.parseNumber(value[0]),
|
10900 | height: Utility.parseNumber(value[1])
|
10901 | };
|
10902 | if ("string" == typeof value) {
|
10903 | var parts = value.split(",");
|
10904 | return 2 !== parts.length ? void 0 === defaultValue ? null : defaultValue : {
|
10905 | width: Utility.parseNumber(parts[0]),
|
10906 | height: Utility.parseNumber(parts[1])
|
10907 | };
|
10908 | }
|
10909 | return 2 !== value.length && "string" != typeof value ? void 0 === defaultValue ? null : defaultValue : {
|
10910 | width: Utility.parseNumber(value.width),
|
10911 | height: Utility.parseNumber(value.height)
|
10912 | };
|
10913 | }
|
10914 | Size.isEmpty = isEmpty, Size.equals = equals, Size.clone = clone, Size.inflate = inflate,
|
10915 | Size.deflate = deflate, Size.combine = combine, Size.toRect = toRect, Size.toString = toString,
|
10916 | Size.equal = equal, Size.equalWithPrecision = equalWithPrecision, Size.parseSize = parseSize;
|
10917 | }(Size = shapes.Size || (shapes.Size = {}));
|
10918 | var Rect;
|
10919 | !function(Rect) {
|
10920 | function getOffset(rect) {
|
10921 | return {
|
10922 | x: rect.left,
|
10923 | y: rect.top
|
10924 | };
|
10925 | }
|
10926 | function getSize(rect) {
|
10927 | return {
|
10928 | width: rect.width,
|
10929 | height: rect.height
|
10930 | };
|
10931 | }
|
10932 | function setSize(rect, value) {
|
10933 | rect.width = value.width, rect.height = value.height;
|
10934 | }
|
10935 | function right(rect) {
|
10936 | return rect.left + rect.width;
|
10937 | }
|
10938 | function bottom(rect) {
|
10939 | return rect.top + rect.height;
|
10940 | }
|
10941 | function topLeft(rect) {
|
10942 | return {
|
10943 | x: rect.left,
|
10944 | y: rect.top
|
10945 | };
|
10946 | }
|
10947 | function topRight(rect) {
|
10948 | return {
|
10949 | x: rect.left + rect.width,
|
10950 | y: rect.top
|
10951 | };
|
10952 | }
|
10953 | function bottomLeft(rect) {
|
10954 | return {
|
10955 | x: rect.left,
|
10956 | y: rect.top + rect.height
|
10957 | };
|
10958 | }
|
10959 | function bottomRight(rect) {
|
10960 | return {
|
10961 | x: rect.left + rect.width,
|
10962 | y: rect.top + rect.height
|
10963 | };
|
10964 | }
|
10965 | function equals(rect, other) {
|
10966 | return void 0 !== other && null !== other && rect.left === other.left && rect.top === other.top && rect.width === other.width && rect.height === other.height;
|
10967 | }
|
10968 | function clone(rect) {
|
10969 | return null !== rect ? {
|
10970 | left: rect.left,
|
10971 | top: rect.top,
|
10972 | width: rect.width,
|
10973 | height: rect.height
|
10974 | } : null;
|
10975 | }
|
10976 | function toString(rect) {
|
10977 | return "{left:" + rect.left + ", top:" + rect.top + ", width:" + rect.width + ", height:" + rect.height + "}";
|
10978 | }
|
10979 | function offset(rect, offsetX, offsetY) {
|
10980 | var newLeft = rect.left + offsetX >= 0 ? rect.left + offsetX : 0, newTop = rect.top + offsetY >= 0 ? rect.top + offsetY : 0;
|
10981 | return {
|
10982 | left: newLeft,
|
10983 | top: newTop,
|
10984 | width: rect.width,
|
10985 | height: rect.height
|
10986 | };
|
10987 | }
|
10988 | function inflate(rect, padding) {
|
10989 | var result = clone(rect);
|
10990 | return padding && (result.left -= padding.left, result.top -= padding.top, result.width += padding.left + padding.right,
|
10991 | result.height += padding.top + padding.bottom), result;
|
10992 | }
|
10993 | function deflate(rect, padding) {
|
10994 | var result = clone(rect);
|
10995 | return padding && (result.left += padding.left, result.top += padding.top, result.width -= padding.left + padding.right,
|
10996 | result.height -= padding.top + padding.bottom), result;
|
10997 | }
|
10998 | function inflateBy(rect, padding) {
|
10999 | return {
|
11000 | left: rect.left - padding,
|
11001 | top: rect.top - padding,
|
11002 | width: rect.width + padding + padding,
|
11003 | height: rect.height + padding + padding
|
11004 | };
|
11005 | }
|
11006 | function deflateBy(rect, padding) {
|
11007 | return {
|
11008 | left: rect.left + padding,
|
11009 | top: rect.top + padding,
|
11010 | width: rect.width - padding - padding,
|
11011 | height: rect.height - padding - padding
|
11012 | };
|
11013 | }
|
11014 | function getClosestPoint(rect, x, y) {
|
11015 | return {
|
11016 | x: Math.min(Math.max(rect.left, x), rect.left + rect.width),
|
11017 | y: Math.min(Math.max(rect.top, y), rect.top + rect.height)
|
11018 | };
|
11019 | }
|
11020 | function equal(rect1, rect2) {
|
11021 | return rect1 === rect2 || void 0 !== rect1 && void 0 !== rect2 && rect1.left === rect2.left && rect1.top === rect2.top && rect1.width === rect2.width && rect1.height === rect2.height;
|
11022 | }
|
11023 | function equalWithPrecision(rect1, rect2) {
|
11024 | return rect1 === rect2 || void 0 !== rect1 && void 0 !== rect2 && powerbi.Double.equalWithPrecision(rect1.left, rect2.left) && powerbi.Double.equalWithPrecision(rect1.top, rect2.top) && powerbi.Double.equalWithPrecision(rect1.width, rect2.width) && powerbi.Double.equalWithPrecision(rect1.height, rect2.height);
|
11025 | }
|
11026 | function isEmpty(rect) {
|
11027 | return void 0 === rect || null === rect || 0 === rect.width && 0 === rect.height;
|
11028 | }
|
11029 | function containsPoint(rect, point) {
|
11030 | return null === rect || null === point ? !1 : powerbi.Double.lessOrEqualWithPrecision(rect.left, point.x) && powerbi.Double.lessOrEqualWithPrecision(point.x, rect.left + rect.width) && powerbi.Double.lessOrEqualWithPrecision(rect.top, point.y) && powerbi.Double.lessOrEqualWithPrecision(point.y, rect.top + rect.height);
|
11031 | }
|
11032 | function isIntersecting(rect1, rect2) {
|
11033 | if (!rect1 || !rect2) return !1;
|
11034 | var left = Math.max(rect1.left, rect2.left), right = Math.min(rect1.left + rect1.width, rect2.left + rect2.width);
|
11035 | if (left > right) return !1;
|
11036 | var top = Math.max(rect1.top, rect2.top), bottom = Math.min(rect1.top + rect1.height, rect2.top + rect2.height);
|
11037 | return bottom >= top;
|
11038 | }
|
11039 | function intersect(rect1, rect2) {
|
11040 | if (!rect1) return rect2;
|
11041 | if (!rect2) return rect1;
|
11042 | var left = Math.max(rect1.left, rect2.left), top = Math.max(rect1.top, rect2.top), right = Math.min(rect1.left + rect1.width, rect2.left + rect2.width), bottom = Math.min(rect1.top + rect1.height, rect2.top + rect2.height);
|
11043 | return right >= left && bottom >= top ? {
|
11044 | left: left,
|
11045 | top: top,
|
11046 | width: right - left,
|
11047 | height: bottom - top
|
11048 | } : {
|
11049 | left: 0,
|
11050 | top: 0,
|
11051 | width: 0,
|
11052 | height: 0
|
11053 | };
|
11054 | }
|
11055 | function combine(rect1, rect2) {
|
11056 | if (!rect1) return rect2;
|
11057 | if (!rect2) return rect1;
|
11058 | var left = Math.min(rect1.left, rect2.left), top = Math.min(rect1.top, rect2.top), right = Math.max(rect1.left + rect1.width, rect2.left + rect2.width), bottom = Math.max(rect1.top + rect1.height, rect2.top + rect2.height);
|
11059 | return {
|
11060 | left: left,
|
11061 | top: top,
|
11062 | width: right - left,
|
11063 | height: bottom - top
|
11064 | };
|
11065 | }
|
11066 | function parseRect(value, defaultValue) {
|
11067 | if (null === value) return void 0 === defaultValue ? null : defaultValue;
|
11068 | if (void 0 === value) return void 0 === defaultValue ? null : defaultValue;
|
11069 | if (4 === value.length) return {
|
11070 | left: Utility.parseNumber(value[0]),
|
11071 | top: Utility.parseNumber(value[1]),
|
11072 | width: Utility.parseNumber(value[2]),
|
11073 | height: Utility.parseNumber(value[3])
|
11074 | };
|
11075 | if ("string" == typeof value) {
|
11076 | var parts = value.split(",");
|
11077 | return 4 !== parts.length ? void 0 === defaultValue ? null : defaultValue : {
|
11078 | left: Utility.parseNumber(parts[0]),
|
11079 | top: Utility.parseNumber(parts[1]),
|
11080 | width: Utility.parseNumber(parts[2]),
|
11081 | height: Utility.parseNumber(parts[3])
|
11082 | };
|
11083 | }
|
11084 | return 4 !== value.length && "string" != typeof value ? void 0 === defaultValue ? null : defaultValue : {
|
11085 | left: Utility.parseNumber(value.left),
|
11086 | top: Utility.parseNumber(value.top),
|
11087 | width: Utility.parseNumber(value.width),
|
11088 | height: Utility.parseNumber(value.height)
|
11089 | };
|
11090 | }
|
11091 | Rect.getOffset = getOffset, Rect.getSize = getSize, Rect.setSize = setSize, Rect.right = right,
|
11092 | Rect.bottom = bottom, Rect.topLeft = topLeft, Rect.topRight = topRight, Rect.bottomLeft = bottomLeft,
|
11093 | Rect.bottomRight = bottomRight, Rect.equals = equals, Rect.clone = clone, Rect.toString = toString,
|
11094 | Rect.offset = offset, Rect.inflate = inflate, Rect.deflate = deflate, Rect.inflateBy = inflateBy,
|
11095 | Rect.deflateBy = deflateBy, Rect.getClosestPoint = getClosestPoint, Rect.equal = equal,
|
11096 | Rect.equalWithPrecision = equalWithPrecision, Rect.isEmpty = isEmpty, Rect.containsPoint = containsPoint,
|
11097 | Rect.isIntersecting = isIntersecting, Rect.intersect = intersect, Rect.combine = combine,
|
11098 | Rect.parseRect = parseRect;
|
11099 | }(Rect = shapes.Rect || (shapes.Rect = {}));
|
11100 | var Thickness;
|
11101 | !function(Thickness) {
|
11102 | function inflate(thickness, other) {
|
11103 | var result = clone(thickness);
|
11104 | return other && (result.left = thickness.left + other.left, result.right = thickness.right + other.right,
|
11105 | result.bottom = thickness.bottom + other.bottom, result.top = thickness.top + other.top),
|
11106 | result;
|
11107 | }
|
11108 | function getWidth(thickness) {
|
11109 | return thickness.left + thickness.right;
|
11110 | }
|
11111 | function getHeight(thickness) {
|
11112 | return thickness.top + thickness.bottom;
|
11113 | }
|
11114 | function clone(thickness) {
|
11115 | return null !== thickness ? {
|
11116 | left: thickness.left,
|
11117 | top: thickness.top,
|
11118 | right: thickness.right,
|
11119 | bottom: thickness.bottom
|
11120 | } : null;
|
11121 | }
|
11122 | function equals(thickness, other) {
|
11123 | return void 0 !== thickness && null !== thickness && void 0 !== other && null !== other && thickness.left === other.left && thickness.bottom === other.bottom && thickness.right === other.right && thickness.top === other.top;
|
11124 | }
|
11125 | function flipHorizontal(thickness) {
|
11126 | var temp = thickness.right;
|
11127 | thickness.right = thickness.left, thickness.left = temp;
|
11128 | }
|
11129 | function flipVertical(thickness) {
|
11130 | var top = thickness.top;
|
11131 | thickness.top = thickness.bottom, thickness.bottom = top;
|
11132 | }
|
11133 | function toString(thickness) {
|
11134 | return "{top:" + thickness.top + ", left:" + thickness.left + ", right:" + thickness.right + ", bottom:" + thickness.bottom + "}";
|
11135 | }
|
11136 | function toCssString(thickness) {
|
11137 | return thickness.top + "px " + thickness.right + "px " + thickness.bottom + "px " + thickness.left + "px";
|
11138 | }
|
11139 | function isEmpty(thickness) {
|
11140 | return 0 === thickness.left && 0 === thickness.top && 0 === thickness.right && 0 === thickness.bottom;
|
11141 | }
|
11142 | function equal(thickness1, thickness2) {
|
11143 | return thickness1 === thickness2 || void 0 !== thickness1 && void 0 !== thickness2 && thickness1.left === thickness2.left && thickness1.top === thickness2.top && thickness1.right === thickness2.right && thickness1.bottom === thickness2.bottom;
|
11144 | }
|
11145 | function equalWithPrecision(thickness1, thickness2) {
|
11146 | return thickness1 === thickness2 || void 0 !== thickness1 && void 0 !== thickness2 && powerbi.Double.equalWithPrecision(thickness1.left, thickness2.left) && powerbi.Double.equalWithPrecision(thickness1.top, thickness2.top) && powerbi.Double.equalWithPrecision(thickness1.right, thickness2.right) && powerbi.Double.equalWithPrecision(thickness1.bottom, thickness2.bottom);
|
11147 | }
|
11148 | function parseThickness(value, defaultValue, resetValue) {
|
11149 | if (null === value) return void 0 === defaultValue ? null : defaultValue;
|
11150 | if (void 0 === value) return void 0 === defaultValue ? null : defaultValue;
|
11151 | if (4 === value.length) return {
|
11152 | left: Utility.parseNumber(value[0]),
|
11153 | top: Utility.parseNumber(value[1]),
|
11154 | right: Utility.parseNumber(value[2]),
|
11155 | bottom: Utility.parseNumber(value[3])
|
11156 | };
|
11157 | if ("string" == typeof value) {
|
11158 | var parts = value.split(",");
|
11159 | return 4 !== parts.length ? void 0 === defaultValue ? null : defaultValue : {
|
11160 | left: Utility.parseNumber(parts[0]),
|
11161 | top: Utility.parseNumber(parts[1]),
|
11162 | right: Utility.parseNumber(parts[2]),
|
11163 | bottom: Utility.parseNumber(parts[3])
|
11164 | };
|
11165 | }
|
11166 | return 4 !== value.length && "string" != typeof value ? void 0 === defaultValue ? null : defaultValue : {
|
11167 | left: Utility.parseNumber(value.left),
|
11168 | top: Utility.parseNumber(value.top),
|
11169 | right: Utility.parseNumber(value.right),
|
11170 | bottom: Utility.parseNumber(value.bottom)
|
11171 | };
|
11172 | }
|
11173 | Thickness.inflate = inflate, Thickness.getWidth = getWidth, Thickness.getHeight = getHeight,
|
11174 | Thickness.clone = clone, Thickness.equals = equals, Thickness.flipHorizontal = flipHorizontal,
|
11175 | Thickness.flipVertical = flipVertical, Thickness.toString = toString, Thickness.toCssString = toCssString,
|
11176 | Thickness.isEmpty = isEmpty, Thickness.equal = equal, Thickness.equalWithPrecision = equalWithPrecision,
|
11177 | Thickness.parseThickness = parseThickness;
|
11178 | }(Thickness = shapes.Thickness || (shapes.Thickness = {}));
|
11179 | var Vector;
|
11180 | !function(Vector) {
|
11181 | function isEmpty(vector) {
|
11182 | return 0 === vector.x && 0 === vector.y;
|
11183 | }
|
11184 | function equals(vector, other) {
|
11185 | return void 0 !== vector && null !== vector && void 0 !== other && null !== other && vector.x === other.x && vector.y === other.y;
|
11186 | }
|
11187 | function clone(vector) {
|
11188 | return null !== vector ? {
|
11189 | x: vector.x,
|
11190 | y: vector.y
|
11191 | } : null;
|
11192 | }
|
11193 | function toString(vector) {
|
11194 | return "{x:" + vector.x + ", y:" + vector.y + "}";
|
11195 | }
|
11196 | function getLength(vector) {
|
11197 | return Math.sqrt(vector.x * vector.x + vector.y * vector.y);
|
11198 | }
|
11199 | function getLengthSqr(vector) {
|
11200 | return vector.x * vector.x + vector.y * vector.y;
|
11201 | }
|
11202 | function scale(vector, scalar) {
|
11203 | return {
|
11204 | x: vector.x * scalar,
|
11205 | y: vector.y * scalar
|
11206 | };
|
11207 | }
|
11208 | function normalize(vector) {
|
11209 | return isEmpty(vector) ? vector : scale(vector, 1 / getLength(vector));
|
11210 | }
|
11211 | function rotate90DegCW(vector) {
|
11212 | return {
|
11213 | x: vector.y,
|
11214 | y: -vector.x
|
11215 | };
|
11216 | }
|
11217 | function rotate90DegCCW(vector) {
|
11218 | return {
|
11219 | x: -vector.y,
|
11220 | y: vector.x
|
11221 | };
|
11222 | }
|
11223 | function rotate(vector, angle) {
|
11224 | var newX = vector.x * Math.cos(angle) - vector.y * Math.sin(angle), newY = vector.x * Math.sin(angle) + vector.y * Math.cos(angle);
|
11225 | return {
|
11226 | x: newX,
|
11227 | y: newY
|
11228 | };
|
11229 | }
|
11230 | function equal(vector1, vector2) {
|
11231 | return vector1 === vector2 || void 0 !== vector1 && void 0 !== vector2 && vector1.x === vector2.x && vector1.y === vector2.y;
|
11232 | }
|
11233 | function equalWithPrecision(vector1, vector2) {
|
11234 | return vector1 === vector2 || void 0 !== vector1 && void 0 !== vector2 && powerbi.Double.equalWithPrecision(vector1.x, vector2.x) && powerbi.Double.equalWithPrecision(vector1.y, vector2.y);
|
11235 | }
|
11236 | function add(vect1, vect2) {
|
11237 | return vect1 && vect2 ? {
|
11238 | x: vect1.x + vect2.x,
|
11239 | y: vect1.y + vect2.y
|
11240 | } : void 0;
|
11241 | }
|
11242 | function subtract(vect1, vect2) {
|
11243 | return vect1 && vect2 ? {
|
11244 | x: vect1.x - vect2.x,
|
11245 | y: vect1.y - vect2.y
|
11246 | } : void 0;
|
11247 | }
|
11248 | function dotProduct(vect1, vect2) {
|
11249 | return vect1 && vect2 ? vect1.x * vect2.x + vect1.y * vect2.y : void 0;
|
11250 | }
|
11251 | function getDeltaVector(p0, p1) {
|
11252 | return p0 && p1 ? {
|
11253 | x: p1.x - p0.x,
|
11254 | y: p1.y - p0.y
|
11255 | } : void 0;
|
11256 | }
|
11257 | Vector.isEmpty = isEmpty, Vector.equals = equals, Vector.clone = clone, Vector.toString = toString,
|
11258 | Vector.getLength = getLength, Vector.getLengthSqr = getLengthSqr, Vector.scale = scale,
|
11259 | Vector.normalize = normalize, Vector.rotate90DegCW = rotate90DegCW, Vector.rotate90DegCCW = rotate90DegCCW,
|
11260 | Vector.rotate = rotate, Vector.equal = equal, Vector.equalWithPrecision = equalWithPrecision,
|
11261 | Vector.add = add, Vector.subtract = subtract, Vector.dotProduct = dotProduct, Vector.getDeltaVector = getDeltaVector;
|
11262 | }(Vector = shapes.Vector || (shapes.Vector = {}));
|
11263 | }(shapes = visuals.shapes || (visuals.shapes = {}));
|
11264 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11265 | }(powerbi || (powerbi = {}));
|
11266 | }, function(module, exports) {
|
11267 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
11268 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
11269 | !function(powerbi) {
|
11270 | var visuals;
|
11271 | !function(visuals) {
|
11272 | var SlicerUtil, PixelConverter = jsCommon.PixelConverter, SQExprBuilder = powerbi.data.SQExprBuilder, SemanticFilter = powerbi.data.SemanticFilter;
|
11273 | !function(SlicerUtil) {
|
11274 | function getContainsFilter(expr, containsText) {
|
11275 | var containsTextExpr = SQExprBuilder.text(containsText), filterExpr = SQExprBuilder.contains(expr, containsTextExpr);
|
11276 | return SemanticFilter.fromSQExpr(filterExpr);
|
11277 | }
|
11278 | function tryRemoveValueFromRetainedList(value, selectedScopeIds, caseInsensitive) {
|
11279 | if (!value || _.isEmpty(selectedScopeIds)) return !1;
|
11280 | for (var i = 0, len = selectedScopeIds.length; len > i; i++) {
|
11281 | var retainedValueScopeId = selectedScopeIds[i];
|
11282 | if (powerbi.DataViewScopeIdentity.equals(value, retainedValueScopeId, caseInsensitive)) return selectedScopeIds.splice(i, 1),
|
11283 | !0;
|
11284 | }
|
11285 | return !1;
|
11286 | }
|
11287 | var Selectors;
|
11288 | !function(Selectors) {
|
11289 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector;
|
11290 | Selectors.HeaderContainer = createClassAndSelector("headerContainer"), Selectors.Header = createClassAndSelector("slicerHeader"),
|
11291 | Selectors.TitleHeader = createClassAndSelector("titleHeader"), Selectors.HeaderText = createClassAndSelector("headerText"),
|
11292 | Selectors.Body = createClassAndSelector("slicerBody"), Selectors.Label = createClassAndSelector("slicerLabel"),
|
11293 | Selectors.LabelText = createClassAndSelector("slicerText"), Selectors.LabelImage = createClassAndSelector("slicerImage"),
|
11294 | Selectors.CountText = createClassAndSelector("slicerCountText"), Selectors.Clear = createClassAndSelector("clear"),
|
11295 | Selectors.SearchHeader = createClassAndSelector("searchHeader"), Selectors.SearchInput = createClassAndSelector("searchInput"),
|
11296 | Selectors.SearchHeaderCollapsed = createClassAndSelector("collapsed"), Selectors.SearchHeaderShow = createClassAndSelector("show"),
|
11297 | Selectors.MultiSelectEnabled = createClassAndSelector("isMultiSelectEnabled");
|
11298 | }(Selectors = SlicerUtil.Selectors || (SlicerUtil.Selectors = {}));
|
11299 | var DisplayNameKeys;
|
11300 | !function(DisplayNameKeys) {
|
11301 | DisplayNameKeys.Clear = "Slicer_Clear", DisplayNameKeys.SelectAll = "Slicer_SelectAll",
|
11302 | DisplayNameKeys.Search = "SearchBox_Text";
|
11303 | }(DisplayNameKeys = SlicerUtil.DisplayNameKeys || (SlicerUtil.DisplayNameKeys = {}));
|
11304 | var SettingsHelper;
|
11305 | !function(SettingsHelper) {
|
11306 | function areSettingsDefined(data) {
|
11307 | return null != data && null != data.slicerSettings;
|
11308 | }
|
11309 | SettingsHelper.areSettingsDefined = areSettingsDefined;
|
11310 | }(SettingsHelper = SlicerUtil.SettingsHelper || (SlicerUtil.SettingsHelper = {}));
|
11311 | var DefaultValueHandler;
|
11312 | !function(DefaultValueHandler) {
|
11313 | function getIdentityFields(dataView) {
|
11314 | if (dataView) {
|
11315 | var dataViewCategorical = dataView.categorical;
|
11316 | if (dataViewCategorical && !_.isEmpty(dataViewCategorical.categories)) return dataViewCategorical.categories[0].identityFields;
|
11317 | }
|
11318 | }
|
11319 | DefaultValueHandler.getIdentityFields = getIdentityFields;
|
11320 | }(DefaultValueHandler = SlicerUtil.DefaultValueHandler || (SlicerUtil.DefaultValueHandler = {})),
|
11321 | SlicerUtil.getContainsFilter = getContainsFilter, SlicerUtil.tryRemoveValueFromRetainedList = tryRemoveValueFromRetainedList;
|
11322 | var DOMHelper = function() {
|
11323 | function DOMHelper() {}
|
11324 | return DOMHelper.prototype.createSlicerHeader = function(hostServices) {
|
11325 | var slicerHeaderDiv = document.createElement("div");
|
11326 | slicerHeaderDiv.className = Selectors.Header["class"];
|
11327 | var slicerHeader = d3.select(slicerHeaderDiv), slicerTitle = slicerHeader.append("h2").classed(Selectors.TitleHeader["class"], !0);
|
11328 | slicerTitle.append("span").classed(Selectors.Clear["class"], !0).attr("title", hostServices.getLocalizedString(DisplayNameKeys.Clear)),
|
11329 | slicerTitle.append("div").classed(Selectors.HeaderText["class"], !0);
|
11330 | var slicerSearch = slicerHeader.append("div").classed(Selectors.SearchHeader["class"], !0).classed(Selectors.SearchHeaderCollapsed["class"], !0);
|
11331 | return slicerSearch.append("span").classed("powervisuals-glyph search", !0).attr("title", hostServices.getLocalizedString(DisplayNameKeys.Search)),
|
11332 | slicerSearch.append("input").attr("type", "text").classed(Selectors.SearchInput["class"], !0).attr("drag-resize-disabled", "true"),
|
11333 | slicerHeaderDiv;
|
11334 | }, DOMHelper.prototype.getHeaderTextProperties = function(settings) {
|
11335 | var headerTextProperties = {
|
11336 | fontFamily: visuals.Font.Family.regular.css,
|
11337 | fontSize: "10px"
|
11338 | };
|
11339 | return settings.header.show && (headerTextProperties.fontSize = PixelConverter.fromPoint(settings.header.textSize)),
|
11340 | headerTextProperties;
|
11341 | }, DOMHelper.prototype.getSlicerBodyViewport = function(currentViewport, settings, headerTextProperties) {
|
11342 | var headerHeight = settings.header.show ? this.getHeaderHeight(settings, headerTextProperties) : 0, searchHeaderHight = settings.search.enabled ? DOMHelper.SearchInputHeight : 0, slicerBodyHeight = currentViewport.height - (headerHeight + settings.header.borderBottomWidth + searchHeaderHight);
|
11343 | return {
|
11344 | height: slicerBodyHeight,
|
11345 | width: currentViewport.width
|
11346 | };
|
11347 | }, DOMHelper.prototype.updateSlicerBodyDimensions = function(currentViewport, slicerBody, settings) {
|
11348 | var slicerViewport = this.getSlicerBodyViewport(currentViewport, settings, this.getHeaderTextProperties(settings));
|
11349 | slicerBody.style({
|
11350 | height: PixelConverter.toString(slicerViewport.height),
|
11351 | width: PixelConverter.toString(slicerViewport.width)
|
11352 | });
|
11353 | }, DOMHelper.prototype.getHeaderHeight = function(settings, textProperties) {
|
11354 | return powerbi.TextMeasurementService.estimateSvgTextHeight(this.getTextProperties(settings.header.textSize, textProperties)) + settings.general.outlineWeight;
|
11355 | }, DOMHelper.prototype.getRowHeight = function(settings, textProperties) {
|
11356 | return powerbi.TextMeasurementService.estimateSvgTextHeight(this.getTextProperties(settings.slicerText.textSize, textProperties)) + this.getRowsOutlineWidth(settings.slicerText.outline, settings.general.outlineWeight);
|
11357 | }, DOMHelper.prototype.styleSlicerHeader = function(slicerHeader, settings, headerText) {
|
11358 | var titleHeader = slicerHeader.select(SlicerUtil.Selectors.TitleHeader.selector), searchHeader = slicerHeader.select(SlicerUtil.Selectors.SearchHeader.selector);
|
11359 | if (settings.header.show) {
|
11360 | titleHeader.style("display", "block");
|
11361 | var headerTextElement = slicerHeader.select(Selectors.HeaderText.selector).text(headerText);
|
11362 | this.setSlicerHeaderTextStyle(titleHeader, headerTextElement, settings, settings.search.enabled);
|
11363 | } else titleHeader.style("display", "none");
|
11364 | settings.search.enabled ? (searchHeader.classed(Selectors.SearchHeaderShow["class"], !0),
|
11365 | searchHeader.classed(Selectors.SearchHeaderCollapsed["class"], !1)) : (searchHeader.classed(Selectors.SearchHeaderShow["class"], !1),
|
11366 | searchHeader.classed(Selectors.SearchHeaderCollapsed["class"], !0));
|
11367 | }, DOMHelper.prototype.setSlicerTextStyle = function(slicerText, settings) {
|
11368 | slicerText.style({
|
11369 | color: settings.slicerText.color,
|
11370 | "background-color": settings.slicerText.background,
|
11371 | "border-style": "solid",
|
11372 | "border-color": settings.general.outlineColor,
|
11373 | "border-width": visuals.VisualBorderUtil.getBorderWidth(settings.slicerText.outline, settings.general.outlineWeight),
|
11374 | "font-size": PixelConverter.fromPoint(settings.slicerText.textSize)
|
11375 | });
|
11376 | }, DOMHelper.prototype.getRowsOutlineWidth = function(outlineElement, outlineWeight) {
|
11377 | switch (outlineElement) {
|
11378 | case visuals.outline.none:
|
11379 | case visuals.outline.leftRight:
|
11380 | return 0;
|
11381 |
|
11382 | case visuals.outline.bottomOnly:
|
11383 | case visuals.outline.topOnly:
|
11384 | return outlineWeight;
|
11385 |
|
11386 | case visuals.outline.topBottom:
|
11387 | case visuals.outline.frame:
|
11388 | return 2 * outlineWeight;
|
11389 |
|
11390 | default:
|
11391 | return 0;
|
11392 | }
|
11393 | }, DOMHelper.prototype.setSlicerHeaderTextStyle = function(slicerHeader, headerTextElement, settings, searchEnabled) {
|
11394 | var hideOutline = !1;
|
11395 | if (searchEnabled) {
|
11396 | var defaultSetting = visuals.Slicer.DefaultStyleProperties();
|
11397 | hideOutline = settings.header.outline === defaultSetting.header.outline && settings.general.outlineWeight === defaultSetting.general.outlineWeight && settings.general.outlineColor === defaultSetting.general.outlineColor;
|
11398 | }
|
11399 | slicerHeader.style({
|
11400 | "border-style": hideOutline ? "none" : "solid",
|
11401 | "border-color": settings.general.outlineColor,
|
11402 | "border-width": visuals.VisualBorderUtil.getBorderWidth(settings.header.outline, settings.general.outlineWeight)
|
11403 | }), headerTextElement.style({
|
11404 | color: settings.header.fontColor,
|
11405 | "background-color": settings.header.background,
|
11406 | "font-size": PixelConverter.fromPoint(settings.header.textSize)
|
11407 | });
|
11408 | }, DOMHelper.prototype.getTextProperties = function(textSize, textProperties) {
|
11409 | return textProperties.fontSize = PixelConverter.fromPoint(textSize), textProperties;
|
11410 | }, DOMHelper.SearchInputHeight = 20, DOMHelper;
|
11411 | }();
|
11412 | SlicerUtil.DOMHelper = DOMHelper;
|
11413 | }(SlicerUtil = visuals.SlicerUtil || (visuals.SlicerUtil = {}));
|
11414 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11415 | }(powerbi || (powerbi = {}));
|
11416 | }, function(module, exports) {
|
11417 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
11418 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
11419 | !function(powerbi) {
|
11420 | var visuals;
|
11421 | !function(visuals) {
|
11422 | var tooltipUtils;
|
11423 | !function(tooltipUtils) {
|
11424 | function tooltipUpdate(selection, tooltips) {
|
11425 | if (0 !== tooltips.length) {
|
11426 | var titles = selection.selectAll("title"), titlesUpdate = titles.data(function(d, i) {
|
11427 | return [ tooltips[i] ];
|
11428 | });
|
11429 | titlesUpdate.enter().append("title"), titlesUpdate.exit().remove(), titlesUpdate.text(function(d) {
|
11430 | return d;
|
11431 | });
|
11432 | }
|
11433 | }
|
11434 | tooltipUtils.tooltipUpdate = tooltipUpdate;
|
11435 | }(tooltipUtils = visuals.tooltipUtils || (visuals.tooltipUtils = {}));
|
11436 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11437 | }(powerbi || (powerbi = {}));
|
11438 | }, function(module, exports) {
|
11439 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
11440 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
11441 | !function(powerbi) {
|
11442 | var visuals;
|
11443 | !function(visuals) {
|
11444 | var SVGUtil;
|
11445 | !function(SVGUtil) {
|
11446 | function translate(x, y) {
|
11447 | return "translate(" + x + "," + y + ")";
|
11448 | }
|
11449 | function translateXWithPixels(x) {
|
11450 | return "translateX(" + x + "px)";
|
11451 | }
|
11452 | function translateWithPixels(x, y) {
|
11453 | return "translate(" + x + "px," + y + "px)";
|
11454 | }
|
11455 | function translateAndRotate(x, y, px, py, angle) {
|
11456 | return "translate(" + x + "," + y + ") rotate(" + angle + "," + px + "," + py + ")";
|
11457 | }
|
11458 | function scale(scale) {
|
11459 | return "scale(" + scale + ")";
|
11460 | }
|
11461 | function translateAndScale(x, y, ratio) {
|
11462 | return "translate(" + x + "," + y + ") scale(" + ratio + ")";
|
11463 | }
|
11464 | function transformOrigin(xOffset, yOffset) {
|
11465 | return xOffset + " " + yOffset;
|
11466 | }
|
11467 | function flushAllD3Transitions() {
|
11468 | var now = Date.now;
|
11469 | Date.now = function() {
|
11470 | return 1 / 0;
|
11471 | }, d3.timer.flush(), Date.now = now;
|
11472 | }
|
11473 | function flushAllD3TransitionsIfNeeded(options) {
|
11474 | if (options) {
|
11475 | var animationOptions = options, asVisualInitOptions = options;
|
11476 | asVisualInitOptions.animation && (animationOptions = asVisualInitOptions.animation),
|
11477 | animationOptions && animationOptions.transitionImmediate && flushAllD3Transitions();
|
11478 | }
|
11479 | }
|
11480 | function ensureDAttribute(pathElement) {
|
11481 | pathElement.getAttribute("d") || pathElement.setAttribute("d", "");
|
11482 | }
|
11483 | function ensureValidSVGPoint(point) {
|
11484 | isNaN(point.x) && (point.x = 0), isNaN(point.y) && (point.y = 0);
|
11485 | }
|
11486 | function parseTranslateTransform(input) {
|
11487 | if (!input || 0 === input.length) return {
|
11488 | x: "0",
|
11489 | y: "0"
|
11490 | };
|
11491 | var xValue, translateCoordinates = input.split(/[\s,]+/), yValue = "0", xCoord = translateCoordinates[0];
|
11492 | if (1 === translateCoordinates.length) xValue = xCoord.substring(10, xCoord.length - 1); else {
|
11493 | var yCoord = translateCoordinates[1];
|
11494 | yValue = yCoord.substring(0, yCoord.length - 1), xValue = xCoord.substring(10, xCoord.length);
|
11495 | }
|
11496 | return {
|
11497 | x: xValue,
|
11498 | y: yValue
|
11499 | };
|
11500 | }
|
11501 | function createArrow(width, height, rotate) {
|
11502 | var transform = "rotate(" + rotate + " " + width / 2 + " " + height / 2 + ")", path = "M0 0";
|
11503 | return path += "L0 " + height, path += "L" + width + " " + height / 2 + " Z", {
|
11504 | path: path,
|
11505 | transform: transform
|
11506 | };
|
11507 | }
|
11508 | function getTransformScaleRatios(svgElement) {
|
11509 | if (null != svgElement) {
|
11510 | var scaledRect = svgElement.getBoundingClientRect(), domRect = svgElement.getBBox();
|
11511 | if (domRect.height > 0 && domRect.width > 0) return {
|
11512 | x: scaledRect.width / domRect.width,
|
11513 | y: scaledRect.height / domRect.height
|
11514 | };
|
11515 | }
|
11516 | return {
|
11517 | x: 1,
|
11518 | y: 1
|
11519 | };
|
11520 | }
|
11521 | SVGUtil.AlmostZero = 1e-6, SVGUtil.translate = translate, SVGUtil.translateXWithPixels = translateXWithPixels,
|
11522 | SVGUtil.translateWithPixels = translateWithPixels, SVGUtil.translateAndRotate = translateAndRotate,
|
11523 | SVGUtil.scale = scale, SVGUtil.translateAndScale = translateAndScale, SVGUtil.transformOrigin = transformOrigin,
|
11524 | SVGUtil.flushAllD3Transitions = flushAllD3Transitions, SVGUtil.flushAllD3TransitionsIfNeeded = flushAllD3TransitionsIfNeeded,
|
11525 | SVGUtil.ensureDAttribute = ensureDAttribute, SVGUtil.ensureValidSVGPoint = ensureValidSVGPoint,
|
11526 | SVGUtil.parseTranslateTransform = parseTranslateTransform, SVGUtil.createArrow = createArrow,
|
11527 | SVGUtil.getTransformScaleRatios = getTransformScaleRatios;
|
11528 | }(SVGUtil = visuals.SVGUtil || (visuals.SVGUtil = {}));
|
11529 | var SVGScaleDetector = function() {
|
11530 | function SVGScaleDetector(svgElement) {
|
11531 | this.scaleDetectorElement = svgElement.append("rect").classed("scale-detector", !0).attr({
|
11532 | width: 1,
|
11533 | height: 1,
|
11534 | "stroke-width": "0px",
|
11535 | fill: "none"
|
11536 | }).node();
|
11537 | }
|
11538 | return SVGScaleDetector.prototype.getScale = function() {
|
11539 | var scaledRect = this.scaleDetectorElement.getBoundingClientRect(), domRect = this.scaleDetectorElement.getBBox();
|
11540 | return domRect.height > 0 && domRect.width > 0 ? {
|
11541 | x: scaledRect.width / domRect.width,
|
11542 | y: scaledRect.height / domRect.height
|
11543 | } : {
|
11544 | x: 1,
|
11545 | y: 1
|
11546 | };
|
11547 | }, SVGScaleDetector;
|
11548 | }();
|
11549 | visuals.SVGScaleDetector = SVGScaleDetector;
|
11550 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11551 | }(powerbi || (powerbi = {}));
|
11552 | }, function(module, exports) {
|
11553 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
11554 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
11555 | !function(powerbi) {
|
11556 | var visuals;
|
11557 | !function(visuals) {
|
11558 | var TextUtil;
|
11559 | !function(TextUtil) {
|
11560 | function removeBreakingSpaces(str) {
|
11561 | return str.toString().replace(new RegExp(" ", "g"), " ");
|
11562 | }
|
11563 | function removeEllipses(str) {
|
11564 | return str.replace(/…/g, "");
|
11565 | }
|
11566 | function replaceSpaceWithNBSP(txt) {
|
11567 | return null != txt ? txt.replace(/ /g, " ") : void 0;
|
11568 | }
|
11569 | TextUtil.removeBreakingSpaces = removeBreakingSpaces, TextUtil.removeEllipses = removeEllipses,
|
11570 | TextUtil.replaceSpaceWithNBSP = replaceSpaceWithNBSP;
|
11571 | }(TextUtil = visuals.TextUtil || (visuals.TextUtil = {}));
|
11572 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11573 | }(powerbi || (powerbi = {}));
|
11574 | }, function(module, exports) {
|
11575 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
11576 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
11577 | !function(powerbi) {
|
11578 | var visuals;
|
11579 | !function(visuals) {
|
11580 | var GradientUtils, DataRoleHelper = powerbi.data.DataRoleHelper;
|
11581 | !function(GradientUtils) {
|
11582 | function getFillRuleRole(objectDescs) {
|
11583 | if (objectDescs) for (var objectName in objectDescs) {
|
11584 | var objectDesc = objectDescs[objectName];
|
11585 | for (var propertyName in objectDesc.properties) {
|
11586 | var propertyDesc = objectDesc.properties[propertyName];
|
11587 | if (propertyDesc.type && propertyDesc.type[FillRulePropertyIdentifier]) return propertyDesc.rule.inputRole;
|
11588 | }
|
11589 | }
|
11590 | }
|
11591 | function shouldShowGradient(visualConfig) {
|
11592 | var isShowGradienCard = !!(visualConfig && visualConfig.query && visualConfig.query.projections && visualConfig.query.projections.Gradient);
|
11593 | return isShowGradienCard;
|
11594 | }
|
11595 | function getUpdatedGradientSettings(gradientObject) {
|
11596 | var gradientSettings;
|
11597 | if (gradientObject && !$.isEmptyObject(gradientObject)) {
|
11598 | gradientSettings = getDefaultGradientSettings();
|
11599 | for (var propertyName in gradientSettings) {
|
11600 | var hasProperty = gradientObject.hasOwnProperty(propertyName);
|
11601 | if (hasProperty) {
|
11602 | var value = gradientObject[propertyName];
|
11603 | value && value.solid && value.solid.color && (value = value.solid.color), gradientSettings[propertyName] = value;
|
11604 | }
|
11605 | }
|
11606 | }
|
11607 | return gradientSettings;
|
11608 | }
|
11609 | function getGradientMeasureIndex(dataViewCategorical) {
|
11610 | if (dataViewCategorical && dataViewCategorical.values && dataViewCategorical.values.grouped) {
|
11611 | var grouped = dataViewCategorical.values.grouped();
|
11612 | return DataRoleHelper.getMeasureIndexOfRole(grouped, "Gradient");
|
11613 | }
|
11614 | return -1;
|
11615 | }
|
11616 | function getGradientValueColumn(dataViewCategorical) {
|
11617 | if (null == dataViewCategorical) return null;
|
11618 | var gradientMeasureIndex = GradientUtils.getGradientMeasureIndex(dataViewCategorical), gradientValueColumn = -1 === gradientMeasureIndex ? null : dataViewCategorical.values[gradientMeasureIndex];
|
11619 | return gradientValueColumn;
|
11620 | }
|
11621 | function hasGradientRole(dataViewCategorical) {
|
11622 | var gradientMeasureIndex = getGradientMeasureIndex(dataViewCategorical);
|
11623 | return gradientMeasureIndex >= 0;
|
11624 | }
|
11625 | function getDefaultGradientSettings() {
|
11626 | var colors = getDefaultColors(), gradientSettings = {
|
11627 | diverging: !1,
|
11628 | minColor: colors.minColor,
|
11629 | midColor: DefaultMidColor,
|
11630 | maxColor: colors.maxColor,
|
11631 | minValue: void 0,
|
11632 | midValue: void 0,
|
11633 | maxValue: void 0
|
11634 | };
|
11635 | return gradientSettings;
|
11636 | }
|
11637 | function getDefaultFillRuleDefinition() {
|
11638 | return getLinearGradien2FillRuleDefinition();
|
11639 | }
|
11640 | function updateFillRule(propertyName, propertyValue, definitions) {
|
11641 | var numericValueExpr, colorValueExpr, dataPointObjectDefinition = powerbi.data.DataViewObjectDefinitions.ensure(definitions, DataPointPropertyIdentifier, null), fillRule = getFillRule(definitions);
|
11642 | fillRule && ($.isNumeric(propertyValue) && (numericValueExpr = void 0 !== propertyValue ? SQExprBuilder["double"](+propertyValue) : void 0),
|
11643 | "minColor" !== propertyName && "midColor" !== propertyName && "maxColor" !== propertyName || (colorValueExpr = getColorExpressionValue(fillRule, propertyName, propertyValue)),
|
11644 | "minColor" === propertyName ? updateMinColor(fillRule, colorValueExpr) : "midColor" === propertyName ? updateMidColor(fillRule, colorValueExpr) : "maxColor" === propertyName ? updateMaxColor(fillRule, colorValueExpr) : "minValue" === propertyName ? updateMinValue(fillRule, numericValueExpr) : "midValue" === propertyName ? updateMidValue(fillRule, numericValueExpr) : "maxValue" === propertyName ? updateMaxValue(fillRule, numericValueExpr) : "diverging" === propertyName ? (fillRule = propertyValue ? getLinearGradien3FillRuleDefinition(fillRule) : getLinearGradien2FillRuleDefinition(fillRule),
|
11645 | dataPointObjectDefinition.properties[FillRulePropertyIdentifier] = fillRule) : "revertToDefault" === propertyName && (fillRule = this.getDefaultFillRuleDefinition(),
|
11646 | dataPointObjectDefinition.properties[FillRulePropertyIdentifier] = fillRule));
|
11647 | }
|
11648 | function getGradientSettings(baseFillRule) {
|
11649 | return baseFillRule ? getGradientSettingsFromRule(baseFillRule) : getDefaultGradientSettings();
|
11650 | }
|
11651 | function getFillRule(objectDefinitions) {
|
11652 | var fillRuleDefinition = powerbi.data.DataViewObjectDefinitions.getValue(objectDefinitions, {
|
11653 | objectName: DataPointPropertyIdentifier,
|
11654 | propertyName: FillRulePropertyIdentifier
|
11655 | }, null);
|
11656 | return fillRuleDefinition;
|
11657 | }
|
11658 | function getDefaultColors() {
|
11659 | var dataColors = new powerbi.visuals.DataColorPalette(), maxColorInfo = dataColors.getColorByIndex(0), colors = d3.scale.linear().domain([ 0, 100 ]).range([ "#ffffff", maxColorInfo.value ]), maxColor = maxColorInfo.value, minColor = colors(20), midColor = DefaultMidColor;
|
11660 | return {
|
11661 | minColor: minColor,
|
11662 | midColor: midColor,
|
11663 | maxColor: maxColor
|
11664 | };
|
11665 | }
|
11666 | function getGradientSettingsFromRule(fillRule) {
|
11667 | var maxColor, minColor, maxValue, midValue, minValue, midColor = DefaultMidColor, diverging = void 0 !== fillRule.linearGradient3;
|
11668 | if (fillRule.linearGradient2) {
|
11669 | var maxColorExpr = fillRule.linearGradient2.max.color, minColorExpr = fillRule.linearGradient2.min.color, maxValueExpr = fillRule.linearGradient2.max.value, minValueExpr = fillRule.linearGradient2.min.value;
|
11670 | maxColor = maxColorExpr.value, minColor = minColorExpr.value, maxValueExpr && (maxValue = maxValueExpr.value),
|
11671 | minValueExpr && (minValue = minValueExpr.value);
|
11672 | } else if (fillRule.linearGradient3) {
|
11673 | var maxColorExpr = fillRule.linearGradient3.max.color, midColorExpr = fillRule.linearGradient3.mid.color, minColorExpr = fillRule.linearGradient3.min.color, maxValueExpr = fillRule.linearGradient3.max.value, midValueExpr = fillRule.linearGradient3.mid.value, minValueExpr = fillRule.linearGradient3.min.value;
|
11674 | maxColor = maxColorExpr.value, midColor = midColorExpr.value, minColor = minColorExpr.value,
|
11675 | maxValueExpr && (maxValue = maxValueExpr.value), midValueExpr && (midValue = midValueExpr.value),
|
11676 | minValueExpr && (minValue = minValueExpr.value);
|
11677 | }
|
11678 | return {
|
11679 | diverging: diverging,
|
11680 | minColor: minColor,
|
11681 | midColor: midColor,
|
11682 | maxColor: maxColor,
|
11683 | minValue: minValue,
|
11684 | midValue: midValue,
|
11685 | maxValue: maxValue
|
11686 | };
|
11687 | }
|
11688 | function getGradientBarColors(gradientSettings) {
|
11689 | var colors = [];
|
11690 | return gradientSettings.minColor = gradientSettings.minColor || DefaultColor, colors.push(gradientSettings.minColor),
|
11691 | gradientSettings.diverging && (gradientSettings.midColor = gradientSettings.midColor || DefaultColor,
|
11692 | colors.push(gradientSettings.midColor || DefaultColor)), gradientSettings.maxColor = gradientSettings.maxColor || DefaultColor,
|
11693 | colors.push(gradientSettings.maxColor || DefaultColor), colors.join(",");
|
11694 | }
|
11695 | function getLinearGradien2FillRuleDefinition(baseFillRule) {
|
11696 | var gradientSettings = getGradientSettings(baseFillRule), fillRuleDefinition = {
|
11697 | linearGradient2: {
|
11698 | max: {
|
11699 | color: SQExprBuilder.text(gradientSettings.maxColor)
|
11700 | },
|
11701 | min: {
|
11702 | color: SQExprBuilder.text(gradientSettings.minColor)
|
11703 | }
|
11704 | }
|
11705 | };
|
11706 | return fillRuleDefinition;
|
11707 | }
|
11708 | function getLinearGradien3FillRuleDefinition(baseFillRule) {
|
11709 | var gradientSettings = getGradientSettings(baseFillRule), fillRuleDefinition = {
|
11710 | linearGradient3: {
|
11711 | max: {
|
11712 | color: SQExprBuilder.text(gradientSettings.maxColor)
|
11713 | },
|
11714 | mid: {
|
11715 | color: SQExprBuilder.text(gradientSettings.midColor)
|
11716 | },
|
11717 | min: {
|
11718 | color: SQExprBuilder.text(gradientSettings.minColor)
|
11719 | }
|
11720 | }
|
11721 | };
|
11722 | return fillRuleDefinition;
|
11723 | }
|
11724 | function getDefaultColorExpression(fillRule, propertyName) {
|
11725 | var defaultColor, defaultFillRule;
|
11726 | return fillRule.linearGradient3 ? (defaultFillRule = getLinearGradien3FillRuleDefinition(),
|
11727 | "minColor" === propertyName ? defaultColor = defaultFillRule.linearGradient3.min.color : "midColor" === propertyName ? defaultColor = defaultFillRule.linearGradient3.mid.color : "maxColor" === propertyName && (defaultColor = defaultFillRule.linearGradient3.max.color)) : fillRule.linearGradient2 && (defaultFillRule = getLinearGradien2FillRuleDefinition(),
|
11728 | "minColor" === propertyName ? defaultColor = defaultFillRule.linearGradient2.min.color : "maxColor" === propertyName && (defaultColor = defaultFillRule.linearGradient2.max.color)),
|
11729 | defaultColor;
|
11730 | }
|
11731 | function getColorExpressionValue(fillRule, propertyName, propertyValue) {
|
11732 | var colorExpressionValue;
|
11733 | return colorExpressionValue = propertyValue ? SQExprBuilder.text(propertyValue) : getDefaultColorExpression(fillRule, propertyName);
|
11734 | }
|
11735 | function updateMinColor(fillRule, colorExpressionValue) {
|
11736 | fillRule.linearGradient2 ? fillRule.linearGradient2.min.color = colorExpressionValue : fillRule.linearGradient3 && (fillRule.linearGradient3.min.color = colorExpressionValue);
|
11737 | }
|
11738 | function updateMidColor(fillRule, colorExpressionValue) {
|
11739 | fillRule.linearGradient3 && (fillRule.linearGradient3.mid.color = colorExpressionValue);
|
11740 | }
|
11741 | function updateMaxColor(fillRule, colorExpressionValue) {
|
11742 | fillRule.linearGradient2 ? fillRule.linearGradient2.max.color = colorExpressionValue : fillRule.linearGradient3 && (fillRule.linearGradient3.max.color = colorExpressionValue);
|
11743 | }
|
11744 | function updateMinValue(fillRule, value) {
|
11745 | fillRule.linearGradient2 ? fillRule.linearGradient2.min.value = value : fillRule.linearGradient3 && (fillRule.linearGradient3.min.value = value);
|
11746 | }
|
11747 | function updateMidValue(fillRule, value) {
|
11748 | fillRule.linearGradient3 && (fillRule.linearGradient3.mid.value = value);
|
11749 | }
|
11750 | function updateMaxValue(fillRule, value) {
|
11751 | fillRule.linearGradient2 ? fillRule.linearGradient2.max.value = value : fillRule.linearGradient3 && (fillRule.linearGradient3.max.value = value);
|
11752 | }
|
11753 | var SQExprBuilder = powerbi.data.SQExprBuilder, DefaultMidColor = "#ffffff", DefaultColor = DefaultMidColor, DataPointPropertyIdentifier = "dataPoint", FillRulePropertyIdentifier = "fillRule";
|
11754 | GradientUtils.getFillRuleRole = getFillRuleRole, GradientUtils.shouldShowGradient = shouldShowGradient,
|
11755 | GradientUtils.getUpdatedGradientSettings = getUpdatedGradientSettings, GradientUtils.getGradientMeasureIndex = getGradientMeasureIndex,
|
11756 | GradientUtils.getGradientValueColumn = getGradientValueColumn, GradientUtils.hasGradientRole = hasGradientRole,
|
11757 | GradientUtils.getDefaultGradientSettings = getDefaultGradientSettings, GradientUtils.getDefaultFillRuleDefinition = getDefaultFillRuleDefinition,
|
11758 | GradientUtils.updateFillRule = updateFillRule, GradientUtils.getGradientSettings = getGradientSettings,
|
11759 | GradientUtils.getFillRule = getFillRule, GradientUtils.getGradientSettingsFromRule = getGradientSettingsFromRule,
|
11760 | GradientUtils.getGradientBarColors = getGradientBarColors;
|
11761 | }(GradientUtils = visuals.GradientUtils || (visuals.GradientUtils = {}));
|
11762 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11763 | }(powerbi || (powerbi = {}));
|
11764 | }, function(module, exports) {
|
11765 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
11766 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
11767 | !function(powerbi) {
|
11768 | var visuals;
|
11769 | !function(visuals) {
|
11770 | var visualBackgroundHelper;
|
11771 | !function(visualBackgroundHelper) {
|
11772 | function getDefaultColor() {
|
11773 | return "#FFF";
|
11774 | }
|
11775 | function getDefaultTransparency() {
|
11776 | return 50;
|
11777 | }
|
11778 | function getDefaultShow() {
|
11779 | return !1;
|
11780 | }
|
11781 | function getDefaultValues() {
|
11782 | return {
|
11783 | color: getDefaultColor(),
|
11784 | transparency: getDefaultTransparency(),
|
11785 | show: getDefaultShow()
|
11786 | };
|
11787 | }
|
11788 | function enumeratePlot(enumeration, background) {
|
11789 | var transparency = background && background.transparency;
|
11790 | null == transparency && (transparency = getDefaultTransparency());
|
11791 | var backgroundObject = {
|
11792 | selector: null,
|
11793 | properties: {
|
11794 | transparency: transparency,
|
11795 | image: background && background.image
|
11796 | },
|
11797 | objectName: "plotArea"
|
11798 | };
|
11799 | enumeration.pushInstance(backgroundObject);
|
11800 | }
|
11801 | function renderBackgroundImage(background, visualElement, layout) {
|
11802 | var image = background && background.image, imageUrl = image && image.url, imageFit = image && image.scaling, imageTransparency = background && background.transparency, backgroundImage = visualElement.children(".background-image");
|
11803 | if (!imageUrl) return void (0 !== backgroundImage.length && backgroundImage.remove());
|
11804 | switch (0 === backgroundImage.length && (visualElement.prepend('<div class="background-image"></div>'),
|
11805 | backgroundImage = visualElement.children(".background-image"), backgroundImage.css("position", "absolute")),
|
11806 | backgroundImage.css({
|
11807 | width: layout.width,
|
11808 | height: layout.height,
|
11809 | "margin-left": layout.left,
|
11810 | "margin-top": layout.top
|
11811 | }), backgroundImage.css({
|
11812 | "background-image": "url(" + imageUrl + ")",
|
11813 | "background-repeat": "no-repeat",
|
11814 | opacity: (100 - imageTransparency) / 100
|
11815 | }), imageFit) {
|
11816 | case visuals.imageScalingType.normal:
|
11817 | backgroundImage.css({
|
11818 | "background-size": "",
|
11819 | "background-position": "50% 50%"
|
11820 | });
|
11821 | break;
|
11822 |
|
11823 | case visuals.imageScalingType.fit:
|
11824 | backgroundImage.css({
|
11825 | "background-size": "100% 100%",
|
11826 | "background-position": ""
|
11827 | });
|
11828 | break;
|
11829 |
|
11830 | case visuals.imageScalingType.fill:
|
11831 | backgroundImage.css({
|
11832 | "background-size": "100%",
|
11833 | "background-position": "50% 50%"
|
11834 | });
|
11835 | break;
|
11836 |
|
11837 | default:
|
11838 | backgroundImage.css({
|
11839 | "background-size": "",
|
11840 | "background-position": "50% 50%"
|
11841 | });
|
11842 | }
|
11843 | }
|
11844 | visualBackgroundHelper.getDefaultColor = getDefaultColor, visualBackgroundHelper.getDefaultTransparency = getDefaultTransparency,
|
11845 | visualBackgroundHelper.getDefaultShow = getDefaultShow, visualBackgroundHelper.getDefaultValues = getDefaultValues,
|
11846 | visualBackgroundHelper.enumeratePlot = enumeratePlot, visualBackgroundHelper.renderBackgroundImage = renderBackgroundImage;
|
11847 | }(visualBackgroundHelper = visuals.visualBackgroundHelper || (visuals.visualBackgroundHelper = {}));
|
11848 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11849 | }(powerbi || (powerbi = {}));
|
11850 | }, function(module, exports) {
|
11851 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
11852 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
11853 | !function(powerbi) {
|
11854 | var visuals;
|
11855 | !function(visuals) {
|
11856 | var Selector = powerbi.data.Selector, ObjectEnumerationBuilder = function() {
|
11857 | function ObjectEnumerationBuilder() {}
|
11858 | return ObjectEnumerationBuilder.prototype.pushInstance = function(instance) {
|
11859 | var instances = this.instances;
|
11860 | instances || (instances = this.instances = []);
|
11861 | var containerIdx = this.containerIdx;
|
11862 | null != containerIdx && (instance.containerIdx = containerIdx);
|
11863 | for (var _i = 0, instances_1 = instances; _i < instances_1.length; _i++) {
|
11864 | var existingInstance = instances_1[_i];
|
11865 | if (this.canMerge(existingInstance, instance)) return this.extend(existingInstance, instance, "properties"),
|
11866 | this.extend(existingInstance, instance, "validValues"), this;
|
11867 | }
|
11868 | return instances.push(instance), this;
|
11869 | }, ObjectEnumerationBuilder.prototype.pushContainer = function(container) {
|
11870 | var containers = this.containers;
|
11871 | containers || (containers = this.containers = []);
|
11872 | var updatedLen = containers.push(container);
|
11873 | return this.containerIdx = updatedLen - 1, this;
|
11874 | }, ObjectEnumerationBuilder.prototype.popContainer = function() {
|
11875 | return this.containerIdx = void 0, this;
|
11876 | }, ObjectEnumerationBuilder.prototype.complete = function() {
|
11877 | if (this.instances) {
|
11878 | var result = {
|
11879 | instances: this.instances
|
11880 | }, containers = this.containers;
|
11881 | return containers && (result.containers = containers), result;
|
11882 | }
|
11883 | }, ObjectEnumerationBuilder.prototype.canMerge = function(x, y) {
|
11884 | return x.objectName === y.objectName && x.containerIdx === y.containerIdx && Selector.equals(x.selector, y.selector);
|
11885 | }, ObjectEnumerationBuilder.prototype.extend = function(target, source, propertyName) {
|
11886 | var sourceValues = source[propertyName];
|
11887 | if (sourceValues) {
|
11888 | var targetValues = target[propertyName];
|
11889 | targetValues || (targetValues = target[propertyName] = {});
|
11890 | for (var valuePropertyName in sourceValues) targetValues[valuePropertyName] || (targetValues[valuePropertyName] = sourceValues[valuePropertyName]);
|
11891 | }
|
11892 | }, ObjectEnumerationBuilder.merge = function(x, y) {
|
11893 | var xNormalized = ObjectEnumerationBuilder.normalize(x), yNormalized = ObjectEnumerationBuilder.normalize(y);
|
11894 | if (!xNormalized || !yNormalized) return xNormalized || yNormalized;
|
11895 | for (var xCategoryCount = xNormalized.containers ? xNormalized.containers.length : 0, _i = 0, _a = yNormalized.instances; _i < _a.length; _i++) {
|
11896 | var yInstance = _a[_i];
|
11897 | xNormalized.instances.push(yInstance), null != yInstance.containerIdx && (yInstance.containerIdx += xCategoryCount);
|
11898 | }
|
11899 | var yContainers = yNormalized.containers;
|
11900 | return _.isEmpty(yContainers) || (xNormalized.containers ? Array.prototype.push.apply(xNormalized.containers, yContainers) : xNormalized.containers = yContainers),
|
11901 | xNormalized;
|
11902 | }, ObjectEnumerationBuilder.normalize = function(x) {
|
11903 | return _.isArray(x) ? {
|
11904 | instances: x
|
11905 | } : x;
|
11906 | }, ObjectEnumerationBuilder.getContainerForInstance = function(enumeration, instance) {
|
11907 | return enumeration.containers[instance.containerIdx];
|
11908 | }, ObjectEnumerationBuilder;
|
11909 | }();
|
11910 | visuals.ObjectEnumerationBuilder = ObjectEnumerationBuilder;
|
11911 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11912 | }(powerbi || (powerbi = {}));
|
11913 | }, function(module, exports) {
|
11914 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
11915 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
11916 | !function(powerbi) {
|
11917 | var visuals;
|
11918 | !function(visuals) {
|
11919 | var VisualBorderUtil;
|
11920 | !function(VisualBorderUtil) {
|
11921 | function getBorderWidth(outlineType, outlineWeight) {
|
11922 | switch (outlineType) {
|
11923 | case visuals.outline.none:
|
11924 | return "0px";
|
11925 |
|
11926 | case visuals.outline.bottomOnly:
|
11927 | return "0px 0px " + outlineWeight + "px 0px";
|
11928 |
|
11929 | case visuals.outline.topOnly:
|
11930 | return outlineWeight + "px 0px 0px 0px";
|
11931 |
|
11932 | case visuals.outline.leftOnly:
|
11933 | return "0px 0px 0px " + outlineWeight + "px";
|
11934 |
|
11935 | case visuals.outline.rightOnly:
|
11936 | return "0px " + outlineWeight + "px 0px 0px";
|
11937 |
|
11938 | case visuals.outline.topBottom:
|
11939 | return outlineWeight + "px 0px";
|
11940 |
|
11941 | case visuals.outline.leftRight:
|
11942 | return "0px " + outlineWeight + "px";
|
11943 |
|
11944 | case visuals.outline.frame:
|
11945 | return outlineWeight + "px";
|
11946 |
|
11947 | default:
|
11948 | return "0px";
|
11949 | }
|
11950 | }
|
11951 | VisualBorderUtil.getBorderWidth = getBorderWidth;
|
11952 | }(VisualBorderUtil = visuals.VisualBorderUtil || (visuals.VisualBorderUtil = {}));
|
11953 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11954 | }(powerbi || (powerbi = {}));
|
11955 | }, function(module, exports) {
|
11956 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
11957 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
11958 | !function(powerbi) {
|
11959 | var visuals;
|
11960 | !function(visuals) {
|
11961 | function createTranslateMatrix(xOffset, yOffset) {
|
11962 | return {
|
11963 | m00: 1,
|
11964 | m01: 0,
|
11965 | m02: xOffset,
|
11966 | m10: 0,
|
11967 | m11: 1,
|
11968 | m12: yOffset
|
11969 | };
|
11970 | }
|
11971 | function createScaleMatrix(xScale, yScale) {
|
11972 | return {
|
11973 | m00: xScale,
|
11974 | m01: 0,
|
11975 | m02: 0,
|
11976 | m10: 0,
|
11977 | m11: yScale,
|
11978 | m12: 0
|
11979 | };
|
11980 | }
|
11981 | function createRotationMatrix(angleInRads) {
|
11982 | var a = angleInRads, sinA = Math.sin(a), cosA = Math.cos(a);
|
11983 | return {
|
11984 | m00: cosA,
|
11985 | m01: -sinA,
|
11986 | m02: 0,
|
11987 | m10: sinA,
|
11988 | m11: cosA,
|
11989 | m12: 0
|
11990 | };
|
11991 | }
|
11992 | function createInverseMatrix(m) {
|
11993 | var determinant = m.m00 * m.m11 - m.m01 * m.m10, invdet = 1 / determinant;
|
11994 | return {
|
11995 | m00: m.m11 * invdet,
|
11996 | m01: -m.m01 * invdet,
|
11997 | m02: (m.m01 * m.m12 - m.m02 * m.m11) * invdet,
|
11998 | m10: -m.m10 * invdet,
|
11999 | m11: m.m00 * invdet,
|
12000 | m12: -(m.m00 * m.m12 - m.m10 * m.m02) * invdet
|
12001 | };
|
12002 | }
|
12003 | function multiplyMatrices(a, b) {
|
12004 | return {
|
12005 | m00: a.m00 * b.m00 + a.m01 * b.m10,
|
12006 | m01: a.m00 * b.m01 + a.m01 * b.m11,
|
12007 | m02: a.m00 * b.m02 + a.m01 * b.m12 + a.m02,
|
12008 | m10: a.m10 * b.m00 + a.m11 * b.m10,
|
12009 | m11: a.m10 * b.m01 + a.m11 * b.m11,
|
12010 | m12: a.m10 * b.m02 + a.m11 * b.m12 + a.m12
|
12011 | };
|
12012 | }
|
12013 | var Transform = function() {
|
12014 | function Transform(m) {
|
12015 | this.matrix = m || {
|
12016 | m00: 1,
|
12017 | m01: 0,
|
12018 | m02: 0,
|
12019 | m10: 0,
|
12020 | m11: 1,
|
12021 | m12: 0
|
12022 | };
|
12023 | }
|
12024 | return Transform.prototype.applyToPoint = function(point) {
|
12025 | if (!point) return point;
|
12026 | var m = this.matrix;
|
12027 | return {
|
12028 | x: m.m00 * point.x + m.m01 * point.y + m.m02,
|
12029 | y: m.m10 * point.x + m.m11 * point.y + m.m12
|
12030 | };
|
12031 | }, Transform.prototype.applyToRect = function(rect) {
|
12032 | if (!rect) return rect;
|
12033 | var x0 = rect.left, y0 = rect.top, m = this.matrix, isScaled = 1 !== m.m00 || 1 !== m.m11, isRotated = 0 !== m.m01 || 0 !== m.m10;
|
12034 | if (!isRotated && !isScaled) return {
|
12035 | left: x0 + m.m02,
|
12036 | top: y0 + m.m12,
|
12037 | width: rect.width,
|
12038 | height: rect.height
|
12039 | };
|
12040 | var minX, maxX, minY, maxY, x1 = rect.left + rect.width, y1 = rect.top + rect.height;
|
12041 | if (isRotated) {
|
12042 | var p0x = m.m00 * x0 + m.m01 * y0 + m.m02, p0y = m.m10 * x0 + m.m11 * y0 + m.m12, p1x = m.m00 * x0 + m.m01 * y1 + m.m02, p1y = m.m10 * x0 + m.m11 * y1 + m.m12, p2x = m.m00 * x1 + m.m01 * y0 + m.m02, p2y = m.m10 * x1 + m.m11 * y0 + m.m12, p3x = m.m00 * x1 + m.m01 * y1 + m.m02, p3y = m.m10 * x1 + m.m11 * y1 + m.m12;
|
12043 | minX = Math.min(p0x, p1x, p2x, p3x), maxX = Math.max(p0x, p1x, p2x, p3x), minY = Math.min(p0y, p1y, p2y, p3y),
|
12044 | maxY = Math.max(p0y, p1y, p2y, p3y);
|
12045 | } else {
|
12046 | var p0x = m.m00 * x0 + m.m02, p0y = m.m11 * y0 + m.m12, p3x = m.m00 * x1 + m.m02, p3y = m.m11 * y1 + m.m12;
|
12047 | minX = Math.min(p0x, p3x), maxX = Math.max(p0x, p3x), minY = Math.min(p0y, p3y),
|
12048 | maxY = Math.max(p0y, p3y);
|
12049 | }
|
12050 | return {
|
12051 | left: minX,
|
12052 | top: minY,
|
12053 | width: maxX - minX,
|
12054 | height: maxY - minY
|
12055 | };
|
12056 | }, Transform.prototype.translate = function(xOffset, yOffset) {
|
12057 | if (0 !== xOffset || 0 !== yOffset) {
|
12058 | var m = createTranslateMatrix(xOffset, yOffset);
|
12059 | this.matrix = multiplyMatrices(this.matrix, m), this._inverse = null;
|
12060 | }
|
12061 | }, Transform.prototype.scale = function(xScale, yScale) {
|
12062 | if (1 !== xScale || 1 !== yScale) {
|
12063 | var m = createScaleMatrix(xScale, yScale);
|
12064 | this.matrix = multiplyMatrices(this.matrix, m), this._inverse = null;
|
12065 | }
|
12066 | }, Transform.prototype.rotate = function(angleInRadians) {
|
12067 | if (0 !== angleInRadians) {
|
12068 | var m = createRotationMatrix(angleInRadians);
|
12069 | this.matrix = multiplyMatrices(this.matrix, m), this._inverse = null;
|
12070 | }
|
12071 | }, Transform.prototype.add = function(other) {
|
12072 | other && (this.matrix = multiplyMatrices(this.matrix, other.matrix), this._inverse = null);
|
12073 | }, Transform.prototype.getInverse = function() {
|
12074 | return this._inverse || (this._inverse = new Transform(createInverseMatrix(this.matrix))),
|
12075 | this._inverse;
|
12076 | }, Transform;
|
12077 | }();
|
12078 | visuals.Transform = Transform, visuals.createTranslateMatrix = createTranslateMatrix,
|
12079 | visuals.createScaleMatrix = createScaleMatrix, visuals.createRotationMatrix = createRotationMatrix,
|
12080 | visuals.createInverseMatrix = createInverseMatrix;
|
12081 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
12082 | }(powerbi || (powerbi = {}));
|
12083 | }, function(module, exports) {
|
12084 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
12085 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
12086 | !function(powerbi) {
|
12087 | var visuals;
|
12088 | !function(visuals) {
|
12089 | var TrendLineHelper, Color = jsCommon.Color, DataRoleHelper = powerbi.data.DataRoleHelper;
|
12090 | !function(TrendLineHelper) {
|
12091 | function enumerateObjectInstances(enumeration, trendLines) {
|
12092 | if (_.isEmpty(trendLines)) return void enumeration.pushInstance({
|
12093 | selector: null,
|
12094 | properties: {
|
12095 | show: !1,
|
12096 | lineColor: TrendLineHelper.defaults.lineColor,
|
12097 | transparency: TrendLineHelper.defaults.transparency,
|
12098 | style: TrendLineHelper.defaults.lineStyle,
|
12099 | combineSeries: TrendLineHelper.defaults.combineSeries
|
12100 | },
|
12101 | objectName: trendObjectName
|
12102 | });
|
12103 | var trendLine = trendLines[0], properties = {};
|
12104 | properties.show = trendLine.show, trendLine.combineSeries && (properties.lineColor = trendLine.lineColor),
|
12105 | properties.transparency = trendLine.transparency, properties.style = trendLine.style,
|
12106 | properties.combineSeries = trendLine.combineSeries, properties.useHighlightValues = trendLine.useHighlightValues,
|
12107 | enumeration.pushInstance({
|
12108 | selector: null,
|
12109 | properties: properties,
|
12110 | objectName: trendObjectName
|
12111 | });
|
12112 | }
|
12113 | function isDataViewForRegression(dataView) {
|
12114 | return DataRoleHelper.hasRoleInDataView(dataView, "regression.X");
|
12115 | }
|
12116 | function readDataView(dataView, sourceDataView, y2, colors) {
|
12117 | if (dataView && dataView.categorical) {
|
12118 | var categorical = dataView.categorical;
|
12119 | if (!_.isEmpty(categorical.categories) && !_.isEmpty(categorical.values)) {
|
12120 | var categories = categorical.categories[0].values, groups = categorical.values.grouped();
|
12121 | if (categories && groups) {
|
12122 | var trendProperties = powerbi.DataViewObjects.getObject(dataView.metadata.objects, trendObjectName, {}), show = powerbi.DataViewObject.getValue(trendProperties, trendLinePropertyNames.show, !1), lineColor = powerbi.DataViewObject.getValue(trendProperties, trendLinePropertyNames.lineColor), transparency = powerbi.DataViewObject.getValue(trendProperties, trendLinePropertyNames.transparency, TrendLineHelper.defaults.transparency), style = powerbi.DataViewObject.getValue(trendProperties, trendLinePropertyNames.style, TrendLineHelper.defaults.lineStyle), combineSeries = powerbi.DataViewObject.getValue(trendProperties, trendLinePropertyNames.combineSeries, TrendLineHelper.defaults.combineSeries), useHighlightValues = powerbi.DataViewObject.getValue(trendProperties, trendLinePropertyNames.useHighlightValues, TrendLineHelper.defaults.useHighlightValues), legacyColor = powerbi.DataViewObjects.getValue(categorical.values[0].source.objects, visuals.lineChartProps.dataPoint.fill);
|
12123 | legacyColor && (lineColor = legacyColor);
|
12124 | for (var objects = sourceDataView.metadata.objects, defaultColor = powerbi.DataViewObjects.getFillColor(objects, {
|
12125 | objectName: "dataPoint",
|
12126 | propertyName: "defaultColor"
|
12127 | }), colorHelper = new visuals.ColorHelper(colors, {
|
12128 | objectName: "dataPoint",
|
12129 | propertyName: "fill"
|
12130 | }, defaultColor), trendLines = [], groupIndex = 0; groupIndex < groups.length; groupIndex++) {
|
12131 | for (var group = groups[groupIndex], points = [], i = 0; i < categories.length; i++) {
|
12132 | var x = visuals.AxisHelper.normalizeNonFiniteNumber(categories[i]), valueColumn = group.values[0], values = void 0;
|
12133 | values = useHighlightValues && valueColumn.highlights ? valueColumn.highlights : valueColumn.values;
|
12134 | var y = visuals.AxisHelper.normalizeNonFiniteNumber(values[i]);
|
12135 | null != x && null != y && points.push({
|
12136 | x: x,
|
12137 | y: y
|
12138 | });
|
12139 | }
|
12140 | var seriesLineColor = void 0;
|
12141 | if (combineSeries) seriesLineColor = lineColor || TrendLineHelper.defaults.lineColor; else if (sourceDataView.categorical.values.source) {
|
12142 | var sourceGroups = sourceDataView.categorical.values.grouped(), color = colorHelper.getColorForSeriesValue(sourceGroups[groupIndex].objects, sourceDataView.categorical.values.identityFields, group.name);
|
12143 | color = darkenTrendLineColor(color), seriesLineColor = {
|
12144 | solid: {
|
12145 | color: color
|
12146 | }
|
12147 | };
|
12148 | } else {
|
12149 | var matchingMeasure = sourceDataView.categorical.values[groupIndex], color = colorHelper.getColorForMeasure(matchingMeasure.source.objects, group.name);
|
12150 | color = darkenTrendLineColor(color), seriesLineColor = {
|
12151 | solid: {
|
12152 | color: color
|
12153 | }
|
12154 | };
|
12155 | }
|
12156 | trendLines.push({
|
12157 | points: points,
|
12158 | show: show,
|
12159 | lineColor: seriesLineColor,
|
12160 | transparency: transparency,
|
12161 | style: style,
|
12162 | combineSeries: combineSeries,
|
12163 | useHighlightValues: useHighlightValues,
|
12164 | y2Axis: y2
|
12165 | });
|
12166 | }
|
12167 | return trendLines;
|
12168 | }
|
12169 | }
|
12170 | }
|
12171 | }
|
12172 | function darkenTrendLineColor(color) {
|
12173 | var rgb = Color.parseColorString(color);
|
12174 | return rgb = Color.darken(rgb, 20), Color.rgbString(rgb);
|
12175 | }
|
12176 | function render(trendLines, graphicsContext, axes, viewport) {
|
12177 | var layer = graphicsContext.select(TrendLineLayerClassSelector.selector);
|
12178 | layer.empty() && (layer = graphicsContext.append("svg").classed(TrendLineLayerClassSelector["class"], !0)),
|
12179 | layer.attr({
|
12180 | height: viewport.height,
|
12181 | width: viewport.width
|
12182 | });
|
12183 | var lines = layer.selectAll(TrendLineClassSelector.selector).data(trendLines || []);
|
12184 | lines.enter().append("path").classed(TrendLineClassSelector["class"], !0), lines.attr("d", function(d) {
|
12185 | var xScale = axes.x.scale, yScale = d.y2Axis && axes.y2 ? axes.y2.scale : axes.y1.scale, pathGen = d3.svg.line().x(function(point) {
|
12186 | return xScale(point.x);
|
12187 | }).y(function(point) {
|
12188 | return yScale(point.y);
|
12189 | });
|
12190 | return pathGen(_.filter(d.points, function(point) {
|
12191 | return null != point.x && null != point.y;
|
12192 | }));
|
12193 | }), lines.each(function(d) {
|
12194 | var line = d3.select(this), style = {};
|
12195 | style.stroke = d.lineColor.solid.color, null != d.transparency && (style["stroke-opacity"] = (100 - d.transparency) / 100),
|
12196 | d.style === visuals.lineStyle.dashed ? style["stroke-dasharray"] = "5, 5" : d.style === visuals.lineStyle.dotted ? (style["stroke-dasharray"] = "1, 5",
|
12197 | style["stroke-linecap"] = "round") : d.style === visuals.lineStyle.solid && (style["stroke-dasharray"] = null,
|
12198 | style["stroke-linecap"] = null), line.style(style);
|
12199 | }), lines.exit().remove();
|
12200 | }
|
12201 | var trendLinePropertyNames = {
|
12202 | show: "show",
|
12203 | lineColor: "lineColor",
|
12204 | transparency: "transparency",
|
12205 | style: "style",
|
12206 | combineSeries: "combineSeries",
|
12207 | useHighlightValues: "useHighlightValues"
|
12208 | }, trendObjectName = "trend";
|
12209 | TrendLineHelper.defaults = {
|
12210 | lineColor: {
|
12211 | solid: {
|
12212 | color: "#000"
|
12213 | }
|
12214 | },
|
12215 | lineStyle: visuals.lineStyle.dashed,
|
12216 | transparency: 0,
|
12217 | combineSeries: !0,
|
12218 | useHighlightValues: !0
|
12219 | };
|
12220 | var TrendLineClassSelector = jsCommon.CssConstants.createClassAndSelector("trend-line"), TrendLineLayerClassSelector = jsCommon.CssConstants.createClassAndSelector("trend-line-layer");
|
12221 | TrendLineHelper.enumerateObjectInstances = enumerateObjectInstances, TrendLineHelper.isDataViewForRegression = isDataViewForRegression,
|
12222 | TrendLineHelper.readDataView = readDataView, TrendLineHelper.darkenTrendLineColor = darkenTrendLineColor,
|
12223 | TrendLineHelper.render = render;
|
12224 | }(TrendLineHelper = visuals.TrendLineHelper || (visuals.TrendLineHelper = {}));
|
12225 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
12226 | }(powerbi || (powerbi = {}));
|
12227 | }, function(module, exports) {
|
12228 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
12229 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
12230 | !function(powerbi) {
|
12231 | var visuals;
|
12232 | !function(visuals) {
|
12233 | var visibilityHelper;
|
12234 | !function(visibilityHelper) {
|
12235 | function partiallyVisible(element) {
|
12236 | return element.is(":visible");
|
12237 | }
|
12238 | visibilityHelper.partiallyVisible = partiallyVisible;
|
12239 | }(visibilityHelper = visuals.visibilityHelper || (visuals.visibilityHelper = {}));
|
12240 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
12241 | }(powerbi || (powerbi = {}));
|
12242 | }, function(module, exports) {
|
12243 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
12244 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
12245 | !function(powerbi) {
|
12246 | var VisualObjectRepetition, Selector = powerbi.data.Selector;
|
12247 | !function(VisualObjectRepetition) {
|
12248 | function equals(x, y) {
|
12249 | return x = x || null, y = y || null, x === y ? !0 : !x != !y ? !1 : Selector.equals(x.selector, y.selector) ? _.isEqual(x.objects, y.objects) : !1;
|
12250 | }
|
12251 | VisualObjectRepetition.equals = equals;
|
12252 | }(VisualObjectRepetition = powerbi.VisualObjectRepetition || (powerbi.VisualObjectRepetition = {}));
|
12253 | }(powerbi || (powerbi = {}));
|
12254 | }, function(module, exports) {
|
12255 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi, __extends = (window.powerbitests,
|
12256 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
12257 | function __() {
|
12258 | this.constructor = d;
|
12259 | }
|
12260 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
12261 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12262 | });
|
12263 | !function(powerbi) {
|
12264 | var visuals;
|
12265 | !function(visuals) {
|
12266 | var DataConversion, DefaultSQExprVisitor = powerbi.data.DefaultSQExprVisitor, SemanticFilter = powerbi.data.SemanticFilter, UrlUtils = jsCommon.UrlUtils;
|
12267 | !function(DataConversion) {
|
12268 | function convert(dataView, localizedSelectAllText, interactivityService, hostServices) {
|
12269 | if (dataView && dataView.categorical && !_.isEmpty(dataView.categorical.categories)) {
|
12270 | var identityFields = dataView.categorical.categories[0].identityFields;
|
12271 | if (identityFields) {
|
12272 | var filter = dataView.metadata && dataView.metadata.objects && powerbi.DataViewObjects.getValue(dataView.metadata.objects, visuals.slicerProps.filterPropertyIdentifier), analyzer = hostServices.analyzeFilter({
|
12273 | dataView: dataView,
|
12274 | defaultValuePropertyId: visuals.slicerProps.defaultValue,
|
12275 | filter: filter,
|
12276 | fieldSQExprs: identityFields
|
12277 | });
|
12278 | if (analyzer) {
|
12279 | var analyzedSemanticFilter = analyzer.filter;
|
12280 | if (analyzedSemanticFilter && !SemanticFilter.isSameFilter(analyzedSemanticFilter, filter)) {
|
12281 | interactivityService.handleClearSelection();
|
12282 | var filterPropertyIdentifier = visuals.slicerProps.filterPropertyIdentifier, properties = {};
|
12283 | properties[filterPropertyIdentifier.propertyName] = analyzer.filter;
|
12284 | var instance = {
|
12285 | objectName: filterPropertyIdentifier.objectName,
|
12286 | selector: void 0,
|
12287 | properties: properties
|
12288 | }, changes = {
|
12289 | merge: [ instance ]
|
12290 | };
|
12291 | hostServices.persistProperties(changes);
|
12292 | }
|
12293 | var slicerData = getSlicerData(analyzer, dataView.metadata, dataView.categorical, localizedSelectAllText, interactivityService, hostServices);
|
12294 | return slicerData;
|
12295 | }
|
12296 | }
|
12297 | }
|
12298 | }
|
12299 | function getSlicerData(analyzer, dataViewMetadata, categorical, localizedSelectAllText, interactivityService, hostServices) {
|
12300 | var isInvertedSelectionMode = interactivityService && interactivityService.isSelectionModeInverted(), selectedScopeIds = analyzer.selectedIdentities, hasSelectionOverride = !_.isEmpty(selectedScopeIds) || isInvertedSelectionMode === !0;
|
12301 | !isInvertedSelectionMode && analyzer.filter && (isInvertedSelectionMode = analyzer.isNotFilter),
|
12302 | interactivityService && (interactivityService.setSelectionModeInverted(isInvertedSelectionMode),
|
12303 | interactivityService.setDefaultValueMode(SemanticFilter.isDefaultFilter(analyzer.filter)));
|
12304 | var category = categorical.categories[0], categoryValuesLen = category && category.values ? category.values.length : 0, slicerDataPoints = [], formatString = visuals.valueFormatter.getFormatString(category.source, visuals.slicerProps.formatString), numOfSelected = 0, valueCounts = categorical.values && categorical.values[0] && categorical.values[0].values;
|
12305 | valueCounts && _.isEmpty(valueCounts) && (valueCounts = void 0);
|
12306 | for (var isImageData = dataViewMetadata && !_.isEmpty(dataViewMetadata.columns) && visuals.converterHelper.isImageUrlColumn(dataViewMetadata.columns[0]), displayNameIdentityPairs = [], i = 0; categoryValuesLen > i; i++) {
|
12307 | var scopeId = category.identity && category.identity[i], value = category.values && category.values[i], count = valueCounts && valueCounts[i], isRetained = hasSelectionOverride ? visuals.SlicerUtil.tryRemoveValueFromRetainedList(scopeId, selectedScopeIds) : !1, label = visuals.valueFormatter.format(value, formatString), isImage = isImageData === !0 && UrlUtils.isValidImageUrl(label), slicerData_1 = {
|
12308 | value: label,
|
12309 | tooltip: label,
|
12310 | identity: visuals.SelectionIdBuilder.builder().withCategory(category, i).createSelectionId(),
|
12311 | selected: isRetained,
|
12312 | count: count,
|
12313 | isImage: isImage
|
12314 | };
|
12315 | if (isRetained) {
|
12316 | var displayNameIdentityPair = {
|
12317 | displayName: label,
|
12318 | identity: scopeId
|
12319 | };
|
12320 | displayNameIdentityPairs.push(displayNameIdentityPair);
|
12321 | }
|
12322 | slicerDataPoints.push(slicerData_1), slicerData_1.selected && numOfSelected++;
|
12323 | }
|
12324 | if (_.isEmpty(displayNameIdentityPairs) || hostServices.setIdentityDisplayNames(displayNameIdentityPairs),
|
12325 | hasSelectionOverride && !_.isEmpty(selectedScopeIds)) {
|
12326 | var displayNamesIdentityPairs = hostServices.getIdentityDisplayNames(selectedScopeIds);
|
12327 | if (!_.isEmpty(displayNamesIdentityPairs)) for (var _i = 0, displayNamesIdentityPairs_1 = displayNamesIdentityPairs; _i < displayNamesIdentityPairs_1.length; _i++) {
|
12328 | var pair = displayNamesIdentityPairs_1[_i], slicerData_2 = {
|
12329 | value: pair.displayName,
|
12330 | tooltip: pair.displayName,
|
12331 | identity: visuals.SelectionIdBuilder.builder().withCategoryIdentity(category, pair.identity).createSelectionId(),
|
12332 | selected: !0,
|
12333 | count: null != valueCounts ? 0 : void 0
|
12334 | };
|
12335 | slicerDataPoints.push(slicerData_2), numOfSelected++;
|
12336 | }
|
12337 | }
|
12338 | var searchKey = getSearchKey(dataViewMetadata), defaultSettings = createDefaultSettings(dataViewMetadata);
|
12339 | defaultSettings.selection.selectAllCheckboxEnabled && _.isEmpty(searchKey) && slicerDataPoints.unshift({
|
12340 | value: localizedSelectAllText,
|
12341 | tooltip: localizedSelectAllText,
|
12342 | identity: visuals.SelectionId.createWithMeasure(localizedSelectAllText),
|
12343 | selected: !!isInvertedSelectionMode && 0 === numOfSelected,
|
12344 | isSelectAllDataPoint: !0,
|
12345 | count: void 0
|
12346 | });
|
12347 | var slicerData = {
|
12348 | categorySourceName: category.source.displayName,
|
12349 | slicerSettings: defaultSettings,
|
12350 | slicerDataPoints: slicerDataPoints,
|
12351 | hasSelectionOverride: hasSelectionOverride,
|
12352 | defaultValue: analyzer.defaultValue,
|
12353 | searchKey: searchKey
|
12354 | };
|
12355 | return slicerData;
|
12356 | }
|
12357 | function getSearchKey(dataViewMetadata) {
|
12358 | var selfFilter = powerbi.DataViewObjects.getValue(dataViewMetadata.objects, visuals.slicerProps.selfFilterPropertyIdentifier, void 0);
|
12359 | if (!selfFilter) return "";
|
12360 | var filterItems = selfFilter.conditions(), containsFilter = filterItems[0];
|
12361 | if (containsFilter) {
|
12362 | var containsValueVisitor = new ConditionsFilterValueVisitor();
|
12363 | return containsFilter.accept(containsValueVisitor), containsValueVisitor.getValueForField();
|
12364 | }
|
12365 | }
|
12366 | function createDefaultSettings(dataViewMetadata) {
|
12367 | var defaultSettings = visuals.Slicer.DefaultStyleProperties(), objects = dataViewMetadata.objects, forceSingleSelect = dataViewMetadata.columns && _.some(dataViewMetadata.columns, function(column) {
|
12368 | return column.discourageAggregationAcrossGroups;
|
12369 | });
|
12370 | if (objects) {
|
12371 | defaultSettings.general.outlineColor = powerbi.DataViewObjects.getFillColor(objects, visuals.slicerProps.general.outlineColor, defaultSettings.general.outlineColor),
|
12372 | defaultSettings.general.outlineWeight = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.general.outlineWeight, defaultSettings.general.outlineWeight),
|
12373 | defaultSettings.general.orientation = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.general.orientation, defaultSettings.general.orientation),
|
12374 | defaultSettings.header.show = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.header.show, defaultSettings.header.show),
|
12375 | defaultSettings.header.fontColor = powerbi.DataViewObjects.getFillColor(objects, visuals.slicerProps.header.fontColor, defaultSettings.header.fontColor);
|
12376 | var headerBackground = powerbi.DataViewObjects.getFillColor(objects, visuals.slicerProps.header.background);
|
12377 | headerBackground && (defaultSettings.header.background = headerBackground), defaultSettings.header.outline = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.header.outline, defaultSettings.header.outline),
|
12378 | defaultSettings.header.textSize = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.header.textSize, defaultSettings.header.textSize),
|
12379 | defaultSettings.slicerText.color = powerbi.DataViewObjects.getFillColor(objects, visuals.slicerProps.items.fontColor, defaultSettings.slicerText.color);
|
12380 | var textBackground = powerbi.DataViewObjects.getFillColor(objects, visuals.slicerProps.items.background);
|
12381 | textBackground && (defaultSettings.slicerText.background = textBackground), defaultSettings.slicerText.outline = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.items.outline, defaultSettings.slicerText.outline),
|
12382 | defaultSettings.slicerText.textSize = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.items.textSize, defaultSettings.slicerText.textSize),
|
12383 | defaultSettings.selection.selectAllCheckboxEnabled = !forceSingleSelect && powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.selection.selectAllCheckboxEnabled, defaultSettings.selection.selectAllCheckboxEnabled),
|
12384 | defaultSettings.selection.singleSelect = forceSingleSelect || powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.selection.singleSelect, defaultSettings.selection.singleSelect),
|
12385 | defaultSettings.search.enabled = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.general.selfFilterEnabled, defaultSettings.search.enabled);
|
12386 | }
|
12387 | return defaultSettings;
|
12388 | }
|
12389 | DataConversion.convert = convert;
|
12390 | var ConditionsFilterValueVisitor = function(_super) {
|
12391 | function ConditionsFilterValueVisitor() {
|
12392 | _super.apply(this, arguments);
|
12393 | }
|
12394 | return __extends(ConditionsFilterValueVisitor, _super), ConditionsFilterValueVisitor.prototype.visitConstant = function(expr) {
|
12395 | expr.type && expr.type.text && (this.value = expr.value);
|
12396 | }, ConditionsFilterValueVisitor.prototype.visitContains = function(expr) {
|
12397 | expr.left.accept(this), expr.right.accept(this);
|
12398 | }, ConditionsFilterValueVisitor.prototype.visitColumnRef = function(expr) {
|
12399 | this.fieldExpr = expr;
|
12400 | }, ConditionsFilterValueVisitor.prototype.visitDefault = function(expr) {
|
12401 | this.value = void 0, this.fieldExpr = void 0;
|
12402 | }, ConditionsFilterValueVisitor.prototype.getValueForField = function() {
|
12403 | return this.fieldExpr && this.value;
|
12404 | }, ConditionsFilterValueVisitor;
|
12405 | }(DefaultSQExprVisitor);
|
12406 | }(DataConversion = visuals.DataConversion || (visuals.DataConversion = {}));
|
12407 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
12408 | }(powerbi || (powerbi = {}));
|
12409 | }, function(module, exports) {
|
12410 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
12411 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
12412 | !function(powerbi) {
|
12413 | var shapes = powerbi.visuals.shapes;
|
12414 | !function(RectOrientation) {
|
12415 | RectOrientation[RectOrientation.None = 0] = "None", RectOrientation[RectOrientation.VerticalBottomTop = 1] = "VerticalBottomTop",
|
12416 | RectOrientation[RectOrientation.VerticalTopBottom = 2] = "VerticalTopBottom", RectOrientation[RectOrientation.HorizontalLeftRight = 3] = "HorizontalLeftRight",
|
12417 | RectOrientation[RectOrientation.HorizontalRightLeft = 4] = "HorizontalRightLeft";
|
12418 | }(powerbi.RectOrientation || (powerbi.RectOrientation = {}));
|
12419 | var RectOrientation = powerbi.RectOrientation;
|
12420 | !function(OutsidePlacement) {
|
12421 | OutsidePlacement[OutsidePlacement.Allowed = 0] = "Allowed", OutsidePlacement[OutsidePlacement.Disallowed = 1] = "Disallowed",
|
12422 | OutsidePlacement[OutsidePlacement.Partial = 2] = "Partial";
|
12423 | }(powerbi.OutsidePlacement || (powerbi.OutsidePlacement = {}));
|
12424 | var OutsidePlacement = powerbi.OutsidePlacement, DataLabelManager = function() {
|
12425 | function DataLabelManager() {
|
12426 | this.movingStep = 3, this.hideOverlapped = !0, this.defaultDataLabelSettings = {
|
12427 | anchorMargin: DataLabelManager.DefaultAnchorMargin,
|
12428 | anchorRectOrientation: RectOrientation.None,
|
12429 | contentPosition: 128,
|
12430 | outsidePlacement: OutsidePlacement.Disallowed,
|
12431 | maximumMovingDistance: DataLabelManager.DefaultMaximumMovingDistance,
|
12432 | minimumMovingDistance: DataLabelManager.DefaultMinimumMovingDistance,
|
12433 | validContentPositions: 128,
|
12434 | opacity: 1
|
12435 | };
|
12436 | }
|
12437 | return Object.defineProperty(DataLabelManager.prototype, "defaultSettings", {
|
12438 | get: function() {
|
12439 | return this.defaultDataLabelSettings;
|
12440 | },
|
12441 | enumerable: !0,
|
12442 | configurable: !0
|
12443 | }), DataLabelManager.prototype.hideCollidedLabels = function(viewport, data, layout, addTransform) {
|
12444 | void 0 === addTransform && (addTransform = !1);
|
12445 | var arrangeGrid = new DataLabelArrangeGrid(viewport, data, layout), filteredData = [], transform = {
|
12446 | x: 0,
|
12447 | y: 0
|
12448 | };
|
12449 | addTransform && (transform.x = viewport.width / 2, transform.y = viewport.height / 2);
|
12450 | for (var i = 0, len = data.length; len > i; i++) if (layout.filter(data[i])) {
|
12451 | var info = this.getLabelInfo(data[i]);
|
12452 | info.anchorPoint = {
|
12453 | x: layout.labelLayout.x(data[i]) + transform.x,
|
12454 | y: layout.labelLayout.y(data[i]) + transform.y
|
12455 | };
|
12456 | var position = this.calculateContentPosition(info, info.contentPosition, data[i].size, info.anchorMargin);
|
12457 | DataLabelManager.isValid(position) && !this.hasCollisions(arrangeGrid, info, position, viewport) && (data[i].labelX = position.left - transform.x,
|
12458 | data[i].labelY = position.top - transform.y, arrangeGrid.add(info, position), filteredData.push(data[i]));
|
12459 | }
|
12460 | return filteredData;
|
12461 | }, DataLabelManager.prototype.getLabelInfo = function(source) {
|
12462 | var settings = this.defaultDataLabelSettings;
|
12463 | return source.anchorMargin = void 0 !== source.anchorMargin ? source.anchorMargin : settings.anchorMargin,
|
12464 | source.anchorRectOrientation = void 0 !== source.anchorRectOrientation ? source.anchorRectOrientation : settings.anchorRectOrientation,
|
12465 | source.contentPosition = void 0 !== source.contentPosition ? source.contentPosition : settings.contentPosition,
|
12466 | source.maximumMovingDistance = void 0 !== source.maximumMovingDistance ? source.maximumMovingDistance : settings.maximumMovingDistance,
|
12467 | source.minimumMovingDistance = void 0 !== source.minimumMovingDistance ? source.minimumMovingDistance : settings.minimumMovingDistance,
|
12468 | source.outsidePlacement = void 0 !== source.outsidePlacement ? source.outsidePlacement : settings.outsidePlacement,
|
12469 | source.validContentPositions = void 0 !== source.validContentPositions ? source.validContentPositions : settings.validContentPositions,
|
12470 | source.opacity = void 0 !== source.opacity ? source.opacity : settings.opacity,
|
12471 | source.maximumMovingDistance += source.anchorMargin, source;
|
12472 | }, DataLabelManager.prototype.calculateContentPositionFromPoint = function(anchorPoint, contentPosition, contentSize, offset) {
|
12473 | var position = {
|
12474 | x: 0,
|
12475 | y: 0
|
12476 | };
|
12477 | if (anchorPoint) {
|
12478 | if (void 0 !== anchorPoint.x && isFinite(anchorPoint.x)) switch (position.x = anchorPoint.x,
|
12479 | contentPosition) {
|
12480 | case 1:
|
12481 | case 8:
|
12482 | case 64:
|
12483 | position.x -= contentSize.width / 2;
|
12484 | break;
|
12485 |
|
12486 | case 4:
|
12487 | case 32:
|
12488 | case 256:
|
12489 | position.x += contentSize.width / 2;
|
12490 | }
|
12491 | if (void 0 !== anchorPoint.y && isFinite(anchorPoint.y)) switch (position.y = anchorPoint.y,
|
12492 | contentPosition) {
|
12493 | case 8:
|
12494 | case 16:
|
12495 | case 32:
|
12496 | position.y -= contentSize.height / 2;
|
12497 | break;
|
12498 |
|
12499 | case 4:
|
12500 | case 1:
|
12501 | case 2:
|
12502 | position.y -= contentSize.height;
|
12503 | }
|
12504 | if (void 0 !== offset && isFinite(offset)) switch (contentPosition) {
|
12505 | case 1:
|
12506 | position.x -= offset, position.y -= offset;
|
12507 | break;
|
12508 |
|
12509 | case 8:
|
12510 | position.x -= offset;
|
12511 | break;
|
12512 |
|
12513 | case 64:
|
12514 | position.x -= offset, position.y += offset;
|
12515 | break;
|
12516 |
|
12517 | case 2:
|
12518 | position.y -= offset;
|
12519 | break;
|
12520 |
|
12521 | case 16:
|
12522 | break;
|
12523 |
|
12524 | case 128:
|
12525 | position.y += offset;
|
12526 | break;
|
12527 |
|
12528 | case 4:
|
12529 | position.x += offset, position.y -= offset;
|
12530 | break;
|
12531 |
|
12532 | case 32:
|
12533 | position.x += offset;
|
12534 | break;
|
12535 |
|
12536 | case 256:
|
12537 | position.x += offset, position.y += offset;
|
12538 | }
|
12539 | }
|
12540 | return {
|
12541 | left: position.x,
|
12542 | top: position.y,
|
12543 | width: contentSize.width,
|
12544 | height: contentSize.height
|
12545 | };
|
12546 | }, DataLabelManager.prototype.calculateContentPositionFromRect = function(anchorRect, anchorRectOrientation, contentPosition, contentSize, offset) {
|
12547 | switch (contentPosition) {
|
12548 | case 512:
|
12549 | return this.handleInsideCenterPosition(anchorRectOrientation, contentSize, anchorRect, offset);
|
12550 |
|
12551 | case 2048:
|
12552 | return this.handleInsideEndPosition(anchorRectOrientation, contentSize, anchorRect, offset);
|
12553 |
|
12554 | case 1024:
|
12555 | return this.handleInsideBasePosition(anchorRectOrientation, contentSize, anchorRect, offset);
|
12556 |
|
12557 | case 8192:
|
12558 | return this.handleOutsideEndPosition(anchorRectOrientation, contentSize, anchorRect, offset);
|
12559 |
|
12560 | case 4096:
|
12561 | return this.handleOutsideBasePosition(anchorRectOrientation, contentSize, anchorRect, offset);
|
12562 | }
|
12563 | return {
|
12564 | left: 0,
|
12565 | top: 0,
|
12566 | width: -1,
|
12567 | height: -1
|
12568 | };
|
12569 | }, DataLabelManager.prototype.handleInsideCenterPosition = function(anchorRectOrientation, contentSize, anchorRect, offset) {
|
12570 | switch (anchorRectOrientation) {
|
12571 | case RectOrientation.VerticalBottomTop:
|
12572 | case RectOrientation.VerticalTopBottom:
|
12573 | return LocationConverter.middleVertical(contentSize, anchorRect, offset);
|
12574 |
|
12575 | case RectOrientation.HorizontalLeftRight:
|
12576 | case RectOrientation.HorizontalRightLeft:
|
12577 | default:
|
12578 | return LocationConverter.middleHorizontal(contentSize, anchorRect, offset);
|
12579 | }
|
12580 | }, DataLabelManager.prototype.handleInsideEndPosition = function(anchorRectOrientation, contentSize, anchorRect, offset) {
|
12581 | switch (anchorRectOrientation) {
|
12582 | case RectOrientation.VerticalBottomTop:
|
12583 | return LocationConverter.topInside(contentSize, anchorRect, offset);
|
12584 |
|
12585 | case RectOrientation.VerticalTopBottom:
|
12586 | return LocationConverter.bottomInside(contentSize, anchorRect, offset);
|
12587 |
|
12588 | case RectOrientation.HorizontalRightLeft:
|
12589 | return LocationConverter.leftInside(contentSize, anchorRect, offset);
|
12590 |
|
12591 | case RectOrientation.HorizontalLeftRight:
|
12592 | default:
|
12593 | return LocationConverter.rightInside(contentSize, anchorRect, offset);
|
12594 | }
|
12595 | }, DataLabelManager.prototype.handleInsideBasePosition = function(anchorRectOrientation, contentSize, anchorRect, offset) {
|
12596 | switch (anchorRectOrientation) {
|
12597 | case RectOrientation.VerticalBottomTop:
|
12598 | return LocationConverter.bottomInside(contentSize, anchorRect, offset);
|
12599 |
|
12600 | case RectOrientation.VerticalTopBottom:
|
12601 | return LocationConverter.topInside(contentSize, anchorRect, offset);
|
12602 |
|
12603 | case RectOrientation.HorizontalRightLeft:
|
12604 | return LocationConverter.rightInside(contentSize, anchorRect, offset);
|
12605 |
|
12606 | case RectOrientation.HorizontalLeftRight:
|
12607 | default:
|
12608 | return LocationConverter.leftInside(contentSize, anchorRect, offset);
|
12609 | }
|
12610 | }, DataLabelManager.prototype.handleOutsideEndPosition = function(anchorRectOrientation, contentSize, anchorRect, offset) {
|
12611 | switch (anchorRectOrientation) {
|
12612 | case RectOrientation.VerticalBottomTop:
|
12613 | return LocationConverter.topOutside(contentSize, anchorRect, offset);
|
12614 |
|
12615 | case RectOrientation.VerticalTopBottom:
|
12616 | return LocationConverter.bottomOutside(contentSize, anchorRect, offset);
|
12617 |
|
12618 | case RectOrientation.HorizontalRightLeft:
|
12619 | return LocationConverter.leftOutside(contentSize, anchorRect, offset);
|
12620 |
|
12621 | case RectOrientation.HorizontalLeftRight:
|
12622 | default:
|
12623 | return LocationConverter.rightOutside(contentSize, anchorRect, offset);
|
12624 | }
|
12625 | }, DataLabelManager.prototype.handleOutsideBasePosition = function(anchorRectOrientation, contentSize, anchorRect, offset) {
|
12626 | switch (anchorRectOrientation) {
|
12627 | case RectOrientation.VerticalBottomTop:
|
12628 | return LocationConverter.bottomOutside(contentSize, anchorRect, offset);
|
12629 |
|
12630 | case RectOrientation.VerticalTopBottom:
|
12631 | return LocationConverter.topOutside(contentSize, anchorRect, offset);
|
12632 |
|
12633 | case RectOrientation.HorizontalRightLeft:
|
12634 | return LocationConverter.rightOutside(contentSize, anchorRect, offset);
|
12635 |
|
12636 | case RectOrientation.HorizontalLeftRight:
|
12637 | default:
|
12638 | return LocationConverter.leftOutside(contentSize, anchorRect, offset);
|
12639 | }
|
12640 | }, DataLabelManager.prototype.calculateContentPosition = function(anchoredElementInfo, contentPosition, contentSize, offset) {
|
12641 | return 2048 !== contentPosition && 512 !== contentPosition && 1024 !== contentPosition && 4096 !== contentPosition && 8192 !== contentPosition ? this.calculateContentPositionFromPoint(anchoredElementInfo.anchorPoint, contentPosition, contentSize, offset) : this.calculateContentPositionFromRect(anchoredElementInfo.anchorRect, anchoredElementInfo.anchorRectOrientation, contentPosition, contentSize, offset);
|
12642 | }, DataLabelManager.prototype.hasCollisions = function(arrangeGrid, info, position, size) {
|
12643 | var rect = shapes.Rect;
|
12644 | if (arrangeGrid.hasConflict(position)) return !0;
|
12645 | var intersection = {
|
12646 | left: 0,
|
12647 | top: position.height / 2,
|
12648 | width: size.width,
|
12649 | height: size.height
|
12650 | };
|
12651 | if (intersection = rect.inflate(intersection, {
|
12652 | left: DataLabelManager.InflateAmount,
|
12653 | top: 0,
|
12654 | right: DataLabelManager.InflateAmount,
|
12655 | bottom: 0
|
12656 | }), intersection = rect.intersect(intersection, position), rect.isEmpty(intersection)) return !0;
|
12657 | var lessWithPrecision = powerbi.Double.lessWithPrecision;
|
12658 | switch (info.outsidePlacement) {
|
12659 | case OutsidePlacement.Disallowed:
|
12660 | return lessWithPrecision(intersection.width, position.width) || lessWithPrecision(intersection.height, position.height / 2);
|
12661 |
|
12662 | case OutsidePlacement.Partial:
|
12663 | return lessWithPrecision(intersection.width, position.width / 2) || lessWithPrecision(intersection.height, position.height / 4);
|
12664 | }
|
12665 | return !1;
|
12666 | }, DataLabelManager.isValid = function(rect) {
|
12667 | return !shapes.Rect.isEmpty(rect) && rect.width > 0 && rect.height > 0;
|
12668 | }, DataLabelManager.DefaultAnchorMargin = 0, DataLabelManager.DefaultMaximumMovingDistance = 12,
|
12669 | DataLabelManager.DefaultMinimumMovingDistance = 3, DataLabelManager.InflateAmount = 5,
|
12670 | DataLabelManager;
|
12671 | }();
|
12672 | powerbi.DataLabelManager = DataLabelManager;
|
12673 | var DataLabelArrangeGrid = function() {
|
12674 | function DataLabelArrangeGrid(size, elements, layout) {
|
12675 | this.grid = [], 0 !== size.width && 0 !== size.height || (this.cellSize = size,
|
12676 | this.rowCount = this.colCount = 0);
|
12677 | var baseProperties = {
|
12678 | fontFamily: powerbi.visuals.dataLabelUtils.LabelTextProperties.fontFamily,
|
12679 | fontSize: powerbi.visuals.dataLabelUtils.LabelTextProperties.fontSize,
|
12680 | fontWeight: powerbi.visuals.dataLabelUtils.LabelTextProperties.fontWeight
|
12681 | };
|
12682 | this.cellSize = {
|
12683 | width: 0,
|
12684 | height: 0
|
12685 | };
|
12686 | for (var i = 0, len = elements.length; len > i; i++) {
|
12687 | var child = elements[i];
|
12688 | child.labeltext = layout.labelText(child);
|
12689 | var properties = powerbi.Prototype.inherit(baseProperties);
|
12690 | properties.text = child.labeltext, properties.fontSize = child.data ? child.data.labelFontSize : child.labelFontSize ? child.labelFontSize : powerbi.visuals.dataLabelUtils.LabelTextProperties.fontSize,
|
12691 | child.size = {
|
12692 | width: powerbi.TextMeasurementService.measureSvgTextWidth(properties),
|
12693 | height: powerbi.TextMeasurementService.estimateSvgTextHeight(properties)
|
12694 | };
|
12695 | var w = 2 * child.size.width, h = 2 * child.size.height;
|
12696 | w > this.cellSize.width && (this.cellSize.width = w), h > this.cellSize.height && (this.cellSize.height = h);
|
12697 | }
|
12698 | 0 === this.cellSize.width && (this.cellSize.width = size.width), 0 === this.cellSize.height && (this.cellSize.height = size.height),
|
12699 | this.colCount = this.getGridRowColCount(this.cellSize.width, size.width, DataLabelArrangeGrid.ARRANGEGRID_MIN_COUNT, DataLabelArrangeGrid.ARRANGEGRID_MAX_COUNT),
|
12700 | this.rowCount = this.getGridRowColCount(this.cellSize.height, size.height, DataLabelArrangeGrid.ARRANGEGRID_MIN_COUNT, DataLabelArrangeGrid.ARRANGEGRID_MAX_COUNT),
|
12701 | this.cellSize.width = size.width / this.colCount, this.cellSize.height = size.height / this.rowCount;
|
12702 | for (var grid = this.grid, x = 0; x < this.colCount; x++) {
|
12703 | grid[x] = [];
|
12704 | for (var y = 0; y < this.rowCount; y++) grid[x][y] = [];
|
12705 | }
|
12706 | }
|
12707 | return DataLabelArrangeGrid.prototype.add = function(element, rect) {
|
12708 | for (var indexRect = this.getGridIndexRect(rect), grid = this.grid, x = indexRect.left; x < indexRect.right; x++) for (var y = indexRect.top; y < indexRect.bottom; y++) grid[x][y].push({
|
12709 | element: element,
|
12710 | rect: rect
|
12711 | });
|
12712 | }, DataLabelArrangeGrid.prototype.hasConflict = function(rect) {
|
12713 | for (var indexRect = this.getGridIndexRect(rect), grid = this.grid, isIntersecting = shapes.Rect.isIntersecting, x = indexRect.left; x < indexRect.right; x++) for (var y = indexRect.top; y < indexRect.bottom; y++) for (var z = 0; z < grid[x][y].length; z++) {
|
12714 | var item = grid[x][y][z];
|
12715 | if (isIntersecting(item.rect, rect)) return !0;
|
12716 | }
|
12717 | return !1;
|
12718 | }, DataLabelArrangeGrid.prototype.getGridRowColCount = function(step, length, minCount, maxCount) {
|
12719 | return Math.min(Math.max(Math.ceil(length / step), minCount), maxCount);
|
12720 | }, DataLabelArrangeGrid.prototype.getGridIndexRect = function(rect) {
|
12721 | var restrict = function(n, min, max) {
|
12722 | return Math.min(Math.max(n, min), max);
|
12723 | };
|
12724 | return {
|
12725 | left: restrict(Math.floor(rect.left / this.cellSize.width), 0, this.colCount),
|
12726 | top: restrict(Math.floor(rect.top / this.cellSize.height), 0, this.rowCount),
|
12727 | right: restrict(Math.ceil((rect.left + rect.width) / this.cellSize.width), 0, this.colCount),
|
12728 | bottom: restrict(Math.ceil((rect.top + rect.height) / this.cellSize.height), 0, this.rowCount)
|
12729 | };
|
12730 | }, DataLabelArrangeGrid.ARRANGEGRID_MIN_COUNT = 1, DataLabelArrangeGrid.ARRANGEGRID_MAX_COUNT = 100,
|
12731 | DataLabelArrangeGrid;
|
12732 | }();
|
12733 | powerbi.DataLabelArrangeGrid = DataLabelArrangeGrid;
|
12734 | var LocationConverter;
|
12735 | !function(LocationConverter) {
|
12736 | function topInside(size, rect, offset) {
|
12737 | return {
|
12738 | left: rect.left + rect.width / 2 - size.width / 2,
|
12739 | top: rect.top + offset,
|
12740 | width: size.width,
|
12741 | height: size.height
|
12742 | };
|
12743 | }
|
12744 | function bottomInside(size, rect, offset) {
|
12745 | return {
|
12746 | left: rect.left + rect.width / 2 - size.width / 2,
|
12747 | top: rect.top + rect.height - size.height - offset,
|
12748 | width: size.width,
|
12749 | height: size.height
|
12750 | };
|
12751 | }
|
12752 | function rightInside(size, rect, offset) {
|
12753 | return {
|
12754 | left: rect.left + rect.width - size.width - offset,
|
12755 | top: rect.top + rect.height / 2 - size.height / 2,
|
12756 | width: size.width,
|
12757 | height: size.height
|
12758 | };
|
12759 | }
|
12760 | function leftInside(size, rect, offset) {
|
12761 | return {
|
12762 | left: rect.left + offset,
|
12763 | top: rect.top + rect.height / 2 - size.height / 2,
|
12764 | width: size.width,
|
12765 | height: size.height
|
12766 | };
|
12767 | }
|
12768 | function topOutside(size, rect, offset) {
|
12769 | return {
|
12770 | left: rect.left + rect.width / 2 - size.width / 2,
|
12771 | top: rect.top - size.height - offset,
|
12772 | width: size.width,
|
12773 | height: size.height
|
12774 | };
|
12775 | }
|
12776 | function bottomOutside(size, rect, offset) {
|
12777 | return {
|
12778 | left: rect.left + rect.width / 2 - size.width / 2,
|
12779 | top: rect.top + rect.height + offset,
|
12780 | width: size.width,
|
12781 | height: size.height
|
12782 | };
|
12783 | }
|
12784 | function rightOutside(size, rect, offset) {
|
12785 | return {
|
12786 | left: rect.left + rect.width + offset,
|
12787 | top: rect.top + rect.height / 2 - size.height / 2,
|
12788 | width: size.width,
|
12789 | height: size.height
|
12790 | };
|
12791 | }
|
12792 | function leftOutside(size, rect, offset) {
|
12793 | return {
|
12794 | left: rect.left - size.width - offset,
|
12795 | top: rect.top + rect.height / 2 - size.height / 2,
|
12796 | width: size.width,
|
12797 | height: size.height
|
12798 | };
|
12799 | }
|
12800 | function middleHorizontal(size, rect, offset) {
|
12801 | return {
|
12802 | left: rect.left + rect.width / 2 - size.width / 2 + offset,
|
12803 | top: rect.top + rect.height / 2 - size.height / 2,
|
12804 | width: size.width,
|
12805 | height: size.height
|
12806 | };
|
12807 | }
|
12808 | function middleVertical(size, rect, offset) {
|
12809 | return {
|
12810 | left: rect.left + rect.width / 2 - size.width / 2,
|
12811 | top: rect.top + rect.height / 2 - size.height / 2 + offset,
|
12812 | width: size.width,
|
12813 | height: size.height
|
12814 | };
|
12815 | }
|
12816 | LocationConverter.topInside = topInside, LocationConverter.bottomInside = bottomInside,
|
12817 | LocationConverter.rightInside = rightInside, LocationConverter.leftInside = leftInside,
|
12818 | LocationConverter.topOutside = topOutside, LocationConverter.bottomOutside = bottomOutside,
|
12819 | LocationConverter.rightOutside = rightOutside, LocationConverter.leftOutside = leftOutside,
|
12820 | LocationConverter.middleHorizontal = middleHorizontal, LocationConverter.middleVertical = middleVertical;
|
12821 | }(LocationConverter || (LocationConverter = {}));
|
12822 | }(powerbi || (powerbi = {}));
|
12823 | }, function(module, exports) {
|
12824 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
12825 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
12826 | !function(powerbi) {
|
12827 | var shapes = powerbi.visuals.shapes, Rect = powerbi.visuals.shapes.Rect, NewDataLabelUtils = powerbi.visuals.NewDataLabelUtils, LabelArrangeGrid = function() {
|
12828 | function LabelArrangeGrid(labelDataPointsGroups, viewport) {
|
12829 | this.viewport = viewport;
|
12830 | for (var maxLabelWidth = 0, maxLabelHeight = 0, _i = 0, labelDataPointsGroups_1 = labelDataPointsGroups; _i < labelDataPointsGroups_1.length; _i++) for (var labelDataPointsGroup = labelDataPointsGroups_1[_i], _a = 0, _b = labelDataPointsGroup.labelDataPoints; _a < _b.length; _a++) {
|
12831 | var labelDataPoint = _b[_a];
|
12832 | if (labelDataPoint.isPreferred) {
|
12833 | var dataLabelSize = labelDataPoint.labelSize;
|
12834 | dataLabelSize.width > maxLabelWidth && (maxLabelWidth = dataLabelSize.width), dataLabelSize.height > maxLabelHeight && (maxLabelHeight = dataLabelSize.height);
|
12835 | }
|
12836 | }
|
12837 | 0 === maxLabelWidth && (maxLabelWidth = viewport.width), 0 === maxLabelHeight && (maxLabelHeight = viewport.height);
|
12838 | var cellSize = this.cellSize = {
|
12839 | width: maxLabelWidth * LabelArrangeGrid.cellSizeMultiplier,
|
12840 | height: maxLabelHeight * LabelArrangeGrid.cellSizeMultiplier
|
12841 | };
|
12842 | this.columnCount = LabelArrangeGrid.getCellCount(cellSize.width, viewport.width, 1, 100),
|
12843 | this.rowCount = LabelArrangeGrid.getCellCount(cellSize.height, viewport.height, 1, 100);
|
12844 | for (var grid = [], i = 0, ilen = this.columnCount; ilen > i; i++) {
|
12845 | grid[i] = [];
|
12846 | for (var j = 0, jlen = this.rowCount; jlen > j; j++) grid[i][j] = [];
|
12847 | }
|
12848 | this.grid = grid;
|
12849 | }
|
12850 | return LabelArrangeGrid.prototype.add = function(rect) {
|
12851 | for (var containingIndexRect = this.getContainingGridSubsection(rect), x = containingIndexRect.xMin; x < containingIndexRect.xMax; x++) for (var y = containingIndexRect.yMin; y < containingIndexRect.yMax; y++) this.grid[x][y].push(rect);
|
12852 | }, LabelArrangeGrid.prototype.hasConflict = function(rect) {
|
12853 | return this.isWithinGridViewport(rect) ? this.hasCollision(rect) : !0;
|
12854 | }, LabelArrangeGrid.prototype.tryPositionInViewport = function(rect) {
|
12855 | return this.isCloseToGridViewport(rect) ? (this.isWithinGridViewport(rect) || (rect = this.tryMoveInsideViewport(rect)),
|
12856 | rect && !this.hasCollision(rect) ? rect : void 0) : void 0;
|
12857 | }, LabelArrangeGrid.prototype.hasCollision = function(rect) {
|
12858 | for (var containingIndexRect = this.getContainingGridSubsection(rect), grid = this.grid, isIntersecting = shapes.Rect.isIntersecting, x = containingIndexRect.xMin; x < containingIndexRect.xMax; x++) for (var y = containingIndexRect.yMin; y < containingIndexRect.yMax; y++) for (var _i = 0, _a = grid[x][y]; _i < _a.length; _i++) {
|
12859 | var currentGridRect = _a[_i];
|
12860 | if (isIntersecting(currentGridRect, rect)) return !0;
|
12861 | }
|
12862 | return !1;
|
12863 | }, LabelArrangeGrid.prototype.isWithinGridViewport = function(rect) {
|
12864 | return rect.left >= 0 && rect.top >= 0 && rect.left + rect.width <= this.viewport.width && rect.top + rect.height <= this.viewport.height;
|
12865 | }, LabelArrangeGrid.prototype.isCloseToGridViewport = function(rect) {
|
12866 | return rect.left + rect.width >= 0 - rect.width && rect.top + rect.height >= -rect.height && rect.left <= this.viewport.width + rect.width && rect.top <= this.viewport.height + rect.height;
|
12867 | }, LabelArrangeGrid.prototype.tryMoveInsideViewport = function(rect) {
|
12868 | var result = Rect.clone(rect), viewport = this.viewport;
|
12869 | return rect.width > viewport.width || rect.height > viewport.height ? void 0 : (rect.left < 0 ? result.left = 0 : rect.left + rect.width > viewport.width && (result.left -= rect.left + rect.width - viewport.width),
|
12870 | rect.top < 0 ? result.top = 0 : rect.top + rect.height > viewport.height && (result.top -= rect.top + rect.height - viewport.height),
|
12871 | result);
|
12872 | }, LabelArrangeGrid.prototype.getContainingGridSubsection = function(rect) {
|
12873 | return {
|
12874 | xMin: LabelArrangeGrid.bound(Math.floor(rect.left / this.cellSize.width), 0, this.columnCount),
|
12875 | xMax: LabelArrangeGrid.bound(Math.ceil((rect.left + rect.width) / this.cellSize.width), 0, this.columnCount),
|
12876 | yMin: LabelArrangeGrid.bound(Math.floor(rect.top / this.cellSize.height), 0, this.rowCount),
|
12877 | yMax: LabelArrangeGrid.bound(Math.ceil((rect.top + rect.height) / this.cellSize.height), 0, this.rowCount)
|
12878 | };
|
12879 | }, LabelArrangeGrid.getCellCount = function(step, length, minCount, maxCount) {
|
12880 | return LabelArrangeGrid.bound(Math.ceil(length / step), minCount, maxCount);
|
12881 | }, LabelArrangeGrid.bound = function(value, min, max) {
|
12882 | return Math.max(Math.min(value, max), min);
|
12883 | }, LabelArrangeGrid.cellSizeMultiplier = 2, LabelArrangeGrid;
|
12884 | }();
|
12885 | powerbi.LabelArrangeGrid = LabelArrangeGrid;
|
12886 | var LabelLayout = function() {
|
12887 | function LabelLayout(options) {
|
12888 | this.startingOffset = options.startingOffset, this.maximumOffset = options.maximumOffset,
|
12889 | null != options.offsetIterationDelta ? this.offsetIterationDelta = options.offsetIterationDelta : this.offsetIterationDelta = LabelLayout.defaultOffsetIterationDelta,
|
12890 | null != options.horizontalPadding ? this.horizontalPadding = options.horizontalPadding : this.horizontalPadding = LabelLayout.defaultHorizontalPadding,
|
12891 | null != options.verticalPadding ? this.verticalPadding = options.verticalPadding : this.verticalPadding = LabelLayout.defaultVerticalPadding,
|
12892 | this.allowLeaderLines = !!options.allowLeaderLines, this.attemptToMoveLabelsIntoViewport = !!options.attemptToMoveLabelsIntoViewport;
|
12893 | }
|
12894 | return LabelLayout.prototype.layout = function(labelDataPointsGroups, viewport) {
|
12895 | for (var _i = 0, labelDataPointsGroups_2 = labelDataPointsGroups; _i < labelDataPointsGroups_2.length; _i++) for (var labelDataPointsGroup = labelDataPointsGroups_2[_i], _a = 0, _b = labelDataPointsGroup.labelDataPoints; _a < _b.length; _a++) {
|
12896 | var labelPoint = _b[_a];
|
12897 | labelPoint.hasBeenRendered = !1, labelPoint.hasBackground ? labelPoint.labelSize = {
|
12898 | width: labelPoint.textSize.width + 2 * NewDataLabelUtils.horizontalLabelBackgroundPadding,
|
12899 | height: labelPoint.textSize.height + 2 * NewDataLabelUtils.verticalLabelBackgroundPadding
|
12900 | } : labelPoint.labelSize = labelPoint.textSize;
|
12901 | }
|
12902 | for (var resultingDataLabels = [], grid = new LabelArrangeGrid(labelDataPointsGroups, viewport), _c = 0, labelDataPointsGroups_3 = labelDataPointsGroups; _c < labelDataPointsGroups_3.length; _c++) {
|
12903 | for (var labelDataPointsGroup = labelDataPointsGroups_3[_c], maxLabelsToRender = labelDataPointsGroup.maxNumberOfLabels, labelDataPoints = _.clone(labelDataPointsGroup.labelDataPoints), preferredLabels = [], j = labelDataPoints.length - 1, localMax = maxLabelsToRender; j >= 0 && localMax > 0; j--) {
|
12904 | var labelPoint = labelDataPoints[j];
|
12905 | labelPoint.isPreferred && (preferredLabels.unshift(labelDataPoints.splice(j, 1)[0]),
|
12906 | localMax--);
|
12907 | }
|
12908 | if (preferredLabels.length > 0) {
|
12909 | var positionedLabels = this.positionDataLabels(preferredLabels, viewport, grid, maxLabelsToRender);
|
12910 | maxLabelsToRender -= positionedLabels.length, resultingDataLabels = resultingDataLabels.concat(positionedLabels);
|
12911 | }
|
12912 | if (labelDataPoints.length > 0) {
|
12913 | var labels = this.positionDataLabels(labelDataPoints, viewport, grid, maxLabelsToRender);
|
12914 | resultingDataLabels = resultingDataLabels.concat(labels);
|
12915 | }
|
12916 | }
|
12917 | return resultingDataLabels;
|
12918 | }, LabelLayout.prototype.positionDataLabels = function(labelDataPoints, viewport, grid, maxLabelsToRender) {
|
12919 | for (var drawLeaderLinesOnIteration, resultingDataLabels = [], offsetDelta = this.offsetIterationDelta, currentOffset = this.startingOffset, currentCenteredOffset = 0, labelsRendered = 0; currentOffset <= this.maximumOffset && maxLabelsToRender > labelsRendered; ) {
|
12920 | drawLeaderLinesOnIteration = this.allowLeaderLines && currentOffset > this.startingOffset;
|
12921 | for (var _i = 0, labelDataPoints_1 = labelDataPoints; _i < labelDataPoints_1.length; _i++) {
|
12922 | var labelPoint = labelDataPoints_1[_i];
|
12923 | if (!labelPoint.hasBeenRendered) {
|
12924 | var dataLabel = void 0;
|
12925 | if (dataLabel = 1 === labelPoint.parentType ? this.tryPositionForRectPositions(labelPoint, grid, currentOffset, currentCenteredOffset) : this.tryPositionForPointPositions(labelPoint, grid, currentOffset, drawLeaderLinesOnIteration),
|
12926 | dataLabel && (resultingDataLabels.push(dataLabel), labelsRendered++), !(maxLabelsToRender > labelsRendered)) break;
|
12927 | }
|
12928 | }
|
12929 | currentOffset += offsetDelta, currentCenteredOffset += offsetDelta;
|
12930 | }
|
12931 | return resultingDataLabels;
|
12932 | }, LabelLayout.prototype.tryPositionForRectPositions = function(labelPoint, grid, currentLabelOffset, currentCenteredLabelOffset) {
|
12933 | for (var _this = this, tryPosition = function(position, adjustForViewport) {
|
12934 | var isPositionInside = 7 & position;
|
12935 | if (!isPositionInside || DataLabelRectPositioner.canFitWithinParent(labelPoint, _this.horizontalPadding, _this.verticalPadding)) {
|
12936 | var resultingBoundingBox = LabelLayout.tryPositionRect(grid, position, labelPoint, currentLabelOffset, currentCenteredLabelOffset, adjustForViewport);
|
12937 | if (resultingBoundingBox) {
|
12938 | if (isPositionInside && !DataLabelRectPositioner.isLabelWithinParent(resultingBoundingBox, labelPoint, _this.horizontalPadding, _this.verticalPadding)) return;
|
12939 | return grid.add(resultingBoundingBox), labelPoint.hasBeenRendered = !0, {
|
12940 | boundingBox: resultingBoundingBox,
|
12941 | text: labelPoint.text,
|
12942 | tooltip: labelPoint.tooltip,
|
12943 | isVisible: !0,
|
12944 | fill: isPositionInside ? labelPoint.insideFill : labelPoint.outsideFill,
|
12945 | identity: labelPoint.identity,
|
12946 | key: labelPoint.key,
|
12947 | fontSize: labelPoint.fontSize,
|
12948 | selected: !1,
|
12949 | hasBackground: !!labelPoint.hasBackground
|
12950 | };
|
12951 | }
|
12952 | }
|
12953 | }, _i = 0, _a = labelPoint.parentShape.validPositions; _i < _a.length; _i++) {
|
12954 | var position = _a[_i], label = tryPosition(position, !1);
|
12955 | if (label) return label;
|
12956 | }
|
12957 | if (this.attemptToMoveLabelsIntoViewport) for (var _b = 0, _c = labelPoint.parentShape.validPositions; _b < _c.length; _b++) {
|
12958 | var position = _c[_b], label = tryPosition(position, !0);
|
12959 | if (label) return label;
|
12960 | }
|
12961 | return null;
|
12962 | }, LabelLayout.tryPositionRect = function(grid, position, labelDataPoint, offset, centerOffset, adjustForViewport) {
|
12963 | var offsetForPosition = offset;
|
12964 | 1 & position && (offsetForPosition = centerOffset);
|
12965 | var labelRect = DataLabelRectPositioner.getLabelRect(labelDataPoint, position, offsetForPosition);
|
12966 | if (1 !== position || 0 === labelDataPoint.parentShape.orientation) {
|
12967 | if (!grid.hasConflict(labelRect)) return labelRect;
|
12968 | if (adjustForViewport) return grid.tryPositionInViewport(labelRect);
|
12969 | } else {
|
12970 | if (!grid.hasConflict(labelRect)) return labelRect;
|
12971 | if (labelRect = DataLabelRectPositioner.getLabelRect(labelDataPoint, position, -offsetForPosition),
|
12972 | !grid.hasConflict(labelRect)) return labelRect;
|
12973 | }
|
12974 | return null;
|
12975 | }, LabelLayout.prototype.tryPositionForPointPositions = function(labelPoint, grid, currentLabelOffset, drawLeaderLines) {
|
12976 | for (var tryPosition = function(position, parentShape, adjustForViewport) {
|
12977 | var resultingBoundingBox = LabelLayout.tryPositionPoint(grid, position, labelPoint, currentLabelOffset, adjustForViewport);
|
12978 | return resultingBoundingBox ? (grid.add(resultingBoundingBox), labelPoint.hasBeenRendered = !0,
|
12979 | {
|
12980 | boundingBox: resultingBoundingBox,
|
12981 | text: labelPoint.text,
|
12982 | tooltip: labelPoint.tooltip,
|
12983 | isVisible: !0,
|
12984 | fill: 256 === position ? labelPoint.insideFill : labelPoint.outsideFill,
|
12985 | isInsideParent: 256 === position,
|
12986 | identity: labelPoint.identity,
|
12987 | key: labelPoint.key,
|
12988 | fontSize: labelPoint.fontSize,
|
12989 | selected: !1,
|
12990 | leaderLinePoints: drawLeaderLines ? DataLabelPointPositioner.getLabelLeaderLineEndingPoint(resultingBoundingBox, position, parentShape) : null,
|
12991 | hasBackground: !!labelPoint.hasBackground
|
12992 | }) : void 0;
|
12993 | }, parentShape = labelPoint.parentShape, validPositions = parentShape.validPositions, _i = 0, validPositions_1 = validPositions; _i < validPositions_1.length; _i++) {
|
12994 | var position = validPositions_1[_i], label = tryPosition(position, parentShape, !1);
|
12995 | if (label) return label;
|
12996 | }
|
12997 | if (this.attemptToMoveLabelsIntoViewport && !_.isEmpty(validPositions)) {
|
12998 | var label = tryPosition(validPositions[0], parentShape, !0);
|
12999 | if (label) return label;
|
13000 | }
|
13001 | return null;
|
13002 | }, LabelLayout.tryPositionPoint = function(grid, position, labelDataPoint, offset, adjustForViewport) {
|
13003 | var labelRect = DataLabelPointPositioner.getLabelRect(labelDataPoint.labelSize, labelDataPoint.parentShape, position, offset);
|
13004 | return grid.hasConflict(labelRect) ? adjustForViewport ? grid.tryPositionInViewport(labelRect) : null : labelRect;
|
13005 | }, LabelLayout.defaultOffsetIterationDelta = 2, LabelLayout.defaultHorizontalPadding = 2,
|
13006 | LabelLayout.defaultVerticalPadding = 2, LabelLayout;
|
13007 | }();
|
13008 | powerbi.LabelLayout = LabelLayout;
|
13009 | var DataLabelRectPositioner;
|
13010 | !function(DataLabelRectPositioner) {
|
13011 | function getLabelRect(labelDataPoint, position, offset) {
|
13012 | var parentRect = labelDataPoint.parentShape;
|
13013 | if (null != parentRect) switch (position) {
|
13014 | case 1:
|
13015 | switch (parentRect.orientation) {
|
13016 | case 1:
|
13017 | case 2:
|
13018 | return DataLabelRectPositioner.middleVertical(labelDataPoint.labelSize, parentRect.rect, offset);
|
13019 |
|
13020 | case 3:
|
13021 | case 4:
|
13022 | return DataLabelRectPositioner.middleHorizontal(labelDataPoint.labelSize, parentRect.rect, offset);
|
13023 |
|
13024 | case 0: }
|
13025 |
|
13026 | case 2:
|
13027 | switch (parentRect.orientation) {
|
13028 | case 1:
|
13029 | return DataLabelRectPositioner.bottomInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13030 |
|
13031 | case 2:
|
13032 | return DataLabelRectPositioner.topInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13033 |
|
13034 | case 3:
|
13035 | return DataLabelRectPositioner.leftInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13036 |
|
13037 | case 4:
|
13038 | return DataLabelRectPositioner.rightInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13039 |
|
13040 | case 0: }
|
13041 |
|
13042 | case 4:
|
13043 | switch (parentRect.orientation) {
|
13044 | case 1:
|
13045 | return DataLabelRectPositioner.topInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13046 |
|
13047 | case 2:
|
13048 | return DataLabelRectPositioner.bottomInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13049 |
|
13050 | case 3:
|
13051 | return DataLabelRectPositioner.rightInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13052 |
|
13053 | case 4:
|
13054 | return DataLabelRectPositioner.leftInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13055 |
|
13056 | case 0: }
|
13057 |
|
13058 | case 8:
|
13059 | switch (parentRect.orientation) {
|
13060 | case 1:
|
13061 | return DataLabelRectPositioner.bottomOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13062 |
|
13063 | case 2:
|
13064 | return DataLabelRectPositioner.topOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13065 |
|
13066 | case 3:
|
13067 | return DataLabelRectPositioner.leftOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13068 |
|
13069 | case 4:
|
13070 | return DataLabelRectPositioner.rightOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13071 |
|
13072 | case 0: }
|
13073 |
|
13074 | case 16:
|
13075 | switch (parentRect.orientation) {
|
13076 | case 1:
|
13077 | return DataLabelRectPositioner.topOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13078 |
|
13079 | case 2:
|
13080 | return DataLabelRectPositioner.bottomOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13081 |
|
13082 | case 3:
|
13083 | return DataLabelRectPositioner.rightOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13084 |
|
13085 | case 4:
|
13086 | return DataLabelRectPositioner.leftOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
13087 |
|
13088 | case 0: }
|
13089 | }
|
13090 | return null;
|
13091 | }
|
13092 | function canFitWithinParent(labelDataPoint, horizontalPadding, verticalPadding) {
|
13093 | return labelDataPoint.labelSize.width + 2 * horizontalPadding < labelDataPoint.parentShape.rect.width || labelDataPoint.labelSize.height + 2 * verticalPadding < labelDataPoint.parentShape.rect.height;
|
13094 | }
|
13095 | function isLabelWithinParent(labelRect, labelPoint, horizontalPadding, verticalPadding) {
|
13096 | var parentRect = labelPoint.parentShape.rect, labelRectWithPadding = shapes.Rect.inflate(labelRect, {
|
13097 | left: horizontalPadding,
|
13098 | right: horizontalPadding,
|
13099 | top: verticalPadding,
|
13100 | bottom: verticalPadding
|
13101 | });
|
13102 | return shapes.Rect.containsPoint(parentRect, {
|
13103 | x: labelRectWithPadding.left,
|
13104 | y: labelRectWithPadding.top
|
13105 | }) && shapes.Rect.containsPoint(parentRect, {
|
13106 | x: labelRectWithPadding.left + labelRectWithPadding.width,
|
13107 | y: labelRectWithPadding.top + labelRectWithPadding.height
|
13108 | });
|
13109 | }
|
13110 | function topInside(labelSize, parentRect, offset) {
|
13111 | return {
|
13112 | left: parentRect.left + parentRect.width / 2 - labelSize.width / 2,
|
13113 | top: parentRect.top + offset,
|
13114 | width: labelSize.width,
|
13115 | height: labelSize.height
|
13116 | };
|
13117 | }
|
13118 | function bottomInside(labelSize, parentRect, offset) {
|
13119 | return {
|
13120 | left: parentRect.left + parentRect.width / 2 - labelSize.width / 2,
|
13121 | top: parentRect.top + parentRect.height - offset - labelSize.height,
|
13122 | width: labelSize.width,
|
13123 | height: labelSize.height
|
13124 | };
|
13125 | }
|
13126 | function rightInside(labelSize, parentRect, offset) {
|
13127 | return {
|
13128 | left: parentRect.left + parentRect.width - labelSize.width - offset,
|
13129 | top: parentRect.top + parentRect.height / 2 - labelSize.height / 2,
|
13130 | width: labelSize.width,
|
13131 | height: labelSize.height
|
13132 | };
|
13133 | }
|
13134 | function leftInside(labelSize, parentRect, offset) {
|
13135 | return {
|
13136 | left: parentRect.left + offset,
|
13137 | top: parentRect.top + parentRect.height / 2 - labelSize.height / 2,
|
13138 | width: labelSize.width,
|
13139 | height: labelSize.height
|
13140 | };
|
13141 | }
|
13142 | function topOutside(labelSize, parentRect, offset) {
|
13143 | return {
|
13144 | left: parentRect.left + parentRect.width / 2 - labelSize.width / 2,
|
13145 | top: parentRect.top - labelSize.height - offset,
|
13146 | width: labelSize.width,
|
13147 | height: labelSize.height
|
13148 | };
|
13149 | }
|
13150 | function bottomOutside(labelSize, parentRect, offset) {
|
13151 | return {
|
13152 | left: parentRect.left + parentRect.width / 2 - labelSize.width / 2,
|
13153 | top: parentRect.top + parentRect.height + offset,
|
13154 | width: labelSize.width,
|
13155 | height: labelSize.height
|
13156 | };
|
13157 | }
|
13158 | function rightOutside(labelSize, parentRect, offset) {
|
13159 | return {
|
13160 | left: parentRect.left + parentRect.width + offset,
|
13161 | top: parentRect.top + parentRect.height / 2 - labelSize.height / 2,
|
13162 | width: labelSize.width,
|
13163 | height: labelSize.height
|
13164 | };
|
13165 | }
|
13166 | function leftOutside(labelSize, parentRect, offset) {
|
13167 | return {
|
13168 | left: parentRect.left - labelSize.width - offset,
|
13169 | top: parentRect.top + parentRect.height / 2 - labelSize.height / 2,
|
13170 | width: labelSize.width,
|
13171 | height: labelSize.height
|
13172 | };
|
13173 | }
|
13174 | function middleHorizontal(labelSize, parentRect, offset) {
|
13175 | return {
|
13176 | left: parentRect.left + parentRect.width / 2 - labelSize.width / 2 + offset,
|
13177 | top: parentRect.top + parentRect.height / 2 - labelSize.height / 2,
|
13178 | width: labelSize.width,
|
13179 | height: labelSize.height
|
13180 | };
|
13181 | }
|
13182 | function middleVertical(labelSize, parentRect, offset) {
|
13183 | return {
|
13184 | left: parentRect.left + parentRect.width / 2 - labelSize.width / 2,
|
13185 | top: parentRect.top + parentRect.height / 2 - labelSize.height / 2 + offset,
|
13186 | width: labelSize.width,
|
13187 | height: labelSize.height
|
13188 | };
|
13189 | }
|
13190 | DataLabelRectPositioner.getLabelRect = getLabelRect, DataLabelRectPositioner.canFitWithinParent = canFitWithinParent,
|
13191 | DataLabelRectPositioner.isLabelWithinParent = isLabelWithinParent, DataLabelRectPositioner.topInside = topInside,
|
13192 | DataLabelRectPositioner.bottomInside = bottomInside, DataLabelRectPositioner.rightInside = rightInside,
|
13193 | DataLabelRectPositioner.leftInside = leftInside, DataLabelRectPositioner.topOutside = topOutside,
|
13194 | DataLabelRectPositioner.bottomOutside = bottomOutside, DataLabelRectPositioner.rightOutside = rightOutside,
|
13195 | DataLabelRectPositioner.leftOutside = leftOutside, DataLabelRectPositioner.middleHorizontal = middleHorizontal,
|
13196 | DataLabelRectPositioner.middleVertical = middleVertical;
|
13197 | }(DataLabelRectPositioner = powerbi.DataLabelRectPositioner || (powerbi.DataLabelRectPositioner = {}));
|
13198 | var DataLabelPointPositioner;
|
13199 | !function(DataLabelPointPositioner) {
|
13200 | function getLabelRect(labelSize, parentPoint, position, offset) {
|
13201 | switch (position) {
|
13202 | case 1:
|
13203 | return DataLabelPointPositioner.above(labelSize, parentPoint.point, parentPoint.radius + offset);
|
13204 |
|
13205 | case 2:
|
13206 | return DataLabelPointPositioner.below(labelSize, parentPoint.point, parentPoint.radius + offset);
|
13207 |
|
13208 | case 4:
|
13209 | return DataLabelPointPositioner.left(labelSize, parentPoint.point, parentPoint.radius + offset);
|
13210 |
|
13211 | case 8:
|
13212 | return DataLabelPointPositioner.right(labelSize, parentPoint.point, parentPoint.radius + offset);
|
13213 |
|
13214 | case 32:
|
13215 | return DataLabelPointPositioner.belowLeft(labelSize, parentPoint.point, parentPoint.radius + offset);
|
13216 |
|
13217 | case 16:
|
13218 | return DataLabelPointPositioner.belowRight(labelSize, parentPoint.point, parentPoint.radius + offset);
|
13219 |
|
13220 | case 128:
|
13221 | return DataLabelPointPositioner.aboveLeft(labelSize, parentPoint.point, parentPoint.radius + offset);
|
13222 |
|
13223 | case 64:
|
13224 | return DataLabelPointPositioner.aboveRight(labelSize, parentPoint.point, parentPoint.radius + offset);
|
13225 |
|
13226 | case 256:
|
13227 | return DataLabelPointPositioner.center(labelSize, parentPoint.point);
|
13228 | }
|
13229 | return null;
|
13230 | }
|
13231 | function above(labelSize, parentPoint, offset) {
|
13232 | return {
|
13233 | left: parentPoint.x - labelSize.width / 2,
|
13234 | top: parentPoint.y - offset - labelSize.height,
|
13235 | width: labelSize.width,
|
13236 | height: labelSize.height
|
13237 | };
|
13238 | }
|
13239 | function below(labelSize, parentPoint, offset) {
|
13240 | return {
|
13241 | left: parentPoint.x - labelSize.width / 2,
|
13242 | top: parentPoint.y + offset,
|
13243 | width: labelSize.width,
|
13244 | height: labelSize.height
|
13245 | };
|
13246 | }
|
13247 | function left(labelSize, parentPoint, offset) {
|
13248 | return {
|
13249 | left: parentPoint.x - offset - labelSize.width,
|
13250 | top: parentPoint.y - labelSize.height / 2,
|
13251 | width: labelSize.width,
|
13252 | height: labelSize.height
|
13253 | };
|
13254 | }
|
13255 | function right(labelSize, parentPoint, offset) {
|
13256 | return {
|
13257 | left: parentPoint.x + offset,
|
13258 | top: parentPoint.y - labelSize.height / 2,
|
13259 | width: labelSize.width,
|
13260 | height: labelSize.height
|
13261 | };
|
13262 | }
|
13263 | function belowLeft(labelSize, parentPoint, offset) {
|
13264 | return {
|
13265 | left: parentPoint.x - DataLabelPointPositioner.sin45 * offset - labelSize.width,
|
13266 | top: parentPoint.y + DataLabelPointPositioner.cos45 * offset,
|
13267 | width: labelSize.width,
|
13268 | height: labelSize.height
|
13269 | };
|
13270 | }
|
13271 | function belowRight(labelSize, parentPoint, offset) {
|
13272 | return {
|
13273 | left: parentPoint.x + DataLabelPointPositioner.sin45 * offset,
|
13274 | top: parentPoint.y + DataLabelPointPositioner.cos45 * offset,
|
13275 | width: labelSize.width,
|
13276 | height: labelSize.height
|
13277 | };
|
13278 | }
|
13279 | function aboveLeft(labelSize, parentPoint, offset) {
|
13280 | return {
|
13281 | left: parentPoint.x - DataLabelPointPositioner.sin45 * offset - labelSize.width,
|
13282 | top: parentPoint.y - DataLabelPointPositioner.cos45 * offset - labelSize.height,
|
13283 | width: labelSize.width,
|
13284 | height: labelSize.height
|
13285 | };
|
13286 | }
|
13287 | function aboveRight(labelSize, parentPoint, offset) {
|
13288 | return {
|
13289 | left: parentPoint.x + DataLabelPointPositioner.sin45 * offset,
|
13290 | top: parentPoint.y - DataLabelPointPositioner.cos45 * offset - labelSize.height,
|
13291 | width: labelSize.width,
|
13292 | height: labelSize.height
|
13293 | };
|
13294 | }
|
13295 | function center(labelSize, parentPoint) {
|
13296 | return {
|
13297 | left: parentPoint.x - labelSize.width / 2,
|
13298 | top: parentPoint.y - labelSize.height / 2,
|
13299 | width: labelSize.width,
|
13300 | height: labelSize.height
|
13301 | };
|
13302 | }
|
13303 | function getLabelLeaderLineEndingPoint(boundingBox, position, parentShape) {
|
13304 | var x = boundingBox.left, y = boundingBox.top;
|
13305 | switch (position) {
|
13306 | case 1:
|
13307 | x += boundingBox.width / 2, y += boundingBox.height;
|
13308 | break;
|
13309 |
|
13310 | case 2:
|
13311 | x += boundingBox.width / 2;
|
13312 | break;
|
13313 |
|
13314 | case 4:
|
13315 | x += boundingBox.width, y += 2 * boundingBox.height / 3;
|
13316 | break;
|
13317 |
|
13318 | case 8:
|
13319 | y += 2 * boundingBox.height / 3;
|
13320 | break;
|
13321 |
|
13322 | case 32:
|
13323 | x += boundingBox.width, y += boundingBox.height / 2;
|
13324 | break;
|
13325 |
|
13326 | case 16:
|
13327 | y += boundingBox.height / 2;
|
13328 | break;
|
13329 |
|
13330 | case 128:
|
13331 | x += boundingBox.width, y += boundingBox.height;
|
13332 | break;
|
13333 |
|
13334 | case 64:
|
13335 | y += boundingBox.height;
|
13336 | }
|
13337 | return [ [ parentShape.point.x, parentShape.point.y ], [ x, y ] ];
|
13338 | }
|
13339 | DataLabelPointPositioner.cos45 = Math.cos(45), DataLabelPointPositioner.sin45 = Math.sin(45),
|
13340 | DataLabelPointPositioner.getLabelRect = getLabelRect, DataLabelPointPositioner.above = above,
|
13341 | DataLabelPointPositioner.below = below, DataLabelPointPositioner.left = left, DataLabelPointPositioner.right = right,
|
13342 | DataLabelPointPositioner.belowLeft = belowLeft, DataLabelPointPositioner.belowRight = belowRight,
|
13343 | DataLabelPointPositioner.aboveLeft = aboveLeft, DataLabelPointPositioner.aboveRight = aboveRight,
|
13344 | DataLabelPointPositioner.center = center, DataLabelPointPositioner.getLabelLeaderLineEndingPoint = getLabelLeaderLineEndingPoint;
|
13345 | }(DataLabelPointPositioner = powerbi.DataLabelPointPositioner || (powerbi.DataLabelPointPositioner = {}));
|
13346 | }(powerbi || (powerbi = {}));
|
13347 | }, function(module, exports) {
|
13348 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
13349 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
13350 | !function(powerbi) {
|
13351 | var NewDataLabelUtils = powerbi.visuals.NewDataLabelUtils, labelStyle = powerbi.visuals.labelStyle, DonutLabelUtils = powerbi.visuals.DonutLabelUtils, DonutLabelLayout = function() {
|
13352 | function DonutLabelLayout(options, donutChartProperties) {
|
13353 | this.startingOffset = options.startingOffset, this.maximumOffset = options.maximumOffset,
|
13354 | null != options.offsetIterationDelta && (this.offsetIterationDelta = options.offsetIterationDelta),
|
13355 | this.donutChartProperties = donutChartProperties, this.center = {
|
13356 | x: donutChartProperties.viewport.width / 2,
|
13357 | y: donutChartProperties.viewport.height / 2
|
13358 | }, this.outerRadius = this.donutChartProperties.radius * this.donutChartProperties.outerArcRadiusRatio,
|
13359 | this.innerRadius = this.donutChartProperties.radius / 2 * this.donutChartProperties.innerArcRadiusRatio,
|
13360 | this.additionalCharsWidth = powerbi.TextMeasurementService.measureSvgTextWidth({
|
13361 | text: " ()",
|
13362 | fontFamily: NewDataLabelUtils.LabelTextProperties.fontFamily,
|
13363 | fontSize: jsCommon.PixelConverter.fromPoint(donutChartProperties.dataLabelsSettings.fontSize),
|
13364 | fontWeight: NewDataLabelUtils.LabelTextProperties.fontWeight
|
13365 | });
|
13366 | }
|
13367 | return DonutLabelLayout.prototype.layout = function(labelDataPoints) {
|
13368 | for (var _i = 0, labelDataPoints_1 = labelDataPoints; _i < labelDataPoints_1.length; _i++) {
|
13369 | var donutLabel = labelDataPoints_1[_i];
|
13370 | donutLabel.hasBeenRendered = !1, donutLabel.labelSize = donutLabel.textSize;
|
13371 | }
|
13372 | for (var resultingLabels = [], preferredLabels = [], viewport = this.donutChartProperties.viewport, labelDataPointsGroup = {
|
13373 | labelDataPoints: labelDataPoints,
|
13374 | maxNumberOfLabels: labelDataPoints.length
|
13375 | }, grid = new powerbi.LabelArrangeGrid([ labelDataPointsGroup ], viewport), i = labelDataPoints.length - 1; i >= 0; i--) {
|
13376 | var labelPoint = labelDataPoints[i];
|
13377 | if (labelPoint.isPreferred) {
|
13378 | var label = labelDataPoints.splice(i, 1);
|
13379 | preferredLabels = label.concat(preferredLabels);
|
13380 | }
|
13381 | }
|
13382 | if (preferredLabels.length > 0 && (resultingLabels = this.positionLabels(preferredLabels, grid)),
|
13383 | labelDataPoints.length > 0) {
|
13384 | var labels = this.positionLabels(labelDataPoints, grid);
|
13385 | resultingLabels = resultingLabels.concat(labels);
|
13386 | }
|
13387 | return resultingLabels;
|
13388 | }, DonutLabelLayout.prototype.positionLabels = function(labelDataPoints, grid) {
|
13389 | for (var resultingLabels = [], offsetDelta = this.offsetIterationDelta, currentOffset = this.startingOffset, currentCenteredOffset = 0; currentOffset <= this.maximumOffset; ) {
|
13390 | for (var _i = 0, labelDataPoints_2 = labelDataPoints; _i < labelDataPoints_2.length; _i++) {
|
13391 | var labelPoint = labelDataPoints_2[_i];
|
13392 | if (!labelPoint.hasBeenRendered) {
|
13393 | var label = this.tryPositionForDonut(labelPoint, grid, currentOffset);
|
13394 | label && resultingLabels.push(label);
|
13395 | }
|
13396 | }
|
13397 | currentOffset += offsetDelta, currentCenteredOffset += offsetDelta;
|
13398 | }
|
13399 | return resultingLabels;
|
13400 | }, DonutLabelLayout.prototype.tryPositionForDonut = function(labelPoint, grid, currentLabelOffset) {
|
13401 | var parentShape = labelPoint.parentShape;
|
13402 | if (!_.isEmpty(parentShape.validPositions) && 0 !== parentShape.validPositions[0]) {
|
13403 | var defaultPosition = parentShape.validPositions[0], bestCandidate = this.tryAllPositions(labelPoint, grid, defaultPosition, currentLabelOffset);
|
13404 | if (bestCandidate && 0 === bestCandidate.score) return this.buildLabel(bestCandidate, grid);
|
13405 | if (this.donutChartProperties.dataLabelsSettings.labelStyle === labelStyle.both) {
|
13406 | var splitLabelDataPoint = this.splitDonutDataPoint(labelPoint), bestSplitCandidate = this.tryAllPositions(splitLabelDataPoint, grid, defaultPosition, currentLabelOffset);
|
13407 | if (bestSplitCandidate && (!bestCandidate || bestSplitCandidate.score < bestCandidate.score)) return this.buildLabel(bestSplitCandidate, grid);
|
13408 | }
|
13409 | return bestCandidate ? this.buildLabel(bestCandidate, grid) : void 0;
|
13410 | }
|
13411 | }, DonutLabelLayout.prototype.generateCandidate = function(labelDataPoint, candidatePosition, grid, currentLabelOffset) {
|
13412 | var angle = this.generateCandidateAngleForPosition(labelDataPoint.donutArcDescriptor, candidatePosition), parentShape = this.getPointPositionForAngle(angle), parentPoint = parentShape.point, score = this.score(labelDataPoint, parentPoint), leaderLinePoints = DonutLabelUtils.getLabelLeaderLineForDonutChart(labelDataPoint.donutArcDescriptor, this.donutChartProperties, parentPoint, angle), leaderLinesSize = DonutLabelUtils.getLabelLeaderLinesSizeForDonutChart(leaderLinePoints), newLabelDataPoint = _.clone(labelDataPoint);
|
13413 | newLabelDataPoint.angle = angle, newLabelDataPoint.parentShape = parentShape, newLabelDataPoint.leaderLinePoints = leaderLinePoints,
|
13414 | newLabelDataPoint.linesSize = leaderLinesSize;
|
13415 | var boundingBoxs = DonutLabelLayout.tryPositionPoint(grid, parentShape.validPositions[0], newLabelDataPoint, currentLabelOffset, this.center, this.donutChartProperties.viewport);
|
13416 | return {
|
13417 | angle: angle,
|
13418 | point: parentShape,
|
13419 | score: score,
|
13420 | labelRects: boundingBoxs,
|
13421 | labelDataPoint: newLabelDataPoint
|
13422 | };
|
13423 | }, DonutLabelLayout.prototype.tryAllPositions = function(labelDataPoint, grid, defaultPosition, currentLabelOffset) {
|
13424 | var boundingBoxs = DonutLabelLayout.tryPositionPoint(grid, defaultPosition, labelDataPoint, currentLabelOffset, this.center, this.donutChartProperties.viewport), originalPoint = labelDataPoint.parentShape, originalCandidate = {
|
13425 | point: originalPoint,
|
13426 | angle: labelDataPoint.angle,
|
13427 | score: this.score(labelDataPoint, originalPoint.point),
|
13428 | labelRects: boundingBoxs,
|
13429 | labelDataPoint: labelDataPoint
|
13430 | };
|
13431 | if (boundingBoxs && boundingBoxs.textRect && 0 === originalCandidate.score) return originalCandidate;
|
13432 | var bestCandidate, positions = [];
|
13433 | boundingBoxs && boundingBoxs.textRect ? (positions = this.getLabelPointPositions(labelDataPoint, !0),
|
13434 | bestCandidate = originalCandidate) : positions = this.getLabelPointPositions(labelDataPoint, !1);
|
13435 | for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
|
13436 | var position = positions_1[_i], candidate = this.generateCandidate(labelDataPoint, position, grid, currentLabelOffset);
|
13437 | if (candidate.labelRects && candidate.labelRects.textRect && (null == bestCandidate || candidate.score < bestCandidate.score) && (bestCandidate = candidate,
|
13438 | 0 === bestCandidate.score)) return bestCandidate;
|
13439 | }
|
13440 | return bestCandidate;
|
13441 | }, DonutLabelLayout.prototype.buildLabel = function(labelLayout, grid) {
|
13442 | var resultingBoundingBox = labelLayout.labelRects.textRect, labelPoint = labelLayout.labelDataPoint;
|
13443 | grid.add(resultingBoundingBox), grid.add(labelLayout.labelRects.horizontalLineRect),
|
13444 | grid.add(labelLayout.labelRects.diagonalLineRect), labelPoint.hasBeenRendered = !0;
|
13445 | var left = resultingBoundingBox.left - this.center.x;
|
13446 | 0 > left ? left += resultingBoundingBox.width / 2 : left -= resultingBoundingBox.width / 2;
|
13447 | var formattedDataLabel, formattedCategoryLabel, text, textAnchor = 8 === labelPoint.parentShape.validPositions[0] ? "start" : "end", boundingBox = {
|
13448 | left: left,
|
13449 | top: resultingBoundingBox.top - this.center.y,
|
13450 | height: resultingBoundingBox.height,
|
13451 | width: resultingBoundingBox.width
|
13452 | }, labelSettingsStyle = this.donutChartProperties.dataLabelsSettings.labelStyle, spaceAvailableForLabels = DonutLabelUtils.getSpaceAvailableForDonutLabels(labelPoint.parentShape.point.x, this.donutChartProperties.viewport), getLabelFormattedText = powerbi.visuals.dataLabelUtils.getLabelFormattedText, fontSize = labelPoint.fontSize, hasOneLabelRow = labelSettingsStyle === labelStyle.both && null == labelPoint.secondRowText;
|
13453 | switch (hasOneLabelRow && (labelPoint.dataLabel = " (" + labelPoint.dataLabel + ")",
|
13454 | spaceAvailableForLabels /= 2), labelSettingsStyle !== labelStyle.both && labelSettingsStyle !== labelStyle.data || (formattedDataLabel = getLabelFormattedText({
|
13455 | label: labelPoint.dataLabel,
|
13456 | maxWidth: spaceAvailableForLabels,
|
13457 | fontSize: fontSize
|
13458 | })), labelSettingsStyle !== labelStyle.both && labelSettingsStyle !== labelStyle.category || (formattedCategoryLabel = getLabelFormattedText({
|
13459 | label: labelPoint.categoryLabel,
|
13460 | maxWidth: spaceAvailableForLabels,
|
13461 | fontSize: fontSize
|
13462 | })), labelSettingsStyle) {
|
13463 | case labelStyle.both:
|
13464 | null == labelPoint.secondRowText ? text = formattedCategoryLabel + formattedDataLabel : (text = formattedDataLabel,
|
13465 | labelPoint.secondRowText = formattedCategoryLabel);
|
13466 | break;
|
13467 |
|
13468 | case labelStyle.data:
|
13469 | text = formattedDataLabel;
|
13470 | break;
|
13471 |
|
13472 | case labelStyle.category:
|
13473 | text = formattedCategoryLabel;
|
13474 | }
|
13475 | return labelPoint.textSize.width = Math.min(labelPoint.textSize.width, hasOneLabelRow ? 2 * spaceAvailableForLabels : spaceAvailableForLabels),
|
13476 | {
|
13477 | boundingBox: boundingBox,
|
13478 | text: text,
|
13479 | tooltip: labelPoint.tooltip,
|
13480 | isVisible: !0,
|
13481 | fill: labelPoint.outsideFill,
|
13482 | identity: labelPoint.identity,
|
13483 | fontSize: fontSize,
|
13484 | selected: !1,
|
13485 | textAnchor: textAnchor,
|
13486 | leaderLinePoints: labelPoint.leaderLinePoints,
|
13487 | hasBackground: !1,
|
13488 | secondRowText: labelPoint.secondRowText
|
13489 | };
|
13490 | }, DonutLabelLayout.tryPositionPoint = function(grid, position, labelDataPoint, offset, center, viewport) {
|
13491 | var parentPoint = labelDataPoint.parentShape, textSize = _.clone(labelDataPoint.textSize);
|
13492 | textSize.width = Math.min(textSize.width, DonutLabelUtils.getSpaceAvailableForDonutLabels(parentPoint.point.x, viewport));
|
13493 | var labelRect = powerbi.DataLabelPointPositioner.getLabelRect(textSize, parentPoint, position, offset), diagonalLineParentPoint = {
|
13494 | point: {
|
13495 | x: labelDataPoint.leaderLinePoints[0][0],
|
13496 | y: labelDataPoint.leaderLinePoints[0][1] < 0 ? labelDataPoint.leaderLinePoints[1][1] : labelDataPoint.leaderLinePoints[0][1]
|
13497 | },
|
13498 | radius: 0,
|
13499 | validPositions: null
|
13500 | }, diagonalLineRect = powerbi.DataLabelPointPositioner.getLabelRect(labelDataPoint.linesSize[DonutLabelUtils.DiagonalLineIndex], diagonalLineParentPoint, position, offset), horizontalLineParentPoint = {
|
13501 | point: {
|
13502 | x: labelDataPoint.leaderLinePoints[1][0],
|
13503 | y: labelDataPoint.leaderLinePoints[1][1]
|
13504 | },
|
13505 | radius: 0,
|
13506 | validPositions: null
|
13507 | }, horizontalLineRect = powerbi.DataLabelPointPositioner.getLabelRect(labelDataPoint.linesSize[DonutLabelUtils.HorizontalLineIndex], horizontalLineParentPoint, position, offset);
|
13508 | if (labelRect && diagonalLineRect && horizontalLineRect) {
|
13509 | labelRect.left += center.x, labelRect.top += center.y;
|
13510 | var centerForLinesWidth = center.x - labelRect.width / 2;
|
13511 | return diagonalLineRect.left += centerForLinesWidth, diagonalLineRect.top += center.y,
|
13512 | horizontalLineRect.left += centerForLinesWidth, horizontalLineRect.top += center.y,
|
13513 | grid.hasConflict(labelRect) || grid.hasConflict(diagonalLineRect) || grid.hasConflict(horizontalLineRect) ? void 0 : {
|
13514 | textRect: labelRect,
|
13515 | diagonalLineRect: diagonalLineRect,
|
13516 | horizontalLineRect: horizontalLineRect
|
13517 | };
|
13518 | }
|
13519 | }, DonutLabelLayout.prototype.getLabelPointPositions = function(labelPoint, isTruncated) {
|
13520 | var parentShape = labelPoint.parentShape, position = parentShape.validPositions[0];
|
13521 | return isTruncated ? parentShape.point.y < 0 ? 8 === position ? [ 64 ] : [ 128 ] : 8 === position ? [ 16 ] : [ 32 ] : 4 === position ? [ 128, 32 ] : [ 16, 64 ];
|
13522 | }, DonutLabelLayout.prototype.splitDonutDataPoint = function(labelPoint) {
|
13523 | var textSize = {
|
13524 | width: Math.max(labelPoint.categoryLabelSize.width, labelPoint.dataLabelSize.width),
|
13525 | height: 2 * labelPoint.dataLabelSize.height
|
13526 | }, newLabelPoint = _.clone(labelPoint);
|
13527 | return newLabelPoint.textSize = textSize, newLabelPoint.secondRowText = labelPoint.categoryLabel,
|
13528 | newLabelPoint;
|
13529 | }, DonutLabelLayout.prototype.generateCandidateAngleForPosition = function(d, position) {
|
13530 | var midAngle = d.startAngle + (d.endAngle - d.startAngle) / 2;
|
13531 | switch (position) {
|
13532 | case 64:
|
13533 | case 32:
|
13534 | return (d.startAngle + midAngle - Math.PI) / 2;
|
13535 |
|
13536 | case 128:
|
13537 | case 16:
|
13538 | return (midAngle + d.endAngle - Math.PI) / 2;
|
13539 | }
|
13540 | }, DonutLabelLayout.prototype.getPointPositionForAngle = function(angle) {
|
13541 | var labelX = DonutLabelUtils.getXPositionForDonutLabel(Math.cos(angle) * this.outerRadius), labelY = Math.sin(angle) * this.outerRadius, newPosition = 0 > labelX ? 4 : 8, pointPosition = {
|
13542 | point: {
|
13543 | x: labelX,
|
13544 | y: labelY
|
13545 | },
|
13546 | validPositions: [ newPosition ],
|
13547 | radius: 0
|
13548 | };
|
13549 | return pointPosition;
|
13550 | }, DonutLabelLayout.prototype.score = function(labelPoint, point) {
|
13551 | var textWidth, spaceAvailableForLabels = DonutLabelUtils.getSpaceAvailableForDonutLabels(point.x, this.donutChartProperties.viewport);
|
13552 | return this.donutChartProperties.dataLabelsSettings.labelStyle === labelStyle.both && null == labelPoint.secondRowText ? (textWidth = Math.max(labelPoint.categoryLabelSize.width, labelPoint.dataLabelSize.width + this.additionalCharsWidth),
|
13553 | spaceAvailableForLabels /= 2) : textWidth = labelPoint.textSize.width, Math.max(textWidth - spaceAvailableForLabels, 0);
|
13554 | }, DonutLabelLayout;
|
13555 | }();
|
13556 | powerbi.DonutLabelLayout = DonutLabelLayout;
|
13557 | }(powerbi || (powerbi = {}));
|
13558 | }, function(module, exports) {
|
13559 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
13560 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
13561 | !function(powerbi) {
|
13562 | var NewDataLabelUtils = powerbi.visuals.NewDataLabelUtils, DefaultCentroidOffset = 5, OffsetDelta = 10, MaximumOffset = 60, stemExtension = 5, FilledMapLabelLayout = function() {
|
13563 | function FilledMapLabelLayout() {}
|
13564 | return FilledMapLabelLayout.prototype.layout = function(labelDataPoints, viewport, polygonInfoTransform, redrawDataLabels) {
|
13565 | if (redrawDataLabels || void 0 === this.labels) {
|
13566 | for (var labelDataPointsGroup = {
|
13567 | labelDataPoints: labelDataPoints,
|
13568 | maxNumberOfLabels: labelDataPoints.length
|
13569 | }, _i = 0, labelDataPoints_1 = labelDataPoints; _i < labelDataPoints_1.length; _i++) {
|
13570 | var labelPoint = labelDataPoints_1[_i];
|
13571 | labelPoint.labelSize = {
|
13572 | width: labelPoint.textSize.width + 2 * NewDataLabelUtils.horizontalLabelBackgroundPadding,
|
13573 | height: labelPoint.textSize.height + 2 * NewDataLabelUtils.verticalLabelBackgroundPadding
|
13574 | };
|
13575 | }
|
13576 | for (var grid = new powerbi.LabelArrangeGrid([ labelDataPointsGroup ], viewport), resultingDataLabels = [], allPolygons = [], _a = 0, labelDataPoints_2 = labelDataPoints; _a < labelDataPoints_2.length; _a++) {
|
13577 | var labelPoint = labelDataPoints_2[_a], polygon = labelPoint.parentShape.polygon;
|
13578 | allPolygons.push(polygon), polygon.pixelBoundingRect = polygonInfoTransform.applyToRect(polygon.absoluteBoundingRect());
|
13579 | }
|
13580 | for (var shapesgrid = new LabelPolygonArrangeGrid(allPolygons, viewport), _b = 0, labelDataPoints_3 = labelDataPoints; _b < labelDataPoints_3.length; _b++) {
|
13581 | var labelPoint = labelDataPoints_3[_b], dataLabel = this.getLabelByPolygonPositions(labelPoint, polygonInfoTransform, grid, shapesgrid);
|
13582 | null != dataLabel && resultingDataLabels.push(dataLabel);
|
13583 | }
|
13584 | this.labels = resultingDataLabels;
|
13585 | } else this.updateLabelOffsets(polygonInfoTransform);
|
13586 | return this.labels;
|
13587 | }, FilledMapLabelLayout.prototype.getLabelPolygon = function(mapDataPoint, position, pointPosition, offset) {
|
13588 | var dataPointSize = {
|
13589 | width: mapDataPoint.textSize.width,
|
13590 | height: mapDataPoint.textSize.height
|
13591 | };
|
13592 | return this.getLabelBoundingBox(dataPointSize, position, pointPosition, offset);
|
13593 | }, FilledMapLabelLayout.prototype.getLabelBoundingBox = function(dataPointSize, position, pointPosition, offset) {
|
13594 | switch (position) {
|
13595 | case 1:
|
13596 | return powerbi.DataLabelPointPositioner.above(dataPointSize, pointPosition, offset);
|
13597 |
|
13598 | case 2:
|
13599 | return powerbi.DataLabelPointPositioner.below(dataPointSize, pointPosition, offset);
|
13600 |
|
13601 | case 4:
|
13602 | return powerbi.DataLabelPointPositioner.left(dataPointSize, pointPosition, offset);
|
13603 |
|
13604 | case 8:
|
13605 | return powerbi.DataLabelPointPositioner.right(dataPointSize, pointPosition, offset);
|
13606 |
|
13607 | case 128:
|
13608 | return powerbi.DataLabelPointPositioner.aboveLeft(dataPointSize, pointPosition, offset);
|
13609 |
|
13610 | case 64:
|
13611 | return powerbi.DataLabelPointPositioner.aboveRight(dataPointSize, pointPosition, offset);
|
13612 |
|
13613 | case 32:
|
13614 | return powerbi.DataLabelPointPositioner.belowLeft(dataPointSize, pointPosition, offset);
|
13615 |
|
13616 | case 16:
|
13617 | return powerbi.DataLabelPointPositioner.belowRight(dataPointSize, pointPosition, offset);
|
13618 |
|
13619 | case 256:
|
13620 | return powerbi.DataLabelPointPositioner.center(dataPointSize, pointPosition);
|
13621 | }
|
13622 | return null;
|
13623 | }, FilledMapLabelLayout.prototype.getLabelByPolygonPositions = function(labelPoint, polygonInfoTransform, grid, shapesGrid) {
|
13624 | for (var offset = 0, inverseTransorm = polygonInfoTransform.getInverse(), i = 0; 2 > i; i++) {
|
13625 | 1 === i && (offset = DefaultCentroidOffset);
|
13626 | for (var _i = 0, _a = labelPoint.parentShape.validPositions; _i < _a.length; _i++) {
|
13627 | var position = _a[_i], resultingAbsoluteBoundingBox = this.tryPositionForPolygonPosition(position, labelPoint, polygonInfoTransform, offset, inverseTransorm);
|
13628 | if ((256 !== position || 0 === i) && resultingAbsoluteBoundingBox) {
|
13629 | var resultingBoundingBox = polygonInfoTransform.applyToRect(resultingAbsoluteBoundingBox), dataLabel = {
|
13630 | text: labelPoint.text,
|
13631 | secondRowText: labelPoint.secondRowText,
|
13632 | boundingBox: resultingBoundingBox,
|
13633 | isVisible: !0,
|
13634 | fill: labelPoint.insideFill,
|
13635 | identity: null,
|
13636 | selected: !1,
|
13637 | hasBackground: !0,
|
13638 | textAnchor: "middle",
|
13639 | originalPixelOffset: offset,
|
13640 | isPlacedInsidePolygon: !0,
|
13641 | absoluteBoundingBoxCenter: {
|
13642 | x: resultingAbsoluteBoundingBox.left + resultingAbsoluteBoundingBox.width / 2,
|
13643 | y: resultingAbsoluteBoundingBox.top + resultingAbsoluteBoundingBox.height / 2
|
13644 | }
|
13645 | };
|
13646 | return dataLabel;
|
13647 | }
|
13648 | }
|
13649 | }
|
13650 | for (var currentOffset = 6; MaximumOffset >= currentOffset; ) {
|
13651 | for (var _b = 0, _c = labelPoint.parentShape.validPositions; _b < _c.length; _b++) {
|
13652 | var position = _c[_b];
|
13653 | if (256 !== position) {
|
13654 | var polygon = labelPoint.parentShape.polygon, pixelCentroid = polygonInfoTransform.applyToPoint(polygon.absoluteCentroid()), resultingAbsolutBoundingBox = this.tryPlaceLabelOutsidePolygon(grid, position, labelPoint, currentOffset, pixelCentroid, shapesGrid, inverseTransorm);
|
13655 | if (resultingAbsolutBoundingBox) {
|
13656 | var resultingBoundingBox = polygonInfoTransform.applyToRect(resultingAbsolutBoundingBox), dataLabel = {
|
13657 | text: labelPoint.text,
|
13658 | secondRowText: labelPoint.secondRowText,
|
13659 | boundingBox: resultingBoundingBox,
|
13660 | isVisible: !0,
|
13661 | fill: labelPoint.insideFill,
|
13662 | identity: null,
|
13663 | selected: !1,
|
13664 | hasBackground: !0,
|
13665 | isPlacedInsidePolygon: !1,
|
13666 | textAnchor: "middle",
|
13667 | originalPixelOffset: currentOffset,
|
13668 | originalPosition: position,
|
13669 | originalAbsoluteCentroid: polygon.absoluteCentroid(),
|
13670 | absoluteBoundingBoxCenter: {
|
13671 | x: resultingAbsolutBoundingBox.left + resultingAbsolutBoundingBox.width / 2,
|
13672 | y: resultingAbsolutBoundingBox.top + resultingAbsolutBoundingBox.height / 2
|
13673 | }
|
13674 | }, pixelStemSource = this.calculateStemSource(polygonInfoTransform, inverseTransorm, polygon, resultingBoundingBox, position, pixelCentroid);
|
13675 | return dataLabel.leaderLinePoints = this.setLeaderLinePoints(pixelStemSource, this.calculateStemDestination(resultingBoundingBox, position)),
|
13676 | dataLabel.absoluteStemSource = inverseTransorm.applyToPoint(pixelStemSource), grid.add(resultingBoundingBox),
|
13677 | dataLabel;
|
13678 | }
|
13679 | }
|
13680 | }
|
13681 | currentOffset += OffsetDelta;
|
13682 | }
|
13683 | return null;
|
13684 | }, FilledMapLabelLayout.prototype.setLeaderLinePoints = function(stemSource, stemDestination) {
|
13685 | return [ [ stemSource.x, stemSource.y ], [ stemDestination.x, stemDestination.y ] ];
|
13686 | }, FilledMapLabelLayout.prototype.calculateStemSource = function(polygonInfoTransform, inverseTransorm, polygon, labelBoundingBox, position, pixelCentroid) {
|
13687 | var absoluteStemSource = polygon.lineIntersectionPoint(polygon.absoluteCentroid(), inverseTransorm.applyToPoint({
|
13688 | x: labelBoundingBox.left + labelBoundingBox.width / 2,
|
13689 | y: labelBoundingBox.top + labelBoundingBox.height / 2
|
13690 | }));
|
13691 | if (null == absoluteStemSource) return pixelCentroid;
|
13692 | var stemSource = polygonInfoTransform.applyToPoint(absoluteStemSource);
|
13693 | switch (position) {
|
13694 | case 1:
|
13695 | stemSource.y += stemExtension;
|
13696 | break;
|
13697 |
|
13698 | case 2:
|
13699 | stemSource.y -= stemExtension;
|
13700 | break;
|
13701 |
|
13702 | case 4:
|
13703 | stemSource.x += stemExtension;
|
13704 | break;
|
13705 |
|
13706 | case 8:
|
13707 | stemSource.x -= stemExtension;
|
13708 | break;
|
13709 |
|
13710 | case 128:
|
13711 | stemSource.x += stemExtension / powerbi.DataLabelPointPositioner.cos45, stemSource.y += stemExtension / powerbi.DataLabelPointPositioner.sin45;
|
13712 | break;
|
13713 |
|
13714 | case 64:
|
13715 | stemSource.x -= stemExtension / powerbi.DataLabelPointPositioner.cos45, stemSource.y += stemExtension / powerbi.DataLabelPointPositioner.sin45;
|
13716 | break;
|
13717 |
|
13718 | case 32:
|
13719 | stemSource.x += stemExtension / powerbi.DataLabelPointPositioner.cos45, stemSource.y -= stemExtension / powerbi.DataLabelPointPositioner.sin45;
|
13720 | break;
|
13721 |
|
13722 | case 16:
|
13723 | stemSource.x -= stemExtension / powerbi.DataLabelPointPositioner.cos45, stemSource.y -= stemExtension / powerbi.DataLabelPointPositioner.sin45;
|
13724 | break;
|
13725 |
|
13726 | case 256: }
|
13727 | return stemSource;
|
13728 | }, FilledMapLabelLayout.prototype.calculateStemDestination = function(labelBoundingBox, position) {
|
13729 | var x, y;
|
13730 | switch (position) {
|
13731 | case 1:
|
13732 | x = labelBoundingBox.left + labelBoundingBox.width / 2, y = labelBoundingBox.top + labelBoundingBox.height;
|
13733 | break;
|
13734 |
|
13735 | case 2:
|
13736 | x = labelBoundingBox.left + labelBoundingBox.width / 2, y = labelBoundingBox.top;
|
13737 | break;
|
13738 |
|
13739 | case 4:
|
13740 | x = labelBoundingBox.left + labelBoundingBox.width, y = labelBoundingBox.top + labelBoundingBox.height / 2;
|
13741 | break;
|
13742 |
|
13743 | case 8:
|
13744 | x = labelBoundingBox.left, y = labelBoundingBox.top + labelBoundingBox.height / 2;
|
13745 | break;
|
13746 |
|
13747 | case 128:
|
13748 | x = labelBoundingBox.left + labelBoundingBox.width, y = labelBoundingBox.top + labelBoundingBox.height;
|
13749 | break;
|
13750 |
|
13751 | case 64:
|
13752 | x = labelBoundingBox.left, y = labelBoundingBox.top + labelBoundingBox.height;
|
13753 | break;
|
13754 |
|
13755 | case 32:
|
13756 | x = labelBoundingBox.left + labelBoundingBox.width, y = labelBoundingBox.top;
|
13757 | break;
|
13758 |
|
13759 | case 16:
|
13760 | x = labelBoundingBox.left, y = labelBoundingBox.top;
|
13761 | break;
|
13762 |
|
13763 | case 256: }
|
13764 | return {
|
13765 | x: x,
|
13766 | y: y
|
13767 | };
|
13768 | }, FilledMapLabelLayout.prototype.tryPositionForPolygonPosition = function(position, labelDataPoint, polygonInfoTransform, offset, inverseTransorm) {
|
13769 | var polygon = labelDataPoint.parentShape.polygon, pixelCentroid = polygonInfoTransform.applyToPoint(polygon.absoluteCentroid()), labelRect = this.getLabelPolygon(labelDataPoint, position, pixelCentroid, offset), absoluteLabelRect = this.getAbsoluteRectangle(inverseTransorm, labelRect);
|
13770 | return polygon.contains(absoluteLabelRect) ? absoluteLabelRect : null;
|
13771 | }, FilledMapLabelLayout.prototype.tryPlaceLabelOutsidePolygon = function(grid, position, labelDataPoint, offset, pixelCentroid, shapesGrid, inverseTransform) {
|
13772 | var offsetForPosition = offset, labelRect = this.getLabelPolygon(labelDataPoint, position, pixelCentroid, offsetForPosition), otherLabelsConflict = grid.hasConflict(labelRect);
|
13773 | if (!otherLabelsConflict) {
|
13774 | var absoluteLabelRect = this.getAbsoluteRectangle(inverseTransform, labelRect);
|
13775 | if (!shapesGrid.hasConflict(absoluteLabelRect, labelRect)) return absoluteLabelRect;
|
13776 | }
|
13777 | return null;
|
13778 | }, FilledMapLabelLayout.prototype.updateLabelOffsets = function(polygonInfoTransform) {
|
13779 | for (var _i = 0, _a = this.labels; _i < _a.length; _i++) {
|
13780 | var label = _a[_i];
|
13781 | if (label.isVisible) if (label.isPlacedInsidePolygon) {
|
13782 | var newOffset = polygonInfoTransform.applyToPoint(label.absoluteBoundingBoxCenter), xDelta = label.boundingBox.left + label.boundingBox.width / 2 - newOffset.x, yDelta = label.boundingBox.top + label.boundingBox.height / 2 - newOffset.y;
|
13783 | label.boundingBox.top -= yDelta, label.boundingBox.left -= xDelta;
|
13784 | } else {
|
13785 | var stemSourcePoint = polygonInfoTransform.applyToPoint(label.absoluteStemSource), pixelCentroid = polygonInfoTransform.applyToPoint(label.originalAbsoluteCentroid);
|
13786 | label.boundingBox = this.getLabelBoundingBox({
|
13787 | width: label.boundingBox.width,
|
13788 | height: label.boundingBox.height
|
13789 | }, label.originalPosition, pixelCentroid, label.originalPixelOffset), void 0 !== label.leaderLinePoints && (label.leaderLinePoints = this.setLeaderLinePoints(stemSourcePoint, this.calculateStemDestination(label.boundingBox, label.originalPosition)));
|
13790 | }
|
13791 | }
|
13792 | }, FilledMapLabelLayout.prototype.getAbsoluteRectangle = function(inverseTransorm, rect) {
|
13793 | return inverseTransorm.applyToRect(rect);
|
13794 | }, FilledMapLabelLayout;
|
13795 | }();
|
13796 | powerbi.FilledMapLabelLayout = FilledMapLabelLayout;
|
13797 | var LabelPolygonArrangeGrid = function() {
|
13798 | function LabelPolygonArrangeGrid(polygons, viewport) {
|
13799 | this.viewport = viewport;
|
13800 | for (var maxPolygonWidth = 0, maxPolygonHeight = 0, _i = 0, polygons_1 = polygons; _i < polygons_1.length; _i++) {
|
13801 | var polygon = polygons_1[_i], polygonSize = polygon.pixelBoundingRect;
|
13802 | polygonSize.width > maxPolygonWidth && (maxPolygonWidth = polygonSize.width), polygonSize.height > maxPolygonHeight && (maxPolygonHeight = polygonSize.height);
|
13803 | }
|
13804 | 0 === maxPolygonWidth && (maxPolygonWidth = viewport.width), 0 === maxPolygonHeight && (maxPolygonHeight = viewport.height);
|
13805 | var cellSize = this.cellSize = {
|
13806 | width: maxPolygonWidth * LabelPolygonArrangeGrid.cellSizeMultiplier,
|
13807 | height: maxPolygonHeight * LabelPolygonArrangeGrid.cellSizeMultiplier
|
13808 | };
|
13809 | this.columnCount = LabelPolygonArrangeGrid.getCellCount(cellSize.width, viewport.width, 1, 100),
|
13810 | this.rowCount = LabelPolygonArrangeGrid.getCellCount(cellSize.height, viewport.height, 1, 100);
|
13811 | for (var grid = [], i = 0, ilen = this.columnCount; ilen > i; i++) {
|
13812 | grid[i] = [];
|
13813 | for (var j = 0, jlen = this.rowCount; jlen > j; j++) grid[i][j] = [];
|
13814 | }
|
13815 | this.grid = grid;
|
13816 | for (var _a = 0, polygons_2 = polygons; _a < polygons_2.length; _a++) {
|
13817 | var polygon = polygons_2[_a];
|
13818 | this.add(polygon);
|
13819 | }
|
13820 | }
|
13821 | return LabelPolygonArrangeGrid.prototype.hasConflict = function(absolutLabelRect, pixelLabelRect) {
|
13822 | for (var containingIndexRect = this.getContainingGridSubsection(pixelLabelRect), grid = this.grid, x = containingIndexRect.xMin; x < containingIndexRect.xMax; x++) for (var y = containingIndexRect.yMin; y < containingIndexRect.yMax; y++) for (var _i = 0, _a = grid[x][y]; _i < _a.length; _i++) {
|
13823 | var currentPolygon = _a[_i];
|
13824 | if (currentPolygon.conflicts(absolutLabelRect)) return !0;
|
13825 | }
|
13826 | return !1;
|
13827 | }, LabelPolygonArrangeGrid.prototype.add = function(polygon) {
|
13828 | for (var containingIndexRect = this.getContainingGridSubsection(polygon.pixelBoundingRect), x = containingIndexRect.xMin; x < containingIndexRect.xMax; x++) for (var y = containingIndexRect.yMin; y < containingIndexRect.yMax; y++) this.grid[x][y].push(polygon);
|
13829 | }, LabelPolygonArrangeGrid.prototype.getContainingGridSubsection = function(rect) {
|
13830 | return {
|
13831 | xMin: LabelPolygonArrangeGrid.bound(Math.floor(rect.left / this.cellSize.width), 0, this.columnCount),
|
13832 | xMax: LabelPolygonArrangeGrid.bound(Math.ceil((rect.left + rect.width) / this.cellSize.width), 0, this.columnCount),
|
13833 | yMin: LabelPolygonArrangeGrid.bound(Math.floor(rect.top / this.cellSize.height), 0, this.rowCount),
|
13834 | yMax: LabelPolygonArrangeGrid.bound(Math.ceil((rect.top + rect.height) / this.cellSize.height), 0, this.rowCount)
|
13835 | };
|
13836 | }, LabelPolygonArrangeGrid.getCellCount = function(step, length, minCount, maxCount) {
|
13837 | return LabelPolygonArrangeGrid.bound(Math.ceil(length / step), minCount, maxCount);
|
13838 | }, LabelPolygonArrangeGrid.bound = function(value, min, max) {
|
13839 | return Math.max(Math.min(value, max), min);
|
13840 | }, LabelPolygonArrangeGrid.cellSizeMultiplier = 2, LabelPolygonArrangeGrid;
|
13841 | }();
|
13842 | powerbi.LabelPolygonArrangeGrid = LabelPolygonArrangeGrid;
|
13843 | }(powerbi || (powerbi = {}));
|
13844 | }, function(module, exports) {
|
13845 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
13846 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
13847 | !function(powerbi) {
|
13848 | var visuals;
|
13849 | !function(visuals) {
|
13850 | function createColorAllocatorFactory() {
|
13851 | return new ColorAllocatorFactory();
|
13852 | }
|
13853 | visuals.createColorAllocatorFactory = createColorAllocatorFactory;
|
13854 | var ColorAllocatorFactory = function() {
|
13855 | function ColorAllocatorFactory() {}
|
13856 | return ColorAllocatorFactory.prototype.linearGradient2 = function(options) {
|
13857 | return new LinearGradient2Allocator(options);
|
13858 | }, ColorAllocatorFactory.prototype.linearGradient3 = function(options, splitScales) {
|
13859 | return splitScales ? new LinearGradient3AllocatorWithSplittedScales(options) : new LinearGradient3Allocator(options);
|
13860 | }, ColorAllocatorFactory;
|
13861 | }(), LinearGradient2Allocator = function() {
|
13862 | function LinearGradient2Allocator(options) {
|
13863 | this.options = options;
|
13864 | var min = options.min, max = options.max;
|
13865 | this.scale = d3.scale.linear().domain([ min.value, max.value ]).range([ min.color, max.color ]).clamp(!0);
|
13866 | }
|
13867 | return LinearGradient2Allocator.prototype.color = function(value) {
|
13868 | var min = this.options.min, max = this.options.max;
|
13869 | return min.value === max.value ? value >= max.value ? max.color : min.color : this.scale(value);
|
13870 | }, LinearGradient2Allocator;
|
13871 | }(), LinearGradient3Allocator = function() {
|
13872 | function LinearGradient3Allocator(options) {
|
13873 | this.options = options;
|
13874 | var min = options.min, mid = options.mid, max = options.max;
|
13875 | this.scale = d3.scale.linear().domain([ min.value, mid.value, max.value ]).range([ min.color, mid.color, max.color ]).clamp(!0);
|
13876 | }
|
13877 | return LinearGradient3Allocator.prototype.color = function(value) {
|
13878 | var min = this.options.min, mid = this.options.mid, max = this.options.max;
|
13879 | return max.value === mid.value || mid.value === min.value || max.value === mid.value && max.value === min.value ? value >= max.value ? max.color : value >= mid.value ? mid.color : min.color : this.scale(value);
|
13880 | }, LinearGradient3Allocator;
|
13881 | }(), LinearGradient3AllocatorWithSplittedScales = function() {
|
13882 | function LinearGradient3AllocatorWithSplittedScales(options) {
|
13883 | this.options = options;
|
13884 | var min = options.min, mid = options.mid, max = options.max;
|
13885 | this.scale1 = d3.scale.linear().domain([ min.value, mid.value ]).range([ min.color, mid.color ]).clamp(!0),
|
13886 | this.scale2 = d3.scale.linear().domain([ mid.value, max.value ]).range([ mid.color, max.color ]).clamp(!0);
|
13887 | }
|
13888 | return LinearGradient3AllocatorWithSplittedScales.prototype.color = function(value) {
|
13889 | var min = this.options.min, mid = this.options.mid, max = this.options.max;
|
13890 | return max.value === mid.value || mid.value === min.value || max.value === mid.value && max.value === min.value ? value >= max.value ? max.color : value >= mid.value ? mid.color : min.color : value <= mid.value ? this.scale1(value) : this.scale2(value);
|
13891 | }, LinearGradient3AllocatorWithSplittedScales;
|
13892 | }();
|
13893 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
13894 | }(powerbi || (powerbi = {}));
|
13895 | }, function(module, exports) {
|
13896 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
13897 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
13898 | !function(powerbi) {
|
13899 | var visuals;
|
13900 | !function(visuals) {
|
13901 | var BeautifiedFormat = {
|
13902 | "0.00 %;-0.00 %;0.00 %": "Percentage",
|
13903 | "0.0 %;-0.0 %;0.0 %": "Percentage1"
|
13904 | }, defaultLocalizedStrings = {
|
13905 | NullValue: "(Blank)",
|
13906 | BooleanTrue: "True",
|
13907 | BooleanFalse: "False",
|
13908 | NaNValue: "NaN",
|
13909 | InfinityValue: "+Infinity",
|
13910 | NegativeInfinityValue: "-Infinity",
|
13911 | Restatement_Comma: "{0}, {1}",
|
13912 | Restatement_CompoundAnd: "{0} and {1}",
|
13913 | DisplayUnitSystem_EAuto_Title: "Auto",
|
13914 | DisplayUnitSystem_E0_Title: "None",
|
13915 | DisplayUnitSystem_E3_LabelFormat: "{0}K",
|
13916 | DisplayUnitSystem_E3_Title: "Thousands",
|
13917 | DisplayUnitSystem_E6_LabelFormat: "{0}M",
|
13918 | DisplayUnitSystem_E6_Title: "Millions",
|
13919 | DisplayUnitSystem_E9_LabelFormat: "{0}bn",
|
13920 | DisplayUnitSystem_E9_Title: "Billions",
|
13921 | DisplayUnitSystem_E12_LabelFormat: "{0}T",
|
13922 | DisplayUnitSystem_E12_Title: "Trillions",
|
13923 | Percentage: "#,0.##%",
|
13924 | Percentage1: "#,0.#%",
|
13925 | RichTextbox_Link_DefaultText: "Link",
|
13926 | TableTotalLabel: "Total",
|
13927 | ListJoin_Separator: ", ",
|
13928 | Tooltip_HighlightedValueDisplayName: "Highlighted",
|
13929 | Funnel_PercentOfFirst: "Percent of first",
|
13930 | Funnel_PercentOfPrevious: "Percent of previous",
|
13931 | Funnel_PercentOfFirst_Highlight: "Percent of first (highlighted)",
|
13932 | Funnel_PercentOfPrevious_Highlight: "Percent of previous (highlighted)",
|
13933 | GeotaggingString_Continent: "continent",
|
13934 | GeotaggingString_Continents: "continents",
|
13935 | GeotaggingString_Country: "country",
|
13936 | GeotaggingString_Countries: "countries",
|
13937 | GeotaggingString_State: "state",
|
13938 | GeotaggingString_States: "states",
|
13939 | GeotaggingString_City: "city",
|
13940 | GeotaggingString_Cities: "cities",
|
13941 | GeotaggingString_Town: "town",
|
13942 | GeotaggingString_Towns: "towns",
|
13943 | GeotaggingString_Province: "province",
|
13944 | GeotaggingString_Provinces: "provinces",
|
13945 | GeotaggingString_County: "county",
|
13946 | GeotaggingString_Counties: "counties",
|
13947 | GeotaggingString_Village: "village",
|
13948 | GeotaggingString_Villages: "villages",
|
13949 | GeotaggingString_Post: "post",
|
13950 | GeotaggingString_Zip: "zip",
|
13951 | GeotaggingString_Code: "code",
|
13952 | GeotaggingString_Place: "place",
|
13953 | GeotaggingString_Places: "places",
|
13954 | GeotaggingString_Address: "address",
|
13955 | GeotaggingString_Addresses: "addresses",
|
13956 | GeotaggingString_Street: "street",
|
13957 | GeotaggingString_Streets: "streets",
|
13958 | GeotaggingString_Longitude: "longitude",
|
13959 | GeotaggingString_Longitude_Short: "lon",
|
13960 | GeotaggingString_Longitude_Short2: "long",
|
13961 | GeotaggingString_Latitude: "latitude",
|
13962 | GeotaggingString_Latitude_Short: "lat",
|
13963 | GeotaggingString_PostalCode: "postal code",
|
13964 | GeotaggingString_PostalCodes: "postal codes",
|
13965 | GeotaggingString_ZipCode: "zip code",
|
13966 | GeotaggingString_ZipCodes: "zip codes",
|
13967 | GeotaggingString_Territory: "territory",
|
13968 | GeotaggingString_Territories: "territories",
|
13969 | Waterfall_IncreaseLabel: "Increase",
|
13970 | Waterfall_DecreaseLabel: "Decrease",
|
13971 | Waterfall_TotalLabel: "Total",
|
13972 | Slicer_SelectAll: "Select All"
|
13973 | }, DefaultVisualHostServices = function() {
|
13974 | function DefaultVisualHostServices() {}
|
13975 | return DefaultVisualHostServices.initialize = function() {
|
13976 | visuals.valueFormatter.setLocaleOptions(DefaultVisualHostServices.createLocaleOptions()),
|
13977 | visuals.TooltipManager.setLocalizedStrings(DefaultVisualHostServices.createTooltipLocaleOptions());
|
13978 | }, DefaultVisualHostServices.createLocaleOptions = function() {
|
13979 | return {
|
13980 | "null": defaultLocalizedStrings.NullValue,
|
13981 | "true": defaultLocalizedStrings.BooleanTrue,
|
13982 | "false": defaultLocalizedStrings.BooleanFalse,
|
13983 | NaN: defaultLocalizedStrings.NaNValue,
|
13984 | infinity: defaultLocalizedStrings.InfinityValue,
|
13985 | negativeInfinity: defaultLocalizedStrings.NegativeInfinityValue,
|
13986 | beautify: function(format) {
|
13987 | return DefaultVisualHostServices.beautify(format);
|
13988 | },
|
13989 | describe: function(exponent) {
|
13990 | return DefaultVisualHostServices.describeUnit(exponent);
|
13991 | },
|
13992 | restatementComma: defaultLocalizedStrings.Restatement_Comma,
|
13993 | restatementCompoundAnd: defaultLocalizedStrings.Restatement_CompoundAnd,
|
13994 | restatementCompoundOr: defaultLocalizedStrings.Restatement_CompoundOr
|
13995 | };
|
13996 | }, DefaultVisualHostServices.createTooltipLocaleOptions = function() {
|
13997 | return {
|
13998 | highlightedValueDisplayName: defaultLocalizedStrings.Tooltip_HighlightedValueDisplayName
|
13999 | };
|
14000 | }, DefaultVisualHostServices.prototype.getLocalizedString = function(stringId) {
|
14001 | return defaultLocalizedStrings[stringId];
|
14002 | }, DefaultVisualHostServices.prototype.onDragStart = function() {}, DefaultVisualHostServices.prototype.canSelect = function() {
|
14003 | return !1;
|
14004 | }, DefaultVisualHostServices.prototype.onSelect = function() {}, DefaultVisualHostServices.prototype.onContextMenu = function() {},
|
14005 | DefaultVisualHostServices.prototype.loadMoreData = function() {}, DefaultVisualHostServices.prototype.persistProperties = function(changes) {},
|
14006 | DefaultVisualHostServices.prototype.onCustomSort = function(args) {}, DefaultVisualHostServices.prototype.getViewMode = function() {
|
14007 | return 0;
|
14008 | }, DefaultVisualHostServices.prototype.setWarnings = function(warnings) {}, DefaultVisualHostServices.prototype.setToolbar = function($toolbar) {},
|
14009 | DefaultVisualHostServices.prototype.shouldRetainSelection = function() {
|
14010 | return !1;
|
14011 | }, DefaultVisualHostServices.prototype.geocoder = function() {
|
14012 | return visuals.services.createGeocoder();
|
14013 | }, DefaultVisualHostServices.prototype.geolocation = function() {
|
14014 | return visuals.services.createGeolocation();
|
14015 | }, DefaultVisualHostServices.prototype.promiseFactory = function() {
|
14016 | return powerbi.createJQueryPromiseFactory();
|
14017 | }, DefaultVisualHostServices.prototype.visualCapabilitiesChanged = function() {},
|
14018 | DefaultVisualHostServices.prototype.analyzeFilter = function(options) {
|
14019 | return {
|
14020 | isNotFilter: !1,
|
14021 | selectedIdentities: [],
|
14022 | filter: void 0,
|
14023 | defaultValue: void 0
|
14024 | };
|
14025 | }, DefaultVisualHostServices.prototype.getIdentityDisplayNames = function(dentities) {},
|
14026 | DefaultVisualHostServices.prototype.setIdentityDisplayNames = function(displayNamesIdentityPairs) {},
|
14027 | DefaultVisualHostServices.beautify = function(format) {
|
14028 | var key = BeautifiedFormat[format];
|
14029 | return key ? defaultLocalizedStrings[key] || format : format;
|
14030 | }, DefaultVisualHostServices.describeUnit = function(exponent) {
|
14031 | var exponentLookup = -1 === exponent ? "Auto" : exponent.toString(), title = defaultLocalizedStrings["DisplayUnitSystem_E" + exponentLookup + "_Title"], format = 0 >= exponent ? "{0}" : defaultLocalizedStrings["DisplayUnitSystem_E" + exponentLookup + "_LabelFormat"];
|
14032 | return title || format ? {
|
14033 | title: title,
|
14034 | format: format
|
14035 | } : void 0;
|
14036 | }, DefaultVisualHostServices;
|
14037 | }();
|
14038 | visuals.DefaultVisualHostServices = DefaultVisualHostServices, visuals.defaultVisualHostServices = new DefaultVisualHostServices();
|
14039 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
14040 | }(powerbi || (powerbi = {}));
|
14041 | }, function(module, exports) {
|
14042 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
14043 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
14044 | !function(powerbi) {
|
14045 | var visuals;
|
14046 | !function(visuals) {
|
14047 | function createInteractivityService(hostServices) {
|
14048 | return new InteractivityService(hostServices);
|
14049 | }
|
14050 | function appendClearCatcher(selection) {
|
14051 | return selection.append("rect").classed("clearCatcher", !0).attr({
|
14052 | width: "100%",
|
14053 | height: "100%"
|
14054 | });
|
14055 | }
|
14056 | function isCategoryColumnSelected(propertyId, categories, idx) {
|
14057 | return null != categories.objects && categories.objects[idx] && powerbi.DataViewObjects.getValue(categories.objects[idx], propertyId);
|
14058 | }
|
14059 | function dataHasSelection(data) {
|
14060 | for (var i = 0, ilen = data.length; ilen > i; i++) if (data[i].selected) return !0;
|
14061 | return !1;
|
14062 | }
|
14063 | var ArrayExtensions = jsCommon.ArrayExtensions, SemanticFilter = powerbi.data.SemanticFilter;
|
14064 | visuals.createInteractivityService = createInteractivityService, visuals.appendClearCatcher = appendClearCatcher,
|
14065 | visuals.isCategoryColumnSelected = isCategoryColumnSelected, visuals.dataHasSelection = dataHasSelection;
|
14066 | var InteractivityService = function() {
|
14067 | function InteractivityService(hostServices) {
|
14068 | this.renderSelectionInVisual = _.noop, this.renderSelectionInLegend = _.noop, this.renderSelectionInLabels = _.noop,
|
14069 | this.selectedIds = [], this.isInvertedSelectionMode = !1, this.hostService = hostServices;
|
14070 | }
|
14071 | return InteractivityService.prototype.bind = function(dataPoints, behavior, behaviorOptions, options) {
|
14072 | var _this = this;
|
14073 | options && options.overrideSelectionFromData && this.takeSelectionStateFromDataPoints(dataPoints),
|
14074 | options ? (options.isLegend ? (this.selectableLegendDataPoints = dataPoints, this.renderSelectionInLegend = function() {
|
14075 | return behavior.renderSelection(_this.legendHasSelection());
|
14076 | }) : options.isLabels ? (this.selectableLabelsDataPoints = dataPoints, this.renderSelectionInLabels = function() {
|
14077 | return behavior.renderSelection(_this.labelsHasSelection());
|
14078 | }) : (this.selectableDataPoints = dataPoints, this.renderSelectionInVisual = function() {
|
14079 | return behavior.renderSelection(_this.hasSelection());
|
14080 | }), null != options.hasSelectionOverride && (this.hasSelectionOverride = options.hasSelectionOverride),
|
14081 | options.slicerValueHandler && (this.slicerValueHandler = options.slicerValueHandler)) : (this.selectableDataPoints = dataPoints,
|
14082 | this.renderSelectionInVisual = function() {
|
14083 | return behavior.renderSelection(_this.hasSelection());
|
14084 | }), this.behavior = behavior, behavior.bindEvents(behaviorOptions, this), this.syncSelectionState();
|
14085 | }, InteractivityService.prototype.clearSelection = function() {
|
14086 | return this.slicerValueHandler && this.slicerValueHandler.getDefaultValue() && this.useDefaultValue ? void (this.isInvertedSelectionMode = !1) : (this.hasSelectionOverride = void 0,
|
14087 | ArrayExtensions.clear(this.selectedIds), this.isInvertedSelectionMode = !1, this.applyToAllSelectableDataPoints(function(dataPoint) {
|
14088 | return dataPoint.selected = !1;
|
14089 | }), void this.renderAll());
|
14090 | }, InteractivityService.prototype.applySelectionStateToData = function(dataPoints) {
|
14091 | for (var _i = 0, dataPoints_1 = dataPoints; _i < dataPoints_1.length; _i++) {
|
14092 | var dataPoint = dataPoints_1[_i];
|
14093 | dataPoint.selected = InteractivityService.checkDatapointAgainstSelectedIds(dataPoint, this.selectedIds);
|
14094 | }
|
14095 | return this.hasSelection();
|
14096 | }, InteractivityService.prototype.hasSelection = function() {
|
14097 | return this.selectedIds.length > 0;
|
14098 | }, InteractivityService.prototype.legendHasSelection = function() {
|
14099 | return this.selectableLegendDataPoints ? dataHasSelection(this.selectableLegendDataPoints) : !1;
|
14100 | }, InteractivityService.prototype.labelsHasSelection = function() {
|
14101 | return this.selectableLabelsDataPoints ? dataHasSelection(this.selectableLabelsDataPoints) : !1;
|
14102 | }, InteractivityService.prototype.isSelectionModeInverted = function() {
|
14103 | return this.isInvertedSelectionMode;
|
14104 | }, InteractivityService.prototype.setSelectionModeInverted = function(inverted) {
|
14105 | this.isInvertedSelectionMode = inverted;
|
14106 | }, InteractivityService.prototype.handleSelection = function(dataPoint, multiSelect) {
|
14107 | dataPoint && (this.useDefaultValue = !1, this.select(dataPoint, multiSelect), this.sendSelectionToHost(),
|
14108 | this.renderAll());
|
14109 | }, InteractivityService.prototype.handleContextMenu = function(dataPoint, point) {
|
14110 | this.sendContextMenuToHost(dataPoint, point);
|
14111 | }, InteractivityService.prototype.handleClearSelection = function() {
|
14112 | this.useDefaultValue = !0, this.clearSelection(), this.sendSelectionToHost();
|
14113 | }, InteractivityService.prototype.toggleSelectionModeInversion = function() {
|
14114 | return this.useDefaultValue = !1, this.isInvertedSelectionMode = !this.isInvertedSelectionMode,
|
14115 | ArrayExtensions.clear(this.selectedIds), this.applyToAllSelectableDataPoints(function(dataPoint) {
|
14116 | return dataPoint.selected = !1;
|
14117 | }), this.sendSelectionToHost(), this.isInvertedSelectionMode ? this.syncSelectionStateInverted() : this.syncSelectionState(),
|
14118 | this.renderAll(), this.isInvertedSelectionMode;
|
14119 | }, InteractivityService.prototype.persistSelectionFilter = function(filterPropertyIdentifier) {
|
14120 | this.hostService.persistProperties(InteractivityService.createChangeForFilterProperty(filterPropertyIdentifier, this.getFilterFromSelectors()));
|
14121 | }, InteractivityService.prototype.persistSelfFilter = function(filterPropertyIdentifier, selfFilter) {
|
14122 | this.hostService.persistProperties(InteractivityService.createChangeForFilterProperty(filterPropertyIdentifier, selfFilter));
|
14123 | }, InteractivityService.prototype.setDefaultValueMode = function(useDefaultValue) {
|
14124 | this.useDefaultValue = useDefaultValue;
|
14125 | }, InteractivityService.prototype.isDefaultValueEnabled = function() {
|
14126 | return this.useDefaultValue;
|
14127 | }, InteractivityService.prototype.renderAll = function() {
|
14128 | this.renderSelectionInVisual(), this.renderSelectionInLegend(), this.renderSelectionInLabels();
|
14129 | }, InteractivityService.prototype.select = function(d, multiSelect) {
|
14130 | if (this.isInvertedSelectionMode) return this.selectInverted(d, multiSelect);
|
14131 | d.identity && d.identity.highlight && (d = _.find(this.selectableDataPoints, function(dp) {
|
14132 | return !dp.identity.highlight && d.identity.includes(dp.identity, !0);
|
14133 | }));
|
14134 | var id = d.identity;
|
14135 | if (id) {
|
14136 | var selected = !d.selected || !multiSelect && this.selectedIds.length > 1;
|
14137 | multiSelect && (selected ? (d.selected = !0, this.selectedIds.push(id), id.hasIdentity() ? this.removeSelectionIdsWithOnlyMeasures() : this.removeSelectionIdsExceptOnlyMeasures()) : (d.selected = !1,
|
14138 | this.removeId(id))), multiSelect && this.hostService.canSelect({
|
14139 | data: this.selectedIds.map(function(value) {
|
14140 | return value.getSelector();
|
14141 | })
|
14142 | }) || (this.clearSelection(), selected && (d.selected = !0, this.selectedIds.push(id))),
|
14143 | this.syncSelectionState();
|
14144 | }
|
14145 | }, InteractivityService.prototype.selectInverted = function(d, multiSelect) {
|
14146 | var wasSelected = d.selected, id = d.identity;
|
14147 | d.selected = !wasSelected, wasSelected ? this.removeId(id) : (this.selectedIds.push(id),
|
14148 | id.hasIdentity() ? this.removeSelectionIdsWithOnlyMeasures() : this.removeSelectionIdsExceptOnlyMeasures()),
|
14149 | this.syncSelectionStateInverted();
|
14150 | }, InteractivityService.prototype.removeId = function(toRemove) {
|
14151 | for (var selectedIds = this.selectedIds, i = selectedIds.length - 1; i > -1; i--) {
|
14152 | var currentId = selectedIds[i];
|
14153 | toRemove.includes(currentId) && selectedIds.splice(i, 1);
|
14154 | }
|
14155 | }, InteractivityService.prototype.getFilterFromSelectors = function() {
|
14156 | var selectors = [];
|
14157 | this.selectedIds.length > 0 && (selectors = _.chain(this.selectedIds).filter(function(value) {
|
14158 | return value.hasIdentity();
|
14159 | }).map(function(value) {
|
14160 | return value.getSelector();
|
14161 | }).value());
|
14162 | var filter = powerbi.data.Selector.filterFromSelector(selectors, this.isInvertedSelectionMode);
|
14163 | return this.slicerValueHandler && this.slicerValueHandler.getDefaultValue() && (this.useDefaultValue === !0 ? filter = SemanticFilter.getDefaultValueFilter(this.slicerValueHandler.getIdentityFields()) : _.isEmpty(selectors) && (filter = SemanticFilter.getAnyValueFilter(this.slicerValueHandler.getIdentityFields()))),
|
14164 | filter;
|
14165 | }, InteractivityService.createChangeForFilterProperty = function(filterPropertyIdentifier, filter) {
|
14166 | var properties = {}, instance = {
|
14167 | objectName: filterPropertyIdentifier.objectName,
|
14168 | selector: void 0,
|
14169 | properties: properties
|
14170 | };
|
14171 | return null == filter ? (properties[filterPropertyIdentifier.propertyName] = {},
|
14172 | {
|
14173 | remove: [ instance ]
|
14174 | }) : (properties[filterPropertyIdentifier.propertyName] = filter, {
|
14175 | merge: [ instance ]
|
14176 | });
|
14177 | }, InteractivityService.prototype.sendContextMenuToHost = function(dataPoint, position) {
|
14178 | var host = this.hostService;
|
14179 | if (host.onContextMenu) {
|
14180 | var selectors = this.getSelectorsByColumn([ dataPoint.identity ]);
|
14181 | if (!_.isEmpty(selectors)) {
|
14182 | var args = {
|
14183 | data: selectors,
|
14184 | position: position
|
14185 | };
|
14186 | host.onContextMenu(args);
|
14187 | }
|
14188 | }
|
14189 | }, InteractivityService.prototype.sendSelectionToHost = function() {
|
14190 | var host = this.hostService;
|
14191 | if (host.onSelect) {
|
14192 | var selectArgs = {
|
14193 | data: this.selectedIds.map(function(value) {
|
14194 | return value.getSelector();
|
14195 | })
|
14196 | }, data2 = this.getSelectorsByColumn(this.selectedIds);
|
14197 | _.isEmpty(data2) || (selectArgs.data2 = data2), host.onSelect(selectArgs);
|
14198 | }
|
14199 | }, InteractivityService.prototype.getSelectorsByColumn = function(selectionIds) {
|
14200 | return _(selectionIds).filter(function(value) {
|
14201 | return value.hasIdentity;
|
14202 | }).map(function(value) {
|
14203 | return value.getSelectorsByColumn();
|
14204 | }).compact().value();
|
14205 | }, InteractivityService.prototype.takeSelectionStateFromDataPoints = function(dataPoints) {
|
14206 | var selectedIds = this.selectedIds;
|
14207 | ArrayExtensions.clear(selectedIds);
|
14208 | for (var _i = 0, dataPoints_2 = dataPoints; _i < dataPoints_2.length; _i++) {
|
14209 | var dataPoint = dataPoints_2[_i];
|
14210 | dataPoint.selected && selectedIds.push(dataPoint.identity);
|
14211 | }
|
14212 | }, InteractivityService.prototype.syncSelectionState = function() {
|
14213 | if (this.isInvertedSelectionMode) return this.syncSelectionStateInverted();
|
14214 | var selectedIds = this.selectedIds, selectableDataPoints = this.selectableDataPoints, selectableLegendDataPoints = this.selectableLegendDataPoints, selectableLabelsDataPoints = this.selectableLabelsDataPoints, foundMatchingId = !1;
|
14215 | if (selectableDataPoints || selectableLegendDataPoints) {
|
14216 | if (selectableDataPoints && InteractivityService.updateSelectableDataPointsBySelectedIds(selectableDataPoints, selectedIds) && (foundMatchingId = !0),
|
14217 | selectableLegendDataPoints && InteractivityService.updateSelectableDataPointsBySelectedIds(selectableLegendDataPoints, selectedIds) && (foundMatchingId = !0),
|
14218 | selectableLabelsDataPoints) for (var labelsDataPoint_1, i = 0, ilen = selectableLabelsDataPoints.length; ilen > i; i++) labelsDataPoint_1 = selectableLabelsDataPoints[i],
|
14219 | selectedIds.some(function(value) {
|
14220 | return value.includes(labelsDataPoint_1.identity);
|
14221 | }) ? labelsDataPoint_1.selected = !0 : labelsDataPoint_1.selected = !1;
|
14222 | !foundMatchingId && selectedIds.length > 0 && (this.clearSelection(), this.sendSelectionToHost());
|
14223 | }
|
14224 | }, InteractivityService.prototype.syncSelectionStateInverted = function() {
|
14225 | var selectedIds = this.selectedIds, selectableDataPoints = this.selectableDataPoints;
|
14226 | if (selectableDataPoints) if (0 === selectedIds.length) for (var _i = 0, selectableDataPoints_1 = selectableDataPoints; _i < selectableDataPoints_1.length; _i++) {
|
14227 | var dataPoint_1 = selectableDataPoints_1[_i];
|
14228 | dataPoint_1.selected = !1;
|
14229 | } else for (var _a = 0, selectableDataPoints_2 = selectableDataPoints; _a < selectableDataPoints_2.length; _a++) {
|
14230 | var dataPoint = selectableDataPoints_2[_a];
|
14231 | selectedIds.some(function(value) {
|
14232 | return value.includes(dataPoint.identity);
|
14233 | }) ? dataPoint.selected = !0 : dataPoint.selected && (dataPoint.selected = !1);
|
14234 | }
|
14235 | }, InteractivityService.prototype.applyToAllSelectableDataPoints = function(action) {
|
14236 | var selectableDataPoints = this.selectableDataPoints, selectableLegendDataPoints = this.selectableLegendDataPoints, selectableLabelsDataPoints = this.selectableLabelsDataPoints;
|
14237 | if (selectableDataPoints) for (var _i = 0, selectableDataPoints_3 = selectableDataPoints; _i < selectableDataPoints_3.length; _i++) {
|
14238 | var dataPoint = selectableDataPoints_3[_i];
|
14239 | action(dataPoint);
|
14240 | }
|
14241 | if (selectableLegendDataPoints) for (var _a = 0, selectableLegendDataPoints_1 = selectableLegendDataPoints; _a < selectableLegendDataPoints_1.length; _a++) {
|
14242 | var dataPoint = selectableLegendDataPoints_1[_a];
|
14243 | action(dataPoint);
|
14244 | }
|
14245 | if (selectableLabelsDataPoints) for (var _b = 0, selectableLabelsDataPoints_1 = selectableLabelsDataPoints; _b < selectableLabelsDataPoints_1.length; _b++) {
|
14246 | var dataPoint = selectableLabelsDataPoints_1[_b];
|
14247 | action(dataPoint);
|
14248 | }
|
14249 | }, InteractivityService.updateSelectableDataPointsBySelectedIds = function(selectableDataPoints, selectedIds) {
|
14250 | for (var foundMatchingId = !1, _i = 0, selectableDataPoints_4 = selectableDataPoints; _i < selectableDataPoints_4.length; _i++) {
|
14251 | var datapoint = selectableDataPoints_4[_i];
|
14252 | datapoint.selected = InteractivityService.checkDatapointAgainstSelectedIds(datapoint, selectedIds),
|
14253 | datapoint.selected && (foundMatchingId = !0);
|
14254 | }
|
14255 | return foundMatchingId;
|
14256 | }, InteractivityService.checkDatapointAgainstSelectedIds = function(datapoint, selectedIds) {
|
14257 | return selectedIds.some(function(value) {
|
14258 | return value.includes(datapoint.identity);
|
14259 | });
|
14260 | }, InteractivityService.prototype.removeSelectionIdsWithOnlyMeasures = function() {
|
14261 | this.selectedIds = _.filter(this.selectedIds, function(identity) {
|
14262 | return identity.hasIdentity();
|
14263 | });
|
14264 | }, InteractivityService.prototype.removeSelectionIdsExceptOnlyMeasures = function() {
|
14265 | this.selectedIds = _.filter(this.selectedIds, function(identity) {
|
14266 | return !identity.hasIdentity();
|
14267 | });
|
14268 | }, InteractivityService;
|
14269 | }();
|
14270 | visuals.InteractivityService = InteractivityService;
|
14271 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
14272 | }(powerbi || (powerbi = {}));
|
14273 | }, function(module, exports) {
|
14274 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
14275 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
14276 | function __() {
|
14277 | this.constructor = d;
|
14278 | }
|
14279 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
14280 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14281 | });
|
14282 | !function(powerbi) {
|
14283 | var visuals;
|
14284 | !function(visuals) {
|
14285 | var services;
|
14286 | !function(services) {
|
14287 | function createGeocoder() {
|
14288 | return {
|
14289 | geocode: geocode,
|
14290 | geocodeBoundary: geocodeBoundary,
|
14291 | geocodePoint: geocodePoint,
|
14292 | tryGeocodeImmediate: tryGeocodeImmediate,
|
14293 | tryGeocodeBoundaryImmediate: tryGeocodeBoundaryImmediate
|
14294 | };
|
14295 | }
|
14296 | function isCategoryType(value) {
|
14297 | return services.CategoryTypeArray.indexOf(value) > -1;
|
14298 | }
|
14299 | function mapLocalesForBing(locale) {
|
14300 | switch (locale.toLowerCase()) {
|
14301 | case "fr":
|
14302 | return "fr-FR";
|
14303 |
|
14304 | default:
|
14305 | return locale;
|
14306 | }
|
14307 | }
|
14308 | function tryGeocodeImmediate(query, category) {
|
14309 | var result = geocodingCache ? geocodingCache.getCoordinates(new GeocodeQuery(query, category).key) : void 0;
|
14310 | return result;
|
14311 | }
|
14312 | function tryGeocodeBoundaryImmediate(latitude, longitude, category, levelOfDetail, maxGeoData) {
|
14313 | void 0 === maxGeoData && (maxGeoData = 3);
|
14314 | var result = geocodingCache ? geocodingCache.getCoordinates(new GeocodeBoundaryQuery(latitude, longitude, category, levelOfDetail, maxGeoData).key) : void 0;
|
14315 | return result;
|
14316 | }
|
14317 | function geocodeCore(geocodeQuery, options) {
|
14318 | var result = geocodingCache ? geocodingCache.getCoordinates(geocodeQuery.key) : void 0, deferred = $.Deferred();
|
14319 | if (result) deferred.resolve(result); else {
|
14320 | var item_1 = {
|
14321 | query: geocodeQuery,
|
14322 | deferred: deferred,
|
14323 | isResolved: !1
|
14324 | };
|
14325 | options && options.timeout && options.timeout["finally"](function() {
|
14326 | item_1.isResolved || (item_1.deferred.reject(), item_1.isResolved = !0);
|
14327 | }), geocodeQueue.push(item_1), dequeue();
|
14328 | }
|
14329 | return deferred;
|
14330 | }
|
14331 | function geocode(query, category, options) {
|
14332 | return void 0 === category && (category = ""), geocodeCore(new GeocodeQuery(query, category), options);
|
14333 | }
|
14334 | function geocodeBoundary(latitude, longitude, category, levelOfDetail, maxGeoData, options) {
|
14335 | return void 0 === category && (category = ""), void 0 === levelOfDetail && (levelOfDetail = 2),
|
14336 | void 0 === maxGeoData && (maxGeoData = 3), geocodeCore(new GeocodeBoundaryQuery(latitude, longitude, category, levelOfDetail, maxGeoData), options);
|
14337 | }
|
14338 | function geocodePoint(latitude, longitude, entities, options) {
|
14339 | return geocodeCore(new GeocodePointQuery(latitude, longitude, entities), options);
|
14340 | }
|
14341 | function dequeue(decrement) {
|
14342 | for (void 0 === decrement && (decrement = 0), activeRequests -= decrement; activeRequests < Settings.MaxBingRequest && 0 !== geocodeQueue.length; ) activeRequests++,
|
14343 | makeRequest(geocodeQueue.shift());
|
14344 | }
|
14345 | function makeRequest(item) {
|
14346 | if (!item.isResolved) {
|
14347 | var result = geocodingCache ? geocodingCache.getCoordinates(item.query.key) : void 0;
|
14348 | result && (item.deferred.resolve(result), item.isResolved = !0);
|
14349 | }
|
14350 | if (item.isResolved) return void setTimeout(function() {
|
14351 | return dequeue(1);
|
14352 | });
|
14353 | var config = {
|
14354 | type: "GET",
|
14355 | dataType: "jsonp",
|
14356 | jsonp: "jsonp"
|
14357 | }, url = item.query.getUrl();
|
14358 | url || completeRequest(item, new Error("Unsupported query. " + item.query.query)),
|
14359 | services.BingAjaxCall(url, config).then(function(data) {
|
14360 | try {
|
14361 | if (item.query instanceof GeocodeBoundaryQuery) {
|
14362 | var result = data;
|
14363 | if (result && result.d && Array.isArray(result.d.results) && result.d.results.length > 0) {
|
14364 | var entity = result.d.results[0], primitives = entity.Primitives;
|
14365 | if (primitives && primitives.length > 0) {
|
14366 | var coordinates = {
|
14367 | latitude: item.query.latitude,
|
14368 | longitude: item.query.longitude,
|
14369 | locations: []
|
14370 | };
|
14371 | primitives.sort(function(a, b) {
|
14372 | return a.Shape.length < b.Shape.length ? 1 : a.Shape.length > b.Shape.length ? -1 : 0;
|
14373 | });
|
14374 | for (var maxGeoData = Math.min(primitives.length, item.query.maxGeoData), i = 0; maxGeoData > i; i++) for (var ringStr = primitives[i].Shape, ringArray = ringStr.split(","), j = 1; j < ringArray.length; j++) coordinates.locations.push({
|
14375 | nativeBing: ringArray[j]
|
14376 | });
|
14377 | completeRequest(item, null, coordinates);
|
14378 | } else completeRequest(item, new Error("Geocode result is empty."));
|
14379 | } else completeRequest(item, new Error("Geocode result is empty."));
|
14380 | } else if (item.query instanceof GeocodePointQuery) {
|
14381 | var resources = data.resourceSets[0].resources;
|
14382 | if (Array.isArray(resources) && resources.length > 0) {
|
14383 | var index = getBestResultIndex(resources, item.query), pointData = resources[index].point.coordinates, addressData = resources[index].address, name_1 = resources[index].name, coordinates = {
|
14384 | latitude: parseFloat(pointData[0]),
|
14385 | longitude: parseFloat(pointData[1]),
|
14386 | addressLine: addressData.addressLine,
|
14387 | locality: addressData.locality,
|
14388 | neighborhood: addressData.neighborhood,
|
14389 | adminDistrict: addressData.adminDistrict,
|
14390 | adminDistrict2: addressData.adminDistrict2,
|
14391 | formattedAddress: addressData.formattedAddress,
|
14392 | postalCode: addressData.postalCode,
|
14393 | countryRegionIso2: addressData.countryRegionIso2,
|
14394 | countryRegion: addressData.countryRegion,
|
14395 | landmark: addressData.landmark,
|
14396 | name: name_1
|
14397 | };
|
14398 | completeRequest(item, null, coordinates);
|
14399 | } else completeRequest(item, null, null);
|
14400 | } else {
|
14401 | var resources = data.resourceSets[0].resources;
|
14402 | if (Array.isArray(resources) && resources.length > 0) {
|
14403 | var index = getBestResultIndex(resources, item.query), pointData = resources[index].point.coordinates, coordinates = {
|
14404 | latitude: parseFloat(pointData[0]),
|
14405 | longitude: parseFloat(pointData[1])
|
14406 | };
|
14407 | completeRequest(item, null, coordinates);
|
14408 | } else completeRequest(item, new Error("Geocode result is empty."));
|
14409 | }
|
14410 | } catch (error) {
|
14411 | completeRequest(item, error);
|
14412 | }
|
14413 | }, function(error) {
|
14414 | completeRequest(item, error);
|
14415 | });
|
14416 | }
|
14417 | function completeRequest(item, error, coordinate) {
|
14418 | void 0 === coordinate && (coordinate = null), item.isResolved || (error ? item.deferred.reject(error) : (!geocodingCache || item.query instanceof GeocodePointQuery || geocodingCache.registerCoordinates(item.query.key, coordinate),
|
14419 | item.deferred.resolve(coordinate)), item.isResolved = !0), dequeueTimeoutId = setTimeout(function() {
|
14420 | return dequeue(1);
|
14421 | }, Settings.UseDoubleArrayGeodataResult ? Settings.UseDoubleArrayDequeueTimeout : 0);
|
14422 | }
|
14423 | function getBestResultIndex(resources, query) {
|
14424 | var queryString = query.query.toLowerCase();
|
14425 | if (2 === queryString.length && query.category === CategoryTypes.CountryRegion) for (var index = 0; index < resources.length; index++) {
|
14426 | var iso2 = resources[index].address && resources[index].address.countryRegionIso2;
|
14427 | if (iso2 && queryString === iso2.toLowerCase()) return index;
|
14428 | }
|
14429 | for (var targetEntity = query.getBingEntity().toLowerCase(), index = 0; index < resources.length; index++) {
|
14430 | var resultEntity = (resources[index].entityType || "").toLowerCase();
|
14431 | if (resultEntity === targetEntity) return index;
|
14432 | }
|
14433 | return 0;
|
14434 | }
|
14435 | function resetStaticGeocoderState(cache) {
|
14436 | void 0 !== cache && (geocodingCache = cache), geocodeQueue = [], activeRequests = 0,
|
14437 | categoryToBingEntity = null, clearTimeout(dequeueTimeoutId);
|
14438 | }
|
14439 | var CategoryTypes = visuals.MapUtil.CategoryTypes, Settings = visuals.MapUtil.Settings;
|
14440 | services.createGeocoder = createGeocoder, services.safeCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-",
|
14441 | services.BingAjaxCall = $.ajax, services.CategoryTypeArray = [ "Address", "City", "Continent", "Country", "County", "Longitude", "Latitude", "Place", "PostalCode", "StateOrProvince" ],
|
14442 | services.isCategoryType = isCategoryType, services.BingEntities = {
|
14443 | Continent: "Continent",
|
14444 | Sovereign: "Sovereign",
|
14445 | CountryRegion: "CountryRegion",
|
14446 | AdminDivision1: "AdminDivision1",
|
14447 | AdminDivision2: "AdminDivision2",
|
14448 | PopulatedPlace: "PopulatedPlace",
|
14449 | Postcode: "Postcode",
|
14450 | Postcode1: "Postcode1",
|
14451 | Neighborhood: "Neighborhood",
|
14452 | Address: "Address"
|
14453 | };
|
14454 | var geocodeQueue, activeRequests, categoryToBingEntity, categoryToBingEntityGeodata, geocodingCache, GeocodeQuery = function() {
|
14455 | function GeocodeQuery(query, category) {
|
14456 | this.query = null != query ? query : "", this.category = null != category ? category : "",
|
14457 | this.key = (this.query + "/" + this.category).toLowerCase(), geocodingCache || (geocodingCache = services.createGeocodingCache(Settings.MaxCacheSize, Settings.MaxCacheSizeOverflow));
|
14458 | }
|
14459 | return GeocodeQuery.prototype.getBingEntity = function() {
|
14460 | var category = this.category.toLowerCase();
|
14461 | return categoryToBingEntity || (categoryToBingEntity = {}, categoryToBingEntity[CategoryTypes.Continent.toLowerCase()] = services.BingEntities.Continent,
|
14462 | categoryToBingEntity[CategoryTypes.CountryRegion.toLowerCase()] = services.BingEntities.Sovereign,
|
14463 | categoryToBingEntity[CategoryTypes.StateOrProvince.toLowerCase()] = services.BingEntities.AdminDivision1,
|
14464 | categoryToBingEntity[CategoryTypes.County.toLowerCase()] = services.BingEntities.AdminDivision2,
|
14465 | categoryToBingEntity[CategoryTypes.City.toLowerCase()] = services.BingEntities.PopulatedPlace,
|
14466 | categoryToBingEntity[CategoryTypes.PostalCode.toLowerCase()] = services.BingEntities.Postcode,
|
14467 | categoryToBingEntity[CategoryTypes.Address.toLowerCase()] = services.BingEntities.Address),
|
14468 | categoryToBingEntity[category] || "";
|
14469 | }, GeocodeQuery.prototype.getUrl = function() {
|
14470 | var url = Settings.BingUrl + "?key=" + Settings.BingKey, entityType = this.getBingEntity(), queryAdded = !1;
|
14471 | if (entityType) if (entityType === services.BingEntities.Postcode) url += "&includeEntityTypes=Postcode,Postcode1,Postcode2,Postcode3,Postcode4"; else if (-1 !== this.query.indexOf(",") || entityType !== services.BingEntities.AdminDivision1 && entityType !== services.BingEntities.AdminDivision2) url += "&includeEntityTypes=" + entityType; else {
|
14472 | queryAdded = !0;
|
14473 | try {
|
14474 | url += "&adminDistrict=" + decodeURIComponent(this.query);
|
14475 | } catch (e) {
|
14476 | return null;
|
14477 | }
|
14478 | }
|
14479 | if (!queryAdded) try {
|
14480 | url += "&q=" + decodeURIComponent(this.query);
|
14481 | } catch (e) {
|
14482 | return null;
|
14483 | }
|
14484 | var cultureName = navigator.userLanguage || navigator.language;
|
14485 | return cultureName = mapLocalesForBing(cultureName), cultureName && (url += "&c=" + cultureName),
|
14486 | url += "&maxRes=20", 2 === this.query.length && this.category === CategoryTypes.CountryRegion && (url += "&include=ciso2"),
|
14487 | url;
|
14488 | }, GeocodeQuery;
|
14489 | }();
|
14490 | services.GeocodeQuery = GeocodeQuery;
|
14491 | var GeocodePointQuery = function(_super) {
|
14492 | function GeocodePointQuery(latitude, longitude, entities) {
|
14493 | _super.call(this, [ latitude, longitude ].join(), "Point"), this.latitude = latitude,
|
14494 | this.longitude = longitude, this.entities = entities;
|
14495 | }
|
14496 | return __extends(GeocodePointQuery, _super), GeocodePointQuery.prototype.getUrl = function() {
|
14497 | var url = Settings.BingUrl + "/" + [ this.latitude, this.longitude ].join() + "?key=" + Settings.BingKey + (_.isEmpty(this.entities) ? "" : "&includeEntityTypes=" + this.entities.join()) + "&include=ciso2";
|
14498 | return url;
|
14499 | }, GeocodePointQuery;
|
14500 | }(GeocodeQuery);
|
14501 | services.GeocodePointQuery = GeocodePointQuery;
|
14502 | var GeocodeBoundaryQuery = function(_super) {
|
14503 | function GeocodeBoundaryQuery(latitude, longitude, category, levelOfDetail, maxGeoData) {
|
14504 | void 0 === maxGeoData && (maxGeoData = 3), _super.call(this, [ latitude, longitude, levelOfDetail, maxGeoData ].join(","), category),
|
14505 | this.latitude = latitude, this.longitude = longitude, this.levelOfDetail = levelOfDetail,
|
14506 | this.maxGeoData = maxGeoData;
|
14507 | }
|
14508 | return __extends(GeocodeBoundaryQuery, _super), GeocodeBoundaryQuery.prototype.getBingEntity = function() {
|
14509 | var category = this.category.toLowerCase();
|
14510 | return categoryToBingEntityGeodata || (categoryToBingEntityGeodata = {}, categoryToBingEntityGeodata[CategoryTypes.CountryRegion.toLowerCase()] = services.BingEntities.CountryRegion,
|
14511 | categoryToBingEntityGeodata[CategoryTypes.StateOrProvince.toLowerCase()] = services.BingEntities.AdminDivision1,
|
14512 | categoryToBingEntityGeodata[CategoryTypes.County.toLowerCase()] = services.BingEntities.AdminDivision2,
|
14513 | categoryToBingEntityGeodata[CategoryTypes.City.toLowerCase()] = services.BingEntities.PopulatedPlace,
|
14514 | categoryToBingEntityGeodata[CategoryTypes.PostalCode.toLowerCase()] = services.BingEntities.Postcode1),
|
14515 | categoryToBingEntityGeodata[category] || "";
|
14516 | }, GeocodeBoundaryQuery.prototype.getUrl = function() {
|
14517 | var url = Settings.BingUrlGeodata + "key=" + Settings.BingKey + "&$format=json", entityType = this.getBingEntity();
|
14518 | if (!entityType) return null;
|
14519 | var cultureName = navigator.userLanguage || navigator.language;
|
14520 | cultureName = mapLocalesForBing(cultureName);
|
14521 | var cultures = cultureName.split("-"), data = [ this.latitude, this.longitude, this.levelOfDetail, "'" + entityType + "'", 1, 0, "'" + cultureName + "'" ];
|
14522 | return cultures.length > 1 && data.push("'" + cultures[1] + "'"), url + "&SpatialFilter=GetBoundary(" + data.join(", ") + ")";
|
14523 | }, GeocodeBoundaryQuery;
|
14524 | }(GeocodeQuery);
|
14525 | services.GeocodeBoundaryQuery = GeocodeBoundaryQuery, services.geocodeCore = geocodeCore,
|
14526 | services.geocode = geocode, services.geocodeBoundary = geocodeBoundary, services.geocodePoint = geocodePoint;
|
14527 | var dequeueTimeoutId;
|
14528 | services.resetStaticGeocoderState = resetStaticGeocoderState, resetStaticGeocoderState();
|
14529 | }(services = visuals.services || (visuals.services = {}));
|
14530 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
14531 | }(powerbi || (powerbi = {}));
|
14532 | }, function(module, exports) {
|
14533 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
14534 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
14535 | !function(powerbi) {
|
14536 | var visuals;
|
14537 | !function(visuals) {
|
14538 | var services;
|
14539 | !function(services) {
|
14540 | function createGeocodingCache(maxCacheSize, maxCacheSizeOverflow, localStorageService) {
|
14541 | return localStorageService || (localStorageService = powerbi.localStorageService),
|
14542 | new GeocodingCache(maxCacheSize, maxCacheSizeOverflow, localStorageService);
|
14543 | }
|
14544 | services.createGeocodingCache = createGeocodingCache;
|
14545 | var GeocodingCache = function() {
|
14546 | function GeocodingCache(maxCacheSize, maxCacheSizeOverflow, localStorageService) {
|
14547 | this.geocodeCache = {}, this.geocodeCacheCount = 0, this.maxCacheSize = maxCacheSize,
|
14548 | this.maxCacheSizeOverflow = maxCacheSizeOverflow, this.localStorageService = localStorageService;
|
14549 | }
|
14550 | return GeocodingCache.prototype.getCoordinates = function(key) {
|
14551 | var pair = this.geocodeCache[key];
|
14552 | return pair ? (++pair.hitCount, pair.coordinate) : (pair = this.localStorageService.getData(key),
|
14553 | pair ? (this.registerInMemory(key, pair.coordinate), pair.coordinate) : void 0);
|
14554 | }, GeocodingCache.prototype.registerCoordinates = function(key, coordinate) {
|
14555 | this.registerInMemory(key, coordinate), this.registerInStorage(key, coordinate);
|
14556 | }, GeocodingCache.prototype.registerInMemory = function(key, coordinate) {
|
14557 | var geocodeCache = this.geocodeCache, maxCacheSize = this.maxCacheSize, maxCacheCount = maxCacheSize + this.maxCacheSizeOverflow;
|
14558 | if (this.geocodeCacheCount >= maxCacheCount) {
|
14559 | var keys = Object.keys(geocodeCache), cacheSize = keys.length;
|
14560 | if (keys.sort(function(a, b) {
|
14561 | var cachedA = geocodeCache[a], cachedB = geocodeCache[b], ca = cachedA ? cachedA.hitCount : 0, cb = cachedB ? cachedB.hitCount : 0;
|
14562 | return cb > ca ? 1 : ca > cb ? -1 : 0;
|
14563 | }), 2 * maxCacheCount > cacheSize) for (var i = maxCacheSize; cacheSize > i; i++) geocodeCache[keys[i]] = void 0; else {
|
14564 | for (var newGeocodeCache = {}, i = 0; maxCacheSize > i; ++i) newGeocodeCache[keys[i]] = geocodeCache[keys[i]];
|
14565 | geocodeCache = this.geocodeCache = newGeocodeCache;
|
14566 | }
|
14567 | this.geocodeCacheCount = maxCacheSize;
|
14568 | }
|
14569 | geocodeCache[key] = {
|
14570 | coordinate: coordinate,
|
14571 | hitCount: 1
|
14572 | }, ++this.geocodeCacheCount;
|
14573 | }, GeocodingCache.prototype.registerInStorage = function(key, coordinate) {
|
14574 | this.localStorageService.setData(key, {
|
14575 | coordinate: coordinate
|
14576 | });
|
14577 | }, GeocodingCache;
|
14578 | }();
|
14579 | }(services = visuals.services || (visuals.services = {}));
|
14580 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
14581 | }(powerbi || (powerbi = {}));
|
14582 | }, function(module, exports) {
|
14583 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
14584 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
14585 | !function(powerbi) {
|
14586 | var visuals;
|
14587 | !function(visuals) {
|
14588 | var services;
|
14589 | !function(services) {
|
14590 | function createGeolocation() {
|
14591 | return new GeolocationService();
|
14592 | }
|
14593 | services.createGeolocation = createGeolocation;
|
14594 | var GeolocationService = function() {
|
14595 | function GeolocationService() {
|
14596 | this.webGeolocation = navigator.geolocation;
|
14597 | }
|
14598 | return GeolocationService.prototype.watchPosition = function(successCallback, errorCallback) {
|
14599 | return this.webGeolocation.watchPosition(function(position) {
|
14600 | successCallback(position);
|
14601 | }, function(error) {
|
14602 | null != errorCallback && errorCallback(error);
|
14603 | });
|
14604 | }, GeolocationService.prototype.clearWatch = function(watchId) {
|
14605 | this.webGeolocation.clearWatch(watchId);
|
14606 | }, GeolocationService.prototype.getCurrentPosition = function(successCallback, errorCallback) {
|
14607 | this.webGeolocation.getCurrentPosition(function(position) {
|
14608 | successCallback(position);
|
14609 | }, function(error) {
|
14610 | null != errorCallback && errorCallback(error);
|
14611 | });
|
14612 | }, GeolocationService;
|
14613 | }();
|
14614 | }(services = visuals.services || (visuals.services = {}));
|
14615 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
14616 | }(powerbi || (powerbi = {}));
|
14617 | }, function(module, exports) {
|
14618 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
14619 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
14620 | function __() {
|
14621 | this.constructor = d;
|
14622 | }
|
14623 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
14624 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14625 | });
|
14626 | !function(powerbi) {
|
14627 | var visuals;
|
14628 | !function(visuals) {
|
14629 | var controls;
|
14630 | !function(controls) {
|
14631 | function fire(eventHandlers, eventArgs) {
|
14632 | if (eventHandlers) for (var i = 0; i < eventHandlers.length; i++) {
|
14633 | var h = eventHandlers[i];
|
14634 | h(eventArgs);
|
14635 | }
|
14636 | }
|
14637 | var UNSELECTABLE_CLASS_NAME = "unselectable";
|
14638 | controls.fire = fire;
|
14639 | var ScrollbarButton = function() {
|
14640 | function ScrollbarButton(owner, direction) {
|
14641 | this._owner = owner, this._direction = direction, this._timerHandle = void 0, this.createView();
|
14642 | var that = this;
|
14643 | this._element.addEventListener("mousedown", function(e) {
|
14644 | that.onMouseDown(e);
|
14645 | }), $(this._element).addClass(UNSELECTABLE_CLASS_NAME), $(this._svg).addClass(UNSELECTABLE_CLASS_NAME),
|
14646 | $(this._polygon).addClass(UNSELECTABLE_CLASS_NAME);
|
14647 | }
|
14648 | return Object.defineProperty(ScrollbarButton.prototype, "element", {
|
14649 | get: function() {
|
14650 | return this._element;
|
14651 | },
|
14652 | enumerable: !0,
|
14653 | configurable: !0
|
14654 | }), ScrollbarButton.prototype.createView = function() {
|
14655 | var svgns = "http://www.w3.org/2000/svg";
|
14656 | this._polygon = document.createElementNS(svgns, "polygon"), this._polygon.setAttributeNS(null, "points", "3,3 6,3 13,8 6,13 3,13 10,8"),
|
14657 | this._polygon.setAttributeNS(null, "fill", ScrollbarButton.ARROW_COLOR), this._svg = document.createElementNS(svgns, "svg");
|
14658 | var svgStyle = this._svg.style;
|
14659 | svgStyle.position = "absolute", svgStyle.left = "0px", svgStyle.top = "0px", this._svg.appendChild(this._polygon),
|
14660 | this._element = document.createElement("div"), this._element.className = Scrollbar.arrowClassName,
|
14661 | this._element.appendChild(this._svg), this._owner.element.appendChild(this._element);
|
14662 | }, ScrollbarButton.prototype.onMouseDown = function(event) {
|
14663 | var that = this;
|
14664 | if (clearTimeout(this._timerHandle), !this._mouseUpWrapper) {
|
14665 | event.cancelBubble = !0;
|
14666 | var that_1 = this;
|
14667 | this._mouseUpWrapper = function(event) {
|
14668 | that_1.onMouseUp(event);
|
14669 | }, Scrollbar.addDocumentMouseUpEvent(this._mouseUpWrapper);
|
14670 | }
|
14671 | this._owner._scrollSmallIncrement(this._direction), this._owner.refresh(), this._timerHandle = setTimeout(function() {
|
14672 | that.onMouseDown(event);
|
14673 | }, 100), event.preventDefault && event.preventDefault();
|
14674 | }, ScrollbarButton.prototype.onMouseUp = function(event) {
|
14675 | clearTimeout(this._timerHandle), Scrollbar.removeDocumentMouseUpEvent(this._mouseUpWrapper),
|
14676 | this._mouseUpWrapper = void 0;
|
14677 | }, ScrollbarButton.prototype.arrange = function(width, height, angle) {
|
14678 | var size = Math.min(width, height), scale = size / 16, x = (width - size) / 2, y = (height - size) / 2;
|
14679 | this._polygon.setAttributeNS(null, "transform", "translate(" + x + ", " + y + ") scale(" + scale + ") rotate(" + angle + ",8,8)"),
|
14680 | this._svg.setAttributeNS(null, "width", width + "px"), this._svg.setAttributeNS(null, "height", height + "px"),
|
14681 | controls.HTMLElementUtils.setElementWidth(this._element, width), controls.HTMLElementUtils.setElementHeight(this._element, height);
|
14682 | }, ScrollbarButton.MIN_WIDTH = 26, ScrollbarButton.ARROW_COLOR = "#404040", ScrollbarButton;
|
14683 | }();
|
14684 | controls.ScrollbarButton = ScrollbarButton;
|
14685 | var Scrollbar = function() {
|
14686 | function Scrollbar(parentElement, layoutKind) {
|
14687 | this.MIN_BAR_SIZE = 10, this.min = 0, this.max = 10, this.viewMin = 0, this.viewSize = 2,
|
14688 | this.smallIncrement = 1, this._onscroll = [], this._screenToOffsetScale = 1, this.createView(parentElement, layoutKind);
|
14689 | var that = this;
|
14690 | this._element.addEventListener("mousedown", function(e) {
|
14691 | that.onBackgroundMouseDown(e);
|
14692 | }), this._middleBar.addEventListener("mousedown", function(e) {
|
14693 | that.onMiddleBarMouseDown(e);
|
14694 | }), this._timerHandle = void 0, this._visible = !0, this.element.winControl = this,
|
14695 | $(this._touchPanel).addClass(UNSELECTABLE_CLASS_NAME);
|
14696 | }
|
14697 | return Scrollbar.prototype.scrollBy = function(delta) {
|
14698 | this.scrollTo(this.viewMin + delta);
|
14699 | }, Scrollbar.prototype.scrollUp = function() {
|
14700 | this.scrollBy(-this.smallIncrement);
|
14701 | }, Scrollbar.prototype.scrollDown = function() {
|
14702 | this.scrollBy(this.smallIncrement);
|
14703 | }, Scrollbar.prototype.scrollPageUp = function() {
|
14704 | this.scrollBy(-this.viewSize);
|
14705 | }, Scrollbar.prototype.scrollPageDown = function() {
|
14706 | this.scrollBy(this.viewSize);
|
14707 | }, Object.defineProperty(Scrollbar.prototype, "width", {
|
14708 | get: function() {
|
14709 | return this._width;
|
14710 | },
|
14711 | set: function(value) {
|
14712 | this._width = value, this._element.style.width = value, this.invalidateArrange();
|
14713 | },
|
14714 | enumerable: !0,
|
14715 | configurable: !0
|
14716 | }), Object.defineProperty(Scrollbar.prototype, "height", {
|
14717 | get: function() {
|
14718 | return this._height;
|
14719 | },
|
14720 | set: function(value) {
|
14721 | this._height = value, this._element.style.height = value, this.invalidateArrange();
|
14722 | },
|
14723 | enumerable: !0,
|
14724 | configurable: !0
|
14725 | }), Scrollbar.prototype.refresh = function() {}, Object.defineProperty(Scrollbar.prototype, "element", {
|
14726 | get: function() {
|
14727 | return this._element;
|
14728 | },
|
14729 | enumerable: !0,
|
14730 | configurable: !0
|
14731 | }), Object.defineProperty(Scrollbar.prototype, "maxButton", {
|
14732 | get: function() {
|
14733 | return this._maxButton;
|
14734 | },
|
14735 | enumerable: !0,
|
14736 | configurable: !0
|
14737 | }), Object.defineProperty(Scrollbar.prototype, "middleBar", {
|
14738 | get: function() {
|
14739 | return this._middleBar;
|
14740 | },
|
14741 | enumerable: !0,
|
14742 | configurable: !0
|
14743 | }), Scrollbar.prototype._scrollSmallIncrement = function(direction) {
|
14744 | this.scrollBy(this.smallIncrement * direction);
|
14745 | }, Object.defineProperty(Scrollbar.prototype, "visible", {
|
14746 | get: function() {
|
14747 | return this._visible;
|
14748 | },
|
14749 | enumerable: !0,
|
14750 | configurable: !0
|
14751 | }), Object.defineProperty(Scrollbar.prototype, "isInMouseCapture", {
|
14752 | get: function() {
|
14753 | return void 0 !== this._timerHandle;
|
14754 | },
|
14755 | enumerable: !0,
|
14756 | configurable: !0
|
14757 | }), Scrollbar.prototype.show = function(value) {
|
14758 | this._visible = value, this.element.style.visibility = value ? "visible" : "hidden",
|
14759 | this.invalidateArrange();
|
14760 | }, Scrollbar.prototype._getMouseOffset = function(event) {
|
14761 | return void 0 !== event.offsetX ? {
|
14762 | x: event.offsetX,
|
14763 | y: event.offsetY
|
14764 | } : void 0 !== event.layerX ? {
|
14765 | x: event.layerX,
|
14766 | y: event.layerY
|
14767 | } : {
|
14768 | x: event.screenX,
|
14769 | y: event.screenY
|
14770 | };
|
14771 | }, Scrollbar.prototype._getOffsetXDelta = function(event) {
|
14772 | return (event.screenX - this._screenPrevMousePos.x) / this._screenToOffsetScale;
|
14773 | }, Scrollbar.prototype._getOffsetYDelta = function(event) {
|
14774 | return (event.screenY - this._screenPrevMousePos.y) / this._screenToOffsetScale;
|
14775 | }, Scrollbar.prototype._getOffsetXTouchDelta = function(event) {
|
14776 | return this._getMouseOffset(event).x - this._offsetTouchPrevPos.x;
|
14777 | }, Scrollbar.prototype._getOffsetYTouchDelta = function(event) {
|
14778 | return this._getMouseOffset(event).y - this._offsetTouchPrevPos.y;
|
14779 | }, Scrollbar.prototype.initTouch = function(panel, allowMouseDrag) {
|
14780 | var _this = this;
|
14781 | this._touchPanel = panel, this._allowMouseDrag = void 0 === allowMouseDrag ? !0 : allowMouseDrag,
|
14782 | "ontouchmove" in panel ? (panel.addEventListener("touchstart", function(e) {
|
14783 | return _this.onTouchStart(e);
|
14784 | }), panel.addEventListener("touchmove", function(e) {
|
14785 | return _this.onTouchMove(e);
|
14786 | }), panel.addEventListener("touchend", function(e) {
|
14787 | return _this.onTouchEnd(e);
|
14788 | })) : (panel.addEventListener("mousedown", function(e) {
|
14789 | return _this.onTouchMouseDown(e);
|
14790 | }), panel.addEventListener("mousemove", function(e) {
|
14791 | return _this.onTouchMouseMove(e);
|
14792 | }), panel.addEventListener("mouseup", function(e) {
|
14793 | return _this.onTouchMouseUp(e);
|
14794 | }));
|
14795 | }, Scrollbar.prototype.onTouchStart = function(e) {
|
14796 | 1 === e.touches.length && this.onTouchMouseDown(e.touches[0]);
|
14797 | }, Scrollbar.prototype.onTouchMove = function(e) {
|
14798 | 1 === e.touches.length && (e.preventDefault && e.preventDefault(), this.onTouchMouseMove(e.touches[0]));
|
14799 | }, Scrollbar.prototype.onTouchEnd = function(e) {
|
14800 | this.onTouchMouseUp(1 === e.touches.length ? e.touches[0] : e, !0);
|
14801 | }, Scrollbar.prototype.onTouchMouseDown = function(e) {
|
14802 | (this._allowMouseDrag || e.pointerType !== MSPointerEvent.MSPOINTER_TYPE_MOUSE) && ("setCapture" in this._touchPanel && this._touchPanel.setCapture(!0),
|
14803 | this._offsetTouchPrevPos = this._offsetTouchStartPos = null, this._touchStarted = !0);
|
14804 | }, Scrollbar.prototype._getOffsetTouchDelta = function(e) {
|
14805 | return null;
|
14806 | }, Scrollbar.prototype.onTouchMouseMove = function(e) {
|
14807 | if (this._touchStarted) {
|
14808 | this._offsetTouchStartPos || (this._offsetTouchPrevPos = this._offsetTouchStartPos = this._getMouseOffset(e));
|
14809 | var delta = this._getOffsetTouchDelta(e);
|
14810 | 0 !== delta && (this.scrollBy(-delta / this._getRunningSize(!1) * this.viewSize),
|
14811 | this._offsetTouchPrevPos = this._getMouseOffset(e)), e.preventDefault && e.preventDefault(),
|
14812 | e.cancelBubble = !0;
|
14813 | }
|
14814 | }, Scrollbar.prototype.onTouchMouseUp = function(e, bubble) {
|
14815 | if (this._touchStarted && this._offsetTouchStartPos) {
|
14816 | var end = this._getMouseOffset(e);
|
14817 | !bubble && (Math.abs(this._offsetTouchStartPos.x - end.x) > 3 || Math.abs(this._offsetTouchStartPos.y - end.y) > 3) && (e.preventDefault && e.preventDefault(),
|
14818 | e.cancelBubble = !0);
|
14819 | }
|
14820 | "releaseCapture" in this._touchPanel && this._touchPanel.releaseCapture(), this._touchStarted = !1;
|
14821 | }, Scrollbar.prototype.createView = function(parentElement, layoutKind) {
|
14822 | this._element = document.createElement("div"), this._element.className = Scrollbar.className,
|
14823 | this._element.setAttribute("drag-resize-disabled", "true"), 0 === layoutKind && parentElement.appendChild(this._element),
|
14824 | this._minButton = new ScrollbarButton(this, -1), this._maxButton = new ScrollbarButton(this, 1),
|
14825 | this._middleBar = document.createElement("div"), this._middleBar.className = Scrollbar.barClassName,
|
14826 | this._element.appendChild(this._middleBar);
|
14827 | }, Scrollbar.prototype.scrollTo = function(pos) {
|
14828 | var viewMin = Math.min(this.max - this.viewSize, Math.max(this.min, pos));
|
14829 | viewMin !== this.viewMin && (this.viewMin = viewMin, fire(this._onscroll, null));
|
14830 | }, Scrollbar.prototype._scrollByPage = function(event) {}, Scrollbar.prototype._getRunningSize = function(net) {
|
14831 | return null;
|
14832 | }, Scrollbar.prototype._getOffsetDelta = function(event) {
|
14833 | return null;
|
14834 | }, Scrollbar.prototype.scroll = function(event) {
|
14835 | var delta = this._getOffsetDelta(event) / this._getRunningSize(!0) * (this.max - this.min);
|
14836 | if (0 > delta) {
|
14837 | if (this._getScreenMousePos(event) >= this._screenMaxMousePos) return;
|
14838 | } else if (delta > 0 && this._getScreenMousePos(event) <= this._screenMinMousePos) return;
|
14839 | this.scrollBy(delta);
|
14840 | }, Object.defineProperty(Scrollbar.prototype, "actualWidth", {
|
14841 | get: function() {
|
14842 | return void 0 === this._actualWidth && this.arrange(), this._actualWidth;
|
14843 | },
|
14844 | enumerable: !0,
|
14845 | configurable: !0
|
14846 | }), Object.defineProperty(Scrollbar.prototype, "actualHeight", {
|
14847 | get: function() {
|
14848 | return void 0 === !this._actualHeight && this.arrange(), this._actualHeight;
|
14849 | },
|
14850 | enumerable: !0,
|
14851 | configurable: !0
|
14852 | }), Object.defineProperty(Scrollbar.prototype, "actualButtonWidth", {
|
14853 | get: function() {
|
14854 | return void 0 === !this._actualButtonWidth && this.arrange(), this._actualButtonWidth;
|
14855 | },
|
14856 | enumerable: !0,
|
14857 | configurable: !0
|
14858 | }), Object.defineProperty(Scrollbar.prototype, "actualButtonHeight", {
|
14859 | get: function() {
|
14860 | return void 0 === !this._actualButtonHeight && this.arrange(), this._actualButtonHeight;
|
14861 | },
|
14862 | enumerable: !0,
|
14863 | configurable: !0
|
14864 | }), Scrollbar.prototype.arrange = function() {
|
14865 | this._actualWidth || (this._actualWidth = this._element.offsetWidth, this._actualHeight = this._element.offsetHeight,
|
14866 | this._actualButtonWidth = this._calculateButtonWidth(), this._actualButtonHeight = this._calculateButtonHeight(),
|
14867 | this._minButton.arrange(this._actualButtonWidth, this._actualButtonHeight, this._getMinButtonAngle()),
|
14868 | this._maxButton.arrange(this._actualButtonWidth, this._actualButtonHeight, this._getMaxButtonAngle()),
|
14869 | this._setMaxButtonPosition());
|
14870 | }, Scrollbar.prototype._calculateButtonWidth = function() {
|
14871 | return null;
|
14872 | }, Scrollbar.prototype._calculateButtonHeight = function() {
|
14873 | return null;
|
14874 | }, Scrollbar.prototype._getMinButtonAngle = function() {
|
14875 | return null;
|
14876 | }, Scrollbar.prototype._getMaxButtonAngle = function() {
|
14877 | return null;
|
14878 | }, Scrollbar.prototype._setMaxButtonPosition = function() {}, Scrollbar.prototype.invalidateArrange = function() {
|
14879 | this._actualWidth = void 0, this._actualHeight = void 0, this._actualButtonWidth = void 0,
|
14880 | this._actualButtonHeight = void 0;
|
14881 | }, Scrollbar.prototype.onHoldBackgroundMouseDown = function(event) {
|
14882 | var _this = this, holdDelay = this._timerHandle ? Scrollbar.ScrollbarBackgroundMousedownHoldDelay : Scrollbar.ScrollbarBackgroundFirstTimeMousedownHoldDelay;
|
14883 | this._timerHandle = setTimeout(function() {
|
14884 | _this.onBackgroundMouseDown(event);
|
14885 | }, holdDelay);
|
14886 | }, Scrollbar.prototype.onBackgroundMouseDown = function(event) {
|
14887 | var that = this;
|
14888 | clearTimeout(this._timerHandle), this._backgroundMouseUpWrapper || (event.cancelBubble = !0,
|
14889 | this._backgroundMouseUpWrapper = function(event) {
|
14890 | that.onBackgroundMouseUp(event);
|
14891 | }, Scrollbar.addDocumentMouseUpEvent(this._backgroundMouseUpWrapper)), this._scrollByPage(event),
|
14892 | this.refresh(), this.onHoldBackgroundMouseDown(event), event.preventDefault && event.preventDefault();
|
14893 | }, Scrollbar.prototype.onBackgroundMouseUp = function(event) {
|
14894 | clearTimeout(this._timerHandle), this._timerHandle = void 0, Scrollbar.removeDocumentMouseUpEvent(this._backgroundMouseUpWrapper),
|
14895 | this._backgroundMouseUpWrapper = void 0;
|
14896 | }, Scrollbar.prototype.getPinchZoomY = function() {
|
14897 | return document.documentElement.clientHeight / window.innerHeight;
|
14898 | }, Scrollbar.prototype.onMiddleBarMouseDown = function(event) {
|
14899 | event.cancelBubble = !0, this._screenPrevMousePos = {
|
14900 | x: event.screenX,
|
14901 | y: event.screenY
|
14902 | }, this._screenMinMousePos = this._getScreenMousePos(event) - (this._getScreenContextualLeft(this._middleBar) - this._getScreenContextualRight(this._minButton.element)),
|
14903 | this._screenMaxMousePos = this._getScreenMousePos(event) + (this._getScreenContextualLeft(this._maxButton.element) - this._getScreenContextualRight(this._middleBar)),
|
14904 | this._screenToOffsetScale = controls.HTMLElementUtils.getAccumulatedScale(this.element) * this.getPinchZoomY();
|
14905 | var that = this;
|
14906 | this._middleBarMouseMoveWrapper = function(e) {
|
14907 | that.onMiddleBarMouseMove(e);
|
14908 | }, Scrollbar.addDocumentMouseMoveEvent(this._middleBarMouseMoveWrapper), this._middleBarMouseUpWrapper = function(e) {
|
14909 | that.onMiddleBarMouseUp(e);
|
14910 | }, Scrollbar.addDocumentMouseUpEvent(this._middleBarMouseUpWrapper), event.preventDefault && event.preventDefault();
|
14911 | }, Scrollbar.prototype.onMiddleBarMouseMove = function(event) {
|
14912 | this._screenPrevMousePos && (this.scroll(event), this.refresh(), this._screenPrevMousePos = {
|
14913 | x: event.screenX,
|
14914 | y: event.screenY
|
14915 | });
|
14916 | }, Scrollbar.prototype.onMiddleBarMouseUp = function(event) {
|
14917 | this._screenPrevMousePos = void 0, Scrollbar.removeDocumentMouseMoveEvent(this._middleBarMouseMoveWrapper),
|
14918 | this._middleBarMouseMoveWrapper = void 0, Scrollbar.removeDocumentMouseUpEvent(this._middleBarMouseUpWrapper),
|
14919 | this._middleBarMouseUpWrapper = void 0, event.preventDefault && event.preventDefault();
|
14920 | }, Scrollbar.prototype._getScreenContextualLeft = function(element) {
|
14921 | return null;
|
14922 | }, Scrollbar.prototype._getScreenContextualRight = function(element) {
|
14923 | return null;
|
14924 | }, Scrollbar.prototype.onMouseWheel = function(delta) {
|
14925 | delta && this.mouseWheel(delta);
|
14926 | }, Scrollbar.prototype.mouseWheel = function(delta) {
|
14927 | this.visible && (0 > delta ? delta = Math.min(-Scrollbar.MouseWheelRange, delta) : delta > 0 && (delta = Math.max(Scrollbar.MouseWheelRange, delta)),
|
14928 | this.scrollBy(-delta / Scrollbar.MouseWheelRange * this.smallIncrement));
|
14929 | }, Scrollbar.prototype._getScreenMousePos = function(event) {
|
14930 | return null;
|
14931 | }, Scrollbar.addDocumentMouseUpEvent = function(func) {
|
14932 | document.addEventListener("mouseup", func);
|
14933 | }, Scrollbar.removeDocumentMouseUpEvent = function(func) {
|
14934 | document.removeEventListener("mouseup", func);
|
14935 | }, Scrollbar.addDocumentMouseMoveEvent = function(func) {
|
14936 | document.addEventListener("mousemove", func);
|
14937 | }, Scrollbar.removeDocumentMouseMoveEvent = function(func) {
|
14938 | document.removeEventListener("mousemove", func);
|
14939 | }, Scrollbar.DefaultScrollbarWidth = "15px", Scrollbar.ScrollbarBackgroundFirstTimeMousedownHoldDelay = 500,
|
14940 | Scrollbar.ScrollbarBackgroundMousedownHoldDelay = 50, Scrollbar.MouseWheelRange = 120,
|
14941 | Scrollbar.className = "scroll-bar-div", Scrollbar.barClassName = "scroll-bar-part-bar",
|
14942 | Scrollbar.arrowClassName = "scroll-bar-part-arrow", Scrollbar;
|
14943 | }();
|
14944 | controls.Scrollbar = Scrollbar;
|
14945 | var HorizontalScrollbar = function(_super) {
|
14946 | function HorizontalScrollbar(parentElement, layoutKind) {
|
14947 | _super.call(this, parentElement, layoutKind), this.height = Scrollbar.DefaultScrollbarWidth;
|
14948 | }
|
14949 | return __extends(HorizontalScrollbar, _super), HorizontalScrollbar.prototype._calculateButtonWidth = function() {
|
14950 | return Math.min(this.actualWidth / 2, Math.max(this.actualHeight, ScrollbarButton.MIN_WIDTH));
|
14951 | }, HorizontalScrollbar.prototype._calculateButtonHeight = function() {
|
14952 | return this.actualHeight;
|
14953 | }, HorizontalScrollbar.prototype._getMinButtonAngle = function() {
|
14954 | return -180;
|
14955 | }, HorizontalScrollbar.prototype._getMaxButtonAngle = function() {
|
14956 | return 0;
|
14957 | }, HorizontalScrollbar.prototype._setMaxButtonPosition = function() {
|
14958 | controls.HTMLElementUtils.setElementLeft(this.maxButton.element, this.actualWidth - this.actualButtonWidth);
|
14959 | }, HorizontalScrollbar.prototype.refresh = function() {
|
14960 | this.arrange();
|
14961 | var runningSize = this.actualWidth - 2 * this.actualButtonWidth - 2, barSize = this.viewSize / (this.max - this.min) * runningSize;
|
14962 | barSize < this.MIN_BAR_SIZE && (runningSize -= this.MIN_BAR_SIZE - barSize, barSize = this.MIN_BAR_SIZE),
|
14963 | 0 > runningSize && (runningSize = 0, barSize = 0), barSize = Math.min(barSize, runningSize);
|
14964 | var barPos = this.viewMin / (this.max - this.min) * runningSize;
|
14965 | controls.HTMLElementUtils.setElementWidth(this.middleBar, barSize), controls.HTMLElementUtils.setElementHeight(this.middleBar, this.actualHeight),
|
14966 | controls.HTMLElementUtils.setElementLeft(this.middleBar, this.actualButtonWidth + 1 + barPos);
|
14967 | }, HorizontalScrollbar.prototype.show = function(visible) {
|
14968 | visible !== this.visible && (_super.prototype.show.call(this, visible), visible ? this.element.style.height = this.height : controls.HTMLElementUtils.setElementHeight(this.element, 0));
|
14969 | }, HorizontalScrollbar.prototype._scrollByPage = function(event) {
|
14970 | var left = this.middleBar.offsetLeft, right = left + this.middleBar.offsetWidth, x = void 0 === event.offsetX ? event.layerX : event.offsetX;
|
14971 | x > right ? this.scrollPageDown() : left > x && this.scrollPageUp();
|
14972 | }, HorizontalScrollbar.prototype._getRunningSize = function(net) {
|
14973 | var result = this.actualWidth;
|
14974 | if (net) {
|
14975 | var barMinPos = this.actualButtonWidth + 1;
|
14976 | result -= 2 * barMinPos;
|
14977 | var barSize = result * (this.viewSize / (this.max - this.min));
|
14978 | barSize < this.MIN_BAR_SIZE && (result -= this.MIN_BAR_SIZE - barSize);
|
14979 | }
|
14980 | return result;
|
14981 | }, HorizontalScrollbar.prototype._getOffsetDelta = function(event) {
|
14982 | return this._getOffsetXDelta(event);
|
14983 | }, HorizontalScrollbar.prototype._getOffsetTouchDelta = function(e) {
|
14984 | return this._getOffsetXTouchDelta(e);
|
14985 | }, HorizontalScrollbar.prototype._getScreenContextualLeft = function(element) {
|
14986 | return element.getBoundingClientRect().left;
|
14987 | }, HorizontalScrollbar.prototype._getScreenContextualRight = function(element) {
|
14988 | return element.getBoundingClientRect().right;
|
14989 | }, HorizontalScrollbar.prototype._getScreenMousePos = function(event) {
|
14990 | return event.screenX;
|
14991 | }, HorizontalScrollbar;
|
14992 | }(Scrollbar);
|
14993 | controls.HorizontalScrollbar = HorizontalScrollbar;
|
14994 | var VerticalScrollbar = function(_super) {
|
14995 | function VerticalScrollbar(parentElement, layoutKind) {
|
14996 | _super.call(this, parentElement, layoutKind), this.width = Scrollbar.DefaultScrollbarWidth;
|
14997 | }
|
14998 | return __extends(VerticalScrollbar, _super), VerticalScrollbar.prototype._calculateButtonWidth = function() {
|
14999 | return this.actualWidth;
|
15000 | }, VerticalScrollbar.prototype._calculateButtonHeight = function() {
|
15001 | return Math.min(this.actualHeight / 2, Math.max(this.actualWidth, ScrollbarButton.MIN_WIDTH));
|
15002 | }, VerticalScrollbar.prototype._getMinButtonAngle = function() {
|
15003 | return -90;
|
15004 | }, VerticalScrollbar.prototype._getMaxButtonAngle = function() {
|
15005 | return 90;
|
15006 | }, VerticalScrollbar.prototype._setMaxButtonPosition = function() {
|
15007 | controls.HTMLElementUtils.setElementTop(this.maxButton.element, this.actualHeight - this.actualButtonHeight);
|
15008 | }, VerticalScrollbar.prototype.refresh = function() {
|
15009 | this.arrange();
|
15010 | var runningSize = this.actualHeight - 2 * this.actualButtonHeight - 2, barSize = this.viewSize / (this.max - this.min) * runningSize;
|
15011 | barSize < this.MIN_BAR_SIZE && (runningSize -= this.MIN_BAR_SIZE - barSize, barSize = this.MIN_BAR_SIZE),
|
15012 | 0 > runningSize && (runningSize = 0, barSize = 0);
|
15013 | var barPos = this.viewMin / (this.max - this.min) * runningSize;
|
15014 | controls.HTMLElementUtils.setElementWidth(this.middleBar, this.actualWidth), controls.HTMLElementUtils.setElementHeight(this.middleBar, barSize),
|
15015 | controls.HTMLElementUtils.setElementTop(this.middleBar, this.actualButtonHeight + 1 + barPos);
|
15016 | }, VerticalScrollbar.prototype.show = function(visible) {
|
15017 | visible !== this.visible && (_super.prototype.show.call(this, visible), visible ? this.element.style.width = this.width : controls.HTMLElementUtils.setElementWidth(this.element, 0));
|
15018 | }, VerticalScrollbar.prototype._scrollByPage = function(event) {
|
15019 | var top = this.middleBar.offsetTop, bottom = top + this.middleBar.offsetHeight, y = void 0 === event.offsetY ? event.layerY : event.offsetY;
|
15020 | y > bottom ? this.scrollPageDown() : top > y && this.scrollPageUp();
|
15021 | }, VerticalScrollbar.prototype._getRunningSize = function(net) {
|
15022 | var result = this.actualHeight;
|
15023 | if (net) {
|
15024 | var barMinPos = this.actualButtonHeight + 1;
|
15025 | result -= 2 * barMinPos;
|
15026 | var barSize = result * (this.viewSize / (this.max - this.min));
|
15027 | barSize < this.MIN_BAR_SIZE && (result -= this.MIN_BAR_SIZE - barSize);
|
15028 | }
|
15029 | return result;
|
15030 | }, VerticalScrollbar.prototype._getOffsetDelta = function(event) {
|
15031 | return this._getOffsetYDelta(event);
|
15032 | }, VerticalScrollbar.prototype._getOffsetTouchDelta = function(e) {
|
15033 | return this._getOffsetYTouchDelta(e);
|
15034 | }, VerticalScrollbar.prototype._getScreenContextualLeft = function(element) {
|
15035 | return element.getBoundingClientRect().top;
|
15036 | }, VerticalScrollbar.prototype._getScreenContextualRight = function(element) {
|
15037 | return element.getBoundingClientRect().bottom;
|
15038 | }, VerticalScrollbar.prototype._getScreenMousePos = function(event) {
|
15039 | return event.screenY;
|
15040 | }, VerticalScrollbar;
|
15041 | }(Scrollbar);
|
15042 | controls.VerticalScrollbar = VerticalScrollbar;
|
15043 | }(controls = visuals.controls || (visuals.controls = {}));
|
15044 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
15045 | }(powerbi || (powerbi = {}));
|
15046 | }, function(module, exports) {
|
15047 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
15048 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
15049 | function __() {
|
15050 | this.constructor = d;
|
15051 | }
|
15052 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
15053 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15054 | });
|
15055 | !function(powerbi) {
|
15056 | var visuals;
|
15057 | !function(visuals) {
|
15058 | var controls;
|
15059 | !function(controls) {
|
15060 | var internal;
|
15061 | !function(internal) {
|
15062 | var UNSELECTABLE_CLASS_NAME = "unselectable", TablixResizer = function() {
|
15063 | function TablixResizer(element, handler) {
|
15064 | this._element = element, this._handler = handler, this._elementMouseDownWrapper = null,
|
15065 | this._elementMouseMoveWrapper = null, this._elementMouseOutWrapper = null, this._documentMouseMoveWrapper = null,
|
15066 | this._documentMouseUpWrapper = null, this._startMousePosition = null, this._originalCursor = null;
|
15067 | }
|
15068 | return TablixResizer.addDocumentMouseUpEvent = function(listener) {
|
15069 | document.addEventListener("mouseup", listener);
|
15070 | }, TablixResizer.removeDocumentMouseUpEvent = function(listener) {
|
15071 | document.removeEventListener("mouseup", listener);
|
15072 | }, TablixResizer.addDocumentMouseMoveEvent = function(listener) {
|
15073 | document.addEventListener("mousemove", listener);
|
15074 | }, TablixResizer.removeDocumentMouseMoveEvent = function(listener) {
|
15075 | document.removeEventListener("mousemove", listener);
|
15076 | }, TablixResizer.getMouseCoordinates = function(event) {
|
15077 | return {
|
15078 | x: event.pageX,
|
15079 | y: event.pageY
|
15080 | };
|
15081 | }, TablixResizer.getMouseCoordinateDelta = function(previous, current) {
|
15082 | return {
|
15083 | x: current.x - previous.x,
|
15084 | y: current.y - previous.y
|
15085 | };
|
15086 | }, TablixResizer.prototype.initialize = function() {
|
15087 | var _this = this;
|
15088 | this._elementMouseDownWrapper = function(e) {
|
15089 | return _this.onElementMouseDown(e);
|
15090 | }, this._element.addEventListener("mousedown", this._elementMouseDownWrapper), this._elementMouseMoveWrapper = function(e) {
|
15091 | return _this.onElementMouseMove(e);
|
15092 | }, this._element.addEventListener("mousemove", this._elementMouseMoveWrapper), this._elementMouseOutWrapper = function(e) {
|
15093 | return _this.onElementMouseOut(e);
|
15094 | }, this._element.addEventListener("mouseout", this._elementMouseOutWrapper), this._elementMouseDoubleClickOutWrapper = function(e) {
|
15095 | return _this.onElementMouseDoubleClick(e);
|
15096 | }, this._element.addEventListener("dblclick", this._elementMouseDoubleClickOutWrapper);
|
15097 | }, TablixResizer.prototype.uninitialize = function() {
|
15098 | this._element.removeEventListener("mousedown", this._elementMouseDownWrapper), this._elementMouseDownWrapper = null,
|
15099 | this._element.removeEventListener("mousemove", this._elementMouseMoveWrapper), this._elementMouseMoveWrapper = null,
|
15100 | this._element.removeEventListener("mouseout", this._elementMouseOutWrapper), this._elementMouseOutWrapper = null,
|
15101 | this._element.removeEventListener("dblclick", this._elementMouseDoubleClickOutWrapper),
|
15102 | this._elementMouseDoubleClickOutWrapper = null;
|
15103 | }, Object.defineProperty(TablixResizer.prototype, "cell", {
|
15104 | get: function() {
|
15105 | return null;
|
15106 | },
|
15107 | enumerable: !0,
|
15108 | configurable: !0
|
15109 | }), Object.defineProperty(TablixResizer.prototype, "element", {
|
15110 | get: function() {
|
15111 | return this._element;
|
15112 | },
|
15113 | enumerable: !0,
|
15114 | configurable: !0
|
15115 | }), TablixResizer.prototype._hotSpot = function(position) {
|
15116 | return !1;
|
15117 | }, TablixResizer.prototype.onElementMouseDown = function(event) {
|
15118 | var _this = this, position = TablixResizer.getMouseCoordinates(event);
|
15119 | this._hotSpot(position) && ("setCapture" in this._element && this._element.setCapture(),
|
15120 | event.cancelBubble = !0, this._startMousePosition = position, this._documentMouseMoveWrapper = function(e) {
|
15121 | return _this.onDocumentMouseMove(e);
|
15122 | }, TablixResizer.addDocumentMouseMoveEvent(this._documentMouseMoveWrapper), this._documentMouseUpWrapper = function(e) {
|
15123 | return _this.onDocumentMouseUp(e);
|
15124 | }, TablixResizer.addDocumentMouseUpEvent(this._documentMouseUpWrapper), document.documentElement && (this._originalCursor = document.documentElement.style.cursor,
|
15125 | document.documentElement.style.cursor = TablixResizer.resizeCursor), this._handler.onStartResize(this.cell, this._startMousePosition.x, this._startMousePosition.y));
|
15126 | }, TablixResizer.prototype.onElementMouseMove = function(event) {
|
15127 | this._startMousePosition || (this._hotSpot(TablixResizer.getMouseCoordinates(event)) ? null === this._originalCursor && (this._originalCursor = this._element.style.cursor,
|
15128 | this._element.style.cursor = TablixResizer.resizeCursor) : null !== this._originalCursor && (this._element.style.cursor = this._originalCursor,
|
15129 | this._originalCursor = null));
|
15130 | }, TablixResizer.prototype.onElementMouseOut = function(event) {
|
15131 | this._startMousePosition || null !== this._originalCursor && (this._element.style.cursor = this._originalCursor,
|
15132 | this._originalCursor = null);
|
15133 | }, TablixResizer.prototype.onElementMouseDoubleClick = function(event) {
|
15134 | this._hotSpot(TablixResizer.getMouseCoordinates(event)) && this._handler.onReset(this.cell);
|
15135 | }, TablixResizer.prototype.onDocumentMouseMove = function(event) {
|
15136 | if (this._startMousePosition) {
|
15137 | var delta = TablixResizer.getMouseCoordinateDelta(this._startMousePosition, TablixResizer.getMouseCoordinates(event));
|
15138 | this._handler.onResize(this.cell, delta.x, delta.y), event.preventDefault();
|
15139 | }
|
15140 | }, TablixResizer.prototype.onDocumentMouseUp = function(event) {
|
15141 | this._startMousePosition = null, "releaseCapture" in this._element && this._element.releaseCapture(),
|
15142 | TablixResizer.removeDocumentMouseMoveEvent(this._documentMouseMoveWrapper), this._documentMouseMoveWrapper = null,
|
15143 | TablixResizer.removeDocumentMouseUpEvent(this._documentMouseUpWrapper), this._documentMouseUpWrapper = null,
|
15144 | document.documentElement && (document.documentElement.style.cursor = this._originalCursor),
|
15145 | event.preventDefault && event.preventDefault(), this._handler.onEndResize(this.cell);
|
15146 | }, TablixResizer.resizeHandleSize = 4, TablixResizer.resizeCursor = "e-resize",
|
15147 | TablixResizer;
|
15148 | }();
|
15149 | internal.TablixResizer = TablixResizer;
|
15150 | var TablixDomResizer = function(_super) {
|
15151 | function TablixDomResizer(cell, element, handler) {
|
15152 | _super.call(this, element, handler), this._cell = cell;
|
15153 | }
|
15154 | return __extends(TablixDomResizer, _super), Object.defineProperty(TablixDomResizer.prototype, "cell", {
|
15155 | get: function() {
|
15156 | return this._cell;
|
15157 | },
|
15158 | enumerable: !0,
|
15159 | configurable: !0
|
15160 | }), TablixDomResizer.prototype._hotSpot = function(position) {
|
15161 | return position.x >= this.element.getBoundingClientRect().right - TablixResizer.resizeHandleSize;
|
15162 | }, TablixDomResizer;
|
15163 | }(TablixResizer);
|
15164 | internal.TablixDomResizer = TablixDomResizer;
|
15165 | var TablixCellPresenter = function() {
|
15166 | function TablixCellPresenter(fitProportionally, layoutKind) {
|
15167 | this._tableCell = null, this._contentElement = internal.TablixUtils.createDiv(),
|
15168 | this._contentHost = internal.TablixUtils.createDiv(), this.layoutKind = layoutKind,
|
15169 | this._contentElement.appendChild(this._contentHost), this._resizer = null;
|
15170 | }
|
15171 | return TablixCellPresenter.prototype.initialize = function(owner) {
|
15172 | this._owner = owner;
|
15173 | }, Object.defineProperty(TablixCellPresenter.prototype, "owner", {
|
15174 | get: function() {
|
15175 | return this._owner;
|
15176 | },
|
15177 | enumerable: !0,
|
15178 | configurable: !0
|
15179 | }), TablixCellPresenter.prototype.registerTableCell = function(tableCell) {
|
15180 | this._tableCell = tableCell, tableCell.appendChild(this._contentElement);
|
15181 | }, Object.defineProperty(TablixCellPresenter.prototype, "tableCell", {
|
15182 | get: function() {
|
15183 | return this._tableCell;
|
15184 | },
|
15185 | enumerable: !0,
|
15186 | configurable: !0
|
15187 | }), Object.defineProperty(TablixCellPresenter.prototype, "contentElement", {
|
15188 | get: function() {
|
15189 | return this._contentElement;
|
15190 | },
|
15191 | enumerable: !0,
|
15192 | configurable: !0
|
15193 | }), Object.defineProperty(TablixCellPresenter.prototype, "contentHost", {
|
15194 | get: function() {
|
15195 | return this._contentHost;
|
15196 | },
|
15197 | enumerable: !0,
|
15198 | configurable: !0
|
15199 | }), TablixCellPresenter.prototype.registerClickHandler = function(handler) {
|
15200 | this._contentElement.onclick = handler;
|
15201 | }, TablixCellPresenter.prototype.unregisterClickHandler = function() {
|
15202 | this._contentElement.onclick = null;
|
15203 | }, TablixCellPresenter.prototype.onContainerWidthChanged = function(value) {
|
15204 | controls.HTMLElementUtils.setElementWidth(this._contentElement, value);
|
15205 | }, TablixCellPresenter.prototype.onContinerHeightChanged = function(height) {
|
15206 | controls.HTMLElementUtils.setElementHeight(this._contentElement, height);
|
15207 | }, TablixCellPresenter.prototype.onColumnSpanChanged = function(value) {
|
15208 | this._tableCell.colSpan = value;
|
15209 | }, TablixCellPresenter.prototype.onRowSpanChanged = function(value) {
|
15210 | this._tableCell.rowSpan = value;
|
15211 | }, TablixCellPresenter.prototype.onTextAlignChanged = function(value) {
|
15212 | this._tableCell.style.textAlign = value;
|
15213 | }, TablixCellPresenter.prototype.onClear = function() {
|
15214 | this._contentHost.className = "", this._tableCell.className = "";
|
15215 | }, TablixCellPresenter.prototype.onHorizontalScroll = function(width, offset) {
|
15216 | controls.HTMLElementUtils.setElementLeft(this._contentHost, offset), controls.HTMLElementUtils.setElementWidth(this._contentHost, width);
|
15217 | }, TablixCellPresenter.prototype.onVerticalScroll = function(height, offset) {
|
15218 | controls.HTMLElementUtils.setElementTop(this._contentHost, offset), controls.HTMLElementUtils.setElementHeight(this._contentHost, height);
|
15219 | }, TablixCellPresenter.prototype.onInitializeScrolling = function() {
|
15220 | controls.HTMLElementUtils.setElementLeft(this._contentHost, 0), controls.HTMLElementUtils.setElementTop(this._contentHost, 0),
|
15221 | controls.HTMLElementUtils.setElementWidth(this._contentHost, -1), controls.HTMLElementUtils.setElementHeight(this._contentHost, -1);
|
15222 | }, TablixCellPresenter.prototype.enableHorizontalResize = function(enable, handler) {
|
15223 | enable !== (null !== this._resizer) && (enable ? (this._resizer = new TablixDomResizer(this._owner, this._tableCell, handler),
|
15224 | this._resizer.initialize()) : (this._resizer.uninitialize(), this._resizer = null));
|
15225 | }, TablixCellPresenter.prototype.disableDragResize = function() {
|
15226 | this._tableCell.setAttribute(TablixCellPresenter._dragResizeDisabledAttributeName, "true");
|
15227 | }, TablixCellPresenter._dragResizeDisabledAttributeName = "drag-resize-disabled",
|
15228 | TablixCellPresenter;
|
15229 | }();
|
15230 | internal.TablixCellPresenter = TablixCellPresenter;
|
15231 | var TablixRowPresenter = function() {
|
15232 | function TablixRowPresenter(fitProportionally) {
|
15233 | this._tableRow = null, this._fitProportionally = fitProportionally;
|
15234 | }
|
15235 | return TablixRowPresenter.prototype.initialize = function(row) {
|
15236 | this._row = row;
|
15237 | }, TablixRowPresenter.prototype.createCellPresenter = function(layoutKind) {
|
15238 | return new TablixCellPresenter(this._fitProportionally, layoutKind);
|
15239 | }, TablixRowPresenter.prototype.registerRow = function(tableRow) {
|
15240 | this._tableRow = tableRow;
|
15241 | }, TablixRowPresenter.prototype.onAppendCell = function(cell) {
|
15242 | var presenter = cell._presenter;
|
15243 | if (null === presenter.tableCell) {
|
15244 | var tableCell = this._tableRow.insertCell(-1);
|
15245 | presenter.registerTableCell(tableCell);
|
15246 | } else this._tableRow.appendChild(presenter.tableCell);
|
15247 | }, TablixRowPresenter.prototype.onInsertCellBefore = function(cell, refCell) {
|
15248 | var presenter = cell._presenter;
|
15249 | if (null === presenter.tableCell) {
|
15250 | var tableCell = this._tableRow.insertCell(Math.max(0, refCell._presenter.tableCell.cellIndex - 1));
|
15251 | presenter.registerTableCell(tableCell);
|
15252 | } else this._tableRow.insertBefore(cell._presenter.tableCell, refCell._presenter.tableCell);
|
15253 | }, TablixRowPresenter.prototype.onRemoveCell = function(cell) {
|
15254 | this._tableRow.removeChild(cell._presenter.tableCell);
|
15255 | }, TablixRowPresenter.prototype.getHeight = function() {
|
15256 | return this.getCellHeight(this._row.getTablixCell());
|
15257 | }, TablixRowPresenter.prototype.getCellHeight = function(cell) {
|
15258 | return -1;
|
15259 | }, TablixRowPresenter.prototype.getCellContentHeight = function(cell) {
|
15260 | return -1;
|
15261 | }, Object.defineProperty(TablixRowPresenter.prototype, "tableRow", {
|
15262 | get: function() {
|
15263 | return this._tableRow;
|
15264 | },
|
15265 | enumerable: !0,
|
15266 | configurable: !0
|
15267 | }), TablixRowPresenter;
|
15268 | }();
|
15269 | internal.TablixRowPresenter = TablixRowPresenter;
|
15270 | var DashboardRowPresenter = function(_super) {
|
15271 | function DashboardRowPresenter(gridPresenter, fitProportionally) {
|
15272 | _super.call(this, fitProportionally), this._gridPresenter = gridPresenter;
|
15273 | }
|
15274 | return __extends(DashboardRowPresenter, _super), DashboardRowPresenter.prototype.getCellHeight = function(cell) {
|
15275 | return cell.containerHeight;
|
15276 | }, DashboardRowPresenter.prototype.getCellContentHeight = function(cell) {
|
15277 | return cell.contentHeight;
|
15278 | }, DashboardRowPresenter;
|
15279 | }(TablixRowPresenter);
|
15280 | internal.DashboardRowPresenter = DashboardRowPresenter;
|
15281 | var CanvasRowPresenter = function(_super) {
|
15282 | function CanvasRowPresenter() {
|
15283 | _super.apply(this, arguments);
|
15284 | }
|
15285 | return __extends(CanvasRowPresenter, _super), CanvasRowPresenter.prototype.getCellHeight = function(cell) {
|
15286 | return cell.containerHeight;
|
15287 | }, CanvasRowPresenter.prototype.getCellContentHeight = function(cell) {
|
15288 | return cell.contentHeight;
|
15289 | }, CanvasRowPresenter;
|
15290 | }(TablixRowPresenter);
|
15291 | internal.CanvasRowPresenter = CanvasRowPresenter;
|
15292 | var TablixColumnPresenter = function() {
|
15293 | function TablixColumnPresenter() {}
|
15294 | return TablixColumnPresenter.prototype.initialize = function(column) {
|
15295 | this._column = column;
|
15296 | }, TablixColumnPresenter.prototype.getWidth = function() {
|
15297 | var width = this.getPersistedWidth();
|
15298 | return null == width && (width = this.getCellWidth(this._column.getTablixCell())),
|
15299 | width;
|
15300 | }, TablixColumnPresenter.prototype.getPersistedWidth = function() {
|
15301 | return -1;
|
15302 | }, TablixColumnPresenter.prototype.getCellWidth = function(cell) {
|
15303 | return -1;
|
15304 | }, TablixColumnPresenter;
|
15305 | }();
|
15306 | internal.TablixColumnPresenter = TablixColumnPresenter;
|
15307 | var DashboardColumnPresenter = function(_super) {
|
15308 | function DashboardColumnPresenter(gridPresenter) {
|
15309 | _super.call(this), this._gridPresenter = gridPresenter;
|
15310 | }
|
15311 | return __extends(DashboardColumnPresenter, _super), DashboardColumnPresenter.prototype.getPersistedWidth = function() {
|
15312 | return this._gridPresenter.sizeComputationManager.cellWidth;
|
15313 | }, DashboardColumnPresenter.prototype.getCellWidth = function(cell) {
|
15314 | return this._gridPresenter.sizeComputationManager.cellWidth;
|
15315 | }, DashboardColumnPresenter;
|
15316 | }(TablixColumnPresenter);
|
15317 | internal.DashboardColumnPresenter = DashboardColumnPresenter;
|
15318 | var CanvasColumnPresenter = function(_super) {
|
15319 | function CanvasColumnPresenter(gridPresenter, index) {
|
15320 | _super.call(this), this._gridPresenter = gridPresenter, this._columnIndex = index;
|
15321 | }
|
15322 | return __extends(CanvasColumnPresenter, _super), CanvasColumnPresenter.prototype.getPersistedWidth = function() {
|
15323 | return this._gridPresenter.getPersistedColumnWidth(this._column);
|
15324 | }, CanvasColumnPresenter.prototype.getCellWidth = function(cell) {
|
15325 | var tablixCell = cell;
|
15326 | return tablixCell._presenter ? cell.contentWidth : 0;
|
15327 | }, CanvasColumnPresenter;
|
15328 | }(TablixColumnPresenter);
|
15329 | internal.CanvasColumnPresenter = CanvasColumnPresenter;
|
15330 | var TablixGridPresenter = function() {
|
15331 | function TablixGridPresenter(columnWidthManager) {
|
15332 | this._table = internal.TablixUtils.createTable(), this._table.className = UNSELECTABLE_CLASS_NAME,
|
15333 | this._footerTable = internal.TablixUtils.createTable(), this._footerTable.className = UNSELECTABLE_CLASS_NAME,
|
15334 | this._columnWidthManager = columnWidthManager;
|
15335 | }
|
15336 | return TablixGridPresenter.prototype.initialize = function(owner, gridHost, footerHost, control) {
|
15337 | this._owner = owner, gridHost.appendChild(this._table), footerHost.appendChild(this._footerTable);
|
15338 | }, TablixGridPresenter.prototype.getWidth = function() {
|
15339 | return -1;
|
15340 | }, TablixGridPresenter.prototype.getHeight = function() {
|
15341 | return -1;
|
15342 | }, TablixGridPresenter.prototype.getScreenToCssRatioX = function() {
|
15343 | return 1;
|
15344 | }, TablixGridPresenter.prototype.getScreenToCssRatioY = function() {
|
15345 | return 1;
|
15346 | }, TablixGridPresenter.prototype.createRowPresenter = function() {
|
15347 | return null;
|
15348 | }, TablixGridPresenter.prototype.createColumnPresenter = function(index) {
|
15349 | return null;
|
15350 | }, TablixGridPresenter.prototype.onAppendRow = function(row) {
|
15351 | var presenter = row.presenter;
|
15352 | if (null === presenter.tableRow) {
|
15353 | var tableRow = this._table.insertRow(-1);
|
15354 | presenter.registerRow(tableRow);
|
15355 | } else this._table.tBodies[0].appendChild(row.presenter.tableRow);
|
15356 | }, TablixGridPresenter.prototype.onInsertRowBefore = function(row, refRow) {
|
15357 | var presenter = row.presenter;
|
15358 | if (null === presenter.tableRow) {
|
15359 | var tableRow = this._table.insertRow(Math.max(0, refRow.presenter.tableRow.rowIndex - 1));
|
15360 | presenter.registerRow(tableRow);
|
15361 | } else this._table.tBodies[0].insertBefore(row.presenter.tableRow, refRow.presenter.tableRow);
|
15362 | }, TablixGridPresenter.prototype.onRemoveRow = function(row) {
|
15363 | this._table.tBodies[0].removeChild(row.presenter.tableRow);
|
15364 | }, TablixGridPresenter.prototype.onAddFooterRow = function(row) {
|
15365 | var presenter = row.presenter;
|
15366 | if (null === presenter.tableRow) {
|
15367 | var tableRow = this._footerTable.insertRow(-1);
|
15368 | presenter.registerRow(tableRow);
|
15369 | } else this._footerTable.tBodies[0].appendChild(row.presenter.tableRow);
|
15370 | }, TablixGridPresenter.prototype.onClear = function() {
|
15371 | controls.HTMLElementUtils.clearChildren(this._table), controls.HTMLElementUtils.clearChildren(this._footerTable);
|
15372 | }, TablixGridPresenter.prototype.onFillColumnsProportionallyChanged = function(value) {
|
15373 | value ? (this._table.style.width = "100%", this._footerTable.style.width = "100%") : (this._table.style.width = "auto",
|
15374 | this._footerTable.style.width = "auto");
|
15375 | }, TablixGridPresenter.prototype.invokeColumnResizeEndCallback = function(column, width) {
|
15376 | this._columnWidthManager && this._columnWidthManager.onColumnWidthChanged(controls.TablixColumnWidthManager.getColumnQueryName(column), width);
|
15377 | }, TablixGridPresenter.prototype.getPersistedColumnWidth = function(column) {
|
15378 | return this._columnWidthManager ? this._columnWidthManager.getPersistedColumnWidth(controls.TablixColumnWidthManager.getColumnQueryName(column)) : void 0;
|
15379 | }, TablixGridPresenter;
|
15380 | }();
|
15381 | internal.TablixGridPresenter = TablixGridPresenter;
|
15382 | var DashboardTablixGridPresenter = function(_super) {
|
15383 | function DashboardTablixGridPresenter(sizeComputationManager) {
|
15384 | _super.call(this), this._sizeComputationManager = sizeComputationManager;
|
15385 | }
|
15386 | return __extends(DashboardTablixGridPresenter, _super), DashboardTablixGridPresenter.prototype.createRowPresenter = function() {
|
15387 | return new DashboardRowPresenter(this, this._owner.fillColumnsProportionally);
|
15388 | }, DashboardTablixGridPresenter.prototype.createColumnPresenter = function(index) {
|
15389 | return new DashboardColumnPresenter(this);
|
15390 | }, Object.defineProperty(DashboardTablixGridPresenter.prototype, "sizeComputationManager", {
|
15391 | get: function() {
|
15392 | return this._sizeComputationManager;
|
15393 | },
|
15394 | enumerable: !0,
|
15395 | configurable: !0
|
15396 | }), DashboardTablixGridPresenter.prototype.getWidth = function() {
|
15397 | return this._sizeComputationManager.gridWidth;
|
15398 | }, DashboardTablixGridPresenter.prototype.getHeight = function() {
|
15399 | return this._sizeComputationManager.gridHeight;
|
15400 | }, DashboardTablixGridPresenter;
|
15401 | }(TablixGridPresenter);
|
15402 | internal.DashboardTablixGridPresenter = DashboardTablixGridPresenter;
|
15403 | var CanvasTablixGridPresenter = function(_super) {
|
15404 | function CanvasTablixGridPresenter(columnWidthManager) {
|
15405 | _super.call(this, columnWidthManager);
|
15406 | }
|
15407 | return __extends(CanvasTablixGridPresenter, _super), CanvasTablixGridPresenter.prototype.createRowPresenter = function() {
|
15408 | return new CanvasRowPresenter(this._owner.fillColumnsProportionally);
|
15409 | }, CanvasTablixGridPresenter.prototype.createColumnPresenter = function(index) {
|
15410 | return new CanvasColumnPresenter(this, index);
|
15411 | }, CanvasTablixGridPresenter.prototype.getWidth = function() {
|
15412 | return controls.HTMLElementUtils.getElementWidth(this._table);
|
15413 | }, CanvasTablixGridPresenter.prototype.getHeight = function() {
|
15414 | return controls.HTMLElementUtils.getElementHeight(this._table);
|
15415 | }, CanvasTablixGridPresenter;
|
15416 | }(TablixGridPresenter);
|
15417 | internal.CanvasTablixGridPresenter = CanvasTablixGridPresenter;
|
15418 | }(internal = controls.internal || (controls.internal = {}));
|
15419 | }(controls = visuals.controls || (visuals.controls = {}));
|
15420 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
15421 | }(powerbi || (powerbi = {}));
|
15422 | }, function(module, exports) {
|
15423 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
15424 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
15425 | function __() {
|
15426 | this.constructor = d;
|
15427 | }
|
15428 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
15429 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15430 | });
|
15431 | !function(powerbi) {
|
15432 | var visuals;
|
15433 | !function(visuals) {
|
15434 | var controls;
|
15435 | !function(controls) {
|
15436 | var internal;
|
15437 | !function(internal) {
|
15438 | var TablixDimensionRealizationManager = function() {
|
15439 | function TablixDimensionRealizationManager(binder) {
|
15440 | this._binder = binder, this._adjustmentFactor = 1;
|
15441 | }
|
15442 | return TablixDimensionRealizationManager.prototype._getOwner = function() {
|
15443 | return null;
|
15444 | }, Object.defineProperty(TablixDimensionRealizationManager.prototype, "binder", {
|
15445 | get: function() {
|
15446 | return this._binder;
|
15447 | },
|
15448 | enumerable: !0,
|
15449 | configurable: !0
|
15450 | }), Object.defineProperty(TablixDimensionRealizationManager.prototype, "adjustmentFactor", {
|
15451 | get: function() {
|
15452 | return this._adjustmentFactor;
|
15453 | },
|
15454 | enumerable: !0,
|
15455 | configurable: !0
|
15456 | }), Object.defineProperty(TablixDimensionRealizationManager.prototype, "itemsToRealizeCount", {
|
15457 | get: function() {
|
15458 | return this._itemsToRealizeCount;
|
15459 | },
|
15460 | set: function(count) {
|
15461 | this._itemsToRealizeCount = count;
|
15462 | },
|
15463 | enumerable: !0,
|
15464 | configurable: !0
|
15465 | }), Object.defineProperty(TablixDimensionRealizationManager.prototype, "itemsEstimatedContextualWidth", {
|
15466 | get: function() {
|
15467 | return this._itemsEstimatedContextualWidth;
|
15468 | },
|
15469 | set: function(contextualWidth) {
|
15470 | this._itemsEstimatedContextualWidth = contextualWidth;
|
15471 | },
|
15472 | enumerable: !0,
|
15473 | configurable: !0
|
15474 | }), TablixDimensionRealizationManager.prototype.onStartRenderingIteration = function() {
|
15475 | var owner = this._getOwner();
|
15476 | owner.measureEnabled && !owner.done && this._getEstimatedItemsToRealizeCount(),
|
15477 | this._realizedLeavesCount = 0;
|
15478 | }, TablixDimensionRealizationManager.prototype.onEndRenderingIteration = function(gridContextualWidth, filled) {
|
15479 | filled || this._getOwner().allItemsRealized || (this._adjustmentFactor *= this._getSizeAdjustment(gridContextualWidth));
|
15480 | }, TablixDimensionRealizationManager.prototype.onEndRenderingSession = function() {
|
15481 | this._adjustmentFactor = 1;
|
15482 | }, TablixDimensionRealizationManager.prototype.onCornerCellRealized = function(item, cell) {},
|
15483 | TablixDimensionRealizationManager.prototype.onHeaderRealized = function(item, cell, leaf) {
|
15484 | leaf && this._realizedLeavesCount++;
|
15485 | }, Object.defineProperty(TablixDimensionRealizationManager.prototype, "needsToRealize", {
|
15486 | get: function() {
|
15487 | return this._realizedLeavesCount < this._itemsToRealizeCount;
|
15488 | },
|
15489 | enumerable: !0,
|
15490 | configurable: !0
|
15491 | }), TablixDimensionRealizationManager.prototype._getEstimatedItemsToRealizeCount = function() {},
|
15492 | TablixDimensionRealizationManager.prototype._getSizeAdjustment = function(gridContextualWidth) {
|
15493 | return 1;
|
15494 | }, TablixDimensionRealizationManager;
|
15495 | }();
|
15496 | internal.TablixDimensionRealizationManager = TablixDimensionRealizationManager;
|
15497 | var RowRealizationManager = function(_super) {
|
15498 | function RowRealizationManager() {
|
15499 | _super.apply(this, arguments);
|
15500 | }
|
15501 | return __extends(RowRealizationManager, _super), Object.defineProperty(RowRealizationManager.prototype, "owner", {
|
15502 | set: function(owner) {
|
15503 | this._owner = owner;
|
15504 | },
|
15505 | enumerable: !0,
|
15506 | configurable: !0
|
15507 | }), RowRealizationManager.prototype._getOwner = function() {
|
15508 | return this._owner;
|
15509 | }, RowRealizationManager.prototype._getEstimatedItemsToRealizeCount = function() {
|
15510 | this.estimateRowsToRealizeCount();
|
15511 | }, RowRealizationManager.prototype.estimateRowsToRealizeCount = function() {
|
15512 | return this._owner.dimension.model ? void (this._owner.alignToEnd ? this.itemsToRealizeCount = this._owner.dimension.getItemsCount() - this._owner.dimension.getIntegerScrollOffset() + 1 : this.itemsToRealizeCount = Math.ceil(this._owner.contextualWidthToFill / (this._owner.owner.getEstimatedRowHeight() * this.adjustmentFactor) + this._owner.dimension.getFractionScrollOffset()) - this._owner.otherLayoutManager.dimension.getDepth() + 1) : void (this.itemsToRealizeCount = 0);
|
15513 | }, RowRealizationManager.prototype.getEstimatedRowHierarchyWidth = function() {
|
15514 | if (!this._owner.dimension.model || 0 === this._owner.dimension.getItemsCount()) return 0;
|
15515 | var levels = new RowWidths();
|
15516 | this.updateRowHiearchyEstimatedWidth(this._owner.dimension.model, this._owner.dimension._hierarchyNavigator.getIndex(this._owner.dimension.getFirstVisibleItem(0)), levels);
|
15517 | for (var levelsArray = levels.items, levelCount = levelsArray.length, width = 0, i = 0; levelCount > i; i++) {
|
15518 | var level = levelsArray[i];
|
15519 | width += 0 !== level.maxNonLeafWidth ? level.maxNonLeafWidth : level.maxLeafWidth;
|
15520 | }
|
15521 | return width;
|
15522 | }, RowRealizationManager.prototype.updateRowHiearchyEstimatedWidth = function(items, firstVisibleIndex, levels) {
|
15523 | if (!(0 > firstVisibleIndex)) for (var hierarchyNavigator = this._owner.owner.owner.hierarchyNavigator, binder = this.binder, length = hierarchyNavigator.getCount(items), i = firstVisibleIndex; length > i; i++) {
|
15524 | if (levels.leafCount === this.itemsToRealizeCount) return;
|
15525 | var item = hierarchyNavigator.getAt(items, i), label = binder.getHeaderLabel(item), itemWidth = this._owner.getEstimatedHeaderWidth(label, firstVisibleIndex), isLeaf = hierarchyNavigator.isLeaf(item), l = hierarchyNavigator.getLevel(item), level = levels.items[l];
|
15526 | level || (level = new RowWidth(), levels.items[l] = level), isLeaf ? (level.maxLeafWidth = Math.max(level.maxLeafWidth, itemWidth),
|
15527 | levels.leafCount = levels.leafCount + 1) : (level.maxNonLeafWidth = Math.max(level.maxNonLeafWidth, itemWidth),
|
15528 | this.updateRowHiearchyEstimatedWidth(hierarchyNavigator.getChildren(item), this._owner.dimension.getFirstVisibleChildIndex(item), levels));
|
15529 | }
|
15530 | }, RowRealizationManager.prototype._getSizeAdjustment = function(gridContextualWidth) {
|
15531 | return gridContextualWidth / ((this._owner.getRealizedItemsCount() - this._owner.dimension.getFractionScrollOffset()) * this._owner.owner.getEstimatedRowHeight());
|
15532 | }, RowRealizationManager;
|
15533 | }(TablixDimensionRealizationManager);
|
15534 | internal.RowRealizationManager = RowRealizationManager;
|
15535 | var ColumnRealizationManager = function(_super) {
|
15536 | function ColumnRealizationManager() {
|
15537 | _super.apply(this, arguments);
|
15538 | }
|
15539 | return __extends(ColumnRealizationManager, _super), Object.defineProperty(ColumnRealizationManager.prototype, "owner", {
|
15540 | set: function(owner) {
|
15541 | this._owner = owner;
|
15542 | },
|
15543 | enumerable: !0,
|
15544 | configurable: !0
|
15545 | }), ColumnRealizationManager.prototype._getOwner = function() {
|
15546 | return this._owner;
|
15547 | }, ColumnRealizationManager.prototype._getEstimatedItemsToRealizeCount = function() {
|
15548 | this.estimateColumnsToRealizeCount(this.getEstimatedRowHierarchyWidth());
|
15549 | }, Object.defineProperty(ColumnRealizationManager.prototype, "rowRealizationManager", {
|
15550 | get: function() {
|
15551 | return this._owner.otherLayoutManager.realizationManager;
|
15552 | },
|
15553 | enumerable: !0,
|
15554 | configurable: !0
|
15555 | }), ColumnRealizationManager.prototype.getEstimatedRowHierarchyWidth = function() {
|
15556 | return this._owner.otherLayoutManager.done ? this._owner.getOtherHierarchyContextualHeight() : this.rowRealizationManager.getEstimatedRowHierarchyWidth() * this.adjustmentFactor;
|
15557 | }, ColumnRealizationManager.prototype.estimateColumnsToRealizeCount = function(rowHierarchyWidth) {
|
15558 | var widthToFill = this._owner.contextualWidthToFill - rowHierarchyWidth;
|
15559 | if (!this._owner.dimension.model || powerbi.Double.lessOrEqualWithPrecision(widthToFill, 0, internal.DimensionLayoutManager._pixelPrecision)) return void (this.itemsToRealizeCount = 0);
|
15560 | var binder = this.binder, hierarchyNavigator = this._owner.owner.owner.hierarchyNavigator, startColumnIndex = this._owner.dimension.getIntegerScrollOffset(), endColumnIndex = this._owner.dimension.getItemsCount(), columnCount = endColumnIndex - startColumnIndex, startRowIndex = this._owner.otherLayoutManager.dimension.getIntegerScrollOffset(), endRowIndex = this._owner.otherLayoutManager.dimension.getItemsCount();
|
15561 | if (this.itemsEstimatedContextualWidth = 0, this._owner.alignToEnd) return void (this.itemsToRealizeCount = columnCount);
|
15562 | for (var i = startColumnIndex; endColumnIndex > i; i++) {
|
15563 | if (powerbi.Double.greaterOrEqualWithPrecision(this.itemsEstimatedContextualWidth, widthToFill, internal.DimensionLayoutManager._pixelPrecision)) return void (this.itemsToRealizeCount = i - startColumnIndex);
|
15564 | var maxWidth = 0, visibleSizeRatio = void 0;
|
15565 | visibleSizeRatio = i === startColumnIndex ? this._owner.getVisibleSizeRatio() : 1;
|
15566 | var columnMember = hierarchyNavigator.getLeafAt(this._owner.dimension.model, i), label = binder.getHeaderLabel(columnMember);
|
15567 | maxWidth = Math.max(maxWidth, this._owner.getEstimatedHeaderWidth(label, i));
|
15568 | for (var j = startRowIndex; endRowIndex > j; j++) {
|
15569 | var intersection = hierarchyNavigator.getIntersection(hierarchyNavigator.getLeafAt(this._owner.otherLayoutManager.dimension.model, j), columnMember);
|
15570 | label = binder.getCellContent(intersection), maxWidth = Math.max(maxWidth, this._owner.getEstimatedBodyCellWidth(label));
|
15571 | }
|
15572 | this.itemsEstimatedContextualWidth += maxWidth * visibleSizeRatio * this.adjustmentFactor;
|
15573 | }
|
15574 | this.itemsToRealizeCount = columnCount;
|
15575 | }, ColumnRealizationManager.prototype._getSizeAdjustment = function(gridContextualWidth) {
|
15576 | return gridContextualWidth / (this.getEstimatedRowHierarchyWidth() + this.itemsEstimatedContextualWidth);
|
15577 | }, ColumnRealizationManager;
|
15578 | }(TablixDimensionRealizationManager);
|
15579 | internal.ColumnRealizationManager = ColumnRealizationManager;
|
15580 | var RowWidths = function() {
|
15581 | function RowWidths() {
|
15582 | this.items = [], this.leafCount = 0;
|
15583 | }
|
15584 | return RowWidths;
|
15585 | }();
|
15586 | internal.RowWidths = RowWidths;
|
15587 | var RowWidth = function() {
|
15588 | function RowWidth() {
|
15589 | this.maxLeafWidth = 0, this.maxNonLeafWidth = 0;
|
15590 | }
|
15591 | return RowWidth;
|
15592 | }();
|
15593 | internal.RowWidth = RowWidth;
|
15594 | }(internal = controls.internal || (controls.internal = {}));
|
15595 | }(controls = visuals.controls || (visuals.controls = {}));
|
15596 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
15597 | }(powerbi || (powerbi = {}));
|
15598 | }, function(module, exports) {
|
15599 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
15600 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
15601 | !function(powerbi) {
|
15602 | var visuals;
|
15603 | !function(visuals) {
|
15604 | var controls;
|
15605 | !function(controls) {
|
15606 | var internal;
|
15607 | !function(internal) {
|
15608 | var TablixCell = function() {
|
15609 | function TablixCell(presenter, extension, row) {
|
15610 | this._scrollable = !1, this._presenter = presenter, this.extension = extension,
|
15611 | this._presenter.initialize(this), this._row = row, this.item = null, this.type = null,
|
15612 | this._horizontalOffset = 0, this._verticalOffset = 0, this._colSpan = 1, this._rowSpan = 1,
|
15613 | this._containerWidth = -1, this._containerHeight = -1, this.contentHeight = this.contentWidth = 0,
|
15614 | this.position = new internal.TablixUtils.CellPosition();
|
15615 | }
|
15616 | return TablixCell.prototype.unfixRowHeight = function() {
|
15617 | this._row.unfixSize();
|
15618 | }, Object.defineProperty(TablixCell.prototype, "colSpan", {
|
15619 | get: function() {
|
15620 | return this._colSpan;
|
15621 | },
|
15622 | set: function(value) {
|
15623 | this._colSpan !== value && (this._presenter.onColumnSpanChanged(value), this._colSpan = value,
|
15624 | this._presenter.onContainerWidthChanged(-1));
|
15625 | },
|
15626 | enumerable: !0,
|
15627 | configurable: !0
|
15628 | }), Object.defineProperty(TablixCell.prototype, "rowSpan", {
|
15629 | get: function() {
|
15630 | return this._rowSpan;
|
15631 | },
|
15632 | set: function(value) {
|
15633 | this._rowSpan !== value && (this._presenter.onRowSpanChanged(value), this._rowSpan = value,
|
15634 | this._row.unfixSize());
|
15635 | },
|
15636 | enumerable: !0,
|
15637 | configurable: !0
|
15638 | }), TablixCell.prototype.getCellSpanningHeight = function() {
|
15639 | return this._row.getCellSpanningHeight(this);
|
15640 | }, Object.defineProperty(TablixCell.prototype, "textAlign", {
|
15641 | get: function() {
|
15642 | return this._textAlign;
|
15643 | },
|
15644 | set: function(value) {
|
15645 | value !== this._textAlign && (this._presenter.onTextAlignChanged(value), this._textAlign = value);
|
15646 | },
|
15647 | enumerable: !0,
|
15648 | configurable: !0
|
15649 | }), Object.defineProperty(TablixCell.prototype, "horizontalOffset", {
|
15650 | get: function() {
|
15651 | return this._horizontalOffset;
|
15652 | },
|
15653 | enumerable: !0,
|
15654 | configurable: !0
|
15655 | }), Object.defineProperty(TablixCell.prototype, "verticalOffset", {
|
15656 | get: function() {
|
15657 | return this._verticalOffset;
|
15658 | },
|
15659 | enumerable: !0,
|
15660 | configurable: !0
|
15661 | }), TablixCell.prototype.isScrollable = function() {
|
15662 | return this._scrollable;
|
15663 | }, TablixCell.prototype.clear = function() {
|
15664 | this.isScrollable() && this.initializeScrolling(), this._presenter.onClear(), this.setContainerWidth(-1),
|
15665 | this.setContainerHeight(-1), this.contentHeight = this.contentWidth = 0;
|
15666 | }, TablixCell.prototype.initializeScrolling = function() {
|
15667 | this._presenter.onInitializeScrolling(), this._horizontalOffset = 0, this._verticalOffset = 0,
|
15668 | 1 === this.colSpan && this.setContainerWidth(-1), 1 === this.rowSpan && this.setContainerHeight(-1);
|
15669 | }, TablixCell.prototype.prepare = function(scrollable) {
|
15670 | this.isScrollable() && this.initializeScrolling(), this._scrollable = scrollable;
|
15671 | }, TablixCell.prototype.scrollVertically = function(height, offset) {
|
15672 | var offsetInPixels = Math.ceil(-height * offset);
|
15673 | this._verticalOffset = offsetInPixels, this.isScrollable() ? (this._presenter.onVerticalScroll(height, offsetInPixels),
|
15674 | this.setContainerHeight(height + offsetInPixels)) : this.setContainerHeight(this._row.getCellSpanningHeight(this) + offsetInPixels);
|
15675 | }, TablixCell.prototype.scrollHorizontally = function(width, offset) {
|
15676 | this.isScrollable() && (this._presenter.onHorizontalScroll(width, offset), this.setContainerWidth(width + offset));
|
15677 | }, TablixCell.prototype.setContainerWidth = function(value) {
|
15678 | value !== this._containerWidth && (this._containerWidth = value, this._presenter.onContainerWidthChanged(value));
|
15679 | }, Object.defineProperty(TablixCell.prototype, "containerWidth", {
|
15680 | get: function() {
|
15681 | return this._containerWidth;
|
15682 | },
|
15683 | enumerable: !0,
|
15684 | configurable: !0
|
15685 | }), TablixCell.prototype.setContainerHeight = function(value) {
|
15686 | 0 > value && (value = -1), value !== this._containerHeight && (this._containerHeight = value,
|
15687 | this._presenter.onContinerHeightChanged(value));
|
15688 | }, Object.defineProperty(TablixCell.prototype, "containerHeight", {
|
15689 | get: function() {
|
15690 | return this._containerHeight;
|
15691 | },
|
15692 | enumerable: !0,
|
15693 | configurable: !0
|
15694 | }), TablixCell.prototype.applyStyle = function(style) {
|
15695 | style && (style.applyStyle(this), this.contentHeight += style.getExtraBottom() + style.getExtraTop(),
|
15696 | this.contentWidth += style.getExtraLeft() + style.getExtraRight());
|
15697 | }, TablixCell.prototype.enableHorizontalResize = function(enable, handler) {
|
15698 | this._presenter.enableHorizontalResize(enable, handler);
|
15699 | }, TablixCell;
|
15700 | }();
|
15701 | internal.TablixCell = TablixCell;
|
15702 | var TablixColumn = function() {
|
15703 | function TablixColumn(presenter, columnIndex) {
|
15704 | this._presenter = presenter, this._presenter.initialize(this), this._containerWidth = -1,
|
15705 | this._width = -1, this._sizeFixed = !1, this._aligningWidth = -1, this._fixedToAligningWidth = !1,
|
15706 | this._items = [], this._itemType = null, this._footerCell = null, this._columnIndex = columnIndex;
|
15707 | }
|
15708 | return TablixColumn.prototype.initialize = function(owner) {
|
15709 | this._owner = owner, this._realizedRowHeaders = [], this._realizedColumnHeaders = [],
|
15710 | this._realizedCornerCells = [], this._realizedBodyCells = [];
|
15711 | }, Object.defineProperty(TablixColumn.prototype, "owner", {
|
15712 | get: function() {
|
15713 | return this._owner;
|
15714 | },
|
15715 | enumerable: !0,
|
15716 | configurable: !0
|
15717 | }), TablixColumn.prototype.getType = function() {
|
15718 | return this._realizedCornerCells.length > 0 ? 0 : 2;
|
15719 | }, TablixColumn.prototype.getColumnHeadersOrCorners = function() {
|
15720 | return this._realizedCornerCells.length > 0 ? this._realizedCornerCells : this._realizedColumnHeaders;
|
15721 | }, TablixColumn.prototype.columnHeadersOrCornersEqual = function(newType, headers, hierarchyNavigator) {
|
15722 | if (this._items.length !== headers.length) return !1;
|
15723 | for (var count = this._items.length, i = 0; count > i; i++) if (!this.columnHeaderOrCornerEquals(this._itemType, this._items[i], newType, headers[i].item, hierarchyNavigator)) return !1;
|
15724 | return !0;
|
15725 | }, Object.defineProperty(TablixColumn.prototype, "itemType", {
|
15726 | get: function() {
|
15727 | return this._itemType;
|
15728 | },
|
15729 | enumerable: !0,
|
15730 | configurable: !0
|
15731 | }), TablixColumn.prototype.getLeafItem = function() {
|
15732 | return 0 === this._items.length ? null : this._items[this._items.length - 1];
|
15733 | }, TablixColumn.prototype.columnHeaderOrCornerEquals = function(type1, item1, type2, item2, hierarchyNavigator) {
|
15734 | if (type1 !== type2) return !1;
|
15735 | if (0 === type1) {
|
15736 | if (!hierarchyNavigator.cornerCellItemEquals(item1, item2)) return !1;
|
15737 | } else if (!hierarchyNavigator.headerItemEquals(item1, item2)) return !1;
|
15738 | return !0;
|
15739 | }, TablixColumn.prototype.OnLeafRealized = function(hierarchyNavigator) {
|
15740 | var type = this.getType(), columnHeadersOrCorners = this.getColumnHeadersOrCorners();
|
15741 | if (this.columnHeadersOrCornersEqual(type, columnHeadersOrCorners, hierarchyNavigator)) this.clearSpanningCellsWidth(this._realizedColumnHeaders); else {
|
15742 | var count = columnHeadersOrCorners.length;
|
15743 | this._items = [];
|
15744 | for (var i = 0; count > i; i++) this._items.push(columnHeadersOrCorners[i].item);
|
15745 | this._itemType = type, this.clearSize();
|
15746 | }
|
15747 | }, TablixColumn.prototype.clearSpanningCellsWidth = function(cells) {
|
15748 | for (var i = 0; i < cells.length; i++) {
|
15749 | var cell = cells[i];
|
15750 | cell.colSpan > 1 && cell.setContainerWidth(-1);
|
15751 | }
|
15752 | }, TablixColumn.prototype.addCornerCell = function(cell) {
|
15753 | cell._column = this, this._realizedCornerCells.push(cell), cell.setContainerWidth(this._containerWidth);
|
15754 | }, TablixColumn.prototype.addRowHeader = function(cell) {
|
15755 | cell._column = this, this._realizedRowHeaders.push(cell), cell.setContainerWidth(this._containerWidth);
|
15756 | }, TablixColumn.prototype.addColumnHeader = function(cell, isLeaf) {
|
15757 | cell._column = this, this._realizedColumnHeaders.push(cell), isLeaf && cell.setContainerWidth(this._containerWidth);
|
15758 | }, TablixColumn.prototype.addBodyCell = function(cell) {
|
15759 | cell._column = this, this._realizedBodyCells.push(cell), cell.setContainerWidth(this._containerWidth);
|
15760 | }, Object.defineProperty(TablixColumn.prototype, "footer", {
|
15761 | get: function() {
|
15762 | return this._footerCell;
|
15763 | },
|
15764 | set: function(footerCell) {
|
15765 | this._footerCell = footerCell, footerCell._column = this, footerCell.setContainerWidth(this._containerWidth);
|
15766 | },
|
15767 | enumerable: !0,
|
15768 | configurable: !0
|
15769 | }), TablixColumn.prototype.onResize = function(width) {
|
15770 | width !== this.getContentContextualWidth() && (this._containerWidth = width, this.setContainerWidth(this._containerWidth),
|
15771 | this._sizeFixed = !0, this._fixedToAligningWidth = !1, this._aligningWidth = -1);
|
15772 | }, TablixColumn.prototype.onResizeEnd = function(width) {
|
15773 | var gridPresenter = this.owner._presenter;
|
15774 | gridPresenter && gridPresenter.invokeColumnResizeEndCallback(this, width);
|
15775 | }, TablixColumn.prototype.fixSize = function() {
|
15776 | var shouldAlign = -1 !== this._aligningWidth, switched = shouldAlign !== this._fixedToAligningWidth;
|
15777 | (!this._sizeFixed || switched || shouldAlign) && (-1 === this._aligningWidth ? this.setContainerWidth(this._containerWidth) : this.setContainerWidth(this._aligningWidth),
|
15778 | this._sizeFixed = !0, this._fixedToAligningWidth = -1 !== this._aligningWidth);
|
15779 | }, TablixColumn.prototype.clearSize = function() {
|
15780 | this._containerWidth = -1, this.setContainerWidth(this._containerWidth), this._sizeFixed = !1;
|
15781 | }, TablixColumn.prototype.getContentContextualWidth = function() {
|
15782 | return this._containerWidth;
|
15783 | }, TablixColumn.prototype.getCellIContentContextualWidth = function(cell) {
|
15784 | return this._presenter.getCellWidth(cell);
|
15785 | }, TablixColumn.prototype.getCellSpanningWidthWithScrolling = function(cell, tablixGrid) {
|
15786 | var width = this.getContextualWidth() + this.getScrollingOffset();
|
15787 | if (cell.colSpan > 1) for (var index = this.getIndex(tablixGrid), columns = tablixGrid.realizedColumns, i = 1; i < cell.colSpan; i++) width += columns[i + index].getContextualWidth();
|
15788 | return width;
|
15789 | }, TablixColumn.prototype.getScrollingOffset = function() {
|
15790 | var offset = 0;
|
15791 | return this._realizedColumnHeaders.length > 0 && (offset = _.last(this._realizedColumnHeaders).horizontalOffset),
|
15792 | offset;
|
15793 | }, TablixColumn.prototype.getContextualWidth = function() {
|
15794 | return -1 !== this._width && -1 !== this._containerWidth || (this._width = this._presenter.getWidth()),
|
15795 | this._width;
|
15796 | }, TablixColumn.prototype.calculateSize = function() {
|
15797 | if (this._sizeFixed) return this._containerWidth;
|
15798 | var contentWidth = 0, persistedWidth = this._presenter.getPersistedWidth();
|
15799 | if (null != persistedWidth) {
|
15800 | contentWidth = persistedWidth;
|
15801 | for (var i = 0, len = this._realizedColumnHeaders.length; len - 1 > i; i++) {
|
15802 | var cell = this._realizedColumnHeaders[i];
|
15803 | 1 === cell.colSpan && (contentWidth = Math.max(contentWidth, this._presenter.getCellWidth(cell)));
|
15804 | }
|
15805 | return this._containerWidth = contentWidth;
|
15806 | }
|
15807 | for (var _i = 0, _a = this._realizedColumnHeaders; _i < _a.length; _i++) {
|
15808 | var cell = _a[_i];
|
15809 | 1 === cell.colSpan && (contentWidth = Math.max(contentWidth, this._presenter.getCellWidth(cell)));
|
15810 | }
|
15811 | for (var _b = 0, _c = this._realizedRowHeaders; _b < _c.length; _b++) {
|
15812 | var cell = _c[_b];
|
15813 | 1 === cell.colSpan && (contentWidth = Math.max(contentWidth, this._presenter.getCellWidth(cell)));
|
15814 | }
|
15815 | for (var _d = 0, _e = this._realizedCornerCells; _d < _e.length; _d++) {
|
15816 | var cell = _e[_d];
|
15817 | contentWidth = Math.max(contentWidth, this._presenter.getCellWidth(cell));
|
15818 | }
|
15819 | for (var _f = 0, _g = this._realizedBodyCells; _f < _g.length; _f++) {
|
15820 | var cell = _g[_f];
|
15821 | contentWidth = Math.max(contentWidth, this._presenter.getCellWidth(cell));
|
15822 | }
|
15823 | return null !== this._footerCell && 1 === this._footerCell.colSpan && (contentWidth = Math.max(contentWidth, this._presenter.getCellWidth(this._footerCell))),
|
15824 | this._containerWidth = contentWidth;
|
15825 | }, TablixColumn.prototype.setAligningContextualWidth = function(size) {
|
15826 | this._aligningWidth = size;
|
15827 | }, TablixColumn.prototype.getAligningContextualWidth = function() {
|
15828 | return this._aligningWidth;
|
15829 | }, TablixColumn.prototype.setContainerWidth = function(value) {
|
15830 | for (var _i = 0, _a = this._realizedColumnHeaders; _i < _a.length; _i++) {
|
15831 | var cell = _a[_i];
|
15832 | 1 === cell.colSpan && cell.setContainerWidth(value);
|
15833 | }
|
15834 | for (var _b = 0, _c = this._realizedRowHeaders; _b < _c.length; _b++) {
|
15835 | var cell = _c[_b];
|
15836 | 1 === cell.colSpan && cell.setContainerWidth(value);
|
15837 | }
|
15838 | for (var _d = 0, _e = this._realizedCornerCells; _d < _e.length; _d++) {
|
15839 | var cell = _e[_d];
|
15840 | cell.setContainerWidth(value);
|
15841 | }
|
15842 | for (var _f = 0, _g = this._realizedBodyCells; _f < _g.length; _f++) {
|
15843 | var cell = _g[_f];
|
15844 | cell.setContainerWidth(value);
|
15845 | }
|
15846 | null !== this._footerCell && 1 === this._footerCell.colSpan && this._footerCell.setContainerWidth(value),
|
15847 | this._width = value;
|
15848 | }, TablixColumn.prototype.getTablixCell = function() {
|
15849 | var realizedCells = this._realizedColumnHeaders.length > 0 ? this._realizedColumnHeaders : this._realizedCornerCells;
|
15850 | return realizedCells[realizedCells.length - 1];
|
15851 | }, TablixColumn.prototype.getIndex = function(grid) {
|
15852 | return grid.realizedColumns.indexOf(this);
|
15853 | }, TablixColumn.prototype.getHeaders = function() {
|
15854 | return this._realizedColumnHeaders;
|
15855 | }, TablixColumn.prototype.getOtherDimensionHeaders = function() {
|
15856 | return this._realizedRowHeaders;
|
15857 | }, TablixColumn.prototype.getCellContextualSpan = function(cell) {
|
15858 | return cell.colSpan;
|
15859 | }, TablixColumn.prototype.getOtherDimensionOwner = function(cell) {
|
15860 | return cell._row;
|
15861 | }, TablixColumn;
|
15862 | }();
|
15863 | internal.TablixColumn = TablixColumn;
|
15864 | var TablixRow = function() {
|
15865 | function TablixRow(presenter) {
|
15866 | this._containerHeight = -1, this._presenter = presenter, this._presenter.initialize(this),
|
15867 | this._allocatedCells = [], this._heightFixed = !1, this._containerHeight = -1, this._height = -1;
|
15868 | }
|
15869 | return TablixRow.prototype.initialize = function(owner) {
|
15870 | this._owner = owner, this._realizedRowHeaders = [], this._realizedBodyCells = [],
|
15871 | this._realizedCornerCells = [], this._realizedColumnHeaders = [], this._realizedCellsCount = 0;
|
15872 | }, Object.defineProperty(TablixRow.prototype, "presenter", {
|
15873 | get: function() {
|
15874 | return this._presenter;
|
15875 | },
|
15876 | enumerable: !0,
|
15877 | configurable: !0
|
15878 | }), Object.defineProperty(TablixRow.prototype, "owner", {
|
15879 | get: function() {
|
15880 | return this._owner;
|
15881 | },
|
15882 | enumerable: !0,
|
15883 | configurable: !0
|
15884 | }), TablixRow.prototype.releaseUnusedCells = function(owner) {
|
15885 | this.releaseCells(owner, this._realizedCellsCount);
|
15886 | }, TablixRow.prototype.releaseAllCells = function(owner) {
|
15887 | this.releaseCells(owner, 0);
|
15888 | }, TablixRow.prototype.releaseCells = function(owner, startIndex) {
|
15889 | for (var cells = this._allocatedCells, length = cells.length, i = startIndex; length > i; i++) {
|
15890 | var cell = cells[i];
|
15891 | owner._unbindCell(cell), cell.clear();
|
15892 | }
|
15893 | }, TablixRow.prototype.moveScrollableCellsToEnd = function(count) {
|
15894 | for (var frontIndex = Math.max(this._realizedRowHeaders.length, this._realizedCornerCells.length), i = frontIndex; frontIndex + count > i; i++) {
|
15895 | var cell = this._allocatedCells[i];
|
15896 | this._presenter.onRemoveCell(cell), this._presenter.onAppendCell(cell), this._allocatedCells.push(cell);
|
15897 | }
|
15898 | this._allocatedCells.splice(frontIndex, count);
|
15899 | }, TablixRow.prototype.moveScrollableCellsToStart = function(count) {
|
15900 | for (var frontIndex = Math.max(this._realizedRowHeaders.length, this._realizedCornerCells.length), i = frontIndex; frontIndex + count > i; i++) {
|
15901 | var cell = this._allocatedCells.pop();
|
15902 | this._presenter.onRemoveCell(cell), this._presenter.onInsertCellBefore(cell, this._allocatedCells[frontIndex]),
|
15903 | this._allocatedCells.splice(frontIndex, 0, cell);
|
15904 | }
|
15905 | }, TablixRow.prototype.getOrCreateCornerCell = function(column) {
|
15906 | var cell = this.getOrCreateCell();
|
15907 | return cell.prepare(!1), column.addCornerCell(cell), this._realizedCornerCells.push(cell),
|
15908 | cell.setContainerHeight(this._containerHeight), cell;
|
15909 | }, TablixRow.prototype.getOrCreateRowHeader = function(column, scrollable, leaf) {
|
15910 | var cell = this.getOrCreateCell();
|
15911 | return cell.prepare(scrollable), column.addRowHeader(cell), this._realizedRowHeaders.push(cell),
|
15912 | leaf && cell.setContainerHeight(this._containerHeight), cell;
|
15913 | }, TablixRow.prototype.getOrCreateColumnHeader = function(column, scrollable, leaf) {
|
15914 | var cell = this.getOrCreateCell();
|
15915 | return cell.prepare(scrollable), column.addColumnHeader(cell, leaf), this._realizedColumnHeaders.push(cell),
|
15916 | cell.setContainerHeight(this._containerHeight), cell;
|
15917 | }, TablixRow.prototype.getOrCreateBodyCell = function(column, scrollable) {
|
15918 | var cell = this.getOrCreateCell();
|
15919 | return cell.prepare(scrollable), column.addBodyCell(cell), this._realizedBodyCells.push(cell),
|
15920 | cell.setContainerHeight(this._containerHeight), cell;
|
15921 | }, TablixRow.prototype.getOrCreateFooterRowHeader = function(column) {
|
15922 | var cell = this.getOrCreateCell();
|
15923 | return cell.prepare(!1), column.footer = cell, this._realizedRowHeaders.push(cell),
|
15924 | cell.setContainerHeight(this._containerHeight), cell;
|
15925 | }, TablixRow.prototype.getOrCreateFooterBodyCell = function(column, scrollable) {
|
15926 | var cell = this.getOrCreateCell();
|
15927 | return cell.prepare(scrollable), column.footer = cell, this._realizedBodyCells.push(cell),
|
15928 | cell.setContainerHeight(this._containerHeight), cell;
|
15929 | }, TablixRow.prototype.getRowHeaderLeafIndex = function() {
|
15930 | for (var index = -1, count = this._allocatedCells.length, i = 0; count > i && 1 === this._allocatedCells[i].type; i++) index++;
|
15931 | return index;
|
15932 | }, TablixRow.prototype.getAllocatedCellAt = function(index) {
|
15933 | return this._allocatedCells[index];
|
15934 | }, TablixRow.prototype.moveCellsBy = function(delta) {
|
15935 | if (0 !== this._allocatedCells.length) if (delta > 0) for (var refCell = this._allocatedCells[0], i = 0; delta > i; i++) {
|
15936 | var cell = this.createCell(this);
|
15937 | this._presenter.onInsertCellBefore(cell, refCell), this._allocatedCells.unshift(cell),
|
15938 | refCell = cell;
|
15939 | } else {
|
15940 | delta = -delta;
|
15941 | for (var i = 0; delta > i; i++) this._presenter.onRemoveCell(this._allocatedCells[i]);
|
15942 | this._allocatedCells.splice(0, delta);
|
15943 | }
|
15944 | }, TablixRow.prototype.getRealizedCellCount = function() {
|
15945 | return this._realizedCellsCount;
|
15946 | }, TablixRow.prototype.getRealizedHeadersCount = function() {
|
15947 | return this._realizedRowHeaders.length;
|
15948 | }, TablixRow.prototype.getRealizedHeaderAt = function(index) {
|
15949 | return this._realizedRowHeaders[index];
|
15950 | }, TablixRow.prototype.getTablixCell = function() {
|
15951 | var realizedCells;
|
15952 | return realizedCells = this._realizedRowHeaders.length > 0 ? this._realizedRowHeaders : this._realizedCornerCells.length > 0 ? this._realizedCornerCells : this._realizedColumnHeaders,
|
15953 | realizedCells[realizedCells.length - 1];
|
15954 | }, TablixRow.prototype.getOrCreateEmptySpaceCell = function() {
|
15955 | var cell = this._allocatedCells[this._realizedCellsCount];
|
15956 | return void 0 === cell && (cell = this.createCell(this), this._allocatedCells[this._realizedCellsCount] = cell,
|
15957 | this._presenter.onAppendCell(cell)), cell;
|
15958 | }, TablixRow.prototype.createCell = function(row) {
|
15959 | var presenter = this._presenter.createCellPresenter(this._owner.owner.layoutManager.getLayoutKind());
|
15960 | return new TablixCell(presenter, presenter, this);
|
15961 | }, TablixRow.prototype.getOrCreateCell = function() {
|
15962 | var cell = this._allocatedCells[this._realizedCellsCount];
|
15963 | return void 0 === cell ? (cell = this.createCell(this), this._allocatedCells[this._realizedCellsCount] = cell,
|
15964 | this._presenter.onAppendCell(cell)) : (cell.colSpan = 1, cell.rowSpan = 1), this._realizedCellsCount = this._realizedCellsCount + 1,
|
15965 | cell;
|
15966 | }, TablixRow.prototype.onResize = function(height) {
|
15967 | height !== this.getContentContextualWidth() && (this._containerHeight = height,
|
15968 | this.setContentHeight(), this._heightFixed = !0, this.setAligningContextualWidth(-1));
|
15969 | }, TablixRow.prototype.onResizeEnd = function(height) {}, TablixRow.prototype.fixSize = function() {
|
15970 | this.sizeFixed() || (this.setContentHeight(), this._heightFixed = !0);
|
15971 | }, TablixRow.prototype.unfixSize = function() {
|
15972 | this._heightFixed = !1, this._height = -1;
|
15973 | }, TablixRow.prototype.getContentContextualWidth = function() {
|
15974 | return this._containerHeight;
|
15975 | }, TablixRow.prototype.getCellIContentContextualWidth = function(cell) {
|
15976 | return this.presenter.getCellContentHeight(cell);
|
15977 | }, TablixRow.prototype.getCellSpanningHeight = function(cell) {
|
15978 | var height = this.getContextualWidth();
|
15979 | if (cell.rowSpan > 1) for (var index = this.getIndex(this.owner), rows = this.owner.realizedRows, i = 1; i < cell.rowSpan; i++) height += rows[i + index].getContextualWidth();
|
15980 | return height;
|
15981 | }, TablixRow.prototype.getContextualWidth = function() {
|
15982 | return -1 !== this._height && -1 !== this._containerHeight || (this._height = this._presenter.getHeight()),
|
15983 | this._height;
|
15984 | }, TablixRow.prototype.sizeFixed = function() {
|
15985 | return this._heightFixed;
|
15986 | }, TablixRow.prototype.calculateSize = function() {
|
15987 | if (this._heightFixed) return this._containerHeight;
|
15988 | for (var contentHeight = 0, count = this._realizedRowHeaders.length, i = 0; count > i; i++) {
|
15989 | var cell = this._realizedRowHeaders[i];
|
15990 | 1 === cell.rowSpan && (contentHeight = Math.max(contentHeight, this._presenter.getCellContentHeight(cell)));
|
15991 | }
|
15992 | count = this._realizedCornerCells.length;
|
15993 | for (var i = 0; count > i; i++) contentHeight = Math.max(contentHeight, this._presenter.getCellContentHeight(this._realizedCornerCells[i]));
|
15994 | count = this._realizedColumnHeaders.length;
|
15995 | for (var i = 0; count > i; i++) {
|
15996 | var cell = this._realizedColumnHeaders[i];
|
15997 | 1 === cell.rowSpan && (contentHeight = Math.max(contentHeight, this._presenter.getCellContentHeight(cell)));
|
15998 | }
|
15999 | count = this._realizedBodyCells.length;
|
16000 | for (var i = 0; count > i; i++) contentHeight = Math.max(contentHeight, this._presenter.getCellContentHeight(this._realizedBodyCells[i]));
|
16001 | return this._containerHeight = contentHeight;
|
16002 | }, TablixRow.prototype.setAligningContextualWidth = function(size) {}, TablixRow.prototype.getAligningContextualWidth = function() {
|
16003 | return -1;
|
16004 | }, TablixRow.prototype.setContentHeight = function() {
|
16005 | for (var count = this._realizedRowHeaders.length, i = count - 1; i >= 0; i--) {
|
16006 | var cell = this._realizedRowHeaders[i];
|
16007 | cell.setContainerHeight(this._containerHeight), cell.rowSpan > 1 && cell.setContainerHeight(this.getCellSpanningHeight(cell));
|
16008 | }
|
16009 | count = this._realizedCornerCells.length;
|
16010 | for (var i = 0; count > i; i++) this._realizedCornerCells[i].setContainerHeight(this._containerHeight);
|
16011 | count = this._realizedColumnHeaders.length;
|
16012 | for (var i = 0; count > i; i++) {
|
16013 | var cell = this._realizedColumnHeaders[i];
|
16014 | cell.setContainerHeight(this._containerHeight), cell.rowSpan > 1 && cell.setContainerHeight(this.getCellSpanningHeight(cell));
|
16015 | }
|
16016 | count = this._realizedBodyCells.length;
|
16017 | for (var i = 0; count > i; i++) this._realizedBodyCells[i].setContainerHeight(this._containerHeight);
|
16018 | this._height = -1;
|
16019 | }, TablixRow.prototype.getIndex = function(grid) {
|
16020 | return grid.realizedRows.indexOf(this);
|
16021 | }, TablixRow.prototype.getHeaders = function() {
|
16022 | return this._realizedRowHeaders;
|
16023 | }, TablixRow.prototype.getOtherDimensionHeaders = function() {
|
16024 | return this._realizedColumnHeaders;
|
16025 | }, TablixRow.prototype.getCellContextualSpan = function(cell) {
|
16026 | return cell.rowSpan;
|
16027 | }, TablixRow.prototype.getOtherDimensionOwner = function(cell) {
|
16028 | return cell._column;
|
16029 | }, TablixRow;
|
16030 | }();
|
16031 | internal.TablixRow = TablixRow;
|
16032 | var TablixGrid = function() {
|
16033 | function TablixGrid(presenter) {
|
16034 | this._presenter = presenter, this._footerRow = null;
|
16035 | }
|
16036 | return TablixGrid.prototype.initialize = function(owner, gridHost, footerHost) {
|
16037 | this._owner = owner, this._presenter.initialize(this, gridHost, footerHost, owner),
|
16038 | this.fillColumnsProportionally = !1, this._realizedRows = [], this._realizedColumns = [],
|
16039 | this._emptySpaceHeaderCell = null, this._emptyFooterSpaceCell = null;
|
16040 | }, Object.defineProperty(TablixGrid.prototype, "owner", {
|
16041 | get: function() {
|
16042 | return this._owner;
|
16043 | },
|
16044 | enumerable: !0,
|
16045 | configurable: !0
|
16046 | }), Object.defineProperty(TablixGrid.prototype, "fillColumnsProportionally", {
|
16047 | get: function() {
|
16048 | return this._fillColumnsProportionally;
|
16049 | },
|
16050 | set: function(value) {
|
16051 | this._fillColumnsProportionally !== value && (this._fillColumnsProportionally = value,
|
16052 | this._presenter.onFillColumnsProportionallyChanged(value));
|
16053 | },
|
16054 | enumerable: !0,
|
16055 | configurable: !0
|
16056 | }), Object.defineProperty(TablixGrid.prototype, "realizedColumns", {
|
16057 | get: function() {
|
16058 | return this._realizedColumns;
|
16059 | },
|
16060 | set: function(columns) {
|
16061 | this._realizedColumns = columns;
|
16062 | },
|
16063 | enumerable: !0,
|
16064 | configurable: !0
|
16065 | }), Object.defineProperty(TablixGrid.prototype, "realizedRows", {
|
16066 | get: function() {
|
16067 | return this._realizedRows;
|
16068 | },
|
16069 | set: function(rows) {
|
16070 | this._realizedRows = rows;
|
16071 | },
|
16072 | enumerable: !0,
|
16073 | configurable: !0
|
16074 | }), Object.defineProperty(TablixGrid.prototype, "footerRow", {
|
16075 | get: function() {
|
16076 | return this._footerRow;
|
16077 | },
|
16078 | enumerable: !0,
|
16079 | configurable: !0
|
16080 | }), Object.defineProperty(TablixGrid.prototype, "emptySpaceHeaderCell", {
|
16081 | get: function() {
|
16082 | return this._emptySpaceHeaderCell;
|
16083 | },
|
16084 | enumerable: !0,
|
16085 | configurable: !0
|
16086 | }), Object.defineProperty(TablixGrid.prototype, "emptySpaceFooterCell", {
|
16087 | get: function() {
|
16088 | return this._emptyFooterSpaceCell;
|
16089 | },
|
16090 | enumerable: !0,
|
16091 | configurable: !0
|
16092 | }), TablixGrid.prototype.ShowEmptySpaceCells = function(rowSpan, width) {
|
16093 | 0 !== this._realizedRows.length && (0 === this._realizedRows.length || this._emptySpaceHeaderCell || (this._emptySpaceHeaderCell = this._realizedRows[0].getOrCreateEmptySpaceCell(),
|
16094 | this._emptySpaceHeaderCell.rowSpan = rowSpan, this._emptySpaceHeaderCell.colSpan = 1,
|
16095 | this._emptySpaceHeaderCell.setContainerWidth(width)), this._footerRow && null === this._emptyFooterSpaceCell && (this._emptyFooterSpaceCell = this._footerRow.getOrCreateEmptySpaceCell(),
|
16096 | this._emptyFooterSpaceCell.rowSpan = 1, this._emptyFooterSpaceCell.colSpan = 1,
|
16097 | this._emptyFooterSpaceCell.setContainerWidth(width)));
|
16098 | }, TablixGrid.prototype.HideEmptySpaceCells = function() {
|
16099 | this._emptySpaceHeaderCell && (this._emptySpaceHeaderCell.clear(), this._emptySpaceHeaderCell = null),
|
16100 | this._emptyFooterSpaceCell && (this._emptyFooterSpaceCell.clear(), this._emptyFooterSpaceCell = null);
|
16101 | }, TablixGrid.prototype.onStartRenderingSession = function(clear) {
|
16102 | clear && (this.clearRows(), this.clearColumns());
|
16103 | }, TablixGrid.prototype.onStartRenderingIteration = function() {
|
16104 | this.initializeRows(), this.initializeColumns();
|
16105 | }, TablixGrid.prototype.onEndRenderingIteration = function() {
|
16106 | var rows = this._rows;
|
16107 | if (void 0 !== rows) for (var rowCount = rows.length, i = 0; rowCount > i; i++) rows[i].releaseUnusedCells(this._owner);
|
16108 | this._footerRow && this._footerRow.releaseUnusedCells(this._owner);
|
16109 | }, TablixGrid.prototype.getOrCreateRow = function(rowIndex) {
|
16110 | var currentRow = this._rows[rowIndex];
|
16111 | return void 0 === currentRow && (currentRow = new TablixRow(this._presenter.createRowPresenter()),
|
16112 | currentRow.initialize(this), this._presenter.onAppendRow(currentRow), this._rows[rowIndex] = currentRow),
|
16113 | void 0 === this._realizedRows[rowIndex] && (this._realizedRows[rowIndex] = currentRow),
|
16114 | currentRow;
|
16115 | }, TablixGrid.prototype.getOrCreateFootersRow = function() {
|
16116 | return null === this._footerRow && (this._footerRow = new TablixRow(this._presenter.createRowPresenter()),
|
16117 | this._footerRow.initialize(this), this._presenter.onAddFooterRow(this._footerRow)),
|
16118 | this._footerRow;
|
16119 | }, TablixGrid.prototype.moveRowsToEnd = function(moveFromIndex, count) {
|
16120 | for (var i = 0; count > i; i++) {
|
16121 | var row = this._rows[i + moveFromIndex];
|
16122 | row.unfixSize(), this._presenter.onRemoveRow(row), this._presenter.onAppendRow(row),
|
16123 | this._rows.push(row);
|
16124 | }
|
16125 | this._rows.splice(moveFromIndex, count);
|
16126 | }, TablixGrid.prototype.moveRowsToStart = function(moveToIndex, count) {
|
16127 | for (var refRow = this._rows[moveToIndex], i = 0; count > i; i++) {
|
16128 | var row = this._rows.pop();
|
16129 | row.unfixSize(), this._presenter.onRemoveRow(row), this._presenter.onInsertRowBefore(row, refRow),
|
16130 | this._rows.splice(moveToIndex + i, 0, row);
|
16131 | }
|
16132 | }, TablixGrid.prototype.moveColumnsToEnd = function(moveFromIndex, count) {
|
16133 | for (var firstCol = this._rows[0]._realizedCornerCells.length, leafStartDepth = Math.max(this._columns[firstCol]._realizedColumnHeaders.length - 1, 0), i = leafStartDepth; i < this._rows.length; i++) this._rows[i].moveScrollableCellsToEnd(count);
|
16134 | for (var i = 0; count > i; i++) {
|
16135 | var column = this._columns[i + moveFromIndex];
|
16136 | this._columns.push(column);
|
16137 | }
|
16138 | this._columns.splice(moveFromIndex, count);
|
16139 | }, TablixGrid.prototype.moveColumnsToStart = function(moveToIndex, count) {
|
16140 | for (var firstCol = this._rows[0]._realizedCornerCells.length, leafStartDepth = Math.max(this._columns[firstCol]._realizedColumnHeaders.length - 1, 0), i = leafStartDepth; i < this._rows.length; i++) this._rows[i].moveScrollableCellsToStart(count);
|
16141 | for (var i = 0; count > i; i++) {
|
16142 | var column = this._columns.pop();
|
16143 | this._columns.splice(moveToIndex + i, 0, column);
|
16144 | }
|
16145 | }, TablixGrid.prototype.getOrCreateColumn = function(columnIndex) {
|
16146 | var currentColumn = this._columns[columnIndex];
|
16147 | return void 0 === currentColumn && (currentColumn = new TablixColumn(this._presenter.createColumnPresenter(columnIndex), columnIndex),
|
16148 | currentColumn.initialize(this), this._columns[columnIndex] = currentColumn), void 0 === this._realizedColumns[columnIndex] && (this._realizedColumns[columnIndex] = currentColumn),
|
16149 | currentColumn;
|
16150 | }, TablixGrid.prototype.initializeColumns = function() {
|
16151 | this._columns || (this._columns = []);
|
16152 | for (var length = this._columns.length, i = 0; length > i; i++) this._columns[i].initialize(this);
|
16153 | this._realizedColumns = [];
|
16154 | }, TablixGrid.prototype.clearColumns = function() {
|
16155 | this._columns = null, this._realizedColumns = null;
|
16156 | }, TablixGrid.prototype.initializeRows = function() {
|
16157 | var hasFooter = this._owner.rowDimension.hasFooter() && null !== this._footerRow;
|
16158 | this._realizedRows = [], this._rows || (this._rows = []);
|
16159 | for (var rows = this._rows, length = rows.length, i = 0; length > i; i++) rows[i].initialize(this);
|
16160 | hasFooter && (this._footerRow || this.getOrCreateFootersRow(), this._footerRow.initialize(this));
|
16161 | }, TablixGrid.prototype.clearRows = function() {
|
16162 | var rows = this._rows;
|
16163 | if (rows) {
|
16164 | for (var length_1 = rows.length, i = 0; length_1 > i; i++) rows[i].releaseAllCells(this._owner);
|
16165 | this._footerRow && this._footerRow.releaseAllCells(this._owner), this._presenter.onClear(),
|
16166 | this._footerRow = null, this._rows = null, this._realizedRows = null;
|
16167 | }
|
16168 | }, TablixGrid.prototype.getWidth = function() {
|
16169 | return this._presenter.getWidth();
|
16170 | }, TablixGrid.prototype.getHeight = function() {
|
16171 | return this._presenter.getHeight();
|
16172 | }, TablixGrid;
|
16173 | }();
|
16174 | internal.TablixGrid = TablixGrid;
|
16175 | }(internal = controls.internal || (controls.internal = {}));
|
16176 | }(controls = visuals.controls || (visuals.controls = {}));
|
16177 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
16178 | }(powerbi || (powerbi = {}));
|
16179 | }, function(module, exports) {
|
16180 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi, __extends = (window.powerbitests,
|
16181 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
16182 | function __() {
|
16183 | this.constructor = d;
|
16184 | }
|
16185 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
16186 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16187 | });
|
16188 | !function(powerbi) {
|
16189 | var visuals;
|
16190 | !function(visuals) {
|
16191 | var controls;
|
16192 | !function(controls) {
|
16193 | var internal;
|
16194 | !function(internal) {
|
16195 | var PixelConverter = jsCommon.PixelConverter, SizeComputationManager = function() {
|
16196 | function SizeComputationManager() {}
|
16197 | return Object.defineProperty(SizeComputationManager.prototype, "visibleWidth", {
|
16198 | get: function() {
|
16199 | return this._viewport ? this._viewport.width : 0;
|
16200 | },
|
16201 | enumerable: !0,
|
16202 | configurable: !0
|
16203 | }), Object.defineProperty(SizeComputationManager.prototype, "visibleHeight", {
|
16204 | get: function() {
|
16205 | return this._viewport ? this._viewport.height : 0;
|
16206 | },
|
16207 | enumerable: !0,
|
16208 | configurable: !0
|
16209 | }), Object.defineProperty(SizeComputationManager.prototype, "gridWidth", {
|
16210 | get: function() {
|
16211 | return this.visibleWidth;
|
16212 | },
|
16213 | enumerable: !0,
|
16214 | configurable: !0
|
16215 | }), Object.defineProperty(SizeComputationManager.prototype, "gridHeight", {
|
16216 | get: function() {
|
16217 | return this.visibleHeight;
|
16218 | },
|
16219 | enumerable: !0,
|
16220 | configurable: !0
|
16221 | }), Object.defineProperty(SizeComputationManager.prototype, "rowHeight", {
|
16222 | get: function() {
|
16223 | return this._cellHeight;
|
16224 | },
|
16225 | enumerable: !0,
|
16226 | configurable: !0
|
16227 | }), Object.defineProperty(SizeComputationManager.prototype, "cellWidth", {
|
16228 | get: function() {
|
16229 | return this._cellWidth;
|
16230 | },
|
16231 | enumerable: !0,
|
16232 | configurable: !0
|
16233 | }), Object.defineProperty(SizeComputationManager.prototype, "cellHeight", {
|
16234 | get: function() {
|
16235 | return this._cellHeight;
|
16236 | },
|
16237 | enumerable: !0,
|
16238 | configurable: !0
|
16239 | }), Object.defineProperty(SizeComputationManager.prototype, "contentWidth", {
|
16240 | get: function() {
|
16241 | return this._cellWidth;
|
16242 | },
|
16243 | enumerable: !0,
|
16244 | configurable: !0
|
16245 | }), Object.defineProperty(SizeComputationManager.prototype, "contentHeight", {
|
16246 | get: function() {
|
16247 | return this._cellHeight;
|
16248 | },
|
16249 | enumerable: !0,
|
16250 | configurable: !0
|
16251 | }), SizeComputationManager.prototype.updateColumnCount = function(columnCount) {
|
16252 | this._columnCount = columnCount;
|
16253 | }, SizeComputationManager.prototype.updateRowHeight = function(rowHeight) {
|
16254 | this._cellHeight = rowHeight;
|
16255 | }, SizeComputationManager.prototype.updateScalingFactor = function(scalingFactor) {
|
16256 | this._scalingFactor = scalingFactor, this._cellWidth = this.computeColumnWidth(this._columnCount);
|
16257 | }, SizeComputationManager.prototype.updateViewport = function(viewport) {
|
16258 | this._viewport = viewport, this._cellWidth = this.computeColumnWidth(this._columnCount),
|
16259 | this._cellHeight = this.computeColumnHeight();
|
16260 | }, SizeComputationManager.prototype.computeColumnWidth = function(totalColumnCount) {
|
16261 | var scalingFactor = this._scalingFactor;
|
16262 | scalingFactor || (scalingFactor = 1);
|
16263 | var minimumColumnWidth = scalingFactor * SizeComputationManager.TablixMinimumColumnWidth, maxAllowedColumns = Math.floor(this._viewport.width / minimumColumnWidth);
|
16264 | return this.fitToColumnCount(maxAllowedColumns, totalColumnCount);
|
16265 | }, SizeComputationManager.prototype.computeColumnHeight = function() {
|
16266 | if (!this.hasImageContent) return this._cellHeight;
|
16267 | var width = this._viewport.width;
|
16268 | return 250 >= width ? 20 : 510 >= width ? 51 : 770 >= width ? 52 : void 0;
|
16269 | }, SizeComputationManager.prototype.fitToColumnCount = function(maxAllowedColumnCount, totalColumnCount) {
|
16270 | var columnsToFit = Math.min(maxAllowedColumnCount, totalColumnCount);
|
16271 | return Math.floor(this._viewport.width / columnsToFit);
|
16272 | }, SizeComputationManager.TablixMinimumColumnWidth = 75, SizeComputationManager;
|
16273 | }();
|
16274 | internal.SizeComputationManager = SizeComputationManager;
|
16275 | var DimensionLayoutManager = function() {
|
16276 | function DimensionLayoutManager(owner, grid, realizationManager) {
|
16277 | this._owner = owner, this._grid = grid, this._lastScrollOffset = null, this._isScrolling = !1,
|
16278 | this._fixedSizeEnabled = !0, this._done = !1, this._realizationManager = realizationManager;
|
16279 | }
|
16280 | return Object.defineProperty(DimensionLayoutManager.prototype, "owner", {
|
16281 | get: function() {
|
16282 | return this._owner;
|
16283 | },
|
16284 | set: function(owner) {
|
16285 | this._owner = owner;
|
16286 | },
|
16287 | enumerable: !0,
|
16288 | configurable: !0
|
16289 | }), Object.defineProperty(DimensionLayoutManager.prototype, "realizationManager", {
|
16290 | get: function() {
|
16291 | return this._realizationManager;
|
16292 | },
|
16293 | enumerable: !0,
|
16294 | configurable: !0
|
16295 | }), Object.defineProperty(DimensionLayoutManager.prototype, "fixedSizeEnabled", {
|
16296 | get: function() {
|
16297 | return this._fixedSizeEnabled;
|
16298 | },
|
16299 | set: function(enable) {
|
16300 | this._fixedSizeEnabled = enable;
|
16301 | },
|
16302 | enumerable: !0,
|
16303 | configurable: !0
|
16304 | }), DimensionLayoutManager.prototype.onCornerCellRealized = function(item, cell, leaf) {
|
16305 | this._realizationManager.onCornerCellRealized(item, cell);
|
16306 | }, DimensionLayoutManager.prototype.onHeaderRealized = function(item, cell, leaf) {
|
16307 | this._realizationManager.onHeaderRealized(item, cell, leaf);
|
16308 | }, Object.defineProperty(DimensionLayoutManager.prototype, "needsToRealize", {
|
16309 | get: function() {
|
16310 | return this._realizationManager.needsToRealize;
|
16311 | },
|
16312 | enumerable: !0,
|
16313 | configurable: !0
|
16314 | }), DimensionLayoutManager.prototype.getVisibleSizeRatio = function() {
|
16315 | return 1 - this.dimension.getFractionScrollOffset();
|
16316 | }, Object.defineProperty(DimensionLayoutManager.prototype, "alignToEnd", {
|
16317 | get: function() {
|
16318 | return this._alignToEnd;
|
16319 | },
|
16320 | enumerable: !0,
|
16321 | configurable: !0
|
16322 | }), Object.defineProperty(DimensionLayoutManager.prototype, "done", {
|
16323 | get: function() {
|
16324 | return this._done;
|
16325 | },
|
16326 | enumerable: !0,
|
16327 | configurable: !0
|
16328 | }), DimensionLayoutManager.prototype._requiresMeasure = function() {
|
16329 | return !0;
|
16330 | }, DimensionLayoutManager.prototype.startScrollingSession = function() {
|
16331 | this._isScrolling = !0;
|
16332 | }, DimensionLayoutManager.prototype.endScrollingSession = function() {
|
16333 | this._isScrolling = !1;
|
16334 | }, DimensionLayoutManager.prototype.isScrolling = function() {
|
16335 | return this._isScrolling;
|
16336 | }, DimensionLayoutManager.prototype.isResizing = function() {
|
16337 | return !1;
|
16338 | }, DimensionLayoutManager.prototype.getOtherHierarchyContextualHeight = function() {
|
16339 | var otherDimension = this.dimension.otherDimension, count = otherDimension.getDepth(), contextualHeight = 0, items = this._getRealizedItems();
|
16340 | if (items.length > 0) for (var i = 0; count > i; i++) contextualHeight += items[i].getContextualWidth();
|
16341 | return contextualHeight;
|
16342 | }, DimensionLayoutManager.prototype._isAutoSized = function() {
|
16343 | return !1;
|
16344 | }, DimensionLayoutManager.prototype.onStartRenderingSession = function() {
|
16345 | this._measureEnabled = this._requiresMeasure(), this._gridOffset = this.dimension.otherDimension.getDepth();
|
16346 | }, DimensionLayoutManager.prototype.onEndRenderingSession = function() {
|
16347 | this._realizationManager.onEndRenderingSession(), this._alignToEnd = !1, this._done = !1,
|
16348 | this._measureEnabled = !0, this._sendDimensionsToControl();
|
16349 | }, DimensionLayoutManager.prototype._sendDimensionsToControl = function() {}, Object.defineProperty(DimensionLayoutManager.prototype, "measureEnabled", {
|
16350 | get: function() {
|
16351 | return this._measureEnabled;
|
16352 | },
|
16353 | enumerable: !0,
|
16354 | configurable: !0
|
16355 | }), DimensionLayoutManager.prototype.getFooterContextualWidth = function() {
|
16356 | return 0;
|
16357 | }, DimensionLayoutManager.prototype.onStartRenderingIteration = function(clear, contextualWidth) {
|
16358 | this._measureEnabled && !this._done && (this._contextualWidthToFill = (contextualWidth - this.otherScrollbarContextualWidth) * this.getGridScale() - this.getFooterContextualWidth()),
|
16359 | this._realizationManager.onStartRenderingIteration(), clear ? this._lastScrollOffset = null : null !== this._lastScrollOffset && this.swapElements();
|
16360 | }, Object.defineProperty(DimensionLayoutManager.prototype, "allItemsRealized", {
|
16361 | get: function() {
|
16362 | return this.getRealizedItemsCount() - this._gridOffset === this.dimension.getItemsCount() || 0 === this.dimension.getItemsCount();
|
16363 | },
|
16364 | enumerable: !0,
|
16365 | configurable: !0
|
16366 | }), DimensionLayoutManager.prototype.onEndRenderingIteration = function() {
|
16367 | if (!this._done) {
|
16368 | if (!this._measureEnabled) return this._lastScrollOffset = this.dimension.scrollOffset,
|
16369 | void (this._done = !0);
|
16370 | var newScrollOffset, gridContextualWidth = this.getGridContextualWidth(), filled = powerbi.Double.greaterOrEqualWithPrecision(gridContextualWidth, this._contextualWidthToFill, DimensionLayoutManager._pixelPrecision), allRealized = this.allItemsRealized;
|
16371 | newScrollOffset = filled ? this.scrollForwardToAlignEnd(gridContextualWidth) : this.scrollBackwardToFill(gridContextualWidth),
|
16372 | this._realizationManager.onEndRenderingIteration(gridContextualWidth, filled);
|
16373 | var originalScrollbarVisible = this.dimension.scrollbar.visible;
|
16374 | this.updateScrollbar(gridContextualWidth), this._done = (filled || allRealized) && this.dimension.scrollbar.visible === originalScrollbarVisible && powerbi.Double.equalWithPrecision(newScrollOffset, this.dimension.scrollOffset, DimensionLayoutManager._scrollOffsetPrecision),
|
16375 | this.dimension.scrollOffset = newScrollOffset, this._lastScrollOffset = this.dimension.scrollOffset;
|
16376 | }
|
16377 | }, DimensionLayoutManager.prototype.getScrollDeltaWithinPage = function() {
|
16378 | if (null !== this._lastScrollOffset) {
|
16379 | var delta = this.dimension.getIntegerScrollOffset() - Math.floor(this._lastScrollOffset);
|
16380 | if (Math.abs(delta) < this.getRealizedItemsCount() - this.dimension.otherDimension.getDepth()) return delta;
|
16381 | }
|
16382 | return null;
|
16383 | }, DimensionLayoutManager.prototype.swapElements = function() {
|
16384 | var delta = this.getScrollDeltaWithinPage();
|
16385 | if (null !== delta) {
|
16386 | var otherHierarchyDepth = this.dimension.otherDimension.getDepth();
|
16387 | Math.abs(delta) < this.getRealizedItemsCount() - otherHierarchyDepth && (delta > 0 ? this._moveElementsToBottom(otherHierarchyDepth, delta) : 0 > delta && this._moveElementsToTop(otherHierarchyDepth, -delta));
|
16388 | }
|
16389 | }, DimensionLayoutManager.prototype._getRealizedItems = function() {
|
16390 | return null;
|
16391 | }, DimensionLayoutManager.prototype.getRealizedItemsCount = function() {
|
16392 | var realizedItems = this._getRealizedItems();
|
16393 | return realizedItems.length;
|
16394 | }, DimensionLayoutManager.prototype._moveElementsToBottom = function(moveFromIndex, count) {},
|
16395 | DimensionLayoutManager.prototype._moveElementsToTop = function(moveToIndex, count) {},
|
16396 | DimensionLayoutManager.prototype.isScrollingWithinPage = function() {
|
16397 | return null !== this.getScrollDeltaWithinPage();
|
16398 | }, DimensionLayoutManager.prototype.getGridContextualWidth = function() {
|
16399 | return 0;
|
16400 | }, DimensionLayoutManager.prototype.updateScrollbar = function(gridContextualWidth) {
|
16401 | var scrollbar = this.dimension.scrollbar;
|
16402 | scrollbar.viewMin = this.dimension.scrollOffset, scrollbar.min = 0, scrollbar.max = this.dimension.getItemsCount(),
|
16403 | scrollbar.viewSize = this.getViewSize(gridContextualWidth), this.dimension.scrollbar.show(this.canScroll(gridContextualWidth));
|
16404 | }, DimensionLayoutManager.prototype.getViewSize = function(gridContextualWidth) {
|
16405 | var count = this.getRealizedItemsCount();
|
16406 | if (0 === count) return 0;
|
16407 | for (var startIndex = this._gridOffset, sizeInItems = 0, sizeInPixels = 0, widthToFill = this._contextualWidthToFill, scrollableArea = widthToFill - this.getOtherHierarchyContextualHeight(), error = this.getMeaurementError(gridContextualWidth), i = startIndex; count > i; i++) {
|
16408 | var visibleRatio = void 0;
|
16409 | visibleRatio = i === startIndex ? this.getVisibleSizeRatio() : 1;
|
16410 | var itemContextualWidth = this.getItemContextualWidthWithScrolling(i) * error;
|
16411 | if (sizeInPixels += itemContextualWidth, sizeInItems += visibleRatio, powerbi.Double.greaterWithPrecision(sizeInPixels, scrollableArea, DimensionLayoutManager._pixelPrecision)) {
|
16412 | sizeInItems -= (sizeInPixels - scrollableArea) / itemContextualWidth * visibleRatio;
|
16413 | break;
|
16414 | }
|
16415 | }
|
16416 | return sizeInItems;
|
16417 | }, DimensionLayoutManager.prototype.isScrollableHeader = function(item, items, index) {
|
16418 | if (0 !== index || 0 === this.dimension.getFractionScrollOffset()) return !1;
|
16419 | var hierarchyNavigator = this.dimension._hierarchyNavigator;
|
16420 | if (hierarchyNavigator.isLeaf(item)) return !0;
|
16421 | var currentItem = item, currentItems = items;
|
16422 | do {
|
16423 | if (currentItems = hierarchyNavigator.getChildren(currentItem), currentItem = this.dimension.getFirstVisibleItem(hierarchyNavigator.getLevel(currentItem) + 1),
|
16424 | void 0 === currentItem) break;
|
16425 | if (!hierarchyNavigator.isLastItem(currentItem, currentItems)) return !1;
|
16426 | } while (!hierarchyNavigator.isLeaf(currentItem));
|
16427 | return !0;
|
16428 | }, DimensionLayoutManager.prototype.reachedEnd = function() {
|
16429 | return this.dimension.getIntegerScrollOffset() + (this.getRealizedItemsCount() - this._gridOffset) >= this.dimension.getItemsCount();
|
16430 | }, DimensionLayoutManager.prototype.scrollBackwardToFill = function(gridContextualWidth) {
|
16431 | var newScrollOffset = this.dimension.scrollOffset;
|
16432 | if (this.reachedEnd()) {
|
16433 | var widthToFill = this._contextualWidthToFill - gridContextualWidth;
|
16434 | if (this.dimension.getItemsCount() > 0) {
|
16435 | var averageColumnwidth = gridContextualWidth / (this.getRealizedItemsCount() - this.dimension.getFractionScrollOffset());
|
16436 | newScrollOffset = this.dimension.getValidScrollOffset(Math.floor(this.dimension.scrollOffset - widthToFill / averageColumnwidth));
|
16437 | }
|
16438 | this._alignToEnd = !powerbi.Double.equalWithPrecision(newScrollOffset, this.dimension.scrollOffset, DimensionLayoutManager._scrollOffsetPrecision);
|
16439 | }
|
16440 | return newScrollOffset;
|
16441 | }, DimensionLayoutManager.prototype.getItemContextualWidth = function(index) {
|
16442 | var realizedItems = this._getRealizedItems();
|
16443 | return index >= realizedItems.length ? null : realizedItems[index].getContextualWidth();
|
16444 | }, DimensionLayoutManager.prototype.getItemContextualWidthWithScrolling = function(index) {
|
16445 | return this.getSizeWithScrolling(this.getItemContextualWidth(index), index);
|
16446 | }, DimensionLayoutManager.prototype.getSizeWithScrolling = function(size, index) {
|
16447 | var ratio;
|
16448 | return ratio = this._gridOffset === index ? this.getVisibleSizeRatio() : 1, size * ratio;
|
16449 | }, DimensionLayoutManager.prototype.getGridContextualWidthFromItems = function() {
|
16450 | for (var count = this.getRealizedItemsCount(), contextualWidth = 0, i = 0; count > i; i++) contextualWidth += this.getItemContextualWidthWithScrolling(i);
|
16451 | return contextualWidth;
|
16452 | }, DimensionLayoutManager.prototype.getMeaurementError = function(gridContextualWidth) {
|
16453 | return gridContextualWidth / this.getGridContextualWidthFromItems();
|
16454 | }, DimensionLayoutManager.prototype.scrollForwardToAlignEnd = function(gridContextualWidth) {
|
16455 | var newScrollOffset = this.dimension.scrollOffset;
|
16456 | if (this._alignToEnd) {
|
16457 | var withinThreshold = powerbi.Double.equalWithPrecision(gridContextualWidth, this._contextualWidthToFill, DimensionLayoutManager._pixelPrecision);
|
16458 | if (!withinThreshold) for (var count = this.getRealizedItemsCount(), startIndex = this._gridOffset, widthToScroll = gridContextualWidth - this._contextualWidthToFill, error = this.getMeaurementError(gridContextualWidth), i = startIndex; count > i; i++) {
|
16459 | var itemContextualWidth = this.getItemContextualWidth(i) * error;
|
16460 | if (!powerbi.Double.lessWithPrecision(itemContextualWidth, widthToScroll, DimensionLayoutManager._pixelPrecision)) {
|
16461 | var visibleRatio = startIndex === i ? 1 - this.dimension.getFractionScrollOffset() : 1;
|
16462 | newScrollOffset = this.dimension.getValidScrollOffset(this.dimension.scrollOffset + (i - startIndex) + widthToScroll * visibleRatio / itemContextualWidth);
|
16463 | break;
|
16464 | }
|
16465 | widthToScroll -= itemContextualWidth;
|
16466 | }
|
16467 | this._alignToEnd = !withinThreshold;
|
16468 | }
|
16469 | return newScrollOffset;
|
16470 | }, Object.defineProperty(DimensionLayoutManager.prototype, "dimension", {
|
16471 | get: function() {
|
16472 | return null;
|
16473 | },
|
16474 | enumerable: !0,
|
16475 | configurable: !0
|
16476 | }), Object.defineProperty(DimensionLayoutManager.prototype, "otherLayoutManager", {
|
16477 | get: function() {
|
16478 | return this.dimension.otherDimension.layoutManager;
|
16479 | },
|
16480 | enumerable: !0,
|
16481 | configurable: !0
|
16482 | }), Object.defineProperty(DimensionLayoutManager.prototype, "contextualWidthToFill", {
|
16483 | get: function() {
|
16484 | return this._contextualWidthToFill;
|
16485 | },
|
16486 | enumerable: !0,
|
16487 | configurable: !0
|
16488 | }), DimensionLayoutManager.prototype.getGridScale = function() {
|
16489 | return 0;
|
16490 | }, Object.defineProperty(DimensionLayoutManager.prototype, "otherScrollbarContextualWidth", {
|
16491 | get: function() {
|
16492 | return 0;
|
16493 | },
|
16494 | enumerable: !0,
|
16495 | configurable: !0
|
16496 | }), DimensionLayoutManager.prototype.getActualContextualWidth = function(gridContextualWidth) {
|
16497 | return this._isAutoSized() && !this.canScroll(gridContextualWidth) ? gridContextualWidth : this._contextualWidthToFill;
|
16498 | }, DimensionLayoutManager.prototype.canScroll = function(gridContextualWidth) {
|
16499 | return !1;
|
16500 | }, DimensionLayoutManager.prototype.calculateSizes = function() {
|
16501 | this.fixedSizeEnabled && (this.calculateContextualWidths(), this.calculateSpans());
|
16502 | }, DimensionLayoutManager.prototype._calculateSize = function(item) {
|
16503 | return null;
|
16504 | }, DimensionLayoutManager.prototype.calculateContextualWidths = function() {
|
16505 | for (var items = this._getRealizedItems(), count = items.length, i = 0; count > i; i++) {
|
16506 | var item = items[i];
|
16507 | this.measureEnabled && item.setAligningContextualWidth(-1), this._calculateSize(item);
|
16508 | }
|
16509 | }, DimensionLayoutManager.prototype.calculateSpans = function() {
|
16510 | this.measureEnabled && (this.updateNonScrollableItemsSpans(), this.updateScrollableItemsSpans());
|
16511 | }, DimensionLayoutManager.prototype.updateNonScrollableItemsSpans = function() {
|
16512 | for (var otherDimensionItems = this.otherLayoutManager._getRealizedItems(), otherDimensionItemsCount = otherDimensionItems.length, startIndex = this.dimension.getDepth(), i = startIndex; otherDimensionItemsCount > i; i++) {
|
16513 | var otherDimensionItem = otherDimensionItems[i];
|
16514 | this.updateSpans(otherDimensionItem, otherDimensionItem.getHeaders(), !1);
|
16515 | }
|
16516 | }, DimensionLayoutManager.prototype.updateScrollableItemsSpans = function() {
|
16517 | for (var otherRealizedItems = this.otherLayoutManager._getRealizedItems(), otherRealizedItemsCount = Math.min(this.dimension.getDepth(), otherRealizedItems.length), i = 0; otherRealizedItemsCount > i; i++) {
|
16518 | var otherRealizedItem = otherRealizedItems[i];
|
16519 | this.updateSpans(otherRealizedItem, otherRealizedItem.getOtherDimensionHeaders(), !0);
|
16520 | }
|
16521 | }, DimensionLayoutManager.prototype.fixSizes = function() {
|
16522 | if (this.fixedSizeEnabled) for (var items = this._getRealizedItems(), count = items.length, i = count - 1; i >= 0; i--) items[i].fixSize();
|
16523 | }, DimensionLayoutManager.prototype.updateSpans = function(otherRealizedItem, cells, considerScrolling) {
|
16524 | for (var realizedItems = this._getRealizedItems(), cellCount = cells.length, j = 0; cellCount > j; j++) {
|
16525 | var cell = cells[j], owner = otherRealizedItem.getOtherDimensionOwner(cell), span = owner.getCellContextualSpan(cell);
|
16526 | if (span > 1) for (var totalSizeInSpan = 0, startIndex = owner.getIndex(this._grid), k = 0; span > k; k++) {
|
16527 | var item = realizedItems[k + startIndex], childWidth = item.getContentContextualWidth();
|
16528 | considerScrolling && 0 === j && 0 === k && (childWidth = Math.floor((1 - this.dimension.getFractionScrollOffset()) * childWidth)),
|
16529 | totalSizeInSpan += childWidth, k === span - 1 && this.updateLastChildSize(cell, item, totalSizeInSpan);
|
16530 | }
|
16531 | }
|
16532 | }, DimensionLayoutManager.prototype.updateLastChildSize = function(spanningCell, item, totalSpanSize) {
|
16533 | var delta = item.getCellIContentContextualWidth(spanningCell) - totalSpanSize;
|
16534 | delta > 0 && item.setAligningContextualWidth(Math.max(item.getAligningContextualWidth(), delta + item.getContentContextualWidth()));
|
16535 | }, DimensionLayoutManager._pixelPrecision = 1.0001, DimensionLayoutManager._scrollOffsetPrecision = .01,
|
16536 | DimensionLayoutManager;
|
16537 | }();
|
16538 | internal.DimensionLayoutManager = DimensionLayoutManager;
|
16539 | var ResizeState = function() {
|
16540 | function ResizeState(column, width, scale) {
|
16541 | this.column = column, this.item = column.getLeafItem(), this.itemType = column.itemType,
|
16542 | this.startColumnWidth = width, this.resizingDelta = 0, this.animationFrame = null,
|
16543 | this.scale = scale;
|
16544 | }
|
16545 | return ResizeState.prototype.getNewSize = function() {
|
16546 | return this.startColumnWidth + this.resizingDelta;
|
16547 | }, ResizeState;
|
16548 | }();
|
16549 | internal.ResizeState = ResizeState;
|
16550 | var ColumnLayoutManager = function(_super) {
|
16551 | function ColumnLayoutManager(owner, grid, realizationManager) {
|
16552 | _super.call(this, owner, grid, realizationManager), realizationManager.owner = this,
|
16553 | this.fillProportionally = !1, this._resizeState = null;
|
16554 | }
|
16555 | return __extends(ColumnLayoutManager, _super), Object.defineProperty(ColumnLayoutManager.prototype, "dimension", {
|
16556 | get: function() {
|
16557 | return this.owner.owner.columnDimension;
|
16558 | },
|
16559 | enumerable: !0,
|
16560 | configurable: !0
|
16561 | }), ColumnLayoutManager.prototype.isResizing = function() {
|
16562 | return null !== this._resizeState;
|
16563 | }, Object.defineProperty(ColumnLayoutManager.prototype, "fillProportionally", {
|
16564 | get: function() {
|
16565 | return this._grid.fillColumnsProportionally;
|
16566 | },
|
16567 | set: function(value) {
|
16568 | this._grid.fillColumnsProportionally = value;
|
16569 | },
|
16570 | enumerable: !0,
|
16571 | configurable: !0
|
16572 | }), ColumnLayoutManager.prototype.getGridScale = function() {
|
16573 | return this._grid._presenter.getScreenToCssRatioX();
|
16574 | }, Object.defineProperty(ColumnLayoutManager.prototype, "otherScrollbarContextualWidth", {
|
16575 | get: function() {
|
16576 | return this.dimension.otherDimension.scrollbar.visible ? controls.HTMLElementUtils.getElementWidth(this.dimension.otherDimension.scrollbar.element) : 0;
|
16577 | },
|
16578 | enumerable: !0,
|
16579 | configurable: !0
|
16580 | }), ColumnLayoutManager.prototype._getRealizedItems = function() {
|
16581 | return this._grid.realizedColumns || (this._grid.realizedColumns = []), this._grid.realizedColumns;
|
16582 | }, ColumnLayoutManager.prototype._moveElementsToBottom = function(moveFromIndex, count) {
|
16583 | this._grid.moveColumnsToEnd(moveFromIndex, count);
|
16584 | }, ColumnLayoutManager.prototype._moveElementsToTop = function(moveToIndex, count) {
|
16585 | this._grid.moveColumnsToStart(moveToIndex, count);
|
16586 | }, ColumnLayoutManager.prototype._requiresMeasure = function() {
|
16587 | return !this.isScrolling() && !this.otherLayoutManager.isScrolling() || this.isScrolling() || this.isResizing();
|
16588 | }, ColumnLayoutManager.prototype.getGridContextualWidth = function() {
|
16589 | return this._grid.getWidth();
|
16590 | }, ColumnLayoutManager.prototype.getFirstVisibleColumn = function() {
|
16591 | return this._grid.realizedColumns[this._gridOffset];
|
16592 | }, ColumnLayoutManager.prototype._isAutoSized = function() {
|
16593 | return this.owner.owner.autoSizeWidth;
|
16594 | }, ColumnLayoutManager.prototype.applyScrolling = function() {
|
16595 | var columnOffset = this.dimension.getFractionScrollOffset(), firstVisibleColumnWidth = 0;
|
16596 | if (0 !== columnOffset) {
|
16597 | var firstVisibleColumn = this.getFirstVisibleColumn();
|
16598 | if (void 0 !== firstVisibleColumn) {
|
16599 | firstVisibleColumnWidth = firstVisibleColumn.getContextualWidth();
|
16600 | var offsetInPixels = Math.ceil(-firstVisibleColumnWidth * columnOffset);
|
16601 | this.scroll(firstVisibleColumn, firstVisibleColumnWidth, offsetInPixels);
|
16602 | }
|
16603 | }
|
16604 | }, ColumnLayoutManager.prototype.scroll = function(firstVisibleColumn, width, offset) {
|
16605 | this.scrollCells(firstVisibleColumn._realizedColumnHeaders, width, offset), this.scrollBodyCells(this._grid.realizedRows, width, offset),
|
16606 | null !== firstVisibleColumn.footer && firstVisibleColumn.footer.scrollHorizontally(width, offset);
|
16607 | }, ColumnLayoutManager.prototype.scrollCells = function(cells, width, offset) {
|
16608 | for (var length = cells.length, i = 0; length > i; i++) cells[i].scrollHorizontally(width, offset);
|
16609 | }, ColumnLayoutManager.prototype.scrollBodyCells = function(rows, width, offset) {
|
16610 | for (var cells, cell, length = rows.length, i = 0; length > i; i++) cells = rows[i]._realizedBodyCells,
|
16611 | void 0 !== cells && (cell = cells[0], void 0 !== cell && cell.scrollHorizontally(width, offset));
|
16612 | }, ColumnLayoutManager.prototype.onStartResize = function(cell, currentX, currentY) {
|
16613 | this._resizeState = new ResizeState(cell._column, cell._column.getContentContextualWidth(), controls.HTMLElementUtils.getAccumulatedScale(this.owner.owner.container));
|
16614 | }, ColumnLayoutManager.prototype.onResize = function(cell, deltaX, deltaY) {
|
16615 | var _this = this;
|
16616 | this.isResizing() && (this._resizeState.resizingDelta = Math.round(Math.max(deltaX / this._resizeState.scale, ColumnLayoutManager.minColumnWidth - this._resizeState.startColumnWidth)),
|
16617 | null === this._resizeState.animationFrame && (this._resizeState.animationFrame = requestAnimationFrame(function() {
|
16618 | return _this.performResizing();
|
16619 | })));
|
16620 | }, ColumnLayoutManager.prototype.onEndResize = function(cell) {
|
16621 | this.isResizing() && null !== this._resizeState.animationFrame && this.performResizing(),
|
16622 | this.endResizing(), this._resizeState = null;
|
16623 | }, ColumnLayoutManager.prototype.onReset = function(cell) {
|
16624 | this._resizeState = new ResizeState(cell._column, -1, 1), cell._column.clearSize(),
|
16625 | this.endResizing(), this.owner.owner.refresh(!1), this._resizeState = null;
|
16626 | }, ColumnLayoutManager.prototype.updateItemToResizeState = function(realizedColumns) {
|
16627 | if (null !== this._resizeState) for (var columnCount = realizedColumns.length, hierarchyNavigator = this.owner.owner.hierarchyNavigator, startIndex = this.otherLayoutManager.dimension.getDepth(), i = startIndex; columnCount > i; i++) {
|
16628 | var column = realizedColumns[i];
|
16629 | if (column.columnHeaderOrCornerEquals(this._resizeState.itemType, this._resizeState.item, column.itemType, column.getLeafItem(), hierarchyNavigator) && column !== this._resizeState.column) {
|
16630 | this._resizeState.column = column, column.onResize(this._resizeState.getNewSize());
|
16631 | break;
|
16632 | }
|
16633 | }
|
16634 | }, ColumnLayoutManager.prototype.performResizing = function() {
|
16635 | if (null !== this._resizeState) {
|
16636 | this._resizeState.animationFrame = null;
|
16637 | var newSize = this._resizeState.getNewSize();
|
16638 | this._resizeState.column.onResize(newSize), this.owner.owner.refresh(!1);
|
16639 | }
|
16640 | }, ColumnLayoutManager.prototype.endResizing = function() {
|
16641 | if (null !== this._resizeState) {
|
16642 | var newSize = this._resizeState.getNewSize();
|
16643 | this._resizeState.column.onResizeEnd(newSize);
|
16644 | }
|
16645 | }, ColumnLayoutManager.prototype._sendDimensionsToControl = function() {
|
16646 | var gridContextualWidth = this.getGridContextualWidth(), widthToFill = this.getActualContextualWidth(gridContextualWidth), otherContextualHeight = this.getOtherHierarchyContextualHeight(), scale = this.getGridScale();
|
16647 | this.owner.owner.updateColumnDimensions(otherContextualHeight / scale, (widthToFill - otherContextualHeight) / scale, this.getViewSize(gridContextualWidth));
|
16648 | }, ColumnLayoutManager.prototype.getEstimatedHeaderWidth = function(label, headerIndex) {
|
16649 | return -1;
|
16650 | }, ColumnLayoutManager.prototype.getEstimatedBodyCellWidth = function(content) {
|
16651 | return -1;
|
16652 | }, ColumnLayoutManager.minColumnWidth = 10, ColumnLayoutManager;
|
16653 | }(DimensionLayoutManager);
|
16654 | internal.ColumnLayoutManager = ColumnLayoutManager;
|
16655 | var DashboardColumnLayoutManager = function(_super) {
|
16656 | function DashboardColumnLayoutManager() {
|
16657 | _super.apply(this, arguments);
|
16658 | }
|
16659 | return __extends(DashboardColumnLayoutManager, _super), DashboardColumnLayoutManager.prototype.getEstimatedHeaderWidth = function(label, headerIndex) {
|
16660 | return this.ignoreColumn(headerIndex) ? 0 : this.owner.getCellWidth(void 0);
|
16661 | }, DashboardColumnLayoutManager.prototype.getEstimatedBodyCellWidth = function(content) {
|
16662 | return this.owner.getCellWidth(void 0);
|
16663 | }, DashboardColumnLayoutManager.prototype.canScroll = function(gridContextualWidth) {
|
16664 | return !1;
|
16665 | }, DashboardColumnLayoutManager.prototype._calculateSize = function(item) {
|
16666 | var headerIndex = item.getIndex(this._grid), computedSize = 0;
|
16667 | return this.ignoreColumn(headerIndex) || (computedSize = this.owner.getContentWidth(void 0)),
|
16668 | item.onResize(computedSize), item.onResizeEnd(computedSize), computedSize;
|
16669 | }, DashboardColumnLayoutManager.prototype.ignoreColumn = function(headerIndex) {
|
16670 | return 0 === headerIndex && !this.owner.binder.hasRowGroups();
|
16671 | }, DashboardColumnLayoutManager;
|
16672 | }(ColumnLayoutManager);
|
16673 | internal.DashboardColumnLayoutManager = DashboardColumnLayoutManager;
|
16674 | var CanvasColumnLayoutManager = function(_super) {
|
16675 | function CanvasColumnLayoutManager() {
|
16676 | _super.apply(this, arguments);
|
16677 | }
|
16678 | return __extends(CanvasColumnLayoutManager, _super), CanvasColumnLayoutManager.prototype.getEstimatedHeaderWidth = function(label, headerIndex) {
|
16679 | return this.owner.getEstimatedTextWidth(label);
|
16680 | }, CanvasColumnLayoutManager.prototype.getEstimatedBodyCellWidth = function(content) {
|
16681 | return this.owner.getEstimatedTextWidth(content);
|
16682 | }, CanvasColumnLayoutManager.prototype.calculateContextualWidths = function() {
|
16683 | for (var items = this._getRealizedItems(), columnWidths = [], i = 0, len = items.length; len > i; i++) {
|
16684 | var item = items[i];
|
16685 | this.measureEnabled && item.setAligningContextualWidth(-1);
|
16686 | var queryName = controls.TablixColumnWidthManager.getColumnQueryName(item);
|
16687 | null != queryName && columnWidths.push({
|
16688 | queryName: queryName,
|
16689 | width: this._calculateSize(item),
|
16690 | isFixed: !1
|
16691 | });
|
16692 | }
|
16693 | this.owner.columnWidthsToPersist = columnWidths;
|
16694 | }, CanvasColumnLayoutManager.prototype.canScroll = function(gridContextualWidth) {
|
16695 | return !powerbi.Double.equalWithPrecision(this.dimension.scrollOffset, 0, DimensionLayoutManager._scrollOffsetPrecision) || this.getRealizedItemsCount() - this._gridOffset < this.dimension.getItemsCount() && this._contextualWidthToFill > 0 || powerbi.Double.greaterWithPrecision(gridContextualWidth, this._contextualWidthToFill, DimensionLayoutManager._pixelPrecision);
|
16696 | }, CanvasColumnLayoutManager.prototype._calculateSize = function(item) {
|
16697 | return item.calculateSize();
|
16698 | }, CanvasColumnLayoutManager;
|
16699 | }(ColumnLayoutManager);
|
16700 | internal.CanvasColumnLayoutManager = CanvasColumnLayoutManager;
|
16701 | var RowLayoutManager = function(_super) {
|
16702 | function RowLayoutManager(owner, grid, realizationManager) {
|
16703 | _super.call(this, owner, grid, realizationManager), realizationManager.owner = this;
|
16704 | }
|
16705 | return __extends(RowLayoutManager, _super), Object.defineProperty(RowLayoutManager.prototype, "dimension", {
|
16706 | get: function() {
|
16707 | return this.owner.owner.rowDimension;
|
16708 | },
|
16709 | enumerable: !0,
|
16710 | configurable: !0
|
16711 | }), RowLayoutManager.prototype.getGridScale = function() {
|
16712 | return this._grid._presenter.getScreenToCssRatioY();
|
16713 | }, Object.defineProperty(RowLayoutManager.prototype, "otherScrollbarContextualWidth", {
|
16714 | get: function() {
|
16715 | return this.dimension.otherDimension.scrollbar.visible ? controls.HTMLElementUtils.getElementHeight(this.dimension.otherDimension.scrollbar.element) : 0;
|
16716 | },
|
16717 | enumerable: !0,
|
16718 | configurable: !0
|
16719 | }), RowLayoutManager.prototype.startScrollingSession = function() {
|
16720 | _super.prototype.startScrollingSession.call(this);
|
16721 | }, RowLayoutManager.prototype._getRealizedItems = function() {
|
16722 | return this._grid.realizedRows || (this._grid.realizedRows = []), this._grid.realizedRows;
|
16723 | }, RowLayoutManager.prototype._moveElementsToBottom = function(moveFromIndex, count) {
|
16724 | this._grid.moveRowsToEnd(moveFromIndex, count);
|
16725 | }, RowLayoutManager.prototype._moveElementsToTop = function(moveToIndex, count) {
|
16726 | this._grid.moveRowsToStart(moveToIndex, count);
|
16727 | }, RowLayoutManager.prototype._requiresMeasure = function() {
|
16728 | return !this.isScrolling() && !this.otherLayoutManager.isScrolling() && !this.otherLayoutManager.isResizing() || this.isScrolling() && this.dimension.getIntegerScrollOffset() + (this.getRealizedItemsCount() - this._gridOffset) >= this.dimension.getItemsCount();
|
16729 | }, RowLayoutManager.prototype.getGridContextualWidth = function() {
|
16730 | return this._grid.getHeight();
|
16731 | }, RowLayoutManager.prototype.getFirstVisibleRow = function() {
|
16732 | return this._grid.realizedRows[this._gridOffset];
|
16733 | }, RowLayoutManager.prototype._isAutoSized = function() {
|
16734 | return this.owner.owner.autoSizeHeight;
|
16735 | }, RowLayoutManager.prototype.applyScrolling = function() {
|
16736 | var rowOffset = this.dimension.getFractionScrollOffset(), firstVisibleRowHeight = 0;
|
16737 | if (0 !== rowOffset) {
|
16738 | var firstVisibleRow = this.getFirstVisibleRow();
|
16739 | firstVisibleRow && (firstVisibleRowHeight = firstVisibleRow.getContextualWidth(),
|
16740 | this.scroll(firstVisibleRow, firstVisibleRowHeight, rowOffset));
|
16741 | }
|
16742 | }, RowLayoutManager.prototype.scroll = function(firstVisibleRow, height, offset) {
|
16743 | this.scrollCells(firstVisibleRow._realizedRowHeaders, height, offset), this.scrollCells(firstVisibleRow._realizedBodyCells, height, offset);
|
16744 | }, RowLayoutManager.prototype.scrollCells = function(cells, height, offset) {
|
16745 | for (var length = cells.length, i = 0; length > i; i++) cells[i].scrollVertically(height, offset);
|
16746 | }, RowLayoutManager.prototype.getFooterContextualWidth = function() {
|
16747 | return this.owner.owner.rowDimension.hasFooter() && this.owner.grid.footerRow ? this.owner.grid.footerRow.getContextualWidth() : 0;
|
16748 | }, RowLayoutManager.prototype.calculateContextualWidths = function() {
|
16749 | if (_super.prototype.calculateContextualWidths.call(this), this.fixedSizeEnabled) {
|
16750 | var footerRow = this._grid.footerRow;
|
16751 | footerRow && this._calculateSize(footerRow);
|
16752 | }
|
16753 | }, RowLayoutManager.prototype.fixSizes = function() {
|
16754 | _super.prototype.fixSizes.call(this), this.fixedSizeEnabled && this._grid.footerRow && this._grid.footerRow.fixSize();
|
16755 | }, RowLayoutManager.prototype._sendDimensionsToControl = function() {
|
16756 | var gridContextualWidth = this.getGridContextualWidth(), widthToFill = this.getActualContextualWidth(gridContextualWidth), otherContextualHeight = this.getOtherHierarchyContextualHeight(), scale = this.getGridScale();
|
16757 | this.owner.owner.updateRowDimensions(otherContextualHeight / scale, (widthToFill - otherContextualHeight) / scale, gridContextualWidth / scale, this.getViewSize(gridContextualWidth), this._grid.footerRow ? this._grid.footerRow.getContextualWidth() / scale : 0);
|
16758 | }, RowLayoutManager.prototype.getEstimatedHeaderWidth = function(label, headerIndex) {
|
16759 | return -1;
|
16760 | }, RowLayoutManager;
|
16761 | }(DimensionLayoutManager);
|
16762 | internal.RowLayoutManager = RowLayoutManager;
|
16763 | var DashboardRowLayoutManager = function(_super) {
|
16764 | function DashboardRowLayoutManager() {
|
16765 | _super.apply(this, arguments);
|
16766 | }
|
16767 | return __extends(DashboardRowLayoutManager, _super), DashboardRowLayoutManager.prototype.getEstimatedHeaderWidth = function(label, headerIndex) {
|
16768 | return this.getHeaderWidth(headerIndex);
|
16769 | }, DashboardRowLayoutManager.prototype.canScroll = function(gridContextualWidth) {
|
16770 | return !1;
|
16771 | }, DashboardRowLayoutManager.prototype._calculateSize = function(item) {
|
16772 | return item.calculateSize();
|
16773 | }, DashboardRowLayoutManager.prototype.getHeaderWidth = function(headerIndex) {
|
16774 | return 0 !== headerIndex || this.owner.binder.hasRowGroups() ? this.owner.getEstimatedTextWidth(void 0) : 0;
|
16775 | }, DashboardRowLayoutManager;
|
16776 | }(RowLayoutManager);
|
16777 | internal.DashboardRowLayoutManager = DashboardRowLayoutManager;
|
16778 | var CanvasRowLayoutManager = function(_super) {
|
16779 | function CanvasRowLayoutManager() {
|
16780 | _super.apply(this, arguments);
|
16781 | }
|
16782 | return __extends(CanvasRowLayoutManager, _super), CanvasRowLayoutManager.prototype.getEstimatedHeaderWidth = function(label, headerIndex) {
|
16783 | return this.owner.getEstimatedTextWidth(label);
|
16784 | }, CanvasRowLayoutManager.prototype.canScroll = function(gridContextualWidth) {
|
16785 | return !powerbi.Double.equalWithPrecision(this.dimension.scrollOffset, 0, DimensionLayoutManager._scrollOffsetPrecision) || this.getRealizedItemsCount() - this._gridOffset < this.dimension.getItemsCount() && this._contextualWidthToFill > 0 || powerbi.Double.greaterWithPrecision(gridContextualWidth, this._contextualWidthToFill, DimensionLayoutManager._pixelPrecision);
|
16786 | }, CanvasRowLayoutManager.prototype._calculateSize = function(item) {
|
16787 | return item.calculateSize();
|
16788 | }, CanvasRowLayoutManager;
|
16789 | }(RowLayoutManager);
|
16790 | internal.CanvasRowLayoutManager = CanvasRowLayoutManager;
|
16791 | var TablixLayoutManager = function() {
|
16792 | function TablixLayoutManager(binder, grid, columnLayoutManager, rowLayoutManager) {
|
16793 | this._allowHeaderResize = !0, this._binder = binder, this._grid = grid, this._columnLayoutManager = columnLayoutManager,
|
16794 | this._rowLayoutManager = rowLayoutManager, this._columnWidthsToPersist = [];
|
16795 | }
|
16796 | return TablixLayoutManager.prototype.initialize = function(owner) {
|
16797 | this._owner = owner, this._container = owner.container, this._gridHost = owner.contentHost,
|
16798 | this._footersHost = owner.footerHost, this._grid.initialize(owner, this._gridHost, this._footersHost);
|
16799 | }, Object.defineProperty(TablixLayoutManager.prototype, "owner", {
|
16800 | get: function() {
|
16801 | return this._owner;
|
16802 | },
|
16803 | enumerable: !0,
|
16804 | configurable: !0
|
16805 | }), Object.defineProperty(TablixLayoutManager.prototype, "binder", {
|
16806 | get: function() {
|
16807 | return this._binder;
|
16808 | },
|
16809 | enumerable: !0,
|
16810 | configurable: !0
|
16811 | }), Object.defineProperty(TablixLayoutManager.prototype, "columnWidthsToPersist", {
|
16812 | get: function() {
|
16813 | return this._columnWidthsToPersist;
|
16814 | },
|
16815 | set: function(columnWidths) {
|
16816 | this._columnWidthsToPersist = columnWidths;
|
16817 | },
|
16818 | enumerable: !0,
|
16819 | configurable: !0
|
16820 | }), TablixLayoutManager.prototype.getTablixClassName = function() {
|
16821 | return null;
|
16822 | }, TablixLayoutManager.prototype.getLayoutKind = function() {
|
16823 | return null;
|
16824 | }, TablixLayoutManager.prototype.getOrCreateColumnHeader = function(item, items, rowIndex, columnIndex) {
|
16825 | var hierarchyNav = this.owner.hierarchyNavigator, row = this._grid.getOrCreateRow(rowIndex), column = this._grid.getOrCreateColumn(columnIndex + this._columnLayoutManager._gridOffset), isLeaf = hierarchyNav.isLeaf(item), cell = row.getOrCreateColumnHeader(column, this._columnLayoutManager.isScrollableHeader(item, items, columnIndex), isLeaf), rowIdx = hierarchyNav.getLevel(item);
|
16826 | cell.position.row.index = cell.position.row.indexInSiblings = rowIdx, cell.position.row.isFirst = 0 === rowIdx,
|
16827 | cell.position.row.isLast = isLeaf;
|
16828 | var colIdx = hierarchyNav.getIndex(item);
|
16829 | return cell.position.column.index = cell.position.row.indexInSiblings = colIdx,
|
16830 | cell.position.column.isFirst = hierarchyNav.areAllParentsFirst(item, items), cell.position.column.isLast = hierarchyNav.areAllParentsLast(item, items),
|
16831 | this.enableCellHorizontalResize(isLeaf, cell), cell;
|
16832 | }, TablixLayoutManager.prototype.getOrCreateRowHeader = function(item, items, rowIndex, columnIndex) {
|
16833 | var hierarchyNav = this.owner.hierarchyNavigator, row = this._grid.getOrCreateRow(rowIndex + this._rowLayoutManager._gridOffset), column = this._grid.getOrCreateColumn(columnIndex), isLeaf = hierarchyNav.isLeaf(item), scrollable = this._rowLayoutManager.isScrollableHeader(item, items, rowIndex);
|
16834 | 0 === row.getRealizedCellCount() && this.alignRowHeaderCells(item, row);
|
16835 | var cell = row.getOrCreateRowHeader(column, scrollable, hierarchyNav.isLeaf(item)), rowIdx = hierarchyNav.getIndex(item);
|
16836 | cell.position.row.index = cell.position.row.indexInSiblings = rowIdx, cell.position.row.isFirst = hierarchyNav.areAllParentsFirst(item, items),
|
16837 | cell.position.row.isLast = hierarchyNav.areAllParentsLast(item, items);
|
16838 | var colIdx = hierarchyNav.getLevel(item);
|
16839 | return cell.position.column.index = cell.position.column.indexInSiblings = colIdx,
|
16840 | cell.position.column.isFirst = 0 === colIdx, cell.position.column.isLast = isLeaf,
|
16841 | cell.enableHorizontalResize(!1, this._columnLayoutManager), cell;
|
16842 | }, TablixLayoutManager.prototype.getOrCreateCornerCell = function(item, rowLevel, columnLevel) {
|
16843 | var row = this._grid.getOrCreateRow(columnLevel), column = this._grid.getOrCreateColumn(rowLevel), columnDepth = this._columnLayoutManager.dimension.getDepth(), isLeaf = columnLevel === columnDepth - 1, cell = row.getOrCreateCornerCell(column), rowIdx = columnLevel;
|
16844 | cell.position.row.index = cell.position.row.indexInSiblings = rowIdx, cell.position.row.isFirst = 0 === rowIdx,
|
16845 | cell.position.row.isLast = isLeaf;
|
16846 | var colIdx = rowLevel;
|
16847 | return cell.position.column.index = cell.position.column.indexInSiblings = colIdx,
|
16848 | cell.position.column.isFirst = 0 === colIdx, cell.position.column.isLast = colIdx === this._rowLayoutManager.dimension.getDepth() - 1,
|
16849 | this.enableCellHorizontalResize(isLeaf, cell), cell;
|
16850 | }, TablixLayoutManager.prototype.getOrCreateBodyCell = function(cellItem, rowItem, rowItems, rowIndex, columnIndex) {
|
16851 | var scrollable, row = this._grid.getOrCreateRow(rowIndex + this._rowLayoutManager._gridOffset), column = this._grid.getOrCreateColumn(columnIndex + this._columnLayoutManager._gridOffset);
|
16852 | scrollable = 0 === row._realizedBodyCells.length && 0 !== this._owner.columnDimension.getFractionScrollOffset() ? !0 : this._rowLayoutManager.isScrollableHeader(rowItem, rowItems, rowIndex);
|
16853 | var cell = row.getOrCreateBodyCell(column, scrollable);
|
16854 | return cell.position = cellItem.position, cell.enableHorizontalResize(!1, this._columnLayoutManager),
|
16855 | cell;
|
16856 | }, TablixLayoutManager.prototype.getOrCreateFooterBodyCell = function(cellItem, columnIndex) {
|
16857 | var scrollable, row = this._grid.getOrCreateFootersRow(), column = this._grid.getOrCreateColumn(columnIndex + this._columnLayoutManager._gridOffset);
|
16858 | scrollable = 0 === row._realizedBodyCells.length && 0 !== this._owner.columnDimension.getFractionScrollOffset();
|
16859 | var cell = row.getOrCreateFooterBodyCell(column, scrollable);
|
16860 | return cell.position = cellItem.position, cell.enableHorizontalResize(!1, this._columnLayoutManager),
|
16861 | cell;
|
16862 | }, TablixLayoutManager.prototype.getOrCreateFooterRowHeader = function(item, items) {
|
16863 | var row = this._grid.getOrCreateFootersRow(), column = this._grid.getOrCreateColumn(0), cell = row.getOrCreateFooterRowHeader(column);
|
16864 | return cell.position = void 0, cell.enableHorizontalResize(!1, this._columnLayoutManager),
|
16865 | cell;
|
16866 | }, TablixLayoutManager.prototype.getVisibleWidth = function() {
|
16867 | return -1;
|
16868 | }, TablixLayoutManager.prototype.getVisibleHeight = function() {
|
16869 | return -1;
|
16870 | }, TablixLayoutManager.prototype.updateColumnCount = function(rowDimension, columnDimension) {},
|
16871 | TablixLayoutManager.prototype.updateViewport = function(viewport) {}, TablixLayoutManager.prototype.getEstimatedRowHeight = function() {
|
16872 | return -1;
|
16873 | }, TablixLayoutManager.prototype.getCellWidth = function(cell) {
|
16874 | return -1;
|
16875 | }, TablixLayoutManager.prototype.getContentWidth = function(cell) {
|
16876 | return -1;
|
16877 | }, TablixLayoutManager.prototype.adjustContentSize = function(hasImage) {}, TablixLayoutManager.prototype.alignRowHeaderCells = function(item, currentRow) {
|
16878 | var index = currentRow.getRowHeaderLeafIndex();
|
16879 | if (-1 !== index) {
|
16880 | var rowDimension = this._owner.rowDimension, leaf = rowDimension.getFirstVisibleChildLeaf(item);
|
16881 | this.owner.hierarchyNavigator.headerItemEquals(leaf, currentRow.getAllocatedCellAt(index).item) && currentRow.moveCellsBy(this.owner.hierarchyNavigator.getLevel(leaf) - this.owner.hierarchyNavigator.getLevel(item) - index);
|
16882 | }
|
16883 | }, Object.defineProperty(TablixLayoutManager.prototype, "grid", {
|
16884 | get: function() {
|
16885 | return this._grid;
|
16886 | },
|
16887 | enumerable: !0,
|
16888 | configurable: !0
|
16889 | }), Object.defineProperty(TablixLayoutManager.prototype, "rowLayoutManager", {
|
16890 | get: function() {
|
16891 | return this._rowLayoutManager;
|
16892 | },
|
16893 | enumerable: !0,
|
16894 | configurable: !0
|
16895 | }), Object.defineProperty(TablixLayoutManager.prototype, "columnLayoutManager", {
|
16896 | get: function() {
|
16897 | return this._columnLayoutManager;
|
16898 | },
|
16899 | enumerable: !0,
|
16900 | configurable: !0
|
16901 | }), TablixLayoutManager.prototype.showEmptySpaceHeader = function() {
|
16902 | return !1;
|
16903 | }, TablixLayoutManager.prototype.onStartRenderingSession = function(scrollingDimension, parentElement, clear) {
|
16904 | if (this.showEmptySpaceHeader()) {
|
16905 | var cell = this._grid.emptySpaceHeaderCell;
|
16906 | cell && this._binder.unbindEmptySpaceHeaderCell(cell), cell = this._grid.emptySpaceFooterCell,
|
16907 | cell && this._binder.unbindEmptySpaceFooterCell(cell), this._grid.HideEmptySpaceCells();
|
16908 | }
|
16909 | this._scrollingDimension = scrollingDimension, this._scrollingDimension && this._scrollingDimension.layoutManager.startScrollingSession(),
|
16910 | this._rowLayoutManager.onStartRenderingSession(), this._columnLayoutManager.onStartRenderingSession(),
|
16911 | this._grid.onStartRenderingSession(clear);
|
16912 | var measureEnabled = this._columnLayoutManager.measureEnabled || this._rowLayoutManager.measureEnabled;
|
16913 | measureEnabled && this.measureSampleText(parentElement);
|
16914 | }, TablixLayoutManager.prototype.onEndRenderingSession = function() {
|
16915 | if (this._rowLayoutManager.onEndRenderingSession(), this._columnLayoutManager.onEndRenderingSession(),
|
16916 | this._scrollingDimension && this._scrollingDimension.layoutManager.endScrollingSession(),
|
16917 | this._scrollingDimension = null, this.showEmptySpaceHeader()) {
|
16918 | var emptySpace = this._columnLayoutManager.contextualWidthToFill - this._columnLayoutManager.getGridContextualWidth();
|
16919 | if (emptySpace > 0) {
|
16920 | this._grid.ShowEmptySpaceCells(this._owner.columnDimension.getDepth(), emptySpace);
|
16921 | var cell = this._grid.emptySpaceHeaderCell;
|
16922 | cell && this._binder.bindEmptySpaceHeaderCell(cell), cell = this._grid.emptySpaceFooterCell,
|
16923 | cell && this._binder.bindEmptySpaceFooterCell(cell);
|
16924 | }
|
16925 | }
|
16926 | }, TablixLayoutManager.prototype.onStartRenderingIteration = function(clear) {
|
16927 | this._rowLayoutManager.onStartRenderingIteration(clear, this.getVisibleHeight()),
|
16928 | this._columnLayoutManager.onStartRenderingIteration(clear, this.getVisibleWidth()),
|
16929 | this._grid.onStartRenderingIteration();
|
16930 | }, TablixLayoutManager.prototype.onEndRenderingIteration = function() {
|
16931 | return this._grid.onEndRenderingIteration(), this._columnLayoutManager.calculateSizes(),
|
16932 | this._rowLayoutManager.calculateSizes(), this._columnLayoutManager.fixSizes(), this._rowLayoutManager.fixSizes(),
|
16933 | this._columnLayoutManager.updateItemToResizeState(this._grid.realizedColumns), this._columnLayoutManager.applyScrolling(),
|
16934 | this._rowLayoutManager.applyScrolling(), this._columnLayoutManager.onEndRenderingIteration(),
|
16935 | this._rowLayoutManager.onEndRenderingIteration(), this._columnLayoutManager.done && this._rowLayoutManager.done;
|
16936 | }, TablixLayoutManager.prototype.onCornerCellRealized = function(item, cell) {
|
16937 | var columnLeaf = this.owner.hierarchyNavigator.isColumnHierarchyLeaf(item), rowLeaf = this.owner.hierarchyNavigator.isRowHierarchyLeaf(item);
|
16938 | columnLeaf && cell._column.OnLeafRealized(this._owner.hierarchyNavigator), this._columnLayoutManager.onCornerCellRealized(item, cell, columnLeaf),
|
16939 | this._rowLayoutManager.onCornerCellRealized(item, cell, rowLeaf);
|
16940 | }, TablixLayoutManager.prototype.onRowHeaderRealized = function(item, cell) {
|
16941 | var hierarchyNavigator = this._owner.hierarchyNavigator, leaf = hierarchyNavigator.isLeaf(item), tablixCell = cell;
|
16942 | tablixCell.colSpan > 1 && tablixCell.setContainerWidth(-1), this._rowLayoutManager.onHeaderRealized(item, cell, leaf);
|
16943 | }, TablixLayoutManager.prototype.onRowHeaderFooterRealized = function(item, cell) {},
|
16944 | TablixLayoutManager.prototype.onColumnHeaderRealized = function(item, cell) {
|
16945 | var hierarchyNavigator = this._owner.hierarchyNavigator, leaf = hierarchyNavigator.isLeaf(item);
|
16946 | leaf && cell._column.OnLeafRealized(this._owner.hierarchyNavigator), this._columnLayoutManager.onHeaderRealized(item, cell, leaf);
|
16947 | }, TablixLayoutManager.prototype.onBodyCellRealized = function(item, cell) {}, TablixLayoutManager.prototype.onBodyCellFooterRealized = function(item, cell) {},
|
16948 | TablixLayoutManager.prototype.setAllowHeaderResize = function(value) {
|
16949 | this._allowHeaderResize = value;
|
16950 | }, TablixLayoutManager.prototype.enableCellHorizontalResize = function(isLeaf, cell) {
|
16951 | var enableCellHorizontalResize = isLeaf && this._allowHeaderResize;
|
16952 | cell.enableHorizontalResize(enableCellHorizontalResize, this._columnLayoutManager);
|
16953 | }, TablixLayoutManager.prototype.getEstimatedTextWidth = function(label) {
|
16954 | return -1;
|
16955 | }, TablixLayoutManager.prototype.measureSampleText = function(parentElement) {},
|
16956 | TablixLayoutManager;
|
16957 | }();
|
16958 | internal.TablixLayoutManager = TablixLayoutManager;
|
16959 | var DashboardTablixLayoutManager = function(_super) {
|
16960 | function DashboardTablixLayoutManager(binder, sizeComputationManager, grid, rowRealizationManager, columnRealizationManager) {
|
16961 | var dashboardColumnLayoutManager = new DashboardColumnLayoutManager(null, grid, columnRealizationManager), dashboardRowLayoutManager = new DashboardRowLayoutManager(null, grid, rowRealizationManager);
|
16962 | _super.call(this, binder, grid, dashboardColumnLayoutManager, dashboardRowLayoutManager),
|
16963 | dashboardColumnLayoutManager.owner = this, dashboardRowLayoutManager.owner = this,
|
16964 | this._sizeComputationManager = sizeComputationManager;
|
16965 | }
|
16966 | return __extends(DashboardTablixLayoutManager, _super), DashboardTablixLayoutManager.createLayoutManager = function(binder) {
|
16967 | var sizeComputationManager = new SizeComputationManager();
|
16968 | return new DashboardTablixLayoutManager(binder, sizeComputationManager, new internal.TablixGrid(new internal.DashboardTablixGridPresenter(sizeComputationManager)), new internal.RowRealizationManager(binder), new internal.ColumnRealizationManager(binder));
|
16969 | }, DashboardTablixLayoutManager.prototype.getTablixClassName = function() {
|
16970 | return "tablixDashboard";
|
16971 | }, DashboardTablixLayoutManager.prototype.getLayoutKind = function() {
|
16972 | return 1;
|
16973 | }, DashboardTablixLayoutManager.prototype.showEmptySpaceHeader = function() {
|
16974 | return !1;
|
16975 | }, DashboardTablixLayoutManager.prototype.measureSampleText = function(parentElement) {
|
16976 | var textProperties = powerbi.TextMeasurementService.getSvgMeasurementProperties(parentElement);
|
16977 | this._characterHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(textProperties),
|
16978 | this._sizeComputationManager.updateRowHeight(this._characterHeight);
|
16979 | var actualTextSize = PixelConverter.toPoint(parseFloat(textProperties.fontSize)), scalingFactor = actualTextSize / controls.TablixDefaultTextSize;
|
16980 | this._sizeComputationManager.updateScalingFactor(powerbi.Double.toIncrement(scalingFactor, .05));
|
16981 | }, DashboardTablixLayoutManager.prototype.getVisibleWidth = function() {
|
16982 | return this._sizeComputationManager.visibleWidth;
|
16983 | }, DashboardTablixLayoutManager.prototype.getVisibleHeight = function() {
|
16984 | return this._sizeComputationManager.visibleHeight;
|
16985 | }, DashboardTablixLayoutManager.prototype.getCellWidth = function(cell) {
|
16986 | return this._sizeComputationManager.cellWidth;
|
16987 | }, DashboardTablixLayoutManager.prototype.getContentWidth = function(cell) {
|
16988 | return this._sizeComputationManager.contentWidth;
|
16989 | }, DashboardTablixLayoutManager.prototype.getEstimatedTextWidth = function(label) {
|
16990 | return this._sizeComputationManager.contentWidth;
|
16991 | }, DashboardTablixLayoutManager.prototype.adjustContentSize = function(hasImage) {
|
16992 | this._sizeComputationManager.hasImageContent = hasImage;
|
16993 | }, DashboardTablixLayoutManager.prototype.updateColumnCount = function(rowDimension, columnDimension) {
|
16994 | var rowDimensionDepth = rowDimension ? rowDimension.getDepth() : 0, columnInstances = columnDimension ? columnDimension.getItemsCount() : 0, totalColumnCount = rowDimensionDepth + columnInstances;
|
16995 | this.binder.hasRowGroups() || totalColumnCount--, this._sizeComputationManager.updateColumnCount(totalColumnCount);
|
16996 | }, DashboardTablixLayoutManager.prototype.updateViewport = function(viewport) {
|
16997 | this._sizeComputationManager.updateViewport(viewport);
|
16998 | }, DashboardTablixLayoutManager.prototype.getEstimatedRowHeight = function() {
|
16999 | return this._characterHeight;
|
17000 | }, DashboardTablixLayoutManager;
|
17001 | }(TablixLayoutManager);
|
17002 | internal.DashboardTablixLayoutManager = DashboardTablixLayoutManager;
|
17003 | var CanvasTablixLayoutManager = function(_super) {
|
17004 | function CanvasTablixLayoutManager(binder, grid, rowRealizationManager, columnRealizationManager) {
|
17005 | var canvasColumnLayoutManager = new CanvasColumnLayoutManager(null, grid, columnRealizationManager), canvasRowLayoutManager = new CanvasRowLayoutManager(null, grid, rowRealizationManager);
|
17006 | _super.call(this, binder, grid, canvasColumnLayoutManager, canvasRowLayoutManager),
|
17007 | canvasColumnLayoutManager.owner = this, canvasRowLayoutManager.owner = this;
|
17008 | }
|
17009 | return __extends(CanvasTablixLayoutManager, _super), CanvasTablixLayoutManager.createLayoutManager = function(binder, columnWidthManager) {
|
17010 | return new CanvasTablixLayoutManager(binder, new internal.TablixGrid(new controls.internal.CanvasTablixGridPresenter(columnWidthManager)), new internal.RowRealizationManager(binder), new internal.ColumnRealizationManager(binder));
|
17011 | }, CanvasTablixLayoutManager.prototype.getTablixClassName = function() {
|
17012 | return "tablixCanvas";
|
17013 | }, CanvasTablixLayoutManager.prototype.getLayoutKind = function() {
|
17014 | return 0;
|
17015 | }, CanvasTablixLayoutManager.prototype.measureSampleText = function(parentElement) {
|
17016 | var textDiv = controls.internal.TablixUtils.createDiv();
|
17017 | textDiv.style.cssFloat = "left", textDiv.style.whiteSpace = "nowrap", textDiv.style.overflow = "hidden",
|
17018 | textDiv.style.lineHeight = "normal", parentElement.appendChild(textDiv);
|
17019 | var textNode = document.createTextNode("a");
|
17020 | textDiv.appendChild(textNode), this.characterWidth = controls.HTMLElementUtils.getElementWidth(textDiv),
|
17021 | this.characterHeight = controls.HTMLElementUtils.getElementHeight(textDiv), textDiv.removeChild(textNode),
|
17022 | parentElement.removeChild(textDiv);
|
17023 | }, CanvasTablixLayoutManager.prototype.showEmptySpaceHeader = function() {
|
17024 | return !this._columnLayoutManager.fillProportionally;
|
17025 | }, CanvasTablixLayoutManager.prototype.getVisibleWidth = function() {
|
17026 | return this._columnLayoutManager.measureEnabled ? this._owner.autoSizeWidth && this._owner.maxWidth ? this._owner.maxWidth : controls.HTMLElementUtils.getElementWidth(this._container) : -1;
|
17027 | }, CanvasTablixLayoutManager.prototype.getVisibleHeight = function() {
|
17028 | return this._rowLayoutManager.measureEnabled ? this._owner.autoSizeHeight && this._owner.maxHeight ? this._owner.maxHeight : controls.HTMLElementUtils.getElementHeight(this._container) : -1;
|
17029 | }, CanvasTablixLayoutManager.prototype.getCellWidth = function(cell) {
|
17030 | return cell.containerWidth;
|
17031 | }, CanvasTablixLayoutManager.prototype.getContentWidth = function(cell) {
|
17032 | return cell.contentWidth;
|
17033 | }, CanvasTablixLayoutManager.prototype.getEstimatedTextWidth = function(text) {
|
17034 | return text ? text.length * this.characterWidth : 0;
|
17035 | }, CanvasTablixLayoutManager.prototype.updateColumnCount = function(rowDimension, columnDimension) {},
|
17036 | CanvasTablixLayoutManager.prototype.updateViewport = function(viewport) {}, CanvasTablixLayoutManager.prototype.getEstimatedRowHeight = function() {
|
17037 | return this.characterHeight;
|
17038 | }, CanvasTablixLayoutManager;
|
17039 | }(TablixLayoutManager);
|
17040 | internal.CanvasTablixLayoutManager = CanvasTablixLayoutManager;
|
17041 | }(internal = controls.internal || (controls.internal = {}));
|
17042 | }(controls = visuals.controls || (visuals.controls = {}));
|
17043 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
17044 | }(powerbi || (powerbi = {}));
|
17045 | }, function(module, exports) {
|
17046 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi, InJs = (window.powerbitests,
|
17047 | window.InJs);
|
17048 | window.debug, window.jasmine, window.Microsoft;
|
17049 | !function(powerbi) {
|
17050 | var visuals;
|
17051 | !function(visuals) {
|
17052 | var controls;
|
17053 | !function(controls) {
|
17054 | var HTMLElementUtils;
|
17055 | !function(HTMLElementUtils) {
|
17056 | function clearChildren(element) {
|
17057 | if (element) for (;element.hasChildNodes(); ) element.removeChild(element.firstChild);
|
17058 | }
|
17059 | function setElementTop(element, top) {
|
17060 | element.style.top = top + "px";
|
17061 | }
|
17062 | function setElementLeft(element, left) {
|
17063 | element.style.left = left + "px";
|
17064 | }
|
17065 | function setElementHeight(element, height) {
|
17066 | HTMLElementUtils.isAutoSize(height) ? element.style.height = "" : element.style.height = height + "px";
|
17067 | }
|
17068 | function setElementWidth(element, width) {
|
17069 | HTMLElementUtils.isAutoSize(width) ? element.style.width = "" : element.style.width = width + "px";
|
17070 | }
|
17071 | function getElementWidth(element) {
|
17072 | return element.offsetWidth;
|
17073 | }
|
17074 | function getElementHeight(element) {
|
17075 | return element.offsetHeight;
|
17076 | }
|
17077 | function isAutoSize(size) {
|
17078 | return -1 === size;
|
17079 | }
|
17080 | function getAccumulatedScale(element) {
|
17081 | for (var scale = 1; element; ) scale *= HTMLElementUtils.getScale(element), element = element.parentElement;
|
17082 | return scale;
|
17083 | }
|
17084 | function getScale(element) {
|
17085 | element = $(element);
|
17086 | var str = element.css("-webkit-transform") || element.css("-moz-transform") || element.css("-ms-transform") || element.css("-o-transform") || element.css("transform");
|
17087 | return str && (str.match(/\d*\.\d*/) && Number(str.match(/\d*\.\d*/)[0]) || str.match(/\d+/) && Number(str.match(/\d+/)[0])) || 1;
|
17088 | }
|
17089 | HTMLElementUtils.clearChildren = clearChildren, HTMLElementUtils.setElementTop = setElementTop,
|
17090 | HTMLElementUtils.setElementLeft = setElementLeft, HTMLElementUtils.setElementHeight = setElementHeight,
|
17091 | HTMLElementUtils.setElementWidth = setElementWidth, HTMLElementUtils.getElementWidth = getElementWidth,
|
17092 | HTMLElementUtils.getElementHeight = getElementHeight, HTMLElementUtils.isAutoSize = isAutoSize,
|
17093 | HTMLElementUtils.getAccumulatedScale = getAccumulatedScale, HTMLElementUtils.getScale = getScale;
|
17094 | }(HTMLElementUtils = controls.HTMLElementUtils || (controls.HTMLElementUtils = {}));
|
17095 | }(controls = visuals.controls || (visuals.controls = {}));
|
17096 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
17097 | }(powerbi || (powerbi = {}));
|
17098 | var powerbi;
|
17099 | !function(powerbi) {
|
17100 | var visuals;
|
17101 | !function(visuals) {
|
17102 | var controls;
|
17103 | !function(controls) {
|
17104 | var internal;
|
17105 | !function(internal) {
|
17106 | var TablixObjects, DomFactory = InJs.DomFactory, DataViewObjectDefinitions = powerbi.data.DataViewObjectDefinitions, DataViewRoleWildCard = powerbi.data.DataViewRoleWildcard;
|
17107 | !function(TablixObjects) {
|
17108 | function getMetadadataObjects(dataview) {
|
17109 | return dataview && dataview.metadata ? dataview.metadata.objects : null;
|
17110 | }
|
17111 | function enumerateObjectRepetition(enumeration, dataView, tablixType) {
|
17112 | if (tablixType === controls.TablixType.Table) {
|
17113 | for (var columns = getTableColumnMetadata(dataView), _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
|
17114 | var column = columns_1[_i], repetition = {
|
17115 | selector: {
|
17116 | data: [ DataViewRoleWildCard.fromRoles([ "Values" ]) ],
|
17117 | metadata: column.queryName
|
17118 | },
|
17119 | objects: (_a = {}, _a[TablixObjects.ObjectValues] = {
|
17120 | formattingProperties: [ TablixObjects.PropValuesBackColor.propertyName ]
|
17121 | }, _a)
|
17122 | };
|
17123 | enumeration.push(repetition);
|
17124 | }
|
17125 | var _a;
|
17126 | }
|
17127 | }
|
17128 | function enumerateObjectInstances(options, enumeration, dataView, tablixType) {
|
17129 | var objects = getMetadadataObjects(dataView), totalsShown = !0;
|
17130 | switch (totalsShown = tablixType === controls.TablixType.Table ? shouldShowTableTotalsOption(dataView) && shouldShowTableTotals(objects) : shouldShowColumnSubtotalsOption(dataView) && shouldShowColumnSubtotals(objects) || shouldShowRowSubtotalsOption(dataView) && shouldShowRowSubtotals(objects),
|
17131 | options.objectName) {
|
17132 | case TablixObjects.ObjectGeneral:
|
17133 | enumerateGeneralOptions(enumeration, objects, tablixType, dataView);
|
17134 | break;
|
17135 |
|
17136 | case TablixObjects.ObjectGrid:
|
17137 | enumerateGridOptions(enumeration, objects, tablixType);
|
17138 | break;
|
17139 |
|
17140 | case TablixObjects.ObjectColumnHeaders:
|
17141 | enumerateColumnHeadersOptions(enumeration, objects);
|
17142 | break;
|
17143 |
|
17144 | case TablixObjects.ObjectRowHeaders:
|
17145 | enumerateRowHeadersOptions(enumeration, objects);
|
17146 | break;
|
17147 |
|
17148 | case TablixObjects.ObjectValues:
|
17149 | enumerateValuesOptions(enumeration, objects, tablixType);
|
17150 | break;
|
17151 |
|
17152 | case TablixObjects.ObjectTotal:
|
17153 | totalsShown && enumerateTotalOptions(enumeration, objects);
|
17154 | break;
|
17155 |
|
17156 | case TablixObjects.ObjectSubTotals:
|
17157 | totalsShown && enumerateSubTotalsOptions(enumeration, objects);
|
17158 | }
|
17159 | }
|
17160 | function enumerateGeneralOptions(enumeration, objects, tablixType, dataView) {
|
17161 | var visualObjectinstance = {
|
17162 | selector: null,
|
17163 | objectName: TablixObjects.ObjectGeneral,
|
17164 | properties: {
|
17165 | autoSizeColumnWidth: TablixObjects.PropGeneralAutoSizeColumns.getValue(objects),
|
17166 | textSize: TablixObjects.PropGeneralTextSize.getValue(objects)
|
17167 | }
|
17168 | }, properties = visualObjectinstance.properties;
|
17169 | switch (tablixType) {
|
17170 | case controls.TablixType.Table:
|
17171 | shouldShowTableTotalsOption(dataView) && (properties[TablixObjects.PropGeneralTableTotals.propertyName] = shouldShowTableTotals(objects));
|
17172 | break;
|
17173 |
|
17174 | case controls.TablixType.Matrix:
|
17175 | shouldShowRowSubtotalsOption(dataView) && (properties[TablixObjects.PropGeneralMatrixRowSubtotals.propertyName] = shouldShowRowSubtotals(objects)),
|
17176 | shouldShowColumnSubtotalsOption(dataView) && (properties[TablixObjects.PropGeneralMatrixColumnSubtotals.propertyName] = shouldShowColumnSubtotals(objects));
|
17177 | }
|
17178 | enumeration.pushInstance(visualObjectinstance);
|
17179 | }
|
17180 | function enumerateGridOptions(enumeration, objects, tablixType) {
|
17181 | var visualObjectinstance = {
|
17182 | selector: null,
|
17183 | objectName: TablixObjects.ObjectGeneral,
|
17184 | properties: {}
|
17185 | }, properties = visualObjectinstance.properties, verticalGridEnabled = TablixObjects.PropGridVertical.getValue(objects);
|
17186 | properties[TablixObjects.PropGridVertical.propertyName] = verticalGridEnabled, verticalGridEnabled && (properties[TablixObjects.PropGridVerticalColor.propertyName] = TablixObjects.PropGridVerticalColor.getValue(objects),
|
17187 | properties[TablixObjects.PropGridVerticalWeight.propertyName] = TablixObjects.PropGridVerticalWeight.getValue(objects));
|
17188 | var horizontalGridEnabled = (tablixType === controls.TablixType.Table ? TablixObjects.PropGridHorizontalTable : TablixObjects.PropGridHorizontalMatrix).getValue(objects);
|
17189 | properties[(tablixType === controls.TablixType.Table ? TablixObjects.PropGridHorizontalTable : TablixObjects.PropGridHorizontalMatrix).propertyName] = horizontalGridEnabled,
|
17190 | horizontalGridEnabled && (properties[TablixObjects.PropGridHorizontalColor.propertyName] = TablixObjects.PropGridHorizontalColor.getValue(objects),
|
17191 | properties[TablixObjects.PropGridHorizontalWeight.propertyName] = TablixObjects.PropGridHorizontalWeight.getValue(objects)),
|
17192 | properties[TablixObjects.PropGridRowPadding.propertyName] = TablixObjects.PropGridRowPadding.getValue(objects),
|
17193 | properties[TablixObjects.PropGridOutlineColor.propertyName] = TablixObjects.PropGridOutlineColor.getValue(objects),
|
17194 | properties[TablixObjects.PropGridOutlineWeight.propertyName] = TablixObjects.PropGridOutlineWeight.getValue(objects),
|
17195 | properties[TablixObjects.PropGridImageHeight.propertyName] = TablixObjects.PropGridImageHeight.getValue(objects),
|
17196 | enumeration.pushInstance(visualObjectinstance);
|
17197 | }
|
17198 | function enumerateColumnHeadersOptions(enumeration, objects) {
|
17199 | enumeration.pushInstance({
|
17200 | selector: null,
|
17201 | objectName: TablixObjects.ObjectColumnHeaders,
|
17202 | properties: {
|
17203 | fontColor: TablixObjects.PropColumnsFontColor.getValue(objects),
|
17204 | backColor: TablixObjects.PropColumnsBackColor.getValue(objects),
|
17205 | outline: TablixObjects.PropColumnsOutline.getValue(objects)
|
17206 | }
|
17207 | });
|
17208 | }
|
17209 | function enumerateRowHeadersOptions(enumeration, objects) {
|
17210 | enumeration.pushInstance({
|
17211 | selector: null,
|
17212 | objectName: TablixObjects.ObjectRowHeaders,
|
17213 | properties: {
|
17214 | fontColor: TablixObjects.PropRowsFontColor.getValue(objects),
|
17215 | backColor: TablixObjects.PropRowsBackColor.getValue(objects),
|
17216 | outline: TablixObjects.PropRowsOutline.getValue(objects)
|
17217 | }
|
17218 | });
|
17219 | }
|
17220 | function enumerateValuesOptions(enumeration, objects, tablixType) {
|
17221 | var instance = {
|
17222 | selector: null,
|
17223 | objectName: TablixObjects.ObjectValues,
|
17224 | properties: {
|
17225 | fontColorPrimary: TablixObjects.PropValuesFontColorPrimary.getValue(objects),
|
17226 | backColorPrimary: TablixObjects.PropValuesBackColorPrimary.getValue(objects),
|
17227 | fontColorSecondary: TablixObjects.PropValuesFontColorSecondary.getValue(objects),
|
17228 | backColorSecondary: TablixObjects.PropValuesBackColorSecondary.getValue(objects),
|
17229 | outline: TablixObjects.PropValuesOutline.getValue(objects)
|
17230 | }
|
17231 | };
|
17232 | tablixType === controls.TablixType.Table && (instance.properties[TablixObjects.PropValuesUrlIconProp.propertyName] = TablixObjects.PropValuesUrlIconProp.getValue(objects)),
|
17233 | enumeration.pushInstance(instance);
|
17234 | }
|
17235 | function enumerateTotalOptions(enumeration, objects) {
|
17236 | enumeration.pushInstance({
|
17237 | selector: null,
|
17238 | objectName: TablixObjects.ObjectTotal,
|
17239 | properties: {
|
17240 | fontColor: TablixObjects.PropTotalFontColor.getValue(objects),
|
17241 | backColor: TablixObjects.PropTotalBackColor.getValue(objects),
|
17242 | outline: TablixObjects.PropTotalOutline.getValue(objects)
|
17243 | }
|
17244 | });
|
17245 | }
|
17246 | function enumerateSubTotalsOptions(enumeration, objects) {
|
17247 | enumeration.pushInstance({
|
17248 | selector: null,
|
17249 | objectName: TablixObjects.ObjectSubTotals,
|
17250 | properties: {
|
17251 | fontColor: TablixObjects.PropSubTotalsFontColor.getValue(objects),
|
17252 | backColor: TablixObjects.PropSubTotalsBackColor.getValue(objects)
|
17253 | }
|
17254 | });
|
17255 | }
|
17256 | function getTableObjects(dataView) {
|
17257 | var objects = getMetadadataObjects(dataView), formattingProperties = {
|
17258 | general: {
|
17259 | autoSizeColumnWidth: TablixObjects.PropGeneralAutoSizeColumns.getValue(objects),
|
17260 | textSize: TablixObjects.PropGeneralTextSize.getValue(objects),
|
17261 | totals: shouldShowTableTotals(objects)
|
17262 | }
|
17263 | };
|
17264 | return formattingProperties.grid = {
|
17265 | gridVertical: TablixObjects.PropGridVertical.getValue(objects),
|
17266 | gridVerticalColor: TablixObjects.PropGridVerticalColor.getValue(objects),
|
17267 | gridVerticalWeight: TablixObjects.PropGridVerticalWeight.getValue(objects),
|
17268 | gridHorizontal: TablixObjects.PropGridHorizontalTable.getValue(objects),
|
17269 | gridHorizontalColor: TablixObjects.PropGridHorizontalColor.getValue(objects),
|
17270 | gridHorizontalWeight: TablixObjects.PropGridHorizontalWeight.getValue(objects),
|
17271 | outlineColor: TablixObjects.PropGridOutlineColor.getValue(objects),
|
17272 | outlineWeight: TablixObjects.PropGridOutlineWeight.getValue(objects),
|
17273 | rowPadding: TablixObjects.PropGridRowPadding.getValue(objects),
|
17274 | imageHeight: TablixObjects.PropGridImageHeight.getValue(objects)
|
17275 | }, formattingProperties.columnHeaders = {
|
17276 | fontColor: TablixObjects.PropColumnsFontColor.getValue(objects),
|
17277 | backColor: TablixObjects.PropColumnsBackColor.getValue(objects),
|
17278 | outline: TablixObjects.PropColumnsOutline.getValue(objects)
|
17279 | }, formattingProperties.values = {
|
17280 | fontColorPrimary: TablixObjects.PropValuesFontColorPrimary.getValue(objects),
|
17281 | backColorPrimary: TablixObjects.PropValuesBackColorPrimary.getValue(objects),
|
17282 | fontColorSecondary: TablixObjects.PropValuesFontColorSecondary.getValue(objects),
|
17283 | backColorSecondary: TablixObjects.PropValuesBackColorSecondary.getValue(objects),
|
17284 | outline: TablixObjects.PropValuesOutline.getValue(objects),
|
17285 | urlIcon: TablixObjects.PropValuesUrlIconProp.getValue(objects)
|
17286 | }, formattingProperties.total = {
|
17287 | fontColor: TablixObjects.PropTotalFontColor.getValue(objects),
|
17288 | backColor: TablixObjects.PropTotalBackColor.getValue(objects),
|
17289 | outline: TablixObjects.PropTotalOutline.getValue(objects)
|
17290 | }, formattingProperties;
|
17291 | }
|
17292 | function getMatrixObjects(dataView) {
|
17293 | var objects = getMetadadataObjects(dataView), formattingProperties = {
|
17294 | general: {
|
17295 | autoSizeColumnWidth: TablixObjects.PropGeneralAutoSizeColumns.getValue(objects),
|
17296 | textSize: TablixObjects.PropGeneralTextSize.getValue(objects),
|
17297 | rowSubtotals: shouldShowRowSubtotals(objects),
|
17298 | columnSubtotals: shouldShowColumnSubtotals(objects)
|
17299 | }
|
17300 | };
|
17301 | return formattingProperties.grid = {
|
17302 | gridVertical: TablixObjects.PropGridVertical.getValue(objects),
|
17303 | gridVerticalColor: TablixObjects.PropGridVerticalColor.getValue(objects),
|
17304 | gridVerticalWeight: TablixObjects.PropGridVerticalWeight.getValue(objects),
|
17305 | gridHorizontal: TablixObjects.PropGridHorizontalMatrix.getValue(objects),
|
17306 | gridHorizontalColor: TablixObjects.PropGridHorizontalColor.getValue(objects),
|
17307 | gridHorizontalWeight: TablixObjects.PropGridHorizontalWeight.getValue(objects),
|
17308 | outlineColor: TablixObjects.PropGridOutlineColor.getValue(objects),
|
17309 | outlineWeight: TablixObjects.PropGridOutlineWeight.getValue(objects),
|
17310 | rowPadding: TablixObjects.PropGridRowPadding.getValue(objects),
|
17311 | imageHeight: TablixObjects.PropGridImageHeight.getValue(objects)
|
17312 | }, formattingProperties.columnHeaders = {
|
17313 | fontColor: TablixObjects.PropColumnsFontColor.getValue(objects),
|
17314 | backColor: TablixObjects.PropColumnsBackColor.getValue(objects),
|
17315 | outline: TablixObjects.PropColumnsOutline.getValue(objects)
|
17316 | }, formattingProperties.rowHeaders = {
|
17317 | fontColor: TablixObjects.PropRowsFontColor.getValue(objects),
|
17318 | backColor: TablixObjects.PropRowsBackColor.getValue(objects),
|
17319 | outline: TablixObjects.PropRowsOutline.getValue(objects)
|
17320 | }, formattingProperties.values = {
|
17321 | fontColorPrimary: TablixObjects.PropValuesFontColorPrimary.getValue(objects),
|
17322 | backColorPrimary: TablixObjects.PropValuesBackColorPrimary.getValue(objects),
|
17323 | fontColorSecondary: TablixObjects.PropValuesFontColorSecondary.getValue(objects),
|
17324 | backColorSecondary: TablixObjects.PropValuesBackColorSecondary.getValue(objects),
|
17325 | outline: TablixObjects.PropValuesOutline.getValue(objects)
|
17326 | }, formattingProperties.subtotals = {
|
17327 | fontColor: TablixObjects.PropSubTotalsFontColor.getValue(objects),
|
17328 | backColor: TablixObjects.PropSubTotalsBackColor.getValue(objects),
|
17329 | outline: TablixObjects.PropSubTotalsOutline.getValue(objects)
|
17330 | }, formattingProperties;
|
17331 | }
|
17332 | function generateTablixDefaultObjects(tablixType) {
|
17333 | return {
|
17334 | general: [ {
|
17335 | selector: null,
|
17336 | properties: {
|
17337 | textSize: DataViewObjectDefinitions.encodePropertyValue(12, {
|
17338 | numeric: !0
|
17339 | }),
|
17340 | totals: DataViewObjectDefinitions.encodePropertyValue(!1, {
|
17341 | bool: !0
|
17342 | })
|
17343 | }
|
17344 | } ]
|
17345 | };
|
17346 | }
|
17347 | function getTextSizeInPx(textSize) {
|
17348 | return jsCommon.PixelConverter.fromPoint(textSize);
|
17349 | }
|
17350 | function shouldShowTableTotals(objects) {
|
17351 | return TablixObjects.PropGeneralTableTotals.getValue(objects);
|
17352 | }
|
17353 | function shouldShowTableTotalsOption(dataView) {
|
17354 | if (dataView && dataView.table && !_.isEmpty(dataView.table.columns)) {
|
17355 | var columns = dataView.table.columns;
|
17356 | if (_.some(columns, function(column) {
|
17357 | return column.discourageAggregationAcrossGroups;
|
17358 | })) return !1;
|
17359 | }
|
17360 | return !0;
|
17361 | }
|
17362 | function getTableColumnMetadata(dataView) {
|
17363 | return dataView && dataView.table && !_.isEmpty(dataView.table.columns) ? dataView.table.columns : void 0;
|
17364 | }
|
17365 | function shouldShowRowSubtotals(objects) {
|
17366 | return TablixObjects.PropGeneralMatrixRowSubtotals.getValue(objects);
|
17367 | }
|
17368 | function shouldShowRowSubtotalsOption(dataView) {
|
17369 | return !(dataView && dataView.matrix && dataView.matrix.rows && isDiscourageAggregationAcrossGroups(dataView.matrix.rows.levels));
|
17370 | }
|
17371 | function shouldShowColumnSubtotals(objects) {
|
17372 | return TablixObjects.PropGeneralMatrixColumnSubtotals.getValue(objects);
|
17373 | }
|
17374 | function shouldShowColumnSubtotalsOption(dataView) {
|
17375 | return !(dataView && dataView.matrix && dataView.matrix.columns && isDiscourageAggregationAcrossGroups(dataView.matrix.columns.levels));
|
17376 | }
|
17377 | function isDiscourageAggregationAcrossGroups(levels) {
|
17378 | var lastLevel = _.last(levels);
|
17379 | return lastLevel && _.some(lastLevel.sources, function(source) {
|
17380 | return source.discourageAggregationAcrossGroups;
|
17381 | });
|
17382 | }
|
17383 | TablixObjects.ObjectGeneral = "general", TablixObjects.ObjectGrid = "grid", TablixObjects.ObjectColumnHeaders = "columnHeaders",
|
17384 | TablixObjects.ObjectRowHeaders = "rowHeaders", TablixObjects.ObjectValues = "values",
|
17385 | TablixObjects.ObjectTotal = "total", TablixObjects.ObjectSubTotals = "subTotals";
|
17386 | var TablixProperty = function() {
|
17387 | function TablixProperty(objectName, propertyName, defaultValue, getterFuntion) {
|
17388 | this.objectName = objectName, this.propertyName = propertyName, this.defaultValue = defaultValue,
|
17389 | this.getterFuntion = getterFuntion;
|
17390 | }
|
17391 | return TablixProperty.prototype.getPropertyID = function() {
|
17392 | return {
|
17393 | objectName: this.objectName,
|
17394 | propertyName: this.propertyName
|
17395 | };
|
17396 | }, TablixProperty.prototype.getValue = function(objects) {
|
17397 | return this.getterFuntion(objects, this.getPropertyID(), this.defaultValue);
|
17398 | }, TablixProperty;
|
17399 | }();
|
17400 | TablixObjects.TablixProperty = TablixProperty, TablixObjects.PropColumnFormatString = new TablixProperty(TablixObjects.ObjectGeneral, "formatString", void 0, powerbi.DataViewObjects.getValue),
|
17401 | TablixObjects.PropGeneralAutoSizeColumns = new TablixProperty(TablixObjects.ObjectGeneral, "autoSizeColumnWidth", !0, powerbi.DataViewObjects.getValue),
|
17402 | TablixObjects.PropGeneralTextSize = new TablixProperty(TablixObjects.ObjectGeneral, "textSize", 8, powerbi.DataViewObjects.getValue),
|
17403 | TablixObjects.PropGeneralTableTotals = new TablixProperty(TablixObjects.ObjectGeneral, "totals", !0, powerbi.DataViewObjects.getValue),
|
17404 | TablixObjects.PropGeneralMatrixRowSubtotals = new TablixProperty(TablixObjects.ObjectGeneral, "rowSubtotals", !0, powerbi.DataViewObjects.getValue),
|
17405 | TablixObjects.PropGeneralMatrixColumnSubtotals = new TablixProperty(TablixObjects.ObjectGeneral, "columnSubtotals", !0, powerbi.DataViewObjects.getValue),
|
17406 | TablixObjects.PropGridVertical = new TablixProperty(TablixObjects.ObjectGrid, "gridVertical", !1, powerbi.DataViewObjects.getValue),
|
17407 | TablixObjects.PropGridVerticalColor = new TablixProperty(TablixObjects.ObjectGrid, "gridVerticalColor", "#E8E8E8", powerbi.DataViewObjects.getFillColor),
|
17408 | TablixObjects.PropGridVerticalWeight = new TablixProperty(TablixObjects.ObjectGrid, "gridVerticalWeight", 1, powerbi.DataViewObjects.getValue),
|
17409 | TablixObjects.PropGridHorizontalTable = new TablixProperty(TablixObjects.ObjectGrid, "gridHorizontal", !0, powerbi.DataViewObjects.getValue),
|
17410 | TablixObjects.PropGridHorizontalMatrix = new TablixProperty(TablixObjects.ObjectGrid, "gridHorizontal", !1, powerbi.DataViewObjects.getValue),
|
17411 | TablixObjects.PropGridHorizontalColor = new TablixProperty(TablixObjects.ObjectGrid, "gridHorizontalColor", "#E8E8E8", powerbi.DataViewObjects.getFillColor),
|
17412 | TablixObjects.PropGridHorizontalWeight = new TablixProperty(TablixObjects.ObjectGrid, "gridHorizontalWeight", 1, powerbi.DataViewObjects.getValue),
|
17413 | TablixObjects.PropGridRowPadding = new TablixProperty(TablixObjects.ObjectGrid, "rowPadding", 0, powerbi.DataViewObjects.getValue),
|
17414 | TablixObjects.PropGridOutlineColor = new TablixProperty(TablixObjects.ObjectGrid, "outlineColor", "#CCC", powerbi.DataViewObjects.getFillColor),
|
17415 | TablixObjects.PropGridOutlineWeight = new TablixProperty(TablixObjects.ObjectGrid, "outlineWeight", 1, powerbi.DataViewObjects.getValue),
|
17416 | TablixObjects.PropGridImageHeight = new TablixProperty(TablixObjects.ObjectGrid, "imageHeight", 75, powerbi.DataViewObjects.getValue),
|
17417 | TablixObjects.PropColumnsFontColor = new TablixProperty(TablixObjects.ObjectColumnHeaders, "fontColor", "#666", powerbi.DataViewObjects.getFillColor),
|
17418 | TablixObjects.PropColumnsBackColor = new TablixProperty(TablixObjects.ObjectColumnHeaders, "backColor", void 0, powerbi.DataViewObjects.getFillColor),
|
17419 | TablixObjects.PropColumnsOutline = new TablixProperty(TablixObjects.ObjectColumnHeaders, "outline", "BottomOnly", powerbi.DataViewObjects.getValue),
|
17420 | TablixObjects.PropRowsFontColor = new TablixProperty(TablixObjects.ObjectRowHeaders, "fontColor", "#666", powerbi.DataViewObjects.getFillColor),
|
17421 | TablixObjects.PropRowsBackColor = new TablixProperty(TablixObjects.ObjectRowHeaders, "backColor", void 0, powerbi.DataViewObjects.getFillColor),
|
17422 | TablixObjects.PropRowsOutline = new TablixProperty(TablixObjects.ObjectRowHeaders, "outline", "RightOnly", powerbi.DataViewObjects.getValue),
|
17423 | TablixObjects.PropValuesBackColor = new TablixProperty(TablixObjects.ObjectValues, "backColor", void 0, powerbi.DataViewObjects.getFillColor),
|
17424 | TablixObjects.PropValuesFontColorPrimary = new TablixProperty(TablixObjects.ObjectValues, "fontColorPrimary", "#333", powerbi.DataViewObjects.getFillColor),
|
17425 | TablixObjects.PropValuesBackColorPrimary = new TablixProperty(TablixObjects.ObjectValues, "backColorPrimary", void 0, powerbi.DataViewObjects.getFillColor),
|
17426 | TablixObjects.PropValuesFontColorSecondary = new TablixProperty(TablixObjects.ObjectValues, "fontColorSecondary", "#333", powerbi.DataViewObjects.getFillColor),
|
17427 | TablixObjects.PropValuesBackColorSecondary = new TablixProperty(TablixObjects.ObjectValues, "backColorSecondary", void 0, powerbi.DataViewObjects.getFillColor),
|
17428 | TablixObjects.PropValuesOutline = new TablixProperty(TablixObjects.ObjectValues, "outline", "None", powerbi.DataViewObjects.getValue),
|
17429 | TablixObjects.PropValuesUrlIconProp = new TablixProperty(TablixObjects.ObjectValues, "urlIcon", !1, powerbi.DataViewObjects.getValue),
|
17430 | TablixObjects.PropTotalFontColor = new TablixProperty(TablixObjects.ObjectTotal, "fontColor", "#333", powerbi.DataViewObjects.getFillColor),
|
17431 | TablixObjects.PropTotalBackColor = new TablixProperty(TablixObjects.ObjectTotal, "backColor", void 0, powerbi.DataViewObjects.getFillColor),
|
17432 | TablixObjects.PropTotalOutline = new TablixProperty(TablixObjects.ObjectTotal, "outline", "TopOnly", powerbi.DataViewObjects.getValue),
|
17433 | TablixObjects.PropSubTotalsFontColor = new TablixProperty(TablixObjects.ObjectSubTotals, "fontColor", "#333", powerbi.DataViewObjects.getFillColor),
|
17434 | TablixObjects.PropSubTotalsBackColor = new TablixProperty(TablixObjects.ObjectSubTotals, "backColor", void 0, powerbi.DataViewObjects.getFillColor),
|
17435 | TablixObjects.PropSubTotalsOutline = new TablixProperty(TablixObjects.ObjectSubTotals, "outline", "TopOnly", powerbi.DataViewObjects.getValue),
|
17436 | TablixObjects.getMetadadataObjects = getMetadadataObjects, TablixObjects.enumerateObjectRepetition = enumerateObjectRepetition,
|
17437 | TablixObjects.enumerateObjectInstances = enumerateObjectInstances, TablixObjects.enumerateGeneralOptions = enumerateGeneralOptions,
|
17438 | TablixObjects.enumerateGridOptions = enumerateGridOptions, TablixObjects.enumerateColumnHeadersOptions = enumerateColumnHeadersOptions,
|
17439 | TablixObjects.enumerateRowHeadersOptions = enumerateRowHeadersOptions, TablixObjects.enumerateValuesOptions = enumerateValuesOptions,
|
17440 | TablixObjects.enumerateTotalOptions = enumerateTotalOptions, TablixObjects.enumerateSubTotalsOptions = enumerateSubTotalsOptions,
|
17441 | TablixObjects.getTableObjects = getTableObjects, TablixObjects.getMatrixObjects = getMatrixObjects,
|
17442 | TablixObjects.generateTablixDefaultObjects = generateTablixDefaultObjects, TablixObjects.getTextSizeInPx = getTextSizeInPx,
|
17443 | TablixObjects.shouldShowTableTotals = shouldShowTableTotals, TablixObjects.shouldShowRowSubtotals = shouldShowRowSubtotals,
|
17444 | TablixObjects.shouldShowColumnSubtotals = shouldShowColumnSubtotals, TablixObjects.shouldShowColumnSubtotalsOption = shouldShowColumnSubtotalsOption,
|
17445 | TablixObjects.isDiscourageAggregationAcrossGroups = isDiscourageAggregationAcrossGroups;
|
17446 | }(TablixObjects = internal.TablixObjects || (internal.TablixObjects = {}));
|
17447 | var TablixUtils;
|
17448 | !function(TablixUtils) {
|
17449 | function createTable() {
|
17450 | return document.createElement("table");
|
17451 | }
|
17452 | function createDiv() {
|
17453 | var div = document.createElement("div");
|
17454 | return div.className = "tablixDiv", div;
|
17455 | }
|
17456 | function resetCellCssClass(cell) {
|
17457 | cell.extension.contentElement.className = TablixUtils.CssClassTablixDiv + " " + TablixUtils.CssClassContentElement,
|
17458 | cell.extension.contentHost.className = TablixUtils.CssClassTablixDiv + " " + TablixUtils.CssClassContentHost;
|
17459 | }
|
17460 | function addCellCssClass(cell, style) {
|
17461 | cell.extension.contentHost.className += " " + style;
|
17462 | }
|
17463 | function clearCellStyle(cell) {
|
17464 | cell.extension.contentHost.className = "", cell.extension.contentHost.style.cssText = "";
|
17465 | }
|
17466 | function clearCellTextAndTooltip(cell) {
|
17467 | cell.extension.contentHost.textContent = "", cell.extension.contentHost.removeAttribute("title"),
|
17468 | cell.contentHeight = cell.contentWidth = 0, controls.HTMLElementUtils.clearChildren(cell.extension.contentHost);
|
17469 | }
|
17470 | function setCellTextAndTooltip(text, elementText, elementTooltip) {
|
17471 | var val = visuals.TextUtil.replaceSpaceWithNBSP(text);
|
17472 | elementText.textContent = val, (elementTooltip || elementText).title = val;
|
17473 | }
|
17474 | function isValidSortClick(e) {
|
17475 | var colHeader = e.target, x = e.offsetX;
|
17476 | return x >= 0 && x < colHeader.offsetWidth - internal.TablixResizer.resizeHandleSize;
|
17477 | }
|
17478 | function appendATagToBodyCell(value, cellElement, urlIcon) {
|
17479 | var atag = null;
|
17480 | 0 === cellElement.childElementCount ? (atag = document.createElement("a"), cellElement.appendChild(atag)) : atag = cellElement.children[0],
|
17481 | atag.href = value, atag.target = "_blank", atag.title = value, urlIcon === !0 ? (atag.className = TablixUtils.CssClassValueURLIcon,
|
17482 | cellElement.className = TablixUtils.CssClassValueURLIconContainer) : atag.innerText = value;
|
17483 | }
|
17484 | function appendImgTagToBodyCell(value, cellElement, imageHeight) {
|
17485 | var imgContainer = TablixUtils.createDiv(), imgTag = document.createElement("img");
|
17486 | imgContainer.style.height = imageHeight + "px", imgContainer.style.width = "100%",
|
17487 | imgContainer.style.textAlign = "center", imgTag.src = value, imgTag.style.maxHeight = "100%",
|
17488 | imgTag.style.maxWidth = "100%", imgContainer.appendChild(imgTag), cellElement.appendChild(imgContainer),
|
17489 | cellElement.title = value;
|
17490 | }
|
17491 | function createKpiDom(kpi, kpiValue) {
|
17492 | var className = visuals.KpiUtil.getClassForKpi(kpi, kpiValue) || "";
|
17493 | return DomFactory.div().addClass(className).css({
|
17494 | display: "inline-block",
|
17495 | "vertical-align": "bottom",
|
17496 | margin: "0"
|
17497 | });
|
17498 | }
|
17499 | function isValidStatusGraphic(kpi, kpiValue) {
|
17500 | return kpi && void 0 !== kpiValue ? !!visuals.KpiUtil.getClassForKpi(kpi, kpiValue) : !1;
|
17501 | }
|
17502 | function getCustomSortEventArgs(queryName, sortDirection) {
|
17503 | var sortDescriptors = [ {
|
17504 | queryName: queryName,
|
17505 | sortDirection: sortDirection
|
17506 | } ];
|
17507 | return {
|
17508 | sortDescriptors: sortDescriptors
|
17509 | };
|
17510 | }
|
17511 | function reverseSort(sortDirection) {
|
17512 | return 2 === sortDirection ? 1 : 2;
|
17513 | }
|
17514 | function addSortIconToColumnHeader(itemSort, cellDiv) {
|
17515 | var colHeaderContainer = TablixUtils.createDiv();
|
17516 | itemSort ? (colHeaderContainer.appendChild(createSortIcon(itemSort, !0)), colHeaderContainer.appendChild(createSortIcon(reverseSort(itemSort), !1))) : colHeaderContainer.appendChild(createSortIcon(2, !1));
|
17517 | var colHeaderTitle = TablixUtils.createDiv();
|
17518 | return colHeaderContainer.appendChild(colHeaderTitle), cellDiv.appendChild(colHeaderContainer),
|
17519 | colHeaderTitle;
|
17520 | }
|
17521 | function createSortIcon(sort, isSorted) {
|
17522 | var imgSort = document.createElement("i");
|
17523 | return imgSort.className = SortIconContainerClassName + " " + (isSorted ? "sorted" : "future") + " " + (1 === sort ? "powervisuals-glyph caret-up" : "powervisuals-glyph caret-down"),
|
17524 | imgSort;
|
17525 | }
|
17526 | function checkSortIconExists(cell) {
|
17527 | for (var i = 0, len = cell.extension.contentElement.childElementCount; len > i; i++) {
|
17528 | var element = cell.extension.contentElement.children.item(i);
|
17529 | if (element.classList.contains(SortIconContainerClassName)) return !0;
|
17530 | }
|
17531 | return !1;
|
17532 | }
|
17533 | function removeSortIcons(cell) {
|
17534 | checkSortIconExists(cell) && $(cell.extension.contentElement).find("." + SortIconContainerClassName).remove();
|
17535 | }
|
17536 | TablixUtils.CssClassTablixDiv = "tablixDiv", TablixUtils.CssClassContentElement = "tablixCellContentElement",
|
17537 | TablixUtils.CssClassContentHost = "tablixCellContentHost", TablixUtils.CssClassTablixHeader = "tablixHeader",
|
17538 | TablixUtils.CssClassTablixColumnHeaderLeaf = "tablixColumnHeaderLeaf", TablixUtils.CssClassTablixValueNumeric = "tablixValueNumeric",
|
17539 | TablixUtils.CssClassTablixValueTotal = "tablixValueTotal", TablixUtils.CssClassValueURLIcon = "powervisuals-glyph url-icon tablixUrlIconGlyph",
|
17540 | TablixUtils.CssClassValueURLIconContainer = "tablixValueUrlIcon", TablixUtils.CssClassMatrixRowHeaderLeaf = "matrixRowHeaderLeaf",
|
17541 | TablixUtils.CssClassMatrixRowHeaderSubTotal = "matrixRowHeaderSubTotal", TablixUtils.CssClassTableFooter = "tableFooterCell",
|
17542 | TablixUtils.CssClassTableBodyCell = "tableBodyCell", TablixUtils.CssClassTableBodyCellBottom = "tableBodyCellBottom",
|
17543 | TablixUtils.StringNonBreakingSpace = " ", TablixUtils.UnitOfMeasurement = "px";
|
17544 | var SortIconContainerClassName = "tablixSortIconContainer";
|
17545 | TablixUtils.CellPaddingLeft = 10, TablixUtils.CellPaddingRight = 5, TablixUtils.CellPaddingLeftMatrixTotal = 5,
|
17546 | TablixUtils.SortIconPadding = 5, TablixUtils.ImageDefaultAspectRatio = 1, TablixUtils.FontFamilyCell = visuals.Font.Family.regular.css,
|
17547 | TablixUtils.FontFamilyHeader = visuals.Font.Family.regular.css, TablixUtils.FontFamilyTotal = visuals.Font.Family.bold.css,
|
17548 | TablixUtils.FontColorCells = "#333", TablixUtils.FontColorHeaders = "#666", function(EdgeType) {
|
17549 | EdgeType[EdgeType.Outline = 0] = "Outline", EdgeType[EdgeType.Gridline = 1] = "Gridline";
|
17550 | }(TablixUtils.EdgeType || (TablixUtils.EdgeType = {}));
|
17551 | var EdgeType = TablixUtils.EdgeType, EdgeSettings = function() {
|
17552 | function EdgeSettings(weight, color) {
|
17553 | this.applyParams(!0, weight, color);
|
17554 | }
|
17555 | return EdgeSettings.prototype.applyParams = function(shown, weight, color, type) {
|
17556 | shown ? (this.weight = null == weight ? 0 : weight, this.color = null == color ? "black" : color,
|
17557 | this.type = null == type ? EdgeType.Gridline : type) : (this.weight = 0, this.color = "black",
|
17558 | this.type = EdgeType.Gridline);
|
17559 | }, EdgeSettings.prototype.getCSS = function() {
|
17560 | var css = [];
|
17561 | return _.isNumber(this.weight) && (css.push(this.weight + TablixUtils.UnitOfMeasurement),
|
17562 | this.color && css.push(this.color), css.push("solid")), css.join(" ");
|
17563 | }, EdgeSettings.prototype.getPriority = function(edges) {
|
17564 | return this === edges.top || this === edges.bottom ? this.type === EdgeType.Outline ? 2 : 0 : this === edges.right || this === edges.left ? this.type === EdgeType.Outline ? 3 : 1 : -1;
|
17565 | }, EdgeSettings.prototype.getShadowCss = function(edges) {
|
17566 | var output = "inset ";
|
17567 | if (this === edges.left) output += this.weight + TablixUtils.UnitOfMeasurement + " 0"; else if (this === edges.right) output += "-" + this.weight + TablixUtils.UnitOfMeasurement + " 0"; else if (this === edges.top) output += "0 " + this.weight + TablixUtils.UnitOfMeasurement; else {
|
17568 | if (this !== edges.bottom) return "";
|
17569 | output += "0 -" + this.weight + TablixUtils.UnitOfMeasurement;
|
17570 | }
|
17571 | return output + " 0 0 " + this.color;
|
17572 | }, EdgeSettings;
|
17573 | }();
|
17574 | TablixUtils.EdgeSettings = EdgeSettings;
|
17575 | var CellStyle = function() {
|
17576 | function CellStyle() {
|
17577 | this.borders = {}, this.paddings = {
|
17578 | top: 0,
|
17579 | left: TablixUtils.CellPaddingLeft,
|
17580 | bottom: 0,
|
17581 | right: TablixUtils.CellPaddingRight
|
17582 | }, this.fontFamily = "", this.fontColor = "", this.backColor = "";
|
17583 | }
|
17584 | return CellStyle.prototype.applyStyle = function(cell) {
|
17585 | var _this = this, div = cell.extension.contentHost, style = div.style;
|
17586 | style.fontFamily = this.fontFamily, style.color = this.fontColor, style.backgroundColor = this.backColor;
|
17587 | var edges = [ this.borders.top, this.borders.right, this.borders.bottom, this.borders.left ];
|
17588 | edges = _.sortBy(edges, function(e) {
|
17589 | return e ? e.getPriority(_this.borders) : -1;
|
17590 | }).reverse(), style.boxShadow = _.map(edges, function(e) {
|
17591 | return e ? e.getShadowCss(_this.borders) : void 0;
|
17592 | }).join(", "), style.border = "none", style.paddingTop = (null == this.paddings.top ? 0 : this.paddings.top) + (null == this.borders.top ? 0 : this.borders.top.weight) + TablixUtils.UnitOfMeasurement,
|
17593 | style.paddingRight = (null == this.paddings.right ? TablixUtils.CellPaddingRight : this.paddings.right) + (null == this.borders.right ? 0 : this.borders.right.weight) + TablixUtils.UnitOfMeasurement,
|
17594 | style.paddingBottom = (null == this.paddings.bottom ? 0 : this.paddings.bottom) + (null == this.borders.bottom ? 0 : this.borders.bottom.weight) + TablixUtils.UnitOfMeasurement,
|
17595 | style.paddingLeft = (null == this.paddings.left ? TablixUtils.CellPaddingLeft : this.paddings.left) + (null == this.borders.left ? 0 : this.borders.left.weight) + TablixUtils.UnitOfMeasurement;
|
17596 | }, CellStyle.prototype.getExtraTop = function() {
|
17597 | var extra = 0;
|
17598 | return this.paddings.top && (extra += this.paddings.top), this.borders.top && (extra += this.borders.top.weight),
|
17599 | extra;
|
17600 | }, CellStyle.prototype.getExtraBottom = function() {
|
17601 | var extra = 0;
|
17602 | return this.paddings.bottom && (extra += this.paddings.bottom), this.borders.bottom && (extra += this.borders.bottom.weight),
|
17603 | extra;
|
17604 | }, CellStyle.prototype.getExtraRight = function() {
|
17605 | var extra = 0;
|
17606 | return this.paddings.right && (extra += this.paddings.right), this.borders.right && (extra += this.borders.right.weight),
|
17607 | extra;
|
17608 | }, CellStyle.prototype.getExtraLeft = function() {
|
17609 | var extra = 0;
|
17610 | return this.paddings.left && (extra += this.paddings.left), this.borders.left && (extra += this.borders.left.weight),
|
17611 | extra;
|
17612 | }, CellStyle;
|
17613 | }();
|
17614 | TablixUtils.CellStyle = CellStyle;
|
17615 | var DimensionPosition = function() {
|
17616 | function DimensionPosition() {}
|
17617 | return DimensionPosition;
|
17618 | }();
|
17619 | TablixUtils.DimensionPosition = DimensionPosition;
|
17620 | var CellPosition = function() {
|
17621 | function CellPosition() {
|
17622 | this.row = new DimensionPosition(), this.column = new DimensionPosition();
|
17623 | }
|
17624 | return CellPosition.prototype.isMatch = function(position) {
|
17625 | return this.column.index === position.column.index && this.row.index === position.row.index;
|
17626 | }, CellPosition;
|
17627 | }();
|
17628 | TablixUtils.CellPosition = CellPosition;
|
17629 | var TablixVisualCell = function() {
|
17630 | function TablixVisualCell(dataPoint, isTotal, columnMetadata, formatter, nullsAreBlank) {
|
17631 | this.dataPoint = dataPoint, this.columnMetadata = columnMetadata, this.formatter = formatter,
|
17632 | this.isTotal = isTotal, this.nullsAreBlank = nullsAreBlank, this.position = new TablixUtils.CellPosition();
|
17633 | }
|
17634 | return Object.defineProperty(TablixVisualCell.prototype, "textContent", {
|
17635 | get: function() {
|
17636 | return this.formatter ? this.formatter(this.dataPoint, this.columnMetadata, TablixObjects.PropColumnFormatString.getPropertyID(), this.nullsAreBlank) : null != this.dataPoint ? this.dataPoint : "";
|
17637 | },
|
17638 | enumerable: !0,
|
17639 | configurable: !0
|
17640 | }), Object.defineProperty(TablixVisualCell.prototype, "kpiContent", {
|
17641 | get: function() {
|
17642 | return this.columnMetadata && isValidStatusGraphic(this.columnMetadata.kpi, this.textContent) ? createKpiDom(this.columnMetadata.kpi, this.textContent) : void 0;
|
17643 | },
|
17644 | enumerable: !0,
|
17645 | configurable: !0
|
17646 | }), Object.defineProperty(TablixVisualCell.prototype, "isNumeric", {
|
17647 | get: function() {
|
17648 | return this.columnMetadata ? this.columnMetadata.type.numeric && !this.columnMetadata.kpi : void 0;
|
17649 | },
|
17650 | enumerable: !0,
|
17651 | configurable: !0
|
17652 | }), Object.defineProperty(TablixVisualCell.prototype, "isUrl", {
|
17653 | get: function() {
|
17654 | return this.columnMetadata ? visuals.converterHelper.isWebUrlColumn(this.columnMetadata) : void 0;
|
17655 | },
|
17656 | enumerable: !0,
|
17657 | configurable: !0
|
17658 | }), Object.defineProperty(TablixVisualCell.prototype, "isImage", {
|
17659 | get: function() {
|
17660 | return this.columnMetadata ? visuals.converterHelper.isImageUrlColumn(this.columnMetadata) : void 0;
|
17661 | },
|
17662 | enumerable: !0,
|
17663 | configurable: !0
|
17664 | }), Object.defineProperty(TablixVisualCell.prototype, "isValidUrl", {
|
17665 | get: function() {
|
17666 | return jsCommon.UrlUtils.isValidImageUrl(this.textContent);
|
17667 | },
|
17668 | enumerable: !0,
|
17669 | configurable: !0
|
17670 | }), TablixVisualCell.prototype.isMatch = function(item) {
|
17671 | return this.position.isMatch(item.position) && this.backColor === item.backColor;
|
17672 | }, TablixVisualCell;
|
17673 | }();
|
17674 | TablixUtils.TablixVisualCell = TablixVisualCell, TablixUtils.createTable = createTable,
|
17675 | TablixUtils.createDiv = createDiv, TablixUtils.resetCellCssClass = resetCellCssClass,
|
17676 | TablixUtils.addCellCssClass = addCellCssClass, TablixUtils.clearCellStyle = clearCellStyle,
|
17677 | TablixUtils.clearCellTextAndTooltip = clearCellTextAndTooltip, TablixUtils.setCellTextAndTooltip = setCellTextAndTooltip,
|
17678 | TablixUtils.isValidSortClick = isValidSortClick, TablixUtils.appendATagToBodyCell = appendATagToBodyCell,
|
17679 | TablixUtils.appendImgTagToBodyCell = appendImgTagToBodyCell, TablixUtils.createKpiDom = createKpiDom,
|
17680 | TablixUtils.isValidStatusGraphic = isValidStatusGraphic, TablixUtils.getCustomSortEventArgs = getCustomSortEventArgs,
|
17681 | TablixUtils.reverseSort = reverseSort, TablixUtils.addSortIconToColumnHeader = addSortIconToColumnHeader,
|
17682 | TablixUtils.removeSortIcons = removeSortIcons;
|
17683 | }(TablixUtils = internal.TablixUtils || (internal.TablixUtils = {}));
|
17684 | }(internal = controls.internal || (controls.internal = {}));
|
17685 | }(controls = visuals.controls || (visuals.controls = {}));
|
17686 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
17687 | }(powerbi || (powerbi = {}));
|
17688 | }, function(module, exports) {
|
17689 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
17690 | window.jasmine, window.Microsoft;
|
17691 | }, function(module, exports) {
|
17692 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
17693 | window.jasmine, window.Microsoft;
|
17694 | }, function(module, exports) {
|
17695 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
17696 | window.jasmine, window.Microsoft;
|
17697 | }, function(module, exports) {
|
17698 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
17699 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
17700 | !function(powerbi) {
|
17701 | var visuals;
|
17702 | !function(visuals) {
|
17703 | var controls;
|
17704 | !function(controls) {
|
17705 | controls.TablixDefaultTextSize = jsCommon.TextSizeDefaults.TextSizeMin;
|
17706 | var TablixControl = function() {
|
17707 | function TablixControl(hierarchyNavigator, layoutManager, binder, parentDomElement, options) {
|
17708 | var _this = this;
|
17709 | this.scrollBarElementWidth = 9, this.options = options;
|
17710 | var isInteractive = options.interactive;
|
17711 | this.isTouchEnabled = isInteractive && options.enableTouchSupport, this.mainDiv = controls.internal.TablixUtils.createDiv(),
|
17712 | this.mainDiv.classList.add(TablixControl.TablixTableAreaClassName), this.footerDiv = controls.internal.TablixUtils.createDiv(),
|
17713 | this.footerDiv.classList.add(TablixControl.TablixFooterClassName), this.isTouchEnabled && this.InitializeTouchSupport(),
|
17714 | this.gridDimensions = {}, this.containerElement = controls.internal.TablixUtils.createDiv(),
|
17715 | this.className = layoutManager.getTablixClassName(), this.autoSizeWidth = !1, this.autoSizeHeight = !1,
|
17716 | this.fontFamily = controls.internal.TablixUtils.FontFamilyCell, this.fontColor = controls.internal.TablixUtils.FontColorCells,
|
17717 | this.fontSize = options.fontSize, parentDomElement.className = TablixControl.TablixContainerClassName,
|
17718 | parentDomElement.appendChild(this.containerElement), this.containerElement.addEventListener("mousewheel", function(e) {
|
17719 | _this.onMouseWheel(e);
|
17720 | }), this.containerElement.addEventListener("DOMMouseScroll", function(e) {
|
17721 | _this.onFireFoxMouseWheel(e);
|
17722 | }), this.containerElement.appendChild(this.mainDiv), this.containerElement.appendChild(this.footerDiv),
|
17723 | this.isTouchEnabled && (this.touchInterpreter.initTouch(this.mainDiv, null, !1),
|
17724 | this.footerTouchInterpreter.initTouch(this.footerDiv, this.mainDiv, !1)), this.controlLayoutManager = layoutManager,
|
17725 | this.controlLayoutManager.initialize(this), this.hierarchyTablixNavigator = hierarchyNavigator,
|
17726 | this.binder = binder, this.columnDim = new controls.TablixColumnDimension(this),
|
17727 | this.rowDim = new controls.TablixRowDimension(this), this.columnDim._otherDimension = this.rowDimension,
|
17728 | this.rowDim._otherDimension = this.columnDimension, this.InitializeScrollbars(),
|
17729 | isInteractive || (this.scrollbarWidth = 0), this.updateHorizontalPosition(), this.updateVerticalPosition(),
|
17730 | this.updateFooterVisibility(), this.lastRenderingArgs = {};
|
17731 | }
|
17732 | return TablixControl.prototype.InitializeTouchSupport = function() {
|
17733 | this.touchManager = new controls.TouchUtils.TouchManager(), this.touchInterpreter = new controls.TouchUtils.TouchEventInterpreter(this.touchManager),
|
17734 | this.footerTouchInterpreter = new controls.TouchUtils.TouchEventInterpreter(this.touchManager),
|
17735 | this.columnTouchDelegate = new controls.ColumnTouchDelegate(new controls.TouchUtils.Rectangle()),
|
17736 | this.rowTouchDelegate = new controls.RowTouchDelegate(new controls.TouchUtils.Rectangle()),
|
17737 | this.bodyTouchDelegate = new controls.BodyTouchDelegate(new controls.TouchUtils.Rectangle()),
|
17738 | this.footerTouchDelegate = new controls.ColumnTouchDelegate(new controls.TouchUtils.Rectangle()),
|
17739 | this.columnTouchDelegate.setHandler(this, this.onTouchEvent), this.rowTouchDelegate.setHandler(this, this.onTouchEvent),
|
17740 | this.bodyTouchDelegate.setHandler(this, this.onTouchEvent), this.footerTouchDelegate.setHandler(this, this.onTouchEvent),
|
17741 | this.touchManager.addTouchRegion(this.columnTouchDelegate.dimension, this.columnTouchDelegate, this.columnTouchDelegate),
|
17742 | this.touchManager.addTouchRegion(this.rowTouchDelegate.dimension, this.rowTouchDelegate, this.rowTouchDelegate),
|
17743 | this.touchManager.addTouchRegion(this.bodyTouchDelegate.dimension, this.bodyTouchDelegate, this.bodyTouchDelegate),
|
17744 | this.touchManager.addTouchRegion(this.footerTouchDelegate.dimension, this.footerTouchDelegate, this.footerTouchDelegate);
|
17745 | }, TablixControl.prototype.InitializeScrollbars = function() {
|
17746 | this.rowDim._initializeScrollbar(this.containerElement, null, this.options.layoutKind);
|
17747 | var rowDimensionScrollbarStyle = this.rowDim.scrollbar.element.style;
|
17748 | rowDimensionScrollbarStyle.position = "absolute", rowDimensionScrollbarStyle.top = "0" + TablixControl.UnitOfMeasurement,
|
17749 | rowDimensionScrollbarStyle.right = "0" + TablixControl.UnitOfMeasurement, this.rowDim.scrollbar.width = this.scrollBarElementWidth + TablixControl.UnitOfMeasurement,
|
17750 | this.rowDim.scrollbar.show(!0), this.columnDim._initializeScrollbar(this.containerElement, null, this.options.layoutKind);
|
17751 | var columnDimensionScrollbarStyle = this.columnDim.scrollbar.element.style;
|
17752 | columnDimensionScrollbarStyle.position = "absolute", columnDimensionScrollbarStyle.left = "0" + TablixControl.UnitOfMeasurement,
|
17753 | columnDimensionScrollbarStyle.bottom = "0" + TablixControl.UnitOfMeasurement, this.columnDim.scrollbar.height = this.scrollBarElementWidth + TablixControl.UnitOfMeasurement,
|
17754 | this.columnDim.scrollbar.show(!1);
|
17755 | }, Object.defineProperty(TablixControl.prototype, "container", {
|
17756 | get: function() {
|
17757 | return this.containerElement;
|
17758 | },
|
17759 | enumerable: !0,
|
17760 | configurable: !0
|
17761 | }), Object.defineProperty(TablixControl.prototype, "contentHost", {
|
17762 | get: function() {
|
17763 | return this.mainDiv;
|
17764 | },
|
17765 | enumerable: !0,
|
17766 | configurable: !0
|
17767 | }), Object.defineProperty(TablixControl.prototype, "footerHost", {
|
17768 | get: function() {
|
17769 | return this.footerDiv;
|
17770 | },
|
17771 | enumerable: !0,
|
17772 | configurable: !0
|
17773 | }), Object.defineProperty(TablixControl.prototype, "className", {
|
17774 | set: function(value) {
|
17775 | this.containerElement.className = value;
|
17776 | },
|
17777 | enumerable: !0,
|
17778 | configurable: !0
|
17779 | }), Object.defineProperty(TablixControl.prototype, "hierarchyNavigator", {
|
17780 | get: function() {
|
17781 | return this.hierarchyTablixNavigator;
|
17782 | },
|
17783 | enumerable: !0,
|
17784 | configurable: !0
|
17785 | }), TablixControl.prototype.getBinder = function() {
|
17786 | return this.binder;
|
17787 | }, Object.defineProperty(TablixControl.prototype, "autoSizeWidth", {
|
17788 | get: function() {
|
17789 | return this._autoSizeWidth;
|
17790 | },
|
17791 | set: function(value) {
|
17792 | this._autoSizeWidth = value, value || (this.containerElement.style.minWidth = this.containerElement.style.maxWidth = "none");
|
17793 | },
|
17794 | enumerable: !0,
|
17795 | configurable: !0
|
17796 | }), Object.defineProperty(TablixControl.prototype, "autoSizeHeight", {
|
17797 | get: function() {
|
17798 | return this._autoSizeHeight;
|
17799 | },
|
17800 | set: function(value) {
|
17801 | value || (this.containerElement.style.minHeight = this.containerElement.style.maxHeight = "none");
|
17802 | },
|
17803 | enumerable: !0,
|
17804 | configurable: !0
|
17805 | }), Object.defineProperty(TablixControl.prototype, "maxWidth", {
|
17806 | get: function() {
|
17807 | return this.maximumWidth;
|
17808 | },
|
17809 | set: function(value) {
|
17810 | this.maximumWidth = value, this.containerElement.style.maxWidth = this.maximumWidth + TablixControl.UnitOfMeasurement;
|
17811 | },
|
17812 | enumerable: !0,
|
17813 | configurable: !0
|
17814 | }), Object.defineProperty(TablixControl.prototype, "viewport", {
|
17815 | get: function() {
|
17816 | return this.viewPort;
|
17817 | },
|
17818 | set: function(value) {
|
17819 | this.viewPort = value, this.containerElement.style.width = this.viewPort.width + TablixControl.UnitOfMeasurement,
|
17820 | this.containerElement.style.height = this.viewPort.height + TablixControl.UnitOfMeasurement,
|
17821 | this.rowDim.scrollbar.invalidateArrange(), this.columnDim.scrollbar.invalidateArrange(),
|
17822 | this.controlLayoutManager.updateViewport(this.viewPort);
|
17823 | },
|
17824 | enumerable: !0,
|
17825 | configurable: !0
|
17826 | }), Object.defineProperty(TablixControl.prototype, "maxHeight", {
|
17827 | get: function() {
|
17828 | return this.maximumHeight;
|
17829 | },
|
17830 | set: function(value) {
|
17831 | this.maximumHeight = value, this.containerElement.style.maxHeight = this.maximumHeight + TablixControl.UnitOfMeasurement;
|
17832 | },
|
17833 | enumerable: !0,
|
17834 | configurable: !0
|
17835 | }), Object.defineProperty(TablixControl.prototype, "minWidth", {
|
17836 | get: function() {
|
17837 | return this.minimumWidth;
|
17838 | },
|
17839 | set: function(value) {
|
17840 | this.minimumWidth = value, this.containerElement.style.minWidth = this.minimumWidth + TablixControl.UnitOfMeasurement;
|
17841 | },
|
17842 | enumerable: !0,
|
17843 | configurable: !0
|
17844 | }), Object.defineProperty(TablixControl.prototype, "minHeight", {
|
17845 | get: function() {
|
17846 | return this.minimumHeight;
|
17847 | },
|
17848 | set: function(value) {
|
17849 | this.minimumHeight = value, this.containerElement.style.minHeight = this.minimumHeight + TablixControl.UnitOfMeasurement;
|
17850 | },
|
17851 | enumerable: !0,
|
17852 | configurable: !0
|
17853 | }), Object.defineProperty(TablixControl.prototype, "fontSize", {
|
17854 | get: function() {
|
17855 | return this.textFontSize;
|
17856 | },
|
17857 | set: function(value) {
|
17858 | this.textFontSize = value ? value : TablixControl.DefaultFontSize, this.containerElement.style.fontSize = this.textFontSize;
|
17859 | },
|
17860 | enumerable: !0,
|
17861 | configurable: !0
|
17862 | }), Object.defineProperty(TablixControl.prototype, "fontFamily", {
|
17863 | get: function() {
|
17864 | return this.textFontFamily;
|
17865 | },
|
17866 | set: function(value) {
|
17867 | this.textFontFamily = value, this.containerElement.style.fontFamily = value;
|
17868 | },
|
17869 | enumerable: !0,
|
17870 | configurable: !0
|
17871 | }), Object.defineProperty(TablixControl.prototype, "fontColor", {
|
17872 | get: function() {
|
17873 | return this.textFontColor;
|
17874 | },
|
17875 | set: function(value) {
|
17876 | this.textFontColor = value, this.containerElement.style.color = value;
|
17877 | },
|
17878 | enumerable: !0,
|
17879 | configurable: !0
|
17880 | }), Object.defineProperty(TablixControl.prototype, "scrollbarWidth", {
|
17881 | set: function(value) {
|
17882 | this.scrollBarElementWidth = value, this.rowDim.scrollbar.width = this.scrollBarElementWidth + TablixControl.UnitOfMeasurement,
|
17883 | this.columnDim.scrollbar.height = this.scrollBarElementWidth + TablixControl.UnitOfMeasurement;
|
17884 | },
|
17885 | enumerable: !0,
|
17886 | configurable: !0
|
17887 | }), TablixControl.prototype.updateModels = function(resetScrollOffsets, rowModel, columnModel) {
|
17888 | this.rowDim.model = rowModel, this.rowDim.modelDepth = this.hierarchyNavigator.getRowHierarchyDepth(),
|
17889 | this.columnDim.model = columnModel, this.columnDim.modelDepth = this.hierarchyNavigator.getColumnHierarchyDepth(),
|
17890 | resetScrollOffsets && (this.rowDim.scrollOffset = 0, this.columnDim.scrollOffset = 0),
|
17891 | this.layoutManager.updateColumnCount(this.rowDim, this.columnDim);
|
17892 | }, TablixControl.prototype.updateColumnDimensions = function(rowHierarchyWidth, columnHierarchyWidth, count) {
|
17893 | var gridDimensions = this.gridDimensions;
|
17894 | gridDimensions.columnCount = count, gridDimensions.rowHierarchyWidth = rowHierarchyWidth,
|
17895 | gridDimensions.columnHierarchyWidth = columnHierarchyWidth;
|
17896 | }, TablixControl.prototype.updateRowDimensions = function(columnHierarchyHeight, rowHierarchyHeight, rowHierarchyContentHeight, count, footerHeight) {
|
17897 | var gridDimensions = this.gridDimensions;
|
17898 | gridDimensions.rowCount = count, gridDimensions.rowHierarchyHeight = rowHierarchyHeight,
|
17899 | gridDimensions.rowHierarchyContentHeight = rowHierarchyContentHeight, gridDimensions.columnHierarchyHeight = columnHierarchyHeight,
|
17900 | gridDimensions.footerHeight = footerHeight;
|
17901 | }, TablixControl.prototype.updateTouchDimensions = function() {
|
17902 | var gridDimensions = this.gridDimensions;
|
17903 | this.columnTouchDelegate.resize(gridDimensions.rowHierarchyWidth, 0, gridDimensions.columnHierarchyWidth, gridDimensions.columnHierarchyHeight),
|
17904 | this.columnTouchDelegate.setScrollDensity(gridDimensions.columnCount / gridDimensions.columnHierarchyWidth),
|
17905 | this.rowTouchDelegate.resize(0, gridDimensions.columnHierarchyHeight, gridDimensions.rowHierarchyWidth, gridDimensions.rowHierarchyHeight),
|
17906 | this.rowTouchDelegate.setScrollDensity(gridDimensions.rowCount / gridDimensions.rowHierarchyHeight),
|
17907 | this.bodyTouchDelegate.resize(gridDimensions.rowHierarchyWidth, gridDimensions.columnHierarchyHeight, gridDimensions.columnHierarchyWidth, gridDimensions.rowHierarchyHeight),
|
17908 | this.bodyTouchDelegate.setScrollDensity(gridDimensions.columnCount / gridDimensions.columnHierarchyWidth, gridDimensions.rowCount / gridDimensions.rowHierarchyHeight),
|
17909 | this.footerTouchDelegate.resize(gridDimensions.rowHierarchyWidth, gridDimensions.columnHierarchyHeight + gridDimensions.rowHierarchyHeight, gridDimensions.columnHierarchyWidth, gridDimensions.footerHeight),
|
17910 | this.footerTouchDelegate.setScrollDensity(gridDimensions.columnCount / gridDimensions.columnHierarchyWidth);
|
17911 | }, TablixControl.prototype.onMouseWheel = function(e) {
|
17912 | this.determineDimensionToScroll(e, function(dimension, delta) {
|
17913 | dimension.scrollbar.onMouseWheel(delta);
|
17914 | }), 0 === this.options.layoutKind && e.preventDefault();
|
17915 | }, TablixControl.prototype.onFireFoxMouseWheel = function(e) {
|
17916 | this.determineDimensionToScrollFirefox(e, function(dimension, delta) {
|
17917 | dimension.scrollbar.onMouseWheel(delta);
|
17918 | }), 0 === this.options.layoutKind && e.preventDefault();
|
17919 | }, TablixControl.prototype.determineDimensionToScroll = function(e, scrollCallback) {
|
17920 | this.rowDim.scrollbar.visible ? (e.wheelDeltaY && scrollCallback(this.rowDim, e.wheelDeltaY),
|
17921 | e.wheelDeltaX && this.columnDim.scrollbar.visible && scrollCallback(this.columnDim, e.wheelDeltaX)) : this.columnDim.scrollbar.visible && (e.wheelDeltaX ? scrollCallback(this.columnDim, e.wheelDeltaX) : e.wheelDeltaY && scrollCallback(this.columnDim, e.wheelDeltaY));
|
17922 | }, TablixControl.prototype.determineDimensionToScrollFirefox = function(e, scrollCallback) {
|
17923 | if (e.detail) {
|
17924 | if (this.rowDim.scrollbar.visible) return void scrollCallback(this.rowDim, -e.detail);
|
17925 | if (this.columnDim.scrollbar.visible) return void scrollCallback(this.columnDim, -e.detail);
|
17926 | }
|
17927 | }, Object.defineProperty(TablixControl.prototype, "layoutManager", {
|
17928 | get: function() {
|
17929 | return this.controlLayoutManager;
|
17930 | },
|
17931 | enumerable: !0,
|
17932 | configurable: !0
|
17933 | }), Object.defineProperty(TablixControl.prototype, "columnDimension", {
|
17934 | get: function() {
|
17935 | return this.columnDim;
|
17936 | },
|
17937 | enumerable: !0,
|
17938 | configurable: !0
|
17939 | }), Object.defineProperty(TablixControl.prototype, "rowDimension", {
|
17940 | get: function() {
|
17941 | return this.rowDim;
|
17942 | },
|
17943 | enumerable: !0,
|
17944 | configurable: !0
|
17945 | }), TablixControl.prototype.refresh = function(clear) {
|
17946 | this.render(clear, null);
|
17947 | }, TablixControl.prototype._onScrollAsync = function(dimension) {
|
17948 | var _this = this;
|
17949 | requestAnimationFrame(function() {
|
17950 | _this.performPendingScroll(dimension);
|
17951 | });
|
17952 | }, TablixControl.prototype.performPendingScroll = function(dimension) {
|
17953 | this.render(!1, dimension);
|
17954 | }, TablixControl.prototype.updateHorizontalPosition = function() {
|
17955 | this.rowDim.scrollbar.visible ? (this.columnDim.scrollbar.element.style.right = this.scrollBarElementWidth + TablixControl.UnitOfMeasurement,
|
17956 | this.footerDiv.style.right = this.scrollBarElementWidth + TablixControl.UnitOfMeasurement,
|
17957 | this.mainDiv.style.right = this.scrollBarElementWidth + TablixControl.UnitOfMeasurement) : (this.columnDim.scrollbar.element.style.right = "0" + TablixControl.UnitOfMeasurement,
|
17958 | this.mainDiv.style.right = "0" + TablixControl.UnitOfMeasurement, this.footerDiv.style.right = "0" + TablixControl.UnitOfMeasurement);
|
17959 | }, TablixControl.prototype.updateFooterVisibility = function() {
|
17960 | (this.rowDim.hasFooter() ? "block" !== this.footerDiv.style.display : "none" !== this.footerDiv.style.display) && (this.rowDim.hasFooter() ? this.footerDiv.style.display = "block" : this.footerDiv.style.display = "none");
|
17961 | }, TablixControl.prototype.updateVerticalPosition = function() {
|
17962 | var hasVerticalScrollbar = this.rowDim.scrollbar.visible, isDashboardTile = 1 === this.controlLayoutManager.getLayoutKind(), showFooter = hasVerticalScrollbar || isDashboardTile;
|
17963 | if (showFooter) {
|
17964 | var mainBottom = this.footerDiv.offsetHeight, footerBottom = 0, verticalScrollbarBottom = 0, hasHorizontalScrollbar = this.columnDim.scrollbar.visible;
|
17965 | hasHorizontalScrollbar && (mainBottom += this.scrollBarElementWidth, footerBottom += this.scrollBarElementWidth,
|
17966 | verticalScrollbarBottom = this.scrollBarElementWidth), this.mainDiv.style.bottom = mainBottom + TablixControl.UnitOfMeasurement,
|
17967 | this.rowDim.scrollbar.element.style.bottom = verticalScrollbarBottom + TablixControl.UnitOfMeasurement,
|
17968 | this.footerDiv.style.bottom = footerBottom + TablixControl.UnitOfMeasurement, this.footerDiv.style.removeProperty("top");
|
17969 | } else this.footerDiv.style.top = this.gridDimensions.rowHierarchyContentHeight + TablixControl.UnitOfMeasurement,
|
17970 | this.footerDiv.style.removeProperty("bottom"), this.mainDiv.style.removeProperty("bottom");
|
17971 | }, TablixControl.prototype.alreadyRendered = function(scrollingDimension) {
|
17972 | return scrollingDimension === this.lastRenderingArgs.scrollingDimension && this.rowDimension.scrollOffset === this.lastRenderingArgs.rowScrollOffset && this.columnDimension.scrollOffset === this.lastRenderingArgs.columnScrollOffset;
|
17973 | }, TablixControl.prototype.render = function(clear, scrollingDimension) {
|
17974 | if (this.columnDim.makeScrollOffsetValid(), this.rowDim.makeScrollOffsetValid(),
|
17975 | clear || null === scrollingDimension) this.lastRenderingArgs = {}; else if (this.alreadyRendered(scrollingDimension)) return;
|
17976 | var done = !1;
|
17977 | this.renderIterationCount = 0, this.controlLayoutManager.onStartRenderingSession(scrollingDimension, this.mainDiv, clear);
|
17978 | var binder = this.binder;
|
17979 | binder.onStartRenderingSession();
|
17980 | for (var priorFooterHeight = this.gridDimensions.footerHeight, priorRowHierarchyHeight = this.gridDimensions.rowHierarchyHeight, priorRowHierarchyContentHeight = this.gridDimensions.rowHierarchyContentHeight; !done && this.renderIterationCount < TablixControl.MaxRenderIterationCount; ) {
|
17981 | var hScrollbarVisibility = this.columnDim.scrollbar.visible, vScrollbarVisibility = this.rowDim.scrollbar.visible;
|
17982 | this.columnDim._onStartRenderingIteration(), this.rowDim._onStartRenderingIteration(),
|
17983 | this.controlLayoutManager.onStartRenderingIteration(clear), this.renderCorner(),
|
17984 | this.columnDim._render(), this.rowDim._render(), done = this.controlLayoutManager.onEndRenderingIteration(),
|
17985 | this.columnDim._onEndRenderingIteration(), this.rowDim._onEndRenderingIteration(),
|
17986 | hScrollbarVisibility !== this.columnDim.scrollbar.visible && this.updateVerticalPosition(),
|
17987 | vScrollbarVisibility !== this.rowDim.scrollbar.visible && this.updateHorizontalPosition(),
|
17988 | this.renderIterationCount++;
|
17989 | }
|
17990 | this.controlLayoutManager.onEndRenderingSession(), binder.onEndRenderingSession(),
|
17991 | this.isTouchEnabled && this.updateTouchDimensions(), this.lastRenderingArgs.rowScrollOffset = this.rowDimension.scrollOffset,
|
17992 | this.lastRenderingArgs.columnScrollOffset = this.columnDimension.scrollOffset, this.updateContainerDimensions();
|
17993 | var lastRenderingArgs = this.lastRenderingArgs;
|
17994 | lastRenderingArgs.rowScrollOffset = this.rowDimension.scrollOffset, lastRenderingArgs.columnScrollOffset = this.columnDimension.scrollOffset,
|
17995 | lastRenderingArgs.scrollingDimension = scrollingDimension, priorFooterHeight === this.gridDimensions.footerHeight && priorRowHierarchyHeight === this.gridDimensions.rowHierarchyHeight && priorRowHierarchyContentHeight === this.gridDimensions.rowHierarchyContentHeight || this.updateVerticalPosition(),
|
17996 | this.options.interactive && (this.columnDim.scrollbar.refresh(), this.rowDim.scrollbar.refresh());
|
17997 | }, TablixControl.prototype.updateContainerDimensions = function() {
|
17998 | var gridDimensions = this.gridDimensions;
|
17999 | if (this._autoSizeWidth) {
|
18000 | var vScrollBarWidth = this.rowDim.scrollbar.visible ? this.scrollBarElementWidth : 0;
|
18001 | this.containerElement.style.width = gridDimensions.rowHierarchyWidth + gridDimensions.columnHierarchyWidth + vScrollBarWidth + TablixControl.UnitOfMeasurement;
|
18002 | }
|
18003 | if (this._autoSizeHeight) {
|
18004 | var hScrollBarHeight = this.columnDim.scrollbar.visible ? this.scrollBarElementWidth : 0;
|
18005 | this.containerElement.style.height = gridDimensions.columnHierarchyHeight + gridDimensions.rowHierarchyHeight + gridDimensions.footerHeight + hScrollBarHeight + TablixControl.UnitOfMeasurement;
|
18006 | }
|
18007 | }, TablixControl.prototype.cornerCellMatch = function(item, cell) {
|
18008 | var previousItem = cell.item;
|
18009 | return 0 === cell.type && previousItem && this.hierarchyTablixNavigator.cornerCellItemEquals(item, previousItem);
|
18010 | }, TablixControl.prototype.renderCorner = function() {
|
18011 | for (var columnDepth = this.columnDim.getDepth(), rowDepth = this.rowDim.getDepth(), i = 0; columnDepth > i; i++) for (var j = 0; rowDepth > j; j++) {
|
18012 | var item = this.hierarchyTablixNavigator.getCorner(j, i), cell = this.controlLayoutManager.getOrCreateCornerCell(item, j, i), match = this.cornerCellMatch(item, cell);
|
18013 | match || (this._unbindCell(cell), cell.type = 0, cell.item = item, this.binder.bindCornerCell(item, cell)),
|
18014 | this.controlLayoutManager.onCornerCellRealized(item, cell);
|
18015 | }
|
18016 | }, TablixControl.prototype._unbindCell = function(cell) {
|
18017 | switch (cell.type) {
|
18018 | case 3:
|
18019 | this.binder.unbindBodyCell(cell.item, cell);
|
18020 | break;
|
18021 |
|
18022 | case 2:
|
18023 | this.binder.unbindColumnHeader(cell.item, cell);
|
18024 | break;
|
18025 |
|
18026 | case 1:
|
18027 | this.binder.unbindRowHeader(cell.item, cell);
|
18028 | break;
|
18029 |
|
18030 | case 0:
|
18031 | this.binder.unbindCornerCell(cell.item, cell);
|
18032 | }
|
18033 | cell.item = null, cell.type = null;
|
18034 | }, TablixControl.prototype.onTouchEvent = function(args) {
|
18035 | var colShift, rowShift, that;
|
18036 | args && args.length > 0 && "columnDim" in args[0] && "rowDim" in args[0] && (that = args[0],
|
18037 | colShift = that.columnDim.scrollbar.visible ? args[1] : 0, rowShift = that.rowDim.scrollbar.visible ? args[2] : 0,
|
18038 | that.columnDim.scrollbar.viewMin = Math.max(0, that.columnDim.scrollbar.viewMin + colShift),
|
18039 | that.columnDim.scrollOffset = Math.max(0, that.columnDim.scrollOffset + colShift),
|
18040 | that.rowDim.scrollbar.viewMin = Math.max(0, that.rowDim.scrollbar.viewMin + rowShift),
|
18041 | that.rowDim.scrollOffset = Math.max(0, that.rowDim.scrollOffset + rowShift), 0 === colShift ? that._onScrollAsync(that.rowDim) : 0 === rowShift ? that._onScrollAsync(that.columnDim) : that._onScrollAsync(null));
|
18042 | }, TablixControl.UnitOfMeasurement = "px", TablixControl.TablixContainerClassName = "tablixContainer",
|
18043 | TablixControl.TablixTableAreaClassName = "tablixTableArea", TablixControl.TablixFooterClassName = "tableFooterArea",
|
18044 | TablixControl.DefaultFontSize = jsCommon.PixelConverter.fromPoint(controls.TablixDefaultTextSize),
|
18045 | TablixControl.MaxRenderIterationCount = 10, TablixControl;
|
18046 | }();
|
18047 | controls.TablixControl = TablixControl;
|
18048 | }(controls = visuals.controls || (visuals.controls = {}));
|
18049 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
18050 | }(powerbi || (powerbi = {}));
|
18051 | }, function(module, exports) {
|
18052 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
18053 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
18054 | function __() {
|
18055 | this.constructor = d;
|
18056 | }
|
18057 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
18058 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
18059 | });
|
18060 | !function(powerbi) {
|
18061 | var visuals;
|
18062 | !function(visuals) {
|
18063 | var controls;
|
18064 | !function(controls) {
|
18065 | var TablixDimension = function() {
|
18066 | function TablixDimension(tablixControl) {
|
18067 | this._scrollStep = .1, this._owner = tablixControl, this._hierarchyNavigator = tablixControl.hierarchyNavigator,
|
18068 | this._binder = tablixControl.getBinder(), this._tablixLayoutManager = tablixControl.layoutManager,
|
18069 | this.scrollOffset = 0;
|
18070 | }
|
18071 | return TablixDimension.prototype._onStartRenderingIteration = function() {
|
18072 | this.updateScrollPosition();
|
18073 | }, TablixDimension.prototype._onEndRenderingIteration = function() {}, TablixDimension.prototype.getValidScrollOffset = function(scrollOffset) {
|
18074 | return Math.min(Math.max(scrollOffset, 0), Math.max(this.getItemsCount() - this._scrollStep, 0));
|
18075 | }, TablixDimension.prototype.makeScrollOffsetValid = function() {
|
18076 | this.scrollOffset = this.getValidScrollOffset(this.scrollOffset);
|
18077 | }, TablixDimension.prototype.getIntegerScrollOffset = function() {
|
18078 | return Math.floor(this.scrollOffset);
|
18079 | }, TablixDimension.prototype.getFractionScrollOffset = function() {
|
18080 | return this.scrollOffset - this.getIntegerScrollOffset();
|
18081 | }, Object.defineProperty(TablixDimension.prototype, "scrollbar", {
|
18082 | get: function() {
|
18083 | return this._scrollbar;
|
18084 | },
|
18085 | enumerable: !0,
|
18086 | configurable: !0
|
18087 | }), TablixDimension.prototype.getFirstVisibleItem = function(level) {
|
18088 | return this._scrollItems[level];
|
18089 | }, TablixDimension.prototype.getFirstVisibleChild = function(item) {
|
18090 | return this._hierarchyNavigator.getAt(this._hierarchyNavigator.getChildren(item), this.getFirstVisibleChildIndex(item));
|
18091 | }, TablixDimension.prototype.getFirstVisibleChildIndex = function(item) {
|
18092 | var firstVisibleIndex, startItem = this.getFirstVisibleItem(this._hierarchyNavigator.getLevel(item) + 1);
|
18093 | return firstVisibleIndex = void 0 === startItem || void 0 !== startItem && this._hierarchyNavigator.getParent(startItem) !== item ? 0 : this._hierarchyNavigator.getIndex(startItem);
|
18094 | }, TablixDimension.prototype._initializeScrollbar = function(parentElement, touchDiv, layoutKind) {
|
18095 | var _this = this;
|
18096 | this._scrollbar = this._createScrollbar(parentElement, layoutKind), this._scrollbar._onscroll.push(function(e) {
|
18097 | return _this.onScroll();
|
18098 | }), touchDiv && (this.scrollbar.initTouch(touchDiv, !0), touchDiv.style.setProperty("-ms-touch-action", "pinch-zoom"));
|
18099 | }, TablixDimension.prototype.getItemsCount = function() {
|
18100 | return this.model ? this._hierarchyNavigator.getLeafCount(this.model) : 0;
|
18101 | }, TablixDimension.prototype.getDepth = function() {
|
18102 | return this.modelDepth;
|
18103 | }, TablixDimension.prototype.onScroll = function() {
|
18104 | this.scrollOffset = this._scrollbar.viewMin, this._owner._onScrollAsync(this);
|
18105 | }, Object.defineProperty(TablixDimension.prototype, "otherDimension", {
|
18106 | get: function() {
|
18107 | return this._otherDimension;
|
18108 | },
|
18109 | enumerable: !0,
|
18110 | configurable: !0
|
18111 | }), Object.defineProperty(TablixDimension.prototype, "layoutManager", {
|
18112 | get: function() {
|
18113 | return this._layoutManager;
|
18114 | },
|
18115 | enumerable: !0,
|
18116 | configurable: !0
|
18117 | }), TablixDimension.prototype._createScrollbar = function(parentElement, layoutKind) {
|
18118 | return null;
|
18119 | }, TablixDimension.prototype.updateScrollPosition = function() {
|
18120 | if (this._scrollItems = [], this.model) {
|
18121 | var firstVisibleScrollIndex = this.getIntegerScrollOffset(), firstVisible = this._hierarchyNavigator.getLeafAt(this.model, firstVisibleScrollIndex);
|
18122 | if (firstVisible) {
|
18123 | this._firstVisibleScrollIndex = firstVisibleScrollIndex;
|
18124 | do this._scrollItems[this._hierarchyNavigator.getLevel(firstVisible)] = firstVisible,
|
18125 | firstVisible = this._hierarchyNavigator.getParent(firstVisible); while (null !== firstVisible);
|
18126 | }
|
18127 | }
|
18128 | }, TablixDimension;
|
18129 | }();
|
18130 | controls.TablixDimension = TablixDimension;
|
18131 | var TablixRowDimension = function(_super) {
|
18132 | function TablixRowDimension(tablixControl) {
|
18133 | _super.call(this, tablixControl), this._layoutManager = this._tablixLayoutManager.rowLayoutManager,
|
18134 | this._footer = null;
|
18135 | }
|
18136 | return __extends(TablixRowDimension, _super), TablixRowDimension.prototype.setFooter = function(footerHeader) {
|
18137 | this._footer = footerHeader, this._owner.updateFooterVisibility();
|
18138 | }, TablixRowDimension.prototype.hasFooter = function() {
|
18139 | return null !== this._footer;
|
18140 | }, TablixRowDimension.prototype._render = function() {
|
18141 | var firstVisibleRowItem = this.getFirstVisibleItem(0);
|
18142 | this.hasFooter() && (this.addFooterRowHeader(this._footer), this.addFooterBodyCells(this._footer)),
|
18143 | void 0 !== firstVisibleRowItem && this.addNodes(this.model, 0, this.getDepth(), this._hierarchyNavigator.getIndex(firstVisibleRowItem));
|
18144 | }, TablixRowDimension.prototype._createScrollbar = function(parentElement, layoutKind) {
|
18145 | return new controls.VerticalScrollbar(parentElement, layoutKind);
|
18146 | }, TablixRowDimension.prototype.addNodes = function(items, rowIndex, depth, firstVisibleIndex) {
|
18147 | for (var count = this._hierarchyNavigator.getCount(items), i = firstVisibleIndex; count > i; i++) {
|
18148 | if (!this._layoutManager.needsToRealize) return;
|
18149 | var item = this._hierarchyNavigator.getAt(items, i), cell = this.addNode(item, items, rowIndex, depth);
|
18150 | rowIndex += cell.rowSpan;
|
18151 | }
|
18152 | }, TablixRowDimension.prototype.getFirstVisibleChildLeaf = function(item) {
|
18153 | for (var leaf = item; !this._hierarchyNavigator.isLeaf(leaf); ) leaf = this.getFirstVisibleChild(leaf);
|
18154 | return leaf;
|
18155 | }, TablixRowDimension.prototype.bindRowHeader = function(item, cell) {
|
18156 | this._binder.bindRowHeader(item, cell);
|
18157 | }, TablixRowDimension.prototype.addNode = function(item, items, rowIndex, depth) {
|
18158 | var previousCount, rowHeaderCell = this._tablixLayoutManager.getOrCreateRowHeader(item, items, rowIndex, this._hierarchyNavigator.getLevel(item)), match = this.rowHeaderMatch(item, rowHeaderCell);
|
18159 | return match || (this._owner._unbindCell(rowHeaderCell), rowHeaderCell.type = 1,
|
18160 | rowHeaderCell.item = item, rowHeaderCell.unfixRowHeight()), this._hierarchyNavigator.isLeaf(item) ? (rowHeaderCell.colSpan = depth - this._hierarchyNavigator.getLevel(item),
|
18161 | rowHeaderCell.rowSpan = 1, match || this.bindRowHeader(item, rowHeaderCell), this._tablixLayoutManager.onRowHeaderRealized(item, rowHeaderCell),
|
18162 | this.addBodyCells(item, items, rowIndex)) : (previousCount = this._layoutManager.getRealizedItemsCount(),
|
18163 | this.addNodes(this._hierarchyNavigator.getChildren(item), rowIndex, depth, this.getFirstVisibleChildIndex(item)),
|
18164 | rowHeaderCell.colSpan = 1, rowHeaderCell.rowSpan = this._layoutManager.getRealizedItemsCount() - previousCount + 1,
|
18165 | match || this.bindRowHeader(item, rowHeaderCell), this._tablixLayoutManager.onRowHeaderRealized(item, rowHeaderCell)),
|
18166 | rowHeaderCell;
|
18167 | }, TablixRowDimension.prototype.rowHeaderMatch = function(item, cell) {
|
18168 | var previousItem = cell.item;
|
18169 | return 1 === cell.type && previousItem && this._hierarchyNavigator.headerItemEquals(item, previousItem);
|
18170 | }, TablixRowDimension.prototype.addBodyCells = function(item, items, rowIndex) {
|
18171 | for (var firstVisibleColumnIndex = this._otherDimension.getIntegerScrollOffset(), columnCount = this._otherDimension._layoutManager.getRealizedItemsCount() - this.getDepth(), hierarchyNavigator = this._hierarchyNavigator, otherModel = this._otherDimension.model, layoutManager = this._tablixLayoutManager, i = 0; columnCount > i; i++) {
|
18172 | var cellItem = hierarchyNavigator.getIntersection(item, hierarchyNavigator.getLeafAt(otherModel, firstVisibleColumnIndex + i)), cell = layoutManager.getOrCreateBodyCell(cellItem, item, items, rowIndex, i);
|
18173 | this.bindBodyCell(cellItem, cell), layoutManager.onBodyCellRealized(cellItem, cell);
|
18174 | }
|
18175 | }, TablixRowDimension.prototype.bindBodyCell = function(item, cell) {
|
18176 | var match = this.bodyCelMatch(item, cell);
|
18177 | match || (this._owner._unbindCell(cell), cell.type = 3, cell.item = item, cell.unfixRowHeight(),
|
18178 | this._binder.bindBodyCell(item, cell));
|
18179 | }, TablixRowDimension.prototype.addFooterRowHeader = function(item) {
|
18180 | var cell = this._tablixLayoutManager.getOrCreateFooterRowHeader(item, this.model);
|
18181 | cell.colSpan = this.getDepth();
|
18182 | var match = this.rowHeaderMatch(item, cell);
|
18183 | match || (this._owner._unbindCell(cell), cell.type = 1, cell.item = item, cell.unfixRowHeight(),
|
18184 | this.bindRowHeader(item, cell), this._tablixLayoutManager.onRowHeaderFooterRealized(item, cell));
|
18185 | }, TablixRowDimension.prototype.addFooterBodyCells = function(rowItem) {
|
18186 | for (var firstVisibleColumnIndex = this._otherDimension.getIntegerScrollOffset(), columnCount = this._otherDimension.layoutManager.getRealizedItemsCount() - this.getDepth(), layoutManager = this._tablixLayoutManager, i = 0; columnCount > i; i++) {
|
18187 | var columnItem = this._hierarchyNavigator.getLeafAt(this._otherDimension.model, firstVisibleColumnIndex + i), item = this._hierarchyNavigator.getIntersection(rowItem, columnItem), cell = layoutManager.getOrCreateFooterBodyCell(item, i);
|
18188 | this.bindBodyCell(item, cell), layoutManager.onBodyCellFooterRealized(item, cell);
|
18189 | }
|
18190 | }, TablixRowDimension.prototype.bodyCelMatch = function(item, cell) {
|
18191 | var previousItem = cell.item;
|
18192 | return 3 === cell.type && previousItem && this._hierarchyNavigator.bodyCellItemEquals(item, previousItem);
|
18193 | }, TablixRowDimension;
|
18194 | }(TablixDimension);
|
18195 | controls.TablixRowDimension = TablixRowDimension;
|
18196 | var TablixColumnDimension = function(_super) {
|
18197 | function TablixColumnDimension(tablixControl) {
|
18198 | _super.call(this, tablixControl), this._layoutManager = this._tablixLayoutManager.columnLayoutManager;
|
18199 | }
|
18200 | return __extends(TablixColumnDimension, _super), TablixColumnDimension.prototype._render = function() {
|
18201 | var firstVisibleColumnItem = this.getFirstVisibleItem(0);
|
18202 | void 0 !== firstVisibleColumnItem && this.addNodes(this.model, 0, this.getDepth(), this._hierarchyNavigator.getIndex(firstVisibleColumnItem));
|
18203 | }, TablixColumnDimension.prototype._createScrollbar = function(parentElement, layoutKind) {
|
18204 | var scrollbar = new controls.HorizontalScrollbar(parentElement, layoutKind);
|
18205 | return scrollbar.smallIncrement = .2, scrollbar;
|
18206 | }, TablixColumnDimension.prototype.addNodes = function(items, columnIndex, depth, firstVisibleIndex) {
|
18207 | for (var count = this._hierarchyNavigator.getCount(items), i = firstVisibleIndex; count > i; i++) {
|
18208 | if (!this._layoutManager.needsToRealize) return;
|
18209 | var cell = this.addNode(this._hierarchyNavigator.getAt(items, i), items, columnIndex, depth);
|
18210 | columnIndex += cell.colSpan;
|
18211 | }
|
18212 | }, TablixColumnDimension.prototype.addNode = function(item, items, columnIndex, depth) {
|
18213 | var cell = this._tablixLayoutManager.getOrCreateColumnHeader(item, items, this._hierarchyNavigator.getLevel(item), columnIndex), match = this.columnHeaderMatch(item, cell);
|
18214 | if (match || (this._owner._unbindCell(cell), cell.type = 2, cell.item = item, cell.unfixRowHeight()),
|
18215 | this._hierarchyNavigator.isLeaf(item)) cell.rowSpan = depth - this._hierarchyNavigator.getLevel(item); else {
|
18216 | var previousCount = this._layoutManager.getRealizedItemsCount();
|
18217 | this.addNodes(this._hierarchyNavigator.getChildren(item), columnIndex, depth, this.getFirstVisibleChildIndex(item));
|
18218 | var childrenLevelDifference = this._hierarchyNavigator.getChildrenLevelDifference(item);
|
18219 | childrenLevelDifference === 1 / 0 ? cell.rowSpan = 1 : cell.rowSpan = childrenLevelDifference,
|
18220 | cell.colSpan = this._layoutManager.getRealizedItemsCount() - previousCount + 1;
|
18221 | }
|
18222 | return match || this._binder.bindColumnHeader(item, cell), this._tablixLayoutManager.onColumnHeaderRealized(item, cell),
|
18223 | cell;
|
18224 | }, TablixColumnDimension.prototype.columnHeaderMatch = function(item, cell) {
|
18225 | var previousItem = cell.item;
|
18226 | return 2 === cell.type && previousItem && this._hierarchyNavigator.headerItemEquals(item, previousItem);
|
18227 | }, TablixColumnDimension;
|
18228 | }(TablixDimension);
|
18229 | controls.TablixColumnDimension = TablixColumnDimension;
|
18230 | }(controls = visuals.controls || (visuals.controls = {}));
|
18231 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
18232 | }(powerbi || (powerbi = {}));
|
18233 | }, function(module, exports) {
|
18234 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
18235 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
18236 | !function(powerbi) {
|
18237 | var visuals;
|
18238 | !function(visuals) {
|
18239 | var controls;
|
18240 | !function(controls) {
|
18241 | var ColumnTouchDelegate = function() {
|
18242 | function ColumnTouchDelegate(region) {
|
18243 | this.dim = region, this.averageSize = 1, this.handlers = null, this.tablixControl = null;
|
18244 | }
|
18245 | return Object.defineProperty(ColumnTouchDelegate.prototype, "dimension", {
|
18246 | get: function() {
|
18247 | return this.dim;
|
18248 | },
|
18249 | enumerable: !0,
|
18250 | configurable: !0
|
18251 | }), ColumnTouchDelegate.prototype.setScrollDensity = function(xRatio) {
|
18252 | this.averageSize = xRatio;
|
18253 | }, ColumnTouchDelegate.prototype.resize = function(x, y, width, height) {
|
18254 | this.dim.x = x, this.dim.y = y, this.dim.width = width, this.dim.height = height;
|
18255 | }, ColumnTouchDelegate.prototype.getPixelToItem = function(x, y, dx, dy, down) {
|
18256 | return new controls.TouchUtils.TouchEvent(x * this.averageSize, 0, down, -dx * this.averageSize, 0);
|
18257 | }, ColumnTouchDelegate.prototype.touchEvent = function(e) {
|
18258 | var args = [];
|
18259 | args[0] = this.tablixControl, args[1] = e.dx, args[2] = e.dy, this.handlers && controls.fire([ this.handlers ], args);
|
18260 | }, ColumnTouchDelegate.prototype.setHandler = function(tablixObj, handlerCall) {
|
18261 | this.handlers = handlerCall, this.tablixControl = tablixObj;
|
18262 | }, ColumnTouchDelegate;
|
18263 | }();
|
18264 | controls.ColumnTouchDelegate = ColumnTouchDelegate;
|
18265 | var RowTouchDelegate = function() {
|
18266 | function RowTouchDelegate(region) {
|
18267 | this.dim = region, this.averageSize = 30, this.handlers = null, this.tablixControl = null;
|
18268 | }
|
18269 | return Object.defineProperty(RowTouchDelegate.prototype, "dimension", {
|
18270 | get: function() {
|
18271 | return this.dim;
|
18272 | },
|
18273 | enumerable: !0,
|
18274 | configurable: !0
|
18275 | }), RowTouchDelegate.prototype.setScrollDensity = function(yRatio) {
|
18276 | this.averageSize = yRatio;
|
18277 | }, RowTouchDelegate.prototype.resize = function(x, y, width, height) {
|
18278 | this.dim.x = x, this.dim.y = y, this.dim.width = width, this.dim.height = height;
|
18279 | }, RowTouchDelegate.prototype.getPixelToItem = function(x, y, dx, dy, down) {
|
18280 | var event = new controls.TouchUtils.TouchEvent(0, y * this.averageSize, down, 0, -dy * this.averageSize);
|
18281 | return event;
|
18282 | }, RowTouchDelegate.prototype.touchEvent = function(e) {
|
18283 | var args = [];
|
18284 | args[0] = this.tablixControl, args[1] = e.dx, args[2] = e.dy, this.handlers && controls.fire([ this.handlers ], args);
|
18285 | }, RowTouchDelegate.prototype.setHandler = function(tablixObj, handlerCall) {
|
18286 | this.handlers = handlerCall, this.tablixControl = tablixObj;
|
18287 | }, RowTouchDelegate;
|
18288 | }();
|
18289 | controls.RowTouchDelegate = RowTouchDelegate;
|
18290 | var BodyTouchDelegate = function() {
|
18291 | function BodyTouchDelegate(region) {
|
18292 | this.dim = region, this.averageSizeX = BodyTouchDelegate.DefaultAverageSizeX, this.averageSizeY = BodyTouchDelegate.DefaultAverageSizeY,
|
18293 | this.handlers = null, this.tablixControl = null;
|
18294 | }
|
18295 | return Object.defineProperty(BodyTouchDelegate.prototype, "dimension", {
|
18296 | get: function() {
|
18297 | return this.dim;
|
18298 | },
|
18299 | enumerable: !0,
|
18300 | configurable: !0
|
18301 | }), BodyTouchDelegate.prototype.setScrollDensity = function(xRatio, yRatio) {
|
18302 | this.averageSizeX = xRatio, this.averageSizeY = yRatio;
|
18303 | }, BodyTouchDelegate.prototype.resize = function(x, y, width, height) {
|
18304 | var dimension = this.dim;
|
18305 | dimension.x = x, dimension.y = y, dimension.width = width, dimension.height = height;
|
18306 | }, BodyTouchDelegate.prototype.getPixelToItem = function(x, y, dx, dy, down) {
|
18307 | return new controls.TouchUtils.TouchEvent(x * this.averageSizeX, y * this.averageSizeY, down, -dx * this.averageSizeX, -dy * this.averageSizeY);
|
18308 | }, BodyTouchDelegate.prototype.touchEvent = function(e) {
|
18309 | var args = [ this.tablixControl, e.dx, e.dy ];
|
18310 | this.handlers && controls.fire([ this.handlers ], args);
|
18311 | }, BodyTouchDelegate.prototype.setHandler = function(tablixObj, handlerCall) {
|
18312 | this.handlers = handlerCall, this.tablixControl = tablixObj;
|
18313 | }, BodyTouchDelegate.DefaultAverageSizeX = 30, BodyTouchDelegate.DefaultAverageSizeY = 30,
|
18314 | BodyTouchDelegate;
|
18315 | }();
|
18316 | controls.BodyTouchDelegate = BodyTouchDelegate;
|
18317 | }(controls = visuals.controls || (visuals.controls = {}));
|
18318 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
18319 | }(powerbi || (powerbi = {}));
|
18320 | }, function(module, exports) {
|
18321 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
18322 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
18323 | function __() {
|
18324 | this.constructor = d;
|
18325 | }
|
18326 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
18327 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
18328 | });
|
18329 | !function(powerbi) {
|
18330 | var visuals;
|
18331 | !function(visuals) {
|
18332 | var controls;
|
18333 | !function(controls) {
|
18334 | var TouchUtils;
|
18335 | !function(TouchUtils) {
|
18336 | var Point = function() {
|
18337 | function Point(x, y) {
|
18338 | this.x = x || 0, this.y = y || 0;
|
18339 | }
|
18340 | return Point.prototype.offset = function(offsetX, offsetY) {
|
18341 | this.x += offsetX, this.y += offsetY;
|
18342 | }, Point;
|
18343 | }();
|
18344 | TouchUtils.Point = Point;
|
18345 | var Rectangle = function(_super) {
|
18346 | function Rectangle(x, y, width, height) {
|
18347 | _super.call(this, x, y), this.width = width || 0, this.height = height || 0;
|
18348 | }
|
18349 | return __extends(Rectangle, _super), Object.defineProperty(Rectangle.prototype, "point", {
|
18350 | get: function() {
|
18351 | return new Point(this.x, this.y);
|
18352 | },
|
18353 | enumerable: !0,
|
18354 | configurable: !0
|
18355 | }), Rectangle.prototype.contains = function(p) {
|
18356 | return Rectangle.contains(this, p);
|
18357 | }, Rectangle.contains = function(rect, p) {
|
18358 | return p && !Rectangle.isEmpty(rect) ? rect.x <= p.x && p.x < rect.x + rect.width && rect.y <= p.y && p.y < rect.y + rect.height : !1;
|
18359 | }, Rectangle.isEmpty = function(rect) {
|
18360 | return !(void 0 !== rect && rect.width >= 0 && rect.height >= 0);
|
18361 | }, Rectangle;
|
18362 | }(Point);
|
18363 | TouchUtils.Rectangle = Rectangle, function(MouseButton) {
|
18364 | MouseButton[MouseButton.NoClick = 0] = "NoClick", MouseButton[MouseButton.LeftClick = 1] = "LeftClick",
|
18365 | MouseButton[MouseButton.RightClick = 2] = "RightClick", MouseButton[MouseButton.CenterClick = 3] = "CenterClick";
|
18366 | }(TouchUtils.MouseButton || (TouchUtils.MouseButton = {}));
|
18367 | var MouseButton = TouchUtils.MouseButton, TouchEvent = function() {
|
18368 | function TouchEvent(x, y, isMouseDown, dx, dy) {
|
18369 | this._x = x, this._y = y, this.isMouseButtonDown = isMouseDown, this._dx = dx || 0,
|
18370 | this._dy = dy || 0;
|
18371 | }
|
18372 | return Object.defineProperty(TouchEvent.prototype, "x", {
|
18373 | get: function() {
|
18374 | return this._x;
|
18375 | },
|
18376 | enumerable: !0,
|
18377 | configurable: !0
|
18378 | }), Object.defineProperty(TouchEvent.prototype, "y", {
|
18379 | get: function() {
|
18380 | return this._y;
|
18381 | },
|
18382 | enumerable: !0,
|
18383 | configurable: !0
|
18384 | }), Object.defineProperty(TouchEvent.prototype, "dx", {
|
18385 | get: function() {
|
18386 | return this._dx;
|
18387 | },
|
18388 | enumerable: !0,
|
18389 | configurable: !0
|
18390 | }), Object.defineProperty(TouchEvent.prototype, "dy", {
|
18391 | get: function() {
|
18392 | return this._dy;
|
18393 | },
|
18394 | enumerable: !0,
|
18395 | configurable: !0
|
18396 | }), Object.defineProperty(TouchEvent.prototype, "isMouseDown", {
|
18397 | get: function() {
|
18398 | return this.isMouseButtonDown;
|
18399 | },
|
18400 | enumerable: !0,
|
18401 | configurable: !0
|
18402 | }), TouchEvent;
|
18403 | }();
|
18404 | TouchUtils.TouchEvent = TouchEvent;
|
18405 | var TouchManager = function() {
|
18406 | function TouchManager() {
|
18407 | this.touchList = [], this.swipeDirection = 2, this.matchingDirectionCount = 0, this.lockThreshold = !0,
|
18408 | this.scrollThreshold = !0, this.lastTouchEvent = new TouchEvent(0, 0, !1);
|
18409 | }
|
18410 | return Object.defineProperty(TouchManager.prototype, "lastEvent", {
|
18411 | get: function() {
|
18412 | return this.lastTouchEvent;
|
18413 | },
|
18414 | enumerable: !0,
|
18415 | configurable: !0
|
18416 | }), TouchManager.prototype.addTouchRegion = function(region, handler, converter) {
|
18417 | var item = {
|
18418 | lastPoint: new TouchEvent(0, 0, !1),
|
18419 | handler: handler,
|
18420 | region: region,
|
18421 | converter: converter
|
18422 | };
|
18423 | this.touchList = this.touchList.concat([ item ]);
|
18424 | }, TouchManager.prototype.upAllTouches = function() {
|
18425 | var eventPoint, length;
|
18426 | length = this.touchList.length;
|
18427 | for (var i = 0; length > i; i++) this.touchList[i].lastPoint.isMouseDown && (eventPoint = this.touchList[i].converter.getPixelToItem(this.touchList[i].lastPoint.x, this.touchList[i].lastPoint.y, 0, 0, !1),
|
18428 | this.touchList[i].handler.touchEvent(eventPoint)), this.touchList[i].lastPoint = new TouchEvent(this.touchList[i].lastPoint.x, this.touchList[i].lastPoint.y, !1);
|
18429 | this.lastTouchEvent = new TouchEvent(0, 0, !1);
|
18430 | }, TouchManager.prototype.touchEvent = function(e) {
|
18431 | var list, length, x = 0, y = 0, dx = 0, dy = 0, angle = 0, eventPoint = null;
|
18432 | list = this._getActive(), !this.lastTouchEvent.isMouseDown && e.isMouseDown && (list = this._findRegions(e)),
|
18433 | dx = this.lastTouchEvent.x - e.x, dy = this.lastTouchEvent.y - e.y, this.lastTouchEvent = new TouchEvent(e.x, e.y, e.isMouseDown, dx, dy),
|
18434 | length = list.length;
|
18435 | for (var i = 0; length > i; i++) x = e.x - list[i].region.point.x, y = e.y - list[i].region.point.y,
|
18436 | list[i].lastPoint.isMouseDown && e.isMouseDown ? (dx = x - list[i].lastPoint.x,
|
18437 | dy = y - list[i].lastPoint.y, angle = Math.abs(180 / Math.PI * Math.atan(dy / dx)),
|
18438 | this.scrollThreshold && (this.lockThreshold && this.matchingDirectionCount > 5 ? 1 === this.swipeDirection ? dy = 0 : 0 === this.swipeDirection && (dx = 0) : 20 > angle ? (dy = 0,
|
18439 | 1 === this.swipeDirection ? this.matchingDirectionCount++ : (this.matchingDirectionCount = 1,
|
18440 | this.swipeDirection = 1)) : (angle = Math.abs(180 / Math.PI * Math.atan(dx / dy)),
|
18441 | 20 > angle ? (dx = 0, 0 === this.swipeDirection ? this.matchingDirectionCount++ : (this.matchingDirectionCount = 1,
|
18442 | this.swipeDirection = 0)) : 2 === this.swipeDirection ? this.matchingDirectionCount++ : (this.swipeDirection = 2,
|
18443 | this.matchingDirectionCount = 1)))) : (dx = 0, dy = 0, this.swipeDirection = 2,
|
18444 | this.matchingDirectionCount = 0), list[i].lastPoint = new TouchEvent(x, y, e.isMouseDown, dx, dy),
|
18445 | eventPoint = list[i].converter.getPixelToItem(x, y, dx, dy, e.isMouseDown), list[i].handler.touchEvent(eventPoint);
|
18446 | }, TouchManager.prototype._findRegions = function(e) {
|
18447 | var length, list = [];
|
18448 | length = this.touchList.length;
|
18449 | for (var i = 0; length > i; i++) this.touchList[i].region.contains(new Point(e.x, e.y)) && (list = list.concat([ this.touchList[i] ]));
|
18450 | return list;
|
18451 | }, TouchManager.prototype._getActive = function() {
|
18452 | var length, list = [];
|
18453 | length = this.touchList.length;
|
18454 | for (var i = 0; length > i; i++) this.touchList[i].lastPoint.isMouseDown && (list = list.concat([ this.touchList[i] ]));
|
18455 | return list;
|
18456 | }, TouchManager;
|
18457 | }();
|
18458 | TouchUtils.TouchManager = TouchManager;
|
18459 | var MinDistanceForSwipe = 80, MaxTimeForSwipe = 600, TouchEventInterpreter = function() {
|
18460 | function TouchEventInterpreter(manager) {
|
18461 | this.manager = manager, this.allowMouseDrag = !0, this.touchPanel = null, this.scale = 1,
|
18462 | this.documentMouseMoveWrapper = null, this.documentMouseUpWrapper = null, this.sliding = !1;
|
18463 | }
|
18464 | return TouchEventInterpreter.prototype.initTouch = function(panel, touchReferencePoint, allowMouseDrag) {
|
18465 | var _this = this;
|
18466 | panel.style.setProperty("-ms-touch-action", "pinch-zoom"), this.touchReferencePoint = touchReferencePoint,
|
18467 | this.touchPanel = panel, this.allowMouseDrag = void 0 === allowMouseDrag ? !0 : allowMouseDrag,
|
18468 | "ontouchmove" in panel ? (panel.addEventListener("touchstart", function(e) {
|
18469 | return _this.onTouchStart(e);
|
18470 | }), panel.addEventListener("touchend", function(e) {
|
18471 | return _this.onTouchEnd(e);
|
18472 | })) : (panel.addEventListener("mousedown", function(e) {
|
18473 | return _this.onTouchMouseDown(e);
|
18474 | }), panel.addEventListener("mouseup", function(e) {
|
18475 | return _this.onTouchMouseUp(e);
|
18476 | }));
|
18477 | }, TouchEventInterpreter.prototype.getXYByClient = function(pageX, pageY, rect) {
|
18478 | var x = rect.left, y = rect.top;
|
18479 | void 0 !== window.scrollX && (x += window.scrollX, y += window.scrollY);
|
18480 | var point = new Point(0, 0);
|
18481 | return point.offset(pageX - x, pageY - y), point;
|
18482 | }, TouchEventInterpreter.prototype.onTouchStart = function(e) {
|
18483 | if (1 === e.touches.length) {
|
18484 | e.cancelBubble = !0;
|
18485 | var mouchEvent = e.touches[0];
|
18486 | this.touchStartTime = new Date().getTime(), this.touchStartPageY = mouchEvent.pageY,
|
18487 | this.onTouchMouseDown(mouchEvent);
|
18488 | }
|
18489 | }, TouchEventInterpreter.prototype.onTouchMove = function(e) {
|
18490 | if (1 === e.touches.length) {
|
18491 | e.preventDefault && e.preventDefault();
|
18492 | var mouchEvent = e.touches[0];
|
18493 | this.touchLastPageY = mouchEvent.pageY, this.touchLastPageX = mouchEvent.pageX,
|
18494 | this.sliding || this.onTouchMouseMove(mouchEvent);
|
18495 | }
|
18496 | }, TouchEventInterpreter.prototype.onTouchEnd = function(e) {
|
18497 | this.clearTouchEvents();
|
18498 | var swipeInfo = this.getSwipeInfo();
|
18499 | this.didUserSwipe(swipeInfo) ? this.startSlideAffect(swipeInfo) : this.sliding || this.upAllTouches();
|
18500 | }, TouchEventInterpreter.prototype.onTouchMouseDown = function(e) {
|
18501 | var _this = this;
|
18502 | this.scale = controls.HTMLElementUtils.getAccumulatedScale(this.touchPanel), document.getSelection().removeAllRanges(),
|
18503 | this.rect = (this.touchReferencePoint ? this.touchReferencePoint : this.touchPanel).getBoundingClientRect(),
|
18504 | "ontouchmove" in this.touchPanel ? (this.documentMouseMoveWrapper = function(e) {
|
18505 | return _this.onTouchMove(e);
|
18506 | }, document.addEventListener("touchmove", this.documentMouseMoveWrapper), this.documentMouseUpWrapper = function(e) {
|
18507 | return _this.onTouchEnd(e);
|
18508 | }, document.addEventListener("touchend", this.documentMouseUpWrapper)) : (this.documentMouseMoveWrapper = function(e) {
|
18509 | return _this.onTouchMouseMove(e);
|
18510 | }, document.addEventListener("mousemove", this.documentMouseMoveWrapper), this.documentMouseUpWrapper = function(e) {
|
18511 | return _this.onTouchMouseUp(e);
|
18512 | }, document.addEventListener("mouseup", this.documentMouseUpWrapper)), "setCapture" in this.touchPanel && this.touchPanel.setCapture();
|
18513 | }, TouchEventInterpreter.prototype.onTouchMouseMove = function(e) {
|
18514 | var event, point, rect = this.rect, validMouseDragEvent = null !== rect && e.which !== MouseButton.NoClick;
|
18515 | validMouseDragEvent && !this.sliding && (point = this.getXYByClient(e.pageX, e.pageY, rect),
|
18516 | event = new TouchEvent(point.x / this.scale, point.y / this.scale, validMouseDragEvent),
|
18517 | this.manager.touchEvent(event), e.preventDefault ? e.preventDefault() : "returnValue" in e && (e.returnValue = !1));
|
18518 | }, TouchEventInterpreter.prototype.onTouchMouseUp = function(e, bubble) {
|
18519 | this.upAllTouches(), this.clearTouchEvents();
|
18520 | }, TouchEventInterpreter.prototype.getSwipeInfo = function() {
|
18521 | var touchEndTime = new Date().getTime(), touchTime = touchEndTime - this.touchStartTime, touchDist = this.touchLastPageY - this.touchStartPageY, touchDirection = 0 > touchDist ? -1 : 1;
|
18522 | return {
|
18523 | direction: touchDirection,
|
18524 | distance: touchDist,
|
18525 | endTime: touchEndTime,
|
18526 | time: touchTime
|
18527 | };
|
18528 | }, TouchEventInterpreter.prototype.didUserSwipe = function(swipeInfo) {
|
18529 | return swipeInfo.time < MaxTimeForSwipe && swipeInfo.distance * swipeInfo.direction > MinDistanceForSwipe;
|
18530 | }, TouchEventInterpreter.prototype.startSlideAffect = function(swipeInfo) {
|
18531 | var _this = this;
|
18532 | if (!this.sliding) {
|
18533 | this.sliding = !0;
|
18534 | var point = this.getXYByClient(this.touchLastPageX, this.touchLastPageY, this.rect);
|
18535 | this.slide(point, 300, swipeInfo), requestAnimationFrame(function() {
|
18536 | _this.didUserChangeDirection(swipeInfo) || _this.slide(point, 200, swipeInfo), _this.clearSlide();
|
18537 | });
|
18538 | }
|
18539 | }, TouchEventInterpreter.prototype.didUserChangeDirection = function(swipeInfo) {
|
18540 | if (this.touchStartTime <= swipeInfo.endTime) return !1;
|
18541 | var updatedDist = this.touchLastPageY - this.touchStartPageY, updatedDirection = 0 > updatedDist ? -1 : 1;
|
18542 | return updatedDirection !== swipeInfo.direction;
|
18543 | }, TouchEventInterpreter.prototype.slide = function(point, slideDist, swipeInfo) {
|
18544 | var updatedDist = this.touchStartTime > swipeInfo.endTime ? this.touchLastPageY - this.touchStartPageY : 0;
|
18545 | point.y += slideDist * swipeInfo.direction + updatedDist;
|
18546 | var event = new TouchEvent(point.x / this.scale, point.y / this.scale, !0);
|
18547 | this.manager.touchEvent(event);
|
18548 | }, TouchEventInterpreter.prototype.clearSlide = function() {
|
18549 | this.sliding = !1, this.upAllTouches();
|
18550 | }, TouchEventInterpreter.prototype.upAllTouches = function() {
|
18551 | null === this.documentMouseMoveWrapper && (this.rect = null, this.manager.upAllTouches());
|
18552 | }, TouchEventInterpreter.prototype.clearTouchEvents = function() {
|
18553 | "releaseCapture" in this.touchPanel && this.touchPanel.releaseCapture(), null !== this.documentMouseMoveWrapper && ("ontouchmove" in this.touchPanel ? (document.removeEventListener("touchmove", this.documentMouseMoveWrapper),
|
18554 | document.removeEventListener("touchend", this.documentMouseUpWrapper)) : (document.removeEventListener("mousemove", this.documentMouseMoveWrapper),
|
18555 | document.removeEventListener("mouseup", this.documentMouseUpWrapper)), this.documentMouseMoveWrapper = null,
|
18556 | this.documentMouseUpWrapper = null);
|
18557 | }, TouchEventInterpreter;
|
18558 | }();
|
18559 | TouchUtils.TouchEventInterpreter = TouchEventInterpreter;
|
18560 | }(TouchUtils = controls.TouchUtils || (controls.TouchUtils = {}));
|
18561 | }(controls = visuals.controls || (visuals.controls = {}));
|
18562 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
18563 | }(powerbi || (powerbi = {}));
|
18564 | }, function(module, exports) {
|
18565 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
18566 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
18567 | !function(powerbi) {
|
18568 | var visuals;
|
18569 | !function(visuals) {
|
18570 | var controls;
|
18571 | !function(controls) {
|
18572 | !function(TablixType) {
|
18573 | TablixType[TablixType.Matrix = 0] = "Matrix", TablixType[TablixType.Table = 1] = "Table";
|
18574 | }(controls.TablixType || (controls.TablixType = {}));
|
18575 | controls.TablixType;
|
18576 | }(controls = visuals.controls || (visuals.controls = {}));
|
18577 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
18578 | }(powerbi || (powerbi = {}));
|
18579 | }, function(module, exports) {
|
18580 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
18581 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
18582 | !function(powerbi) {
|
18583 | var visuals;
|
18584 | !function(visuals) {
|
18585 | var controls;
|
18586 | !function(controls) {
|
18587 | var PropAutoSizeWidth = controls.internal.TablixObjects.PropGeneralAutoSizeColumns, getMetadataObjects = controls.internal.TablixObjects.getMetadadataObjects, TablixColumnWidthManager = function() {
|
18588 | function TablixColumnWidthManager(dataView, isMatrix, hostPersistCallBack, matrixLeafNodes) {
|
18589 | this.columnWidthObjects = {}, this.isMatrix = isMatrix, this.updateDataView(dataView, matrixLeafNodes),
|
18590 | this.hostPersistCallBack = hostPersistCallBack, this.visualObjectInstancesToPersist = {
|
18591 | merge: [],
|
18592 | remove: []
|
18593 | };
|
18594 | }
|
18595 | return TablixColumnWidthManager.prototype.updateDataView = function(dataView, matrixLeafNodes) {
|
18596 | this.previousDataView = this.currentDataView, this.previousDataView ? this.previousAutoColumnSizePropertyValue = PropAutoSizeWidth.getValue(getMetadataObjects(this.previousDataView)) : this.previousAutoColumnSizePropertyValue = void 0,
|
18597 | this.currentDataView = dataView, this.currentDataView ? this.currentAutoColumnSizePropertyValue = PropAutoSizeWidth.getValue(getMetadataObjects(this.currentDataView)) : this.currentAutoColumnSizePropertyValue = void 0,
|
18598 | this.matrixLeafNodes = matrixLeafNodes, this.updateColumnsMetadata(), this.updateTablixColumnWidths();
|
18599 | }, TablixColumnWidthManager.prototype.updateColumnsMetadata = function() {
|
18600 | this.columnWidthObjects = {}, this.isMatrix ? this.updateMatrixColumnsMetadata() : this.updateTableColumnsMetadata();
|
18601 | }, TablixColumnWidthManager.prototype.updateTableColumnsMetadata = function() {
|
18602 | if (this.currentDataView && this.currentDataView.table) for (var columnMetaData = this.currentDataView.table.columns, i = 0, len = columnMetaData.length; len > i; i++) {
|
18603 | var queryName = columnMetaData[i].queryName;
|
18604 | queryName && (this.columnWidthObjects[queryName] = {
|
18605 | queryName: queryName,
|
18606 | width: void 0,
|
18607 | isFixed: !1
|
18608 | });
|
18609 | }
|
18610 | }, TablixColumnWidthManager.prototype.updateMatrixColumnsMetadata = function() {
|
18611 | if (this.currentDataView && this.currentDataView.matrix && this.currentDataView.matrix.rows) for (var i = 0, len = this.currentDataView.matrix.rows.levels.length; len > i; i++) {
|
18612 | var rowGroup = this.currentDataView.matrix.rows.levels[i];
|
18613 | if (1 === rowGroup.sources.length) {
|
18614 | var queryName = rowGroup.sources[0].queryName;
|
18615 | queryName && (this.columnWidthObjects[queryName] = {
|
18616 | queryName: queryName,
|
18617 | width: void 0,
|
18618 | isFixed: !1
|
18619 | });
|
18620 | }
|
18621 | }
|
18622 | if (this.matrixLeafNodes) for (var i = 0, len = this.matrixLeafNodes.length; len > i; i++) {
|
18623 | var queryName = this.matrixLeafNodes[i].queryName;
|
18624 | queryName && (this.columnWidthObjects[queryName] = {
|
18625 | queryName: queryName,
|
18626 | width: void 0,
|
18627 | isFixed: !1
|
18628 | });
|
18629 | }
|
18630 | }, TablixColumnWidthManager.prototype.updateTablixColumnWidths = function() {
|
18631 | var columnMetaData = this.currentDataView && this.currentDataView.metadata && this.currentDataView.metadata.columns;
|
18632 | if (columnMetaData) {
|
18633 | if (this.shouldClearAllColumnWidths()) return void this.autoSizeAllColumns();
|
18634 | this.deserializeColumnsWidth(columnMetaData);
|
18635 | }
|
18636 | }, TablixColumnWidthManager.prototype.autoSizeAllColumns = function() {
|
18637 | for (var queryName in this.columnWidthObjects) this.visualObjectInstancesToPersist.remove.push(this.generateColumnWidthObjectToPersist(queryName, void 0));
|
18638 | this.callHostToPersist();
|
18639 | }, TablixColumnWidthManager.prototype.deserializeColumnsWidth = function(columnsMetadata) {
|
18640 | for (var colObj in this.columnWidthObjects) this.columnWidthObjects[colObj].isFixed = !this.currentAutoColumnSizePropertyValue,
|
18641 | this.columnWidthObjects[colObj].width = void 0;
|
18642 | for (var i = 0, len = columnsMetadata.length; len > i; i++) {
|
18643 | var column = columnsMetadata[i], queryName = column.queryName, width = powerbi.DataViewObjects.getValue(column.objects, TablixColumnWidthManager.columnWidthProp);
|
18644 | this.columnWidthObjects.hasOwnProperty(queryName) && null != width && (this.columnWidthObjects[queryName].width = width,
|
18645 | this.columnWidthObjects[queryName].isFixed = !0);
|
18646 | }
|
18647 | }, TablixColumnWidthManager.prototype.shouldPersistAllColumnWidths = function() {
|
18648 | return this.previousDataView ? !this.currentAutoColumnSizePropertyValue && this.previousAutoColumnSizePropertyValue : !1;
|
18649 | }, TablixColumnWidthManager.prototype.shouldClearAllColumnWidths = function() {
|
18650 | return null != this.previousDataView && this.previousAutoColumnSizePropertyValue === !1 && null != this.currentDataView && this.currentAutoColumnSizePropertyValue === !0;
|
18651 | }, TablixColumnWidthManager.getColumnQueryName = function(column) {
|
18652 | var headerCell = column.getTablixCell();
|
18653 | switch (headerCell.type) {
|
18654 | case 0:
|
18655 | if (null == headerCell.item || null == headerCell.item.metadata) return;
|
18656 | return headerCell.item.metadata.queryName;
|
18657 |
|
18658 | case 2:
|
18659 | return headerCell.item.queryName;
|
18660 |
|
18661 | default:
|
18662 | return;
|
18663 | }
|
18664 | }, TablixColumnWidthManager.prototype.getColumnWidthObjects = function() {
|
18665 | return this.columnWidthObjects;
|
18666 | }, TablixColumnWidthManager.prototype.getFixedColumnWidthObjects = function() {
|
18667 | var fixedOnly = {};
|
18668 | for (var queryName in this.columnWidthObjects) {
|
18669 | var obj = this.columnWidthObjects[queryName];
|
18670 | obj.isFixed && (fixedOnly[queryName] = obj);
|
18671 | }
|
18672 | return fixedOnly;
|
18673 | }, TablixColumnWidthManager.prototype.getPersistedColumnWidth = function(queryName) {
|
18674 | var obj = this.columnWidthObjects[queryName];
|
18675 | return obj && obj.width;
|
18676 | }, TablixColumnWidthManager.prototype.callHostToPersist = function() {
|
18677 | this.hostPersistCallBack && this.hostPersistCallBack(this.visualObjectInstancesToPersist),
|
18678 | this.visualObjectInstancesToPersist = {
|
18679 | merge: [],
|
18680 | remove: []
|
18681 | };
|
18682 | }, TablixColumnWidthManager.prototype.onColumnWidthChanged = function(queryName, width) {
|
18683 | if (null != queryName && null != this.columnWidthObjects[queryName]) {
|
18684 | var resizedColumn = this.columnWidthObjects[queryName];
|
18685 | -1 === width ? (resizedColumn.width = void 0, resizedColumn.isFixed = !this.currentAutoColumnSizePropertyValue,
|
18686 | this.visualObjectInstancesToPersist.remove.push(this.generateColumnWidthObjectToPersist(resizedColumn.queryName, void 0)),
|
18687 | this.callHostToPersist()) : (resizedColumn.width = width, resizedColumn.isFixed = !0,
|
18688 | this.visualObjectInstancesToPersist.merge.push(this.generateColumnWidthObjectToPersist(queryName, width)),
|
18689 | this.callHostToPersist());
|
18690 | }
|
18691 | }, TablixColumnWidthManager.prototype.onColumnsRendered = function(renderedColumns) {
|
18692 | for (var maxWidths = {}, i = 0, len = renderedColumns.length; len > i; i++) {
|
18693 | var queryName = renderedColumns[i].queryName, newWidth = renderedColumns[i].width;
|
18694 | null == maxWidths[queryName] ? maxWidths[queryName] = {
|
18695 | queryName: queryName,
|
18696 | width: newWidth,
|
18697 | isFixed: !1
|
18698 | } : newWidth > maxWidths[queryName].width && (maxWidths[queryName].width = newWidth);
|
18699 | }
|
18700 | var widthChanged = !1;
|
18701 | for (var queryName in this.columnWidthObjects) if (maxWidths[queryName]) {
|
18702 | var colWidthObj = this.columnWidthObjects[queryName];
|
18703 | colWidthObj.isFixed && null == colWidthObj.width && (colWidthObj.width = maxWidths[queryName].width,
|
18704 | this.visualObjectInstancesToPersist.merge.push(this.generateColumnWidthObjectToPersist(queryName, colWidthObj.width)),
|
18705 | widthChanged = !0);
|
18706 | }
|
18707 | return widthChanged && this.callHostToPersist(), widthChanged;
|
18708 | }, TablixColumnWidthManager.prototype.generateColumnWidthObjectToPersist = function(queryName, width) {
|
18709 | return {
|
18710 | selector: {
|
18711 | metadata: queryName
|
18712 | },
|
18713 | objectName: "general",
|
18714 | properties: {
|
18715 | columnWidth: width
|
18716 | }
|
18717 | };
|
18718 | }, TablixColumnWidthManager.columnWidthProp = {
|
18719 | objectName: "general",
|
18720 | propertyName: "columnWidth"
|
18721 | }, TablixColumnWidthManager;
|
18722 | }();
|
18723 | controls.TablixColumnWidthManager = TablixColumnWidthManager;
|
18724 | }(controls = visuals.controls || (visuals.controls = {}));
|
18725 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
18726 | }(powerbi || (powerbi = {}));
|
18727 | }, function(module, exports) {
|
18728 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
18729 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
18730 | !function(powerbi) {
|
18731 | var visuals;
|
18732 | !function(visuals) {
|
18733 | var AnimatedText = function() {
|
18734 | function AnimatedText(name) {
|
18735 | this.mainText = jsCommon.CssConstants.createClassAndSelector("mainText"), this.name = name,
|
18736 | this.visualConfiguration = {
|
18737 | maxFontSize: 60
|
18738 | };
|
18739 | }
|
18740 | return AnimatedText.prototype.getMetaDataColumn = function(dataView) {
|
18741 | if (dataView && dataView.metadata && dataView.metadata.columns) for (var i = 0, ilen = dataView.metadata.columns.length; ilen > i; i++) {
|
18742 | var column = dataView.metadata.columns[i];
|
18743 | if (column.isMeasure) {
|
18744 | this.metaDataColumn = column;
|
18745 | break;
|
18746 | }
|
18747 | }
|
18748 | }, AnimatedText.prototype.getAdjustedFontHeight = function(availableWidth, textToMeasure, seedFontHeight) {
|
18749 | var textProperties = {
|
18750 | fontFamily: null,
|
18751 | fontSize: null,
|
18752 | text: textToMeasure
|
18753 | }, fontHeight = this.getAdjustedFontHeightCore(textProperties, availableWidth, seedFontHeight, 0);
|
18754 | return fontHeight;
|
18755 | }, AnimatedText.prototype.getAdjustedFontHeightCore = function(textProperties, availableWidth, seedFontHeight, iteration) {
|
18756 | if (iteration > 10) return seedFontHeight;
|
18757 | textProperties.fontSize = jsCommon.PixelConverter.toString(seedFontHeight);
|
18758 | var candidateLength = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties);
|
18759 | return availableWidth > candidateLength ? seedFontHeight : this.getAdjustedFontHeightCore(textProperties, availableWidth, .9 * seedFontHeight, iteration + 1);
|
18760 | }, AnimatedText.prototype.clear = function() {
|
18761 | this.svg.select(this.mainText.selector).text("");
|
18762 | }, AnimatedText.prototype.doValueTransition = function(startValue, endValue, displayUnitSystemType, animationOptions, duration, forceUpdate, formatter) {
|
18763 | if (forceUpdate || startValue !== endValue || null == endValue) {
|
18764 | startValue || (startValue = 0);
|
18765 | var svg = this.svg, viewport = this.currentViewport, height = viewport.height, width = viewport.width, endValueArr = [ endValue ], seedFontHeight = this.getSeedFontHeight(width, height), translateX = this.getTranslateX(width), translateY = this.getTranslateY(seedFontHeight), metaDataColumn = this.metaDataColumn;
|
18766 | formatter || (formatter = visuals.valueFormatter.create({
|
18767 | format: this.getFormatString(metaDataColumn),
|
18768 | value: endValue,
|
18769 | displayUnitSystemType: displayUnitSystemType,
|
18770 | formatSingleValues: !0,
|
18771 | allowFormatBeautification: !0,
|
18772 | columnType: metaDataColumn ? metaDataColumn.type : void 0
|
18773 | }));
|
18774 | var startText = formatter.format(startValue), endText = formatter.format(endValue);
|
18775 | svg.attr("class", this.name);
|
18776 | var textElement = svg.selectAll("text").data(endValueArr);
|
18777 | textElement.enter().append("text").attr("class", this.mainText["class"]);
|
18778 | var fontHeight = this.getAdjustedFontHeight(width, endText, seedFontHeight);
|
18779 | translateY = this.getTranslateY(fontHeight + (height - fontHeight) / 2);
|
18780 | var textElementUpdate = textElement.text(startText).attr({
|
18781 | "text-anchor": this.getTextAnchor(),
|
18782 | "font-size": fontHeight,
|
18783 | transform: visuals.SVGUtil.translate(translateX, translateY)
|
18784 | }).style({
|
18785 | fill: this.style.titleText.color.value
|
18786 | }).call(visuals.tooltipUtils.tooltipUpdate, [ startText ]);
|
18787 | if (null == endValue) textElementUpdate.text(endText).call(visuals.tooltipUtils.tooltipUpdate, [ endText ]); else if (metaDataColumn && visuals.AxisHelper.isDateTime(metaDataColumn.type)) textElementUpdate.text(endText).call(visuals.tooltipUtils.tooltipUpdate, [ endText ]); else {
|
18788 | var interpolatedValue_1 = startValue;
|
18789 | textElementUpdate.transition().duration(duration).tween("text", function(d) {
|
18790 | var i = d3.interpolate(interpolatedValue_1, d);
|
18791 | return function(t) {
|
18792 | var num = i(t);
|
18793 | this.textContent = formatter.format(num);
|
18794 | };
|
18795 | });
|
18796 | }
|
18797 | visuals.SVGUtil.flushAllD3TransitionsIfNeeded(animationOptions);
|
18798 | }
|
18799 | }, AnimatedText.prototype.setTextColor = function(color) {
|
18800 | this.style.titleText.color.value = color;
|
18801 | }, AnimatedText.prototype.getSeedFontHeight = function(boundingWidth, boundingHeight) {
|
18802 | var estimatedSize = Math.floor(.75 * Math.min(boundingWidth, boundingHeight)), maxFontSize = this.visualConfiguration.maxFontSize;
|
18803 | return maxFontSize ? Math.min(maxFontSize, estimatedSize) : estimatedSize;
|
18804 | }, AnimatedText.prototype.getTranslateX = function(width) {
|
18805 | if (this.visualConfiguration) switch (this.visualConfiguration.align) {
|
18806 | case "left":
|
18807 | return 0;
|
18808 |
|
18809 | case "right":
|
18810 | return width;
|
18811 | }
|
18812 | return width / 2;
|
18813 | }, AnimatedText.prototype.getTranslateY = function(height) {
|
18814 | return height;
|
18815 | }, AnimatedText.prototype.getTextAnchor = function() {
|
18816 | if (this.visualConfiguration) switch (this.visualConfiguration.align) {
|
18817 | case "left":
|
18818 | return "start";
|
18819 |
|
18820 | case "right":
|
18821 | return "end";
|
18822 | }
|
18823 | return "middle";
|
18824 | }, AnimatedText.prototype.getFormatString = function(column) {
|
18825 | return visuals.valueFormatter.getFormatString(column, AnimatedText.formatStringProp);
|
18826 | }, AnimatedText.formatStringProp = {
|
18827 | objectName: "general",
|
18828 | propertyName: "formatString"
|
18829 | }, AnimatedText;
|
18830 | }();
|
18831 | visuals.AnimatedText = AnimatedText;
|
18832 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
18833 | }(powerbi || (powerbi = {}));
|
18834 | }, function(module, exports) {
|
18835 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
18836 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
18837 | function __() {
|
18838 | this.constructor = d;
|
18839 | }
|
18840 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
18841 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
18842 | });
|
18843 | !function(powerbi) {
|
18844 | var visuals;
|
18845 | !function(visuals) {
|
18846 | var AnimatedNumber = function(_super) {
|
18847 | function AnimatedNumber(svg, animator) {
|
18848 | _super.call(this, "animatedNumber"), svg && (this.svg = svg), animator && (this.animator = animator);
|
18849 | }
|
18850 | return __extends(AnimatedNumber, _super), AnimatedNumber.prototype.init = function(options) {
|
18851 | this.options = options;
|
18852 | var element = options.element;
|
18853 | this.svg || (this.svg = d3.select(element.get(0)).append("svg")), this.currentViewport = options.viewport,
|
18854 | this.hostServices = options.host, this.style = options.style, this.updateViewportDependantProperties();
|
18855 | }, AnimatedNumber.prototype.updateViewportDependantProperties = function() {
|
18856 | var viewport = this.currentViewport;
|
18857 | this.svg.attr("width", viewport.width).attr("height", viewport.height);
|
18858 | }, AnimatedNumber.prototype.update = function(options) {
|
18859 | this.currentViewport = options.viewport;
|
18860 | var dataViews = this.dataViews = options.dataViews;
|
18861 | if (dataViews && dataViews[0]) {
|
18862 | var dataView = dataViews[0];
|
18863 | this.updateViewportDependantProperties(), this.getMetaDataColumn(dataView);
|
18864 | var newValue = dataView && dataView.single ? dataView.single.value : 0;
|
18865 | this.updateInternal(newValue, options.suppressAnimations, !0, this.formatter);
|
18866 | }
|
18867 | }, AnimatedNumber.prototype.setFormatter = function(formatter) {
|
18868 | this.formatter = formatter;
|
18869 | }, AnimatedNumber.prototype.onDataChanged = function(options) {
|
18870 | this.update({
|
18871 | dataViews: options.dataViews,
|
18872 | suppressAnimations: options.suppressAnimations,
|
18873 | viewport: this.currentViewport
|
18874 | });
|
18875 | }, AnimatedNumber.prototype.onResizing = function(viewport) {
|
18876 | this.update({
|
18877 | dataViews: this.dataViews,
|
18878 | suppressAnimations: !0,
|
18879 | viewport: viewport
|
18880 | });
|
18881 | }, AnimatedNumber.prototype.canResizeTo = function(viewport) {
|
18882 | return !0;
|
18883 | }, AnimatedNumber.prototype.updateInternal = function(target, suppressAnimations, forceUpdate, formatter) {
|
18884 | void 0 === forceUpdate && (forceUpdate = !1);
|
18885 | var start = this.value, duration = visuals.AnimatorCommon.GetAnimationDuration(this.animator, suppressAnimations);
|
18886 | this.doValueTransition(start, target, null, this.options.animation, duration, forceUpdate, formatter),
|
18887 | this.value = target;
|
18888 | }, AnimatedNumber;
|
18889 | }(visuals.AnimatedText);
|
18890 | visuals.AnimatedNumber = AnimatedNumber;
|
18891 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
18892 | }(powerbi || (powerbi = {}));
|
18893 | }, function(module, exports) {
|
18894 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
18895 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
18896 | !function(powerbi) {
|
18897 | var visuals;
|
18898 | !function(visuals) {
|
18899 | var BasicShapeVisual = function() {
|
18900 | function BasicShapeVisual(options) {}
|
18901 | return Object.defineProperty(BasicShapeVisual.prototype, "shapeType", {
|
18902 | get: function() {
|
18903 | return this.data.shapeType;
|
18904 | },
|
18905 | set: function(shapeType) {
|
18906 | this.data.shapeType = shapeType;
|
18907 | },
|
18908 | enumerable: !0,
|
18909 | configurable: !0
|
18910 | }), Object.defineProperty(BasicShapeVisual.prototype, "lineColor", {
|
18911 | get: function() {
|
18912 | return this.data ? this.data.lineColor : BasicShapeVisual.DefaultStrokeColor;
|
18913 | },
|
18914 | set: function(color) {
|
18915 | this.data.lineColor = color;
|
18916 | },
|
18917 | enumerable: !0,
|
18918 | configurable: !0
|
18919 | }), Object.defineProperty(BasicShapeVisual.prototype, "lineTransparency", {
|
18920 | get: function() {
|
18921 | return this.data ? this.data.lineTransparency : BasicShapeVisual.DefaultLineTransValue;
|
18922 | },
|
18923 | set: function(trans) {
|
18924 | this.data.lineTransparency = trans;
|
18925 | },
|
18926 | enumerable: !0,
|
18927 | configurable: !0
|
18928 | }), Object.defineProperty(BasicShapeVisual.prototype, "lineWeight", {
|
18929 | get: function() {
|
18930 | return this.data ? this.data.lineWeight : BasicShapeVisual.DefaultWeightValue;
|
18931 | },
|
18932 | set: function(weight) {
|
18933 | this.data.lineWeight = weight;
|
18934 | },
|
18935 | enumerable: !0,
|
18936 | configurable: !0
|
18937 | }), Object.defineProperty(BasicShapeVisual.prototype, "roundEdge", {
|
18938 | get: function() {
|
18939 | return this.data ? this.data.roundEdge : BasicShapeVisual.DefaultRoundEdgeValue;
|
18940 | },
|
18941 | set: function(roundEdge) {
|
18942 | this.data.roundEdge = roundEdge;
|
18943 | },
|
18944 | enumerable: !0,
|
18945 | configurable: !0
|
18946 | }), Object.defineProperty(BasicShapeVisual.prototype, "showFill", {
|
18947 | get: function() {
|
18948 | return this.data ? this.data.showFill : BasicShapeVisual.DefaultFillShowValue;
|
18949 | },
|
18950 | set: function(show) {
|
18951 | this.data.showFill = show;
|
18952 | },
|
18953 | enumerable: !0,
|
18954 | configurable: !0
|
18955 | }), Object.defineProperty(BasicShapeVisual.prototype, "fillColor", {
|
18956 | get: function() {
|
18957 | return this.data ? this.data.fillColor : BasicShapeVisual.DefaultFillColor;
|
18958 | },
|
18959 | set: function(color) {
|
18960 | this.data.fillColor = color;
|
18961 | },
|
18962 | enumerable: !0,
|
18963 | configurable: !0
|
18964 | }), Object.defineProperty(BasicShapeVisual.prototype, "shapeTransparency", {
|
18965 | get: function() {
|
18966 | return this.data ? this.data.shapeTransparency : BasicShapeVisual.DefaultFillTransValue;
|
18967 | },
|
18968 | set: function(trans) {
|
18969 | this.data.shapeTransparency = trans;
|
18970 | },
|
18971 | enumerable: !0,
|
18972 | configurable: !0
|
18973 | }), Object.defineProperty(BasicShapeVisual.prototype, "angle", {
|
18974 | get: function() {
|
18975 | return this.data ? this.data.angle : BasicShapeVisual.DefaultAngle;
|
18976 | },
|
18977 | set: function(angle) {
|
18978 | this.data.angle = this.scaleTo360Deg(angle);
|
18979 | },
|
18980 | enumerable: !0,
|
18981 | configurable: !0
|
18982 | }), BasicShapeVisual.prototype.init = function(options) {
|
18983 | this.element = options.element, this.selection = d3.select(this.element.context),
|
18984 | this.currentViewport = options.viewport;
|
18985 | }, BasicShapeVisual.prototype.update = function(options) {
|
18986 | this.currentViewport = options.viewport;
|
18987 | var dataViews = options.dataViews;
|
18988 | if (!_.isEmpty(dataViews)) {
|
18989 | var dataView = options.dataViews[0];
|
18990 | if (dataView.metadata && dataView.metadata.objects) {
|
18991 | var dataViewObject = options.dataViews[0].metadata.objects;
|
18992 | this.data = this.getDataFromDataView(dataViewObject), this.render();
|
18993 | }
|
18994 | }
|
18995 | }, BasicShapeVisual.prototype.getDataFromDataView = function(dataViewObject) {
|
18996 | return dataViewObject ? {
|
18997 | shapeType: powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.general.shapeType, BasicShapeVisual.DefaultShape),
|
18998 | lineColor: this.getValueFromColor(powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.line.lineColor, BasicShapeVisual.DefaultStrokeColor)),
|
18999 | lineTransparency: powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.line.transparency, BasicShapeVisual.DefaultLineTransValue),
|
19000 | lineWeight: powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.line.weight, BasicShapeVisual.DefaultWeightValue),
|
19001 | roundEdge: powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.line.roundEdge, BasicShapeVisual.DefaultRoundEdgeValue),
|
19002 | shapeTransparency: powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.fill.transparency, BasicShapeVisual.DefaultFillTransValue),
|
19003 | fillColor: this.getValueFromColor(powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.fill.fillColor, BasicShapeVisual.DefaultFillColor)),
|
19004 | showFill: powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.fill.show, BasicShapeVisual.DefaultFillShowValue),
|
19005 | angle: this.scaleTo360Deg(powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.rotation.angle, BasicShapeVisual.DefaultAngle))
|
19006 | } : null;
|
19007 | }, BasicShapeVisual.prototype.scaleTo360Deg = function(angle) {
|
19008 | return 0 !== angle && Math.abs(angle) % 360 === 0 ? angle : (angle %= 360, angle = (angle + 360) % 360);
|
19009 | }, BasicShapeVisual.prototype.getValueFromColor = function(color) {
|
19010 | return color.solid ? color.solid.color : color;
|
19011 | }, BasicShapeVisual.prototype.enumerateObjectInstances = function(options) {
|
19012 | var objectInstances = [];
|
19013 | if (!this.data) return objectInstances;
|
19014 | switch (options.objectName) {
|
19015 | case "line":
|
19016 | var instance = {
|
19017 | selector: null,
|
19018 | properties: {
|
19019 | lineColor: this.lineColor,
|
19020 | transparency: this.lineTransparency,
|
19021 | weight: this.lineWeight
|
19022 | },
|
19023 | objectName: options.objectName
|
19024 | };
|
19025 | return this.shapeType === visuals.basicShapeType.rectangle && (instance.properties.roundEdge = this.roundEdge),
|
19026 | objectInstances.push(instance), objectInstances;
|
19027 |
|
19028 | case "fill":
|
19029 | return this.shapeType !== visuals.basicShapeType.line && objectInstances.push({
|
19030 | selector: null,
|
19031 | properties: {
|
19032 | show: this.showFill,
|
19033 | fillColor: this.fillColor,
|
19034 | transparency: this.shapeTransparency
|
19035 | },
|
19036 | objectName: options.objectName
|
19037 | }), objectInstances;
|
19038 |
|
19039 | case "rotation":
|
19040 | return objectInstances.push({
|
19041 | selector: null,
|
19042 | properties: {
|
19043 | angle: this.angle
|
19044 | },
|
19045 | objectName: options.objectName
|
19046 | }), objectInstances;
|
19047 | }
|
19048 | return null;
|
19049 | }, BasicShapeVisual.prototype.render = function() {
|
19050 | switch (this.selection.html(""), this.shapeType) {
|
19051 | case visuals.basicShapeType.rectangle:
|
19052 | visuals.ShapeFactory.createRectangle(this.data, this.currentViewport.height, this.currentViewport.width, this.selection, this.angle);
|
19053 | break;
|
19054 |
|
19055 | case visuals.basicShapeType.oval:
|
19056 | visuals.ShapeFactory.createOval(this.data, this.currentViewport.height, this.currentViewport.width, this.selection, this.angle);
|
19057 | break;
|
19058 |
|
19059 | case visuals.basicShapeType.line:
|
19060 | visuals.ShapeFactory.createLine(this.data, this.currentViewport.height, this.currentViewport.width, this.selection, this.angle);
|
19061 | break;
|
19062 |
|
19063 | case visuals.basicShapeType.arrow:
|
19064 | visuals.ShapeFactory.createUpArrow(this.data, this.currentViewport.height, this.currentViewport.width, this.selection, this.angle);
|
19065 | break;
|
19066 |
|
19067 | case visuals.basicShapeType.triangle:
|
19068 | visuals.ShapeFactory.createTriangle(this.data, this.currentViewport.height, this.currentViewport.width, this.selection, this.angle);
|
19069 | }
|
19070 | }, BasicShapeVisual.DefaultShape = visuals.basicShapeType.rectangle, BasicShapeVisual.DefaultStrokeColor = "#00B8AA",
|
19071 | BasicShapeVisual.DefaultFillColor = "#E6E6E6", BasicShapeVisual.DefaultFillShowValue = !0,
|
19072 | BasicShapeVisual.DefaultFillTransValue = 0, BasicShapeVisual.DefaultWeightValue = 3,
|
19073 | BasicShapeVisual.DefaultLineTransValue = 0, BasicShapeVisual.DefaultRoundEdgeValue = 0,
|
19074 | BasicShapeVisual.DefaultAngle = 0, BasicShapeVisual;
|
19075 | }();
|
19076 | visuals.BasicShapeVisual = BasicShapeVisual;
|
19077 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
19078 | }(powerbi || (powerbi = {}));
|
19079 | }, function(module, exports) {
|
19080 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
19081 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
19082 | !function(powerbi) {
|
19083 | var visuals;
|
19084 | !function(visuals) {
|
19085 | function getLayerDataViews(dataViews) {
|
19086 | return _.isEmpty(dataViews) ? [] : _.filter(dataViews, function(dataView) {
|
19087 | return !visuals.TrendLineHelper.isDataViewForRegression(dataView);
|
19088 | });
|
19089 | }
|
19090 | function hasMultipleYAxes(layers) {
|
19091 | return layers.length > 1;
|
19092 | }
|
19093 | function shouldShowYAxisLabel(layerNumber, valueAxisProperties, yAxisWillMerge) {
|
19094 | return 0 === layerNumber && !!valueAxisProperties && !!valueAxisProperties.showAxisTitle || 1 === layerNumber && !yAxisWillMerge && !!valueAxisProperties && !!valueAxisProperties.secShowAxisTitle;
|
19095 | }
|
19096 | function tryMergeYDomains(layers, visualOptions) {
|
19097 | var noMerge = {
|
19098 | domain: void 0,
|
19099 | merged: !1,
|
19100 | tickCount: void 0
|
19101 | };
|
19102 | if (layers.length < 2) return noMerge;
|
19103 | var min, max, minOfMax, maxOfMin, y1props = layers[0].calculateAxesProperties(visualOptions)[1], y2props = layers[1].calculateAxesProperties(visualOptions)[1], firstYDomain = y1props.scale.domain(), secondYDomain = y2props.scale.domain();
|
19104 | if (y1props.values && y1props.values.length > 0 && y2props.values && y2props.values.length > 0 && (noMerge.tickCount = Math.max(y1props.values.length, y2props.values.length)),
|
19105 | min = Math.min(firstYDomain[0], secondYDomain[0]), max = Math.max(firstYDomain[1], secondYDomain[1]),
|
19106 | visualOptions.forceMerge) return {
|
19107 | domain: [ min, max ],
|
19108 | merged: !0,
|
19109 | tickCount: noMerge.tickCount
|
19110 | };
|
19111 | if (firstYDomain[0] > secondYDomain[1] || firstYDomain[1] < secondYDomain[0]) return noMerge;
|
19112 | maxOfMin = Math.max(firstYDomain[0], secondYDomain[0]), minOfMax = Math.min(firstYDomain[1], secondYDomain[1]);
|
19113 | var range = max - min;
|
19114 | if (0 === range) return noMerge;
|
19115 | var intersection = Math.abs((minOfMax - maxOfMin) / range);
|
19116 | return COMBOCHART_DOMAIN_OVERLAP_TRESHOLD_PERCENTAGE > intersection ? noMerge : {
|
19117 | domain: [ min, max ],
|
19118 | merged: !0,
|
19119 | tickCount: noMerge.tickCount
|
19120 | };
|
19121 | }
|
19122 | var EnumExtensions = jsCommon.EnumExtensions, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, DEFAULT_AXIS_SCALE_TYPE = visuals.axisScale.linear, COMBOCHART_DOMAIN_OVERLAP_TRESHOLD_PERCENTAGE = .1, INTERACTIVITY_RIGHT_MARGIN = 6;
|
19123 | visuals.DEFAULT_AXIS_COLOR = "#777";
|
19124 | var CartesianChart = function() {
|
19125 | function CartesianChart(options) {
|
19126 | this.xRefLine = createClassAndSelector("x-ref-line"), this.y1RefLine = createClassAndSelector("y1-ref-line");
|
19127 | var isScrollable = !1;
|
19128 | this.trimOrdinalDataOnOverflow = !0, options && (this.tooltipsEnabled = options.tooltipsEnabled,
|
19129 | this.tooltipBucketEnabled = options.tooltipBucketEnabled, this.cartesianLoadMoreEnabled = options.cartesianLoadMoreEnabled,
|
19130 | this.type = options.chartType, this.isLabelInteractivityEnabled = options.isLabelInteractivityEnabled,
|
19131 | this.advancedLineLabelsEnabled = options.advancedLineLabelsEnabled, void 0 !== options.trimOrdinalDataOnOverflow && (this.trimOrdinalDataOnOverflow = options.trimOrdinalDataOnOverflow),
|
19132 | options.isScrollable && (isScrollable = options.isScrollable), this.animator = options.animator,
|
19133 | options.cartesianSmallViewPortProperties && (this.cartesianSmallViewPortProperties = options.cartesianSmallViewPortProperties),
|
19134 | options.behavior && (this.behavior = options.behavior)), this.axes = new CartesianAxes(isScrollable, ScrollableAxes.ScrollbarWidth, this.trimOrdinalDataOnOverflow),
|
19135 | this.svgAxes = new SvgCartesianAxes(this.axes), this.svgBrush = new SvgBrush(ScrollableAxes.ScrollbarWidth),
|
19136 | this.scrollableAxes = new ScrollableAxes(this.axes, this.svgBrush);
|
19137 | }
|
19138 | return CartesianChart.getAxisVisibility = function(type) {
|
19139 | switch (type) {
|
19140 | case 6:
|
19141 | case 5:
|
19142 | case 7:
|
19143 | return 1;
|
19144 |
|
19145 | case 9:
|
19146 | return 3;
|
19147 |
|
19148 | default:
|
19149 | return 2;
|
19150 | }
|
19151 | }, CartesianChart.prototype.init = function(options) {
|
19152 | this.visualInitOptions = options, this.layers = [];
|
19153 | var element = this.element = options.element;
|
19154 | this.currentViewport = options.viewport, this.hostServices = options.host;
|
19155 | var chartAreaSvg = this.chartAreaSvg = d3.select(element.get(0)).append("svg");
|
19156 | chartAreaSvg.classed(CartesianChart.ClassName, !0), chartAreaSvg.style("position", "absolute"),
|
19157 | this.behavior && (this.clearCatcher = visuals.appendClearCatcher(chartAreaSvg),
|
19158 | this.interactivityService = visuals.createInteractivityService(this.hostServices)),
|
19159 | null != options.style.maxMarginFactor && this.axes.setMaxMarginFactor(options.style.maxMarginFactor);
|
19160 | var axisLinesVisibility = CartesianChart.getAxisVisibility(this.type);
|
19161 | this.axes.setAxisLinesVisibility(axisLinesVisibility), this.svgAxes.init(chartAreaSvg),
|
19162 | this.svgBrush.init(chartAreaSvg), this.sharedColorPalette = new SharedColorPalette(options.style.colorPalette.dataColors),
|
19163 | this.legend = visuals.createLegend(element, options.interactivity && options.interactivity.isInteractiveLegend, 12 !== this.type ? this.interactivityService : void 0, this.axes.isScrollable),
|
19164 | this.isMobileChart = options.interactivity && options.interactivity.isInteractiveLegend;
|
19165 | }, CartesianChart.prototype.isPlayAxis = function() {
|
19166 | if (!this.dataViews || !this.dataViews[0]) return !1;
|
19167 | var dataView = this.dataViews[0], categoryRoleIsPlay = dataView.categorical && dataView.categorical.categories && dataView.categorical.categories[0] && dataView.categorical.categories[0].source && dataView.categorical.categories[0].source.roles && dataView.categorical.categories[0].source.roles.Play;
|
19168 | return 9 === this.type && (this.animator || this.isMobileChart) && null != dataView.matrix && (!dataView.categorical || categoryRoleIsPlay);
|
19169 | }, CartesianChart.getIsScalar = function(objects, propertyId, type, scalarKeys) {
|
19170 | if (!CartesianChart.supportsScalar(type, scalarKeys)) return !1;
|
19171 | var axisTypeValue = powerbi.DataViewObjects.getValue(objects, propertyId);
|
19172 | return objects && null != axisTypeValue ? axisTypeValue === visuals.axisType.scalar : !0;
|
19173 | }, CartesianChart.supportsScalar = function(type, scalarKeys) {
|
19174 | return scalarKeys && !_.isEmpty(scalarKeys.values) ? !0 : !visuals.AxisHelper.isOrdinal(type);
|
19175 | }, CartesianChart.getAdditionalTelemetry = function(dataView) {
|
19176 | var telemetry = {}, categoryColumn = dataView && dataView.categorical && _.first(dataView.categorical.categories);
|
19177 | return categoryColumn && (telemetry.axisType = visuals.CartesianChart.getIsScalar(dataView.metadata.objects, visuals.columnChartProps.categoryAxis.axisType, categoryColumn.source.type) ? "scalar" : "categorical"),
|
19178 | telemetry;
|
19179 | }, CartesianChart.detectScalarMapping = function(dataViewMapping) {
|
19180 | if (!dataViewMapping || !dataViewMapping.categorical || !dataViewMapping.categorical.categories) return !1;
|
19181 | var dataViewCategories = dataViewMapping.categorical.categories, categoryItems = dataViewCategories["for"]["in"].items;
|
19182 | if (_.isEmpty(categoryItems)) return !1;
|
19183 | var categoryType = categoryItems[0].type;
|
19184 | if (!dataViewMapping.metadata) return !1;
|
19185 | var objects = dataViewMapping.metadata.objects;
|
19186 | return CartesianChart.getIsScalar(objects, visuals.columnChartProps.categoryAxis.axisType, categoryType);
|
19187 | }, CartesianChart.prototype.populateObjectProperties = function(dataViews) {
|
19188 | if (dataViews && dataViews.length > 0) {
|
19189 | var dataViewMetadata = dataViews[0].metadata;
|
19190 | dataViewMetadata ? (this.legendObjectProperties = powerbi.DataViewObjects.getObject(dataViewMetadata.objects, "legend", {}),
|
19191 | this.xAxisReferenceLines = powerbi.DataViewObjects.getUserDefinedObjects(dataViewMetadata.objects, "xAxisReferenceLine"),
|
19192 | this.y1AxisReferenceLines = powerbi.DataViewObjects.getUserDefinedObjects(dataViewMetadata.objects, "y1AxisReferenceLine")) : this.legendObjectProperties = {},
|
19193 | this.categoryAxisProperties = visuals.CartesianHelper.getCategoryAxisProperties(dataViewMetadata),
|
19194 | this.valueAxisProperties = visuals.CartesianHelper.getValueAxisProperties(dataViewMetadata);
|
19195 | }
|
19196 | }, CartesianChart.prototype.updateInternal = function(options, operationKind) {
|
19197 | var dataViews = this.dataViews = options.dataViews;
|
19198 | if (this.currentViewport = options.viewport, dataViews) {
|
19199 | if (0 === this.layers.length) {
|
19200 | var objects = this.extractMetadataObjects(dataViews);
|
19201 | this.layers = this.createAndInitLayers(objects);
|
19202 | }
|
19203 | var layers = this.layers;
|
19204 | if (null != operationKind) {
|
19205 | if (!_.isEmpty(dataViews)) {
|
19206 | this.populateObjectProperties(dataViews), this.axes.update(dataViews), this.svgAxes.update(this.categoryAxisProperties, this.valueAxisProperties);
|
19207 | var dataView = dataViews[0];
|
19208 | if (dataView.metadata && (this.background = {
|
19209 | image: powerbi.DataViewObjects.getValue(dataView.metadata.objects, visuals.scatterChartProps.plotArea.image),
|
19210 | transparency: powerbi.DataViewObjects.getValue(dataView.metadata.objects, visuals.scatterChartProps.plotArea.transparency, visuals.visualBackgroundHelper.getDefaultTransparency())
|
19211 | }, this.cartesianLoadMoreEnabled)) {
|
19212 | var isScalar = !0, categoryColumn = dataView && dataView.categorical && _.first(dataView.categorical.categories);
|
19213 | categoryColumn && categoryColumn.source && (isScalar = visuals.CartesianChart.getIsScalar(dataView.metadata.objects, visuals.columnChartProps.categoryAxis.axisType, categoryColumn.source.type)),
|
19214 | isScalar && this.loadMoreDataHandler ? this.loadMoreDataHandler = null : isScalar || this.loadMoreDataHandler || (this.loadMoreDataHandler = new CartesianLoadMoreDataHandler(null, this.hostServices.loadMoreData, CartesianChart.LoadMoreThreshold));
|
19215 | }
|
19216 | }
|
19217 | this.sharedColorPalette.clearPreferredScale();
|
19218 | var layerDataViews = getLayerDataViews(dataViews), trendLineDataViews = _.filter(dataViews, function(dataView) {
|
19219 | return visuals.TrendLineHelper.isDataViewForRegression(dataView);
|
19220 | });
|
19221 | this.trendLines = [];
|
19222 | for (var i = 0, layerCount = layers.length; layerCount > i; i++) {
|
19223 | var layerDataView = layerDataViews[i];
|
19224 | if (layers[i].setData(layerDataView ? [ layerDataView ] : []), this.supportsTrendLines(i)) {
|
19225 | var trendLineDataView = trendLineDataViews[i];
|
19226 | if (trendLineDataView) {
|
19227 | var y2 = i > 0, trendLines = visuals.TrendLineHelper.readDataView(trendLineDataView, layerDataView, y2, this.sharedColorPalette);
|
19228 | (_a = this.trendLines).push.apply(_a, trendLines);
|
19229 | }
|
19230 | }
|
19231 | layerCount > 1 && this.sharedColorPalette.rotateScale();
|
19232 | }
|
19233 | }
|
19234 | if (this.loadMoreDataHandler && null != operationKind && this.loadMoreDataHandler.onLoadMoreDataCompleted(),
|
19235 | this.render(!this.hasSetData || options.suppressAnimations, options.resizeMode, operationKind),
|
19236 | this.hasSetData = this.hasSetData || dataViews && dataViews.length > 0, dataViews && dataViews.length > 0) {
|
19237 | var warnings = visuals.getInvalidValueWarnings(dataViews, !1, !1, !1);
|
19238 | this.axes.addWarnings(warnings), warnings && warnings.length > 0 && this.hostServices.setWarnings(warnings);
|
19239 | }
|
19240 | var _a;
|
19241 | }
|
19242 | }, CartesianChart.prototype.onDataChanged = function(options) {
|
19243 | this.updateInternal({
|
19244 | dataViews: options.dataViews,
|
19245 | suppressAnimations: options.suppressAnimations,
|
19246 | viewport: this.currentViewport
|
19247 | }, null != options.operationKind ? options.operationKind : powerbi.VisualDataChangeOperationKind.Create);
|
19248 | }, CartesianChart.prototype.onResizing = function(viewport, resizeMode) {
|
19249 | this.updateInternal({
|
19250 | dataViews: this.dataViews,
|
19251 | suppressAnimations: !0,
|
19252 | viewport: viewport,
|
19253 | resizeMode: resizeMode
|
19254 | });
|
19255 | }, CartesianChart.prototype.scrollTo = function(position) {
|
19256 | this.scrollableAxes.scrollTo(position);
|
19257 | }, CartesianChart.prototype.enumerateObjectInstances = function(options) {
|
19258 | var enumeration = new visuals.ObjectEnumerationBuilder(), layersLength = this.layers ? this.layers.length : 0;
|
19259 | if ("legend" === options.objectName) {
|
19260 | if (!this.shouldShowLegendCard()) return;
|
19261 | var show = powerbi.DataViewObject.getValue(this.legendObjectProperties, visuals.legendProps.show, this.legend.isVisible()), showTitle = powerbi.DataViewObject.getValue(this.legendObjectProperties, visuals.legendProps.showTitle, !0), titleText = powerbi.DataViewObject.getValue(this.legendObjectProperties, visuals.legendProps.titleText, this.layerLegendData ? this.layerLegendData.title : ""), labelColor = powerbi.DataViewObject.getValue(this.legendObjectProperties, visuals.legendProps.labelColor, visuals.LegendData.DefaultLegendLabelFillColor), fontSize = powerbi.DataViewObject.getValue(this.legendObjectProperties, visuals.legendProps.fontSize, this.layerLegendData && this.layerLegendData.fontSize ? this.layerLegendData.fontSize : visuals.SVGLegend.DefaultFontSizeInPt);
|
19262 | enumeration.pushInstance({
|
19263 | selector: null,
|
19264 | properties: {
|
19265 | show: show,
|
19266 | position: visuals.LegendPosition[this.legend.getOrientation()],
|
19267 | showTitle: showTitle,
|
19268 | titleText: titleText,
|
19269 | labelColor: labelColor,
|
19270 | fontSize: fontSize
|
19271 | },
|
19272 | objectName: options.objectName
|
19273 | });
|
19274 | } else if ("categoryAxis" === options.objectName && this.axes.hasCategoryAxis()) this.getCategoryAxisValues(enumeration); else if ("valueAxis" === options.objectName) this.getValueAxisValues(enumeration); else if ("y1AxisReferenceLine" === options.objectName) {
|
19275 | var refLinedefaultColor = this.sharedColorPalette.getColorByIndex(0).value;
|
19276 | visuals.ReferenceLineHelper.enumerateObjectInstances(enumeration, this.y1AxisReferenceLines, refLinedefaultColor, options.objectName);
|
19277 | } else if ("xAxisReferenceLine" === options.objectName) {
|
19278 | var refLinedefaultColor = this.sharedColorPalette.getColorByIndex(0).value;
|
19279 | visuals.ReferenceLineHelper.enumerateObjectInstances(enumeration, this.xAxisReferenceLines, refLinedefaultColor, options.objectName);
|
19280 | } else "trend" === options.objectName ? this.supportsTrendLines() && visuals.TrendLineHelper.enumerateObjectInstances(enumeration, this.trendLines) : "plotArea" === options.objectName && visuals.visualBackgroundHelper.enumeratePlot(enumeration, this.background);
|
19281 | if ("dataPoint" === options.objectName && visuals.ComboChart.isComboChart(this.type)) visuals.ComboChart.enumerateDataPoints(enumeration, options, this.layers); else for (var i = 0, len = layersLength; len > i; i++) {
|
19282 | var layer = this.layers[i];
|
19283 | layer.enumerateObjectInstances && layer.enumerateObjectInstances(enumeration, options);
|
19284 | }
|
19285 | return enumeration.complete();
|
19286 | }, CartesianChart.prototype.supportsTrendLines = function(layerIndex) {
|
19287 | var layerDataViews = getLayerDataViews(this.dataViews);
|
19288 | if (_.isEmpty(this.layers)) return !1;
|
19289 | var layers = null == layerIndex ? this.layers : [ this.layers[layerIndex] ];
|
19290 | return _.all(layers, function(layer, index) {
|
19291 | return layerDataViews[index] ? layer.supportsTrendLine && layer.supportsTrendLine() : !0;
|
19292 | });
|
19293 | }, CartesianChart.prototype.shouldShowLegendCard = function() {
|
19294 | var layers = this.layers, dataViews = this.dataViews;
|
19295 | if (layers && dataViews) for (var layersLength = layers.length, layersWithValuesCtr = 0, i = 0; layersLength > i; i++) {
|
19296 | if (layers[i].hasLegend()) return !0;
|
19297 | var dataView = dataViews[i];
|
19298 | if (dataView && dataView.categorical && dataView.categorical.values && dataView.categorical.values.length > 0 && (layersWithValuesCtr++,
|
19299 | layersWithValuesCtr > 1)) return !0;
|
19300 | }
|
19301 | return !1;
|
19302 | }, CartesianChart.prototype.getAxisScaleOptions = function(axisType) {
|
19303 | var scaleOptions = [ DEFAULT_AXIS_SCALE_TYPE ];
|
19304 | return this.axes.isLogScaleAllowed(axisType) && scaleOptions.push(visuals.axisScale.log),
|
19305 | scaleOptions;
|
19306 | }, CartesianChart.prototype.getCategoryAxisValues = function(enumeration) {
|
19307 | if (this.categoryAxisProperties) {
|
19308 | var supportedType = visuals.axisType.both, isScalar = !1, scaleOptions = this.getAxisScaleOptions(0);
|
19309 | this.layers && this.layers[0].getSupportedCategoryAxisType && (supportedType = this.layers[0].getSupportedCategoryAxisType(),
|
19310 | isScalar = supportedType === visuals.axisType.scalar ? !0 : visuals.CartesianHelper.isScalar(supportedType === visuals.axisType.both, this.categoryAxisProperties)),
|
19311 | isScalar || (this.categoryAxisProperties.start = null, this.categoryAxisProperties.end = null);
|
19312 | var instance = {
|
19313 | selector: null,
|
19314 | properties: {},
|
19315 | objectName: "categoryAxis",
|
19316 | validValues: {
|
19317 | axisScale: scaleOptions,
|
19318 | axisStyle: this.axes.categoryAxisHasUnitType ? [ visuals.axisStyle.showTitleOnly, visuals.axisStyle.showUnitOnly, visuals.axisStyle.showBoth ] : [ visuals.axisStyle.showTitleOnly ]
|
19319 | }
|
19320 | };
|
19321 | if (instance.properties.show = null != this.categoryAxisProperties.show ? this.categoryAxisProperties.show : !0,
|
19322 | this.axes.isYAxisCategorical() && (instance.properties.position = this.valueAxisProperties && null != this.valueAxisProperties.position ? this.valueAxisProperties.position : visuals.yAxisPosition.left),
|
19323 | supportedType === visuals.axisType.both && (instance.properties.axisType = isScalar ? visuals.axisType.scalar : visuals.axisType.categorical),
|
19324 | isScalar && (instance.properties.axisScale = this.categoryAxisProperties.axisScale || DEFAULT_AXIS_SCALE_TYPE,
|
19325 | instance.properties.start = this.categoryAxisProperties.start, instance.properties.end = this.categoryAxisProperties.end),
|
19326 | instance.properties.showAxisTitle = null != this.categoryAxisProperties.showAxisTitle ? this.categoryAxisProperties.showAxisTitle : !1,
|
19327 | instance.properties.axisStyle = this.categoryAxisProperties.axisStyle ? this.categoryAxisProperties.axisStyle : visuals.axisStyle.showTitleOnly,
|
19328 | instance.properties.labelColor = this.categoryAxisProperties.labelColor || visuals.DEFAULT_AXIS_COLOR,
|
19329 | isScalar) {
|
19330 | instance.properties.labelDisplayUnits = this.categoryAxisProperties.labelDisplayUnits ? this.categoryAxisProperties.labelDisplayUnits : 0;
|
19331 | var labelPrecision = this.categoryAxisProperties.labelPrecision;
|
19332 | instance.properties.labelPrecision = void 0 === labelPrecision || 0 > labelPrecision ? visuals.dataLabelUtils.defaultLabelPrecision : labelPrecision;
|
19333 | }
|
19334 | enumeration.pushInstance(instance);
|
19335 | }
|
19336 | }, CartesianChart.prototype.getValueAxisValues = function(enumeration) {
|
19337 | if (this.valueAxisProperties) {
|
19338 | var scaleOptions = this.getAxisScaleOptions(1), secScaleOption = this.getAxisScaleOptions(2), instance = {
|
19339 | selector: null,
|
19340 | properties: {},
|
19341 | objectName: "valueAxis",
|
19342 | validValues: {
|
19343 | axisScale: scaleOptions,
|
19344 | secAxisScale: secScaleOption,
|
19345 | axisStyle: this.axes.valueAxisHasUnitType ? [ visuals.axisStyle.showTitleOnly, visuals.axisStyle.showUnitOnly, visuals.axisStyle.showBoth ] : [ visuals.axisStyle.showTitleOnly ],
|
19346 | secAxisStyle: this.axes.secondaryValueAxisHasUnitType ? [ visuals.axisStyle.showTitleOnly, visuals.axisStyle.showUnitOnly, visuals.axisStyle.showBoth ] : [ visuals.axisStyle.showTitleOnly ]
|
19347 | }
|
19348 | };
|
19349 | if (instance.properties.show = null != this.valueAxisProperties.show ? this.valueAxisProperties.show : !0,
|
19350 | instance.properties.axisLabel = this.valueAxisProperties.axisLabel, this.axes.isYAxisCategorical() || (instance.properties.position = null != this.valueAxisProperties.position ? this.valueAxisProperties.position : visuals.yAxisPosition.left),
|
19351 | instance.properties.axisScale = this.valueAxisProperties.axisScale || DEFAULT_AXIS_SCALE_TYPE,
|
19352 | instance.properties.start = this.valueAxisProperties.start, instance.properties.end = this.valueAxisProperties.end,
|
19353 | instance.properties.showAxisTitle = null != this.valueAxisProperties.showAxisTitle ? this.valueAxisProperties.showAxisTitle : !1,
|
19354 | instance.properties.axisStyle = null != this.valueAxisProperties.axisStyle ? this.valueAxisProperties.axisStyle : visuals.axisStyle.showTitleOnly,
|
19355 | instance.properties.labelColor = this.valueAxisProperties.labelColor || visuals.DEFAULT_AXIS_COLOR,
|
19356 | 7 !== this.type && 8 !== this.type) {
|
19357 | instance.properties.labelDisplayUnits = this.valueAxisProperties.labelDisplayUnits ? this.valueAxisProperties.labelDisplayUnits : 0;
|
19358 | var labelPrecision = this.valueAxisProperties.labelPrecision;
|
19359 | instance.properties.labelPrecision = void 0 === labelPrecision || 0 > labelPrecision ? visuals.dataLabelUtils.defaultLabelPrecision : labelPrecision;
|
19360 | }
|
19361 | 2 === this.layers.length && (instance.properties.secShow = null != this.valueAxisProperties.secShow ? this.valueAxisProperties.secShow : this.axes.hasY2Axis()),
|
19362 | this.axes.hasY2Axis() && instance.properties.secShow && (instance.properties.secAxisLabel = "",
|
19363 | instance.properties.secPosition = null != this.valueAxisProperties.secPosition ? this.valueAxisProperties.secPosition : visuals.yAxisPosition.right,
|
19364 | instance.properties.secAxisScale = this.valueAxisProperties.secAxisScale || DEFAULT_AXIS_SCALE_TYPE,
|
19365 | instance.properties.secStart = this.valueAxisProperties.secStart, instance.properties.secEnd = this.valueAxisProperties.secEnd,
|
19366 | instance.properties.secShowAxisTitle = null != this.valueAxisProperties.secShowAxisTitle ? this.valueAxisProperties.secShowAxisTitle : !1,
|
19367 | instance.properties.secAxisStyle = this.valueAxisProperties.secAxisStyle ? this.valueAxisProperties.secAxisStyle : visuals.axisStyle.showTitleOnly,
|
19368 | instance.properties.labelColor = this.valueAxisProperties.secLabelColor, instance.properties.secLabelDisplayUnits = this.valueAxisProperties.secLabelDisplayUnits ? this.valueAxisProperties.secLabelDisplayUnits : 0,
|
19369 | instance.properties.secLabelPrecision = this.valueAxisProperties.secLabelPrecision < 0 ? 0 : this.valueAxisProperties.secLabelPrecision),
|
19370 | enumeration.pushInstance(instance);
|
19371 | }
|
19372 | }, CartesianChart.prototype.onClearSelection = function() {
|
19373 | if (this.hasSetData) for (var i = 0, len = this.layers.length; len > i; i++) {
|
19374 | var layer = this.layers[i];
|
19375 | layer.onClearSelection(), layer.render(!0);
|
19376 | }
|
19377 | }, CartesianChart.prototype.extractMetadataObjects = function(dataViews) {
|
19378 | var objects;
|
19379 | if (dataViews && dataViews.length > 0) {
|
19380 | var dataViewMetadata = dataViews[0].metadata;
|
19381 | dataViewMetadata && (objects = dataViewMetadata.objects);
|
19382 | }
|
19383 | return objects;
|
19384 | }, CartesianChart.prototype.createAndInitLayers = function(objects) {
|
19385 | var _this = this, layers = CartesianLayerFactory.createLayers(this.type, objects, this.interactivityService, this.animator, this.axes.isScrollable, this.tooltipsEnabled, this.tooltipBucketEnabled, this.advancedLineLabelsEnabled, this.cartesianLoadMoreEnabled), cartesianOptions = powerbi.Prototype.inherit(this.visualInitOptions);
|
19386 | cartesianOptions.svg = this.svgAxes.getScrollableRegion(), cartesianOptions.labelsContext = this.svgAxes.getLabelsRegion(),
|
19387 | cartesianOptions.cartesianHost = {
|
19388 | updateLegend: function(data) {
|
19389 | return _this.legend.drawLegend(data, _this.currentViewport);
|
19390 | },
|
19391 | getSharedColors: function() {
|
19392 | return _this.sharedColorPalette;
|
19393 | },
|
19394 | triggerRender: function(suppressAnimations) {
|
19395 | return _this.render(suppressAnimations);
|
19396 | }
|
19397 | }, cartesianOptions.chartType = this.type;
|
19398 | for (var i = 0, len = layers.length; len > i; i++) layers[i].init(cartesianOptions);
|
19399 | return layers;
|
19400 | }, CartesianChart.prototype.renderLegend = function() {
|
19401 | for (var layers = this.layers, legendData = {
|
19402 | title: "",
|
19403 | dataPoints: []
|
19404 | }, _loop_1 = function(i, len) {
|
19405 | this_1.layerLegendData = layers[i].calculateLegend(), this_1.layerLegendData && (legendData.title = 0 === i ? this_1.layerLegendData.title || "" : legendData.title,
|
19406 | legendData.labelColor = this_1.layerLegendData.labelColor, _.isEmpty(this_1.layerLegendData.dataPoints) || this_1.layerLegendData.dataPoints.forEach(function(dataPoint) {
|
19407 | return dataPoint.layerNumber = i;
|
19408 | }), legendData.dataPoints = legendData.dataPoints.concat(this_1.layerLegendData.dataPoints || []),
|
19409 | legendData.fontSize = this_1.layerLegendData.fontSize || visuals.SVGLegend.DefaultFontSizeInPt,
|
19410 | this_1.layerLegendData.grouped && (legendData.grouped = !0));
|
19411 | }, this_1 = this, i = 0, len = layers.length; len > i; i++) _loop_1(i, len);
|
19412 | var legendProperties = this.legendObjectProperties;
|
19413 | if (legendProperties) {
|
19414 | visuals.LegendData.update(legendData, legendProperties);
|
19415 | var position = legendProperties[visuals.legendProps.position];
|
19416 | position && this.legend.changeOrientation(visuals.LegendPosition[position]);
|
19417 | } else this.legend.changeOrientation(visuals.LegendPosition.Top);
|
19418 | (1 === legendData.dataPoints.length && !legendData.grouped || this.hideLegends()) && (legendData.dataPoints = []),
|
19419 | this.legend.drawLegend(legendData, this.currentViewport);
|
19420 | }, CartesianChart.prototype.hideLegends = function() {
|
19421 | return !!(this.cartesianSmallViewPortProperties && this.cartesianSmallViewPortProperties.hideLegendOnSmallViewPort && this.currentViewport.height < this.cartesianSmallViewPortProperties.MinHeightLegendVisible);
|
19422 | }, CartesianChart.prototype.render = function(suppressAnimations, resizeMode, operationKind) {
|
19423 | var _this = this;
|
19424 | this.visualInitOptions.interactivity && this.visualInitOptions.interactivity.isInteractiveLegend || this.renderLegend();
|
19425 | var playAxisControlLayout, legendMargins = this.legendMargins = this.legend.getMargins(), legendOrientation = this.legend.getOrientation(), hideAxisLabels = this.hideAxisLabels(legendMargins), plotAreaViewport = {
|
19426 | height: this.currentViewport.height - legendMargins.height,
|
19427 | width: this.currentViewport.width - legendMargins.width
|
19428 | }, padding = powerbi.Prototype.inherit(SvgCartesianAxes.AxisPadding);
|
19429 | this.isPlayAxis() && (plotAreaViewport.height -= CartesianChart.PlayAxisBottomMargin,
|
19430 | playAxisControlLayout = {
|
19431 | left: visuals.Legend.isLeft(legendOrientation) ? legendMargins.width : 0,
|
19432 | top: visuals.Legend.isTop(legendOrientation) ? legendMargins.height + plotAreaViewport.height : plotAreaViewport.height,
|
19433 | height: CartesianChart.PlayAxisBottomMargin,
|
19434 | width: plotAreaViewport.width
|
19435 | }), this.chartAreaSvg.attr({
|
19436 | width: plotAreaViewport.width,
|
19437 | height: plotAreaViewport.height
|
19438 | }), visuals.Legend.positionChartArea(this.chartAreaSvg, this.legend);
|
19439 | var interactivityRightMargin = this.calculateInteractivityRightMargin(), _a = this.getMinimumDomainExtents(), ensureXDomain = _a[0], ensureYDomain = _a[1], axesLayout = this.axes.negotiateAxes(this.layers, plotAreaViewport, padding, playAxisControlLayout, hideAxisLabels, CartesianChart.AxisTextProperties, interactivityRightMargin, ensureXDomain, ensureYDomain), categoryAxis = axesLayout.axes.x.isCategoryAxis ? axesLayout.axes.x : axesLayout.axes.y1;
|
19440 | this.loadMoreDataHandler && this.loadMoreDataHandler.setScale(categoryAxis.scale);
|
19441 | var plotAreaHasChanged = !this.renderedPlotArea || this.renderedPlotArea.height !== axesLayout.plotArea.height || this.renderedPlotArea.width !== axesLayout.plotArea.width;
|
19442 | suppressAnimations = suppressAnimations || plotAreaHasChanged, this.scrollableAxes.render(axesLayout, this.layers, suppressAnimations, function(layers, axesLayout, suppressAnimations) {
|
19443 | return _this.renderPlotArea(layers, axesLayout, suppressAnimations, legendMargins, resizeMode);
|
19444 | }, this.loadMoreDataHandler, operationKind === powerbi.VisualDataChangeOperationKind.Append),
|
19445 | this.chartAreaSvg.on("wheel", function() {
|
19446 | if (_this.axes.isXScrollBarVisible || _this.axes.isYScrollBarVisible) {
|
19447 | visuals.TooltipManager.ToolTipInstance.hide();
|
19448 | var wheelEvent = d3.event, dy = wheelEvent.deltaY;
|
19449 | _this.scrollableAxes.scrollDelta(dy), wheelEvent.preventDefault();
|
19450 | }
|
19451 | }), this.renderedPlotArea = axesLayout.plotArea;
|
19452 | }, CartesianChart.prototype.getMinimumDomainExtents = function() {
|
19453 | var xs = [], ys = [];
|
19454 | if (!_.isEmpty(this.xAxisReferenceLines)) {
|
19455 | var xAxisReferenceLineProperties = this.xAxisReferenceLines[0].object, value = visuals.ReferenceLineHelper.extractReferenceLineValue(xAxisReferenceLineProperties);
|
19456 | xs.push(value);
|
19457 | }
|
19458 | if (!_.isEmpty(this.y1AxisReferenceLines)) {
|
19459 | var y1AxisReferenceLineProperties = this.y1AxisReferenceLines[0].object, value = visuals.ReferenceLineHelper.extractReferenceLineValue(y1AxisReferenceLineProperties);
|
19460 | ys.push(value);
|
19461 | }
|
19462 | var ensureXDomain = {
|
19463 | min: d3.min(xs),
|
19464 | max: d3.max(xs)
|
19465 | }, ensureYDomain = {
|
19466 | min: d3.min(ys),
|
19467 | max: d3.max(ys)
|
19468 | };
|
19469 | return [ ensureXDomain, ensureYDomain ];
|
19470 | }, CartesianChart.prototype.getPlotAreaRect = function(axesLayout, legendMargins) {
|
19471 | var rect = {
|
19472 | left: axesLayout.margin.left,
|
19473 | top: axesLayout.margin.top,
|
19474 | width: axesLayout.plotArea.width,
|
19475 | height: axesLayout.plotArea.height
|
19476 | };
|
19477 | if (this.legend) {
|
19478 | var legendPosition_1 = this.legend.getOrientation();
|
19479 | visuals.Legend.isTop(legendPosition_1) ? rect.top += legendMargins.height : visuals.Legend.isLeft(legendPosition_1) && (rect.left += legendMargins.width);
|
19480 | }
|
19481 | return rect;
|
19482 | }, CartesianChart.prototype.renderBackgroundImage = function(layout) {
|
19483 | visuals.visualBackgroundHelper.renderBackgroundImage(this.background, this.element, layout);
|
19484 | }, CartesianChart.prototype.hideAxisLabels = function(legendMargins) {
|
19485 | return !(!(this.cartesianSmallViewPortProperties && this.cartesianSmallViewPortProperties.hideAxesOnSmallViewPort && this.currentViewport.height < this.cartesianSmallViewPortProperties.MinHeightAxesVisible) || this.visualInitOptions.interactivity.isInteractiveLegend);
|
19486 | }, CartesianChart.prototype.calculateInteractivityRightMargin = function() {
|
19487 | return this.visualInitOptions.interactivity && this.visualInitOptions.interactivity.isInteractiveLegend && !this.trimOrdinalDataOnOverflow ? INTERACTIVITY_RIGHT_MARGIN : 0;
|
19488 | }, CartesianChart.prototype.renderPlotArea = function(layers, axesLayout, suppressAnimations, legendMargins, resizeMode) {
|
19489 | var axes = axesLayout.axes, plotArea = axesLayout.plotArea, plotAreaRect = this.getPlotAreaRect(axesLayout, legendMargins), duration = visuals.AnimatorCommon.GetAnimationDuration(this.animator, suppressAnimations), easing = this.animator && this.animator.getEasing();
|
19490 | this.renderBackgroundImage(plotAreaRect), _.isEmpty(easing) ? this.svgAxes.renderAxes(axesLayout, duration) : this.svgAxes.renderAxes(axesLayout, duration, easing),
|
19491 | this.renderReferenceLines(axesLayout), this.renderLayers(layers, plotArea, axes, suppressAnimations, resizeMode),
|
19492 | this.renderTrendLines(axesLayout);
|
19493 | }, CartesianChart.prototype.renderTrendLines = function(axesLayout) {
|
19494 | var scrollableRegion = this.svgAxes.getScrollableRegion();
|
19495 | visuals.TrendLineHelper.render(this.trendLines, scrollableRegion, axesLayout.axes, axesLayout.plotArea);
|
19496 | }, CartesianChart.prototype.renderReferenceLines = function(axesLayout) {
|
19497 | var axes = axesLayout.axes, plotArea = axesLayout.plotArea, scrollableRegion = this.svgAxes.getScrollableRegion(), refLineDefaultColor = this.sharedColorPalette.getColorByIndex(0).value, showY1ReferenceLines = !1;
|
19498 | if (this.y1AxisReferenceLines) for (var _i = 0, _a = this.y1AxisReferenceLines; _i < _a.length; _i++) {
|
19499 | var referenceLineProperties = _a[_i], object = referenceLineProperties.object;
|
19500 | if (object[visuals.ReferenceLineHelper.referenceLineProps.show]) {
|
19501 | var isHorizontal = !axes.y1.isCategoryAxis, y1RefLineOptions = {
|
19502 | graphicContext: scrollableRegion,
|
19503 | referenceLineProperties: object,
|
19504 | axes: axes,
|
19505 | viewport: plotArea,
|
19506 | classAndSelector: this.y1RefLine,
|
19507 | defaultColor: refLineDefaultColor,
|
19508 | isHorizontal: isHorizontal
|
19509 | };
|
19510 | visuals.ReferenceLineHelper.render(y1RefLineOptions), showY1ReferenceLines = !0;
|
19511 | }
|
19512 | }
|
19513 | showY1ReferenceLines || scrollableRegion.selectAll(this.y1RefLine.selector).remove();
|
19514 | var showXReferenceLines = !1;
|
19515 | if (this.xAxisReferenceLines) for (var _b = 0, _c = this.xAxisReferenceLines; _b < _c.length; _b++) {
|
19516 | var referenceLineProperties = _c[_b], object = referenceLineProperties.object;
|
19517 | if (object[visuals.ReferenceLineHelper.referenceLineProps.show]) {
|
19518 | var isHorizontal = !1, xRefLineOptions = {
|
19519 | graphicContext: scrollableRegion,
|
19520 | referenceLineProperties: object,
|
19521 | axes: axes,
|
19522 | viewport: plotArea,
|
19523 | classAndSelector: this.xRefLine,
|
19524 | defaultColor: refLineDefaultColor,
|
19525 | isHorizontal: isHorizontal
|
19526 | };
|
19527 | visuals.ReferenceLineHelper.render(xRefLineOptions), showXReferenceLines = !0;
|
19528 | }
|
19529 | }
|
19530 | showXReferenceLines || scrollableRegion.selectAll(this.xRefLine.selector).remove();
|
19531 | }, CartesianChart.prototype.getReferenceLineLabels = function(axes, plotArea) {
|
19532 | var refLineDefaultColor = this.sharedColorPalette.getColorByIndex(0).value, referenceLineLabels = [];
|
19533 | if (this.y1AxisReferenceLines) for (var _i = 0, _a = this.y1AxisReferenceLines; _i < _a.length; _i++) {
|
19534 | var referenceLineProperties = _a[_i], object = referenceLineProperties.object;
|
19535 | if (object[visuals.ReferenceLineHelper.referenceLineProps.show] && object[visuals.ReferenceLineHelper.referenceLineProps.dataLabelShow]) {
|
19536 | var isHorizontal = !axes.y1.isCategoryAxis, y1RefLineLabelOptions = {
|
19537 | referenceLineProperties: object,
|
19538 | axes: axes,
|
19539 | viewport: plotArea,
|
19540 | defaultColor: refLineDefaultColor,
|
19541 | isHorizontal: isHorizontal,
|
19542 | key: JSON.stringify({
|
19543 | type: "y1AxisReferenceLine",
|
19544 | id: referenceLineProperties.id
|
19545 | })
|
19546 | };
|
19547 | referenceLineLabels.push(visuals.ReferenceLineHelper.createLabelDataPoint(y1RefLineLabelOptions));
|
19548 | }
|
19549 | }
|
19550 | if (this.xAxisReferenceLines) for (var _b = 0, _c = this.xAxisReferenceLines; _b < _c.length; _b++) {
|
19551 | var referenceLineProperties = _c[_b], object = referenceLineProperties.object;
|
19552 | if (object[visuals.ReferenceLineHelper.referenceLineProps.show] && object[visuals.ReferenceLineHelper.referenceLineProps.dataLabelShow]) {
|
19553 | var isHorizontal = !1, xRefLineLabelOptions = {
|
19554 | referenceLineProperties: object,
|
19555 | axes: axes,
|
19556 | viewport: plotArea,
|
19557 | defaultColor: refLineDefaultColor,
|
19558 | isHorizontal: isHorizontal,
|
19559 | key: JSON.stringify({
|
19560 | type: "xAxisReferenceLine",
|
19561 | id: referenceLineProperties.id
|
19562 | })
|
19563 | };
|
19564 | referenceLineLabels.push(visuals.ReferenceLineHelper.createLabelDataPoint(xRefLineLabelOptions));
|
19565 | }
|
19566 | }
|
19567 | return referenceLineLabels;
|
19568 | }, CartesianChart.prototype.renderDataLabels = function(labelDataPointGroups, labelsAreNumeric, plotArea, suppressAnimations, isCombo) {
|
19569 | var labelBackgroundRegion = this.svgAxes.getLabelBackground(), labelRegion = this.svgAxes.getLabelsRegion();
|
19570 | if (this.behavior) {
|
19571 | var labelLayoutOptions = visuals.NewDataLabelUtils.getDataLabelLayoutOptions(this.type), labelLayout = new powerbi.LabelLayout(labelLayoutOptions), dataLabels = labelLayout.layout(labelDataPointGroups, plotArea);
|
19572 | isCombo && visuals.NewDataLabelUtils.drawLabelBackground(labelBackgroundRegion, dataLabels, "#FFFFFF", .7);
|
19573 | var svgLabels = void 0, animator = this.animator;
|
19574 | if (animator && !suppressAnimations) {
|
19575 | var isPlayAxis = this.isPlayAxis(), duration = isPlayAxis ? visuals.PlayChart.FrameAnimationDuration : animator.getDuration();
|
19576 | svgLabels = visuals.NewDataLabelUtils.animateDefaultLabels(labelRegion, dataLabels, duration, labelsAreNumeric, isPlayAxis ? "linear" : animator.getEasing());
|
19577 | } else svgLabels = visuals.NewDataLabelUtils.drawDefaultLabels(labelRegion, dataLabels, labelsAreNumeric);
|
19578 | if (labelLayoutOptions.allowLeaderLines) {
|
19579 | var filteredLabels = _.filter(dataLabels, function(d) {
|
19580 | return null != d.leaderLinePoints && !_.isEmpty(d.leaderLinePoints) && null != d.identity;
|
19581 | });
|
19582 | visuals.NewDataLabelUtils.drawLabelLeaderLines(labelRegion, filteredLabels, function(d) {
|
19583 | return d.identity.getKey();
|
19584 | });
|
19585 | }
|
19586 | if (this.interactivityService && this.isLabelInteractivityEnabled) {
|
19587 | var labelsBehaviorOptions = {
|
19588 | labelItems: svgLabels
|
19589 | };
|
19590 | this.interactivityService.bind(dataLabels, new visuals.LabelsBehavior(), labelsBehaviorOptions, {
|
19591 | isLabels: !0
|
19592 | });
|
19593 | }
|
19594 | } else {
|
19595 | var labelLayout = new powerbi.LabelLayout({
|
19596 | maximumOffset: visuals.NewDataLabelUtils.maxLabelOffset,
|
19597 | startingOffset: visuals.NewDataLabelUtils.startingLabelOffset,
|
19598 | attemptToMoveLabelsIntoViewport: !0
|
19599 | }), dataLabels = labelLayout.layout(labelDataPointGroups, plotArea);
|
19600 | isCombo && visuals.NewDataLabelUtils.drawLabelBackground(labelBackgroundRegion, dataLabels, "#FFFFFF", .7),
|
19601 | visuals.NewDataLabelUtils.drawDefaultLabels(labelRegion, dataLabels, labelsAreNumeric);
|
19602 | }
|
19603 | }, CartesianChart.prototype.renderLayers = function(layers, plotArea, axes, suppressAnimations, resizeMode) {
|
19604 | var labelDataPointGroups = [], dataPoints = [], layerBehaviorOptions = [], labelsAreNumeric = !0;
|
19605 | if (!suppressAnimations) for (var _i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
|
19606 | var layer = layers_1[_i];
|
19607 | if (layer.shouldSuppressAnimation && layer.shouldSuppressAnimation()) {
|
19608 | suppressAnimations = !0;
|
19609 | break;
|
19610 | }
|
19611 | }
|
19612 | for (var _a = 0, layers_2 = layers; _a < layers_2.length; _a++) {
|
19613 | var layer = layers_2[_a], result = layer.render(suppressAnimations, resizeMode);
|
19614 | if (result) {
|
19615 | if (this.behavior && (dataPoints = dataPoints.concat(result.dataPoints), layerBehaviorOptions.push(result.behaviorOptions)),
|
19616 | result.labelDataPointGroups) for (var resultLabelDataPointsGroups = result.labelDataPointGroups, _b = 0, resultLabelDataPointsGroups_1 = resultLabelDataPointsGroups; _b < resultLabelDataPointsGroups_1.length; _b++) {
|
19617 | var resultLabelDataPointsGroup = resultLabelDataPointsGroups_1[_b];
|
19618 | resultLabelDataPointsGroup && labelDataPointGroups.push({
|
19619 | labelDataPoints: visuals.NewDataLabelUtils.removeDuplicates(resultLabelDataPointsGroup.labelDataPoints || []),
|
19620 | maxNumberOfLabels: resultLabelDataPointsGroup.maxNumberOfLabels
|
19621 | });
|
19622 | } else {
|
19623 | var resultsLabelDataPoints = result.labelDataPoints || [];
|
19624 | labelDataPointGroups.push({
|
19625 | labelDataPoints: visuals.NewDataLabelUtils.removeDuplicates(resultsLabelDataPoints),
|
19626 | maxNumberOfLabels: resultsLabelDataPoints.length
|
19627 | });
|
19628 | }
|
19629 | labelsAreNumeric = labelsAreNumeric && result.labelsAreNumeric;
|
19630 | }
|
19631 | }
|
19632 | var referenceLineLabels = this.getReferenceLineLabels(axes, plotArea);
|
19633 | if (_.isEmpty(referenceLineLabels) || labelDataPointGroups.unshift({
|
19634 | labelDataPoints: referenceLineLabels,
|
19635 | maxNumberOfLabels: referenceLineLabels.length
|
19636 | }), this.renderDataLabels(labelDataPointGroups, labelsAreNumeric, plotArea, suppressAnimations, visuals.ComboChart.isComboChart(this.type)),
|
19637 | this.interactivityService) {
|
19638 | var behaviorOptions = {
|
19639 | layerOptions: layerBehaviorOptions,
|
19640 | clearCatcher: this.clearCatcher
|
19641 | };
|
19642 | this.interactivityService.bind(dataPoints, this.behavior, behaviorOptions);
|
19643 | }
|
19644 | }, CartesianChart.getPreferredPlotArea = function(categoryCount, categoryThickness, viewport, isScrollable, isScalar, margin, noOuterPadding) {
|
19645 | margin || (margin = {
|
19646 | top: 0,
|
19647 | right: 0,
|
19648 | bottom: 0,
|
19649 | left: 0
|
19650 | });
|
19651 | var plotArea = {
|
19652 | height: viewport.height - margin.top - margin.bottom,
|
19653 | width: viewport.width - margin.left - margin.right
|
19654 | };
|
19655 | if (!isScalar && isScrollable) {
|
19656 | var preferredCategorySpan = CartesianChart.getPreferredCategorySpan(categoryCount, categoryThickness, noOuterPadding);
|
19657 | plotArea.width = Math.max(preferredCategorySpan, plotArea.width);
|
19658 | }
|
19659 | return plotArea;
|
19660 | }, CartesianChart.getPreferredCategorySpan = function(categoryCount, categoryThickness, noOuterPadding) {
|
19661 | var span = categoryThickness * categoryCount;
|
19662 | return noOuterPadding ? span : span + categoryThickness * CartesianChart.OuterPaddingRatio * 2;
|
19663 | }, CartesianChart.getLayout = function(data, options) {
|
19664 | var categoryCount = options.categoryCount, availableWidth = options.availableWidth, domain = options.domain, trimOrdinalDataOnOverflow = options.trimOrdinalDataOnOverflow, isScalar = !!options.isScalar, isScrollable = !!options.isScrollable, categoryThickness = CartesianChart.getCategoryThickness(data ? data.series : null, categoryCount, availableWidth, domain, isScalar, trimOrdinalDataOnOverflow), totalOuterPadding = categoryThickness * CartesianChart.OuterPaddingRatio * 2, calculatedBarCount = powerbi.Double.floorWithPrecision((availableWidth - totalOuterPadding) / categoryThickness), visibleCategoryCount = Math.min(calculatedBarCount, categoryCount), willScroll = categoryCount > visibleCategoryCount && isScrollable, outerPaddingRatio = CartesianChart.OuterPaddingRatio;
|
19665 | if (!isScalar && !willScroll) {
|
19666 | var oneOuterPadding = (availableWidth - categoryThickness * visibleCategoryCount) / 2;
|
19667 | outerPaddingRatio = oneOuterPadding / categoryThickness;
|
19668 | }
|
19669 | return !isScalar && isScrollable && (visibleCategoryCount = categoryCount), {
|
19670 | categoryCount: visibleCategoryCount,
|
19671 | categoryThickness: categoryThickness,
|
19672 | outerPaddingRatio: outerPaddingRatio,
|
19673 | isScalar: isScalar
|
19674 | };
|
19675 | }, CartesianChart.getCategoryThickness = function(seriesList, numCategories, plotLength, domain, isScalar, trimOrdinalDataOnOverflow) {
|
19676 | var thickness;
|
19677 | if (2 > numCategories) thickness = plotLength * (1 - CartesianChart.OuterPaddingRatio); else if (isScalar && domain && domain.length > 1) {
|
19678 | var minInterval = CartesianChart.getMinInterval(seriesList), domainSpan = domain[domain.length - 1] - domain[0], ratio = minInterval / (domainSpan + minInterval * CartesianChart.OuterPaddingRatio * 2);
|
19679 | thickness = plotLength * ratio, thickness = Math.max(thickness, CartesianChart.MinScalarRectThickness);
|
19680 | } else thickness = plotLength / (numCategories + 2 * CartesianChart.OuterPaddingRatio),
|
19681 | trimOrdinalDataOnOverflow && (thickness = Math.max(thickness, CartesianChart.MinOrdinalRectThickness));
|
19682 | var maxRectThickness = plotLength / (3 + 2 * CartesianChart.OuterPaddingRatio);
|
19683 | return thickness = Math.min(thickness, maxRectThickness), !isScalar && numCategories >= 3 && trimOrdinalDataOnOverflow ? Math.max(thickness, CartesianChart.MinOrdinalRectThickness) : thickness;
|
19684 | }, CartesianChart.getMinInterval = function(seriesList) {
|
19685 | var minInterval = Number.MAX_VALUE;
|
19686 | if (seriesList.length > 0) for (var series0data = seriesList[0].data.filter(function(d) {
|
19687 | return !d.highlight;
|
19688 | }), i = 0, ilen = series0data.length - 1; ilen > i; i++) minInterval = Math.min(minInterval, Math.abs(series0data[i + 1].categoryValue - series0data[i].categoryValue));
|
19689 | return minInterval;
|
19690 | }, CartesianChart.applyLoadMoreEnabledToMapping = function(cartesianLoadMoreEnabled, mapping) {
|
19691 | var CartesianLoadMoreCategoryWindowCount = 100, CartesianLoadMoreValueTopCount = 60;
|
19692 | if (cartesianLoadMoreEnabled) {
|
19693 | var categorical = mapping.categorical;
|
19694 | if (categorical) {
|
19695 | var categories = categorical.categories, values = categorical.values;
|
19696 | categories && (categories.dataReductionAlgorithm = {
|
19697 | window: {
|
19698 | count: CartesianLoadMoreCategoryWindowCount
|
19699 | }
|
19700 | }), values && values.group && (values.group.dataReductionAlgorithm = {
|
19701 | top: {
|
19702 | count: CartesianLoadMoreValueTopCount
|
19703 | }
|
19704 | });
|
19705 | }
|
19706 | }
|
19707 | }, CartesianChart.MinOrdinalRectThickness = 20, CartesianChart.MinScalarRectThickness = 2,
|
19708 | CartesianChart.OuterPaddingRatio = .4, CartesianChart.InnerPaddingRatio = .2, CartesianChart.TickLabelPadding = 2,
|
19709 | CartesianChart.LoadMoreThreshold = 1, CartesianChart.ClassName = "cartesianChart",
|
19710 | CartesianChart.PlayAxisBottomMargin = 80, CartesianChart.FontSize = 11, CartesianChart.FontSizeString = jsCommon.PixelConverter.toString(CartesianChart.FontSize),
|
19711 | CartesianChart.AxisTextProperties = {
|
19712 | fontFamily: visuals.Font.Family.regular.css,
|
19713 | fontSize: CartesianChart.FontSizeString
|
19714 | }, CartesianChart;
|
19715 | }();
|
19716 | visuals.CartesianChart = CartesianChart;
|
19717 | var SvgBrush = function() {
|
19718 | function SvgBrush(brushWidth) {
|
19719 | this.brush = d3.svg.brush(), this.brushWidth = brushWidth;
|
19720 | }
|
19721 | return SvgBrush.prototype.init = function(element) {
|
19722 | this.element = element;
|
19723 | }, SvgBrush.prototype.remove = function() {
|
19724 | this.element.selectAll(SvgBrush.Brush.selector).remove(), this.brushGraphicsContext = void 0;
|
19725 | }, SvgBrush.prototype.getExtent = function() {
|
19726 | return this.brush.extent();
|
19727 | }, SvgBrush.prototype.setExtent = function(extent) {
|
19728 | this.brush.extent(extent);
|
19729 | }, SvgBrush.prototype.setScale = function(scale) {
|
19730 | this.isHorizontal ? this.brush.x(scale) : this.brush.y(scale);
|
19731 | }, SvgBrush.prototype.setOrientation = function(isHorizontal) {
|
19732 | this.isHorizontal = isHorizontal;
|
19733 | }, SvgBrush.prototype.renderBrush = function(extentLength, brushX, brushY, scrollCallback) {
|
19734 | var _this = this;
|
19735 | this.brushGraphicsContext || (this.brushGraphicsContext = this.element.append("g").classed(SvgBrush.Brush["class"], !0)),
|
19736 | this.scrollCallback = scrollCallback, this.brush.on("brushstart", function() {
|
19737 | return _this.brushStartExtent = _this.brush.extent();
|
19738 | }).on("brush", function() {
|
19739 | window.requestAnimationFrame(scrollCallback);
|
19740 | }).on("brushend", function() {
|
19741 | _this.resizeExtent(extentLength), _this.updateExtentPosition(extentLength), _this.brushStartExtent = null;
|
19742 | });
|
19743 | var brushContext = this.brushGraphicsContext.attr({
|
19744 | transform: visuals.SVGUtil.translate(brushX, brushY),
|
19745 | "drag-resize-disabled": "true"
|
19746 | }).call(this.brush);
|
19747 | brushContext.selectAll(".resize").remove(), this.isHorizontal ? brushContext.selectAll("rect").attr("height", this.brushWidth) : brushContext.selectAll("rect").attr("width", this.brushWidth);
|
19748 | }, SvgBrush.prototype.scroll = function(scrollBarLength) {
|
19749 | this.updateExtentPosition(scrollBarLength), this.scrollCallback();
|
19750 | }, SvgBrush.prototype.updateExtentPosition = function(scrollBarLength) {
|
19751 | var extent = this.brush.extent(), newStartPos = extent[0], halfScrollBarLen = scrollBarLength / 2;
|
19752 | if (extent[0] === extent[1] && (newStartPos -= halfScrollBarLen), extent[1] - extent[0] > scrollBarLength) {
|
19753 | var halfDragLength = (extent[1] - extent[0]) / 2;
|
19754 | newStartPos = extent[0] < this.brushStartExtent[0] ? extent[0] + halfDragLength - halfScrollBarLen : extent[1] - halfDragLength - halfScrollBarLen;
|
19755 | }
|
19756 | this.isHorizontal ? this.brushGraphicsContext.select(".extent").attr("x", newStartPos) : this.brushGraphicsContext.select(".extent").attr("y", newStartPos);
|
19757 | }, SvgBrush.prototype.resizeExtent = function(extentLength) {
|
19758 | this.isHorizontal ? this.brushGraphicsContext.select(".extent").attr("width", extentLength) : this.brushGraphicsContext.select(".extent").attr("height", extentLength);
|
19759 | }, SvgBrush.Brush = createClassAndSelector("brush"), SvgBrush;
|
19760 | }(), ScrollableAxes = function() {
|
19761 | function ScrollableAxes(axes, svgBrush) {
|
19762 | this.axes = axes, this.brush = svgBrush;
|
19763 | }
|
19764 | return ScrollableAxes.prototype.filterDataToViewport = function(mainAxisScale, layers, axes, scrollScale, extent, visibleCategoryCount) {
|
19765 | if (scrollScale) {
|
19766 | var selected, data = [], startIndex = visuals.AxisHelper.lookupOrdinalIndex(scrollScale, extent[0]), endIndex = startIndex + visibleCategoryCount, domain = scrollScale.domain();
|
19767 | if (selected = domain.slice(startIndex, endIndex), selected && selected.length > 0) {
|
19768 | for (var i = 0; i < layers.length; i++) data[i] = layers[i].setFilteredData(selected[0], selected[selected.length - 1] + 1);
|
19769 | mainAxisScale.domain(selected);
|
19770 | var axisPropsToUpdate = void 0;
|
19771 | axisPropsToUpdate = this.axes.isXScrollBarVisible ? axes.x : axes.y1, axisPropsToUpdate.axis.scale(mainAxisScale),
|
19772 | axisPropsToUpdate.scale(mainAxisScale), axisPropsToUpdate.axis.ticks(selected.length),
|
19773 | axisPropsToUpdate.axis.tickValues(selected);
|
19774 | var tickFormat_1 = axisPropsToUpdate.axis.tickFormat();
|
19775 | axisPropsToUpdate.values = _.map(selected, function(d) {
|
19776 | return tickFormat_1(d);
|
19777 | });
|
19778 | }
|
19779 | return {
|
19780 | startIndex: startIndex,
|
19781 | endIndex: endIndex - 1
|
19782 | };
|
19783 | }
|
19784 | }, ScrollableAxes.prototype.render = function(axesLayout, layers, suppressAnimations, renderDelegate, loadMoreDataHandler, preserveScrollPosition) {
|
19785 | var _this = this, plotArea = axesLayout.plotArea;
|
19786 | if (!(plotArea.width < 1 || plotArea.height < 1)) {
|
19787 | this.axisScale = null;
|
19788 | var brushX, brushY, scrollbarLength, numVisibleCategories, categoryThickness, newAxisLength, showingScrollBar = this.axes.isXScrollBarVisible || this.axes.isYScrollBarVisible;
|
19789 | if (loadMoreDataHandler || showingScrollBar) if (this.axes.isYAxisCategorical()) {
|
19790 | this.axisScale = axesLayout.axes.y1.scale, brushX = axesLayout.viewport.width, brushY = axesLayout.margin.top,
|
19791 | categoryThickness = axesLayout.axes.y1.categoryThickness;
|
19792 | var outerPadding = axesLayout.axes.y1.outerPadding;
|
19793 | numVisibleCategories = powerbi.Double.floorWithPrecision((plotArea.height - 2 * outerPadding) / categoryThickness),
|
19794 | scrollbarLength = (numVisibleCategories + 1) * categoryThickness, newAxisLength = plotArea.height;
|
19795 | } else {
|
19796 | this.axisScale = axesLayout.axes.x.scale, brushX = axesLayout.margin.left, brushY = axesLayout.viewport.height,
|
19797 | categoryThickness = axesLayout.axes.x.categoryThickness;
|
19798 | var outerPadding = axesLayout.axes.x.outerPadding;
|
19799 | numVisibleCategories = powerbi.Double.floorWithPrecision((plotArea.width - 2 * outerPadding) / categoryThickness),
|
19800 | scrollbarLength = (numVisibleCategories + 1) * categoryThickness, newAxisLength = plotArea.width;
|
19801 | }
|
19802 | if (!showingScrollBar) return loadMoreDataHandler && (loadMoreDataHandler.viewportDataRange = {
|
19803 | startIndex: 0,
|
19804 | endIndex: numVisibleCategories
|
19805 | }, loadMoreDataHandler.shouldLoadMoreData() && loadMoreDataHandler.loadMoreData()),
|
19806 | this.brush.remove(), void renderDelegate(layers, axesLayout, suppressAnimations);
|
19807 | if (!(1 > numVisibleCategories)) {
|
19808 | this.scrollScale = this.axisScale.copy(), this.scrollScale.rangeBands([ 0, scrollbarLength ]),
|
19809 | this.brushMinExtent = this.scrollScale(numVisibleCategories - 1), this.axisScale.rangeBands([ 0, newAxisLength ], CartesianChart.InnerPaddingRatio, CartesianChart.OuterPaddingRatio),
|
19810 | this.brush.setOrientation(this.axes.isXScrollBarVisible), this.brush.setScale(this.scrollScale),
|
19811 | this.brush.setExtent([ 0, this.brushMinExtent ]);
|
19812 | var renderOnScroll = function(extent, suppressAnimations) {
|
19813 | var dataRange = _this.filterDataToViewport(_this.axisScale, layers, axesLayout.axes, _this.scrollScale, extent, numVisibleCategories);
|
19814 | loadMoreDataHandler && (loadMoreDataHandler.viewportDataRange = dataRange, loadMoreDataHandler.shouldLoadMoreData() && loadMoreDataHandler.loadMoreData()),
|
19815 | renderDelegate(layers, axesLayout, suppressAnimations);
|
19816 | }, scrollCallback = function() {
|
19817 | return _this.onBrushed(scrollbarLength, renderOnScroll);
|
19818 | };
|
19819 | if (this.brush.renderBrush(this.brushMinExtent, brushX, brushY, scrollCallback),
|
19820 | preserveScrollPosition && loadMoreDataHandler) {
|
19821 | var startIndex = loadMoreDataHandler.viewportDataRange ? loadMoreDataHandler.viewportDataRange.startIndex : 0;
|
19822 | ScrollableAxes.clampBrushExtent(this.brush, scrollbarLength, this.brushMinExtent),
|
19823 | this.scrollTo(startIndex);
|
19824 | } else renderOnScroll(this.brush.getExtent(), suppressAnimations);
|
19825 | }
|
19826 | }
|
19827 | }, ScrollableAxes.prototype.scrollDelta = function(delta) {
|
19828 | if (this.axisScale && !_.isEmpty(this.axisScale.domain())) {
|
19829 | var currentStartIndex = this.axisScale.domain()[0], newStartIndex = currentStartIndex + Math.round(delta / CartesianChart.MinOrdinalRectThickness);
|
19830 | this.scrollTo(newStartIndex);
|
19831 | }
|
19832 | }, ScrollableAxes.prototype.scrollTo = function(startIndex) {
|
19833 | var lastIndex = _.last(this.scrollScale.domain());
|
19834 | startIndex = Math.max(0, Math.min(startIndex, lastIndex));
|
19835 | var extent = this.brush.getExtent(), extentLength = extent[1] - extent[0], halfCategoryThickness = (this.scrollScale(1) - this.scrollScale(0)) / 2;
|
19836 | extent[0] = this.scrollScale(startIndex) + halfCategoryThickness, extent[1] = extent[0] + extentLength + halfCategoryThickness,
|
19837 | this.brush.setExtent(extent);
|
19838 | var scrollbarLength = this.scrollScale.rangeExtent()[1];
|
19839 | ScrollableAxes.clampBrushExtent(this.brush, scrollbarLength, this.brushMinExtent),
|
19840 | this.brush.scroll(scrollbarLength);
|
19841 | }, ScrollableAxes.prototype.onBrushed = function(scrollbarLength, render) {
|
19842 | var brush = this.brush;
|
19843 | ScrollableAxes.clampBrushExtent(this.brush, scrollbarLength, this.brushMinExtent);
|
19844 | var extent = brush.getExtent();
|
19845 | render(extent, !0);
|
19846 | }, ScrollableAxes.clampBrushExtent = function(brush, scrollbarLength, minExtent) {
|
19847 | var extent = brush.getExtent(), width = extent[1] - extent[0];
|
19848 | if (!(width === minExtent && extent[1] <= scrollbarLength && extent[0] >= 0)) {
|
19849 | if (width > minExtent) {
|
19850 | var padding = (width - minExtent) / 2;
|
19851 | extent[0] += padding, extent[1] -= padding;
|
19852 | } else if (minExtent > width) {
|
19853 | var padding = (minExtent - width) / 2;
|
19854 | extent[0] -= padding, extent[1] += padding;
|
19855 | }
|
19856 | extent[0] < 0 ? (extent[0] = 0, extent[1] = minExtent) : extent[0] > scrollbarLength - minExtent && (extent[0] = scrollbarLength - minExtent,
|
19857 | extent[1] = scrollbarLength), brush.setExtent(extent);
|
19858 | }
|
19859 | }, ScrollableAxes.ScrollbarWidth = 10, ScrollableAxes;
|
19860 | }(), SvgCartesianAxes = function() {
|
19861 | function SvgCartesianAxes(axes) {
|
19862 | this.axes = axes;
|
19863 | }
|
19864 | return SvgCartesianAxes.prototype.getScrollableRegion = function() {
|
19865 | return this.axisGraphicsContextScrollable;
|
19866 | }, SvgCartesianAxes.prototype.getLabelsRegion = function() {
|
19867 | return this.labelRegion;
|
19868 | }, SvgCartesianAxes.prototype.getLabelBackground = function() {
|
19869 | return this.labelBackgroundRegion;
|
19870 | }, SvgCartesianAxes.prototype.getXAxis = function() {
|
19871 | return this.xAxisGraphicsContext;
|
19872 | }, SvgCartesianAxes.prototype.getY1Axis = function() {
|
19873 | return this.y1AxisGraphicsContext;
|
19874 | }, SvgCartesianAxes.prototype.getY2Axis = function() {
|
19875 | return this.y2AxisGraphicsContext;
|
19876 | }, SvgCartesianAxes.prototype.update = function(categoryAxisProperties, valueAxisProperties) {
|
19877 | this.categoryAxisProperties = categoryAxisProperties, this.valueAxisProperties = valueAxisProperties;
|
19878 | }, SvgCartesianAxes.prototype.init = function(svg) {
|
19879 | var axisGraphicsContext = this.axisGraphicsContext = svg.append("g").classed(SvgCartesianAxes.AxisGraphicsContext["class"], !0);
|
19880 | this.svgScrollable = svg.append("svg").classed("svgScrollable", !0).style("overflow", "hidden");
|
19881 | var axisGraphicsContextScrollable = this.axisGraphicsContextScrollable = this.svgScrollable.append("g").classed(SvgCartesianAxes.AxisGraphicsContext["class"], !0);
|
19882 | this.labelBackgroundRegion = this.svgScrollable.append("g").classed(visuals.NewDataLabelUtils.labelBackgroundGraphicsContextClass["class"], !0),
|
19883 | this.labelRegion = this.svgScrollable.append("g").classed(visuals.NewDataLabelUtils.labelGraphicsContextClass["class"], !0);
|
19884 | var showLinesOnX = this.axes.showLinesOnX, showLinesOnY = this.axes.showLinesOnY, scrollX = showLinesOnY, scrollY = !scrollX;
|
19885 | scrollY ? (this.y1AxisGraphicsContext = axisGraphicsContextScrollable.append("g").attr("class", "y axis"),
|
19886 | this.y2AxisGraphicsContext = axisGraphicsContextScrollable.append("g").attr("class", "y axis")) : (this.y1AxisGraphicsContext = axisGraphicsContext.append("g").attr("class", "y axis"),
|
19887 | this.y2AxisGraphicsContext = axisGraphicsContext.append("g").attr("class", "y axis")),
|
19888 | scrollX ? this.xAxisGraphicsContext = axisGraphicsContextScrollable.append("g").attr("class", "x axis") : this.xAxisGraphicsContext = axisGraphicsContext.append("g").attr("class", "x axis"),
|
19889 | this.xAxisGraphicsContext.classed("showLinesOnAxis", showLinesOnX), this.y1AxisGraphicsContext.classed("showLinesOnAxis", showLinesOnY),
|
19890 | this.y2AxisGraphicsContext.classed("showLinesOnAxis", showLinesOnY), this.xAxisGraphicsContext.classed("hideLinesOnAxis", !showLinesOnX),
|
19891 | this.y1AxisGraphicsContext.classed("hideLinesOnAxis", !showLinesOnY), this.y2AxisGraphicsContext.classed("hideLinesOnAxis", !showLinesOnY);
|
19892 | }, SvgCartesianAxes.updateAnimatedTickTooltips = function(axisSelection, values) {
|
19893 | axisSelection.each("end", function() {
|
19894 | d3.select(this).selectAll("text").append("title").text(function(d, i) {
|
19895 | return values[i];
|
19896 | });
|
19897 | });
|
19898 | }, SvgCartesianAxes.updateTickTooltips = function(axisSelection, values) {
|
19899 | axisSelection.selectAll("text").append("title").text(function(d, i) {
|
19900 | return values[i];
|
19901 | });
|
19902 | }, SvgCartesianAxes.prototype.renderAxes = function(axesLayout, duration, easing) {
|
19903 | void 0 === easing && (easing = "cubic-in-out");
|
19904 | var xLabelColor, yLabelColor, y2LabelColor, marginLimits = axesLayout.marginLimits, plotArea = axesLayout.plotArea, viewport = axesLayout.viewport, margin = axesLayout.margin, axes = axesLayout.axes, tickLabelMargins = axesLayout.tickLabelMargins, bottomMarginLimit = marginLimits.bottom, leftRightMarginLimit = marginLimits.left;
|
19905 | if (this.axes.shouldRenderAxis(axes.x)) {
|
19906 | xLabelColor = axes.x.isCategoryAxis ? this.categoryAxisProperties && this.categoryAxisProperties.labelColor ? this.categoryAxisProperties.labelColor : null : this.valueAxisProperties && this.valueAxisProperties.labelColor ? this.valueAxisProperties.labelColor : null,
|
19907 | axes.x.axis.orient("bottom"), !axes.x.willLabelsFit && visuals.AxisHelper.isOrdinalScale(axes.x.scale) && axes.x.axis.tickPadding(SvgCartesianAxes.TickPaddingRotatedX);
|
19908 | var xAxisGraphicsElement = this.xAxisGraphicsContext;
|
19909 | duration ? xAxisGraphicsElement.transition().duration(duration).ease(easing).call(axes.x.axis).call(SvgCartesianAxes.updateAnimatedTickTooltips, axes.x.values) : xAxisGraphicsElement.call(axes.x.axis),
|
19910 | xAxisGraphicsElement.call(SvgCartesianAxes.darkenZeroLine).call(SvgCartesianAxes.setAxisLabelColor, xLabelColor);
|
19911 | var xAxisTextNodes = xAxisGraphicsElement.selectAll("text");
|
19912 | axes.x.willLabelsWordBreak ? xAxisTextNodes.call(visuals.AxisHelper.LabelLayoutStrategy.wordBreak, axes.x, bottomMarginLimit) : xAxisTextNodes.call(visuals.AxisHelper.LabelLayoutStrategy.rotate, bottomMarginLimit, powerbi.TextMeasurementService.getTailoredTextOrDefault, CartesianChart.AxisTextProperties, !axes.x.willLabelsFit && visuals.AxisHelper.isOrdinalScale(axes.x.scale), bottomMarginLimit === tickLabelMargins.xMax, axes.x, margin, this.axes.isXScrollBarVisible || this.axes.isYScrollBarVisible),
|
19913 | duration || SvgCartesianAxes.updateTickTooltips(xAxisGraphicsElement, axes.x.values);
|
19914 | } else this.xAxisGraphicsContext.selectAll("*").remove();
|
19915 | if (this.axes.shouldRenderAxis(axes.y1)) {
|
19916 | yLabelColor = axes.y1.isCategoryAxis ? this.categoryAxisProperties && this.categoryAxisProperties.labelColor ? this.categoryAxisProperties.labelColor : null : this.valueAxisProperties && this.valueAxisProperties.labelColor ? this.valueAxisProperties.labelColor : null;
|
19917 | var showY1OnRight = this.axes.shouldShowY1OnRight(), y1TickPadding = showY1OnRight ? axesLayout.tickPadding.right : axesLayout.tickPadding.left;
|
19918 | axes.y1.axis.tickSize(-plotArea.width).tickPadding(y1TickPadding).orient(this.axes.getYAxisOrientation().toLowerCase());
|
19919 | var y1AxisGraphicsElement = this.y1AxisGraphicsContext;
|
19920 | if (duration ? y1AxisGraphicsElement.transition().duration(duration).ease(easing).call(axes.y1.axis).call(SvgCartesianAxes.updateAnimatedTickTooltips, axes.y1.values) : y1AxisGraphicsElement.call(axes.y1.axis),
|
19921 | y1AxisGraphicsElement.call(SvgCartesianAxes.darkenZeroLine).call(SvgCartesianAxes.setAxisLabelColor, yLabelColor),
|
19922 | tickLabelMargins.yLeft >= leftRightMarginLimit && y1AxisGraphicsElement.selectAll("text").call(visuals.AxisHelper.LabelLayoutStrategy.clip, leftRightMarginLimit - y1TickPadding, powerbi.TextMeasurementService.svgEllipsis),
|
19923 | duration || SvgCartesianAxes.updateTickTooltips(y1AxisGraphicsElement, axes.y1.values),
|
19924 | !axes.y2 || this.valueAxisProperties && null != this.valueAxisProperties.secShow && !this.valueAxisProperties.secShow) this.y2AxisGraphicsContext.selectAll("*").remove(); else {
|
19925 | y2LabelColor = this.valueAxisProperties && this.valueAxisProperties.secLabelColor ? this.valueAxisProperties.secLabelColor : null;
|
19926 | var y2TickPadding = showY1OnRight ? axesLayout.tickPadding.left : axesLayout.tickPadding.right;
|
19927 | axes.y2.axis.tickSize(SvgCartesianAxes.Y2TickSize).tickPadding(y2TickPadding).orient(showY1OnRight ? visuals.yAxisPosition.left.toLowerCase() : visuals.yAxisPosition.right.toLowerCase());
|
19928 | var y2AxisGraphicsElement = this.y2AxisGraphicsContext;
|
19929 | duration ? y2AxisGraphicsElement.transition().duration(duration).ease(easing).call(axes.y2.axis).call(SvgCartesianAxes.updateAnimatedTickTooltips, axes.y2.values) : y2AxisGraphicsElement.call(axes.y2.axis),
|
19930 | y2AxisGraphicsElement.call(SvgCartesianAxes.darkenZeroLine).call(SvgCartesianAxes.setAxisLabelColor, y2LabelColor),
|
19931 | tickLabelMargins.yRight >= leftRightMarginLimit && y2AxisGraphicsElement.selectAll("text").call(visuals.AxisHelper.LabelLayoutStrategy.clip, leftRightMarginLimit - y2TickPadding, powerbi.TextMeasurementService.svgEllipsis),
|
19932 | duration || SvgCartesianAxes.updateTickTooltips(y2AxisGraphicsElement, axes.y2.values);
|
19933 | }
|
19934 | } else this.y1AxisGraphicsContext.selectAll("*").remove(), this.y2AxisGraphicsContext.selectAll("*").remove();
|
19935 | var axisLabels = axesLayout.axisLabels, chartHasAxisLabels = null != axisLabels.x || null != axisLabels.y || null != axisLabels.y2;
|
19936 | if (chartHasAxisLabels) {
|
19937 | var hideXAxisTitle = !this.axes.shouldRenderAxisTitle(axes.x, !0, !1), hideYAxisTitle = !this.axes.shouldRenderAxisTitle(axes.y1, !0, !1), hideY2AxisTitle = !this.axes.shouldRenderAxisTitle(axes.y2, !1, !0), renderAxisOptions = {
|
19938 | axisLabels: axisLabels,
|
19939 | viewport: viewport,
|
19940 | margin: margin,
|
19941 | hideXAxisTitle: hideXAxisTitle,
|
19942 | hideYAxisTitle: hideYAxisTitle,
|
19943 | hideY2AxisTitle: hideY2AxisTitle,
|
19944 | xLabelColor: xLabelColor,
|
19945 | yLabelColor: yLabelColor,
|
19946 | y2LabelColor: y2LabelColor,
|
19947 | fontSize: SvgCartesianAxes.AxisLabelFontSize
|
19948 | };
|
19949 | this.renderAxesLabels(renderAxisOptions);
|
19950 | } else this.axisGraphicsContext.selectAll(".xAxisLabel").remove(), this.axisGraphicsContext.selectAll(".yAxisLabel").remove();
|
19951 | this.translateAxes(viewport, margin);
|
19952 | }, SvgCartesianAxes.prototype.renderAxesLabels = function(options) {
|
19953 | this.axisGraphicsContext.selectAll(".xAxisLabel").remove(), this.axisGraphicsContext.selectAll(".yAxisLabel").remove();
|
19954 | var margin = options.margin, width = options.viewport.width - (margin.left + margin.right), height = options.viewport.height, fontSize = options.fontSize, axisTextProperties = _.clone(CartesianChart.AxisTextProperties);
|
19955 | axisTextProperties.fontSize = fontSize + "px";
|
19956 | var showOnRight = this.axes.shouldShowY1OnRight();
|
19957 | if (!options.hideXAxisTitle) {
|
19958 | axisTextProperties.text = options.axisLabels.x;
|
19959 | var heightOffset_1 = powerbi.TextMeasurementService.estimateSvgTextHeight(axisTextProperties), xAxisLabel = this.axisGraphicsContext.append("text").style("text-anchor", "middle").text(options.axisLabels.x).call(function(text) {
|
19960 | text.each(function() {
|
19961 | var text = d3.select(this);
|
19962 | text.attr({
|
19963 | "class": "xAxisLabel",
|
19964 | transform: visuals.SVGUtil.translate(width / 2, height - heightOffset_1)
|
19965 | });
|
19966 | });
|
19967 | });
|
19968 | xAxisLabel.style("fill", options.xLabelColor ? options.xLabelColor.solid.color : null),
|
19969 | xAxisLabel.call(visuals.AxisHelper.LabelLayoutStrategy.clip, width, powerbi.TextMeasurementService.svgEllipsis).call(visuals.tooltipUtils.tooltipUpdate, [ options.axisLabels.x ]);
|
19970 | }
|
19971 | if (!options.hideYAxisTitle) {
|
19972 | axisTextProperties.text = options.axisLabels.y;
|
19973 | var textHeight_1 = powerbi.TextMeasurementService.estimateSvgTextHeight(axisTextProperties), yAxisLabel = this.axisGraphicsContext.append("text").style("text-anchor", "middle").text(options.axisLabels.y).call(function(text) {
|
19974 | text.each(function() {
|
19975 | var text = d3.select(this);
|
19976 | text.attr({
|
19977 | "class": "yAxisLabel",
|
19978 | transform: "rotate(-90)",
|
19979 | y: showOnRight ? width + margin.right - textHeight_1 : -margin.left,
|
19980 | x: -((height - margin.top - margin.bottom) / 2),
|
19981 | dy: "1em"
|
19982 | });
|
19983 | });
|
19984 | });
|
19985 | yAxisLabel.style("fill", options.yLabelColor ? options.yLabelColor.solid.color : null),
|
19986 | yAxisLabel.call(visuals.AxisHelper.LabelLayoutStrategy.clip, height - (margin.bottom + margin.top), powerbi.TextMeasurementService.svgEllipsis).call(visuals.tooltipUtils.tooltipUpdate, [ options.axisLabels.y ]);
|
19987 | }
|
19988 | if (!options.hideY2AxisTitle && options.axisLabels.y2) {
|
19989 | axisTextProperties.text = options.axisLabels.y2;
|
19990 | var textHeight_2 = powerbi.TextMeasurementService.estimateSvgTextHeight(axisTextProperties), y2AxisLabel = this.axisGraphicsContext.append("text").style("text-anchor", "middle").text(options.axisLabels.y2).call(function(text) {
|
19991 | text.each(function() {
|
19992 | var text = d3.select(this);
|
19993 | text.attr({
|
19994 | "class": "yAxisLabel",
|
19995 | transform: "rotate(-90)",
|
19996 | y: showOnRight ? -margin.left : width + margin.right - textHeight_2,
|
19997 | x: -((height - margin.top - margin.bottom) / 2),
|
19998 | dy: "1em"
|
19999 | });
|
20000 | });
|
20001 | });
|
20002 | y2AxisLabel.style("fill", options.y2LabelColor ? options.y2LabelColor.solid.color : null),
|
20003 | y2AxisLabel.call(visuals.AxisHelper.LabelLayoutStrategy.clip, height - (margin.bottom + margin.top), powerbi.TextMeasurementService.svgEllipsis).call(visuals.tooltipUtils.tooltipUpdate, [ options.axisLabels.y2 ]);
|
20004 | }
|
20005 | }, SvgCartesianAxes.prototype.translateAxes = function(viewport, margin) {
|
20006 | var width = viewport.width - (margin.left + margin.right), height = viewport.height - (margin.top + margin.bottom), showY1OnRight = this.axes.shouldShowY1OnRight();
|
20007 | this.xAxisGraphicsContext.attr("transform", visuals.SVGUtil.translate(0, height)),
|
20008 | this.y1AxisGraphicsContext.attr("transform", visuals.SVGUtil.translate(showY1OnRight ? width : 0, 0)),
|
20009 | this.y2AxisGraphicsContext.attr("transform", visuals.SVGUtil.translate(showY1OnRight ? 0 : width, 0)),
|
20010 | this.svgScrollable.attr({
|
20011 | x: 0,
|
20012 | width: viewport.width,
|
20013 | height: viewport.height
|
20014 | }), this.axisGraphicsContext.attr("transform", visuals.SVGUtil.translate(margin.left, margin.top)),
|
20015 | this.axisGraphicsContextScrollable.attr("transform", visuals.SVGUtil.translate(margin.left, margin.top)),
|
20016 | this.labelRegion.attr("transform", visuals.SVGUtil.translate(margin.left, margin.top)),
|
20017 | this.labelBackgroundRegion.attr("transform", visuals.SVGUtil.translate(margin.left, margin.top)),
|
20018 | this.axes.isXScrollBarVisible ? (this.svgScrollable.attr({
|
20019 | x: margin.left
|
20020 | }), this.axisGraphicsContextScrollable.attr("transform", visuals.SVGUtil.translate(0, margin.top)),
|
20021 | this.labelRegion.attr("transform", visuals.SVGUtil.translate(0, margin.top)), this.labelBackgroundRegion.attr("transform", visuals.SVGUtil.translate(0, margin.top)),
|
20022 | this.svgScrollable.attr("width", width)) : this.axes.isYScrollBarVisible && this.svgScrollable.attr("height", height + margin.top);
|
20023 | }, SvgCartesianAxes.darkenZeroLine = function(g) {
|
20024 | g.selectAll("g.tick line").classed("zero-line", !1);
|
20025 | var zeroTick = g.selectAll("g.tick").filter(function(data) {
|
20026 | return 0 === data;
|
20027 | }).node();
|
20028 | zeroTick && d3.select(zeroTick).select("line").classed("zero-line", !0);
|
20029 | }, SvgCartesianAxes.setAxisLabelColor = function(g, fill) {
|
20030 | g.selectAll("g.tick text").style("fill", fill ? fill.solid.color : null);
|
20031 | }, SvgCartesianAxes.AxisPadding = {
|
20032 | left: 10,
|
20033 | right: 10,
|
20034 | top: 0,
|
20035 | bottom: 13
|
20036 | }, SvgCartesianAxes.AxisGraphicsContext = createClassAndSelector("axisGraphicsContext"),
|
20037 | SvgCartesianAxes.TickPaddingRotatedX = 5, SvgCartesianAxes.AxisLabelFontSize = 11,
|
20038 | SvgCartesianAxes.Y2TickSize = -6, SvgCartesianAxes;
|
20039 | }();
|
20040 | visuals.SvgCartesianAxes = SvgCartesianAxes;
|
20041 | var CartesianAxes = function() {
|
20042 | function CartesianAxes(isScrollable, scrollbarWidth, trimOrdinalDataOnOverflow) {
|
20043 | this.scrollbarWidth = scrollbarWidth, this.isScrollable = isScrollable, this.maxMarginFactor = CartesianAxes.MaxMarginFactor,
|
20044 | this.yAxisOrientation = visuals.yAxisPosition.left, this.trimOrdinalDataOnOverflow = trimOrdinalDataOnOverflow;
|
20045 | }
|
20046 | return CartesianAxes.prototype.shouldShowY1OnRight = function() {
|
20047 | return this.yAxisOrientation === visuals.yAxisPosition.right;
|
20048 | }, CartesianAxes.prototype.isYAxisCategorical = function() {
|
20049 | return this.layout && this.layout.axes.y1.isCategoryAxis;
|
20050 | }, CartesianAxes.prototype.hasCategoryAxis = function() {
|
20051 | var axes = this.layout && this.layout.axes;
|
20052 | return axes ? this.isYAxisCategorical() ? axes.y1 && null != axes.y1.axis : axes.x && null != axes.x.axis : !1;
|
20053 | }, CartesianAxes.prototype.hasY2Axis = function() {
|
20054 | return this.layout && null != this.layout.axes.y2;
|
20055 | }, CartesianAxes.prototype.getYAxisOrientation = function() {
|
20056 | return this.yAxisOrientation;
|
20057 | }, CartesianAxes.prototype.setAxisLinesVisibility = function(axisLinesVisibility) {
|
20058 | this.showLinesOnX = EnumExtensions.hasFlag(axisLinesVisibility, 3) || EnumExtensions.hasFlag(axisLinesVisibility, 1),
|
20059 | this.showLinesOnY = EnumExtensions.hasFlag(axisLinesVisibility, 3) || EnumExtensions.hasFlag(axisLinesVisibility, 2);
|
20060 | }, CartesianAxes.prototype.setMaxMarginFactor = function(factor) {
|
20061 | this.maxMarginFactor = factor;
|
20062 | }, CartesianAxes.prototype.update = function(dataViews) {
|
20063 | if (dataViews && dataViews.length > 0) {
|
20064 | var dataViewMetadata = dataViews[0].metadata;
|
20065 | this.categoryAxisProperties = visuals.CartesianHelper.getCategoryAxisProperties(dataViewMetadata),
|
20066 | this.valueAxisProperties = visuals.CartesianHelper.getValueAxisProperties(dataViewMetadata);
|
20067 | }
|
20068 | var axisPosition = this.valueAxisProperties.position;
|
20069 | this.yAxisOrientation = axisPosition ? axisPosition.toString() : visuals.yAxisPosition.left;
|
20070 | }, CartesianAxes.prototype.addWarnings = function(warnings) {
|
20071 | var axes = this.layout && this.layout.axes;
|
20072 | (axes && axes.x && axes.x.hasDisallowedZeroInDomain || axes.y1 && axes.y1.hasDisallowedZeroInDomain || axes.y2 && axes.y2.hasDisallowedZeroInDomain) && warnings.unshift(new visuals.ZeroValueWarning());
|
20073 | }, CartesianAxes.prototype.calculateAxes = function(layers, viewport, margin, playAxisControlLayout, textProperties, scrollbarVisible, existingAxisProperties, hideAxisTitles, ensureXDomain, ensureYDomain) {
|
20074 | var mergeResult, visualOptions = {
|
20075 | viewport: viewport,
|
20076 | margin: margin,
|
20077 | forcedXDomain: [ this.categoryAxisProperties ? this.categoryAxisProperties.start : null, this.categoryAxisProperties ? this.categoryAxisProperties.end : null ],
|
20078 | forceMerge: this.valueAxisProperties && this.valueAxisProperties.secShow === !1,
|
20079 | showCategoryAxisLabel: !1,
|
20080 | showValueAxisLabel: !1,
|
20081 | trimOrdinalDataOnOverflow: this.trimOrdinalDataOnOverflow,
|
20082 | categoryAxisScaleType: this.categoryAxisProperties && null != this.categoryAxisProperties.axisScale ? this.categoryAxisProperties.axisScale : DEFAULT_AXIS_SCALE_TYPE,
|
20083 | valueAxisScaleType: this.valueAxisProperties && null != this.valueAxisProperties.axisScale ? this.valueAxisProperties.axisScale : DEFAULT_AXIS_SCALE_TYPE,
|
20084 | categoryAxisDisplayUnits: this.categoryAxisProperties && null != this.categoryAxisProperties.labelDisplayUnits ? this.categoryAxisProperties.labelDisplayUnits : 0,
|
20085 | valueAxisDisplayUnits: this.valueAxisProperties && null != this.valueAxisProperties.labelDisplayUnits ? this.valueAxisProperties.labelDisplayUnits : 0,
|
20086 | categoryAxisPrecision: this.categoryAxisProperties ? visuals.CartesianHelper.getPrecision(this.categoryAxisProperties.labelPrecision) : null,
|
20087 | valueAxisPrecision: this.valueAxisProperties ? visuals.CartesianHelper.getPrecision(this.valueAxisProperties.labelPrecision) : null,
|
20088 | playAxisControlLayout: playAxisControlLayout,
|
20089 | ensureXDomain: ensureXDomain,
|
20090 | ensureYDomain: ensureYDomain
|
20091 | }, skipMerge = this.valueAxisProperties && this.valueAxisProperties.secShow === !0, yAxisWillMerge = !1;
|
20092 | hasMultipleYAxes(layers) && !skipMerge && (mergeResult = tryMergeYDomains(layers, visualOptions),
|
20093 | yAxisWillMerge = mergeResult.merged, yAxisWillMerge ? visualOptions.forcedYDomain = mergeResult.domain : visualOptions.forcedTickCount = mergeResult.tickCount),
|
20094 | this.valueAxisProperties && (visualOptions.forcedYDomain = visuals.AxisHelper.applyCustomizedDomain([ this.valueAxisProperties.start, this.valueAxisProperties.end ], visualOptions.forcedYDomain));
|
20095 | for (var result, layerNumber = 0, len = layers.length; len > layerNumber; layerNumber++) {
|
20096 | var currentlayer = layers[layerNumber];
|
20097 | 1 !== layerNumber || yAxisWillMerge || (visualOptions.forcedYDomain = this.valueAxisProperties ? [ this.valueAxisProperties.secStart, this.valueAxisProperties.secEnd ] : null,
|
20098 | visualOptions.valueAxisScaleType = this.valueAxisProperties && null != this.valueAxisProperties.secAxisScale ? this.valueAxisProperties.secAxisScale : DEFAULT_AXIS_SCALE_TYPE,
|
20099 | visualOptions.valueAxisDisplayUnits = this.valueAxisProperties && null != this.valueAxisProperties.secLabelDisplayUnits ? this.valueAxisProperties.secLabelDisplayUnits : 0,
|
20100 | visualOptions.valueAxisPrecision = this.valueAxisProperties ? visuals.CartesianHelper.getPrecision(this.valueAxisProperties.secLabelPrecision) : null),
|
20101 | visualOptions.showCategoryAxisLabel = !!this.categoryAxisProperties && !!this.categoryAxisProperties.showAxisTitle,
|
20102 | visualOptions.showValueAxisLabel = shouldShowYAxisLabel(layerNumber, this.valueAxisProperties, yAxisWillMerge);
|
20103 | var axes = currentlayer.calculateAxesProperties(visualOptions);
|
20104 | if (0 === layerNumber) result = {
|
20105 | x: axes[0],
|
20106 | y1: axes[1]
|
20107 | }; else if (axes && !result.y2) if (result.x.usingDefaultDomain || _.isEmpty(result.x.dataDomain)) {
|
20108 | visualOptions.showValueAxisLabel = !!this.valueAxisProperties && !!this.valueAxisProperties.showAxisTitle;
|
20109 | var axes_1 = currentlayer.calculateAxesProperties(visualOptions);
|
20110 | result.x = axes_1[0], result.y1 = axes_1[1];
|
20111 | } else currentlayer.overrideXScale(result.x), yAxisWillMerge || axes[1].usingDefaultDomain || (result.y2 = axes[1]);
|
20112 | if (existingAxisProperties && existingAxisProperties.x) result.x.willLabelsFit = existingAxisProperties.x.willLabelsFit,
|
20113 | result.x.willLabelsWordBreak = existingAxisProperties.x.willLabelsWordBreak; else {
|
20114 | var width = viewport.width - (margin.left + margin.right);
|
20115 | result.x.willLabelsFit = visuals.AxisHelper.LabelLayoutStrategy.willLabelsFit(result.x, width, powerbi.TextMeasurementService.measureSvgTextWidth, textProperties),
|
20116 | result.x.willLabelsWordBreak = !result.x.willLabelsFit && !scrollbarVisible && visuals.AxisHelper.LabelLayoutStrategy.willLabelsWordBreak(result.x, margin, width, powerbi.TextMeasurementService.measureSvgTextWidth, powerbi.TextMeasurementService.estimateSvgTextHeight, powerbi.TextMeasurementService.getTailoredTextOrDefault, textProperties);
|
20117 | }
|
20118 | }
|
20119 | return hideAxisTitles && (result.x.axisLabel = null, result.y1.axisLabel = null,
|
20120 | result.y2 && (result.y2.axisLabel = null)), this.addUnitTypeToAxisLabels(result),
|
20121 | result;
|
20122 | }, CartesianAxes.prototype.negotiateAxes = function(layers, parentViewport, padding, playAxisControlLayout, hideAxisLabels, textProperties, interactivityRightMargin, ensureXDomain, ensureYDomain) {
|
20123 | var margin = powerbi.Prototype.inherit(CartesianAxes.MinimumMargin), viewport = powerbi.Prototype.inherit(parentViewport), leftRightMarginLimit = viewport.width * this.maxMarginFactor, bottomMarginLimit = Math.max(CartesianAxes.MinimumMargin.bottom, Math.ceil(viewport.height * this.maxMarginFactor)), marginLimits = {
|
20124 | left: leftRightMarginLimit,
|
20125 | right: leftRightMarginLimit,
|
20126 | top: 0,
|
20127 | bottom: bottomMarginLimit
|
20128 | }, axes = this.calculateAxes(layers, viewport, margin, playAxisControlLayout, textProperties, !1, null, hideAxisLabels, ensureXDomain, ensureYDomain), renderXAxis = this.shouldRenderAxis(axes.x), renderY1Axis = this.shouldRenderAxis(axes.y1), renderY2Axis = this.shouldRenderAxis(axes.y2, !0), showY1OnRight = this.shouldShowY1OnRight(), plotArea = {
|
20129 | width: viewport.width - (margin.left + margin.right),
|
20130 | height: viewport.height - (margin.top + margin.bottom)
|
20131 | }, isScalar = !1;
|
20132 | _.isEmpty(layers) || layers[0].getVisualCategoryAxisIsScalar && (isScalar = layers[0].getVisualCategoryAxisIsScalar());
|
20133 | var tickLabelMargins = void 0;
|
20134 | tickLabelMargins = visuals.AxisHelper.getTickLabelMargins(plotArea, marginLimits.left, powerbi.TextMeasurementService.measureSvgTextWidth, powerbi.TextMeasurementService.estimateSvgTextHeight, axes, marginLimits.bottom, textProperties, !1, showY1OnRight, renderXAxis, renderY1Axis, renderY2Axis),
|
20135 | margin = this.updateAxisMargins(axes, tickLabelMargins, padding, showY1OnRight, renderY1Axis, renderY2Axis, isScalar ? 0 : interactivityRightMargin);
|
20136 | var previousTickCountY1 = axes.y1 && axes.y1.values.length, previousTickCountY2 = axes.y2 && axes.y2.values.length, previousWillFitX = axes.x && axes.x.willLabelsFit, previousWillBreakX = axes.x && axes.x.willLabelsWordBreak;
|
20137 | axes = this.calculateAxes(layers, viewport, margin, playAxisControlLayout, textProperties, !1, null, hideAxisLabels, ensureXDomain, ensureYDomain),
|
20138 | plotArea.width = viewport.width - (margin.left + margin.right), plotArea.height = viewport.height - (margin.top + margin.bottom);
|
20139 | var preferredPlotArea = this.getPreferredPlotArea(axes, layers, isScalar), rotateXTickLabels90 = !this.willAllCategoriesFitInPlotArea(plotArea, preferredPlotArea), allDone = !(axes.y1 && axes.y1.values.length !== previousTickCountY1 || axes.y2 && axes.y2.values.length !== previousTickCountY2 || axes.x && axes.x.willLabelsFit !== previousWillFitX || axes.x && axes.x.willLabelsWordBreak !== previousWillBreakX || rotateXTickLabels90);
|
20140 | if (this.isXScrollBarVisible = !1, this.isYScrollBarVisible = !1, !allDone) {
|
20141 | tickLabelMargins = visuals.AxisHelper.getTickLabelMargins(plotArea, marginLimits.left, powerbi.TextMeasurementService.measureSvgTextWidth, powerbi.TextMeasurementService.estimateSvgTextHeight, axes, marginLimits.bottom, textProperties, rotateXTickLabels90, showY1OnRight, renderXAxis, renderY1Axis, renderY2Axis),
|
20142 | margin = this.updateAxisMargins(axes, tickLabelMargins, padding, showY1OnRight, renderY1Axis, renderY2Axis, isScalar ? 0 : interactivityRightMargin),
|
20143 | axes = this.calculateAxes(layers, viewport, margin, playAxisControlLayout, textProperties, rotateXTickLabels90, axes, hideAxisLabels, ensureXDomain, ensureYDomain),
|
20144 | plotArea.width = viewport.width - (margin.left + margin.right), plotArea.height = viewport.height - (margin.top + margin.bottom),
|
20145 | preferredPlotArea = this.getPreferredPlotArea(axes, layers, isScalar);
|
20146 | var willScroll = !this.willAllCategoriesFitInPlotArea(plotArea, preferredPlotArea);
|
20147 | willScroll && (this.showLinesOnY && (this.isXScrollBarVisible = !0, plotArea.height -= this.scrollbarWidth,
|
20148 | viewport.height -= this.scrollbarWidth), this.showLinesOnX && (this.isYScrollBarVisible = !0,
|
20149 | plotArea.width -= this.scrollbarWidth, viewport.width -= this.scrollbarWidth), axes = this.calculateAxes(layers, viewport, margin, playAxisControlLayout, textProperties, !0, axes, hideAxisLabels, ensureXDomain, ensureYDomain));
|
20150 | }
|
20151 | var axisLabels = hideAxisLabels ? {
|
20152 | x: null,
|
20153 | y: null,
|
20154 | y2: null
|
20155 | } : {
|
20156 | x: axes.x.axisLabel,
|
20157 | y: axes.y1.axisLabel,
|
20158 | y2: axes.y2 ? axes.y2.axisLabel : null
|
20159 | };
|
20160 | return this.layout = {
|
20161 | axes: axes,
|
20162 | axisLabels: axisLabels,
|
20163 | margin: margin,
|
20164 | marginLimits: marginLimits,
|
20165 | viewport: viewport,
|
20166 | plotArea: plotArea,
|
20167 | preferredPlotArea: preferredPlotArea,
|
20168 | tickLabelMargins: tickLabelMargins,
|
20169 | tickPadding: padding,
|
20170 | rotateXTickLabels90: rotateXTickLabels90
|
20171 | }, this.layout;
|
20172 | }, CartesianAxes.prototype.getPreferredPlotArea = function(axes, layers, isScalar) {
|
20173 | var preferredPlotArea;
|
20174 | if (!isScalar && this.isScrollable && !_.isEmpty(layers) && layers[0].getPreferredPlotArea) {
|
20175 | var categoryThickness = this.showLinesOnY ? axes.x.categoryThickness : axes.y1.categoryThickness, categoryCount = this.showLinesOnY ? axes.x.dataDomain.length : axes.y1.dataDomain.length;
|
20176 | preferredPlotArea = layers[0].getPreferredPlotArea(isScalar, categoryCount, categoryThickness);
|
20177 | }
|
20178 | return preferredPlotArea;
|
20179 | }, CartesianAxes.prototype.willAllCategoriesFitInPlotArea = function(plotArea, preferredPlotArea) {
|
20180 | return this.showLinesOnY && preferredPlotArea && powerbi.Double.greaterWithPrecision(preferredPlotArea.width, plotArea.width) ? !1 : !(this.showLinesOnX && preferredPlotArea && powerbi.Double.greaterWithPrecision(preferredPlotArea.height, plotArea.height));
|
20181 | }, CartesianAxes.prototype.updateAxisMargins = function(axes, tickLabelMargins, padding, showY1OnRight, renderY1Axis, renderY2Axis, interactivityRightMargin) {
|
20182 | var maxY1Padding = showY1OnRight ? tickLabelMargins.yRight : tickLabelMargins.yLeft, maxY2Padding = showY1OnRight ? tickLabelMargins.yLeft : tickLabelMargins.yRight, maxXAxisBottom = tickLabelMargins.xMax;
|
20183 | maxY1Padding += padding.left, (renderY2Axis && !showY1OnRight || showY1OnRight && renderY1Axis) && (maxY2Padding += padding.right),
|
20184 | maxXAxisBottom += padding.bottom;
|
20185 | var axisLabels = {
|
20186 | x: axes.x.axisLabel,
|
20187 | y: axes.y1.axisLabel,
|
20188 | y2: axes.y2 ? axes.y2.axisLabel : null
|
20189 | };
|
20190 | null != axisLabels.x && (maxXAxisBottom += CartesianAxes.XAxisLabelPadding), null != axisLabels.y && (maxY1Padding += CartesianAxes.YAxisLabelPadding),
|
20191 | null != axisLabels.y2 && (maxY2Padding += CartesianAxes.YAxisLabelPadding);
|
20192 | var margin = powerbi.Prototype.inherit(CartesianAxes.MinimumMargin);
|
20193 | return margin.left = showY1OnRight ? maxY2Padding : maxY1Padding, margin.right = showY1OnRight ? maxY1Padding : maxY2Padding,
|
20194 | margin.right += interactivityRightMargin, margin.bottom = maxXAxisBottom, margin;
|
20195 | }, CartesianAxes.prototype.isLogScaleAllowed = function(axisType) {
|
20196 | var axes = this.layout && this.layout.axes;
|
20197 | if (!axes) return !1;
|
20198 | switch (axisType) {
|
20199 | case 0:
|
20200 | return axes.x.isLogScaleAllowed;
|
20201 |
|
20202 | case 1:
|
20203 | return axes.y1.isLogScaleAllowed;
|
20204 |
|
20205 | case 2:
|
20206 | return axes.y2 && axes.y2.isLogScaleAllowed;
|
20207 | }
|
20208 | }, CartesianAxes.prototype.axesHaveTicks = function(viewport) {
|
20209 | if (!this.layout) return !1;
|
20210 | var margin = this.layout.margin, width = viewport.width - (margin.left + margin.right), height = viewport.height - (margin.top + margin.bottom);
|
20211 | return 0 !== visuals.AxisHelper.getRecommendedNumberOfTicksForXAxis(width) || 0 !== visuals.AxisHelper.getRecommendedNumberOfTicksForYAxis(height);
|
20212 | }, CartesianAxes.prototype.shouldRenderAxisTitle = function(axisProperties, defaultValue, secondary) {
|
20213 | var propertyName = secondary ? "secShowAxisTitle" : "showAxisTitle";
|
20214 | return !!this.getAxisProperty(axisProperties, propertyName, defaultValue);
|
20215 | }, CartesianAxes.prototype.shouldRenderAxis = function(axisProperties, secondary) {
|
20216 | if (void 0 === secondary && (secondary = !1), !axisProperties) return !1;
|
20217 | var propertyName = secondary ? "secShow" : "show";
|
20218 | return this.getAxisProperty(axisProperties, propertyName, !0) && axisProperties.values && axisProperties.values.length > 0;
|
20219 | }, CartesianAxes.prototype.getAxisProperty = function(axisProperties, propertyName, defaultValue) {
|
20220 | if (!axisProperties) return defaultValue;
|
20221 | var properties = axisProperties.isCategoryAxis ? this.categoryAxisProperties : this.valueAxisProperties;
|
20222 | return properties && null != properties[propertyName] ? properties[propertyName] : defaultValue;
|
20223 | }, CartesianAxes.prototype.addUnitTypeToAxisLabels = function(axes) {
|
20224 | var unitType = CartesianAxes.getUnitType(axes.x.formatter);
|
20225 | if (axes.x.isCategoryAxis ? this.categoryAxisHasUnitType = null != unitType : this.valueAxisHasUnitType = null != unitType,
|
20226 | axes.x.axisLabel && unitType && (axes.x.isCategoryAxis ? axes.x.axisLabel = visuals.AxisHelper.createAxisLabel(this.categoryAxisProperties, axes.x.axisLabel, unitType) : axes.x.axisLabel = visuals.AxisHelper.createAxisLabel(this.valueAxisProperties, axes.x.axisLabel, unitType)),
|
20227 | unitType = CartesianAxes.getUnitType(axes.y1.formatter), axes.y1.isCategoryAxis ? this.categoryAxisHasUnitType = null != unitType : this.valueAxisHasUnitType = null != unitType,
|
20228 | axes.y1.axisLabel && unitType && (axes.y1.isCategoryAxis ? axes.y1.axisLabel = visuals.AxisHelper.createAxisLabel(this.categoryAxisProperties, axes.y1.axisLabel, unitType) : axes.y1.axisLabel = visuals.AxisHelper.createAxisLabel(this.valueAxisProperties, axes.y1.axisLabel, unitType)),
|
20229 | axes.y2) {
|
20230 | var unitType_1 = CartesianAxes.getUnitType(axes.y2.formatter);
|
20231 | this.secondaryValueAxisHasUnitType = null != unitType_1, axes.y2.axisLabel && unitType_1 && (axes.y2.axisLabel = visuals.AxisHelper.createAxisLabel(this.valueAxisProperties, axes.y2.axisLabel, unitType_1, !0));
|
20232 | }
|
20233 | }, CartesianAxes.getUnitType = function(formatter) {
|
20234 | return formatter && formatter.displayUnit && formatter.displayUnit.value > 1 ? formatter.displayUnit.title : void 0;
|
20235 | }, CartesianAxes.YAxisLabelPadding = 20, CartesianAxes.XAxisLabelPadding = 18, CartesianAxes.MaxMarginFactor = .25,
|
20236 | CartesianAxes.MinimumMargin = {
|
20237 | left: 1,
|
20238 | right: 1,
|
20239 | top: 8,
|
20240 | bottom: 25
|
20241 | }, CartesianAxes;
|
20242 | }();
|
20243 | visuals.CartesianAxes = CartesianAxes;
|
20244 | var CartesianLayerFactory;
|
20245 | !function(CartesianLayerFactory) {
|
20246 | function createLayers(type, objects, interactivityService, animator, isScrollable, tooltipsEnabled, tooltipBucketEnabled, advancedLineLabelsEnabled, cartesianLoadMoreEnabled) {
|
20247 | void 0 === isScrollable && (isScrollable = !1);
|
20248 | var layers = [], cartesianOptions = {
|
20249 | isScrollable: isScrollable,
|
20250 | animator: animator,
|
20251 | interactivityService: interactivityService,
|
20252 | tooltipsEnabled: tooltipsEnabled,
|
20253 | tooltipBucketEnabled: tooltipBucketEnabled,
|
20254 | advancedLineLabelsEnabled: advancedLineLabelsEnabled,
|
20255 | cartesianLoadMoreEnabled: cartesianLoadMoreEnabled
|
20256 | };
|
20257 | switch (type) {
|
20258 | case 1:
|
20259 | layers.push(createLineChartLayer(2, !1, cartesianOptions));
|
20260 | break;
|
20261 |
|
20262 | case 0:
|
20263 | layers.push(createLineChartLayer(1, !1, cartesianOptions));
|
20264 | break;
|
20265 |
|
20266 | case 2:
|
20267 | layers.push(createLineChartLayer(16, !1, cartesianOptions));
|
20268 | break;
|
20269 |
|
20270 | case 9:
|
20271 | layers.push(createScatterChartLayer(cartesianOptions));
|
20272 | break;
|
20273 |
|
20274 | case 12:
|
20275 | layers.push(createWaterfallChartLayer(cartesianOptions));
|
20276 | break;
|
20277 |
|
20278 | case 11:
|
20279 | layers.push(createDataDotChartLayer(cartesianOptions));
|
20280 | break;
|
20281 |
|
20282 | case 4:
|
20283 | layers.push(createColumnChartLayer(visuals.ColumnChartType.stackedColumn, cartesianOptions));
|
20284 | break;
|
20285 |
|
20286 | case 3:
|
20287 | layers.push(createColumnChartLayer(visuals.ColumnChartType.clusteredColumn, cartesianOptions));
|
20288 | break;
|
20289 |
|
20290 | case 8:
|
20291 | layers.push(createColumnChartLayer(visuals.ColumnChartType.hundredPercentStackedColumn, cartesianOptions));
|
20292 | break;
|
20293 |
|
20294 | case 6:
|
20295 | layers.push(createColumnChartLayer(visuals.ColumnChartType.stackedBar, cartesianOptions));
|
20296 | break;
|
20297 |
|
20298 | case 5:
|
20299 | layers.push(createColumnChartLayer(visuals.ColumnChartType.clusteredBar, cartesianOptions));
|
20300 | break;
|
20301 |
|
20302 | case 7:
|
20303 | layers.push(createColumnChartLayer(visuals.ColumnChartType.hundredPercentStackedBar, cartesianOptions));
|
20304 | break;
|
20305 |
|
20306 | case 10:
|
20307 | var columnType = getComboColumnType();
|
20308 | layers.push(createColumnChartLayer(columnType, cartesianOptions)), layers.push(createLineChartLayer(1, !0, cartesianOptions));
|
20309 | break;
|
20310 |
|
20311 | case 13:
|
20312 | layers.push(createColumnChartLayer(visuals.ColumnChartType.clusteredColumn, cartesianOptions)),
|
20313 | layers.push(createLineChartLayer(1, !0, cartesianOptions));
|
20314 | break;
|
20315 |
|
20316 | case 14:
|
20317 | layers.push(createColumnChartLayer(visuals.ColumnChartType.stackedColumn, cartesianOptions)),
|
20318 | layers.push(createLineChartLayer(1, !0, cartesianOptions));
|
20319 | break;
|
20320 |
|
20321 | case 15:
|
20322 | layers.push(createColumnChartLayer(visuals.ColumnChartType.clusteredColumn, cartesianOptions)),
|
20323 | layers.push(createDataDotChartLayer(cartesianOptions));
|
20324 | break;
|
20325 |
|
20326 | case 16:
|
20327 | layers.push(createColumnChartLayer(visuals.ColumnChartType.stackedColumn, cartesianOptions)),
|
20328 | layers.push(createDataDotChartLayer(cartesianOptions));
|
20329 | }
|
20330 | return layers;
|
20331 | }
|
20332 | function createLineChartLayer(type, inComboChart, defaultOptions, isTrendLayer) {
|
20333 | var options = {
|
20334 | animator: defaultOptions.animator,
|
20335 | interactivityService: defaultOptions.interactivityService,
|
20336 | isScrollable: defaultOptions.isScrollable,
|
20337 | tooltipsEnabled: !isTrendLayer && defaultOptions.tooltipsEnabled,
|
20338 | tooltipBucketEnabled: defaultOptions.tooltipBucketEnabled,
|
20339 | chartType: type,
|
20340 | advancedLineLabelsEnabled: defaultOptions.advancedLineLabelsEnabled,
|
20341 | cartesianLoadMoreEnabled: defaultOptions.cartesianLoadMoreEnabled
|
20342 | };
|
20343 | return inComboChart && (options.chartType = 8 | options.chartType), new visuals.LineChart(options);
|
20344 | }
|
20345 | function createScatterChartLayer(defaultOptions) {
|
20346 | return defaultOptions.isScrollable = !1, new visuals.ScatterChart(defaultOptions);
|
20347 | }
|
20348 | function createWaterfallChartLayer(defaultOptions) {
|
20349 | return new visuals.WaterfallChart(defaultOptions);
|
20350 | }
|
20351 | function createDataDotChartLayer(defaultOptions) {
|
20352 | return new visuals.DataDotChart(defaultOptions);
|
20353 | }
|
20354 | function createColumnChartLayer(type, defaultOptions) {
|
20355 | var options = {
|
20356 | animator: defaultOptions.animator,
|
20357 | interactivityService: defaultOptions.interactivityService,
|
20358 | isScrollable: defaultOptions.isScrollable,
|
20359 | tooltipsEnabled: defaultOptions.tooltipsEnabled,
|
20360 | tooltipBucketEnabled: defaultOptions.tooltipBucketEnabled,
|
20361 | cartesianLoadMoreEnabled: defaultOptions.cartesianLoadMoreEnabled,
|
20362 | chartType: type
|
20363 | };
|
20364 | return new visuals.ColumnChart(options);
|
20365 | }
|
20366 | function getComboColumnType(objects) {
|
20367 | var columnType = visuals.ColumnChartType.clusteredColumn;
|
20368 | if (objects) {
|
20369 | var comboChartTypes = objects.general;
|
20370 | if (comboChartTypes) {
|
20371 | switch (comboChartTypes.visualType1) {
|
20372 | case "Column":
|
20373 | columnType = visuals.ColumnChartType.clusteredColumn;
|
20374 | break;
|
20375 |
|
20376 | case "ColumnStacked":
|
20377 | columnType = visuals.ColumnChartType.stackedColumn;
|
20378 | }
|
20379 | comboChartTypes.visualType2;
|
20380 | }
|
20381 | }
|
20382 | return columnType;
|
20383 | }
|
20384 | CartesianLayerFactory.createLayers = createLayers;
|
20385 | }(CartesianLayerFactory || (CartesianLayerFactory = {}));
|
20386 | var SharedColorPalette = function() {
|
20387 | function SharedColorPalette(palette) {
|
20388 | this.palette = palette, this.clearPreferredScale();
|
20389 | }
|
20390 | return SharedColorPalette.prototype.getColorScaleByKey = function(scaleKey) {
|
20391 | return this.setPreferredScale(scaleKey), this.preferredScale;
|
20392 | }, SharedColorPalette.prototype.getNewColorScale = function() {
|
20393 | return this.preferredScale;
|
20394 | }, SharedColorPalette.prototype.getColorByIndex = function(index) {
|
20395 | return this.palette.getColorByIndex(index);
|
20396 | }, SharedColorPalette.prototype.getSentimentColors = function() {
|
20397 | return this.palette.getSentimentColors();
|
20398 | }, SharedColorPalette.prototype.getBasePickerColors = function() {
|
20399 | return this.palette.getBasePickerColors();
|
20400 | }, SharedColorPalette.prototype.clearPreferredScale = function() {
|
20401 | this.preferredScale = this.palette.getNewColorScale(), this.rotated = !1;
|
20402 | }, SharedColorPalette.prototype.rotateScale = function() {
|
20403 | this.preferredScale = this.preferredScale.clone(), this.preferredScale.clearAndRotateScale(),
|
20404 | this.rotated = !0;
|
20405 | }, SharedColorPalette.prototype.setPreferredScale = function(scaleKey) {
|
20406 | this.rotated || (this.preferredScale = this.palette.getColorScaleByKey(scaleKey));
|
20407 | }, SharedColorPalette;
|
20408 | }();
|
20409 | visuals.SharedColorPalette = SharedColorPalette;
|
20410 | var CartesianLoadMoreDataHandler = function() {
|
20411 | function CartesianLoadMoreDataHandler(scale, loadMoreCallback, loadMoreThreshold) {
|
20412 | void 0 === loadMoreThreshold && (loadMoreThreshold = 0), this.loadMoreThreshold = loadMoreThreshold,
|
20413 | this.loadMoreCallback = loadMoreCallback, this.setScale(scale);
|
20414 | }
|
20415 | return CartesianLoadMoreDataHandler.prototype.setScale = function(scale) {
|
20416 | scale && (this.loadMoreThresholdIndex = scale.domain().length - 1 - this.loadMoreThreshold);
|
20417 | }, CartesianLoadMoreDataHandler.prototype.isLoadingMoreData = function() {
|
20418 | return this.loadingMoreData;
|
20419 | }, CartesianLoadMoreDataHandler.prototype.onLoadMoreDataCompleted = function() {
|
20420 | this.loadingMoreData = !1;
|
20421 | }, CartesianLoadMoreDataHandler.prototype.shouldLoadMoreData = function() {
|
20422 | var viewportDataRange = this.viewportDataRange;
|
20423 | return !viewportDataRange || this.isLoadingMoreData() ? !1 : viewportDataRange.endIndex >= this.loadMoreThresholdIndex;
|
20424 | }, CartesianLoadMoreDataHandler.prototype.loadMoreData = function() {
|
20425 | this.isLoadingMoreData() || (this.loadingMoreData = !0, this.loadMoreCallback());
|
20426 | }, CartesianLoadMoreDataHandler;
|
20427 | }();
|
20428 | visuals.CartesianLoadMoreDataHandler = CartesianLoadMoreDataHandler;
|
20429 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
20430 | }(powerbi || (powerbi = {}));
|
20431 | }, function(module, exports) {
|
20432 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
20433 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
20434 | !function(powerbi) {
|
20435 | var visuals;
|
20436 | !function(visuals) {
|
20437 | var EnumExtensions = jsCommon.EnumExtensions, DataRoleHelper = powerbi.data.DataRoleHelper, flagBar = 2, flagColumn = 4, flagClustered = 8, flagStacked = 16, flagStacked100 = 32 | flagStacked;
|
20438 | !function(ColumnChartType) {
|
20439 | ColumnChartType[ColumnChartType.clusteredBar = flagBar | flagClustered] = "clusteredBar",
|
20440 | ColumnChartType[ColumnChartType.clusteredColumn = flagColumn | flagClustered] = "clusteredColumn",
|
20441 | ColumnChartType[ColumnChartType.hundredPercentStackedBar = flagBar | flagStacked100] = "hundredPercentStackedBar",
|
20442 | ColumnChartType[ColumnChartType.hundredPercentStackedColumn = flagColumn | flagStacked100] = "hundredPercentStackedColumn",
|
20443 | ColumnChartType[ColumnChartType.stackedBar = flagBar | flagStacked] = "stackedBar",
|
20444 | ColumnChartType[ColumnChartType.stackedColumn = flagColumn | flagStacked] = "stackedColumn";
|
20445 | }(visuals.ColumnChartType || (visuals.ColumnChartType = {}));
|
20446 | var ColumnChartType = visuals.ColumnChartType, RoleNames = {
|
20447 | category: "Category",
|
20448 | series: "Series",
|
20449 | y: "Y"
|
20450 | }, ColumnChart = function() {
|
20451 | function ColumnChart(options) {
|
20452 | var chartType = options.chartType;
|
20453 | this.chartType = chartType, this.categoryAxisType = null, this.animator = options.animator,
|
20454 | this.isScrollable = options.isScrollable, this.tooltipsEnabled = options.tooltipsEnabled,
|
20455 | this.tooltipBucketEnabled = options.tooltipBucketEnabled, this.interactivityService = options.interactivityService;
|
20456 | }
|
20457 | return ColumnChart.customizeQuery = function(options) {
|
20458 | var dataViewMapping = options.dataViewMappings[0];
|
20459 | if (dataViewMapping && dataViewMapping.categorical && dataViewMapping.categorical.categories) if (dataViewMapping.categorical.dataVolume = 4,
|
20460 | visuals.CartesianChart.detectScalarMapping(dataViewMapping)) {
|
20461 | var dataViewCategories = dataViewMapping.categorical.categories;
|
20462 | dataViewCategories.dataReductionAlgorithm = {
|
20463 | sample: {}
|
20464 | };
|
20465 | } else visuals.CartesianChart.applyLoadMoreEnabledToMapping(options.cartesianLoadMoreEnabled, dataViewMapping);
|
20466 | }, ColumnChart.getSortableRoles = function(options) {
|
20467 | var dataViewMapping = options.dataViewMappings[0];
|
20468 | if (!dataViewMapping || !dataViewMapping.categorical || !dataViewMapping.categorical.categories) return null;
|
20469 | var dataViewCategories = dataViewMapping.categorical.categories, categoryItems = dataViewCategories["for"]["in"].items;
|
20470 | if (!_.isEmpty(categoryItems)) {
|
20471 | var categoryType = categoryItems[0].type, objects = void 0;
|
20472 | if (dataViewMapping.metadata && (objects = dataViewMapping.metadata.objects), !visuals.CartesianChart.getIsScalar(objects, visuals.columnChartProps.categoryAxis.axisType, categoryType)) return [ "Category", "Y" ];
|
20473 | }
|
20474 | return null;
|
20475 | }, ColumnChart.prototype.updateVisualMetadata = function(x, y, margin) {
|
20476 | this.xAxisProperties = x, this.yAxisProperties = y, this.margin = margin;
|
20477 | }, ColumnChart.prototype.init = function(options) {
|
20478 | this.svg = options.svg, this.svg.classed(ColumnChart.ColumnChartClassName, !0),
|
20479 | this.unclippedGraphicsContext = this.svg.append("g").classed("columnChartUnclippedGraphicsContext", !0),
|
20480 | this.mainGraphicsContext = this.unclippedGraphicsContext.append("svg").classed("mainGraphicsContext", !0),
|
20481 | this.style = options.style, this.currentViewport = options.viewport, this.hostService = options.host,
|
20482 | this.interactivity = options.interactivity, this.colors = this.style.colorPalette.dataColors,
|
20483 | this.cartesianVisualHost = options.cartesianHost, this.options = options, this.isComboChart = visuals.ComboChart.isComboChart(options.chartType),
|
20484 | this.element = options.element;
|
20485 | }, ColumnChart.prototype.getCategoryLayout = function(numCategoryValues, options) {
|
20486 | var availableWidth;
|
20487 | availableWidth = ColumnChart.isBar(this.chartType) ? this.currentViewport.height - (this.margin.top + this.margin.bottom) : this.currentViewport.width - (this.margin.left + this.margin.right);
|
20488 | var metaDataColumn = this.data ? this.data.categoryMetadata : void 0, categoryDataType = visuals.AxisHelper.getCategoryValueType(metaDataColumn), isScalar = this.data ? this.data.scalarCategoryAxis : !1, domain = visuals.AxisHelper.createDomain(this.data.series, categoryDataType, isScalar, options.forcedXDomain, options.ensureXDomain);
|
20489 | return visuals.CartesianChart.getLayout(this.data, {
|
20490 | availableWidth: availableWidth,
|
20491 | categoryCount: numCategoryValues,
|
20492 | domain: domain,
|
20493 | isScalar: isScalar,
|
20494 | isScrollable: this.isScrollable,
|
20495 | trimOrdinalDataOnOverflow: options.trimOrdinalDataOnOverflow
|
20496 | });
|
20497 | }, ColumnChart.converter = function(dataView, colors, is100PercentStacked, isScalar, dataViewMetadata, chartType, interactivityService, tooltipsEnabled, tooltipBucketEnabled) {
|
20498 | void 0 === is100PercentStacked && (is100PercentStacked = !1), void 0 === isScalar && (isScalar = !1),
|
20499 | void 0 === dataViewMetadata && (dataViewMetadata = null), void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
20500 | var xAxisCardProperties = visuals.CartesianHelper.getCategoryAxisProperties(dataViewMetadata), valueAxisProperties = visuals.CartesianHelper.getValueAxisProperties(dataViewMetadata);
|
20501 | isScalar = visuals.CartesianHelper.isScalar(isScalar, xAxisCardProperties);
|
20502 | var dataViewCat = visuals.ColumnUtil.applyUserMinMax(isScalar, dataView.categorical, xAxisCardProperties), converterStrategy = new ColumnChartConverterHelper(dataView), categoryInfo = visuals.converterHelper.getPivotedCategories(dataViewCat, visuals.columnChartProps.general.formatString), categories = categoryInfo.categories, categoryFormatter = categoryInfo.categoryFormatter, categoryIdentities = categoryInfo.categoryIdentities, categoryMetadata = dataViewCat && dataViewCat.categories && dataViewCat.categories.length > 0 ? dataViewCat.categories[0].source : void 0, labelSettings = visuals.dataLabelUtils.getDefaultColumnLabelSettings(is100PercentStacked || ColumnChart.isStacked(chartType)), defaultLegendLabelColor = visuals.LegendData.DefaultLegendLabelFillColor, defaultDataPointColor = void 0, showAllDataPoints = void 0;
|
20503 | if (dataViewMetadata && dataViewMetadata.objects) {
|
20504 | var objects = dataViewMetadata.objects;
|
20505 | defaultDataPointColor = powerbi.DataViewObjects.getFillColor(objects, visuals.columnChartProps.dataPoint.defaultColor),
|
20506 | showAllDataPoints = powerbi.DataViewObjects.getValue(objects, visuals.columnChartProps.dataPoint.showAllDataPoints),
|
20507 | defaultLegendLabelColor = powerbi.DataViewObjects.getFillColor(objects, visuals.columnChartProps.legend.labelColor, visuals.LegendData.DefaultLegendLabelFillColor);
|
20508 | var labelsObj = objects.labels;
|
20509 | visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(labelsObj, labelSettings);
|
20510 | }
|
20511 | for (var legendAndSeriesInfo = converterStrategy.getLegend(colors, defaultLegendLabelColor, defaultDataPointColor), legend = legendAndSeriesInfo.legend.dataPoints, seriesSources = legendAndSeriesInfo.seriesSources, result = ColumnChart.createDataPoints(dataView, categories, categoryIdentities, legend, legendAndSeriesInfo.seriesObjects, converterStrategy, labelSettings, is100PercentStacked, isScalar, visuals.converterHelper.categoryIsAlsoSeriesRole(dataView, RoleNames.series, RoleNames.category), categoryInfo.categoryObjects, defaultDataPointColor, chartType, categoryMetadata, tooltipsEnabled, tooltipBucketEnabled), columnSeries = result.series, valuesMetadata = [], j = 0, jlen = legend.length; jlen > j; j++) valuesMetadata.push(seriesSources[j]);
|
20512 | var labels = visuals.converterHelper.createAxesLabels(xAxisCardProperties, valueAxisProperties, categoryMetadata, valuesMetadata);
|
20513 | if (!ColumnChart.isColumn(chartType)) {
|
20514 | var temp = labels.xAxisLabel;
|
20515 | labels.xAxisLabel = labels.yAxisLabel, labels.yAxisLabel = temp;
|
20516 | }
|
20517 | if (interactivityService) {
|
20518 | for (var _i = 0, columnSeries_1 = columnSeries; _i < columnSeries_1.length; _i++) {
|
20519 | var series = columnSeries_1[_i];
|
20520 | interactivityService.applySelectionStateToData(series.data);
|
20521 | }
|
20522 | interactivityService.applySelectionStateToData(legendAndSeriesInfo.legend.dataPoints);
|
20523 | }
|
20524 | return {
|
20525 | categories: categories,
|
20526 | categoryFormatter: categoryFormatter,
|
20527 | series: columnSeries,
|
20528 | valuesMetadata: valuesMetadata,
|
20529 | legendData: legendAndSeriesInfo.legend,
|
20530 | hasHighlights: result.hasHighlights,
|
20531 | categoryMetadata: categoryMetadata,
|
20532 | scalarCategoryAxis: isScalar,
|
20533 | labelSettings: labelSettings,
|
20534 | axesLabels: {
|
20535 | x: labels.xAxisLabel,
|
20536 | y: labels.yAxisLabel
|
20537 | },
|
20538 | hasDynamicSeries: result.hasDynamicSeries,
|
20539 | isMultiMeasure: result.isMultiMeasure,
|
20540 | defaultDataPointColor: defaultDataPointColor,
|
20541 | showAllDataPoints: showAllDataPoints
|
20542 | };
|
20543 | }, ColumnChart.canSupportOverflow = function(chartType, seriesCount) {
|
20544 | return !ColumnChart.isStacked(chartType) || 1 === seriesCount;
|
20545 | }, ColumnChart.createDataPoints = function(dataView, categories, categoryIdentities, legend, seriesObjectsList, converterStrategy, defaultLabelSettings, is100PercentStacked, isScalar, isCategoryAlsoSeries, categoryObjectsList, defaultDataPointColor, chartType, categoryMetadata, tooltipsEnabled, tooltipBucketEnabled) {
|
20546 | void 0 === is100PercentStacked && (is100PercentStacked = !1), void 0 === isScalar && (isScalar = !1);
|
20547 | var dataViewCat = dataView.categorical, reader = powerbi.data.createIDataViewCategoricalReader(dataView), grouped = dataViewCat && dataViewCat.values ? dataViewCat.values.grouped() : void 0, categoryCount = categories.length, seriesCount = reader.hasValues("Y") ? reader.getSeriesCount("Y") : void 0, columnSeries = [];
|
20548 | if (1 > seriesCount || 1 > categoryCount) return {
|
20549 | series: columnSeries,
|
20550 | hasHighlights: !1,
|
20551 | hasDynamicSeries: !1,
|
20552 | isMultiMeasure: !1
|
20553 | };
|
20554 | var dvCategories = dataViewCat.categories;
|
20555 | categoryMetadata = _.isEmpty(dvCategories) ? null : dvCategories[0].source;
|
20556 | for (var categoryType = visuals.AxisHelper.getCategoryValueType(categoryMetadata), isDateTime = visuals.AxisHelper.isDateTime(categoryType), baseValuesPos = [], baseValuesNeg = [], rawValues = [], rawHighlightValues = [], hasDynamicSeries = !(!dataViewCat.values || !dataViewCat.values.source), isMultiMeasure = !hasDynamicSeries && seriesCount > 1, highlightsOverflow = !1, hasHighlights = converterStrategy.hasHighlightValues(0), seriesIndex = 0; seriesCount > seriesIndex; seriesIndex++) {
|
20557 | for (var seriesValues = [], seriesHighlightValues = [], categoryIndex = 0; categoryCount > categoryIndex; categoryIndex++) {
|
20558 | var value = converterStrategy.getValueBySeriesAndCategory(seriesIndex, categoryIndex);
|
20559 | if (seriesValues[categoryIndex] = value, hasHighlights) {
|
20560 | var highlightValue = converterStrategy.getHighlightBySeriesAndCategory(seriesIndex, categoryIndex);
|
20561 | seriesHighlightValues[categoryIndex] = highlightValue, value >= 0 && highlightValue >= 0 && value >= highlightValue || 0 >= value && 0 >= highlightValue && highlightValue >= value || (highlightsOverflow = !0);
|
20562 | }
|
20563 | }
|
20564 | rawValues.push(seriesValues), hasHighlights && rawHighlightValues.push(seriesHighlightValues);
|
20565 | }
|
20566 | highlightsOverflow && !ColumnChart.canSupportOverflow(chartType, seriesCount) && (highlightsOverflow = !1,
|
20567 | hasHighlights = !1, rawValues = rawHighlightValues);
|
20568 | for (var dataPointObjects = categoryObjectsList, formatStringProp = visuals.columnChartProps.general.formatString, seriesIndex = 0; seriesCount > seriesIndex; seriesIndex++) {
|
20569 | var seriesDataPoints = [], legendItem = legend[seriesIndex], seriesLabelSettings = void 0;
|
20570 | if (!hasDynamicSeries) {
|
20571 | var labelsSeriesGroup = !_.isEmpty(grouped) && grouped[0].values ? grouped[0].values[seriesIndex] : null, labelObjects = labelsSeriesGroup && labelsSeriesGroup.source && labelsSeriesGroup.source.objects ? labelsSeriesGroup.source.objects.labels : null;
|
20572 | labelObjects && (seriesLabelSettings = powerbi.Prototype.inherit(defaultLabelSettings),
|
20573 | visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(labelObjects, seriesLabelSettings));
|
20574 | }
|
20575 | columnSeries.push({
|
20576 | displayName: legendItem.label,
|
20577 | key: "series" + seriesIndex,
|
20578 | index: seriesIndex,
|
20579 | data: seriesDataPoints,
|
20580 | identity: legendItem.identity,
|
20581 | color: legendItem.color,
|
20582 | labelSettings: seriesLabelSettings
|
20583 | }), seriesCount > 1 && (dataPointObjects = seriesObjectsList[seriesIndex]);
|
20584 | for (var valueColumnMetadata = reader.getValueMetadataColumn("Y", seriesIndex), gradientMeasureIndex = visuals.GradientUtils.getGradientMeasureIndex(dataViewCat), gradientValueColumn = visuals.GradientUtils.getGradientValueColumn(dataViewCat), valueMeasureIndex = DataRoleHelper.getMeasureIndexOfRole(grouped, "Y"), pctFormatString = visuals.valueFormatter.getLocalizedString("Percentage"), categoryIndex = 0; categoryCount > categoryIndex; categoryIndex++) {
|
20585 | 0 === seriesIndex && (baseValuesPos.push(0), baseValuesNeg.push(0));
|
20586 | var value = visuals.AxisHelper.normalizeNonFiniteNumber(rawValues[seriesIndex][categoryIndex]);
|
20587 | if (!(null == value && seriesIndex > 0)) {
|
20588 | var originalValue = value, categoryValue = categories[categoryIndex];
|
20589 | if ((!isDateTime || null == categoryValue || categoryValue instanceof Date) && (isDateTime && categoryValue && (categoryValue = categoryValue.getTime()),
|
20590 | !isScalar || null != categoryValue && !isNaN(categoryValue))) {
|
20591 | var multipliers = void 0;
|
20592 | is100PercentStacked && (multipliers = visuals.StackedUtil.getStackedMultiplier(dataViewCat, categoryIndex, seriesCount, categoryCount, converterStrategy));
|
20593 | var unadjustedValue = value, isNegative = 0 > value;
|
20594 | multipliers && (value *= isNegative ? multipliers.neg : multipliers.pos);
|
20595 | var valueAbsolute = Math.abs(value), position = void 0;
|
20596 | isNegative ? (position = baseValuesNeg[categoryIndex], isNaN(valueAbsolute) || (baseValuesNeg[categoryIndex] -= valueAbsolute)) : (isNaN(valueAbsolute) || (baseValuesPos[categoryIndex] += valueAbsolute),
|
20597 | position = baseValuesPos[categoryIndex]);
|
20598 | var seriesGroup = grouped && grouped.length > seriesIndex && grouped[seriesIndex].values ? grouped[seriesIndex].values[valueMeasureIndex] : null, category = _.isEmpty(dataViewCat.categories) ? null : dataViewCat.categories[0], identity = visuals.SelectionIdBuilder.builder().withCategory(category, categoryIndex).withSeries(dataViewCat.values, seriesGroup).withMeasure(converterStrategy.getMeasureNameByIndex(seriesIndex)).createSelectionId(), rawCategoryValue = reader.getCategoryValue("Category", categoryIndex), color = ColumnChart.getDataPointColor(legendItem, categoryIndex, dataPointObjects), gradientColumnForTooltip = 0 === gradientMeasureIndex ? null : gradientValueColumn, valueHighlight = void 0, unadjustedValueHighlight = void 0, absoluteValueHighlight = void 0, highlightValue = void 0, highlightPosition = void 0, highlightIdentity = void 0;
|
20599 | if (hasHighlights) {
|
20600 | valueHighlight = reader.getHighlight("Y", categoryIndex, seriesIndex), unadjustedValueHighlight = valueHighlight;
|
20601 | var highlightedTooltip = !0;
|
20602 | null === valueHighlight && (valueHighlight = 0, highlightedTooltip = !1), is100PercentStacked && (valueHighlight *= multipliers.pos),
|
20603 | absoluteValueHighlight = Math.abs(valueHighlight), highlightPosition = position,
|
20604 | valueHighlight > 0 ? highlightPosition -= valueAbsolute - absoluteValueHighlight : 0 === valueHighlight && value > 0 && (highlightPosition -= valueAbsolute),
|
20605 | highlightIdentity = visuals.SelectionId.createWithHighlight(identity);
|
20606 | var highlightedValueAndPct = void 0, highlightedValueFormat = void 0;
|
20607 | if (highlightedTooltip && null != unadjustedValueHighlight && null != valueHighlight) {
|
20608 | var highlightedPct = visuals.valueFormatter.format(valueHighlight, pctFormatString);
|
20609 | highlightedValueFormat = visuals.converterHelper.formatFromMetadataColumn(unadjustedValueHighlight, valueColumnMetadata, formatStringProp),
|
20610 | highlightedValueAndPct = highlightedValueFormat + " (" + highlightedPct + ")";
|
20611 | }
|
20612 | highlightValue = is100PercentStacked ? highlightedValueAndPct : highlightedValueFormat;
|
20613 | }
|
20614 | var tooltipInfo = void 0;
|
20615 | if (tooltipsEnabled) {
|
20616 | if (tooltipInfo = [], category && tooltipInfo.push({
|
20617 | displayName: reader.getCategoryDisplayName("Category"),
|
20618 | value: visuals.converterHelper.formatFromMetadataColumn(rawCategoryValue, category.source, formatStringProp)
|
20619 | }), hasDynamicSeries && (category && category.source === dataViewCat.values.source || tooltipInfo.push({
|
20620 | displayName: dataViewCat.values.source.displayName,
|
20621 | value: visuals.converterHelper.formatFromMetadataColumn(grouped[seriesIndex].name, dataViewCat.values.source, formatStringProp)
|
20622 | })), null != originalValue) {
|
20623 | var valueString = void 0, formattedOriginalValue = visuals.converterHelper.formatFromMetadataColumn(originalValue, valueColumnMetadata, formatStringProp);
|
20624 | if (is100PercentStacked) {
|
20625 | var originalPct = visuals.valueFormatter.format(valueAbsolute, pctFormatString);
|
20626 | valueString = formattedOriginalValue + " (" + originalPct + ")";
|
20627 | } else valueString = formattedOriginalValue;
|
20628 | tooltipInfo.push({
|
20629 | displayName: valueColumnMetadata.displayName,
|
20630 | value: valueString
|
20631 | });
|
20632 | }
|
20633 | null != highlightValue && tooltipInfo.push({
|
20634 | displayName: visuals.ToolTipComponent.localizationOptions.highlightedValueDisplayName,
|
20635 | value: highlightValue
|
20636 | }), gradientColumnForTooltip && null != gradientColumnForTooltip.values[categoryIndex] && tooltipInfo.push({
|
20637 | displayName: gradientColumnForTooltip.source.displayName,
|
20638 | value: visuals.converterHelper.formatFromMetadataColumn(gradientColumnForTooltip.values[categoryIndex], gradientColumnForTooltip.source, formatStringProp)
|
20639 | }), tooltipBucketEnabled && visuals.TooltipBuilder.addTooltipBucketItem(reader, tooltipInfo, categoryIndex, hasDynamicSeries ? seriesIndex : void 0);
|
20640 | }
|
20641 | var series = columnSeries[seriesIndex], dataPointLabelSettings = series.labelSettings ? series.labelSettings : defaultLabelSettings, labelColor = dataPointLabelSettings.labelColor, lastValue = void 0;
|
20642 | ColumnChart.isStacked(chartType) && (lastValue = this.getStackedLabelColor(isNegative, seriesIndex, seriesCount, categoryIndex, rawValues),
|
20643 | labelColor = lastValue || seriesIndex === seriesCount - 1 && !isNegative ? labelColor : visuals.dataLabelUtils.defaultInsideLabelColor);
|
20644 | var dataPoint = {
|
20645 | categoryValue: categoryValue,
|
20646 | value: value,
|
20647 | position: position,
|
20648 | valueAbsolute: valueAbsolute,
|
20649 | valueOriginal: unadjustedValue,
|
20650 | seriesIndex: seriesIndex,
|
20651 | labelSettings: dataPointLabelSettings,
|
20652 | categoryIndex: categoryIndex,
|
20653 | color: color,
|
20654 | selected: !1,
|
20655 | originalValue: value,
|
20656 | originalPosition: position,
|
20657 | originalValueAbsolute: valueAbsolute,
|
20658 | identity: identity,
|
20659 | key: identity.getKey(),
|
20660 | tooltipInfo: tooltipInfo,
|
20661 | labelFill: labelColor,
|
20662 | labelFormatString: valueColumnMetadata.format,
|
20663 | lastSeries: lastValue,
|
20664 | chartType: chartType
|
20665 | };
|
20666 | if (seriesDataPoints.push(dataPoint), hasHighlights) {
|
20667 | var highlightDataPoint = {
|
20668 | categoryValue: categoryValue,
|
20669 | value: valueHighlight,
|
20670 | position: highlightPosition,
|
20671 | valueAbsolute: absoluteValueHighlight,
|
20672 | valueOriginal: unadjustedValueHighlight,
|
20673 | seriesIndex: seriesIndex,
|
20674 | labelSettings: dataPointLabelSettings,
|
20675 | categoryIndex: categoryIndex,
|
20676 | color: color,
|
20677 | selected: !1,
|
20678 | highlight: !0,
|
20679 | originalValue: value,
|
20680 | originalPosition: position,
|
20681 | originalValueAbsolute: valueAbsolute,
|
20682 | drawThinner: highlightsOverflow,
|
20683 | identity: highlightIdentity,
|
20684 | key: highlightIdentity.getKey(),
|
20685 | tooltipInfo: tooltipInfo,
|
20686 | labelFormatString: valueColumnMetadata.format,
|
20687 | labelFill: labelColor,
|
20688 | lastSeries: lastValue,
|
20689 | chartType: chartType
|
20690 | };
|
20691 | seriesDataPoints.push(highlightDataPoint);
|
20692 | }
|
20693 | }
|
20694 | }
|
20695 | }
|
20696 | }
|
20697 | return {
|
20698 | series: columnSeries,
|
20699 | hasHighlights: hasHighlights,
|
20700 | hasDynamicSeries: hasDynamicSeries,
|
20701 | isMultiMeasure: isMultiMeasure
|
20702 | };
|
20703 | }, ColumnChart.getDataPointColor = function(legendItem, categoryIndex, dataPointObjects) {
|
20704 | if (dataPointObjects) {
|
20705 | var colorOverride = powerbi.DataViewObjects.getFillColor(dataPointObjects[categoryIndex], visuals.columnChartProps.dataPoint.fill);
|
20706 | if (colorOverride) return colorOverride;
|
20707 | }
|
20708 | return legendItem.color;
|
20709 | }, ColumnChart.getStackedLabelColor = function(isNegative, seriesIndex, seriesCount, categoryIndex, rawValues) {
|
20710 | for (var lastValue = !(isNegative && seriesIndex === seriesCount - 1 && 1 !== seriesCount), i = seriesIndex + 1; seriesCount > i; i++) {
|
20711 | var nextValues = visuals.AxisHelper.normalizeNonFiniteNumber(rawValues[i][categoryIndex]);
|
20712 | if (null !== nextValues && ((!isNegative || isNegative && 0 === seriesIndex) && nextValues > 0 || isNegative && 0 !== seriesIndex)) {
|
20713 | lastValue = !1;
|
20714 | break;
|
20715 | }
|
20716 | }
|
20717 | return lastValue;
|
20718 | }, ColumnChart.sliceSeries = function(series, endIndex, startIndex) {
|
20719 | void 0 === startIndex && (startIndex = 0);
|
20720 | var newSeries = [];
|
20721 | if (series && series.length > 0) for (var i = 0, len = series.length; len > i; i++) {
|
20722 | var iNewSeries = newSeries[i] = powerbi.Prototype.inherit(series[i]);
|
20723 | iNewSeries.data = series[i].data.filter(function(d) {
|
20724 | return d.categoryIndex >= startIndex && d.categoryIndex < endIndex;
|
20725 | });
|
20726 | }
|
20727 | return newSeries;
|
20728 | }, ColumnChart.getInteractiveColumnChartDomElement = function(element) {
|
20729 | return element.children("svg").get(0);
|
20730 | }, ColumnChart.prototype.setData = function(dataViews) {
|
20731 | var is100PctStacked = ColumnChart.isStacked100(this.chartType);
|
20732 | if (this.data = {
|
20733 | categories: [],
|
20734 | categoryFormatter: null,
|
20735 | series: [],
|
20736 | valuesMetadata: [],
|
20737 | legendData: null,
|
20738 | hasHighlights: !1,
|
20739 | categoryMetadata: null,
|
20740 | scalarCategoryAxis: !1,
|
20741 | labelSettings: visuals.dataLabelUtils.getDefaultColumnLabelSettings(is100PctStacked || ColumnChart.isStacked(this.chartType)),
|
20742 | axesLabels: {
|
20743 | x: null,
|
20744 | y: null
|
20745 | },
|
20746 | hasDynamicSeries: !1,
|
20747 | defaultDataPointColor: null,
|
20748 | isMultiMeasure: !1
|
20749 | }, dataViews.length > 0) {
|
20750 | var dataView = this.dataView = dataViews[0];
|
20751 | if (dataView && dataView.categorical) {
|
20752 | var dvCategories = dataView.categorical.categories, categoryMetadata = dvCategories && dvCategories.length > 0 ? dvCategories[0].source : null, categoryType = visuals.AxisHelper.getCategoryValueType(categoryMetadata);
|
20753 | this.data = ColumnChart.converter(dataView, this.cartesianVisualHost.getSharedColors(), is100PctStacked, visuals.CartesianChart.getIsScalar(dataView.metadata ? dataView.metadata.objects : null, visuals.columnChartProps.categoryAxis.axisType, categoryType), dataView.metadata, this.chartType, this.interactivityService, this.tooltipsEnabled, this.tooltipBucketEnabled);
|
20754 | }
|
20755 | }
|
20756 | this.setChartStrategy();
|
20757 | }, ColumnChart.prototype.setChartStrategy = function() {
|
20758 | switch (this.chartType) {
|
20759 | case ColumnChartType.clusteredBar:
|
20760 | this.columnChart = new visuals.ClusteredBarChartStrategy();
|
20761 | break;
|
20762 |
|
20763 | case ColumnChartType.clusteredColumn:
|
20764 | this.columnChart = new visuals.ClusteredColumnChartStrategy();
|
20765 | break;
|
20766 |
|
20767 | case ColumnChartType.stackedBar:
|
20768 | case ColumnChartType.hundredPercentStackedBar:
|
20769 | this.columnChart = new visuals.StackedBarChartStrategy();
|
20770 | break;
|
20771 |
|
20772 | case ColumnChartType.stackedColumn:
|
20773 | case ColumnChartType.hundredPercentStackedColumn:
|
20774 | default:
|
20775 | this.columnChart = new visuals.StackedColumnChartStrategy();
|
20776 | }
|
20777 | if (ColumnChart.isStacked(this.chartType) && 1 === this.data.series.length) switch (this.chartType) {
|
20778 | case ColumnChartType.stackedBar:
|
20779 | this.columnChart = new visuals.ClusteredBarChartStrategy();
|
20780 | break;
|
20781 |
|
20782 | case ColumnChartType.stackedColumn:
|
20783 | this.columnChart = new visuals.ClusteredColumnChartStrategy();
|
20784 | }
|
20785 | }, ColumnChart.prototype.calculateLegend = function() {
|
20786 | if (this.interactivity && this.interactivity.isInteractiveLegend) return this.createInteractiveLegendDataPoints(0);
|
20787 | var legendData = this.data ? this.data.legendData : null, legendDataPoints = legendData ? legendData.dataPoints : [];
|
20788 | return _.isEmpty(legendDataPoints) ? null : legendData;
|
20789 | }, ColumnChart.prototype.hasLegend = function() {
|
20790 | return this.data && (this.data.hasDynamicSeries || this.data.series && this.data.series.length > 1);
|
20791 | }, ColumnChart.prototype.enumerateObjectInstances = function(enumeration, options) {
|
20792 | switch (options.objectName) {
|
20793 | case "dataPoint":
|
20794 | this.dataView && !visuals.GradientUtils.hasGradientRole(this.dataView.categorical) && this.enumerateDataPoints(enumeration);
|
20795 | break;
|
20796 |
|
20797 | case "labels":
|
20798 | this.enumerateDataLabels(enumeration);
|
20799 | }
|
20800 | }, ColumnChart.prototype.enumerateDataLabels = function(enumeration) {
|
20801 | var data = this.data, labelSettings = this.data.labelSettings, seriesCount = data.series.length, showLabelPerSeries = !data.hasDynamicSeries && (seriesCount > 1 || !data.categoryMetadata);
|
20802 | if (visuals.dataLabelUtils.enumerateDataLabels(this.getLabelSettingsOptions(enumeration, labelSettings, null, showLabelPerSeries)),
|
20803 | 0 !== seriesCount && showLabelPerSeries && labelSettings.showLabelPerSeries) for (var i = 0; seriesCount > i; i++) {
|
20804 | var series = data.series[i], labelSettings_1 = series.labelSettings ? series.labelSettings : this.data.labelSettings;
|
20805 | enumeration.pushContainer({
|
20806 | displayName: series.displayName
|
20807 | }), visuals.dataLabelUtils.enumerateDataLabels(this.getLabelSettingsOptions(enumeration, labelSettings_1, series)),
|
20808 | enumeration.popContainer();
|
20809 | }
|
20810 | }, ColumnChart.prototype.getLabelSettingsOptions = function(enumeration, labelSettings, series, showAll) {
|
20811 | return {
|
20812 | enumeration: enumeration,
|
20813 | dataLabelsSettings: labelSettings,
|
20814 | show: !0,
|
20815 | displayUnits: !ColumnChart.isStacked100(this.chartType),
|
20816 | precision: !0,
|
20817 | selector: series && series.identity ? series.identity.getSelector() : null,
|
20818 | showAll: showAll,
|
20819 | fontSize: !0
|
20820 | };
|
20821 | }, ColumnChart.prototype.enumerateDataPoints = function(enumeration) {
|
20822 | var data = this.data;
|
20823 | if (data) {
|
20824 | var seriesCount = data.series.length;
|
20825 | if (0 !== seriesCount) if (data.hasDynamicSeries || seriesCount > 1 || !data.categoryMetadata) for (var i = 0; seriesCount > i; i++) {
|
20826 | var series = data.series[i];
|
20827 | enumeration.pushInstance({
|
20828 | objectName: "dataPoint",
|
20829 | displayName: series.displayName,
|
20830 | selector: visuals.ColorHelper.normalizeSelector(series.identity.getSelector()),
|
20831 | properties: {
|
20832 | fill: {
|
20833 | solid: {
|
20834 | color: series.color
|
20835 | }
|
20836 | }
|
20837 | }
|
20838 | });
|
20839 | } else {
|
20840 | var singleSeriesData = data.series[0].data, categoryFormatter = data.categoryFormatter;
|
20841 | if (enumeration.pushInstance({
|
20842 | objectName: "dataPoint",
|
20843 | selector: null,
|
20844 | properties: {
|
20845 | defaultColor: {
|
20846 | solid: {
|
20847 | color: data.defaultDataPointColor || this.colors.getColorByIndex(0).value
|
20848 | }
|
20849 | }
|
20850 | }
|
20851 | }).pushInstance({
|
20852 | objectName: "dataPoint",
|
20853 | selector: null,
|
20854 | properties: {
|
20855 | showAllDataPoints: !!data.showAllDataPoints
|
20856 | }
|
20857 | }), data.showAllDataPoints) for (var i = 0; i < singleSeriesData.length; i++) {
|
20858 | var singleSeriesDataPoints = singleSeriesData[i], categoryValue = data.categories[i];
|
20859 | enumeration.pushInstance({
|
20860 | objectName: "dataPoint",
|
20861 | displayName: categoryFormatter ? categoryFormatter.format(categoryValue) : categoryValue,
|
20862 | selector: visuals.ColorHelper.normalizeSelector(singleSeriesDataPoints.identity.getSelector(), !0),
|
20863 | properties: {
|
20864 | fill: {
|
20865 | solid: {
|
20866 | color: singleSeriesDataPoints.color
|
20867 | }
|
20868 | }
|
20869 | }
|
20870 | });
|
20871 | }
|
20872 | }
|
20873 | }
|
20874 | }, ColumnChart.prototype.calculateAxesProperties = function(options) {
|
20875 | var data = this.data;
|
20876 | this.currentViewport = options.viewport;
|
20877 | var margin = this.margin = options.margin, origCatgSize = data && data.categories ? data.categories.length : 0, chartLayout = data ? this.getCategoryLayout(origCatgSize, options) : {
|
20878 | categoryCount: 0,
|
20879 | categoryThickness: visuals.CartesianChart.MinOrdinalRectThickness,
|
20880 | outerPaddingRatio: visuals.CartesianChart.OuterPaddingRatio,
|
20881 | isScalar: !1
|
20882 | };
|
20883 | if (this.categoryAxisType = chartLayout.isScalar ? visuals.axisType.scalar : null,
|
20884 | data && !chartLayout.isScalar && !this.isScrollable && options.trimOrdinalDataOnOverflow) {
|
20885 | var catgSize = Math.min(origCatgSize, chartLayout.categoryCount);
|
20886 | catgSize !== origCatgSize && (data = powerbi.Prototype.inherit(data), data.series = ColumnChart.sliceSeries(data.series, catgSize),
|
20887 | data.categories = data.categories.slice(0, catgSize));
|
20888 | }
|
20889 | this.columnChart.setData(data);
|
20890 | var preferredPlotArea = this.getPreferredPlotArea(chartLayout.isScalar, chartLayout.categoryCount, chartLayout.categoryThickness), is100Pct = ColumnChart.isStacked100(this.chartType), chartContext = {
|
20891 | height: preferredPlotArea.height,
|
20892 | width: preferredPlotArea.width,
|
20893 | duration: 0,
|
20894 | hostService: this.hostService,
|
20895 | unclippedGraphicsContext: this.unclippedGraphicsContext,
|
20896 | mainGraphicsContext: this.mainGraphicsContext,
|
20897 | margin: this.margin,
|
20898 | layout: chartLayout,
|
20899 | animator: this.animator,
|
20900 | interactivityService: this.interactivityService,
|
20901 | viewportHeight: this.currentViewport.height - (margin.top + margin.bottom),
|
20902 | viewportWidth: this.currentViewport.width - (margin.left + margin.right),
|
20903 | is100Pct: is100Pct,
|
20904 | isComboChart: this.isComboChart
|
20905 | };
|
20906 | this.ApplyInteractivity(chartContext), this.columnChart.setupVisualProps(chartContext);
|
20907 | var ensureXDomain, ensureYDomain, isBarChart = ColumnChart.isBar(this.chartType);
|
20908 | if (isBarChart) {
|
20909 | var temp = options.forcedXDomain;
|
20910 | options.forcedXDomain = options.forcedYDomain, options.forcedYDomain = temp, ensureXDomain = options.ensureYDomain;
|
20911 | } else ensureYDomain = options.ensureYDomain;
|
20912 | return this.xAxisProperties = this.columnChart.setXScale(is100Pct, options.forcedTickCount, options.forcedXDomain, isBarChart ? options.valueAxisScaleType : options.categoryAxisScaleType, isBarChart ? options.valueAxisDisplayUnits : options.categoryAxisDisplayUnits, isBarChart ? options.valueAxisPrecision : options.categoryAxisPrecision, ensureXDomain),
|
20913 | this.yAxisProperties = this.columnChart.setYScale(is100Pct, options.forcedTickCount, options.forcedYDomain, isBarChart ? options.categoryAxisScaleType : options.valueAxisScaleType, isBarChart ? options.categoryAxisDisplayUnits : options.valueAxisDisplayUnits, isBarChart ? options.categoryAxisPrecision : options.valueAxisPrecision, ensureYDomain),
|
20914 | options.showCategoryAxisLabel && this.xAxisProperties.isCategoryAxis || options.showValueAxisLabel && !this.xAxisProperties.isCategoryAxis ? this.xAxisProperties.axisLabel = data.axesLabels.x : this.xAxisProperties.axisLabel = null,
|
20915 | options.showValueAxisLabel && !this.yAxisProperties.isCategoryAxis || options.showCategoryAxisLabel && this.yAxisProperties.isCategoryAxis ? this.yAxisProperties.axisLabel = data.axesLabels.y : this.yAxisProperties.axisLabel = null,
|
20916 | [ this.xAxisProperties, this.yAxisProperties ];
|
20917 | }, ColumnChart.prototype.getPreferredPlotArea = function(isScalar, categoryCount, categoryThickness) {
|
20918 | var plotArea = {
|
20919 | height: this.currentViewport.height - this.margin.top - this.margin.bottom,
|
20920 | width: this.currentViewport.width - this.margin.left - this.margin.right
|
20921 | };
|
20922 | if (this.isScrollable && !isScalar) {
|
20923 | var preferredCategorySpan = visuals.CartesianChart.getPreferredCategorySpan(categoryCount, categoryThickness);
|
20924 | ColumnChart.isBar(this.chartType) ? plotArea.height = Math.max(preferredCategorySpan, plotArea.height) : plotArea.width = Math.max(preferredCategorySpan, plotArea.width);
|
20925 | }
|
20926 | return plotArea;
|
20927 | }, ColumnChart.prototype.ApplyInteractivity = function(chartContext) {
|
20928 | var _this = this, interactivity = this.interactivity;
|
20929 | if (interactivity && (interactivity.dragDataPoint && (chartContext.onDragStart = function(datum) {
|
20930 | datum.identity && _this.hostService.onDragStart({
|
20931 | event: d3.event,
|
20932 | data: {
|
20933 | data: datum.identity.getSelector()
|
20934 | }
|
20935 | });
|
20936 | }), interactivity.isInteractiveLegend)) {
|
20937 | var dragMove = function() {
|
20938 | var mousePoint = d3.mouse(_this.mainGraphicsContext[0][0]), x = mousePoint[0], y = mousePoint[1], index = _this.columnChart.getClosestColumnIndex(x, y);
|
20939 | _this.selectColumn(index);
|
20940 | }, ColumnChartSvg = ColumnChart.getInteractiveColumnChartDomElement(this.element);
|
20941 | this.svg.on("click", dragMove), d3.select(ColumnChartSvg).on("click", dragMove).style("touch-action", "none");
|
20942 | var drag = d3.behavior.drag().origin(Object).on("drag", dragMove);
|
20943 | this.svg.call(drag), d3.select(ColumnChartSvg).call(drag);
|
20944 | }
|
20945 | }, ColumnChart.prototype.selectColumn = function(indexOfColumnSelected, force) {
|
20946 | if (void 0 === force && (force = !1), force || this.lastInteractiveSelectedColumnIndex !== indexOfColumnSelected) {
|
20947 | var legendData = this.createInteractiveLegendDataPoints(indexOfColumnSelected), legendDataPoints = legendData.dataPoints;
|
20948 | this.cartesianVisualHost.updateLegend(legendData), legendDataPoints.length > 0 && this.columnChart.selectColumn(indexOfColumnSelected, this.lastInteractiveSelectedColumnIndex),
|
20949 | this.lastInteractiveSelectedColumnIndex = indexOfColumnSelected;
|
20950 | }
|
20951 | }, ColumnChart.prototype.createInteractiveLegendDataPoints = function(columnIndex) {
|
20952 | var data = this.data;
|
20953 | if (!data || _.isEmpty(data.series)) return {
|
20954 | dataPoints: []
|
20955 | };
|
20956 | for (var formatStringProp = visuals.columnChartProps.general.formatString, legendDataPoints = [], category = data.categories && data.categories[columnIndex], allSeries = data.series, dataPoints = data.legendData && data.legendData.dataPoints, converterStrategy = new ColumnChartConverterHelper(this.dataView), i = 0, len = allSeries.length; len > i; i++) {
|
20957 | var measure = converterStrategy.getValueBySeriesAndCategory(i, columnIndex), valueMetadata = data.valuesMetadata[i], formattedLabel = visuals.converterHelper.getFormattedLegendLabel(valueMetadata, this.dataView.categorical.values, formatStringProp), dataPointColor = void 0;
|
20958 | if (1 === allSeries.length) {
|
20959 | var series = allSeries[0];
|
20960 | dataPointColor = series.data.length > columnIndex && series.data[columnIndex].color;
|
20961 | } else dataPointColor = dataPoints.length > i && dataPoints[i].color;
|
20962 | legendDataPoints.push({
|
20963 | color: dataPointColor,
|
20964 | icon: visuals.LegendIcon.Box,
|
20965 | label: formattedLabel,
|
20966 | category: data.categoryFormatter ? data.categoryFormatter.format(category) : category,
|
20967 | measure: visuals.valueFormatter.format(measure, visuals.valueFormatter.getFormatString(valueMetadata, formatStringProp)),
|
20968 | identity: visuals.SelectionId.createNull(),
|
20969 | selected: !1
|
20970 | });
|
20971 | }
|
20972 | return {
|
20973 | dataPoints: legendDataPoints
|
20974 | };
|
20975 | }, ColumnChart.prototype.overrideXScale = function(xProperties) {
|
20976 | this.xAxisProperties = xProperties;
|
20977 | }, ColumnChart.prototype.render = function(suppressAnimations) {
|
20978 | var columnChartDrawInfo = this.columnChart.drawColumns(!suppressAnimations), data = this.data, margin = this.margin, viewport = this.currentViewport, height = viewport.height - (margin.top + margin.bottom), width = viewport.width - (margin.left + margin.right);
|
20979 | this.mainGraphicsContext.attr("height", height).attr("width", width), this.tooltipsEnabled && visuals.TooltipManager.addTooltip(columnChartDrawInfo.eventGroup, function(tooltipEvent) {
|
20980 | return tooltipEvent.data.tooltipInfo;
|
20981 | });
|
20982 | var allDataPoints = [], behaviorOptions = void 0;
|
20983 | if (this.interactivityService) {
|
20984 | for (var i = 0, ilen = data.series.length; ilen > i; i++) allDataPoints = allDataPoints.concat(data.series[i].data);
|
20985 | behaviorOptions = {
|
20986 | datapoints: allDataPoints,
|
20987 | eventGroup: columnChartDrawInfo.eventGroup,
|
20988 | bars: columnChartDrawInfo.shapesSelection,
|
20989 | hasHighlights: data.hasHighlights,
|
20990 | mainGraphicsContext: this.mainGraphicsContext,
|
20991 | viewport: columnChartDrawInfo.viewport,
|
20992 | axisOptions: columnChartDrawInfo.axisOptions,
|
20993 | showLabel: data.labelSettings.show
|
20994 | };
|
20995 | }
|
20996 | return this.interactivity && this.interactivity.isInteractiveLegend && this.data.series.length > 0 && this.selectColumn(visuals.CartesianHelper.findMaxCategoryIndex(this.data.series), !0),
|
20997 | visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options), {
|
20998 | dataPoints: allDataPoints,
|
20999 | behaviorOptions: behaviorOptions,
|
21000 | labelDataPoints: columnChartDrawInfo.labelDataPoints,
|
21001 | labelsAreNumeric: !0
|
21002 | };
|
21003 | }, ColumnChart.prototype.onClearSelection = function() {
|
21004 | this.interactivityService && this.interactivityService.clearSelection();
|
21005 | }, ColumnChart.prototype.getVisualCategoryAxisIsScalar = function() {
|
21006 | return this.data ? this.data.scalarCategoryAxis : !1;
|
21007 | }, ColumnChart.prototype.getSupportedCategoryAxisType = function() {
|
21008 | var metaDataColumn = this.data ? this.data.categoryMetadata : void 0, valueType = visuals.AxisHelper.getCategoryValueType(metaDataColumn), isOrdinal = visuals.AxisHelper.isOrdinal(valueType);
|
21009 | return isOrdinal ? visuals.axisType.categorical : visuals.axisType.both;
|
21010 | }, ColumnChart.prototype.setFilteredData = function(startIndex, endIndex) {
|
21011 | var data = powerbi.Prototype.inherit(this.data);
|
21012 | return data.series = ColumnChart.sliceSeries(data.series, endIndex, startIndex),
|
21013 | data.categories = data.categories.slice(startIndex, endIndex), this.columnChart.setData(data),
|
21014 | data;
|
21015 | }, ColumnChart.getLabelFill = function(labelColor, isInside, isCombo) {
|
21016 | return labelColor ? labelColor : isInside && !isCombo ? visuals.NewDataLabelUtils.defaultInsideLabelColor : visuals.NewDataLabelUtils.defaultLabelColor;
|
21017 | }, ColumnChart.prototype.supportsTrendLine = function() {
|
21018 | var dataView = this.dataView, reader = powerbi.data.createIDataViewCategoricalReader(dataView), isScalar = this.data ? this.data.scalarCategoryAxis : !1;
|
21019 | return this.chartType === ColumnChartType.clusteredColumn && isScalar && reader.hasValues("Y");
|
21020 | }, ColumnChart.isBar = function(chartType) {
|
21021 | return EnumExtensions.hasFlag(chartType, flagBar);
|
21022 | }, ColumnChart.isColumn = function(chartType) {
|
21023 | return EnumExtensions.hasFlag(chartType, flagColumn);
|
21024 | }, ColumnChart.isClustered = function(chartType) {
|
21025 | return EnumExtensions.hasFlag(chartType, flagClustered);
|
21026 | }, ColumnChart.isStacked = function(chartType) {
|
21027 | return EnumExtensions.hasFlag(chartType, flagStacked);
|
21028 | }, ColumnChart.isStacked100 = function(chartType) {
|
21029 | return EnumExtensions.hasFlag(chartType, flagStacked100);
|
21030 | }, ColumnChart.ColumnChartClassName = "columnChart", ColumnChart.clusteredValidLabelPositions = [ 16, 4, 1, 2 ],
|
21031 | ColumnChart.stackedValidLabelPositions = [ 1, 4, 2 ], ColumnChart.SeriesClasses = jsCommon.CssConstants.createClassAndSelector("series"),
|
21032 | ColumnChart;
|
21033 | }();
|
21034 | visuals.ColumnChart = ColumnChart;
|
21035 | var ColumnChartConverterHelper = function() {
|
21036 | function ColumnChartConverterHelper(dataView) {
|
21037 | this.dataView = dataView && dataView.categorical, this.reader = powerbi.data.createIDataViewCategoricalReader(dataView);
|
21038 | }
|
21039 | return ColumnChartConverterHelper.prototype.getLegend = function(colors, defaultLegendLabelColor, defaultColor) {
|
21040 | var legend = [], seriesSources = [], seriesObjects = [], grouped = !1, colorHelper = new visuals.ColorHelper(colors, visuals.columnChartProps.dataPoint.fill, defaultColor), legendTitle = void 0;
|
21041 | if (this.dataView && this.dataView.values) {
|
21042 | for (var allValues = this.dataView.values, valueGroups = allValues.grouped(), hasDynamicSeries = !(!allValues || !allValues.source), formatStringProp = visuals.columnChartProps.general.formatString, valueGroupsIndex = 0, valueGroupsLen = valueGroups.length; valueGroupsLen > valueGroupsIndex; valueGroupsIndex++) for (var valueGroup = valueGroups[valueGroupsIndex], valueGroupObjects = valueGroup.objects, values = valueGroup.values, valueIndex = 0, valuesLen = values.length; valuesLen > valueIndex; valueIndex++) {
|
21043 | var series = values[valueIndex], source = series.source;
|
21044 | if (!DataRoleHelper.hasRole(source, "Gradient") && !DataRoleHelper.hasRole(source, "Tooltips") || DataRoleHelper.hasRole(source, "Y")) {
|
21045 | seriesSources.push(source), seriesObjects.push(series.objects);
|
21046 | var selectionId = series.identity ? visuals.SelectionId.createWithIdAndMeasure(series.identity, source.queryName) : visuals.SelectionId.createWithMeasure(this.getMeasureNameByIndex(valueIndex)), label = visuals.converterHelper.getFormattedLegendLabel(source, allValues, formatStringProp), color = hasDynamicSeries ? colorHelper.getColorForSeriesValue(valueGroupObjects, allValues.identityFields, source.groupName) : colorHelper.getColorForMeasure(source.objects, source.queryName);
|
21047 | legend.push({
|
21048 | icon: visuals.LegendIcon.Box,
|
21049 | color: color,
|
21050 | label: label,
|
21051 | identity: selectionId,
|
21052 | selected: !1
|
21053 | }), series.identity && void 0 !== source.groupName && (grouped = !0);
|
21054 | }
|
21055 | }
|
21056 | var dvValues = this.dataView.values;
|
21057 | legendTitle = dvValues && dvValues.source ? dvValues.source.displayName : "";
|
21058 | }
|
21059 | var legendData = {
|
21060 | title: legendTitle,
|
21061 | dataPoints: legend,
|
21062 | grouped: grouped,
|
21063 | labelColor: defaultLegendLabelColor
|
21064 | };
|
21065 | return {
|
21066 | legend: legendData,
|
21067 | seriesSources: seriesSources,
|
21068 | seriesObjects: seriesObjects
|
21069 | };
|
21070 | }, ColumnChartConverterHelper.prototype.getValueBySeriesAndCategory = function(series, category) {
|
21071 | return this.reader.getValue("Y", category, series);
|
21072 | }, ColumnChartConverterHelper.prototype.getMeasureNameByIndex = function(index) {
|
21073 | return this.dataView.values[index].source.queryName;
|
21074 | }, ColumnChartConverterHelper.prototype.hasHighlightValues = function(series) {
|
21075 | var column = this.dataView && this.dataView.values ? this.dataView.values[series] : void 0;
|
21076 | return column && !!column.highlights;
|
21077 | }, ColumnChartConverterHelper.prototype.getHighlightBySeriesAndCategory = function(series, category) {
|
21078 | return this.dataView.values[series].highlights[category];
|
21079 | }, ColumnChartConverterHelper;
|
21080 | }();
|
21081 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
21082 | }(powerbi || (powerbi = {}));
|
21083 | }, function(module, exports) {
|
21084 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
21085 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
21086 | !function(powerbi) {
|
21087 | var visuals;
|
21088 | !function(visuals) {
|
21089 | var PixelConverter = jsCommon.PixelConverter, ClusteredColumnChartStrategy = function() {
|
21090 | function ClusteredColumnChartStrategy() {}
|
21091 | return ClusteredColumnChartStrategy.prototype.setupVisualProps = function(columnChartProps) {
|
21092 | this.graphicsContext = columnChartProps, this.margin = columnChartProps.margin,
|
21093 | this.width = this.graphicsContext.width, this.height = this.graphicsContext.height,
|
21094 | this.categoryLayout = columnChartProps.layout, this.animator = columnChartProps.animator,
|
21095 | this.interactivityService = columnChartProps.interactivityService, this.viewportHeight = columnChartProps.viewportHeight,
|
21096 | this.viewportWidth = columnChartProps.viewportWidth, this.isComboChart = columnChartProps.isComboChart;
|
21097 | }, ClusteredColumnChartStrategy.prototype.setData = function(data) {
|
21098 | this.data = data;
|
21099 | }, ClusteredColumnChartStrategy.prototype.setXScale = function(is100Pct, forcedTickCount, forcedXDomain, axisScaleType, axisDisplayUnits, axisPrecision, ensureXDomain) {
|
21100 | var forcedXMin, forcedXMax, width = this.width;
|
21101 | forcedXDomain && 2 === forcedXDomain.length && (forcedXMin = forcedXDomain[0], forcedXMax = forcedXDomain[1]);
|
21102 | var props = this.xProps = visuals.ColumnUtil.getCategoryAxis(this.data, width, this.categoryLayout, !1, forcedXMin, forcedXMax, axisScaleType, axisDisplayUnits, axisPrecision, ensureXDomain), seriesLength = this.data.series.length, columnWidth = this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio) / seriesLength;
|
21103 | return this.seriesOffsetScale = d3.scale.ordinal().domain(this.data.series.map(function(s) {
|
21104 | return s.index;
|
21105 | })).rangeBands([ 0, seriesLength * columnWidth ]), props;
|
21106 | }, ClusteredColumnChartStrategy.prototype.setYScale = function(is100Pct, forcedTickCount, forcedYDomain, axisScaleType, axisDisplayUnits, axisPrecision, ensureYDomain) {
|
21107 | var height = this.viewportHeight, valueDomain = visuals.AxisHelper.createValueDomain(this.data.series, !0) || visuals.emptyDomain, combinedDomain = visuals.AxisHelper.combineDomain(forcedYDomain, valueDomain, ensureYDomain), shouldClamp = visuals.AxisHelper.scaleShouldClamp(combinedDomain, valueDomain);
|
21108 | return this.yProps = visuals.AxisHelper.createAxis({
|
21109 | pixelSpan: height,
|
21110 | dataDomain: combinedDomain,
|
21111 | metaDataColumn: this.data.valuesMetadata[0],
|
21112 | formatString: visuals.valueFormatter.getFormatString(this.data.valuesMetadata[0], visuals.columnChartProps.general.formatString),
|
21113 | outerPadding: 0,
|
21114 | isScalar: !0,
|
21115 | isVertical: !0,
|
21116 | forcedTickCount: forcedTickCount,
|
21117 | useTickIntervalForDisplayUnits: !0,
|
21118 | isCategoryAxis: !1,
|
21119 | scaleType: axisScaleType,
|
21120 | axisDisplayUnits: axisDisplayUnits,
|
21121 | axisPrecision: axisPrecision,
|
21122 | shouldClamp: shouldClamp
|
21123 | }), this.yProps;
|
21124 | }, ClusteredColumnChartStrategy.prototype.drawColumns = function(useAnimation) {
|
21125 | var data = this.data;
|
21126 | this.columnsCenters = null;
|
21127 | var categoryWidth = this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio), columnWidth = categoryWidth / data.series.length, axisOptions = {
|
21128 | columnWidth: columnWidth,
|
21129 | categoryWidth: categoryWidth,
|
21130 | xScale: this.xProps.scale,
|
21131 | yScale: this.yProps.scale,
|
21132 | seriesOffsetScale: this.seriesOffsetScale,
|
21133 | isScalar: this.categoryLayout.isScalar,
|
21134 | margin: this.margin
|
21135 | }, clusteredColumnLayout = this.layout = ClusteredColumnChartStrategy.getLayout(data, axisOptions), dataLabelSettings = data.labelSettings, labelDataPoints = [];
|
21136 | dataLabelSettings && dataLabelSettings.show && (labelDataPoints = this.createLabelDataPoints());
|
21137 | var result, shapes, series = visuals.ColumnUtil.drawSeries(data, this.graphicsContext.mainGraphicsContext, axisOptions);
|
21138 | return this.animator && useAnimation && (result = this.animator.animate({
|
21139 | viewModel: data,
|
21140 | series: series,
|
21141 | layout: clusteredColumnLayout,
|
21142 | itemCS: ClusteredColumnChartStrategy.classes.item,
|
21143 | interactivityService: this.interactivityService,
|
21144 | mainGraphicsContext: this.graphicsContext.mainGraphicsContext,
|
21145 | viewPort: {
|
21146 | height: this.height,
|
21147 | width: this.width
|
21148 | }
|
21149 | }), shapes = result.shapes), this.animator && useAnimation && !result.failed || (shapes = visuals.ColumnUtil.drawDefaultShapes(data, series, clusteredColumnLayout, ClusteredColumnChartStrategy.classes.item, !this.animator, this.interactivityService && this.interactivityService.hasSelection())),
|
21150 | visuals.ColumnUtil.applyInteractivity(shapes, this.graphicsContext.onDragStart),
|
21151 | {
|
21152 | eventGroup: this.graphicsContext.mainGraphicsContext,
|
21153 | shapesSelection: shapes,
|
21154 | viewport: {
|
21155 | height: this.height,
|
21156 | width: this.width
|
21157 | },
|
21158 | axisOptions: axisOptions,
|
21159 | labelDataPoints: labelDataPoints
|
21160 | };
|
21161 | }, ClusteredColumnChartStrategy.prototype.selectColumn = function(selectedColumnIndex, lastSelectedColumnIndex) {
|
21162 | visuals.ColumnUtil.setChosenColumnOpacity(this.graphicsContext.mainGraphicsContext, ClusteredColumnChartStrategy.classes.item.selector, selectedColumnIndex, lastSelectedColumnIndex),
|
21163 | this.moveHandle(selectedColumnIndex);
|
21164 | }, ClusteredColumnChartStrategy.prototype.getClosestColumnIndex = function(x, y) {
|
21165 | return visuals.ColumnUtil.getClosestColumnIndex(x, this.getColumnsCenters());
|
21166 | }, ClusteredColumnChartStrategy.prototype.getColumnsCenters = function() {
|
21167 | var _this = this;
|
21168 | if (!this.columnsCenters) {
|
21169 | var categoryWidth = this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio);
|
21170 | if (this.data.series.length > 0) {
|
21171 | var xScaleOffset_1 = 0;
|
21172 | this.categoryLayout.isScalar || (xScaleOffset_1 = categoryWidth / 2);
|
21173 | var firstSeries = this.data.series[0];
|
21174 | this.columnsCenters = firstSeries.data.map(function(d) {
|
21175 | return _this.xProps.scale(_this.categoryLayout.isScalar ? d.categoryValue : d.categoryIndex) + xScaleOffset_1;
|
21176 | });
|
21177 | }
|
21178 | }
|
21179 | return this.columnsCenters;
|
21180 | }, ClusteredColumnChartStrategy.prototype.moveHandle = function(selectedColumnIndex) {
|
21181 | var columnCenters = this.getColumnsCenters(), x = columnCenters[selectedColumnIndex], hoverLine = d3.select(".interactive-hover-line");
|
21182 | if (hoverLine.empty() || this.columnSelectionLineHandle || (this.columnSelectionLineHandle = d3.select(hoverLine.node().parentNode)),
|
21183 | this.columnSelectionLineHandle) {
|
21184 | var handle = this.columnSelectionLineHandle;
|
21185 | handle.select("line").attr({
|
21186 | x1: x,
|
21187 | x2: x
|
21188 | }), handle.select("circle").attr({
|
21189 | cx: x
|
21190 | });
|
21191 | } else {
|
21192 | var handle = this.columnSelectionLineHandle = this.graphicsContext.unclippedGraphicsContext.append("g");
|
21193 | handle.append("line").classed("interactive-hover-line", !0).attr({
|
21194 | x1: x,
|
21195 | x2: x,
|
21196 | y1: 0,
|
21197 | y2: this.height
|
21198 | }), handle.append("circle").attr({
|
21199 | cx: x,
|
21200 | cy: this.height,
|
21201 | r: "6px"
|
21202 | }).classed("drag-handle", !0);
|
21203 | }
|
21204 | }, ClusteredColumnChartStrategy.getLayout = function(data, axisOptions) {
|
21205 | var columnWidth = axisOptions.columnWidth, halfColumnWidth = .5 * columnWidth, quarterColumnWidth = halfColumnWidth / 2, isScalar = axisOptions.isScalar, xScale = axisOptions.xScale, yScale = axisOptions.yScale, seriesOffsetScale = axisOptions.seriesOffsetScale, scaledY0 = yScale(0), xScaleOffset = 0;
|
21206 | return isScalar && (xScaleOffset = axisOptions.categoryWidth / 2), {
|
21207 | shapeLayout: {
|
21208 | width: function(d) {
|
21209 | return d.drawThinner ? halfColumnWidth : columnWidth;
|
21210 | },
|
21211 | x: function(d) {
|
21212 | return xScale(isScalar ? d.categoryValue : d.categoryIndex) + seriesOffsetScale(d.seriesIndex) - xScaleOffset + (d.drawThinner ? quarterColumnWidth : 0);
|
21213 | },
|
21214 | y: function(d) {
|
21215 | return scaledY0 + visuals.AxisHelper.diffScaled(yScale, Math.max(0, d.value), 0);
|
21216 | },
|
21217 | height: function(d) {
|
21218 | return Math.abs(visuals.AxisHelper.diffScaled(yScale, 0, d.value));
|
21219 | }
|
21220 | },
|
21221 | shapeLayoutWithoutHighlights: {
|
21222 | width: function(d) {
|
21223 | return columnWidth;
|
21224 | },
|
21225 | x: function(d) {
|
21226 | return xScale(isScalar ? d.categoryValue : d.categoryIndex) + seriesOffsetScale(d.seriesIndex) - xScaleOffset;
|
21227 | },
|
21228 | y: function(d) {
|
21229 | return scaledY0 + visuals.AxisHelper.diffScaled(yScale, Math.max(0, d.originalValue), 0);
|
21230 | },
|
21231 | height: function(d) {
|
21232 | return Math.abs(visuals.AxisHelper.diffScaled(yScale, 0, d.originalValue));
|
21233 | }
|
21234 | },
|
21235 | zeroShapeLayout: {
|
21236 | width: function(d) {
|
21237 | return d.drawThinner ? halfColumnWidth : columnWidth;
|
21238 | },
|
21239 | x: function(d) {
|
21240 | return xScale(isScalar ? d.categoryValue : d.categoryIndex) + seriesOffsetScale(d.seriesIndex) - xScaleOffset + (d.drawThinner ? quarterColumnWidth : 0);
|
21241 | },
|
21242 | y: function(d) {
|
21243 | return scaledY0;
|
21244 | },
|
21245 | height: function(d) {
|
21246 | return 0;
|
21247 | }
|
21248 | }
|
21249 | };
|
21250 | }, ClusteredColumnChartStrategy.prototype.createLabelDataPoints = function() {
|
21251 | for (var labelDataPoints = [], data = this.data, series = data.series, formattersCache = visuals.NewDataLabelUtils.createColumnFormatterCacheManager(), shapeLayout = this.layout.shapeLayout, _i = 0, series_1 = series; _i < series_1.length; _i++) {
|
21252 | var currentSeries = series_1[_i], labelSettings = currentSeries.labelSettings ? currentSeries.labelSettings : data.labelSettings;
|
21253 | if (labelSettings.show) for (var axisFormatter = visuals.NewDataLabelUtils.getDisplayUnitValueFromAxisFormatter(this.yProps.formatter, labelSettings), _a = 0, _b = currentSeries.data; _a < _b.length; _a++) {
|
21254 | var dataPoint = _b[_a];
|
21255 | if ((!data.hasHighlights || dataPoint.highlight) && null != dataPoint.value) {
|
21256 | var parentRect = {
|
21257 | left: shapeLayout.x(dataPoint),
|
21258 | top: shapeLayout.y(dataPoint),
|
21259 | width: shapeLayout.width(dataPoint),
|
21260 | height: shapeLayout.height(dataPoint)
|
21261 | }, formatString = dataPoint.labelFormatString, formatter = formattersCache.getOrCreate(formatString, labelSettings, axisFormatter), text = visuals.NewDataLabelUtils.getLabelFormattedText(formatter.format(dataPoint.value)), properties = {
|
21262 | text: text,
|
21263 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
21264 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt),
|
21265 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
21266 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties, !0);
|
21267 | labelDataPoints.push({
|
21268 | isPreferred: !0,
|
21269 | text: text,
|
21270 | textSize: {
|
21271 | width: textWidth,
|
21272 | height: textHeight
|
21273 | },
|
21274 | outsideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !1, this.isComboChart),
|
21275 | insideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !0, this.isComboChart),
|
21276 | parentType: 1,
|
21277 | parentShape: {
|
21278 | rect: parentRect,
|
21279 | orientation: dataPoint.value >= 0 ? 1 : 2,
|
21280 | validPositions: visuals.ColumnChart.clusteredValidLabelPositions
|
21281 | },
|
21282 | identity: dataPoint.identity,
|
21283 | fontSize: labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt
|
21284 | });
|
21285 | }
|
21286 | }
|
21287 | }
|
21288 | return labelDataPoints;
|
21289 | }, ClusteredColumnChartStrategy.classes = {
|
21290 | item: {
|
21291 | "class": "column",
|
21292 | selector: ".column"
|
21293 | }
|
21294 | }, ClusteredColumnChartStrategy;
|
21295 | }();
|
21296 | visuals.ClusteredColumnChartStrategy = ClusteredColumnChartStrategy;
|
21297 | var ClusteredBarChartStrategy = function() {
|
21298 | function ClusteredBarChartStrategy() {}
|
21299 | return ClusteredBarChartStrategy.prototype.setupVisualProps = function(barChartProps) {
|
21300 | this.graphicsContext = barChartProps, this.margin = barChartProps.margin, this.width = this.graphicsContext.width,
|
21301 | this.height = this.graphicsContext.height, this.categoryLayout = barChartProps.layout,
|
21302 | this.animator = barChartProps.animator, this.interactivityService = barChartProps.interactivityService,
|
21303 | this.viewportHeight = barChartProps.viewportHeight, this.viewportWidth = barChartProps.viewportWidth,
|
21304 | this.isComboChart = barChartProps.isComboChart;
|
21305 | }, ClusteredBarChartStrategy.prototype.setData = function(data) {
|
21306 | this.data = data;
|
21307 | }, ClusteredBarChartStrategy.prototype.setYScale = function(is100Pct, forcedTickCount, forcedYDomain, axisScaleType, axisDisplayUnits, axisPrecision, ensureYDomain) {
|
21308 | var forcedYMin, forcedYMax, height = this.height;
|
21309 | forcedYDomain && 2 === forcedYDomain.length && (forcedYMin = forcedYDomain[0], forcedYMax = forcedYDomain[1]);
|
21310 | var props = this.yProps = visuals.ColumnUtil.getCategoryAxis(this.data, height, this.categoryLayout, !0, forcedYMin, forcedYMax, axisScaleType, axisDisplayUnits, axisPrecision, ensureYDomain), seriesLength = this.data.series.length, columnWidth = this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio) / seriesLength;
|
21311 | return this.seriesOffsetScale = d3.scale.ordinal().domain(this.data.series.map(function(s) {
|
21312 | return s.index;
|
21313 | })).rangeBands([ 0, seriesLength * columnWidth ]), props;
|
21314 | }, ClusteredBarChartStrategy.prototype.setXScale = function(is100Pct, forcedTickCount, forcedXDomain, axisScaleType, axisDisplayUnits, axisPrecision, ensureXDomain) {
|
21315 | var width = this.width, valueDomain = visuals.AxisHelper.createValueDomain(this.data.series, !0) || visuals.emptyDomain, combinedDomain = visuals.AxisHelper.combineDomain(forcedXDomain, valueDomain, ensureXDomain), shouldClamp = visuals.AxisHelper.scaleShouldClamp(combinedDomain, valueDomain);
|
21316 | return this.xProps = visuals.AxisHelper.createAxis({
|
21317 | pixelSpan: width,
|
21318 | dataDomain: combinedDomain,
|
21319 | metaDataColumn: this.data.valuesMetadata[0],
|
21320 | formatString: visuals.valueFormatter.getFormatString(this.data.valuesMetadata[0], visuals.columnChartProps.general.formatString),
|
21321 | outerPadding: 0,
|
21322 | isScalar: !0,
|
21323 | isVertical: !1,
|
21324 | forcedTickCount: forcedTickCount,
|
21325 | useTickIntervalForDisplayUnits: !0,
|
21326 | isCategoryAxis: !1,
|
21327 | scaleType: axisScaleType,
|
21328 | axisDisplayUnits: axisDisplayUnits,
|
21329 | axisPrecision: axisPrecision,
|
21330 | shouldClamp: shouldClamp
|
21331 | }), this.xProps.axis.tickSize(-this.viewportHeight, 0), this.xProps;
|
21332 | }, ClusteredBarChartStrategy.prototype.drawColumns = function(useAnimation) {
|
21333 | var data = this.data;
|
21334 | this.barsCenters = null;
|
21335 | var categoryWidth = this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio), columnWidth = categoryWidth / data.series.length, axisOptions = {
|
21336 | columnWidth: columnWidth,
|
21337 | categoryWidth: categoryWidth,
|
21338 | xScale: this.xProps.scale,
|
21339 | yScale: this.yProps.scale,
|
21340 | seriesOffsetScale: this.seriesOffsetScale,
|
21341 | isScalar: this.categoryLayout.isScalar,
|
21342 | margin: this.margin
|
21343 | }, clusteredBarLayout = this.layout = ClusteredBarChartStrategy.getLayout(data, axisOptions), dataLabelSettings = data.labelSettings, labelDataPoints = [];
|
21344 | dataLabelSettings && dataLabelSettings.show && (labelDataPoints = this.createLabelDataPoints());
|
21345 | var result, shapes, series = visuals.ColumnUtil.drawSeries(data, this.graphicsContext.mainGraphicsContext, axisOptions);
|
21346 | return this.animator && useAnimation && (result = this.animator.animate({
|
21347 | viewModel: data,
|
21348 | series: series,
|
21349 | layout: clusteredBarLayout,
|
21350 | itemCS: ClusteredBarChartStrategy.classes.item,
|
21351 | interactivityService: this.interactivityService,
|
21352 | mainGraphicsContext: this.graphicsContext.mainGraphicsContext,
|
21353 | viewPort: {
|
21354 | height: this.height,
|
21355 | width: this.width
|
21356 | }
|
21357 | }), shapes = result.shapes), this.animator && useAnimation && !result.failed || (shapes = visuals.ColumnUtil.drawDefaultShapes(data, series, clusteredBarLayout, ClusteredBarChartStrategy.classes.item, !this.animator, this.interactivityService && this.interactivityService.hasSelection())),
|
21358 | visuals.ColumnUtil.applyInteractivity(shapes, this.graphicsContext.onDragStart),
|
21359 | {
|
21360 | eventGroup: this.graphicsContext.mainGraphicsContext,
|
21361 | shapesSelection: shapes,
|
21362 | viewport: {
|
21363 | height: this.height,
|
21364 | width: this.width
|
21365 | },
|
21366 | axisOptions: axisOptions,
|
21367 | labelDataPoints: labelDataPoints
|
21368 | };
|
21369 | }, ClusteredBarChartStrategy.prototype.selectColumn = function(selectedColumnIndex, lastSelectedColumnIndex) {
|
21370 | visuals.ColumnUtil.setChosenColumnOpacity(this.graphicsContext.mainGraphicsContext, ClusteredBarChartStrategy.classes.item.selector, selectedColumnIndex, lastSelectedColumnIndex),
|
21371 | this.moveHandle(selectedColumnIndex);
|
21372 | }, ClusteredBarChartStrategy.prototype.getClosestColumnIndex = function(x, y) {
|
21373 | return visuals.ColumnUtil.getClosestColumnIndex(y, this.getBarsCenters());
|
21374 | }, ClusteredBarChartStrategy.prototype.getBarsCenters = function() {
|
21375 | var _this = this;
|
21376 | if (!this.barsCenters) {
|
21377 | var barWidth = this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio);
|
21378 | if (this.data.series.length > 0) {
|
21379 | var yScaleOffset_1 = 0;
|
21380 | this.categoryLayout.isScalar || (yScaleOffset_1 = barWidth / 2);
|
21381 | var firstSeries = this.data.series[0];
|
21382 | this.barsCenters = firstSeries.data.map(function(d) {
|
21383 | return _this.yProps.scale(_this.categoryLayout.isScalar ? d.categoryValue : d.categoryIndex) + yScaleOffset_1;
|
21384 | });
|
21385 | }
|
21386 | }
|
21387 | return this.barsCenters;
|
21388 | }, ClusteredBarChartStrategy.prototype.moveHandle = function(selectedColumnIndex) {
|
21389 | var barCenters = this.getBarsCenters(), y = barCenters[selectedColumnIndex], hoverLine = d3.select(".interactive-hover-line");
|
21390 | if (hoverLine.empty() || this.columnSelectionLineHandle || (this.columnSelectionLineHandle = d3.select(hoverLine.node().parentNode)),
|
21391 | this.columnSelectionLineHandle) {
|
21392 | var handle = this.columnSelectionLineHandle;
|
21393 | handle.select("line").attr({
|
21394 | y1: y,
|
21395 | y2: y
|
21396 | }), handle.select("circle").attr({
|
21397 | cy: y
|
21398 | });
|
21399 | } else {
|
21400 | var handle = this.columnSelectionLineHandle = this.graphicsContext.unclippedGraphicsContext.append("g");
|
21401 | handle.append("line").classed("interactive-hover-line", !0).attr({
|
21402 | x1: 0,
|
21403 | x2: this.width,
|
21404 | y1: y,
|
21405 | y2: y
|
21406 | }), handle.append("circle").attr({
|
21407 | cx: 0,
|
21408 | cy: y,
|
21409 | r: "6px"
|
21410 | }).classed("drag-handle", !0);
|
21411 | }
|
21412 | }, ClusteredBarChartStrategy.getLayout = function(data, axisOptions) {
|
21413 | var columnWidth = axisOptions.columnWidth, halfColumnWidth = .5 * columnWidth, quarterColumnWidth = halfColumnWidth / 2, isScalar = axisOptions.isScalar, xScale = axisOptions.xScale, yScale = axisOptions.yScale, seriesOffsetScale = axisOptions.seriesOffsetScale, scaledX0 = xScale(0), yScaleOffset = 0;
|
21414 | return isScalar && (yScaleOffset = axisOptions.categoryWidth / 2), {
|
21415 | shapeLayout: {
|
21416 | width: function(d) {
|
21417 | return Math.abs(visuals.AxisHelper.diffScaled(xScale, 0, d.value));
|
21418 | },
|
21419 | x: function(d) {
|
21420 | return scaledX0 + visuals.AxisHelper.diffScaled(xScale, Math.min(0, d.value), 0);
|
21421 | },
|
21422 | y: function(d) {
|
21423 | return yScale(isScalar ? d.categoryValue : d.categoryIndex) + seriesOffsetScale(d.seriesIndex) - yScaleOffset + (d.drawThinner ? quarterColumnWidth : 0);
|
21424 | },
|
21425 | height: function(d) {
|
21426 | return d.drawThinner ? halfColumnWidth : columnWidth;
|
21427 | }
|
21428 | },
|
21429 | shapeLayoutWithoutHighlights: {
|
21430 | width: function(d) {
|
21431 | return Math.abs(visuals.AxisHelper.diffScaled(xScale, 0, d.originalValue));
|
21432 | },
|
21433 | x: function(d) {
|
21434 | return scaledX0 + visuals.AxisHelper.diffScaled(xScale, Math.min(0, d.originalValue), 0);
|
21435 | },
|
21436 | y: function(d) {
|
21437 | return yScale(isScalar ? d.categoryValue : d.categoryIndex) + seriesOffsetScale(d.seriesIndex) - yScaleOffset;
|
21438 | },
|
21439 | height: function(d) {
|
21440 | return columnWidth;
|
21441 | }
|
21442 | },
|
21443 | zeroShapeLayout: {
|
21444 | width: function(d) {
|
21445 | return 0;
|
21446 | },
|
21447 | x: function(d) {
|
21448 | return scaledX0 + visuals.AxisHelper.diffScaled(xScale, Math.min(0, d.value), 0);
|
21449 | },
|
21450 | y: function(d) {
|
21451 | return yScale(isScalar ? d.categoryValue : d.categoryIndex) + seriesOffsetScale(d.seriesIndex) - yScaleOffset + (d.drawThinner ? quarterColumnWidth : 0);
|
21452 | },
|
21453 | height: function(d) {
|
21454 | return d.drawThinner ? halfColumnWidth : columnWidth;
|
21455 | }
|
21456 | }
|
21457 | };
|
21458 | }, ClusteredBarChartStrategy.prototype.createLabelDataPoints = function() {
|
21459 | for (var labelDataPoints = [], data = this.data, series = data.series, formattersCache = visuals.NewDataLabelUtils.createColumnFormatterCacheManager(), shapeLayout = this.layout.shapeLayout, _i = 0, series_2 = series; _i < series_2.length; _i++) {
|
21460 | var currentSeries = series_2[_i], labelSettings = currentSeries.labelSettings ? currentSeries.labelSettings : data.labelSettings;
|
21461 | if (labelSettings.show) for (var axisFormatter = visuals.NewDataLabelUtils.getDisplayUnitValueFromAxisFormatter(this.yProps.formatter, labelSettings), _a = 0, _b = currentSeries.data; _a < _b.length; _a++) {
|
21462 | var dataPoint = _b[_a];
|
21463 | if ((!data.hasHighlights || dataPoint.highlight) && null != dataPoint.value) {
|
21464 | var formatString = dataPoint.labelFormatString, formatter = formattersCache.getOrCreate(formatString, labelSettings, axisFormatter), text = visuals.NewDataLabelUtils.getLabelFormattedText(formatter.format(dataPoint.value)), properties = {
|
21465 | text: text,
|
21466 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
21467 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt),
|
21468 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
21469 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties, !0), parentRect = {
|
21470 | left: shapeLayout.x(dataPoint),
|
21471 | top: shapeLayout.y(dataPoint),
|
21472 | width: shapeLayout.width(dataPoint),
|
21473 | height: shapeLayout.height(dataPoint)
|
21474 | };
|
21475 | labelDataPoints.push({
|
21476 | isPreferred: !0,
|
21477 | text: text,
|
21478 | textSize: {
|
21479 | width: textWidth,
|
21480 | height: textHeight
|
21481 | },
|
21482 | outsideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !1, this.isComboChart),
|
21483 | insideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !0, this.isComboChart),
|
21484 | parentType: 1,
|
21485 | parentShape: {
|
21486 | rect: parentRect,
|
21487 | orientation: dataPoint.value >= 0 ? 3 : 4,
|
21488 | validPositions: visuals.ColumnChart.clusteredValidLabelPositions
|
21489 | },
|
21490 | identity: dataPoint.identity,
|
21491 | fontSize: labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt
|
21492 | });
|
21493 | }
|
21494 | }
|
21495 | }
|
21496 | return labelDataPoints;
|
21497 | }, ClusteredBarChartStrategy.classes = {
|
21498 | item: {
|
21499 | "class": "bar",
|
21500 | selector: ".bar"
|
21501 | }
|
21502 | }, ClusteredBarChartStrategy;
|
21503 | }();
|
21504 | visuals.ClusteredBarChartStrategy = ClusteredBarChartStrategy;
|
21505 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
21506 | }(powerbi || (powerbi = {}));
|
21507 | }, function(module, exports) {
|
21508 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
21509 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
21510 | !function(powerbi) {
|
21511 | var visuals;
|
21512 | !function(visuals) {
|
21513 | var PixelConverter = jsCommon.PixelConverter, StackedColumnChartStrategy = function() {
|
21514 | function StackedColumnChartStrategy() {}
|
21515 | return StackedColumnChartStrategy.prototype.setupVisualProps = function(columnChartProps) {
|
21516 | this.graphicsContext = columnChartProps, this.margin = columnChartProps.margin,
|
21517 | this.width = this.graphicsContext.width, this.height = this.graphicsContext.height,
|
21518 | this.categoryLayout = columnChartProps.layout, this.animator = columnChartProps.animator,
|
21519 | this.interactivityService = columnChartProps.interactivityService, this.viewportHeight = columnChartProps.viewportHeight,
|
21520 | this.viewportWidth = columnChartProps.viewportWidth, this.isComboChart = columnChartProps.isComboChart;
|
21521 | }, StackedColumnChartStrategy.prototype.setData = function(data) {
|
21522 | this.data = data;
|
21523 | }, StackedColumnChartStrategy.prototype.setXScale = function(is100Pct, forcedTickCount, forcedXDomain, axisScaleType, axisDisplayUnits, axisPrecision, xReferenceLineValue) {
|
21524 | var forcedXMin, forcedXMax, width = this.width;
|
21525 | forcedXDomain && 2 === forcedXDomain.length && (forcedXMin = forcedXDomain[0], forcedXMax = forcedXDomain[1]);
|
21526 | var props = this.xProps = visuals.ColumnUtil.getCategoryAxis(this.data, width, this.categoryLayout, !1, forcedXMin, forcedXMax, axisScaleType, axisDisplayUnits, axisPrecision, xReferenceLineValue);
|
21527 | return props;
|
21528 | }, StackedColumnChartStrategy.prototype.setYScale = function(is100Pct, forcedTickCount, forcedYDomain, axisScaleType, axisDisplayUnits, axisPrecision, y1ReferenceLineValue) {
|
21529 | var height = this.viewportHeight, valueDomain = visuals.StackedUtil.calcValueDomain(this.data.series, is100Pct), valueDomainArr = [ valueDomain.min, valueDomain.max ], combinedDomain = visuals.AxisHelper.combineDomain(forcedYDomain, valueDomainArr, y1ReferenceLineValue), shouldClamp = visuals.AxisHelper.scaleShouldClamp(combinedDomain, valueDomainArr), metadataColumn = this.data.valuesMetadata[0], formatString = is100Pct ? this.graphicsContext.hostService.getLocalizedString("Percentage") : visuals.valueFormatter.getFormatString(metadataColumn, visuals.columnChartProps.general.formatString);
|
21530 | return this.yProps = visuals.AxisHelper.createAxis({
|
21531 | pixelSpan: height,
|
21532 | dataDomain: combinedDomain,
|
21533 | metaDataColumn: metadataColumn,
|
21534 | formatString: formatString,
|
21535 | outerPadding: 0,
|
21536 | isScalar: !0,
|
21537 | isVertical: !0,
|
21538 | forcedTickCount: forcedTickCount,
|
21539 | useTickIntervalForDisplayUnits: !0,
|
21540 | isCategoryAxis: !1,
|
21541 | scaleType: axisScaleType,
|
21542 | axisDisplayUnits: axisDisplayUnits,
|
21543 | axisPrecision: axisPrecision,
|
21544 | is100Pct: is100Pct,
|
21545 | shouldClamp: shouldClamp
|
21546 | }), this.yProps;
|
21547 | }, StackedColumnChartStrategy.prototype.drawColumns = function(useAnimation) {
|
21548 | var data = this.data;
|
21549 | this.columnsCenters = null;
|
21550 | var axisOptions = {
|
21551 | columnWidth: this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio),
|
21552 | xScale: this.xProps.scale,
|
21553 | yScale: this.yProps.scale,
|
21554 | isScalar: this.categoryLayout.isScalar,
|
21555 | margin: this.margin
|
21556 | }, stackedColumnLayout = this.layout = StackedColumnChartStrategy.getLayout(data, axisOptions), dataLabelSettings = data.labelSettings, labelDataPoints = [];
|
21557 | dataLabelSettings && dataLabelSettings.show && (labelDataPoints = this.createLabelDataPoints());
|
21558 | var result, shapes, series = visuals.ColumnUtil.drawSeries(data, this.graphicsContext.mainGraphicsContext, axisOptions);
|
21559 | return this.animator && useAnimation && (result = this.animator.animate({
|
21560 | viewModel: data,
|
21561 | series: series,
|
21562 | layout: stackedColumnLayout,
|
21563 | itemCS: StackedColumnChartStrategy.classes.item,
|
21564 | interactivityService: this.interactivityService,
|
21565 | mainGraphicsContext: this.graphicsContext.mainGraphicsContext,
|
21566 | viewPort: {
|
21567 | height: this.height,
|
21568 | width: this.width
|
21569 | }
|
21570 | }), shapes = result.shapes), this.animator && useAnimation && !result.failed || (shapes = visuals.ColumnUtil.drawDefaultShapes(data, series, stackedColumnLayout, StackedColumnChartStrategy.classes.item, !this.animator, this.interactivityService && this.interactivityService.hasSelection())),
|
21571 | visuals.ColumnUtil.applyInteractivity(shapes, this.graphicsContext.onDragStart),
|
21572 | {
|
21573 | eventGroup: this.graphicsContext.mainGraphicsContext,
|
21574 | shapesSelection: shapes,
|
21575 | viewport: {
|
21576 | height: this.height,
|
21577 | width: this.width
|
21578 | },
|
21579 | axisOptions: axisOptions,
|
21580 | labelDataPoints: labelDataPoints
|
21581 | };
|
21582 | }, StackedColumnChartStrategy.prototype.selectColumn = function(selectedColumnIndex, lastSelectedColumnIndex) {
|
21583 | visuals.ColumnUtil.setChosenColumnOpacity(this.graphicsContext.mainGraphicsContext, StackedColumnChartStrategy.classes.item.selector, selectedColumnIndex, lastSelectedColumnIndex),
|
21584 | this.moveHandle(selectedColumnIndex);
|
21585 | }, StackedColumnChartStrategy.prototype.getClosestColumnIndex = function(x, y) {
|
21586 | return visuals.ColumnUtil.getClosestColumnIndex(x, this.getColumnsCenters());
|
21587 | }, StackedColumnChartStrategy.prototype.getColumnsCenters = function() {
|
21588 | var _this = this;
|
21589 | if (!this.columnsCenters) {
|
21590 | var categoryWidth = this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio);
|
21591 | if (this.data.series.length > 0) {
|
21592 | var xScaleOffset_1 = 0;
|
21593 | this.categoryLayout.isScalar || (xScaleOffset_1 = categoryWidth / 2);
|
21594 | var firstSeries = this.data.series[0];
|
21595 | this.columnsCenters = firstSeries.data.map(function(d) {
|
21596 | return _this.xProps.scale(_this.categoryLayout.isScalar ? d.categoryValue : d.categoryIndex) + xScaleOffset_1;
|
21597 | });
|
21598 | }
|
21599 | }
|
21600 | return this.columnsCenters;
|
21601 | }, StackedColumnChartStrategy.prototype.moveHandle = function(selectedColumnIndex) {
|
21602 | var columnCenters = this.getColumnsCenters(), x = columnCenters[selectedColumnIndex], hoverLine = d3.select(".interactive-hover-line");
|
21603 | if (hoverLine.empty() || this.columnSelectionLineHandle || (this.columnSelectionLineHandle = d3.select(hoverLine.node().parentNode)),
|
21604 | this.columnSelectionLineHandle) {
|
21605 | var handle = this.columnSelectionLineHandle;
|
21606 | handle.select("line").attr({
|
21607 | x1: x,
|
21608 | x2: x
|
21609 | }), handle.select("circle").attr({
|
21610 | cx: x
|
21611 | });
|
21612 | } else {
|
21613 | var handle = this.columnSelectionLineHandle = this.graphicsContext.unclippedGraphicsContext.append("g");
|
21614 | handle.append("line").classed("interactive-hover-line", !0).attr({
|
21615 | x1: x,
|
21616 | x2: x,
|
21617 | y1: 0,
|
21618 | y2: this.height
|
21619 | }), handle.append("circle").attr({
|
21620 | cx: x,
|
21621 | cy: this.height,
|
21622 | r: "6px"
|
21623 | }).classed("drag-handle", !0);
|
21624 | }
|
21625 | }, StackedColumnChartStrategy.getLayout = function(data, axisOptions) {
|
21626 | var columnWidth = axisOptions.columnWidth, isScalar = axisOptions.isScalar, xScale = axisOptions.xScale, yScale = axisOptions.yScale, xScaleOffset = 0;
|
21627 | return isScalar && (xScaleOffset = columnWidth / 2), {
|
21628 | shapeLayout: {
|
21629 | width: function(d) {
|
21630 | return columnWidth;
|
21631 | },
|
21632 | x: function(d) {
|
21633 | return xScale(isScalar ? d.categoryValue : d.categoryIndex) - xScaleOffset;
|
21634 | },
|
21635 | y: function(d) {
|
21636 | return yScale(d.position);
|
21637 | },
|
21638 | height: function(d) {
|
21639 | return yScale(d.position - d.valueAbsolute) - yScale(d.position);
|
21640 | }
|
21641 | },
|
21642 | shapeLayoutWithoutHighlights: {
|
21643 | width: function(d) {
|
21644 | return columnWidth;
|
21645 | },
|
21646 | x: function(d) {
|
21647 | return xScale(isScalar ? d.categoryValue : d.categoryIndex) - xScaleOffset;
|
21648 | },
|
21649 | y: function(d) {
|
21650 | return yScale(d.originalPosition);
|
21651 | },
|
21652 | height: function(d) {
|
21653 | return yScale(d.originalPosition - d.originalValueAbsolute) - yScale(d.originalPosition);
|
21654 | }
|
21655 | },
|
21656 | zeroShapeLayout: {
|
21657 | width: function(d) {
|
21658 | return columnWidth;
|
21659 | },
|
21660 | x: function(d) {
|
21661 | return xScale(isScalar ? d.categoryValue : d.categoryIndex) - xScaleOffset;
|
21662 | },
|
21663 | y: function(d) {
|
21664 | return yScale(d.value >= 0 ? d.position - d.valueAbsolute : d.position);
|
21665 | },
|
21666 | height: function(d) {
|
21667 | return 0;
|
21668 | }
|
21669 | }
|
21670 | };
|
21671 | }, StackedColumnChartStrategy.prototype.createLabelDataPoints = function() {
|
21672 | for (var labelDataPoints = [], data = this.data, series = data.series, formattersCache = visuals.NewDataLabelUtils.createColumnFormatterCacheManager(), shapeLayout = this.layout.shapeLayout, _i = 0, series_1 = series; _i < series_1.length; _i++) {
|
21673 | var currentSeries = series_1[_i], labelSettings = currentSeries.labelSettings ? currentSeries.labelSettings : data.labelSettings;
|
21674 | if (labelSettings.show) for (var axisFormatter = visuals.NewDataLabelUtils.getDisplayUnitValueFromAxisFormatter(this.yProps.formatter, labelSettings), _a = 0, _b = currentSeries.data; _a < _b.length; _a++) {
|
21675 | var dataPoint = _b[_a];
|
21676 | if ((!data.hasHighlights || dataPoint.highlight) && null != dataPoint.value) {
|
21677 | var parentRect = {
|
21678 | left: shapeLayout.x(dataPoint),
|
21679 | top: shapeLayout.y(dataPoint),
|
21680 | width: shapeLayout.width(dataPoint),
|
21681 | height: shapeLayout.height(dataPoint)
|
21682 | }, formatString = "";
|
21683 | formatString = this.graphicsContext.is100Pct ? visuals.NewDataLabelUtils.hundredPercentFormat : dataPoint.labelFormatString;
|
21684 | var formatter = formattersCache.getOrCreate(formatString, labelSettings, axisFormatter), text = visuals.NewDataLabelUtils.getLabelFormattedText(formatter.format(dataPoint.value)), properties = {
|
21685 | text: text,
|
21686 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
21687 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt),
|
21688 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
21689 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties, !0);
|
21690 | labelDataPoints.push({
|
21691 | isPreferred: !0,
|
21692 | text: text,
|
21693 | textSize: {
|
21694 | width: textWidth,
|
21695 | height: textHeight
|
21696 | },
|
21697 | outsideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !1, this.isComboChart),
|
21698 | insideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !0, this.isComboChart),
|
21699 | parentType: 1,
|
21700 | parentShape: {
|
21701 | rect: parentRect,
|
21702 | orientation: dataPoint.value >= 0 ? 1 : 2,
|
21703 | validPositions: visuals.ColumnChart.stackedValidLabelPositions
|
21704 | },
|
21705 | identity: dataPoint.identity,
|
21706 | fontSize: labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt
|
21707 | });
|
21708 | }
|
21709 | }
|
21710 | }
|
21711 | return labelDataPoints;
|
21712 | }, StackedColumnChartStrategy.classes = {
|
21713 | item: {
|
21714 | "class": "column",
|
21715 | selector: ".column"
|
21716 | },
|
21717 | highlightItem: {
|
21718 | "class": "highlightColumn",
|
21719 | selector: ".highlightColumn"
|
21720 | }
|
21721 | }, StackedColumnChartStrategy;
|
21722 | }();
|
21723 | visuals.StackedColumnChartStrategy = StackedColumnChartStrategy;
|
21724 | var StackedBarChartStrategy = function() {
|
21725 | function StackedBarChartStrategy() {}
|
21726 | return StackedBarChartStrategy.prototype.setupVisualProps = function(barChartProps) {
|
21727 | this.graphicsContext = barChartProps, this.margin = barChartProps.margin, this.width = this.graphicsContext.width,
|
21728 | this.height = this.graphicsContext.height, this.categoryLayout = barChartProps.layout,
|
21729 | this.animator = barChartProps.animator, this.interactivityService = barChartProps.interactivityService,
|
21730 | this.viewportHeight = barChartProps.viewportHeight, this.viewportWidth = barChartProps.viewportWidth,
|
21731 | this.isComboChart = barChartProps.isComboChart;
|
21732 | }, StackedBarChartStrategy.prototype.setData = function(data) {
|
21733 | this.data = data;
|
21734 | }, StackedBarChartStrategy.prototype.setYScale = function(is100Pct, forcedTickCount, forcedYDomain, axisScaleType, axisDisplayUnits, axisPrecision, ensureYDomain) {
|
21735 | var forcedYMin, forcedYMax, height = this.height;
|
21736 | forcedYDomain && 2 === forcedYDomain.length && (forcedYMin = forcedYDomain[0], forcedYMax = forcedYDomain[1]);
|
21737 | var props = this.yProps = visuals.ColumnUtil.getCategoryAxis(this.data, height, this.categoryLayout, !0, forcedYMin, forcedYMax, axisScaleType, axisDisplayUnits, axisPrecision, ensureYDomain);
|
21738 | return props;
|
21739 | }, StackedBarChartStrategy.prototype.setXScale = function(is100Pct, forcedTickCount, forcedXDomain, axisScaleType, axisDisplayUnits, axisPrecision, ensureXDomain) {
|
21740 | var width = this.width, valueDomain = visuals.StackedUtil.calcValueDomain(this.data.series, is100Pct), valueDomainArr = [ valueDomain.min, valueDomain.max ], combinedDomain = visuals.AxisHelper.combineDomain(forcedXDomain, valueDomainArr, ensureXDomain), shouldClamp = visuals.AxisHelper.scaleShouldClamp(combinedDomain, valueDomainArr), metadataColumn = this.data.valuesMetadata[0], formatString = is100Pct ? this.graphicsContext.hostService.getLocalizedString("Percentage") : visuals.valueFormatter.getFormatString(metadataColumn, visuals.columnChartProps.general.formatString);
|
21741 | return this.xProps = visuals.AxisHelper.createAxis({
|
21742 | pixelSpan: width,
|
21743 | dataDomain: combinedDomain,
|
21744 | metaDataColumn: metadataColumn,
|
21745 | formatString: formatString,
|
21746 | outerPadding: 0,
|
21747 | isScalar: !0,
|
21748 | isVertical: !1,
|
21749 | forcedTickCount: forcedTickCount,
|
21750 | useTickIntervalForDisplayUnits: !0,
|
21751 | isCategoryAxis: !1,
|
21752 | scaleType: axisScaleType,
|
21753 | axisDisplayUnits: axisDisplayUnits,
|
21754 | axisPrecision: axisPrecision,
|
21755 | is100Pct: is100Pct,
|
21756 | shouldClamp: shouldClamp
|
21757 | }), this.xProps.axis.tickSize(-this.viewportHeight, 0), this.xProps;
|
21758 | }, StackedBarChartStrategy.prototype.drawColumns = function(useAnimation) {
|
21759 | var data = this.data;
|
21760 | this.barsCenters = null;
|
21761 | var axisOptions = {
|
21762 | columnWidth: this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio),
|
21763 | xScale: this.xProps.scale,
|
21764 | yScale: this.yProps.scale,
|
21765 | isScalar: this.categoryLayout.isScalar,
|
21766 | margin: this.margin
|
21767 | }, stackedBarLayout = this.layout = StackedBarChartStrategy.getLayout(data, axisOptions), dataLabelSettings = data.labelSettings, labelDataPoints = [];
|
21768 | dataLabelSettings && dataLabelSettings.show && (labelDataPoints = this.createLabelDataPoints());
|
21769 | var result, shapes, series = visuals.ColumnUtil.drawSeries(data, this.graphicsContext.mainGraphicsContext, axisOptions);
|
21770 | return this.animator && useAnimation && (result = this.animator.animate({
|
21771 | viewModel: data,
|
21772 | series: series,
|
21773 | layout: stackedBarLayout,
|
21774 | itemCS: StackedBarChartStrategy.classes.item,
|
21775 | interactivityService: this.interactivityService,
|
21776 | mainGraphicsContext: this.graphicsContext.mainGraphicsContext,
|
21777 | viewPort: {
|
21778 | height: this.height,
|
21779 | width: this.width
|
21780 | }
|
21781 | }), shapes = result.shapes), this.animator && useAnimation && !result.failed || (shapes = visuals.ColumnUtil.drawDefaultShapes(data, series, stackedBarLayout, StackedBarChartStrategy.classes.item, !this.animator, this.interactivityService && this.interactivityService.hasSelection())),
|
21782 | visuals.ColumnUtil.applyInteractivity(shapes, this.graphicsContext.onDragStart),
|
21783 | {
|
21784 | eventGroup: this.graphicsContext.mainGraphicsContext,
|
21785 | shapesSelection: shapes,
|
21786 | viewport: {
|
21787 | height: this.height,
|
21788 | width: this.width
|
21789 | },
|
21790 | axisOptions: axisOptions,
|
21791 | labelDataPoints: labelDataPoints
|
21792 | };
|
21793 | }, StackedBarChartStrategy.prototype.selectColumn = function(selectedColumnIndex, lastInteractiveSelectedColumnIndex) {
|
21794 | visuals.ColumnUtil.setChosenColumnOpacity(this.graphicsContext.mainGraphicsContext, StackedBarChartStrategy.classes.item.selector, selectedColumnIndex, lastInteractiveSelectedColumnIndex),
|
21795 | this.moveHandle(selectedColumnIndex);
|
21796 | }, StackedBarChartStrategy.prototype.getClosestColumnIndex = function(x, y) {
|
21797 | return visuals.ColumnUtil.getClosestColumnIndex(y, this.getBarsCenters());
|
21798 | }, StackedBarChartStrategy.prototype.getBarsCenters = function() {
|
21799 | var _this = this;
|
21800 | if (!this.barsCenters) {
|
21801 | var barWidth = this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio);
|
21802 | if (this.data.series.length > 0) {
|
21803 | var yScaleOffset_1 = 0;
|
21804 | this.categoryLayout.isScalar || (yScaleOffset_1 = barWidth / 2);
|
21805 | var firstSeries = this.data.series[0];
|
21806 | this.barsCenters = firstSeries.data.map(function(d) {
|
21807 | return _this.yProps.scale(_this.categoryLayout.isScalar ? d.categoryValue : d.categoryIndex) + yScaleOffset_1;
|
21808 | });
|
21809 | }
|
21810 | }
|
21811 | return this.barsCenters;
|
21812 | }, StackedBarChartStrategy.prototype.moveHandle = function(selectedColumnIndex) {
|
21813 | var barCenters = this.getBarsCenters(), y = barCenters[selectedColumnIndex], hoverLine = d3.select(".interactive-hover-line");
|
21814 | if (hoverLine.empty() || this.columnSelectionLineHandle || (this.columnSelectionLineHandle = d3.select(hoverLine.node().parentNode)),
|
21815 | this.columnSelectionLineHandle) {
|
21816 | var handle = this.columnSelectionLineHandle;
|
21817 | handle.select("line").attr({
|
21818 | y1: y,
|
21819 | y2: y
|
21820 | }), handle.select("circle").attr({
|
21821 | cy: y
|
21822 | });
|
21823 | } else {
|
21824 | var handle = this.columnSelectionLineHandle = this.graphicsContext.unclippedGraphicsContext.append("g");
|
21825 | handle.append("line").classed("interactive-hover-line", !0).attr({
|
21826 | x1: 0,
|
21827 | x2: this.width,
|
21828 | y1: y,
|
21829 | y2: y
|
21830 | }), handle.append("circle").classed("drag-handle", !0).attr({
|
21831 | cx: 0,
|
21832 | cy: y,
|
21833 | r: "6px"
|
21834 | });
|
21835 | }
|
21836 | }, StackedBarChartStrategy.getLayout = function(data, axisOptions) {
|
21837 | var columnWidth = axisOptions.columnWidth, isScalar = axisOptions.isScalar, xScale = axisOptions.xScale, yScale = axisOptions.yScale, yScaleOffset = 0;
|
21838 | return isScalar && (yScaleOffset = columnWidth / 2), {
|
21839 | shapeLayout: {
|
21840 | width: function(d) {
|
21841 | return xScale(d.position) - xScale(d.position - d.valueAbsolute);
|
21842 | },
|
21843 | x: function(d) {
|
21844 | return xScale(d.position - d.valueAbsolute);
|
21845 | },
|
21846 | y: function(d) {
|
21847 | return yScale(isScalar ? d.categoryValue : d.categoryIndex) - yScaleOffset;
|
21848 | },
|
21849 | height: function(d) {
|
21850 | return columnWidth;
|
21851 | }
|
21852 | },
|
21853 | shapeLayoutWithoutHighlights: {
|
21854 | width: function(d) {
|
21855 | return xScale(d.originalPosition) - xScale(d.originalPosition - d.originalValueAbsolute);
|
21856 | },
|
21857 | x: function(d) {
|
21858 | return xScale(d.originalPosition - d.originalValueAbsolute);
|
21859 | },
|
21860 | y: function(d) {
|
21861 | return yScale(isScalar ? d.categoryValue : d.categoryIndex) - yScaleOffset;
|
21862 | },
|
21863 | height: function(d) {
|
21864 | return columnWidth;
|
21865 | }
|
21866 | },
|
21867 | zeroShapeLayout: {
|
21868 | width: function(d) {
|
21869 | return 0;
|
21870 | },
|
21871 | x: function(d) {
|
21872 | return xScale(d.value >= 0 ? d.position - d.valueAbsolute : d.position);
|
21873 | },
|
21874 | y: function(d) {
|
21875 | return yScale(isScalar ? d.categoryValue : d.categoryIndex) - yScaleOffset;
|
21876 | },
|
21877 | height: function(d) {
|
21878 | return columnWidth;
|
21879 | }
|
21880 | }
|
21881 | };
|
21882 | }, StackedBarChartStrategy.prototype.createLabelDataPoints = function() {
|
21883 | for (var labelDataPoints = [], data = this.data, series = data.series, formattersCache = visuals.NewDataLabelUtils.createColumnFormatterCacheManager(), shapeLayout = this.layout.shapeLayout, _i = 0, series_2 = series; _i < series_2.length; _i++) {
|
21884 | var currentSeries = series_2[_i], labelSettings = currentSeries.labelSettings ? currentSeries.labelSettings : data.labelSettings;
|
21885 | if (labelSettings.show) for (var axisFormatter = visuals.NewDataLabelUtils.getDisplayUnitValueFromAxisFormatter(this.yProps.formatter, labelSettings), _a = 0, _b = currentSeries.data; _a < _b.length; _a++) {
|
21886 | var dataPoint = _b[_a];
|
21887 | if ((!data.hasHighlights || dataPoint.highlight) && null != dataPoint.value) {
|
21888 | var formatString = void 0;
|
21889 | formatString = this.graphicsContext.is100Pct ? visuals.NewDataLabelUtils.hundredPercentFormat : dataPoint.labelFormatString;
|
21890 | var formatter = formattersCache.getOrCreate(formatString, labelSettings, axisFormatter), text = visuals.NewDataLabelUtils.getLabelFormattedText(formatter.format(dataPoint.value)), properties = {
|
21891 | text: text,
|
21892 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
21893 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt),
|
21894 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
21895 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties, !0), parentRect = {
|
21896 | left: shapeLayout.x(dataPoint),
|
21897 | top: shapeLayout.y(dataPoint),
|
21898 | width: shapeLayout.width(dataPoint),
|
21899 | height: shapeLayout.height(dataPoint)
|
21900 | };
|
21901 | labelDataPoints.push({
|
21902 | isPreferred: !0,
|
21903 | text: text,
|
21904 | textSize: {
|
21905 | width: textWidth,
|
21906 | height: textHeight
|
21907 | },
|
21908 | outsideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !1, this.isComboChart),
|
21909 | insideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !0, this.isComboChart),
|
21910 | parentType: 1,
|
21911 | parentShape: {
|
21912 | rect: parentRect,
|
21913 | orientation: dataPoint.value >= 0 ? 3 : 4,
|
21914 | validPositions: visuals.ColumnChart.stackedValidLabelPositions
|
21915 | },
|
21916 | identity: dataPoint.identity,
|
21917 | fontSize: labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt
|
21918 | });
|
21919 | }
|
21920 | }
|
21921 | }
|
21922 | return labelDataPoints;
|
21923 | }, StackedBarChartStrategy.classes = {
|
21924 | item: {
|
21925 | "class": "bar",
|
21926 | selector: ".bar"
|
21927 | },
|
21928 | highlightItem: {
|
21929 | "class": "highlightBar",
|
21930 | selector: ".highlightBar"
|
21931 | }
|
21932 | }, StackedBarChartStrategy;
|
21933 | }();
|
21934 | visuals.StackedBarChartStrategy = StackedBarChartStrategy;
|
21935 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
21936 | }(powerbi || (powerbi = {}));
|
21937 | }, function(module, exports) {
|
21938 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
21939 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
21940 | !function(powerbi) {
|
21941 | var visuals;
|
21942 | !function(visuals) {
|
21943 | var samples;
|
21944 | !function(samples) {
|
21945 | var SelectionManager = visuals.utility.SelectionManager, HelloIVisual = function() {
|
21946 | function HelloIVisual() {}
|
21947 | return HelloIVisual.converter = function(dataView) {
|
21948 | var viewModel = {
|
21949 | size: HelloIVisual.getSize(dataView),
|
21950 | color: HelloIVisual.getFill(dataView).solid.color,
|
21951 | text: HelloIVisual.DefaultText,
|
21952 | toolTipInfo: [ {
|
21953 | displayName: "Test",
|
21954 | value: "1...2....3... can you see me? I am sending random strings to the tooltip"
|
21955 | } ],
|
21956 | selector: visuals.SelectionId.createNull()
|
21957 | }, table = dataView.table;
|
21958 | return table ? (viewModel.text = table.rows[0][0], dataView.categorical && (viewModel.selector = dataView.categorical.categories[0].identity ? visuals.SelectionId.createWithId(dataView.categorical.categories[0].identity[0]) : visuals.SelectionId.createNull()),
|
21959 | viewModel) : viewModel;
|
21960 | }, HelloIVisual.prototype.init = function(options) {
|
21961 | this.root = d3.select(options.element.get(0)).append("svg").classed("hello", !0),
|
21962 | this.svgText = this.root.append("text").style("cursor", "pointer").style("stroke", "green").style("stroke-width", "0px").attr("text-anchor", "middle"),
|
21963 | this.selectiionManager = new SelectionManager({
|
21964 | hostServices: options.host
|
21965 | });
|
21966 | }, HelloIVisual.prototype.update = function(options) {
|
21967 | if (options.dataViews || options.dataViews[0]) {
|
21968 | var dataView = this.dataView = options.dataViews[0], viewport = options.viewport, viewModel = HelloIVisual.converter(dataView);
|
21969 | this.root.attr({
|
21970 | height: viewport.height,
|
21971 | width: viewport.width
|
21972 | });
|
21973 | var textProperties = {
|
21974 | fontFamily: "tahoma",
|
21975 | fontSize: viewModel.size + "px",
|
21976 | text: viewModel.text
|
21977 | }, textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(textProperties), selectionManager = this.selectiionManager;
|
21978 | this.svgText.style({
|
21979 | fill: viewModel.color,
|
21980 | "font-size": textProperties.fontSize,
|
21981 | "font-family": textProperties.fontFamily
|
21982 | }).attr({
|
21983 | y: viewport.height / 2 + textHeight / 3 + "px",
|
21984 | x: viewport.width / 2
|
21985 | }).text(viewModel.text).on("click", function() {
|
21986 | var _this = this;
|
21987 | selectionManager.select(viewModel.selector).then(function(ids) {
|
21988 | return d3.select(_this).style("stroke-width", ids.length > 0 ? "2px" : "0px");
|
21989 | });
|
21990 | }).data([ viewModel ]), visuals.TooltipManager.addTooltip(this.svgText, function(tooltipEvent) {
|
21991 | return tooltipEvent.data.toolTipInfo;
|
21992 | });
|
21993 | }
|
21994 | }, HelloIVisual.getFill = function(dataView) {
|
21995 | if (dataView) {
|
21996 | var objects = dataView.metadata.objects;
|
21997 | if (objects) {
|
21998 | var general = objects.general;
|
21999 | if (general) {
|
22000 | var fill = general.fill;
|
22001 | if (fill) return fill;
|
22002 | }
|
22003 | }
|
22004 | }
|
22005 | return {
|
22006 | solid: {
|
22007 | color: "red"
|
22008 | }
|
22009 | };
|
22010 | }, HelloIVisual.getSize = function(dataView) {
|
22011 | if (dataView) {
|
22012 | var objects = dataView.metadata.objects;
|
22013 | if (objects) {
|
22014 | var general = objects.general;
|
22015 | if (general) {
|
22016 | var size = general.size;
|
22017 | if (size) return size;
|
22018 | }
|
22019 | }
|
22020 | }
|
22021 | return 100;
|
22022 | }, HelloIVisual.prototype.enumerateObjectInstances = function(options) {
|
22023 | var instances = [], dataView = this.dataView;
|
22024 | switch (options.objectName) {
|
22025 | case "general":
|
22026 | var general = {
|
22027 | objectName: "general",
|
22028 | displayName: "General",
|
22029 | selector: null,
|
22030 | properties: {
|
22031 | fill: HelloIVisual.getFill(dataView),
|
22032 | size: HelloIVisual.getSize(dataView)
|
22033 | }
|
22034 | };
|
22035 | instances.push(general);
|
22036 | }
|
22037 | return instances;
|
22038 | }, HelloIVisual.prototype.destroy = function() {
|
22039 | this.root = null;
|
22040 | }, HelloIVisual.capabilities = {
|
22041 | dataRoles: [ {
|
22042 | displayName: "Values",
|
22043 | name: "Values",
|
22044 | kind: powerbi.VisualDataRoleKind.GroupingOrMeasure
|
22045 | } ],
|
22046 | dataViewMappings: [ {
|
22047 | table: {
|
22048 | rows: {
|
22049 | "for": {
|
22050 | "in": "Values"
|
22051 | },
|
22052 | dataReductionAlgorithm: {
|
22053 | window: {
|
22054 | count: 100
|
22055 | }
|
22056 | }
|
22057 | },
|
22058 | rowCount: {
|
22059 | preferred: {
|
22060 | min: 1
|
22061 | }
|
22062 | }
|
22063 | }
|
22064 | } ],
|
22065 | objects: {
|
22066 | general: {
|
22067 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
22068 | properties: {
|
22069 | fill: {
|
22070 | type: {
|
22071 | fill: {
|
22072 | solid: {
|
22073 | color: !0
|
22074 | }
|
22075 | }
|
22076 | },
|
22077 | displayName: "Fill"
|
22078 | },
|
22079 | size: {
|
22080 | type: {
|
22081 | numeric: !0
|
22082 | },
|
22083 | displayName: "Size"
|
22084 | }
|
22085 | }
|
22086 | }
|
22087 | }
|
22088 | }, HelloIVisual.DefaultText = "Invalid DV", HelloIVisual;
|
22089 | }();
|
22090 | samples.HelloIVisual = HelloIVisual;
|
22091 | }(samples = visuals.samples || (visuals.samples = {}));
|
22092 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
22093 | }(powerbi || (powerbi = {}));
|
22094 | }, function(module, exports) {
|
22095 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
22096 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
22097 | !function(powerbi) {
|
22098 | var visuals;
|
22099 | !function(visuals) {
|
22100 | var ComboChart;
|
22101 | !function(ComboChart) {
|
22102 | function enumerateDataPoints(enumeration, options, layers) {
|
22103 | if (layers) {
|
22104 | for (var columnChartLayerIndex, layersLength = layers.length, layerIndex = 0; layersLength > layerIndex; layerIndex++) {
|
22105 | var layer = layers[layerIndex];
|
22106 | if (layer.enumerateObjectInstances) {
|
22107 | if (layer instanceof visuals.ColumnChart) {
|
22108 | columnChartLayerIndex = layerIndex;
|
22109 | continue;
|
22110 | }
|
22111 | layer.enumerateObjectInstances(enumeration, options);
|
22112 | }
|
22113 | }
|
22114 | void 0 !== columnChartLayerIndex && layers[columnChartLayerIndex].enumerateObjectInstances(enumeration, options);
|
22115 | }
|
22116 | }
|
22117 | function customizeQuery(options) {
|
22118 | var columnMapping = !_.isEmpty(options.dataViewMappings) && options.dataViewMappings[0];
|
22119 | if (columnMapping) {
|
22120 | var columnValuesMapping = columnMapping.categorical && columnMapping.categorical.values, seriesSelect = columnValuesMapping.group && !_.isEmpty(columnValuesMapping.group.select) && columnValuesMapping.group.select[0];
|
22121 | _.isEmpty(seriesSelect["for"]["in"].items) && (columnValuesMapping.group.by.items = void 0);
|
22122 | }
|
22123 | var isScalar = visuals.CartesianChart.detectScalarMapping(columnMapping);
|
22124 | if (columnMapping && columnMapping.categorical) if (columnMapping.categorical.dataVolume = 4,
|
22125 | isScalar) {
|
22126 | var dataViewCategories = columnMapping.categorical.categories;
|
22127 | dataViewCategories.dataReductionAlgorithm = {
|
22128 | sample: {}
|
22129 | };
|
22130 | } else visuals.CartesianChart.applyLoadMoreEnabledToMapping(options.cartesianLoadMoreEnabled, columnMapping);
|
22131 | var lineMapping = options.dataViewMappings.length > 1 && options.dataViewMappings[1];
|
22132 | if (lineMapping && lineMapping.categorical) if (lineMapping.categorical.dataVolume = 4,
|
22133 | isScalar) {
|
22134 | var dataViewCategories = lineMapping.categorical.categories;
|
22135 | dataViewCategories.dataReductionAlgorithm = {
|
22136 | sample: {}
|
22137 | };
|
22138 | } else visuals.CartesianChart.applyLoadMoreEnabledToMapping(options.cartesianLoadMoreEnabled, lineMapping);
|
22139 | }
|
22140 | function getSortableRoles(options) {
|
22141 | if (options && options.dataViewMappings.length > 0) {
|
22142 | var dataViewMapping = options.dataViewMappings[0];
|
22143 | if (!visuals.CartesianChart.detectScalarMapping(dataViewMapping)) return [ "Category", "Y", "Y2" ];
|
22144 | }
|
22145 | return null;
|
22146 | }
|
22147 | function isComboChart(chartType) {
|
22148 | return 10 === chartType || 13 === chartType || 14 === chartType || 15 === chartType || 16 === chartType;
|
22149 | }
|
22150 | ComboChart.capabilities = visuals.comboChartCapabilities, ComboChart.enumerateDataPoints = enumerateDataPoints,
|
22151 | ComboChart.customizeQuery = customizeQuery, ComboChart.getSortableRoles = getSortableRoles,
|
22152 | ComboChart.isComboChart = isComboChart;
|
22153 | }(ComboChart = visuals.ComboChart || (visuals.ComboChart = {}));
|
22154 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
22155 | }(powerbi || (powerbi = {}));
|
22156 | }, function(module, exports) {
|
22157 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
22158 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
22159 | !function(powerbi) {
|
22160 | var visuals;
|
22161 | !function(visuals) {
|
22162 | var ArrayExtensions = jsCommon.ArrayExtensions, DataColorPalette = function() {
|
22163 | function DataColorPalette(colors, sentimentcolors) {
|
22164 | this.basePickerColors = [ {
|
22165 | value: "#FFFFFF"
|
22166 | }, {
|
22167 | value: "#000000"
|
22168 | }, {
|
22169 | value: "#00B8AA"
|
22170 | }, {
|
22171 | value: "#374649"
|
22172 | }, {
|
22173 | value: "#FD625E"
|
22174 | }, {
|
22175 | value: "#F2C811"
|
22176 | }, {
|
22177 | value: "#5F6B6D"
|
22178 | }, {
|
22179 | value: "#8AD4EB"
|
22180 | }, {
|
22181 | value: "#FE9666"
|
22182 | }, {
|
22183 | value: "#A66999"
|
22184 | } ], this.colors = colors || ThemeManager.getDefaultTheme(), this.sentimentColors = sentimentcolors || ThemeManager.defaultSentimentColors,
|
22185 | this.scales = {};
|
22186 | }
|
22187 | return DataColorPalette.prototype.getColorScaleByKey = function(key) {
|
22188 | var scale = this.scales[key];
|
22189 | return void 0 === scale && (scale = this.createScale(), this.scales[key] = scale),
|
22190 | scale;
|
22191 | }, DataColorPalette.prototype.getNewColorScale = function() {
|
22192 | return this.createScale();
|
22193 | }, DataColorPalette.prototype.getColorByIndex = function(index) {
|
22194 | return this.colors[index];
|
22195 | }, DataColorPalette.prototype.getSentimentColors = function() {
|
22196 | return this.sentimentColors;
|
22197 | }, DataColorPalette.prototype.getBasePickerColors = function() {
|
22198 | return this.basePickerColors;
|
22199 | }, DataColorPalette.prototype.getAllColors = function() {
|
22200 | return this.colors;
|
22201 | }, DataColorPalette.prototype.createScale = function() {
|
22202 | return D3ColorScale.createFromColors(this.colors);
|
22203 | }, DataColorPalette;
|
22204 | }();
|
22205 | visuals.DataColorPalette = DataColorPalette;
|
22206 | var D3ColorScale = function() {
|
22207 | function D3ColorScale(scale) {
|
22208 | this.scale = scale;
|
22209 | }
|
22210 | return D3ColorScale.prototype.getColor = function(key) {
|
22211 | return this.scale(key);
|
22212 | }, D3ColorScale.prototype.clearAndRotateScale = function() {
|
22213 | var offset = this.scale.domain().length, rotatedColors = ArrayExtensions.rotate(this.scale.range(), offset);
|
22214 | this.scale = d3.scale.ordinal().range(rotatedColors);
|
22215 | }, D3ColorScale.prototype.clone = function() {
|
22216 | return new D3ColorScale(this.scale.copy());
|
22217 | }, D3ColorScale.prototype.getDomain = function() {
|
22218 | return this.scale.domain();
|
22219 | }, D3ColorScale.createFromColors = function(colors) {
|
22220 | return new D3ColorScale(d3.scale.ordinal().range(colors));
|
22221 | }, D3ColorScale;
|
22222 | }();
|
22223 | visuals.D3ColorScale = D3ColorScale;
|
22224 | var ThemeManager = function() {
|
22225 | function ThemeManager() {}
|
22226 | return ThemeManager.getDefaultTheme = function() {
|
22227 | if (!ThemeManager.defaultTheme) {
|
22228 | ThemeManager.defaultTheme = [];
|
22229 | for (var baseColors = ThemeManager.defaultBaseColors, i = 0; i < ThemeManager.colorSectorCount; ++i) for (var j = 0, jlen = baseColors.length; jlen > j; ++j) ThemeManager.defaultTheme.push({
|
22230 | value: jsCommon.Color.rotate(baseColors[j].value, i / ThemeManager.colorSectorCount)
|
22231 | });
|
22232 | }
|
22233 | return ThemeManager.defaultTheme;
|
22234 | }, ThemeManager.colorSectorCount = 12, ThemeManager.defaultBaseColors = [ {
|
22235 | value: "#01B8AA"
|
22236 | }, {
|
22237 | value: "#374649"
|
22238 | }, {
|
22239 | value: "#FD625E"
|
22240 | }, {
|
22241 | value: "#F2C80F"
|
22242 | }, {
|
22243 | value: "#5F6B6D"
|
22244 | }, {
|
22245 | value: "#8AD4EB"
|
22246 | }, {
|
22247 | value: "#FE9666"
|
22248 | }, {
|
22249 | value: "#A66999"
|
22250 | }, {
|
22251 | value: "#3599B8"
|
22252 | }, {
|
22253 | value: "#DFBFBF"
|
22254 | }, {
|
22255 | value: "#4AC5BB"
|
22256 | }, {
|
22257 | value: "#5F6B6D"
|
22258 | }, {
|
22259 | value: "#FB8281"
|
22260 | }, {
|
22261 | value: "#F4D25A"
|
22262 | }, {
|
22263 | value: "#7F898A"
|
22264 | }, {
|
22265 | value: "#A4DDEE"
|
22266 | }, {
|
22267 | value: "#FDAB89"
|
22268 | }, {
|
22269 | value: "#B687AC"
|
22270 | }, {
|
22271 | value: "#28738A"
|
22272 | }, {
|
22273 | value: "#A78F8F"
|
22274 | }, {
|
22275 | value: "#168980"
|
22276 | }, {
|
22277 | value: "#293537"
|
22278 | }, {
|
22279 | value: "#BB4A4A"
|
22280 | }, {
|
22281 | value: "#B59525"
|
22282 | }, {
|
22283 | value: "#475052"
|
22284 | }, {
|
22285 | value: "#6A9FB0"
|
22286 | }, {
|
22287 | value: "#BD7150"
|
22288 | }, {
|
22289 | value: "#7B4F71"
|
22290 | }, {
|
22291 | value: "#1B4D5C"
|
22292 | }, {
|
22293 | value: "#706060"
|
22294 | }, {
|
22295 | value: "#0F5C55"
|
22296 | }, {
|
22297 | value: "#1C2325"
|
22298 | }, {
|
22299 | value: "#7D3231"
|
22300 | }, {
|
22301 | value: "#796419"
|
22302 | }, {
|
22303 | value: "#303637"
|
22304 | }, {
|
22305 | value: "#476A75"
|
22306 | }, {
|
22307 | value: "#7E4B36"
|
22308 | }, {
|
22309 | value: "#52354C"
|
22310 | }, {
|
22311 | value: "#0D262E"
|
22312 | }, {
|
22313 | value: "#544848"
|
22314 | } ], ThemeManager.defaultSentimentColors = [ {
|
22315 | value: "#C0433A"
|
22316 | }, {
|
22317 | value: "#E8D62E"
|
22318 | }, {
|
22319 | value: "#79C75B"
|
22320 | } ], ThemeManager;
|
22321 | }();
|
22322 | visuals.ThemeManager = ThemeManager;
|
22323 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
22324 | }(powerbi || (powerbi = {}));
|
22325 | }, function(module, exports) {
|
22326 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
22327 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
22328 | !function(powerbi) {
|
22329 | var visuals;
|
22330 | !function(visuals) {
|
22331 | var DataDotChart = function() {
|
22332 | function DataDotChart(options) {
|
22333 | this.isScrollable = options.isScrollable, this.interactivityService = options.interactivityService;
|
22334 | }
|
22335 | return DataDotChart.prototype.init = function(options) {
|
22336 | this.options = options, this.svg = options.svg, this.svg.classed(DataDotChart.ClassName, !0),
|
22337 | this.mainGraphicsG = this.svg.append("g").classed("dataDotChartMainGraphicsContext", !0),
|
22338 | this.mainGraphicsContext = this.mainGraphicsG.append("svg"), this.currentViewport = options.viewport,
|
22339 | this.hostService = options.host, this.cartesianVisualHost = options.cartesianHost,
|
22340 | this.style = options.style, this.colors = this.style.colorPalette.dataColors, this.interactivity = options.interactivity,
|
22341 | this.element = options.element;
|
22342 | }, DataDotChart.prototype.setData = function(dataViews) {
|
22343 | if (this.data = {
|
22344 | series: {
|
22345 | data: []
|
22346 | },
|
22347 | hasHighlights: !1,
|
22348 | hasDynamicSeries: !1
|
22349 | }, dataViews.length > 0) {
|
22350 | var dataView = dataViews[0];
|
22351 | if (dataView && dataView.categorical) {
|
22352 | var dataViewCategorical = this.dataViewCategorical = dataView.categorical, dvCategories = dataViewCategorical.categories, categoryType = powerbi.ValueType.fromDescriptor({
|
22353 | text: !0
|
22354 | });
|
22355 | dvCategories && dvCategories.length > 0 && dvCategories[0].source && dvCategories[0].source.type && (categoryType = dvCategories[0].source.type),
|
22356 | this.data = DataDotChart.converter(dataView, visuals.valueFormatter.format(null), this.interactivityService);
|
22357 | }
|
22358 | }
|
22359 | }, DataDotChart.prototype.setFilteredData = function(startIndex, endIndex) {
|
22360 | var data = this.clippedData = powerbi.Prototype.inherit(this.data);
|
22361 | return data && data.series && data.series.data && (data.series = {
|
22362 | data: data.series.data.slice(startIndex, endIndex),
|
22363 | xCol: data.series.xCol,
|
22364 | yCol: data.series.yCol
|
22365 | }), data;
|
22366 | }, DataDotChart.prototype.calculateAxesProperties = function(options) {
|
22367 | var _this = this;
|
22368 | this.currentViewport = options.viewport, this.margin = options.margin;
|
22369 | var data = this.clippedData = this.data, viewport = this.currentViewport, margin = this.margin, series = data ? data.series : null, seriesArray = series && series.data && series.data.length > 0 ? [ series ] : [], categoryCount = series && series.data ? series.data.length : 0;
|
22370 | data.hasHighlights && (categoryCount /= 2);
|
22371 | var xMetaDataColumn, yMetaDataColumn, width = viewport.width - (margin.left + margin.right), height = viewport.height - (margin.top + margin.bottom);
|
22372 | DataDotChart.hasDataPoint(series) && (xMetaDataColumn = series.xCol, yMetaDataColumn = series.yCol);
|
22373 | var layout = visuals.CartesianChart.getLayout(null, {
|
22374 | availableWidth: width,
|
22375 | categoryCount: categoryCount,
|
22376 | domain: null,
|
22377 | isScalar: !1,
|
22378 | isScrollable: this.isScrollable,
|
22379 | trimOrdinalDataOnOverflow: options.trimOrdinalDataOnOverflow
|
22380 | }), outerPadding = layout.categoryThickness * visuals.CartesianChart.OuterPaddingRatio;
|
22381 | this.isScrollable || (this.clippedData = DataDotChart.createClippedDataIfOverflowed(data, layout.categoryCount));
|
22382 | var yDomain = visuals.AxisHelper.createValueDomain(seriesArray, !0) || visuals.emptyDomain, combinedDomain = visuals.AxisHelper.combineDomain(options.forcedYDomain, yDomain, options.ensureYDomain);
|
22383 | this.yAxisProperties = visuals.AxisHelper.createAxis({
|
22384 | pixelSpan: height,
|
22385 | dataDomain: combinedDomain,
|
22386 | metaDataColumn: yMetaDataColumn,
|
22387 | formatString: visuals.valueFormatter.getFormatString(yMetaDataColumn, DataDotChart.formatStringProp),
|
22388 | outerPadding: 0,
|
22389 | isScalar: !0,
|
22390 | isVertical: !0,
|
22391 | forcedTickCount: options.forcedTickCount,
|
22392 | useTickIntervalForDisplayUnits: !0,
|
22393 | isCategoryAxis: !1
|
22394 | });
|
22395 | var axisType = this.xAxisProperties ? this.xAxisProperties.axisType : powerbi.ValueType.fromDescriptor({
|
22396 | text: !0
|
22397 | }), xDomain = visuals.AxisHelper.createDomain(seriesArray, axisType, !1, options.forcedXDomain, options.ensureXDomain);
|
22398 | return this.xAxisProperties = visuals.AxisHelper.createAxis({
|
22399 | pixelSpan: width,
|
22400 | dataDomain: xDomain,
|
22401 | metaDataColumn: xMetaDataColumn,
|
22402 | formatString: visuals.valueFormatter.getFormatString(xMetaDataColumn, DataDotChart.formatStringProp),
|
22403 | outerPadding: outerPadding,
|
22404 | isScalar: !1,
|
22405 | isVertical: !1,
|
22406 | forcedTickCount: options.forcedTickCount,
|
22407 | useTickIntervalForDisplayUnits: !0,
|
22408 | categoryThickness: layout.categoryThickness,
|
22409 | getValueFn: function(index, type) {
|
22410 | return _this.lookupXValue(index, type);
|
22411 | },
|
22412 | isCategoryAxis: !0
|
22413 | }), [ this.xAxisProperties, this.yAxisProperties ];
|
22414 | }, DataDotChart.createClippedDataIfOverflowed = function(data, categoryCount) {
|
22415 | var requiredLength = data.hasHighlights ? Math.min(data.series.data.length, 2 * categoryCount) : Math.min(data.series.data.length, categoryCount);
|
22416 | if (requiredLength >= data.series.data.length) return data;
|
22417 | var clipped = powerbi.Prototype.inherit(data);
|
22418 | return clipped.series = powerbi.Prototype.inherit(data.series), clipped.series.data = clipped.series.data.slice(0, requiredLength),
|
22419 | clipped;
|
22420 | }, DataDotChart.hasDataPoint = function(series) {
|
22421 | return series && series.data && series.data.length > 0;
|
22422 | }, DataDotChart.prototype.lookupXValue = function(index, type) {
|
22423 | var data = this.data, isDateTime = visuals.AxisHelper.isDateTime(type);
|
22424 | if (isDateTime) return new Date(index);
|
22425 | if (data && data.series) {
|
22426 | var seriesData = data.series.data;
|
22427 | if (seriesData) {
|
22428 | var dataAtIndex = seriesData[index];
|
22429 | if (dataAtIndex) return dataAtIndex.categoryValue;
|
22430 | }
|
22431 | }
|
22432 | return index;
|
22433 | }, DataDotChart.prototype.overrideXScale = function(xProperties) {
|
22434 | this.xAxisProperties = xProperties;
|
22435 | }, DataDotChart.prototype.render = function(suppressAnimations) {
|
22436 | var _this = this;
|
22437 | if (this.clippedData) {
|
22438 | var data = this.clippedData, dataPoints = data.series.data, hasHighlights = data.hasHighlights, margin = this.margin, viewport = this.currentViewport, width = viewport.width - (margin.left + margin.right), height = viewport.height - (margin.top + margin.bottom), xScale = this.xAxisProperties.scale, yScale = this.yAxisProperties.scale, dotWidth = this.xAxisProperties.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio), dotRadius = dotWidth / 2, dotColor = this.cartesianVisualHost.getSharedColors().getNewColorScale().getColor(DataDotChart.DotColorKey), hasSelection = this.interactivityService ? this.interactivityService.hasSelection() : !1;
|
22439 | this.mainGraphicsContext.attr("width", width).attr("height", height);
|
22440 | var dots = this.mainGraphicsContext.selectAll(DataDotChart.DotClassSelector).data(dataPoints, function(d) {
|
22441 | return d.identity.getKey();
|
22442 | });
|
22443 | dots.enter().append("circle").classed(DataDotChart.DotClassName, !0), dots.style({
|
22444 | fill: dotColor.value
|
22445 | }).style("fill-opacity", function(d) {
|
22446 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, hasHighlights);
|
22447 | }).classed("null-value", function(d) {
|
22448 | return null === d.value;
|
22449 | }).attr({
|
22450 | r: function(d) {
|
22451 | return dotRadius;
|
22452 | },
|
22453 | cx: function(d) {
|
22454 | return xScale(d.categoryIndex) + dotRadius;
|
22455 | },
|
22456 | cy: function(d) {
|
22457 | return yScale(d.value);
|
22458 | }
|
22459 | }), dots.exit().remove();
|
22460 | var dotLabels = this.mainGraphicsContext.selectAll(DataDotChart.DotLabelClassSelector).data(dataPoints, function(d) {
|
22461 | return d.identity.getKey();
|
22462 | });
|
22463 | dotLabels.enter().append("text").classed(DataDotChart.DotLabelClassName, !0).attr({
|
22464 | "text-anchor": DataDotChart.DotLabelTextAnchor,
|
22465 | dy: DataDotChart.DotLabelVerticalOffset
|
22466 | }), dotLabels.classed("null-value", function(d) {
|
22467 | return null === d.value;
|
22468 | }).classed("overflowed", !1).attr({
|
22469 | x: function(d) {
|
22470 | return xScale(d.categoryIndex) + dotRadius;
|
22471 | },
|
22472 | y: function(d) {
|
22473 | return yScale(d.value);
|
22474 | }
|
22475 | }).text(function(d) {
|
22476 | return _this.yAxisProperties.formatter.format(d.value);
|
22477 | });
|
22478 | var overflowed = !1;
|
22479 | dotLabels.each(function() {
|
22480 | if (!overflowed && !$("<div>").addClass($(this).attr("class")).hasClass("null-value")) {
|
22481 | var width_1 = powerbi.TextMeasurementService.measureSvgTextElementWidth(this);
|
22482 | width_1 > dotWidth && (dotLabels.classed("overflowed", !0), overflowed = !0);
|
22483 | }
|
22484 | }), dotLabels.exit().remove();
|
22485 | var behaviorOptions = void 0;
|
22486 | return this.interactivityService && (behaviorOptions = {
|
22487 | dots: dots,
|
22488 | dotLabels: dotLabels,
|
22489 | datapoints: dataPoints
|
22490 | }), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options), {
|
22491 | dataPoints: dataPoints,
|
22492 | behaviorOptions: behaviorOptions,
|
22493 | labelDataPoints: [],
|
22494 | labelsAreNumeric: !0
|
22495 | };
|
22496 | }
|
22497 | }, DataDotChart.prototype.calculateLegend = function() {
|
22498 | return this.createLegendDataPoints(0);
|
22499 | }, DataDotChart.prototype.hasLegend = function() {
|
22500 | return this.data && this.data.hasDynamicSeries;
|
22501 | }, DataDotChart.prototype.createLegendDataPoints = function(columnIndex) {
|
22502 | var data = this.data;
|
22503 | if (!data) return null;
|
22504 | var category, series = data.series, seriesData = series.data, legendDataPoints = [], axisType = this.xAxisProperties ? this.xAxisProperties.axisType : powerbi.ValueType.fromDescriptor({
|
22505 | text: !0
|
22506 | });
|
22507 | if (data.series && data.series.data) {
|
22508 | var firstDataPoint = data.series.data[0];
|
22509 | category = firstDataPoint && this.lookupXValue(firstDataPoint.categoryValue, axisType);
|
22510 | }
|
22511 | if (series.yCol) {
|
22512 | var formatStringProp = DataDotChart.formatStringProp, lineDataPoint = seriesData[columnIndex], measure = lineDataPoint && lineDataPoint.value, label = visuals.converterHelper.getFormattedLegendLabel(series.yCol, this.dataViewCategorical.values, formatStringProp), dotColor = this.cartesianVisualHost.getSharedColors().getNewColorScale().getColor(DataDotChart.DotColorKey), dataViewCategoricalValues = this.dataViewCategorical.values, identity = dataViewCategoricalValues && dataViewCategoricalValues.length > columnIndex ? visuals.SelectionId.createWithIdAndMeasure(dataViewCategoricalValues[columnIndex].identity, dataViewCategoricalValues[columnIndex].source.queryName) : visuals.SelectionId.createWithMeasure(dataViewCategoricalValues.source.queryName);
|
22513 | legendDataPoints.push({
|
22514 | color: dotColor.value,
|
22515 | icon: visuals.LegendIcon.Line,
|
22516 | label: label,
|
22517 | category: visuals.valueFormatter.format(category, visuals.valueFormatter.getFormatString(series.xCol, formatStringProp)),
|
22518 | measure: visuals.valueFormatter.format(measure, visuals.valueFormatter.getFormatString(series.yCol, formatStringProp)),
|
22519 | identity: identity,
|
22520 | selected: !1
|
22521 | });
|
22522 | }
|
22523 | return {
|
22524 | dataPoints: legendDataPoints
|
22525 | };
|
22526 | }, DataDotChart.prototype.onClearSelection = function() {
|
22527 | this.interactivityService && this.interactivityService.clearSelection();
|
22528 | }, DataDotChart.converter = function(dataView, blankCategoryValue, interactivityService) {
|
22529 | var categorical = dataView.categorical, category = categorical.categories && categorical.categories.length > 0 ? categorical.categories[0] : {
|
22530 | source: void 0,
|
22531 | values: [ blankCategoryValue ],
|
22532 | identity: void 0
|
22533 | }, categoryType = visuals.AxisHelper.getCategoryValueType(category.source), isDateTime = visuals.AxisHelper.isDateTime(categoryType), categoryValues = category.values;
|
22534 | if (!_.isEmpty(categorical.values)) {
|
22535 | for (var measure = categorical.values[0], hasHighlights = !!measure.highlights, dataPoints = [], categoryIndex = 0, len = measure.values.length; len > categoryIndex; categoryIndex++) {
|
22536 | var identity = category.identity ? visuals.SelectionId.createWithIdAndMeasure(category.identity[categoryIndex], measure.source.queryName) : visuals.SelectionId.createWithMeasure(measure.source.queryName), categoryValue = categoryValues[categoryIndex];
|
22537 | if ((!isDateTime || null == categoryValue || categoryValue instanceof Date) && (dataPoints.push({
|
22538 | categoryValue: isDateTime && categoryValue ? categoryValue.getTime() : categoryValue,
|
22539 | value: measure.values[categoryIndex],
|
22540 | categoryIndex: categoryIndex,
|
22541 | seriesIndex: 0,
|
22542 | selected: !1,
|
22543 | identity: identity,
|
22544 | highlight: !1
|
22545 | }), hasHighlights)) {
|
22546 | var highlightIdentity = visuals.SelectionId.createWithHighlight(identity), highlightValue = measure.highlights[categoryIndex];
|
22547 | dataPoints.push({
|
22548 | categoryValue: isDateTime && categoryValue ? categoryValue.getTime() : categoryValue,
|
22549 | value: highlightValue,
|
22550 | categoryIndex: categoryIndex,
|
22551 | seriesIndex: 0,
|
22552 | selected: !1,
|
22553 | identity: highlightIdentity,
|
22554 | highlight: !0
|
22555 | });
|
22556 | }
|
22557 | }
|
22558 | return interactivityService && interactivityService.applySelectionStateToData(dataPoints),
|
22559 | {
|
22560 | series: {
|
22561 | xCol: category.source,
|
22562 | yCol: measure.source,
|
22563 | data: dataPoints
|
22564 | },
|
22565 | hasHighlights: hasHighlights,
|
22566 | hasDynamicSeries: !0
|
22567 | };
|
22568 | }
|
22569 | return {
|
22570 | series: {
|
22571 | data: []
|
22572 | },
|
22573 | hasHighlights: !1,
|
22574 | hasDynamicSeries: !1
|
22575 | };
|
22576 | }, DataDotChart.formatStringProp = {
|
22577 | objectName: "general",
|
22578 | propertyName: "formatString"
|
22579 | }, DataDotChart.ClassName = "dataDotChart", DataDotChart.DotClassName = "dot", DataDotChart.DotClassSelector = ".dot",
|
22580 | DataDotChart.DotColorKey = "dataDot", DataDotChart.DotLabelClassName = "label",
|
22581 | DataDotChart.DotLabelClassSelector = ".label", DataDotChart.DotLabelVerticalOffset = "0.4em",
|
22582 | DataDotChart.DotLabelTextAnchor = "middle", DataDotChart;
|
22583 | }();
|
22584 | visuals.DataDotChart = DataDotChart;
|
22585 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
22586 | }(powerbi || (powerbi = {}));
|
22587 | }, function(module, exports) {
|
22588 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
22589 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
22590 | !function(powerbi) {
|
22591 | var visuals;
|
22592 | !function(visuals) {
|
22593 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter, LabelUtils = visuals.NewDataLabelUtils, FunnelChart = function() {
|
22594 | function FunnelChart(options) {
|
22595 | this.labelPositionObjects = [ visuals.labelPosition.outsideEnd, visuals.labelPosition.insideCenter ],
|
22596 | options && (this.tooltipsEnabled = options.tooltipsEnabled, this.tooltipBucketEnabled = options.tooltipBucketEnabled,
|
22597 | options.funnelSmallViewPortProperties && (this.funnelSmallViewPortProperties = options.funnelSmallViewPortProperties),
|
22598 | options.animator && (this.animator = options.animator), options.behavior && (this.behavior = options.behavior));
|
22599 | }
|
22600 | return FunnelChart.converter = function(dataView, colors, hostServices, defaultDataPointColor, tooltipsEnabled, tooltipBucketEnabled) {
|
22601 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
22602 | for (var reader = powerbi.data.createIDataViewCategoricalReader(dataView), dataPoints = [], formatStringProp = visuals.funnelChartProps.general.formatString, categorical = dataView.categorical, hasHighlights = reader.hasHighlights("Y"), valueMetaData = [], seriesIndex = 0, seriesCount = reader.getSeriesCount("Y"); seriesCount > seriesIndex; seriesIndex++) valueMetaData.push(reader.getValueMetadataColumn("Y", seriesIndex));
|
22603 | var firstValue, firstHighlight, previousValue, previousHighlight, highlightsOverflow = !1, hasNegativeValues = !1, allValuesAreNegative = !1, categoryLabels = [], dataLabelsSettings = this.getDefaultLabelSettings(), percentBarLabelSettings = this.getDefaultPercentLabelSettings(), colorHelper = new visuals.ColorHelper(colors, visuals.funnelChartProps.dataPoint.fill, defaultDataPointColor), gradientValueColumn = visuals.GradientUtils.getGradientValueColumn(categorical);
|
22604 | if (dataView && dataView.metadata && dataView.metadata.objects) {
|
22605 | var labelsObj = dataView.metadata.objects.labels;
|
22606 | labelsObj && visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(labelsObj, dataLabelsSettings);
|
22607 | var percentLabelsObj = dataView.metadata.objects.percentBarLabel;
|
22608 | percentLabelsObj && visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(percentLabelsObj, percentBarLabelSettings);
|
22609 | }
|
22610 | if (!reader.hasValues("Y")) return {
|
22611 | dataPoints: dataPoints,
|
22612 | categoryLabels: categoryLabels,
|
22613 | valuesMetadata: valueMetaData,
|
22614 | hasHighlights: hasHighlights,
|
22615 | highlightsOverflow: highlightsOverflow,
|
22616 | canShowDataLabels: !0,
|
22617 | dataLabelsSettings: dataLabelsSettings,
|
22618 | hasNegativeValues: hasNegativeValues,
|
22619 | allValuesAreNegative: allValuesAreNegative,
|
22620 | percentBarLabelSettings: percentBarLabelSettings
|
22621 | };
|
22622 | firstValue = reader.getValue("Y", 0, 0), hasHighlights && (firstHighlight = reader.getHighlight("Y", 0, 0));
|
22623 | var pctFormatString = visuals.valueFormatter.getLocalizedString("Percentage");
|
22624 | if (reader.hasCategories()) for (var categoryIndex = 0, categoryCount = reader.getCategoryCount(); categoryCount > categoryIndex; categoryIndex++) {
|
22625 | var categoryColumn = reader.getCategoryColumn("Category"), categoryValue = reader.getCategoryValue("Category", categoryIndex), valueMetadataColumn = reader.getValueMetadataColumn("Y"), identity = visuals.SelectionIdBuilder.builder().withCategory(categoryColumn, categoryIndex).withMeasure(valueMetadataColumn.queryName).createSelectionId(), value = reader.getValue("Y", categoryIndex), formattedCategoryValue = visuals.converterHelper.formatFromMetadataColumn(categoryValue, categoryColumn.source, formatStringProp), tooltipInfo = void 0;
|
22626 | if (tooltipsEnabled) {
|
22627 | tooltipInfo = [], tooltipInfo.push({
|
22628 | displayName: categoryColumn.source.displayName,
|
22629 | value: formattedCategoryValue
|
22630 | }), null != value && tooltipInfo.push({
|
22631 | displayName: valueMetadataColumn.displayName,
|
22632 | value: visuals.converterHelper.formatFromMetadataColumn(value, valueMetadataColumn, formatStringProp)
|
22633 | });
|
22634 | var highlightValue = void 0;
|
22635 | hasHighlights && (highlightValue = reader.getHighlight("Y", categoryIndex), null != highlightValue && tooltipInfo.push({
|
22636 | displayName: visuals.ToolTipComponent.localizationOptions.highlightedValueDisplayName,
|
22637 | value: visuals.converterHelper.formatFromMetadataColumn(highlightValue, valueMetadataColumn, formatStringProp)
|
22638 | }));
|
22639 | var gradientColumnMetadata = gradientValueColumn ? gradientValueColumn.source : void 0;
|
22640 | gradientColumnMetadata && gradientColumnMetadata !== valueMetadataColumn && null != gradientValueColumn.values[categoryIndex] && tooltipInfo.push({
|
22641 | displayName: gradientColumnMetadata.displayName,
|
22642 | value: visuals.converterHelper.formatFromMetadataColumn(reader.getValue("Gradient", categoryIndex), gradientColumnMetadata, formatStringProp)
|
22643 | }), hasHighlights ? FunnelChart.addFunnelPercentsToTooltip(pctFormatString, tooltipInfo, hostServices, firstHighlight ? highlightValue / firstHighlight : null, previousHighlight ? highlightValue / previousHighlight : null, !0) : FunnelChart.addFunnelPercentsToTooltip(pctFormatString, tooltipInfo, hostServices, firstValue ? value / firstValue : null, previousValue ? value / previousValue : null),
|
22644 | tooltipBucketEnabled && visuals.TooltipBuilder.addTooltipBucketItem(reader, tooltipInfo, categoryIndex);
|
22645 | }
|
22646 | var color = colorHelper.getColorForMeasure(reader.getCategoryObjects("Category", categoryIndex), "");
|
22647 | if (dataPoints.push({
|
22648 | label: formattedCategoryValue,
|
22649 | value: value,
|
22650 | originalValue: value,
|
22651 | categoryOrMeasureIndex: categoryIndex,
|
22652 | identity: identity,
|
22653 | selected: !1,
|
22654 | key: identity.getKey(),
|
22655 | tooltipInfo: tooltipInfo,
|
22656 | color: color,
|
22657 | labelFill: dataLabelsSettings.labelColor
|
22658 | }), hasHighlights) {
|
22659 | var highlightIdentity = visuals.SelectionId.createWithHighlight(identity), highlightValue = reader.getHighlight("Y", categoryIndex);
|
22660 | dataPoints.push({
|
22661 | label: formattedCategoryValue,
|
22662 | value: value,
|
22663 | originalValue: value,
|
22664 | categoryOrMeasureIndex: categoryIndex,
|
22665 | identity: highlightIdentity,
|
22666 | selected: !1,
|
22667 | key: highlightIdentity.getKey(),
|
22668 | highlight: !0,
|
22669 | highlightValue: highlightValue,
|
22670 | originalHighlightValue: highlightValue,
|
22671 | tooltipInfo: tooltipInfo,
|
22672 | color: color
|
22673 | }), previousHighlight = highlightValue;
|
22674 | }
|
22675 | previousValue = value;
|
22676 | } else for (var categoryIndex = 0, seriesIndex = 0, seriesCount = reader.getSeriesCount("Y"); seriesCount > seriesIndex; seriesIndex++) {
|
22677 | var value = reader.getValue("Y", categoryIndex, seriesIndex), valueMetadataColumn = reader.getValueMetadataColumn("Y", seriesIndex), identity = visuals.SelectionId.createWithMeasure(valueMetadataColumn.queryName), tooltipInfo = void 0, color = colorHelper.getColorForMeasure(valueMetadataColumn.objects, "");
|
22678 | if (tooltipsEnabled) {
|
22679 | if (tooltipInfo = [], null != value && tooltipInfo.push({
|
22680 | displayName: valueMetadataColumn.displayName,
|
22681 | value: visuals.converterHelper.formatFromMetadataColumn(value, valueMetadataColumn, formatStringProp)
|
22682 | }), hasHighlights) {
|
22683 | var highlightValue = reader.getHighlight("Y", categoryIndex, seriesIndex);
|
22684 | null != highlightValue && tooltipInfo.push({
|
22685 | displayName: visuals.ToolTipComponent.localizationOptions.highlightedValueDisplayName,
|
22686 | value: visuals.converterHelper.formatFromMetadataColumn(highlightValue, valueMetadataColumn, formatStringProp)
|
22687 | }), FunnelChart.addFunnelPercentsToTooltip(pctFormatString, tooltipInfo, hostServices, firstHighlight ? highlightValue / firstHighlight : null, previousHighlight ? highlightValue / previousHighlight : null, !0);
|
22688 | } else FunnelChart.addFunnelPercentsToTooltip(pctFormatString, tooltipInfo, hostServices, firstValue ? value / firstValue : null, previousValue ? value / previousValue : null);
|
22689 | if (tooltipBucketEnabled) {
|
22690 | var tooltipValues = reader.getAllValuesForRole("Tooltips", categoryIndex, void 0), tooltipMetadataColumns = reader.getAllValueMetadataColumnsForRole("Tooltips", void 0);
|
22691 | if (tooltipValues && tooltipMetadataColumns) for (var j = 0; j < tooltipValues.length; j++) null != tooltipValues[j] && tooltipInfo.push({
|
22692 | displayName: tooltipMetadataColumns[j].displayName,
|
22693 | value: visuals.converterHelper.formatFromMetadataColumn(tooltipValues[j], tooltipMetadataColumns[j], formatStringProp)
|
22694 | });
|
22695 | }
|
22696 | }
|
22697 | if (dataPoints.push({
|
22698 | label: valueMetadataColumn.displayName,
|
22699 | value: value,
|
22700 | originalValue: value,
|
22701 | categoryOrMeasureIndex: seriesIndex,
|
22702 | identity: identity,
|
22703 | selected: !1,
|
22704 | key: identity.getKey(),
|
22705 | tooltipInfo: tooltipInfo,
|
22706 | color: color,
|
22707 | labelFill: dataLabelsSettings.labelColor
|
22708 | }), hasHighlights) {
|
22709 | var highlightIdentity = visuals.SelectionId.createWithHighlight(identity), highlight = reader.getHighlight("Y", categoryIndex, seriesIndex);
|
22710 | dataPoints.push({
|
22711 | label: valueMetadataColumn.displayName,
|
22712 | value: value,
|
22713 | originalValue: value,
|
22714 | categoryOrMeasureIndex: seriesIndex,
|
22715 | identity: highlightIdentity,
|
22716 | key: highlightIdentity.getKey(),
|
22717 | selected: !1,
|
22718 | highlight: !0,
|
22719 | originalHighlightValue: highlight,
|
22720 | highlightValue: highlight,
|
22721 | tooltipInfo: tooltipInfo,
|
22722 | color: color
|
22723 | }), previousHighlight = highlight;
|
22724 | }
|
22725 | previousValue = value;
|
22726 | }
|
22727 | for (var i = 0; i < dataPoints.length; i += hasHighlights ? 2 : 1) {
|
22728 | var dataPoint = dataPoints[i];
|
22729 | categoryLabels.push(dataPoint.label);
|
22730 | }
|
22731 | allValuesAreNegative = dataPoints.length > 0 && _.every(dataPoints, function(dataPoint) {
|
22732 | return (dataPoint.highlight ? dataPoint.highlightValue <= 0 : !0) && dataPoint.value < 0;
|
22733 | });
|
22734 | for (var _i = 0, dataPoints_1 = dataPoints; _i < dataPoints_1.length; _i++) {
|
22735 | var dataPoint = dataPoints_1[_i];
|
22736 | if (allValuesAreNegative) dataPoint.value = Math.abs(dataPoint.value), dataPoint.highlight && (dataPoint.highlightValue = Math.abs(dataPoint.highlightValue)); else {
|
22737 | var value = dataPoint.value, isValueNegative = 0 > value;
|
22738 | isValueNegative && (dataPoint.value = 0);
|
22739 | var isHighlightValueNegative = !1;
|
22740 | if (dataPoint.highlight) {
|
22741 | var highlightValue = dataPoint.highlightValue;
|
22742 | isHighlightValueNegative = 0 > highlightValue, dataPoint.highlightValue = isHighlightValueNegative ? 0 : highlightValue;
|
22743 | }
|
22744 | hasNegativeValues || (hasNegativeValues = isValueNegative || isHighlightValueNegative);
|
22745 | }
|
22746 | dataPoint.highlightValue > dataPoint.value && (highlightsOverflow = !0);
|
22747 | }
|
22748 | return {
|
22749 | dataPoints: dataPoints,
|
22750 | categoryLabels: categoryLabels,
|
22751 | valuesMetadata: valueMetaData,
|
22752 | hasHighlights: hasHighlights,
|
22753 | highlightsOverflow: highlightsOverflow,
|
22754 | canShowDataLabels: !0,
|
22755 | dataLabelsSettings: dataLabelsSettings,
|
22756 | hasNegativeValues: hasNegativeValues,
|
22757 | allValuesAreNegative: allValuesAreNegative,
|
22758 | percentBarLabelSettings: percentBarLabelSettings
|
22759 | };
|
22760 | }, FunnelChart.prototype.enumerateObjectInstances = function(options) {
|
22761 | var enumeration = new visuals.ObjectEnumerationBuilder();
|
22762 | switch (options.objectName) {
|
22763 | case "dataPoint":
|
22764 | var dataViewCat = this.dataViews && this.dataViews.length > 0 && this.dataViews[0] && this.dataViews[0].categorical, hasGradientRole = visuals.GradientUtils.hasGradientRole(dataViewCat);
|
22765 | hasGradientRole || this.enumerateDataPoints(enumeration);
|
22766 | break;
|
22767 |
|
22768 | case "labels":
|
22769 | var labelSettingsOptions = FunnelChart.getLabelSettingsOptions(enumeration, this.data.dataLabelsSettings, !0, this.labelPositionObjects);
|
22770 | visuals.dataLabelUtils.enumerateDataLabels(labelSettingsOptions);
|
22771 | break;
|
22772 |
|
22773 | case "percentBarLabel":
|
22774 | var percentLabelSettingOptions = FunnelChart.getLabelSettingsOptions(enumeration, this.data.percentBarLabelSettings, !1);
|
22775 | visuals.dataLabelUtils.enumerateDataLabels(percentLabelSettingOptions);
|
22776 | }
|
22777 | return enumeration.complete();
|
22778 | }, FunnelChart.getLabelSettingsOptions = function(enumeration, labelSettings, isDataLabels, positionObject) {
|
22779 | return {
|
22780 | enumeration: enumeration,
|
22781 | dataLabelsSettings: labelSettings,
|
22782 | show: !0,
|
22783 | displayUnits: isDataLabels,
|
22784 | precision: isDataLabels,
|
22785 | position: isDataLabels,
|
22786 | positionObject: positionObject,
|
22787 | fontSize: !0
|
22788 | };
|
22789 | }, FunnelChart.prototype.enumerateDataPoints = function(enumeration) {
|
22790 | var data = this.data;
|
22791 | if (data) {
|
22792 | var dataPoints = data.dataPoints;
|
22793 | enumeration.pushInstance({
|
22794 | objectName: "dataPoint",
|
22795 | selector: null,
|
22796 | properties: {
|
22797 | defaultColor: {
|
22798 | solid: {
|
22799 | color: this.defaultDataPointColor || this.colors.getColorByIndex(0).value
|
22800 | }
|
22801 | }
|
22802 | }
|
22803 | });
|
22804 | for (var i = 0; i < dataPoints.length; i++) {
|
22805 | var dataPont = dataPoints[i];
|
22806 | if (!dataPont.highlight) {
|
22807 | var color = dataPont.color, selector = dataPont.identity.getSelector(), isSingleSeries = !!selector.data;
|
22808 | enumeration.pushInstance({
|
22809 | objectName: "dataPoint",
|
22810 | displayName: dataPont.label,
|
22811 | selector: visuals.ColorHelper.normalizeSelector(selector, isSingleSeries),
|
22812 | properties: {
|
22813 | fill: {
|
22814 | solid: {
|
22815 | color: color
|
22816 | }
|
22817 | }
|
22818 | }
|
22819 | });
|
22820 | }
|
22821 | }
|
22822 | }
|
22823 | }, FunnelChart.prototype.init = function(options) {
|
22824 | this.options = options;
|
22825 | var element = options.element, svg = this.svg = d3.select(element.get(0)).append("svg").classed(FunnelChart.VisualClassName, !0);
|
22826 | this.behavior && (this.clearCatcher = visuals.appendClearCatcher(this.svg)), this.currentViewport = options.viewport,
|
22827 | this.margin = {
|
22828 | left: 5,
|
22829 | right: 5,
|
22830 | top: 0,
|
22831 | bottom: 0
|
22832 | };
|
22833 | var style = options.style;
|
22834 | this.colors = style.colorPalette.dataColors, this.hostServices = options.host, this.behavior && (this.interactivityService = visuals.createInteractivityService(this.hostServices)),
|
22835 | this.percentGraphicsContext = svg.append("g").classed(FunnelChart.Selectors.percentBar.root["class"], !0),
|
22836 | this.funnelGraphicsContext = svg.append("g"), this.axisGraphicsContext = svg.append("g"),
|
22837 | this.labelGraphicsContext = svg.append("g").classed(LabelUtils.labelGraphicsContextClass["class"], !0),
|
22838 | this.updateViewportProperties();
|
22839 | }, FunnelChart.prototype.updateViewportProperties = function() {
|
22840 | var viewport = this.currentViewport;
|
22841 | this.svg.attr("width", viewport.width).attr("height", viewport.height);
|
22842 | }, FunnelChart.prototype.update = function(options) {
|
22843 | this.data = {
|
22844 | dataPoints: [],
|
22845 | categoryLabels: [],
|
22846 | valuesMetadata: [],
|
22847 | hasHighlights: !1,
|
22848 | highlightsOverflow: !1,
|
22849 | canShowDataLabels: !0,
|
22850 | dataLabelsSettings: visuals.dataLabelUtils.getDefaultLabelSettings(),
|
22851 | hasNegativeValues: !1,
|
22852 | allValuesAreNegative: !1,
|
22853 | percentBarLabelSettings: visuals.dataLabelUtils.getDefaultLabelSettings(!0)
|
22854 | };
|
22855 | var dataViews = this.dataViews = options.dataViews;
|
22856 | if (this.currentViewport = options.viewport, dataViews && dataViews.length > 0) {
|
22857 | var dataView = dataViews[0];
|
22858 | if (dataView.metadata && dataView.metadata.objects) {
|
22859 | var defaultColor = powerbi.DataViewObjects.getFillColor(dataView.metadata.objects, visuals.funnelChartProps.dataPoint.defaultColor);
|
22860 | defaultColor && (this.defaultDataPointColor = defaultColor);
|
22861 | }
|
22862 | dataView.categorical && (this.data = FunnelChart.converter(dataView, this.colors, this.hostServices, this.defaultDataPointColor, this.tooltipsEnabled, this.tooltipBucketEnabled),
|
22863 | this.interactivityService && this.interactivityService.applySelectionStateToData(this.data.dataPoints));
|
22864 | var warnings = visuals.getInvalidValueWarnings(dataViews, !1, !1, !1);
|
22865 | this.data.allValuesAreNegative ? warnings.push(new visuals.AllNegativeValuesWarning()) : this.data.hasNegativeValues && warnings.push(new visuals.NegativeValuesNotSupportedWarning()),
|
22866 | this.hostServices.setWarnings(warnings);
|
22867 | }
|
22868 | this.updateViewportProperties(), this.updateInternal(options.suppressAnimations);
|
22869 | }, FunnelChart.prototype.onDataChanged = function(options) {
|
22870 | this.update({
|
22871 | dataViews: options.dataViews,
|
22872 | suppressAnimations: options.suppressAnimations,
|
22873 | viewport: this.currentViewport
|
22874 | });
|
22875 | }, FunnelChart.prototype.onResizing = function(viewport) {
|
22876 | this.currentViewport = viewport, this.update({
|
22877 | dataViews: this.dataViews,
|
22878 | suppressAnimations: !0,
|
22879 | viewport: this.currentViewport
|
22880 | });
|
22881 | }, FunnelChart.prototype.getMaxLabelLength = function(labels, properties) {
|
22882 | for (var max = 0, textMeasurer = powerbi.TextMeasurementService.measureSvgTextWidth, i = 0, len = labels.length; len > i; i++) properties.text = labels[i],
|
22883 | max = Math.max(max, textMeasurer(properties));
|
22884 | return max + FunnelChart.LabelFunnelPadding;
|
22885 | }, FunnelChart.prototype.updateInternal = function(suppressAnimations) {
|
22886 | if (null != this.data) {
|
22887 | var data = this.data, dataPoints = data.dataPoints, dataPointsWithoutHighlights = dataPoints.filter(function(d) {
|
22888 | return !d.highlight;
|
22889 | }), isHidingPercentBars = this.isHidingPercentBars(), axisOptions = this.setUpAxis(), margin = axisOptions.margin, funnelContext = this.funnelGraphicsContext.attr("transform", visuals.SVGUtil.translate(margin.left, margin.top)), labelContext = this.labelGraphicsContext.attr("transform", visuals.SVGUtil.translate(margin.left, margin.top));
|
22890 | this.percentGraphicsContext.attr("transform", visuals.SVGUtil.translate(margin.left, margin.top)),
|
22891 | this.svg.style("font-family", visuals.dataLabelUtils.StandardFontFamily);
|
22892 | var result, shapes, layout = FunnelChart.getLayout(data, axisOptions), labels = this.getLabels(layout);
|
22893 | if (this.animator && !suppressAnimations) {
|
22894 | var animationOptions = {
|
22895 | viewModel: data,
|
22896 | interactivityService: this.interactivityService,
|
22897 | layout: layout,
|
22898 | axisGraphicsContext: this.axisGraphicsContext,
|
22899 | shapeGraphicsContext: funnelContext,
|
22900 | percentGraphicsContext: this.percentGraphicsContext,
|
22901 | labelGraphicsContext: this.labelGraphicsContext,
|
22902 | axisOptions: axisOptions,
|
22903 | dataPointsWithoutHighlights: dataPointsWithoutHighlights,
|
22904 | labelLayout: labels,
|
22905 | isHidingPercentBars: isHidingPercentBars,
|
22906 | visualInitOptions: this.options
|
22907 | };
|
22908 | result = this.animator.animate(animationOptions), shapes = result.shapes;
|
22909 | }
|
22910 | if ((!this.animator || suppressAnimations || result.failed) && (FunnelChart.drawDefaultAxis(this.axisGraphicsContext, axisOptions, isHidingPercentBars),
|
22911 | shapes = FunnelChart.drawDefaultShapes(data, dataPoints, funnelContext, layout, this.interactivityService && this.interactivityService.hasSelection()),
|
22912 | FunnelChart.drawPercentBars(data, this.percentGraphicsContext, layout, isHidingPercentBars),
|
22913 | LabelUtils.drawDefaultLabels(labelContext, labels, !1)), this.interactivityService) {
|
22914 | var interactors = FunnelChart.drawInteractorShapes(dataPoints, funnelContext, layout), behaviorOptions = {
|
22915 | bars: shapes,
|
22916 | interactors: interactors,
|
22917 | clearCatcher: this.clearCatcher,
|
22918 | hasHighlights: data.hasHighlights
|
22919 | };
|
22920 | this.interactivityService.bind(dataPoints, this.behavior, behaviorOptions), this.tooltipsEnabled && visuals.TooltipManager.addTooltip(interactors, function(tooltipEvent) {
|
22921 | return tooltipEvent.data.tooltipInfo;
|
22922 | });
|
22923 | }
|
22924 | this.tooltipsEnabled && visuals.TooltipManager.addTooltip(shapes, function(tooltipEvent) {
|
22925 | return tooltipEvent.data.tooltipInfo;
|
22926 | }), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options);
|
22927 | }
|
22928 | }, FunnelChart.prototype.getUsableVerticalSpace = function() {
|
22929 | var categoryLabels = this.data.categoryLabels, margin = this.margin, verticalSpace = this.currentViewport.height - (margin.top + margin.bottom);
|
22930 | return verticalSpace - FunnelChart.MinBarThickness * categoryLabels.length;
|
22931 | }, FunnelChart.prototype.isHidingPercentBars = function() {
|
22932 | var data = this.data;
|
22933 | if (data.percentBarLabelSettings.show) {
|
22934 | var percentBarTextHeight = this.getPercentBarTextHeight(), verticalSpace = this.getUsableVerticalSpace() - 2 * FunnelChart.MinBarThickness * FunnelChart.PercentBarToBarRatio - 2 * percentBarTextHeight;
|
22935 | return 0 >= verticalSpace;
|
22936 | }
|
22937 | return !0;
|
22938 | }, FunnelChart.prototype.isSparklines = function() {
|
22939 | return this.getUsableVerticalSpace() <= 0;
|
22940 | }, FunnelChart.prototype.setUpAxis = function() {
|
22941 | var data = this.data, dataPoints = data.dataPoints, categoryLabels = data.categoryLabels, viewport = this.currentViewport, margin = this.margin, isSparklines = this.isSparklines(), isHidingPercentBars = this.isHidingPercentBars(), percentBarTextHeight = isHidingPercentBars ? 0 : this.getPercentBarTextHeight(), verticalRange = viewport.height - (margin.top + margin.bottom) - 2 * percentBarTextHeight, maxMarginFactor = FunnelChart.MaxMarginFactor;
|
22942 | if (categoryLabels.length > 0 && isSparklines) categoryLabels = [], data.canShowDataLabels = !1; else if (this.showCategoryLabels()) {
|
22943 | var textProperties = FunnelChart.getTextProperties(), longestLabelLength = this.getMaxLabelLength(categoryLabels, textProperties), maxLabelLength = viewport.width * maxMarginFactor, labelLength = Math.min(longestLabelLength, maxLabelLength);
|
22944 | margin.left = labelLength + FunnelChart.YAxisPadding;
|
22945 | } else categoryLabels = [];
|
22946 | var horizontalRange = viewport.width - (margin.left + margin.right), barToSpaceRatio = FunnelChart.BarToSpaceRatio, maxScore = d3.max(dataPoints.map(function(d) {
|
22947 | return d.value;
|
22948 | }));
|
22949 | if (data.hasHighlights) {
|
22950 | var maxHighlight = d3.max(dataPoints.map(function(d) {
|
22951 | return d.highlightValue;
|
22952 | }));
|
22953 | maxScore = d3.max([ maxScore, maxHighlight ]);
|
22954 | }
|
22955 | var delta, minScore = 0, rangeStart = 0, rangeEnd = verticalRange;
|
22956 | delta = isHidingPercentBars ? verticalRange - categoryLabels.length * FunnelChart.MaxBarHeight : verticalRange - categoryLabels.length * FunnelChart.MaxBarHeight - 2 * FunnelChart.MaxBarHeight * FunnelChart.PercentBarToBarRatio,
|
22957 | categoryLabels.length > 0 && delta > 0 && (rangeStart = Math.ceil(delta / 2), rangeEnd = Math.ceil(verticalRange - delta / 2)),
|
22958 | isHidingPercentBars || (rangeStart += percentBarTextHeight, rangeEnd += percentBarTextHeight);
|
22959 | var valueScale = d3.scale.linear().domain([ minScore, maxScore ]).range([ horizontalRange, 0 ]), categoryScale = d3.scale.ordinal().domain(d3.range(0, data.categoryLabels.length)).rangeBands([ rangeStart, rangeEnd ], barToSpaceRatio, isHidingPercentBars ? barToSpaceRatio : FunnelChart.PercentBarToBarRatio);
|
22960 | return {
|
22961 | margin: margin,
|
22962 | valueScale: valueScale,
|
22963 | categoryScale: categoryScale,
|
22964 | maxScore: maxScore,
|
22965 | maxWidth: horizontalRange,
|
22966 | rangeStart: rangeStart,
|
22967 | rangeEnd: rangeEnd,
|
22968 | barToSpaceRatio: barToSpaceRatio,
|
22969 | categoryLabels: categoryLabels
|
22970 | };
|
22971 | }, FunnelChart.prototype.getPercentBarTextHeight = function() {
|
22972 | var percentBarTextProperties = FunnelChart.getTextProperties(this.data.percentBarLabelSettings.fontSize);
|
22973 | return powerbi.TextMeasurementService.estimateSvgTextHeight(percentBarTextProperties);
|
22974 | }, FunnelChart.prototype.onClearSelection = function() {
|
22975 | this.interactivityService && this.interactivityService.clearSelection();
|
22976 | }, FunnelChart.getLayout = function(data, axisOptions) {
|
22977 | var highlightsOverflow = data.highlightsOverflow, categoryScale = axisOptions.categoryScale, valueScale = axisOptions.valueScale, maxScore = axisOptions.maxScore, columnHeight = categoryScale.rangeBand(), percentBarTickHeight = Math.ceil(columnHeight / 2), overFlowHighlightColumnWidth = columnHeight * FunnelChart.OverflowingHighlightWidthRatio, overFlowHighlightOffset = overFlowHighlightColumnWidth / 2, lastCategoryIndex = axisOptions.categoryLabels.length - 1, horizontalDistance = Math.abs(valueScale(maxScore) - valueScale(0)), emptyHorizontalSpace = function(value) {
|
22978 | return (horizontalDistance - Math.abs(valueScale(value) - valueScale(0))) / 2;
|
22979 | }, getMinimumShapeSize = function(value) {
|
22980 | return Math.max(FunnelChart.MinimumInteractorSize, Math.abs(valueScale(value) - valueScale(0)));
|
22981 | }, percentBarFontSize = PixelConverter.fromPoint(data.percentBarLabelSettings.fontSize), percentBarTextProperties = FunnelChart.getTextProperties(data.percentBarLabelSettings.fontSize), baselineDelta = powerbi.TextMeasurementService.estimateSvgTextBaselineDelta(percentBarTextProperties), percentBarYOffset = powerbi.TextMeasurementService.estimateSvgTextHeight(percentBarTextProperties) - baselineDelta;
|
22982 | return {
|
22983 | percentBarLayout: {
|
22984 | mainLine: {
|
22985 | x2: function(d) {
|
22986 | return Math.abs(valueScale(d.value) - valueScale(0));
|
22987 | },
|
22988 | transform: function(d) {
|
22989 | var xOffset = valueScale(d.value) - emptyHorizontalSpace(d.value), yOffset = d.isTop ? categoryScale(0) - percentBarTickHeight : categoryScale(lastCategoryIndex) + columnHeight + percentBarTickHeight;
|
22990 | return visuals.SVGUtil.translate(xOffset, yOffset);
|
22991 | }
|
22992 | },
|
22993 | leftTick: {
|
22994 | y2: function(d) {
|
22995 | return percentBarTickHeight;
|
22996 | },
|
22997 | transform: function(d) {
|
22998 | var xOffset = valueScale(d.value) - emptyHorizontalSpace(d.value), yOffset = d.isTop ? categoryScale(0) - percentBarTickHeight - percentBarTickHeight / 2 : categoryScale(lastCategoryIndex) + columnHeight + percentBarTickHeight - percentBarTickHeight / 2;
|
22999 | return visuals.SVGUtil.translate(xOffset, yOffset);
|
23000 | }
|
23001 | },
|
23002 | rightTick: {
|
23003 | y2: function(d) {
|
23004 | return percentBarTickHeight;
|
23005 | },
|
23006 | transform: function(d) {
|
23007 | var columnOffset = valueScale(d.value) - emptyHorizontalSpace(d.value), columnWidth = Math.abs(valueScale(d.value) - valueScale(0)), xOffset = columnOffset + columnWidth, yOffset = d.isTop ? categoryScale(0) - percentBarTickHeight - percentBarTickHeight / 2 : categoryScale(lastCategoryIndex) + columnHeight + percentBarTickHeight - percentBarTickHeight / 2;
|
23008 | return visuals.SVGUtil.translate(xOffset, yOffset);
|
23009 | }
|
23010 | },
|
23011 | text: {
|
23012 | x: function(d) {
|
23013 | return Math.ceil(Math.abs(valueScale(maxScore) - valueScale(0)) / 2);
|
23014 | },
|
23015 | y: function(d) {
|
23016 | return d.isTop ? -percentBarTickHeight / 2 - baselineDelta : percentBarYOffset + percentBarTickHeight / 2;
|
23017 | },
|
23018 | style: function() {
|
23019 | return "font-size: " + percentBarFontSize + ";";
|
23020 | },
|
23021 | transform: function(d) {
|
23022 | var xOffset = d.isTop ? categoryScale(0) - percentBarTickHeight : categoryScale(lastCategoryIndex) + columnHeight + percentBarTickHeight;
|
23023 | return visuals.SVGUtil.translate(0, xOffset);
|
23024 | },
|
23025 | fill: data.percentBarLabelSettings.labelColor,
|
23026 | maxWidth: horizontalDistance
|
23027 | }
|
23028 | },
|
23029 | shapeLayout: {
|
23030 | height: function(d) {
|
23031 | return d.highlight && highlightsOverflow ? overFlowHighlightColumnWidth : columnHeight;
|
23032 | },
|
23033 | width: function(d) {
|
23034 | return Math.abs(valueScale(FunnelChart.getValueFromDataPoint(d)) - valueScale(0));
|
23035 | },
|
23036 | y: function(d) {
|
23037 | return categoryScale(d.categoryOrMeasureIndex) + (d.highlight && highlightsOverflow ? overFlowHighlightOffset : 0);
|
23038 | },
|
23039 | x: function(d) {
|
23040 | var value = FunnelChart.getValueFromDataPoint(d);
|
23041 | return valueScale(value) - emptyHorizontalSpace(value);
|
23042 | }
|
23043 | },
|
23044 | shapeLayoutWithoutHighlights: {
|
23045 | height: function(d) {
|
23046 | return columnHeight;
|
23047 | },
|
23048 | width: function(d) {
|
23049 | return Math.abs(valueScale(d.value) - valueScale(0));
|
23050 | },
|
23051 | y: function(d) {
|
23052 | return categoryScale(d.categoryOrMeasureIndex) + 0;
|
23053 | },
|
23054 | x: function(d) {
|
23055 | return valueScale(d.value) - emptyHorizontalSpace(d.value);
|
23056 | }
|
23057 | },
|
23058 | zeroShapeLayout: {
|
23059 | height: function(d) {
|
23060 | return d.highlight && highlightsOverflow ? overFlowHighlightColumnWidth : columnHeight;
|
23061 | },
|
23062 | width: function(d) {
|
23063 | return 0;
|
23064 | },
|
23065 | y: function(d) {
|
23066 | return categoryScale(d.categoryOrMeasureIndex) + (d.highlight && highlightsOverflow ? overFlowHighlightOffset : 0);
|
23067 | },
|
23068 | x: function(d) {
|
23069 | return valueScale((valueScale.domain()[0] + valueScale.domain()[1]) / 2);
|
23070 | }
|
23071 | },
|
23072 | interactorLayout: {
|
23073 | height: function(d) {
|
23074 | return d.highlight && highlightsOverflow ? overFlowHighlightColumnWidth : columnHeight;
|
23075 | },
|
23076 | width: function(d) {
|
23077 | return getMinimumShapeSize(FunnelChart.getValueFromDataPoint(d));
|
23078 | },
|
23079 | y: function(d) {
|
23080 | return categoryScale(d.categoryOrMeasureIndex) + (d.highlight && highlightsOverflow ? overFlowHighlightOffset : 0);
|
23081 | },
|
23082 | x: function(d) {
|
23083 | var size = getMinimumShapeSize(FunnelChart.getValueFromDataPoint(d));
|
23084 | return (horizontalDistance - size) / 2;
|
23085 | }
|
23086 | }
|
23087 | };
|
23088 | }, FunnelChart.drawDefaultAxis = function(graphicsContext, axisOptions, isHidingPercentBars) {
|
23089 | var indices = d3.range(0, axisOptions.categoryLabels.length), xScaleForAxis = d3.scale.ordinal().domain(indices).rangeBands([ axisOptions.rangeStart, axisOptions.rangeEnd ], axisOptions.barToSpaceRatio, isHidingPercentBars ? axisOptions.barToSpaceRatio : FunnelChart.PercentBarToBarRatio), xAxis = d3.svg.axis().scale(xScaleForAxis).orient("right").tickPadding(FunnelChart.TickPadding).innerTickSize(FunnelChart.InnerTickSize).ticks(indices.length).tickValues(indices).tickFormat(function(i) {
|
23090 | return axisOptions.categoryLabels[i];
|
23091 | });
|
23092 | graphicsContext.attr("class", "axis hideLinesOnAxis").attr("transform", visuals.SVGUtil.translate(0, axisOptions.margin.top)).call(xAxis),
|
23093 | graphicsContext.selectAll(".tick").call(visuals.tooltipUtils.tooltipUpdate, axisOptions.categoryLabels);
|
23094 | var leftRightMarginLimit = axisOptions.margin.left - FunnelChart.LabelFunnelPadding;
|
23095 | graphicsContext.selectAll(".tick text").call(visuals.AxisHelper.LabelLayoutStrategy.clip, leftRightMarginLimit, powerbi.TextMeasurementService.svgEllipsis);
|
23096 | }, FunnelChart.drawDefaultShapes = function(data, dataPoints, graphicsContext, layout, hasSelection) {
|
23097 | var hasHighlights = data.hasHighlights, columns = graphicsContext.selectAll(FunnelChart.Selectors.funnel.bars.selector).data(dataPoints, function(d) {
|
23098 | return d.key;
|
23099 | });
|
23100 | return columns.enter().append("rect").attr("class", function(d) {
|
23101 | return d.highlight ? FunnelChart.FunnelBarHighlightClass : FunnelChart.Selectors.funnel.bars["class"];
|
23102 | }), columns.style("fill", function(d) {
|
23103 | return d.color;
|
23104 | }).style("fill-opacity", function(d) {
|
23105 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, hasHighlights);
|
23106 | }).attr(layout.shapeLayout), columns.exit().remove(), columns;
|
23107 | }, FunnelChart.getValueFromDataPoint = function(dataPoint, asOriginal) {
|
23108 | return void 0 === asOriginal && (asOriginal = !1), asOriginal ? dataPoint.highlight ? dataPoint.originalHighlightValue : dataPoint.originalValue : dataPoint.highlight ? dataPoint.highlightValue : dataPoint.value;
|
23109 | }, FunnelChart.drawInteractorShapes = function(dataPoints, graphicsContext, layout) {
|
23110 | var interactorsData = dataPoints.filter(function(d) {
|
23111 | return !d.highlight && layout.interactorLayout.width(d) === FunnelChart.MinimumInteractorSize;
|
23112 | }), columns = graphicsContext.selectAll(FunnelChart.Selectors.funnel.interactors.selector).data(interactorsData, function(d) {
|
23113 | return d.key;
|
23114 | });
|
23115 | return columns.enter().append("rect").attr("class", FunnelChart.Selectors.funnel.interactors["class"]),
|
23116 | columns.style("fill-opacity", 0).attr(layout.interactorLayout), columns.exit().remove(),
|
23117 | columns;
|
23118 | }, FunnelChart.drawPercentBarComponents = function(graphicsContext, data, layout, percentLabelSettings) {
|
23119 | var mainLine = graphicsContext.selectAll(FunnelChart.Selectors.percentBar.mainLine.selector).data(data);
|
23120 | mainLine.exit().remove(), mainLine.enter().append("line").classed(FunnelChart.Selectors.percentBar.mainLine["class"], !0),
|
23121 | mainLine.attr(layout.percentBarLayout.mainLine);
|
23122 | var leftTick = graphicsContext.selectAll(FunnelChart.Selectors.percentBar.leftTick.selector).data(data);
|
23123 | leftTick.exit().remove(), leftTick.enter().append("line").classed(FunnelChart.Selectors.percentBar.leftTick["class"], !0),
|
23124 | leftTick.attr(layout.percentBarLayout.leftTick);
|
23125 | var rightTick = graphicsContext.selectAll(FunnelChart.Selectors.percentBar.rightTick.selector).data(data);
|
23126 | rightTick.exit().remove(), rightTick.enter().append("line").classed(FunnelChart.Selectors.percentBar.rightTick["class"], !0),
|
23127 | rightTick.attr(layout.percentBarLayout.rightTick);
|
23128 | var text = graphicsContext.selectAll(FunnelChart.Selectors.percentBar.text.selector).data(data), localizedString = visuals.valueFormatter.getLocalizedString("Percentage1");
|
23129 | text.exit().remove(), text.enter().append("text").classed(FunnelChart.Selectors.percentBar.text["class"], !0),
|
23130 | text.attr(layout.percentBarLayout.text).text(function(fp) {
|
23131 | return visuals.dataLabelUtils.getLabelFormattedText({
|
23132 | label: fp.percent,
|
23133 | format: localizedString,
|
23134 | fontSize: percentLabelSettings.fontSize,
|
23135 | maxWidth: layout.percentBarLayout.text.maxWidth
|
23136 | });
|
23137 | }).append("title").text(function(d) {
|
23138 | return powerbi.formattingService.formatValue(d.percent, localizedString);
|
23139 | });
|
23140 | }, FunnelChart.drawPercentBars = function(data, graphicsContext, layout, isHidingPercentBars) {
|
23141 | if (isHidingPercentBars || !data.dataPoints || (data.hasHighlights ? data.dataPoints.length / 2 : data.dataPoints.length) < 2) return void FunnelChart.drawPercentBarComponents(graphicsContext, [], layout, data.percentBarLabelSettings);
|
23142 | var dataPoints = [ data.dataPoints[data.hasHighlights ? 1 : 0], data.dataPoints[data.dataPoints.length - 1] ], baseline = FunnelChart.getValueFromDataPoint(dataPoints[0]);
|
23143 | if (0 >= baseline) return void FunnelChart.drawPercentBarComponents(graphicsContext, [], layout, data.percentBarLabelSettings);
|
23144 | var percentData = [ {
|
23145 | value: FunnelChart.getValueFromDataPoint(dataPoints[0]),
|
23146 | percent: 1,
|
23147 | isTop: !0
|
23148 | }, {
|
23149 | value: FunnelChart.getValueFromDataPoint(dataPoints[1]),
|
23150 | percent: FunnelChart.getValueFromDataPoint(dataPoints[1]) / baseline,
|
23151 | isTop: !1
|
23152 | } ];
|
23153 | FunnelChart.drawPercentBarComponents(graphicsContext, percentData, layout, data.percentBarLabelSettings);
|
23154 | }, FunnelChart.prototype.showCategoryLabels = function() {
|
23155 | return !(this.funnelSmallViewPortProperties && this.funnelSmallViewPortProperties.hideFunnelCategoryLabelsOnSmallViewPort && this.currentViewport.height < this.funnelSmallViewPortProperties.minHeightFunnelCategoryLabelsVisible);
|
23156 | }, FunnelChart.addFunnelPercentsToTooltip = function(pctFormatString, tooltipInfo, hostServices, percentOfFirst, percentOfPrevious, highlight) {
|
23157 | null != percentOfFirst && tooltipInfo.push({
|
23158 | displayName: hostServices.getLocalizedString("Funnel_PercentOfFirst" + (highlight ? "_Highlight" : "")),
|
23159 | value: visuals.valueFormatter.format(percentOfFirst, pctFormatString)
|
23160 | }), null != percentOfPrevious && tooltipInfo.push({
|
23161 | displayName: hostServices.getLocalizedString("Funnel_PercentOfPrevious" + (highlight ? "_Highlight" : "")),
|
23162 | value: visuals.valueFormatter.format(percentOfPrevious, pctFormatString)
|
23163 | });
|
23164 | }, FunnelChart.getTextProperties = function(fontSize) {
|
23165 | return {
|
23166 | fontSize: PixelConverter.fromPoint(fontSize || visuals.dataLabelUtils.DefaultFontSizeInPt),
|
23167 | fontFamily: FunnelChart.DefaultFontFamily
|
23168 | };
|
23169 | }, FunnelChart.getDefaultLabelSettings = function() {
|
23170 | return {
|
23171 | show: !0,
|
23172 | position: powerbi.visuals.labelPosition.insideCenter,
|
23173 | displayUnits: 0,
|
23174 | labelColor: null,
|
23175 | fontSize: LabelUtils.DefaultLabelFontSizeInPt
|
23176 | };
|
23177 | }, FunnelChart.getDefaultPercentLabelSettings = function() {
|
23178 | return {
|
23179 | show: !0,
|
23180 | position: 0,
|
23181 | displayUnits: 0,
|
23182 | labelColor: LabelUtils.defaultLabelColor,
|
23183 | fontSize: LabelUtils.DefaultLabelFontSizeInPt
|
23184 | };
|
23185 | }, FunnelChart.prototype.getLabels = function(layout) {
|
23186 | var labels = [];
|
23187 | if (this.data.dataLabelsSettings.show && this.data.canShowDataLabels) {
|
23188 | var labelDataPoints = this.createLabelDataPoints(layout.shapeLayout, this.data.dataLabelsSettings), newLabelLayout = new powerbi.LabelLayout({
|
23189 | maximumOffset: LabelUtils.maxLabelOffset,
|
23190 | startingOffset: LabelUtils.startingLabelOffset
|
23191 | }), labelDataPointsGroup = {
|
23192 | labelDataPoints: labelDataPoints,
|
23193 | maxNumberOfLabels: labelDataPoints.length
|
23194 | }, labelViewport = {
|
23195 | width: this.currentViewport.width - this.margin.left,
|
23196 | height: this.currentViewport.height - this.margin.top
|
23197 | };
|
23198 | labels = newLabelLayout.layout([ labelDataPointsGroup ], labelViewport);
|
23199 | }
|
23200 | return labels;
|
23201 | }, FunnelChart.prototype.createLabelDataPoints = function(shapeLayout, visualSettings) {
|
23202 | var data = this.data, dataPoints = data.dataPoints;
|
23203 | if (_.isEmpty(dataPoints)) return [];
|
23204 | var points = new Array(), generalSettings = dataPoints[0], validPositions = FunnelChart.LabelInsidePosition, height = shapeLayout.height(generalSettings);
|
23205 | visualSettings.position && visualSettings.position === visuals.labelPosition.outsideEnd && (validPositions = FunnelChart.LabelOutsidePosition);
|
23206 | for (var maxAbsoluteValue = data.dataPoints.reduce(function(memo, value) {
|
23207 | return Math.abs(memo.value) > Math.abs(value.value) ? memo : value;
|
23208 | }).value, formatString = visuals.valueFormatter.getFormatString(data.valuesMetadata[0], visuals.funnelChartProps.general.formatString), formattersCache = LabelUtils.createColumnFormatterCacheManager(), fontSize = visualSettings.fontSize, properties = {
|
23209 | fontFamily: LabelUtils.LabelTextProperties.fontFamily,
|
23210 | fontSize: PixelConverter.fromPoint(fontSize || LabelUtils.DefaultLabelFontSizeInPt),
|
23211 | fontWeight: LabelUtils.LabelTextProperties.fontWeight
|
23212 | }, outsideFill = generalSettings.labelFill || LabelUtils.defaultLabelColor, insideFill = generalSettings.labelFill || LabelUtils.defaultInsideLabelColor, _i = 0, dataPoints_2 = dataPoints; _i < dataPoints_2.length; _i++) {
|
23213 | var dataPoint = dataPoints_2[_i], value = FunnelChart.getValueFromDataPoint(dataPoint, !0);
|
23214 | if (null != value && (!data.hasHighlights || dataPoint.highlight)) {
|
23215 | var labelFormatString = null != formatString ? formatString : generalSettings.labelFormatString, formatter = formattersCache.getOrCreate(labelFormatString, visualSettings, maxAbsoluteValue), labelText = formatter.format(value);
|
23216 | properties.text = labelText;
|
23217 | var textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties), parentType = 1, shape = {
|
23218 | rect: {
|
23219 | left: shapeLayout.x(dataPoint),
|
23220 | top: shapeLayout.y(dataPoint),
|
23221 | width: shapeLayout.width(dataPoint),
|
23222 | height: height
|
23223 | },
|
23224 | orientation: FunnelChart.LabelOrientation,
|
23225 | validPositions: validPositions
|
23226 | }, point = {
|
23227 | isPreferred: !0,
|
23228 | text: labelText,
|
23229 | textSize: {
|
23230 | width: textWidth,
|
23231 | height: textHeight
|
23232 | },
|
23233 | fontSize: fontSize,
|
23234 | parentType: parentType,
|
23235 | parentShape: shape,
|
23236 | insideFill: insideFill,
|
23237 | outsideFill: outsideFill,
|
23238 | identity: dataPoint.identity,
|
23239 | hasBackground: !1
|
23240 | };
|
23241 | 0 === dataPoint.value && (shape = {
|
23242 | validPositions: [ 256 ],
|
23243 | point: {
|
23244 | x: shapeLayout.x(dataPoint),
|
23245 | y: shapeLayout.y(dataPoint) + height / 2
|
23246 | }
|
23247 | }, parentType = 0, point.parentShape = shape, point.parentType = parentType, point.insideFill = point.outsideFill),
|
23248 | points.push(point);
|
23249 | }
|
23250 | }
|
23251 | return points;
|
23252 | }, FunnelChart.LabelInsidePosition = [ 1, 16 ], FunnelChart.LabelOutsidePosition = [ 16, 4 ],
|
23253 | FunnelChart.LabelOrientation = 3, FunnelChart.DefaultBarOpacity = 1, FunnelChart.DimmedBarOpacity = .4,
|
23254 | FunnelChart.PercentBarToBarRatio = .75, FunnelChart.TickPadding = 0, FunnelChart.InnerTickSize = 0,
|
23255 | FunnelChart.MinimumInteractorSize = 15, FunnelChart.InnerTextClassName = "labelSeries",
|
23256 | FunnelChart.Selectors = {
|
23257 | funnel: {
|
23258 | bars: createClassAndSelector("funnelBar"),
|
23259 | highlights: createClassAndSelector("highlight"),
|
23260 | interactors: createClassAndSelector("funnelBarInteractor")
|
23261 | },
|
23262 | percentBar: {
|
23263 | root: createClassAndSelector("percentBars"),
|
23264 | mainLine: createClassAndSelector("mainLine"),
|
23265 | leftTick: createClassAndSelector("leftTick"),
|
23266 | rightTick: createClassAndSelector("rightTick"),
|
23267 | text: createClassAndSelector("value")
|
23268 | }
|
23269 | }, FunnelChart.FunnelBarHighlightClass = [ FunnelChart.Selectors.funnel.bars["class"], FunnelChart.Selectors.funnel.highlights["class"] ].join(" "),
|
23270 | FunnelChart.YAxisPadding = 10, FunnelChart.VisualClassName = "funnelChart", FunnelChart.DefaultFontFamily = visuals.Font.Family.regularSecondary.css,
|
23271 | FunnelChart.BarToSpaceRatio = .1, FunnelChart.MaxBarHeight = 40, FunnelChart.MinBarThickness = 12,
|
23272 | FunnelChart.LabelFunnelPadding = 6, FunnelChart.OverflowingHighlightWidthRatio = .5,
|
23273 | FunnelChart.MaxMarginFactor = .25, FunnelChart;
|
23274 | }();
|
23275 | visuals.FunnelChart = FunnelChart;
|
23276 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
23277 | }(powerbi || (powerbi = {}));
|
23278 | }, function(module, exports) {
|
23279 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
23280 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
23281 | !function(powerbi) {
|
23282 | var visuals;
|
23283 | !function(visuals) {
|
23284 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter, DataRoleHelper = powerbi.data.DataRoleHelper, Gauge = function() {
|
23285 | function Gauge(options) {
|
23286 | this.lastAngle = -Math.PI / 2, options && (options.gaugeSmallViewPortProperties && (this.gaugeSmallViewPortProperties = options.gaugeSmallViewPortProperties),
|
23287 | this.animator = options.animator, this.tooltipsEnabled = options.tooltipsEnabled,
|
23288 | this.tooltipBucketEnabled = options.tooltipBucketEnabled);
|
23289 | }
|
23290 | return Gauge.prototype.enumerateObjectInstances = function(options) {
|
23291 | var enumeration = new visuals.ObjectEnumerationBuilder();
|
23292 | switch (options.objectName) {
|
23293 | case "axis":
|
23294 | this.enumerateAxis(enumeration);
|
23295 | break;
|
23296 |
|
23297 | case "labels":
|
23298 | var labelSettings = this.data ? this.data.dataLabelsSettings : visuals.dataLabelUtils.getDefaultGaugeLabelSettings();
|
23299 | visuals.dataLabelUtils.enumerateDataLabels(this.getDataLabelSettingsOptions(enumeration, labelSettings));
|
23300 | break;
|
23301 |
|
23302 | case "calloutValue":
|
23303 | var labelSettings = this.data ? this.data.calloutValueLabelsSettings : visuals.dataLabelUtils.getDefaultGaugeLabelSettings();
|
23304 | visuals.dataLabelUtils.enumerateDataLabels(this.getDataLabelSettingsOptions(enumeration, labelSettings));
|
23305 | break;
|
23306 |
|
23307 | case "dataPoint":
|
23308 | this.enumerateDataPoint(enumeration);
|
23309 | }
|
23310 | return enumeration.complete();
|
23311 | }, Gauge.prototype.getDataLabelSettingsOptions = function(enumeration, labelSettings) {
|
23312 | return {
|
23313 | dataLabelsSettings: labelSettings,
|
23314 | show: !0,
|
23315 | precision: !0,
|
23316 | displayUnits: !0,
|
23317 | fontSize: !0,
|
23318 | enumeration: enumeration
|
23319 | };
|
23320 | }, Gauge.prototype.enumerateAxis = function(enumeration) {
|
23321 | var dataView = this.dataView;
|
23322 | if (dataView && dataView.metadata) {
|
23323 | var properties = Gauge.getGaugeObjectsProperties(dataView);
|
23324 | enumeration.pushInstance({
|
23325 | selector: null,
|
23326 | objectName: "axis",
|
23327 | properties: properties
|
23328 | });
|
23329 | }
|
23330 | }, Gauge.prototype.enumerateDataPoint = function(enumeration) {
|
23331 | var dataPointSettings = this.data ? this.data.dataPointSettings : Gauge.DefaultDataPointSettings, properties = {};
|
23332 | properties.fill = {
|
23333 | solid: {
|
23334 | color: dataPointSettings.fillColor
|
23335 | }
|
23336 | }, null != dataPointSettings.targetColor && (properties.target = {
|
23337 | solid: {
|
23338 | color: dataPointSettings.targetColor
|
23339 | }
|
23340 | }), enumeration.pushInstance({
|
23341 | selector: null,
|
23342 | objectName: visuals.gaugeProps.dataPoint.target.objectName,
|
23343 | properties: properties
|
23344 | });
|
23345 | }, Gauge.getGaugeObjectsProperties = function(dataView) {
|
23346 | var properties = {}, objects = dataView.metadata.objects, hasAxisObject = !!objects && !!objects.axis;
|
23347 | return DataRoleHelper.hasRoleInDataView(dataView, visuals.gaugeRoleNames.minValue) || (properties.min = hasAxisObject ? objects.axis.min : void 0),
|
23348 | DataRoleHelper.hasRoleInDataView(dataView, visuals.gaugeRoleNames.maxValue) || (properties.max = hasAxisObject ? objects.axis.max : void 0),
|
23349 | DataRoleHelper.hasRoleInDataView(dataView, visuals.gaugeRoleNames.targetValue) || (properties.target = hasAxisObject ? objects.axis.target : void 0),
|
23350 | properties;
|
23351 | }, Gauge.prototype.init = function(options) {
|
23352 | this.element = options.element, this.currentViewport = options.viewport, this.style = options.style,
|
23353 | this.options = options, this.settings = Gauge.DefaultStyleProperties, this.targetSettings = Gauge.DefaultTargetSettings,
|
23354 | this.setMargins(), this.color = d3.scale.ordinal().range(this.style.colorPalette.dataColors.getSentimentColors().map(function(color) {
|
23355 | return color.value;
|
23356 | })), this.hostService = options.host;
|
23357 | var svg = this.svg = d3.select(this.element.get(0)).append("svg");
|
23358 | svg.classed(Gauge.VisualClassName, !0);
|
23359 | var mainGraphicsContext = this.mainGraphicsContext = svg.append("g");
|
23360 | mainGraphicsContext.attr("class", Gauge.MainGaugeGroupClassName), this.initKpiBands();
|
23361 | var backgroundArc = this.backgroundArc = d3.svg.arc().innerRadius(0).outerRadius(0).startAngle(-Math.PI / 2).endAngle(Math.PI / 2), foregroundArc = this.foregroundArc = d3.svg.arc().innerRadius(0).outerRadius(0).startAngle(-Math.PI / 2);
|
23362 | this.backgroundArcPath = mainGraphicsContext.append("path").classed("backgroundArc", !0).attr("d", backgroundArc),
|
23363 | this.foregroundArcPath = mainGraphicsContext.append("path").datum({
|
23364 | endAngle: -Math.PI / 2
|
23365 | }).classed("foregroundArc", !0).attr("d", foregroundArc);
|
23366 | var g = this.animatedNumberGrapicsContext = svg.append("g");
|
23367 | this.animatedNumber = new visuals.AnimatedNumber(g), this.animatedNumber.init(options);
|
23368 | var gaugeDrawingOptions = this.gaugeVisualProperties = this.getGaugeVisualProperties(), animatedNumberProperties = this.getAnimatedNumberProperties(gaugeDrawingOptions.radius, gaugeDrawingOptions.innerRadiusFactor, gaugeDrawingOptions.top, gaugeDrawingOptions.left);
|
23369 | this.animatedNumberGrapicsContext.attr("transform", animatedNumberProperties.transformString),
|
23370 | this.animatedNumber.onResizing(animatedNumberProperties.viewport);
|
23371 | }, Gauge.prototype.update = function(options) {
|
23372 | if (this.currentViewport = options.viewport, options.dataViews && options.dataViews[0]) {
|
23373 | var dataView = this.dataView = options.dataViews[0], reader = powerbi.data.createIDataViewCategoricalReader(dataView);
|
23374 | this.data = Gauge.converter(reader, this.tooltipBucketEnabled), this.targetSettings = this.data.targetSettings,
|
23375 | this.dataView.single = {
|
23376 | value: this.data.total
|
23377 | }, this.showTargetLabel = null != this.targetSettings.target && (this.currentViewport.width > Gauge.MinWidthForTargetLabel || !this.showMinMaxLabelsOnBottom()) && this.showSideNumbersLabelText() && this.data.dataLabelsSettings.show,
|
23378 | this.setMargins(), this.gaugeVisualProperties = this.getGaugeVisualProperties(),
|
23379 | this.drawViewPort(this.gaugeVisualProperties), this.updateInternal(options.suppressAnimations),
|
23380 | this.updateCalloutValue(options.suppressAnimations);
|
23381 | var warnings = visuals.getInvalidValueWarnings([ dataView ], !1, !1, !1);
|
23382 | this.hostService.setWarnings(warnings);
|
23383 | }
|
23384 | }, Gauge.prototype.updateCalloutValue = function(suppressAnimations) {
|
23385 | if (this.data.calloutValueLabelsSettings.show) {
|
23386 | var animatedNumberProperties = this.getAnimatedNumberProperties(this.gaugeVisualProperties.radius, this.gaugeVisualProperties.innerRadiusFactor, this.gaugeVisualProperties.top, this.gaugeVisualProperties.left);
|
23387 | this.animatedNumberGrapicsContext.attr("transform", animatedNumberProperties.transformString),
|
23388 | this.animatedNumber.setTextColor(this.data.calloutValueLabelsSettings.labelColor);
|
23389 | var calloutValue = this.data ? this.data.total : null, formatter = this.getFormatter(this.data.calloutValueLabelsSettings, this.data.metadataColumn, calloutValue);
|
23390 | this.animatedNumber.setFormatter(formatter), this.animatedNumber.update({
|
23391 | viewport: animatedNumberProperties.viewport,
|
23392 | dataViews: [ this.dataView ],
|
23393 | suppressAnimations: suppressAnimations
|
23394 | }), this.animatedNumberGrapicsContext.selectAll("title").remove(), this.animatedNumberGrapicsContext.append("title").text([ formatter.format(calloutValue) ]);
|
23395 | } else this.animatedNumber.clear(), this.animatedNumberGrapicsContext.selectAll("title").remove();
|
23396 | }, Gauge.prototype.onDataChanged = function(options) {
|
23397 | this.update({
|
23398 | dataViews: options.dataViews,
|
23399 | suppressAnimations: options.suppressAnimations,
|
23400 | viewport: this.currentViewport
|
23401 | });
|
23402 | }, Gauge.prototype.onResizing = function(viewport) {
|
23403 | this.update({
|
23404 | dataViews: [ this.dataView ],
|
23405 | suppressAnimations: !0,
|
23406 | viewMode: 0,
|
23407 | viewport: viewport
|
23408 | });
|
23409 | }, Gauge.parseGaugeData = function(reader, tooltipBucketEnabled) {
|
23410 | var dataViewObjects = reader.getStaticObjects(), metadataColumn = reader.getCategoryMetadataColumn(visuals.gaugeRoleNames.y), axisObject = dataViewObjects ? dataViewObjects.axis : null, isValueDefined = reader.hasValues(visuals.gaugeRoleNames.y), isMaxDefined = reader.hasValues(visuals.gaugeRoleNames.maxValue), isMinDefined = reader.hasValues(visuals.gaugeRoleNames.minValue), valueIndex = 0, data = {
|
23411 | max: null,
|
23412 | min: null,
|
23413 | target: null,
|
23414 | value: null,
|
23415 | tooltipItems: []
|
23416 | };
|
23417 | if (isValueDefined) {
|
23418 | var valueMetadata = reader.getValueMetadataColumn(visuals.gaugeRoleNames.y);
|
23419 | data.value = reader.getValue(visuals.gaugeRoleNames.y, valueIndex);
|
23420 | var value = visuals.converterHelper.formatFromMetadataColumn(data.value, valueMetadata, Gauge.formatStringProp);
|
23421 | data.tooltipItems.push({
|
23422 | displayName: reader.getValueDisplayName(visuals.gaugeRoleNames.y),
|
23423 | value: value
|
23424 | });
|
23425 | }
|
23426 | if (reader.hasValues(visuals.gaugeRoleNames.targetValue)) {
|
23427 | var targetMetadata = reader.getValueMetadataColumn(visuals.gaugeRoleNames.targetValue);
|
23428 | data.target = reader.getValue(visuals.gaugeRoleNames.targetValue, valueIndex);
|
23429 | var value = visuals.converterHelper.formatFromMetadataColumn(data.target, targetMetadata, Gauge.formatStringProp);
|
23430 | data.tooltipItems.push({
|
23431 | displayName: reader.getValueDisplayName(visuals.gaugeRoleNames.targetValue),
|
23432 | value: value
|
23433 | });
|
23434 | } else axisObject && (data.target = axisObject.target);
|
23435 | if (isMaxDefined) data.max = reader.getValue(visuals.gaugeRoleNames.maxValue, valueIndex); else if (axisObject && null != axisObject.max) data.max = axisObject.max; else if (data.max = Gauge.DEFAULT_MAX,
|
23436 | isValueDefined && data.value && 0 !== data.value) {
|
23437 | var hasPercent = !1;
|
23438 | if (metadataColumn) {
|
23439 | var formatString = visuals.valueFormatter.getFormatString(metadataColumn, Gauge.formatStringProp, !0);
|
23440 | null != formatString && (hasPercent = visuals.valueFormatter.getFormatMetadata(formatString).hasPercent);
|
23441 | }
|
23442 | hasPercent || isMinDefined || (data.max = data.value < 0 ? Gauge.DEFAULT_MIN : 2 * data.value);
|
23443 | }
|
23444 | return isMinDefined ? data.min = reader.getValue(visuals.gaugeRoleNames.minValue, valueIndex) : axisObject && null != axisObject.min ? data.min = axisObject.min : (data.min = Gauge.DEFAULT_MIN,
|
23445 | !isMaxDefined && isValueDefined && null != data.value && data.value < 0 && (data.min = 2 * data.value)),
|
23446 | tooltipBucketEnabled && visuals.TooltipBuilder.addTooltipBucketItem(reader, data.tooltipItems, 0),
|
23447 | data;
|
23448 | }, Gauge.converter = function(reader, tooltipBucketEnabled) {
|
23449 | void 0 === tooltipBucketEnabled && (tooltipBucketEnabled = !0);
|
23450 | var objectSettings = reader.getStaticObjects(), metadataColumn = reader.getValueMetadataColumn(visuals.gaugeRoleNames.y), gaugeData = Gauge.parseGaugeData(reader, tooltipBucketEnabled), value = gaugeData.value;
|
23451 | return {
|
23452 | total: value,
|
23453 | tooltipInfo: gaugeData.tooltipItems,
|
23454 | maxColumnMetadata: reader.getValueMetadataColumn(visuals.gaugeRoleNames.maxValue),
|
23455 | minColumnMetadata: reader.getValueMetadataColumn(visuals.gaugeRoleNames.minValue),
|
23456 | targetColumnMetadata: reader.getValueMetadataColumn(visuals.gaugeRoleNames.targetValue),
|
23457 | metadataColumn: metadataColumn,
|
23458 | targetSettings: {
|
23459 | min: gaugeData.min,
|
23460 | max: gaugeData.max,
|
23461 | target: gaugeData.target
|
23462 | },
|
23463 | dataLabelsSettings: Gauge.convertDataLabelSettings(objectSettings, "labels"),
|
23464 | calloutValueLabelsSettings: Gauge.convertDataLabelSettings(objectSettings, "calloutValue"),
|
23465 | dataPointSettings: Gauge.convertDataPointSettings(objectSettings, gaugeData)
|
23466 | };
|
23467 | }, Gauge.convertDataLabelSettings = function(objects, objectName) {
|
23468 | var dataLabelsSettings = visuals.dataLabelUtils.getDefaultGaugeLabelSettings();
|
23469 | if (objects) {
|
23470 | var labelsObj = objects[objectName];
|
23471 | visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(labelsObj, dataLabelsSettings);
|
23472 | }
|
23473 | return dataLabelsSettings;
|
23474 | }, Gauge.convertDataPointSettings = function(objects, targetSettings) {
|
23475 | var targetColor, fillColor = Gauge.DefaultDataPointSettings.fillColor;
|
23476 | return objects ? (fillColor = powerbi.DataViewObjects.getFillColor(objects, visuals.gaugeProps.dataPoint.fill, Gauge.DefaultDataPointSettings.fillColor),
|
23477 | targetSettings && null != targetSettings.target && (targetColor = powerbi.DataViewObjects.getFillColor(objects, visuals.gaugeProps.dataPoint.target, Gauge.DefaultDataPointSettings.targetColor))) : targetSettings && null != targetSettings.target && (targetColor = Gauge.DefaultDataPointSettings.targetColor),
|
23478 | {
|
23479 | fillColor: fillColor,
|
23480 | targetColor: targetColor
|
23481 | };
|
23482 | }, Gauge.prototype.initKpiBands = function() {
|
23483 | if (this.settings.kpiBands.show) for (var kpiArcs = this.kpiArcs = [], kpiArcPaths = this.kpiArcPaths = [], mainGraphicsContext = this.mainGraphicsContext, i = 0; 3 > i; i++) {
|
23484 | var arc = d3.svg.arc().innerRadius(0).outerRadius(0).startAngle(0).endAngle(0);
|
23485 | kpiArcs.push(arc);
|
23486 | var arcPath = mainGraphicsContext.append("path").attr("d", arc);
|
23487 | kpiArcPaths.push(arcPath);
|
23488 | }
|
23489 | }, Gauge.prototype.isValid = function() {
|
23490 | if (!this.data || !this.data.targetSettings) return !1;
|
23491 | var targetSettings = this.data.targetSettings;
|
23492 | return $.isNumeric(targetSettings.min) && $.isNumeric(targetSettings.max) || targetSettings.min > targetSettings.max;
|
23493 | }, Gauge.prototype.updateKpiBands = function(radius, innerRadiusFactor, tString, kpiAngleAttr) {
|
23494 | if (this.settings.kpiBands.show) for (var i = 0; i < kpiAngleAttr.length; i++) this.kpiArcs[i].innerRadius(radius * innerRadiusFactor - (Gauge.KpiBandDistanceFromMainArc + this.settings.kpiBands.thickness)).outerRadius(radius * innerRadiusFactor - Gauge.KpiBandDistanceFromMainArc).startAngle(kpiAngleAttr[i].start).endAngle(kpiAngleAttr[i].end),
|
23495 | this.kpiArcPaths[i].attr("fill", kpiAngleAttr[i].fill).attr("d", this.kpiArcs[i]).attr("transform", tString);
|
23496 | }, Gauge.prototype.removeTargetElements = function() {
|
23497 | this.targetLine && (this.targetLine.remove(), this.targetText.remove(), this.targetConnector.remove(),
|
23498 | this.targetLine = this.targetConnector = this.targetText = null);
|
23499 | }, Gauge.prototype.getTargetRatio = function() {
|
23500 | var targetSettings = this.targetSettings, range = targetSettings.max - targetSettings.min;
|
23501 | return 0 !== range ? (targetSettings.target - targetSettings.min) / range : 0;
|
23502 | }, Gauge.prototype.updateTargetLine = function(radius, innerRadius, left, top) {
|
23503 | this.targetLine || (this.targetLine = this.mainGraphicsContext.append("line"));
|
23504 | var angle = this.getTargetRatio() * Math.PI, outY = top - radius * Math.sin(angle), outX = left - radius * Math.cos(angle), inY = top - innerRadius * Math.sin(angle), inX = left - innerRadius * Math.cos(angle);
|
23505 | this.targetLine.attr({
|
23506 | x1: inX,
|
23507 | y1: inY,
|
23508 | x2: outX,
|
23509 | y2: outY
|
23510 | });
|
23511 | }, Gauge.prototype.getAnimatedNumberProperties = function(radius, innerRadiusFactor, top, left) {
|
23512 | var boxAngle = Math.PI / 4, scale = 1, innerRadiusOfArc = radius * innerRadiusFactor, innerRadiusForTextBoundingBox = innerRadiusOfArc - (this.settings.kpiBands.show ? Gauge.KpiBandDistanceFromMainArc + this.settings.kpiBands.thickness : 0), innerRCos = innerRadiusForTextBoundingBox * Math.cos(boxAngle), innerRSin = innerRadiusForTextBoundingBox * Math.sin(boxAngle), innerY = top - innerRSin, innerX = left - innerRCos;
|
23513 | innerY *= scale, innerX *= scale;
|
23514 | var animatedNumberWidth = 2 * innerRCos, properties = {
|
23515 | transformString: visuals.SVGUtil.translate(innerX, innerY),
|
23516 | viewport: {
|
23517 | height: innerRSin,
|
23518 | width: animatedNumberWidth
|
23519 | }
|
23520 | };
|
23521 | return properties;
|
23522 | }, Gauge.prototype.getGaugeVisualProperties = function() {
|
23523 | var viewport = this.currentViewport, margin = this.margin, width = viewport.width - margin.right - margin.left, halfWidth = width / 2, height = viewport.height - margin.top - margin.bottom, radius = Math.min(halfWidth, height), innerRadiusFactor = Gauge.InnerRadiusFactor, left = margin.left + halfWidth, top = radius + (height - radius) / 2 + margin.top, tString = visuals.SVGUtil.translate(left, top), innerRadiusOfArc = radius * innerRadiusFactor, gaugeData = {
|
23524 | radius: radius,
|
23525 | innerRadiusOfArc: innerRadiusOfArc,
|
23526 | left: left,
|
23527 | top: top,
|
23528 | height: height,
|
23529 | width: width,
|
23530 | margin: margin,
|
23531 | transformString: tString,
|
23532 | innerRadiusFactor: innerRadiusFactor
|
23533 | };
|
23534 | return gaugeData;
|
23535 | }, Gauge.prototype.drawViewPort = function(drawOptions) {
|
23536 | var separation = this.settings.kpiBands.separationRadians, innerRadiusFactor = Gauge.InnerRadiusFactor, backgroudArc = this.backgroundArc, color = this.color, attrs = [ {
|
23537 | fill: color(0),
|
23538 | start: -Math.PI / 2,
|
23539 | end: -Math.PI / 2 + Math.PI / 4 - separation
|
23540 | }, {
|
23541 | fill: color(1),
|
23542 | start: -Math.PI / 2 + 1 * Math.PI / 4 + separation,
|
23543 | end: -Math.PI / 2 + 3 * Math.PI / 4 - separation
|
23544 | }, {
|
23545 | fill: color(2),
|
23546 | start: -Math.PI / 2 + 3 * Math.PI / 4 + separation,
|
23547 | end: Math.PI / 2
|
23548 | } ], radius = drawOptions.radius, transformString = drawOptions.transformString;
|
23549 | this.updateKpiBands(radius, innerRadiusFactor, transformString, attrs), backgroudArc.innerRadius(radius * innerRadiusFactor).outerRadius(radius).startAngle(-Math.PI / 2).endAngle(Math.PI / 2),
|
23550 | this.backgroundArcPath.attr("d", backgroudArc).attr("transform", transformString);
|
23551 | var foregroundArc = this.foregroundArc;
|
23552 | foregroundArc.innerRadius(radius * innerRadiusFactor).outerRadius(radius).startAngle(-Math.PI / 2),
|
23553 | this.foregroundArcPath.datum({
|
23554 | endAngle: this.lastAngle
|
23555 | }).attr("transform", transformString).attr("d", foregroundArc);
|
23556 | var innerRadiusOfArc = drawOptions.innerRadiusOfArc, left = drawOptions.left, top = drawOptions.top, margin = drawOptions.margin, height = drawOptions.height, targetSettings = this.targetSettings;
|
23557 | this.settings.targetLine.show && this.isValid() && $.isNumeric(targetSettings.target) ? targetSettings.min > targetSettings.target || targetSettings.max < targetSettings.target ? this.removeTargetElements() : (this.updateTargetLine(radius, innerRadiusOfArc, left, top),
|
23558 | this.renderTarget(radius, height, drawOptions.width, margin)) : this.removeTargetElements(),
|
23559 | this.svg.attr("height", this.currentViewport.height).attr("width", this.currentViewport.width);
|
23560 | }, Gauge.prototype.getValueAngle = function() {
|
23561 | var settings = this.data.targetSettings, total = this.data.total;
|
23562 | if (!this.isValid() || !$.isNumeric(total)) return 0;
|
23563 | var adjustedTotal = Math.min(Math.max(total, settings.min), settings.max), angle = (adjustedTotal - settings.min) / (settings.max - settings.min);
|
23564 | return angle;
|
23565 | }, Gauge.prototype.createTicks = function() {
|
23566 | var targetSettings = this.targetSettings, arr = [], minFormatter = this.getFormatter(this.data.dataLabelsSettings, this.data.minColumnMetadata, targetSettings.max);
|
23567 | arr.push(minFormatter.format(targetSettings.min));
|
23568 | var maxFormatter = this.getFormatter(this.data.dataLabelsSettings, this.data.maxColumnMetadata, targetSettings.max);
|
23569 | return arr.push(maxFormatter.format(targetSettings.max)), arr;
|
23570 | }, Gauge.prototype.updateInternal = function(suppressAnimations) {
|
23571 | var height = this.gaugeVisualProperties.height, width = this.gaugeVisualProperties.width, radius = this.gaugeVisualProperties.radius, margin = this.margin, duration = visuals.AnimatorCommon.GetAnimationDuration(this.animator, suppressAnimations), data = this.data, lastAngle = this.lastAngle = -Math.PI / 2 + Math.PI * this.getValueAngle(), ticks = this.createTicks();
|
23572 | this.foregroundArcPath.transition().ease(this.settings.transition.ease).duration(duration).call(this.arcTween, [ lastAngle, this.foregroundArc ]),
|
23573 | this.renderMinMaxLabels(ticks, radius, height, width, margin), this.updateVisualConfigurations(),
|
23574 | this.updateVisualStyles(), this.tooltipsEnabled && (visuals.TooltipManager.addTooltip(this.foregroundArcPath, function(tooltipEvent) {
|
23575 | return data.tooltipInfo;
|
23576 | }), visuals.TooltipManager.addTooltip(this.backgroundArcPath, function(tooltipEvent) {
|
23577 | return data.tooltipInfo;
|
23578 | }));
|
23579 | }, Gauge.prototype.updateVisualStyles = function() {
|
23580 | var fillColor = this.data.dataLabelsSettings.labelColor || this.style.labelText.color.value;
|
23581 | this.mainGraphicsContext.selectAll("text").style({
|
23582 | fill: fillColor
|
23583 | });
|
23584 | }, Gauge.prototype.updateVisualConfigurations = function() {
|
23585 | var configOptions = this.settings, dataPointSettings = this.data.dataPointSettings;
|
23586 | this.mainGraphicsContext.select("line").attr({
|
23587 | stroke: dataPointSettings.targetColor,
|
23588 | "stroke-width": configOptions.targetLine.thickness
|
23589 | }), this.backgroundArcPath.style("fill", configOptions.arcColors.background), this.foregroundArcPath.style("fill", dataPointSettings.fillColor);
|
23590 | }, Gauge.prototype.renderMinMaxLabels = function(ticks, radius, height, width, margin) {
|
23591 | if (this.svg.selectAll(Gauge.LabelText.selector).remove(), this.data.dataLabelsSettings.show) for (var total = ticks.length, divisor = total - 1, top = radius + (height - radius) / 2 + margin.top, showMinMaxLabelsOnBottom = this.showMinMaxLabelsOnBottom(), fontSize = PixelConverter.fromPoint(this.data.dataLabelsSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt), padding = this.settings.labels.padding, index = 0; total > index; index++) {
|
23592 | var textProperties = {
|
23593 | text: ticks[index],
|
23594 | fontFamily: visuals.dataLabelUtils.LabelTextProperties.fontFamily,
|
23595 | fontSize: visuals.dataLabelUtils.LabelTextProperties.fontSize,
|
23596 | fontWeight: visuals.dataLabelUtils.LabelTextProperties.fontWeight
|
23597 | };
|
23598 | if (this.showSideNumbersLabelText()) {
|
23599 | var x = margin.left + width / 2 - radius * Math.cos(Math.PI * index / divisor), y = top - radius * Math.sin(Math.PI * index / divisor), anchor = void 0, onRight = 1 === index, onBottom = !1;
|
23600 | showMinMaxLabelsOnBottom ? (onBottom = !0, y += padding / 2, anchor = onRight ? "end" : "start",
|
23601 | textProperties.text = powerbi.TextMeasurementService.getTailoredTextOrDefault(textProperties, radius)) : (anchor = onRight ? "start" : "end",
|
23602 | x += padding * (onRight ? 1 : -1));
|
23603 | var text = this.mainGraphicsContext.append("text").attr({
|
23604 | x: x,
|
23605 | y: y,
|
23606 | dy: onBottom ? fontSize : 0,
|
23607 | "class": Gauge.LabelText["class"]
|
23608 | }).style({
|
23609 | "text-anchor": anchor,
|
23610 | "font-size": fontSize
|
23611 | }).text(textProperties.text).append("title").text(textProperties.text);
|
23612 | onBottom || this.truncateTextIfNeeded(text, x, onRight);
|
23613 | }
|
23614 | }
|
23615 | }, Gauge.prototype.truncateTextIfNeeded = function(text, positionX, onRight) {
|
23616 | var availableSpace = onRight ? this.currentViewport.width - positionX : positionX;
|
23617 | text.call(visuals.AxisHelper.LabelLayoutStrategy.clip, availableSpace, powerbi.TextMeasurementService.svgEllipsis);
|
23618 | }, Gauge.prototype.getFormatter = function(dataLabelSettings, metadataColumn, maxValue) {
|
23619 | var max = 0 === dataLabelSettings.displayUnits ? maxValue : null;
|
23620 | metadataColumn && metadataColumn.objects && !_.isEmpty(powerbi.DataViewObjects.getValue(metadataColumn.objects, Gauge.formatStringProp)) || (metadataColumn = this.data.metadataColumn);
|
23621 | var formatString = visuals.valueFormatter.getFormatString(metadataColumn, Gauge.formatStringProp), precision = visuals.dataLabelUtils.getLabelPrecision(dataLabelSettings.precision, formatString), valueFormatterOptions = visuals.dataLabelUtils.getOptionsForLabelFormatter(dataLabelSettings, formatString, max, precision);
|
23622 | return valueFormatterOptions.formatSingleValues = !(dataLabelSettings.displayUnits > 0),
|
23623 | visuals.valueFormatter.create(valueFormatterOptions);
|
23624 | }, Gauge.prototype.renderTarget = function(radius, height, width, margin) {
|
23625 | var targetSettings = this.targetSettings, target = targetSettings.target, tRatio = this.getTargetRatio(), top = radius + (height - radius) / 2 + margin.top, flag = tRatio > .5, padding = this.settings.labels.padding, anchor = flag ? "start" : "end", formatter = this.getFormatter(this.data.dataLabelsSettings, this.data.targetColumnMetadata, targetSettings.max), maxRatio = Math.asin(Gauge.MinDistanceFromBottom / radius) / Math.PI, finalRatio = maxRatio > tRatio || tRatio > 1 - maxRatio ? flag ? 1 - maxRatio : maxRatio : tRatio, targetX = margin.left + width / 2 - (radius + padding) * Math.cos(Math.PI * finalRatio), targetY = top - (radius + padding) * Math.sin(Math.PI * finalRatio);
|
23626 | this.targetText || (this.targetText = this.mainGraphicsContext.append("text").classed(Gauge.TargetText["class"], !0)),
|
23627 | this.targetText.attr({
|
23628 | x: targetX,
|
23629 | y: targetY
|
23630 | }).style({
|
23631 | "text-anchor": anchor,
|
23632 | display: this.showTargetLabel ? "" : "none",
|
23633 | "font-size": this.style.labelText.fontSize
|
23634 | }).text(formatter.format(target)), this.truncateTextIfNeeded(this.targetText, targetX, flag),
|
23635 | this.targetText.call(visuals.tooltipUtils.tooltipUpdate, [ formatter.format(target) ]),
|
23636 | this.targetConnector || (this.targetConnector = this.mainGraphicsContext.append("line").classed(Gauge.TargetConnector["class"], !0)),
|
23637 | tRatio === finalRatio ? this.targetConnector.style("display", "none") : this.targetConnector.attr({
|
23638 | x1: margin.left + width / 2 - radius * Math.cos(Math.PI * tRatio),
|
23639 | y1: top - radius * Math.sin(Math.PI * tRatio),
|
23640 | x2: targetX,
|
23641 | y2: targetY
|
23642 | }).style({
|
23643 | "stroke-width": this.settings.targetLine.thickness,
|
23644 | stroke: this.settings.targetLine.color,
|
23645 | display: ""
|
23646 | });
|
23647 | }, Gauge.prototype.arcTween = function(transition, arr) {
|
23648 | transition.attrTween("d", function(d) {
|
23649 | var interpolate = d3.interpolate(d.endAngle, arr[0]);
|
23650 | return function(t) {
|
23651 | return d.endAngle = interpolate(t), arr[1](d);
|
23652 | };
|
23653 | });
|
23654 | }, Gauge.prototype.showMinMaxLabelsOnBottom = function() {
|
23655 | if (this.currentViewport.height > this.currentViewport.width) return !0;
|
23656 | if (this.data && this.gaugeVisualProperties) {
|
23657 | var ticks = this.createTicks(), visualWhitespace = (this.currentViewport.width - 2 * this.gaugeVisualProperties.radius) / 2, maxLabelWidth = visualWhitespace - this.settings.labels.padding, textProperties = powerbi.TextMeasurementService.getMeasurementProperties($(this.svg.node()));
|
23658 | textProperties.fontSize = PixelConverter.fromPoint(this.data.dataLabelsSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt);
|
23659 | for (var width = void 0, _i = 0, _a = [ ticks[0], ticks[ticks.length - 1] ]; _i < _a.length; _i++) {
|
23660 | var tickValue = _a[_i];
|
23661 | if (textProperties.text = tickValue, width = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties),
|
23662 | width > maxLabelWidth) return !0;
|
23663 | }
|
23664 | }
|
23665 | return !1;
|
23666 | }, Gauge.prototype.setMargins = function() {
|
23667 | if (this.gaugeSmallViewPortProperties && this.gaugeSmallViewPortProperties.smallGaugeMarginsOnSmallViewPort && this.currentViewport.height < this.gaugeSmallViewPortProperties.MinHeightGaugeSideNumbersVisible) {
|
23668 | var margins = this.gaugeSmallViewPortProperties.GaugeMarginsOnSmallViewPort;
|
23669 | return void (this.margin = {
|
23670 | top: margins,
|
23671 | bottom: margins,
|
23672 | left: margins,
|
23673 | right: margins
|
23674 | });
|
23675 | }
|
23676 | if (this.margin = {
|
23677 | top: Gauge.DefaultTopBottomMargin,
|
23678 | bottom: Gauge.DefaultTopBottomMargin,
|
23679 | left: Gauge.DefaultLeftRightMargin,
|
23680 | right: Gauge.DefaultLeftRightMargin
|
23681 | }, !this.showSideNumbersLabelText() || this.showMinMaxLabelsOnBottom()) {
|
23682 | var targetSettings = this.targetSettings;
|
23683 | if (this.showTargetLabel) {
|
23684 | var tRatio = (targetSettings.target - targetSettings.min) / (targetSettings.max - targetSettings.min);
|
23685 | tRatio > .5 ? this.margin.left = Gauge.ReducedLeftRightMargin : this.margin.right = Gauge.ReducedLeftRightMargin;
|
23686 | } else this.margin.left = this.margin.right = Gauge.ReducedLeftRightMargin;
|
23687 | }
|
23688 | var fontSize = 0;
|
23689 | this.data && this.data.dataLabelsSettings && this.data.dataLabelsSettings.fontSize && this.data.dataLabelsSettings.fontSize >= visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt && (fontSize = PixelConverter.fromPointToPixel(this.data.dataLabelsSettings.fontSize - visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt)),
|
23690 | 0 !== fontSize && (this.margin.bottom += fontSize, this.margin.left += fontSize,
|
23691 | this.margin.right += fontSize);
|
23692 | }, Gauge.prototype.showSideNumbersLabelText = function() {
|
23693 | return !(this.gaugeSmallViewPortProperties && this.gaugeSmallViewPortProperties.hideGaugeSideNumbersOnSmallViewPort && this.currentViewport.height < this.gaugeSmallViewPortProperties.MinHeightGaugeSideNumbersVisible);
|
23694 | }, Gauge.MinDistanceFromBottom = 10, Gauge.MinWidthForTargetLabel = 150, Gauge.DefaultTopBottomMargin = 20,
|
23695 | Gauge.DefaultLeftRightMargin = 45, Gauge.ReducedLeftRightMargin = 15, Gauge.DEFAULT_MAX = 1,
|
23696 | Gauge.DEFAULT_MIN = 0, Gauge.VisualClassName = "gauge", Gauge.DefaultStyleProperties = {
|
23697 | transition: {
|
23698 | ease: "bounce"
|
23699 | },
|
23700 | arcColors: {
|
23701 | background: "#e9e9e9",
|
23702 | foreground: "#00B8AA"
|
23703 | },
|
23704 | targetLine: {
|
23705 | show: !0,
|
23706 | color: "#666666",
|
23707 | thickness: 2
|
23708 | },
|
23709 | labels: {
|
23710 | count: 2,
|
23711 | padding: 5,
|
23712 | fontSize: visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt
|
23713 | },
|
23714 | kpiBands: {
|
23715 | show: !1,
|
23716 | separationRadians: Math.PI / 128,
|
23717 | thickness: 5
|
23718 | }
|
23719 | }, Gauge.DefaultTargetSettings = {
|
23720 | min: 0,
|
23721 | max: 1,
|
23722 | target: void 0
|
23723 | }, Gauge.DefaultDataPointSettings = {
|
23724 | fillColor: Gauge.DefaultStyleProperties.arcColors.foreground,
|
23725 | targetColor: Gauge.DefaultStyleProperties.targetLine.color
|
23726 | }, Gauge.InnerRadiusFactor = .7, Gauge.KpiBandDistanceFromMainArc = 2, Gauge.MainGaugeGroupClassName = "mainGroup",
|
23727 | Gauge.LabelText = createClassAndSelector("labelText"), Gauge.TargetConnector = createClassAndSelector("targetConnector"),
|
23728 | Gauge.TargetText = createClassAndSelector("targetText"), Gauge.formatStringProp = {
|
23729 | objectName: "general",
|
23730 | propertyName: "formatString"
|
23731 | }, Gauge;
|
23732 | }();
|
23733 | visuals.Gauge = Gauge;
|
23734 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
23735 | }(powerbi || (powerbi = {}));
|
23736 | }, function(module, exports) {
|
23737 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
23738 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
23739 | !function(powerbi) {
|
23740 | var visuals;
|
23741 | !function(visuals) {
|
23742 | var Utility = jsCommon.Utility, ImageVisual = function() {
|
23743 | function ImageVisual() {
|
23744 | this.scalingType = visuals.imageScalingType.normal;
|
23745 | }
|
23746 | return ImageVisual.prototype.init = function(options) {
|
23747 | this.element = options.element;
|
23748 | }, ImageVisual.prototype.enumerateObjectInstances = function(options) {
|
23749 | switch (options.objectName) {
|
23750 | case "imageScaling":
|
23751 | return this.enumerateImageScaling();
|
23752 | }
|
23753 | return null;
|
23754 | }, ImageVisual.prototype.enumerateImageScaling = function() {
|
23755 | return [ {
|
23756 | selector: null,
|
23757 | objectName: "imageScaling",
|
23758 | properties: {
|
23759 | imageScalingType: this.scalingType
|
23760 | }
|
23761 | } ];
|
23762 | }, ImageVisual.prototype.update = function(options) {
|
23763 | var dataViews = options.dataViews;
|
23764 | if (dataViews && 0 !== dataViews.length) {
|
23765 | var objects = dataViews[0].metadata.objects;
|
23766 | if (objects && objects.general) {
|
23767 | var div = this.imageBackgroundElement;
|
23768 | div || (div = $("<div class='imageBackground' />"), this.imageBackgroundElement = div,
|
23769 | this.imageBackgroundElement.appendTo(this.element));
|
23770 | var viewport = options.viewport;
|
23771 | div.css("height", viewport.height), objects.imageScaling ? this.scalingType = objects.imageScaling.imageScalingType.toString() : this.scalingType = visuals.imageScalingType.normal;
|
23772 | var imageUrl = objects.general.imageUrl;
|
23773 | Utility.isLocalUrl(imageUrl) && div.css("backgroundImage", "url(" + imageUrl + ")"),
|
23774 | this.scalingType === visuals.imageScalingType.fit ? div.css("background-size", "100% 100%") : this.scalingType === visuals.imageScalingType.fill ? div.css("background-size", "cover") : div.css("background-size", "contain");
|
23775 | }
|
23776 | }
|
23777 | }, ImageVisual;
|
23778 | }();
|
23779 | visuals.ImageVisual = ImageVisual;
|
23780 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
23781 | }(powerbi || (powerbi = {}));
|
23782 | }, function(module, exports) {
|
23783 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
23784 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
23785 | !function(powerbi) {
|
23786 | var visuals;
|
23787 | !function(visuals) {
|
23788 | function GetStatus(actual, goals, directionType) {
|
23789 | if (!goals || 0 === goals.length) return KPIStatusWithHistory.status.NOGOAL;
|
23790 | var maxGoal, minGoal;
|
23791 | if (2 === goals.length) {
|
23792 | if (maxGoal = Math.max.apply(Math, goals), minGoal = Math.min.apply(Math, goals),
|
23793 | actual >= minGoal && maxGoal >= actual) return KPIStatusWithHistory.status.IN_BETWEEN;
|
23794 | } else maxGoal = goals[0], minGoal = goals[0];
|
23795 | switch (directionType) {
|
23796 | case visuals.kpiDirection.positive:
|
23797 | if (minGoal > actual) return KPIStatusWithHistory.status.DROP;
|
23798 | break;
|
23799 |
|
23800 | case visuals.kpiDirection.negative:
|
23801 | if (actual > maxGoal) return KPIStatusWithHistory.status.DROP;
|
23802 | }
|
23803 | return KPIStatusWithHistory.status.INCREASE;
|
23804 | }
|
23805 | function getDistanceFromGoalInPercentageString(actual, goals, directionType) {
|
23806 | if (!goals || 1 !== goals.length || 0 === goals[0]) return "";
|
23807 | var distance, sign = "+", goal = goals[0];
|
23808 | switch (distance = Math.abs(actual - goal), directionType) {
|
23809 | case visuals.kpiDirection.positive:
|
23810 | goal > actual && (sign = "-");
|
23811 | break;
|
23812 |
|
23813 | case visuals.kpiDirection.negative:
|
23814 | actual > goal && (sign = "-");
|
23815 | }
|
23816 | var percent = Number((100 * distance / goal).toFixed(2));
|
23817 | return "(" + sign + percent + "%)";
|
23818 | }
|
23819 | function GetTextColorClassByStatus(status) {
|
23820 | switch (status) {
|
23821 | case KPIStatusWithHistory.status.NOGOAL:
|
23822 | return KPIStatusWithHistory.kpiTextGreyClass;
|
23823 |
|
23824 | case KPIStatusWithHistory.status.INCREASE:
|
23825 | return KPIStatusWithHistory.kpiGreenClass;
|
23826 |
|
23827 | case KPIStatusWithHistory.status.IN_BETWEEN:
|
23828 | return KPIStatusWithHistory.kpiYellowClass;
|
23829 |
|
23830 | case KPIStatusWithHistory.status.DROP:
|
23831 | return KPIStatusWithHistory.kpiRedClass;
|
23832 | }
|
23833 | }
|
23834 | function GetGraphColorClassByStatus(status) {
|
23835 | switch (status) {
|
23836 | case KPIStatusWithHistory.status.NOGOAL:
|
23837 | return KPIStatusWithHistory.kpiGraphGreyClass;
|
23838 |
|
23839 | case KPIStatusWithHistory.status.INCREASE:
|
23840 | return KPIStatusWithHistory.kpiGreenClass;
|
23841 |
|
23842 | case KPIStatusWithHistory.status.IN_BETWEEN:
|
23843 | return KPIStatusWithHistory.kpiYellowClass;
|
23844 |
|
23845 | case KPIStatusWithHistory.status.DROP:
|
23846 | return KPIStatusWithHistory.kpiRedClass;
|
23847 | }
|
23848 | }
|
23849 | var DataRoleHelper = powerbi.data.DataRoleHelper, KPIStatusWithHistory = function() {
|
23850 | function KPIStatusWithHistory() {}
|
23851 | return KPIStatusWithHistory.prototype.init = function(options) {
|
23852 | KPIStatusWithHistory.getLocalizedString = options.host.getLocalizedString, this.rootElement = d3.select(options.element.get(0)).append("div").attr("text-align", "center").classed("kpiVisual", !0),
|
23853 | this.svg = this.rootElement.append("svg");
|
23854 | var mainGroupElement = this.mainGroupElement = this.svg.append("g");
|
23855 | this.areaFill = mainGroupElement.append("path"), this.textContainer = this.rootElement.append("div").classed("textContainer", !0),
|
23856 | this.indicatorTextContainer = this.textContainer.append("div").classed("indicatorText", !0),
|
23857 | this.absoluteGoalDistanceText = this.textContainer.append("div").classed("goalText", !0),
|
23858 | this.kpiActualText = this.indicatorTextContainer.append("div").attr("id", "indicatorText"),
|
23859 | this.initIcons(), this.host = options.host;
|
23860 | }, KPIStatusWithHistory.prototype.update = function(options) {
|
23861 | if (options.dataViews && options.dataViews[0]) {
|
23862 | var dataView = this.dataView = options.dataViews[0], viewport = options.viewport;
|
23863 | if ((!dataView.categorical || !dataView.categorical.values || dataView.categorical.values.length < 1) && (!dataView.categorical || !dataView.categorical.categories || dataView.categorical.categories.length < 1)) return this.svg.attr("visibility", "hidden"),
|
23864 | void this.textContainer.attr("style", "display:none");
|
23865 | this.svg.attr("visibility", "visible");
|
23866 | var kpiViewModel = KPIStatusWithHistory.converter(dataView, viewport, KPIStatusWithHistory.getProp_KPIDirection(dataView));
|
23867 | this.render(kpiViewModel, viewport);
|
23868 | }
|
23869 | }, KPIStatusWithHistory.prototype.initIcons = function() {
|
23870 | this.successMarkIcon = this.indicatorTextContainer.append("div").classed("powervisuals-glyph checkmark kpi-visual-green", !0),
|
23871 | this.betweenIcon = this.indicatorTextContainer.append("div").classed("powervisuals-glyph circle-small kpi-visual-yellow", !0),
|
23872 | this.exclamationMarkIcon = this.indicatorTextContainer.append("div").classed("powervisuals-glyph exclamation kpi-visual-red", !0),
|
23873 | this.successMarkIcon.attr("style", "display:none"), this.betweenIcon.attr("style", "display:none"),
|
23874 | this.exclamationMarkIcon.attr("style", "display:none");
|
23875 | }, KPIStatusWithHistory.prototype.render = function(kpiViewModel, viewport) {
|
23876 | if (this.setShowDataMissingWarning(!(kpiViewModel.indicatorExists && kpiViewModel.trendExists)),
|
23877 | 0 === kpiViewModel.dataPoints.length || !kpiViewModel.indicatorExists || !kpiViewModel.trendExists) return this.areaFill.attr("visibility", "hidden"),
|
23878 | this.svg.attr("visibility", "hidden"), void this.textContainer.attr("style", "display:none");
|
23879 | this.svg.attr({
|
23880 | height: viewport.height,
|
23881 | width: viewport.width
|
23882 | });
|
23883 | var status = KPIStatusWithHistory.status.NOGOAL;
|
23884 | kpiViewModel.targetExists && kpiViewModel.indicatorExists && kpiViewModel.trendExists && (status = GetStatus(kpiViewModel.actual, kpiViewModel.goals, kpiViewModel.directionType));
|
23885 | var actualText = kpiViewModel.formattedValue, calculatedHeight = KPIStatusWithHistory.indicatorTextSizeInPx;
|
23886 | this.textContainer.attr("style", "width:" + viewport.width + "px;top:" + (viewport.height - calculatedHeight) / 2 + "px"),
|
23887 | this.kpiActualText.classed(KPIStatusWithHistory.allColorClasses, !1).classed(GetTextColorClassByStatus(status), !0).attr("text-anchor", "middle").text(actualText);
|
23888 | var icon = null;
|
23889 | switch (status) {
|
23890 | case KPIStatusWithHistory.status.INCREASE:
|
23891 | icon = this.successMarkIcon, this.exclamationMarkIcon.attr("style", "display:none"),
|
23892 | this.betweenIcon.attr("style", "display:none");
|
23893 | break;
|
23894 |
|
23895 | case KPIStatusWithHistory.status.IN_BETWEEN:
|
23896 | icon = this.betweenIcon, this.exclamationMarkIcon.attr("style", "display:none"),
|
23897 | this.successMarkIcon.attr("style", "display:none");
|
23898 | break;
|
23899 |
|
23900 | case KPIStatusWithHistory.status.DROP:
|
23901 | icon = this.exclamationMarkIcon, this.successMarkIcon.attr("style", "display:none"),
|
23902 | this.betweenIcon.attr("style", "display:none");
|
23903 | break;
|
23904 |
|
23905 | default:
|
23906 | this.exclamationMarkIcon.attr("style", "display:none"), this.successMarkIcon.attr("style", "display:none"),
|
23907 | this.betweenIcon.attr("style", "display:none");
|
23908 | }
|
23909 | icon && icon.attr("style", "font-size:12px");
|
23910 | var shownGoalString = kpiViewModel.showGoal ? kpiViewModel.formattedGoalString + " " : "", shownDistanceFromGoalString = kpiViewModel.showDistanceFromGoal ? getDistanceFromGoalInPercentageString(kpiViewModel.actual, kpiViewModel.goals, kpiViewModel.directionType) : "";
|
23911 | if (this.absoluteGoalDistanceText.attr("text-anchor", "middle").text(shownGoalString + shownDistanceFromGoalString),
|
23912 | kpiViewModel.showTrendLine && kpiViewModel.historyExists) {
|
23913 | var area = d3.svg.area().x(function(d) {
|
23914 | return d.x;
|
23915 | }).y0(viewport.height).y1(function(d) {
|
23916 | return d.y;
|
23917 | });
|
23918 | this.areaFill.classed(KPIStatusWithHistory.allColorClasses, !1).classed(GetGraphColorClassByStatus(status), !0).attr("d", area(kpiViewModel.dataPoints)).attr("stroke", "none").attr("visibility", "visible").attr("fill-opacity", .2);
|
23919 | } else this.areaFill.attr("visibility", "hidden");
|
23920 | }, KPIStatusWithHistory.prototype.setShowDataMissingWarning = function(show) {
|
23921 | this.host.setWarnings(show ? [ new visuals.VisualKPIDataMissingWarning() ] : []);
|
23922 | }, KPIStatusWithHistory.getDefaultFormatSettings = function() {
|
23923 | return {
|
23924 | labelSettings: visuals.dataLabelUtils.getDefaultLabelSettings(!0, visuals.Card.DefaultStyle.value.color),
|
23925 | textSize: 27,
|
23926 | wordWrap: !1
|
23927 | };
|
23928 | }, KPIStatusWithHistory.getFormatString = function(column) {
|
23929 | return visuals.valueFormatter.getFormatString(column, visuals.AnimatedText.formatStringProp);
|
23930 | }, KPIStatusWithHistory.getProp_Show_KPIGoal = function(dataView) {
|
23931 | return dataView && dataView.metadata ? powerbi.DataViewObjects.getValue(dataView.metadata.objects, KPIStatusWithHistory.showKPIGoal, !0) : !0;
|
23932 | }, KPIStatusWithHistory.getProp_Show_KPITrendLine = function(dataView) {
|
23933 | return dataView && dataView.metadata ? powerbi.DataViewObjects.getValue(dataView.metadata.objects, KPIStatusWithHistory.showKPITrendLine, !0) : !0;
|
23934 | }, KPIStatusWithHistory.getProp_Show_KPIDistance = function(dataView) {
|
23935 | return dataView && dataView.metadata ? powerbi.DataViewObjects.getValue(dataView.metadata.objects, KPIStatusWithHistory.showKPIDistance, !0) : !0;
|
23936 | }, KPIStatusWithHistory.getProp_KPIDirection = function(dataView) {
|
23937 | return dataView && dataView.metadata ? powerbi.DataViewObjects.getValue(dataView.metadata.objects, KPIStatusWithHistory.directionTypeStringProp, visuals.kpiDirection.positive) : visuals.kpiDirection.positive;
|
23938 | }, KPIStatusWithHistory.getProp_Indicator_DisplayUnits = function(dataView) {
|
23939 | return KPIStatusWithHistory.initDefaultLabelSettings(), dataView && dataView.metadata ? powerbi.DataViewObjects.getValue(dataView.metadata.objects, KPIStatusWithHistory.indicatorDisplayUnitsProp, KPIStatusWithHistory.defaultLabelSettings.displayUnits) : KPIStatusWithHistory.defaultLabelSettings.displayUnits;
|
23940 | }, KPIStatusWithHistory.getProp_Indicator_Precision = function(dataView) {
|
23941 | return KPIStatusWithHistory.initDefaultLabelSettings(), dataView && dataView.metadata ? powerbi.DataViewObjects.getValue(dataView.metadata.objects, KPIStatusWithHistory.indicatorPrecisionProp, KPIStatusWithHistory.defaultLabelSettings.precision) : KPIStatusWithHistory.defaultLabelSettings.precision;
|
23942 | }, KPIStatusWithHistory.initDefaultLabelSettings = function() {
|
23943 | KPIStatusWithHistory.defaultCardFormatSetting || (KPIStatusWithHistory.defaultCardFormatSetting = KPIStatusWithHistory.getDefaultFormatSettings(),
|
23944 | KPIStatusWithHistory.defaultLabelSettings = KPIStatusWithHistory.defaultCardFormatSetting.labelSettings);
|
23945 | }, KPIStatusWithHistory.getFormattedValue = function(metaDataColumn, theValue, precision, displayUnits, displayUnitSystemType) {
|
23946 | void 0 === displayUnitSystemType && (displayUnitSystemType = powerbi.DisplayUnitSystemType.WholeUnits);
|
23947 | var isDefaultDisplayUnit = 0 === displayUnits, formatter = visuals.valueFormatter.create({
|
23948 | format: KPIStatusWithHistory.getFormatString(metaDataColumn),
|
23949 | value: displayUnits,
|
23950 | precision: precision,
|
23951 | displayUnitSystemType: displayUnitSystemType,
|
23952 | formatSingleValues: !!isDefaultDisplayUnit,
|
23953 | allowFormatBeautification: !0,
|
23954 | columnType: metaDataColumn ? metaDataColumn.type : void 0
|
23955 | });
|
23956 | return formatter.format(theValue);
|
23957 | }, KPIStatusWithHistory.getFormattedGoalString = function(metaDataColumn, goals, precision, displayUnits) {
|
23958 | if (!goals || 0 === goals.length) return "";
|
23959 | var goalsString = KPIStatusWithHistory.getLocalizedString("Visual_KPI_Goal_Title") + ": " + KPIStatusWithHistory.getFormattedValue(metaDataColumn, goals[0], precision, displayUnits);
|
23960 | return 2 === goals.length && (goalsString += ", " + KPIStatusWithHistory.getFormattedValue(metaDataColumn, goals[1], precision, displayUnits)),
|
23961 | goalsString;
|
23962 | }, KPIStatusWithHistory.converter = function(dataView, viewPort, directionType) {
|
23963 | var dataPoints = [], catDv = dataView.categorical, indicatorMetadataColumn = null, goalMetadataColumn = null, formattedGoalString = "", formattedValue = "", targetExists = !1, indicatorExists = !1, trendExists = !1, historyExists = !0;
|
23964 | dataView.categorical.categories || (historyExists = !1);
|
23965 | for (var values = catDv.values, columns = dataView.metadata.columns, _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
|
23966 | var column = columns_1[_i];
|
23967 | DataRoleHelper.hasRole(column, "Indicator") && (indicatorExists = !0, indicatorMetadataColumn = column),
|
23968 | DataRoleHelper.hasRole(column, "TrendLine") && (trendExists = !0), DataRoleHelper.hasRole(column, "Goal") && (targetExists = !0,
|
23969 | goalMetadataColumn = column);
|
23970 | }
|
23971 | if (!(indicatorExists && trendExists && values && 0 !== values.length && values[0].values && dataView.categorical.values)) return {
|
23972 | dataPoints: dataPoints,
|
23973 | directionType: directionType,
|
23974 | actual: 0,
|
23975 | goals: [],
|
23976 | formattedGoalString: formattedGoalString,
|
23977 | targetExists: targetExists,
|
23978 | historyExists: historyExists,
|
23979 | indicatorExists: indicatorExists,
|
23980 | trendExists: trendExists,
|
23981 | formattedValue: formattedValue,
|
23982 | showGoal: !1,
|
23983 | showDistanceFromGoal: !1,
|
23984 | showTrendLine: !1
|
23985 | };
|
23986 | var category, categoryValues;
|
23987 | historyExists && (category = catDv.categories[0], categoryValues = category.values);
|
23988 | for (var actualValue, historyActualData = [], historyGoalData = [], indicatorColumns = KPIStatusWithHistory.getColumnsByRole(values, "Indicator"), goalColumns = KPIStatusWithHistory.getColumnsByRole(values, "Goal"), i = 0, len = values[0].values.length; len > i; i++) {
|
23989 | actualValue = indicatorColumns[0].values[i];
|
23990 | for (var goals_1 = [], goalCnt = 0; goalCnt < goalColumns.length; goalCnt++) goals_1.push(goalColumns[goalCnt].values[i]);
|
23991 | historyGoalData.push(goals_1), historyActualData.push(actualValue);
|
23992 | }
|
23993 | for (var maxActualData = Math.max.apply(Math, historyActualData), minActualData = Math.min.apply(Math, historyActualData), areaMaxHight = viewPort.height * KPIStatusWithHistory.trendAreaFilePercentage, precision = KPIStatusWithHistory.getProp_Indicator_Precision(dataView), displayUnits = KPIStatusWithHistory.getProp_Indicator_DisplayUnits(dataView), i = 0; i < historyActualData.length; i++) {
|
23994 | var yPos = areaMaxHight * (historyActualData[i] - minActualData) / (maxActualData - minActualData), selectorId = null;
|
23995 | historyExists && (selectorId = visuals.SelectionId.createWithId(category.identity[i]).getSelector()),
|
23996 | dataPoints.push({
|
23997 | x: i * viewPort.width / (historyActualData.length - 1),
|
23998 | y: viewPort.height - yPos,
|
23999 | actual: historyActualData[i],
|
24000 | goals: historyGoalData[i]
|
24001 | });
|
24002 | }
|
24003 | var actual, goals;
|
24004 | dataPoints.length > 0 && (actual = dataPoints[dataPoints.length - 1].actual, goals = dataPoints[dataPoints.length - 1].goals),
|
24005 | 1 === dataPoints.length && (historyExists = !1), formattedValue = KPIStatusWithHistory.getFormattedValue(indicatorMetadataColumn, actual, precision, displayUnits, powerbi.DisplayUnitSystemType.DataLabels),
|
24006 | formattedGoalString = KPIStatusWithHistory.getFormattedGoalString(goalMetadataColumn, goals, precision, displayUnits);
|
24007 | var showGoal = KPIStatusWithHistory.getProp_Show_KPIGoal(dataView), showDistanceFromGoal = KPIStatusWithHistory.getProp_Show_KPIDistance(dataView), showTrendLine = KPIStatusWithHistory.getProp_Show_KPITrendLine(dataView);
|
24008 | return {
|
24009 | dataPoints: dataPoints,
|
24010 | directionType: directionType,
|
24011 | actual: actual,
|
24012 | goals: goals,
|
24013 | formattedGoalString: formattedGoalString,
|
24014 | targetExists: targetExists,
|
24015 | historyExists: historyExists,
|
24016 | indicatorExists: indicatorExists,
|
24017 | trendExists: trendExists,
|
24018 | formattedValue: formattedValue,
|
24019 | showGoal: showGoal,
|
24020 | showDistanceFromGoal: showDistanceFromGoal,
|
24021 | showTrendLine: showTrendLine
|
24022 | };
|
24023 | }, KPIStatusWithHistory.getColumnsByRole = function(values, roleString) {
|
24024 | for (var retval = [], i = 0; i < values.length; i++) DataRoleHelper.hasRole(values[i].source, roleString) && retval.push(values[i]);
|
24025 | return retval;
|
24026 | }, KPIStatusWithHistory.prototype.enumerateObjectInstances = function(options) {
|
24027 | var instances = [], dataView = this.dataView;
|
24028 | switch (options.objectName) {
|
24029 | case "indicator":
|
24030 | instances.push({
|
24031 | selector: null,
|
24032 | objectName: "indicator",
|
24033 | properties: {
|
24034 | indicatorDisplayUnits: KPIStatusWithHistory.getProp_Indicator_DisplayUnits(dataView),
|
24035 | indicatorPrecision: KPIStatusWithHistory.getProp_Indicator_Precision(dataView)
|
24036 | }
|
24037 | });
|
24038 |
|
24039 | case "trendline":
|
24040 | instances.push({
|
24041 | selector: null,
|
24042 | objectName: "trendline",
|
24043 | properties: {
|
24044 | show: KPIStatusWithHistory.getProp_Show_KPITrendLine(dataView)
|
24045 | }
|
24046 | });
|
24047 |
|
24048 | case "goals":
|
24049 | instances.push({
|
24050 | selector: null,
|
24051 | objectName: "goals",
|
24052 | properties: {
|
24053 | showGoal: KPIStatusWithHistory.getProp_Show_KPIGoal(dataView),
|
24054 | showDistance: KPIStatusWithHistory.getProp_Show_KPIDistance(dataView)
|
24055 | }
|
24056 | });
|
24057 |
|
24058 | case "status":
|
24059 | instances.push({
|
24060 | selector: null,
|
24061 | objectName: "status",
|
24062 | properties: {
|
24063 | direction: KPIStatusWithHistory.getProp_KPIDirection(dataView)
|
24064 | }
|
24065 | });
|
24066 | }
|
24067 | return instances;
|
24068 | }, KPIStatusWithHistory.prototype.destroy = function() {
|
24069 | this.svg = null;
|
24070 | }, KPIStatusWithHistory.directionTypeStringProp = {
|
24071 | objectName: "status",
|
24072 | propertyName: "direction"
|
24073 | }, KPIStatusWithHistory.showKPIGoal = {
|
24074 | objectName: "goals",
|
24075 | propertyName: "showGoal"
|
24076 | }, KPIStatusWithHistory.showKPIDistance = {
|
24077 | objectName: "goals",
|
24078 | propertyName: "showDistance"
|
24079 | }, KPIStatusWithHistory.showKPITrendLine = {
|
24080 | objectName: "trendline",
|
24081 | propertyName: "show"
|
24082 | }, KPIStatusWithHistory.indicatorDisplayUnitsProp = {
|
24083 | objectName: "indicator",
|
24084 | propertyName: "indicatorDisplayUnits"
|
24085 | }, KPIStatusWithHistory.indicatorPrecisionProp = {
|
24086 | objectName: "indicator",
|
24087 | propertyName: "indicatorPrecision"
|
24088 | }, KPIStatusWithHistory.status = {
|
24089 | INCREASE: "increase",
|
24090 | DROP: "drop",
|
24091 | IN_BETWEEN: "in-between",
|
24092 | NOGOAL: "no-goal"
|
24093 | }, KPIStatusWithHistory.statusBandingType = {
|
24094 | Below: "BELOW",
|
24095 | Above: "ABOVE"
|
24096 | }, KPIStatusWithHistory.actualTextConsts = {
|
24097 | VERTICAL_OFFSET_FROM_HALF_HEIGHT: 20,
|
24098 | FONT_WIDTH_FACTOR: 14,
|
24099 | RIGHT_MARGIN: 10
|
24100 | }, KPIStatusWithHistory.kpiRedClass = "kpi-visual-red", KPIStatusWithHistory.kpiYellowClass = "kpi-visual-yellow",
|
24101 | KPIStatusWithHistory.kpiGreenClass = "kpi-visual-green", KPIStatusWithHistory.kpiTextGreyClass = "kpi-visual-text-grey",
|
24102 | KPIStatusWithHistory.kpiGraphGreyClass = "kpi-visual-graph-grey", KPIStatusWithHistory.allColorClasses = KPIStatusWithHistory.kpiRedClass + " " + KPIStatusWithHistory.kpiYellowClass + " " + KPIStatusWithHistory.kpiGreenClass + " " + KPIStatusWithHistory.kpiTextGreyClass + " " + KPIStatusWithHistory.kpiGraphGreyClass,
|
24103 | KPIStatusWithHistory.trendAreaFilePercentage = 1, KPIStatusWithHistory.estimatedIconHeightInPx = 9,
|
24104 | KPIStatusWithHistory.indicatorTextSizeInPx = 60, KPIStatusWithHistory;
|
24105 | }();
|
24106 | visuals.KPIStatusWithHistory = KPIStatusWithHistory;
|
24107 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
24108 | }(powerbi || (powerbi = {}));
|
24109 | }, function(module, exports) {
|
24110 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
24111 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
24112 | !function(powerbi) {
|
24113 | var visuals;
|
24114 | !function(visuals) {
|
24115 | var EnumExtensions = jsCommon.EnumExtensions, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter, LineChart = function() {
|
24116 | function LineChart(options) {
|
24117 | var _this = this;
|
24118 | this.pathXAdjustment = 0, this.deferDragMoveOperation = jsCommon.DeferUtility.deferUntilNextFrame(function() {
|
24119 | if (_this.lastDragMoveXPosition) {
|
24120 | var index = _this.findIndex(_this.lastDragMoveXPosition - _this.margin.left);
|
24121 | _this.selectColumn(index), _this.lastDragMoveXPosition = void 0;
|
24122 | }
|
24123 | }), this.isScrollable = options.isScrollable ? options.isScrollable : !1, this.tooltipsEnabled = options.tooltipsEnabled,
|
24124 | this.lineType = options.chartType ? options.chartType : 1, this.interactivityService = options.interactivityService,
|
24125 | this.animator = options.animator, this.lineClassAndSelector = LineChart.LineClassSelector,
|
24126 | this.tooltipBucketEnabled = options.tooltipBucketEnabled, this.advancedLineLabelsEnabled = options.advancedLineLabelsEnabled;
|
24127 | }
|
24128 | return LineChart.customizeQuery = function(options) {
|
24129 | var dataViewMapping = options.dataViewMappings[0];
|
24130 | if (dataViewMapping && dataViewMapping.categorical && dataViewMapping.categorical.categories) if (dataViewMapping.categorical.dataVolume = 4,
|
24131 | visuals.CartesianChart.detectScalarMapping(dataViewMapping)) {
|
24132 | var dataViewCategories = dataViewMapping.categorical.categories;
|
24133 | dataViewCategories.dataReductionAlgorithm = {
|
24134 | sample: {}
|
24135 | };
|
24136 | } else visuals.CartesianChart.applyLoadMoreEnabledToMapping(options.cartesianLoadMoreEnabled, dataViewMapping);
|
24137 | }, LineChart.getSortableRoles = function(options) {
|
24138 | var dataViewMapping = options.dataViewMappings[0];
|
24139 | if (!dataViewMapping || !dataViewMapping.categorical || !dataViewMapping.categorical.categories) return null;
|
24140 | var dataViewCategories = dataViewMapping.categorical.categories, categoryItems = dataViewCategories["for"]["in"].items;
|
24141 | if (!_.isEmpty(categoryItems)) {
|
24142 | var categoryType = categoryItems[0].type, objects = void 0;
|
24143 | if (dataViewMapping.metadata && (objects = dataViewMapping.metadata.objects), !visuals.CartesianChart.getIsScalar(objects, visuals.lineChartProps.categoryAxis.axisType, categoryType)) return [ "Category", "Y" ];
|
24144 | }
|
24145 | return null;
|
24146 | }, LineChart.converter = function(dataView, blankCategoryValue, colors, isScalar, interactivityService, shouldCalculateStacked, isComboChart, tooltipsEnabled, tooltipBucketEnabled) {
|
24147 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0), void 0 === tooltipBucketEnabled && (tooltipBucketEnabled = !1);
|
24148 | var reader = powerbi.data.createIDataViewCategoricalReader(dataView), valueRoleName = reader.hasValues("Y") ? "Y" : "Y2", categorical = dataView.categorical, category = categorical.categories && categorical.categories.length > 0 ? categorical.categories[0] : {
|
24149 | source: void 0,
|
24150 | values: [ blankCategoryValue ],
|
24151 | identity: void 0
|
24152 | }, xAxisCardProperties = visuals.CartesianHelper.getCategoryAxisProperties(dataView.metadata);
|
24153 | isScalar = visuals.CartesianHelper.isScalar(isScalar, xAxisCardProperties);
|
24154 | var scalarMetadataColumn, scalarKeys = LineChart.getScalarKeys(category), useScalarKeys = isScalar && scalarKeys && !_.isEmpty(scalarKeys.values);
|
24155 | useScalarKeys && (scalarMetadataColumn = {
|
24156 | displayName: null,
|
24157 | type: {
|
24158 | dateTime: !0
|
24159 | }
|
24160 | }), categorical = visuals.ColumnUtil.applyUserMinMax(isScalar, categorical, xAxisCardProperties);
|
24161 | var defaultSeriesColor, formatStringProp = visuals.lineChartProps.general.formatString, categoryType = visuals.AxisHelper.getCategoryValueType(category.source, isScalar), isDateTime = visuals.AxisHelper.isDateTime(categoryType), categoryValues = category.values, categoryData = [], series = [], seriesCount = reader.getSeriesCount(valueRoleName), hasDynamicSeries = !(!categorical.values || !categorical.values.source), values = categorical.values, defaultLabelSettings = visuals.dataLabelUtils.getDefaultLineChartLabelSettings(isComboChart);
|
24162 | if (dataView.metadata && dataView.metadata.objects) {
|
24163 | var objects = dataView.metadata.objects;
|
24164 | defaultSeriesColor = isComboChart ? void 0 : powerbi.DataViewObjects.getFillColor(objects, visuals.lineChartProps.dataPoint.defaultColor);
|
24165 | var labelsObj = objects.labels;
|
24166 | visuals.dataLabelUtils.updateLineChartLabelSettingsFromLabelsObject(labelsObj, defaultLabelSettings);
|
24167 | }
|
24168 | var grouped, colorHelper = new visuals.ColorHelper(colors, visuals.lineChartProps.dataPoint.fill, defaultSeriesColor);
|
24169 | dataView.categorical.values && (grouped = dataView.categorical.values.grouped());
|
24170 | var stackedValues;
|
24171 | shouldCalculateStacked && (stackedValues = categorical.values && categorical.values.length > 0 ? _.times(categorical.values[0].values.length, function() {
|
24172 | return 0;
|
24173 | }) : []);
|
24174 | for (var seriesIndex = 0; seriesCount > seriesIndex; seriesIndex++) {
|
24175 | var column = categorical.values[seriesIndex], valuesMetadata = column.source, dataPoints = [], groupedIdentity = grouped[seriesIndex], identity = hasDynamicSeries && groupedIdentity ? visuals.SelectionId.createWithIdAndMeasure(groupedIdentity.identity, column.source.queryName) : visuals.SelectionId.createWithMeasure(column.source.queryName), key = identity.getKey(), color = this.getColor(colorHelper, hasDynamicSeries, values, grouped, seriesIndex, groupedIdentity), seriesLabelSettings = void 0;
|
24176 | if (!hasDynamicSeries) {
|
24177 | var labelsSeriesGroup = grouped && grouped.length > 0 && grouped[0].values ? grouped[0].values[seriesIndex] : null, labelObjects = labelsSeriesGroup && labelsSeriesGroup.source && labelsSeriesGroup.source.objects ? labelsSeriesGroup.source.objects.labels : null;
|
24178 | labelObjects && (seriesLabelSettings = powerbi.Prototype.inherit(defaultLabelSettings),
|
24179 | visuals.dataLabelUtils.updateLineChartLabelSettingsFromLabelsObject(labelObjects, seriesLabelSettings));
|
24180 | }
|
24181 | for (var dataPointLabelSettings = seriesLabelSettings ? seriesLabelSettings : defaultLabelSettings, useHighlightValues = column.highlights && column.highlights.length > 0, categoryCount = reader.hasCategories() ? reader.getCategoryCount() : 1, categoryIndex = 0; categoryCount > categoryIndex; categoryIndex++) {
|
24182 | var categoryValue = categoryValues[categoryIndex], xAxisValue = useScalarKeys ? scalarKeys.values[categoryIndex].min : categoryValue, value = visuals.AxisHelper.normalizeNonFiniteNumber(useHighlightValues ? reader.getHighlight(valueRoleName, categoryIndex, seriesIndex) : reader.getValue(valueRoleName, categoryIndex, seriesIndex));
|
24183 | if ((!isScalar || null != categoryValue && null != value) && (!isDateTime || null == categoryValue || categoryValue instanceof Date)) {
|
24184 | var categorical_1 = dataView.categorical, tooltipInfo = void 0, extraTooltipInfo = void 0;
|
24185 | tooltipsEnabled && (tooltipInfo = [], category.source && tooltipInfo.push({
|
24186 | displayName: category.source.displayName,
|
24187 | value: visuals.converterHelper.formatFromMetadataColumn(categoryValue, category.source, formatStringProp)
|
24188 | }), hasDynamicSeries && (category.source && category.source === categorical_1.values.source || tooltipInfo.push({
|
24189 | displayName: categorical_1.values.source.displayName,
|
24190 | value: visuals.converterHelper.formatFromMetadataColumn(grouped[seriesIndex].name, categorical_1.values.source, formatStringProp)
|
24191 | })), null != value && tooltipInfo.push({
|
24192 | displayName: valuesMetadata.displayName,
|
24193 | value: visuals.converterHelper.formatFromMetadataColumn(value, valuesMetadata, formatStringProp)
|
24194 | }), tooltipBucketEnabled && (extraTooltipInfo = [], visuals.TooltipBuilder.addTooltipBucketItem(reader, extraTooltipInfo, categoryIndex, hasDynamicSeries ? seriesIndex : void 0)));
|
24195 | var categoryKey = category && !_.isEmpty(category.identity) && category.identity[categoryIndex] ? category.identity[categoryIndex].key : categoryIndex, dataPoint = {
|
24196 | categoryValue: (isDateTime || useScalarKeys) && xAxisValue ? xAxisValue.getTime() : xAxisValue,
|
24197 | value: value,
|
24198 | categoryIndex: categoryIndex,
|
24199 | seriesIndex: seriesIndex,
|
24200 | tooltipInfo: tooltipInfo,
|
24201 | selected: !1,
|
24202 | identity: identity,
|
24203 | key: JSON.stringify({
|
24204 | series: key,
|
24205 | category: categoryKey
|
24206 | }),
|
24207 | labelFill: dataPointLabelSettings.labelColor,
|
24208 | labelFormatString: valuesMetadata.format,
|
24209 | labelSettings: dataPointLabelSettings,
|
24210 | extraTooltipInfo: extraTooltipInfo
|
24211 | };
|
24212 | shouldCalculateStacked && (stackedValues[categoryIndex] += value, dataPoint.stackedValue = stackedValues[categoryIndex]),
|
24213 | category.objects && category.objects[categoryIndex] && (dataPoint.pointColor = powerbi.DataViewObjects.getFillColor(category.objects[categoryIndex], visuals.lineChartProps.dataPoint.fill)),
|
24214 | dataPoints.push(dataPoint), categoryData[categoryIndex] || (categoryData[categoryIndex] = dataPoint);
|
24215 | }
|
24216 | }
|
24217 | interactivityService && interactivityService.applySelectionStateToData(dataPoints),
|
24218 | dataPoints.length > 0 && series.push({
|
24219 | displayName: visuals.converterHelper.formatFromMetadataColumn(reader.getValueDisplayName(valueRoleName, seriesIndex), reader.getValueMetadataColumn(valueRoleName, seriesIndex), formatStringProp),
|
24220 | dynamicDisplayName: hasDynamicSeries ? visuals.converterHelper.formatFromMetadataColumn(reader.getSeriesName(seriesIndex), reader.getSeriesMetadataColumn(), formatStringProp) : void 0,
|
24221 | key: key,
|
24222 | lineIndex: seriesIndex,
|
24223 | color: color,
|
24224 | xCol: useScalarKeys ? scalarMetadataColumn : category.source,
|
24225 | yCol: reader.getValueMetadataColumn(valueRoleName, seriesIndex),
|
24226 | data: dataPoints,
|
24227 | identity: identity,
|
24228 | selected: !1,
|
24229 | labelSettings: seriesLabelSettings
|
24230 | });
|
24231 | }
|
24232 | xAxisCardProperties = visuals.CartesianHelper.getCategoryAxisProperties(dataView.metadata);
|
24233 | var valueAxisProperties = visuals.CartesianHelper.getValueAxisProperties(dataView.metadata), valuesMetadataArray = [];
|
24234 | if (values) for (var i = 0; i < values.length; i++) values[i] && values[i].source && values[i].source.displayName && valuesMetadataArray.push({
|
24235 | displayName: values[i].source.displayName
|
24236 | });
|
24237 | var axesLabels = visuals.converterHelper.createAxesLabels(xAxisCardProperties, valueAxisProperties, category.source, valuesMetadataArray);
|
24238 | return interactivityService && interactivityService.applySelectionStateToData(series),
|
24239 | {
|
24240 | series: series,
|
24241 | isScalar: isScalar,
|
24242 | dataLabelsSettings: defaultLabelSettings,
|
24243 | axesLabels: {
|
24244 | x: axesLabels.xAxisLabel,
|
24245 | y: axesLabels.yAxisLabel
|
24246 | },
|
24247 | hasDynamicSeries: hasDynamicSeries,
|
24248 | categoryMetadata: category.source,
|
24249 | scalarMetadata: scalarMetadataColumn,
|
24250 | scalarKeyCount: useScalarKeys ? scalarKeys.values.length : void 0,
|
24251 | categories: categoryValues,
|
24252 | categoryData: categoryData,
|
24253 | seriesDisplayName: hasDynamicSeries ? visuals.converterHelper.formatFromMetadataColumn(reader.getSeriesDisplayName(), reader.getSeriesMetadataColumn(), formatStringProp) : void 0,
|
24254 | hasValues: reader.hasValues(valueRoleName)
|
24255 | };
|
24256 | }, LineChart.getInteractiveLineChartDomElement = function(element) {
|
24257 | return element.children("svg").get(0);
|
24258 | }, LineChart.getColor = function(colorHelper, hasDynamicSeries, values, grouped, seriesIndex, groupedIdentity) {
|
24259 | var objects;
|
24260 | return hasDynamicSeries ? grouped && grouped[seriesIndex] && (objects = grouped[seriesIndex].objects) : values[seriesIndex] && (objects = values[seriesIndex].source.objects),
|
24261 | hasDynamicSeries && groupedIdentity ? colorHelper.getColorForSeriesValue(objects, values.identityFields, groupedIdentity.name) : colorHelper.getColorForMeasure(objects, values[seriesIndex].source.queryName);
|
24262 | }, LineChart.createStackedValueDomain = function(data) {
|
24263 | if (0 === data.length) return null;
|
24264 | var minY = d3.min(data, function(kv) {
|
24265 | return d3.min(kv.data, function(d) {
|
24266 | return d.stackedValue;
|
24267 | });
|
24268 | }), maxY = d3.max(data, function(kv) {
|
24269 | return d3.max(kv.data, function(d) {
|
24270 | return d.stackedValue;
|
24271 | });
|
24272 | });
|
24273 | return [ minY, maxY ];
|
24274 | }, LineChart.prototype.init = function(options) {
|
24275 | var _this = this;
|
24276 | this.options = options, this.element = options.element, this.cartesainSVG = options.svg,
|
24277 | this.host = options.host, this.currentViewport = options.viewport, this.colors = options.style.colorPalette.dataColors,
|
24278 | this.isInteractiveChart = options.interactivity && options.interactivity.isInteractiveLegend,
|
24279 | this.cartesianVisualHost = options.cartesianHost, this.scaleDetector = new visuals.SVGScaleDetector(this.cartesainSVG);
|
24280 | var chartType = options.chartType;
|
24281 | this.isComboChart = 10 === chartType || 13 === chartType || 14 === chartType;
|
24282 | var svg = options.svg;
|
24283 | svg.classed(LineChart.ClassName, !0);
|
24284 | var graphicsContextParent = this.mainGraphicsSVG = svg.append("svg").classed("lineChartSVG", !0);
|
24285 | this.isComboChart || this.isInteractiveChart || (this.overlayRect = graphicsContextParent.append(LineChart.RectOverlayName).style("opacity", visuals.SVGUtil.AlmostZero)),
|
24286 | this.mainGraphicsContext = graphicsContextParent.append("g").classed(LineChart.MainGraphicsContextClassName, !0),
|
24287 | this.hoverLineContext = svg.append("g").classed("hover-line", !0), this.hoverLineContext.append(LineChart.LineElementName).attr("x1", 0).attr("x2", 0).attr("y1", 0).attr("y2", 0);
|
24288 | var hoverLine = this.hoverLine = this.hoverLineContext.select(LineChart.LineElementName);
|
24289 | if (this.isInteractiveChart && hoverLine.classed("interactive", !0), hoverLine.style("opacity", visuals.SVGUtil.AlmostZero),
|
24290 | this.selectionCircles = [], this.xAxisProperties = {
|
24291 | axis: null,
|
24292 | scale: null,
|
24293 | axisType: null,
|
24294 | formatter: null,
|
24295 | graphicsContext: null,
|
24296 | values: null,
|
24297 | axisLabel: null,
|
24298 | isCategoryAxis: !0
|
24299 | }, this.isInteractiveChart) {
|
24300 | var rootSvg_1 = LineChart.getInteractiveLineChartDomElement(this.element), dragMove = function() {
|
24301 | _this.lastDragMoveXPosition = d3.mouse(rootSvg_1)[0], _this.deferDragMoveOperation();
|
24302 | }, drag = d3.behavior.drag().origin(Object).on("drag", dragMove);
|
24303 | d3.select(rootSvg_1).style("touch-action", "none").call(drag).on("click", dragMove);
|
24304 | }
|
24305 | jsCommon.BrowserUtils.isInternetExplorerOrEdge() ? this.pathXAdjustment = 5 : jsCommon.BrowserUtils.isFirefox() && (this.pathXAdjustment = 2 * LineChart.interactivityStrokeWidth);
|
24306 | }, LineChart.prototype.setData = function(dataViews) {
|
24307 | if (this.data = {
|
24308 | series: [],
|
24309 | dataLabelsSettings: visuals.dataLabelUtils.getDefaultLineChartLabelSettings(this.isComboChart),
|
24310 | axesLabels: {
|
24311 | x: null,
|
24312 | y: null
|
24313 | },
|
24314 | hasDynamicSeries: !1,
|
24315 | categories: [],
|
24316 | categoryMetadata: void 0,
|
24317 | categoryData: []
|
24318 | }, dataViews.length > 0) {
|
24319 | var dataView = dataViews[0];
|
24320 | if (dataView && dataView.categorical) {
|
24321 | var dataViewCat = this.dataViewCat = dataView.categorical, dvCategories = dataViewCat.categories, categoryType = {
|
24322 | text: !0
|
24323 | }, scalarKeys = void 0;
|
24324 | dvCategories && !_.isEmpty(dvCategories) && (dvCategories[0].source && dvCategories[0].source.type && (categoryType = dvCategories[0].source.type),
|
24325 | scalarKeys = LineChart.getScalarKeys(dvCategories[0]));
|
24326 | var convertedData = LineChart.converter(dataView, visuals.valueFormatter.format(null), this.cartesianVisualHost.getSharedColors(), visuals.CartesianChart.getIsScalar(dataView.metadata ? dataView.metadata.objects : null, visuals.lineChartProps.categoryAxis.axisType, categoryType, scalarKeys), this.interactivityService, EnumExtensions.hasFlag(this.lineType, 16), this.isComboChart, this.tooltipsEnabled, this.tooltipBucketEnabled);
|
24327 | this.data = convertedData;
|
24328 | }
|
24329 | }
|
24330 | }, LineChart.prototype.calculateLegend = function() {
|
24331 | return this.createLegendDataPoints(0);
|
24332 | }, LineChart.prototype.hasLegend = function() {
|
24333 | return this.data && (this.data.hasDynamicSeries || this.data.series && this.data.series.length > 1);
|
24334 | }, LineChart.prototype.setFilteredData = function(startIndex, endIndex) {
|
24335 | var catgSize = endIndex - startIndex, data = this.clippedData = powerbi.Prototype.inherit(this.data);
|
24336 | return data.series = LineChart.sliceSeries(data.series, catgSize, startIndex), data.categories = data.categories.slice(startIndex, endIndex),
|
24337 | data;
|
24338 | }, LineChart.prototype.calculateAxesProperties = function(options) {
|
24339 | var _this = this, data = this.data, viewport = options.viewport, margin = options.margin;
|
24340 | this.currentViewport = viewport, this.margin = margin;
|
24341 | var origCatgSize = data.series && data.series.length > 0 ? data.series[0].data.length : 0, categoryWidth = visuals.CartesianChart.MinOrdinalRectThickness, isScalar = this.data.isScalar, trimOrdinalDataOnOverflow = options.trimOrdinalDataOnOverflow, preferredPlotArea = this.getPreferredPlotArea(isScalar, origCatgSize, categoryWidth);
|
24342 | if (this.clippedData = void 0, data && !isScalar && !this.isScrollable && trimOrdinalDataOnOverflow) {
|
24343 | var categoryCount = this.getCategoryCount(origCatgSize), catgSize = Math.min(origCatgSize, categoryCount);
|
24344 | catgSize !== origCatgSize && (data = this.clippedData = powerbi.Prototype.inherit(data),
|
24345 | this.clippedData.series = LineChart.sliceSeries(data.series, catgSize));
|
24346 | }
|
24347 | var xMetaDataColumn, yMetaDataColumn;
|
24348 | data.series && data.series.length > 0 && (xMetaDataColumn = data.series[0].xCol,
|
24349 | yMetaDataColumn = data.series[0].yCol);
|
24350 | var valueDomain = EnumExtensions.hasFlag(this.lineType, 16) ? LineChart.createStackedValueDomain(data.series) : visuals.AxisHelper.createValueDomain(data.series, !1), hasZeroValueInYDomain = options.valueAxisScaleType === visuals.axisScale.log && !visuals.AxisHelper.isLogScalePossible(valueDomain), combinedDomain = visuals.AxisHelper.combineDomain(options.forcedYDomain, valueDomain, options.ensureYDomain);
|
24351 | this.yAxisProperties = visuals.AxisHelper.createAxis({
|
24352 | pixelSpan: preferredPlotArea.height,
|
24353 | dataDomain: combinedDomain,
|
24354 | metaDataColumn: yMetaDataColumn,
|
24355 | formatString: visuals.valueFormatter.getFormatString(yMetaDataColumn, visuals.lineChartProps.general.formatString),
|
24356 | outerPadding: 0,
|
24357 | isScalar: !0,
|
24358 | isVertical: !0,
|
24359 | forcedTickCount: options.forcedTickCount,
|
24360 | useTickIntervalForDisplayUnits: !0,
|
24361 | isCategoryAxis: !1,
|
24362 | scaleType: options.valueAxisScaleType,
|
24363 | axisDisplayUnits: options.valueAxisDisplayUnits,
|
24364 | axisPrecision: options.valueAxisPrecision,
|
24365 | shouldClamp: !1
|
24366 | });
|
24367 | var metaDataColumn = data.scalarMetadata ? data.scalarMetadata : data.categoryMetadata, xAxisDataType = visuals.AxisHelper.getCategoryValueType(metaDataColumn), xDomain = visuals.AxisHelper.createDomain(data.series, xAxisDataType, this.data.isScalar, options.forcedXDomain, options.ensureXDomain), hasZeroValueInXDomain = options.categoryAxisScaleType === visuals.axisScale.log && !visuals.AxisHelper.isLogScalePossible(xDomain);
|
24368 | return this.xAxisProperties = visuals.AxisHelper.createAxis({
|
24369 | pixelSpan: preferredPlotArea.width,
|
24370 | dataDomain: xDomain,
|
24371 | metaDataColumn: xMetaDataColumn,
|
24372 | formatString: visuals.valueFormatter.getFormatString(xMetaDataColumn, visuals.lineChartProps.general.formatString),
|
24373 | outerPadding: this.data.isScalar ? LineChart.ScalarOuterPadding : 0,
|
24374 | isScalar: this.data.isScalar,
|
24375 | isVertical: !1,
|
24376 | forcedTickCount: options.forcedTickCount,
|
24377 | maxTickCount: data.scalarKeyCount,
|
24378 | useTickIntervalForDisplayUnits: !0,
|
24379 | getValueFn: function(index, type) {
|
24380 | return visuals.CartesianHelper.lookupXValue(_this.data, index, type, _this.data.isScalar);
|
24381 | },
|
24382 | categoryThickness: visuals.CartesianChart.getCategoryThickness(data.series, origCatgSize, this.getAvailableWidth(), xDomain, isScalar, trimOrdinalDataOnOverflow),
|
24383 | isCategoryAxis: !0,
|
24384 | scaleType: options.categoryAxisScaleType,
|
24385 | axisDisplayUnits: options.categoryAxisDisplayUnits,
|
24386 | axisPrecision: options.categoryAxisPrecision
|
24387 | }), this.xAxisProperties.axisLabel = options.showCategoryAxisLabel ? data.axesLabels.x : null,
|
24388 | this.yAxisProperties.axisLabel = options.showValueAxisLabel ? data.axesLabels.y : null,
|
24389 | this.xAxisProperties.hasDisallowedZeroInDomain = hasZeroValueInXDomain, this.yAxisProperties.hasDisallowedZeroInDomain = hasZeroValueInYDomain,
|
24390 | [ this.xAxisProperties, this.yAxisProperties ];
|
24391 | }, LineChart.prototype.enumerateObjectInstances = function(enumeration, options) {
|
24392 | switch (options.objectName) {
|
24393 | case "dataPoint":
|
24394 | this.enumerateDataPoints(enumeration);
|
24395 | break;
|
24396 |
|
24397 | case "labels":
|
24398 | this.enumerateDataLabels(enumeration);
|
24399 | }
|
24400 | }, LineChart.prototype.enumerateDataPoints = function(enumeration) {
|
24401 | var data = this.data;
|
24402 | if (data && data.series && 0 !== data.series.length) for (var formatStringProp = visuals.lineChartProps.general.formatString, singleSeriesData = data.series, seriesLength = singleSeriesData.length, i = 0; seriesLength > i; i++) {
|
24403 | var selector = visuals.ColorHelper.normalizeSelector(singleSeriesData[i].identity.getSelector()), label = visuals.converterHelper.getFormattedLegendLabel(singleSeriesData[i].yCol, this.dataViewCat.values, formatStringProp);
|
24404 | enumeration.pushInstance({
|
24405 | objectName: "dataPoint",
|
24406 | displayName: label,
|
24407 | selector: selector,
|
24408 | properties: {
|
24409 | fill: {
|
24410 | solid: {
|
24411 | color: data.defaultSeriesColor || singleSeriesData[i].color
|
24412 | }
|
24413 | }
|
24414 | }
|
24415 | });
|
24416 | }
|
24417 | }, LineChart.prototype.enumerateDataLabels = function(enumeration) {
|
24418 | var data = this.data, labelSettings = this.data.dataLabelsSettings, seriesCount = data.series.length, showLabelPerSeries = this.showLabelPerSeries();
|
24419 | if (visuals.dataLabelUtils.enumerateDataLabels(this.getLabelSettingsOptions(enumeration, labelSettings, null, showLabelPerSeries)),
|
24420 | 0 !== seriesCount && showLabelPerSeries && labelSettings.showLabelPerSeries) for (var i = 0; seriesCount > i; i++) {
|
24421 | var series = data.series[i], labelSettings_1 = series.labelSettings ? series.labelSettings : this.data.dataLabelsSettings;
|
24422 | enumeration.pushContainer({
|
24423 | displayName: series.displayName
|
24424 | }), visuals.dataLabelUtils.enumerateDataLabels(this.getLabelSettingsOptions(enumeration, labelSettings_1, series)),
|
24425 | enumeration.popContainer();
|
24426 | }
|
24427 | }, LineChart.prototype.supportsTrendLine = function() {
|
24428 | var isScalar = this.data ? this.data.isScalar : !1;
|
24429 | return !EnumExtensions.hasFlag(this.lineType, 16) && isScalar && this.data.hasValues;
|
24430 | }, LineChart.prototype.showLabelPerSeries = function() {
|
24431 | var data = this.data;
|
24432 | return !data.hasDynamicSeries && (data.series.length > 1 || !data.categoryMetadata);
|
24433 | }, LineChart.prototype.getLabelSettingsOptions = function(enumeration, labelSettings, series, showAll) {
|
24434 | return {
|
24435 | enumeration: enumeration,
|
24436 | dataLabelsSettings: labelSettings,
|
24437 | show: !0,
|
24438 | displayUnits: !0,
|
24439 | precision: !0,
|
24440 | selector: series && series.identity ? series.identity.getSelector() : null,
|
24441 | showAll: showAll,
|
24442 | fontSize: !0,
|
24443 | labelDensity: (this.isComboChart ? this.data.series.length > 0 : !0) && this.advancedLineLabelsEnabled && this.data.isScalar
|
24444 | };
|
24445 | }, LineChart.prototype.overrideXScale = function(xProperties) {
|
24446 | this.xAxisProperties = xProperties;
|
24447 | }, LineChart.prototype.onClearSelection = function() {
|
24448 | this.interactivityService && this.interactivityService.clearSelection();
|
24449 | }, LineChart.prototype.render = function(suppressAnimations) {
|
24450 | var duration = visuals.AnimatorCommon.GetAnimationDuration(this.animator, suppressAnimations);
|
24451 | this.data.categoryData.length !== this.previousCategoryCount && (duration = 0),
|
24452 | this.previousCategoryCount = this.data.categoryData.length;
|
24453 | var result;
|
24454 | return result = this.isInteractiveChart ? this.renderOld(duration) : this.renderNew(duration),
|
24455 | visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options), result;
|
24456 | }, LineChart.prototype.renderNew = function(duration) {
|
24457 | var _this = this, data = this.clippedData ? this.clippedData : this.data;
|
24458 | if (data) {
|
24459 | var dataPointCount = data.categories.length * data.series.length;
|
24460 | dataPointCount > visuals.AnimatorCommon.MaxDataPointsToAnimate && (duration = 0);
|
24461 | var y0Position, yPosition, isStackedArea = EnumExtensions.hasFlag(this.lineType, 16), margin = this.margin, viewport = this.currentViewport, height = viewport.height - (margin.top + margin.bottom), width = viewport.width - (margin.left + margin.right), xScale = this.xAxisProperties.scale, yScale = this.yAxisProperties.scale, horizontalOffset = this.getXOfFirstCategory(), hasSelection = this.interactivityService && this.interactivityService.hasSelection(), renderAreas = EnumExtensions.hasFlag(this.lineType, 2) || EnumExtensions.hasFlag(this.lineType, 16), xPosition = function(d) {
|
24462 | return xScale(_this.getXValue(d)) + horizontalOffset;
|
24463 | };
|
24464 | isStackedArea ? (y0Position = function(d) {
|
24465 | return yScale(d.stackedValue - d.value);
|
24466 | }, yPosition = function(d) {
|
24467 | return yScale(d.stackedValue);
|
24468 | }) : (y0Position = yScale(0), yPosition = function(d) {
|
24469 | return yScale(d.value);
|
24470 | });
|
24471 | var area;
|
24472 | renderAreas && (area = d3.svg.area().x(xPosition).y0(y0Position).y1(yPosition).defined(function(d) {
|
24473 | return null !== d.value;
|
24474 | }));
|
24475 | var line = d3.svg.line().x(xPosition).y(yPosition).defined(function(d) {
|
24476 | return null !== d.value;
|
24477 | });
|
24478 | EnumExtensions.hasFlag(this.lineType, 4) && (line.interpolate("basis"), area && area.interpolate("basis")),
|
24479 | this.mainGraphicsSVG.attr("height", height).attr("width", width);
|
24480 | var areas = void 0;
|
24481 | renderAreas && (areas = this.mainGraphicsContext.selectAll(LineChart.CategoryAreaSelector.selector).data(data.series, function(d) {
|
24482 | return d.identity.getKey();
|
24483 | }), areas.enter().append(LineChart.PathElementName).classed(LineChart.CategoryAreaSelector["class"], !0),
|
24484 | areas.style("fill", function(d) {
|
24485 | return d.color;
|
24486 | }).style("fill-opacity", function(d) {
|
24487 | return hasSelection && !d.selected ? LineChart.DimmedAreaFillOpacity : LineChart.AreaFillOpacity;
|
24488 | }).transition().ease("linear").duration(duration).attr("d", function(d) {
|
24489 | return area(d.data);
|
24490 | }), areas.exit().remove());
|
24491 | var lines = this.mainGraphicsContext.selectAll(this.lineClassAndSelector.selector).data(data.series, function(d) {
|
24492 | return d.identity.getKey();
|
24493 | });
|
24494 | lines.enter().append(LineChart.PathElementName).classed(this.lineClassAndSelector["class"], !0),
|
24495 | lines.style("stroke", function(d) {
|
24496 | return d.color;
|
24497 | }).style("stroke-opacity", function(d) {
|
24498 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
24499 | }).transition().ease("linear").duration(duration).attr("d", function(d) {
|
24500 | return line(d.data);
|
24501 | }), lines.exit().remove();
|
24502 | var interactivityLines = this.mainGraphicsContext.selectAll(".interactivity-line").data(data.series, function(d) {
|
24503 | return d.identity.getKey();
|
24504 | });
|
24505 | interactivityLines.enter().append(LineChart.PathElementName).classed("interactivity-line", !0).style("stroke-width", LineChart.interactivityStrokeWidth),
|
24506 | interactivityLines.attr("d", function(d) {
|
24507 | return line(d.data);
|
24508 | }), interactivityLines.exit().remove();
|
24509 | var dotGroups = this.mainGraphicsContext.selectAll(LineChart.CategorySelector.selector).data(data.series, function(d) {
|
24510 | return d.identity.getKey();
|
24511 | });
|
24512 | dotGroups.enter().append("g").classed(LineChart.CategorySelector["class"], !0),
|
24513 | dotGroups.exit().remove();
|
24514 | var dots = dotGroups.selectAll(LineChart.CategoryValuePoint.selector).data(function(series) {
|
24515 | return series.data.filter(function(value, i) {
|
24516 | return _this.shouldDrawCircle(series, i);
|
24517 | });
|
24518 | }, function(d) {
|
24519 | return d.key;
|
24520 | });
|
24521 | dots.enter().append(LineChart.CircleElementName).classed(LineChart.CategoryValuePoint["class"], !0),
|
24522 | dots.style("fill", function() {
|
24523 | var lineSeries = d3.select(this.parentNode).datum();
|
24524 | return lineSeries.color;
|
24525 | }).style("fill-opacity", function() {
|
24526 | var lineSeries = d3.select(this.parentNode).datum();
|
24527 | return visuals.ColumnUtil.getFillOpacity(lineSeries.selected, !1, hasSelection, !1);
|
24528 | }).transition().duration(duration).attr({
|
24529 | cx: function(d, i) {
|
24530 | return xScale(_this.getXValue(d)) + horizontalOffset;
|
24531 | },
|
24532 | cy: function(d, i) {
|
24533 | return yScale(isStackedArea ? d.stackedValue : d.value);
|
24534 | },
|
24535 | r: LineChart.CircleRadius
|
24536 | }), dots.exit().remove();
|
24537 | var explicitDots;
|
24538 | this.isComboChart || (explicitDots = dotGroups.selectAll(LineChart.CategoryPointSelector.selector).data(function(series) {
|
24539 | return _.filter(series.data, function(value) {
|
24540 | return null != value.pointColor;
|
24541 | });
|
24542 | }, function(d) {
|
24543 | return d.key;
|
24544 | }), explicitDots.enter().append(LineChart.CircleElementName).classed(LineChart.CategoryPointSelector["class"], !0),
|
24545 | explicitDots.style("fill", function(d) {
|
24546 | return d.pointColor;
|
24547 | }).transition().duration(duration).attr({
|
24548 | cx: function(d) {
|
24549 | return xScale(_this.getXValue(d));
|
24550 | },
|
24551 | cy: function(d) {
|
24552 | return yScale(isStackedArea ? d.stackedValue : d.value);
|
24553 | },
|
24554 | r: LineChart.PointRadius
|
24555 | }), explicitDots.exit().remove());
|
24556 | var labelDataPointGroups;
|
24557 | if (data.dataLabelsSettings.show && (labelDataPointGroups = this.createLabelDataPoints()),
|
24558 | this.tooltipsEnabled) if (this.isComboChart) {
|
24559 | var seriesTooltipApplier = function(tooltipEvent) {
|
24560 | var pointX = tooltipEvent.elementCoordinates[0];
|
24561 | return _this.getTooltipInfoForCombo(tooltipEvent, pointX);
|
24562 | };
|
24563 | interactivityLines && visuals.TooltipManager.addTooltip(interactivityLines, seriesTooltipApplier, !0),
|
24564 | visuals.TooltipManager.addTooltip(dots, function(tooltipEvent) {
|
24565 | return tooltipEvent.data.tooltipInfo;
|
24566 | }, !0), explicitDots && visuals.TooltipManager.addTooltip(explicitDots, function(tooltipEvent) {
|
24567 | return tooltipEvent.data.tooltipInfo;
|
24568 | }, !0);
|
24569 | } else {
|
24570 | this.overlayRect.attr({
|
24571 | x: 0,
|
24572 | width: width,
|
24573 | height: height
|
24574 | });
|
24575 | var seriesTooltipApplier = function(tooltipEvent) {
|
24576 | var pointX = tooltipEvent.elementCoordinates[0], index = _this.getCategoryIndexFromTooltipEvent(tooltipEvent, pointX), categoryData = _this.selectColumnForTooltip(index);
|
24577 | return _this.getSeriesTooltipInfo(categoryData);
|
24578 | }, clearHoverLine = function() {
|
24579 | _this.hoverLine.style("opacity", visuals.SVGUtil.AlmostZero), _this.hoverLineContext.selectAll(LineChart.HoverLineCircleDot.selector).remove();
|
24580 | };
|
24581 | visuals.TooltipManager.addTooltip(this.mainGraphicsSVG, seriesTooltipApplier, !0, clearHoverLine);
|
24582 | }
|
24583 | var dataPointsToBind = void 0, behaviorOptions = void 0;
|
24584 | if (this.interactivityService) {
|
24585 | dataPointsToBind = data.series.slice();
|
24586 | for (var i = 0, ilen = data.series.length; ilen > i; i++) dataPointsToBind = dataPointsToBind.concat(data.series[i].data);
|
24587 | behaviorOptions = {
|
24588 | lines: lines,
|
24589 | interactivityLines: interactivityLines,
|
24590 | dots: dots,
|
24591 | areas: areas,
|
24592 | tooltipOverlay: this.overlayRect
|
24593 | };
|
24594 | }
|
24595 | return {
|
24596 | dataPoints: dataPointsToBind,
|
24597 | behaviorOptions: behaviorOptions,
|
24598 | labelDataPoints: [],
|
24599 | labelsAreNumeric: !0,
|
24600 | labelDataPointGroups: labelDataPointGroups
|
24601 | };
|
24602 | }
|
24603 | }, LineChart.prototype.renderOld = function(duration) {
|
24604 | var _this = this, data = this.clippedData ? this.clippedData : this.data;
|
24605 | if (data) {
|
24606 | var area, margin = this.margin, viewport = this.currentViewport, height = viewport.height - (margin.top + margin.bottom), xScale = this.xAxisProperties.scale, yScale = this.yAxisProperties.scale, hasSelection = this.interactivityService && this.interactivityService.hasSelection();
|
24607 | EnumExtensions.hasFlag(this.lineType, 2) && (area = d3.svg.area().x(function(d) {
|
24608 | return xScale(_this.getXValue(d));
|
24609 | }).y0(height).y1(function(d) {
|
24610 | return yScale(d.value);
|
24611 | }).defined(function(d) {
|
24612 | return null !== d.value;
|
24613 | }));
|
24614 | var line = d3.svg.line().x(function(d) {
|
24615 | return xScale(_this.getXValue(d));
|
24616 | }).y(function(d) {
|
24617 | return yScale(d.value);
|
24618 | }).defined(function(d) {
|
24619 | return null !== d.value;
|
24620 | });
|
24621 | EnumExtensions.hasFlag(this.lineType, 4) && (line.interpolate("basis"), area && area.interpolate("basis"));
|
24622 | var firstCategoryOffset = this.getXOfFirstCategory();
|
24623 | if (this.mainGraphicsContext.attr("transform", visuals.SVGUtil.translate(firstCategoryOffset, 0)),
|
24624 | this.mainGraphicsSVG.attr("height", this.getAvailableHeight()).attr("width", this.getAvailableWidth()),
|
24625 | this.hoverLineContext.attr("transform", visuals.SVGUtil.translate(firstCategoryOffset, 0)),
|
24626 | EnumExtensions.hasFlag(this.lineType, 2)) {
|
24627 | var catAreaSelect = this.mainGraphicsContext.selectAll(LineChart.CategoryAreaSelector.selector).data(data.series, function(d) {
|
24628 | return d.identity.getKey();
|
24629 | }), catAreaEnter = catAreaSelect.enter().append("g").classed(LineChart.CategoryAreaSelector["class"], !0);
|
24630 | catAreaEnter.append(LineChart.PathElementName);
|
24631 | var catAreaUpdate = this.mainGraphicsContext.selectAll(LineChart.CategoryAreaSelector.selector);
|
24632 | catAreaUpdate.select(LineChart.PathElementName).transition().ease("linear").duration(duration).attr("d", function(d) {
|
24633 | return area(d.data);
|
24634 | }).style("fill", function(d) {
|
24635 | return d.color;
|
24636 | }).style("fill-opacity", function(d) {
|
24637 | return hasSelection && !d.selected ? LineChart.DimmedAreaFillOpacity : LineChart.AreaFillOpacity;
|
24638 | }), catAreaSelect.exit().remove();
|
24639 | }
|
24640 | var catSelect = this.mainGraphicsContext.selectAll(LineChart.CategorySelector.selector).data(data.series, function(d) {
|
24641 | return d.identity.getKey();
|
24642 | }), catEnter = catSelect.enter().append("g").classed(LineChart.CategorySelector["class"], !0);
|
24643 | if (catEnter.append(LineChart.PathElementName), catEnter.selectAll(LineChart.CategoryValuePoint.selector).data(function(d) {
|
24644 | return d.data;
|
24645 | }).enter().append(LineChart.CircleElementName).classed(LineChart.CategoryValuePoint["class"], !0),
|
24646 | catSelect.exit().remove(), this.isInteractiveChart && !this.dragHandle) {
|
24647 | var handleTop = this.getAvailableHeight();
|
24648 | this.dragHandle = this.hoverLineContext.append("circle").attr("cx", 0).attr("cy", handleTop).attr("r", "6px").classed("drag-handle", !0);
|
24649 | }
|
24650 | for (var linesCount = catSelect.data().length; this.selectionCircles.length < linesCount; ) {
|
24651 | var addedCircle = this.hoverLineContext.append(LineChart.CircleElementName).classed(LineChart.CircleClassName, !0).attr("r", LineChart.CircleRadius).style("opacity", 0);
|
24652 | this.selectionCircles.push(addedCircle);
|
24653 | }
|
24654 | for (;this.selectionCircles.length > linesCount; ) this.selectionCircles.pop().remove();
|
24655 | var catUpdate = this.mainGraphicsContext.selectAll(LineChart.CategorySelector.selector), lineSelection = catUpdate.select(LineChart.PathElementName).classed(this.lineClassAndSelector["class"], !0).style("stroke", function(d) {
|
24656 | return d.color;
|
24657 | }).style("stroke-opacity", function(d) {
|
24658 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
24659 | });
|
24660 | lineSelection.transition().ease("linear").duration(duration).attr("d", function(d) {
|
24661 | return line(d.data);
|
24662 | });
|
24663 | var that = this, updateSelection = catUpdate.selectAll(LineChart.CategoryValuePoint.selector), transitions = updateSelection.style("fill", function() {
|
24664 | var lineSeries = d3.select(this.parentNode).datum();
|
24665 | return lineSeries.color;
|
24666 | }).style("fill-opacity", function() {
|
24667 | var lineSeries = d3.select(this.parentNode).datum();
|
24668 | return visuals.ColumnUtil.getFillOpacity(lineSeries.selected, !1, hasSelection, !1);
|
24669 | }).transition().duration(duration).attr({
|
24670 | cx: function(d, i) {
|
24671 | var lineSeries = d3.select(this.parentNode).datum(), circleIndex = that.shouldDrawCircle(lineSeries, i);
|
24672 | return circleIndex ? xScale(that.getXValue(d)) : 0;
|
24673 | },
|
24674 | cy: function(d, i) {
|
24675 | var lineSeries = d3.select(this.parentNode).datum(), circleIndex = that.shouldDrawCircle(lineSeries, i);
|
24676 | return circleIndex ? yScale(d.value) : 0;
|
24677 | },
|
24678 | r: function(d, i) {
|
24679 | var lineSeries = d3.select(this.parentNode).datum(), circleIndex = that.shouldDrawCircle(lineSeries, i);
|
24680 | return circleIndex ? LineChart.CircleRadius : 0;
|
24681 | }
|
24682 | });
|
24683 | if (this.isInteractiveChart && this.hasDataPoint(data.series)) {
|
24684 | var selectionSize_1 = updateSelection.size(), endedTransitionCount_1 = 0;
|
24685 | transitions.each("end", function() {
|
24686 | endedTransitionCount_1++, endedTransitionCount_1 === selectionSize_1 && _this.selectColumn(visuals.CartesianHelper.findMaxCategoryIndex(data.series), !0);
|
24687 | });
|
24688 | }
|
24689 | var dataPoints = null;
|
24690 | if (data.dataLabelsSettings.show) {
|
24691 | dataPoints = [];
|
24692 | for (var i = 0, ilen = data.series.length; ilen > i; i++) Array.prototype.push.apply(dataPoints, data.series[i].data);
|
24693 | }
|
24694 | catSelect.exit().remove();
|
24695 | var labelDataPointsGroups;
|
24696 | return data.dataLabelsSettings.show && (labelDataPointsGroups = this.createLabelDataPoints()),
|
24697 | null == dataPoints ? null : {
|
24698 | dataPoints: dataPoints,
|
24699 | behaviorOptions: null,
|
24700 | labelDataPoints: null,
|
24701 | labelsAreNumeric: null,
|
24702 | labelDataPointGroups: labelDataPointsGroups
|
24703 | };
|
24704 | }
|
24705 | }, LineChart.prototype.getSeriesTooltipInfo = function(pointData) {
|
24706 | if (_.isEmpty(pointData)) return null;
|
24707 | var transparentColor = "#000000", hiddenItemOpacity = "0", tooltipinfo = [], maxNumberOfItems = 10, hasDynamicSeries = !_.isEmpty(pointData) && pointData[0].seriesDisplayName, count = 0;
|
24708 | if (_.any(pointData, function(point) {
|
24709 | return !_.isEmpty(point.extraTooltipInfo);
|
24710 | })) {
|
24711 | for (var _a = 0, pointData_2 = pointData; _a < pointData_2.length; _a++) {
|
24712 | var point = pointData_2[_a];
|
24713 | if (count >= maxNumberOfItems) break;
|
24714 | if (null != point.value && (hasDynamicSeries && tooltipinfo.push({
|
24715 | header: point.category,
|
24716 | displayName: point.seriesDisplayName,
|
24717 | value: point.seriesName
|
24718 | }), tooltipinfo.push({
|
24719 | header: point.category,
|
24720 | color: point.color,
|
24721 | displayName: point.measureDisplayName,
|
24722 | value: point.measure
|
24723 | }), count += 2, hasDynamicSeries && !_.isEmpty(point.extraTooltipInfo))) for (var _b = 0, _c = point.extraTooltipInfo; _b < _c.length; _b++) {
|
24724 | var extraTooltipInfo = _c[_b];
|
24725 | if (count >= maxNumberOfItems) break;
|
24726 | tooltipinfo.push({
|
24727 | header: point.category,
|
24728 | color: transparentColor,
|
24729 | displayName: extraTooltipInfo.displayName,
|
24730 | value: extraTooltipInfo.value,
|
24731 | opacity: hiddenItemOpacity
|
24732 | }), count++;
|
24733 | }
|
24734 | }
|
24735 | if (!hasDynamicSeries) for (var _d = 0, _e = pointData[0].extraTooltipInfo; _d < _e.length; _d++) {
|
24736 | var extraTooltipInfo = _e[_d];
|
24737 | if (count >= maxNumberOfItems) break;
|
24738 | tooltipinfo.push({
|
24739 | header: pointData[0].category,
|
24740 | color: transparentColor,
|
24741 | displayName: extraTooltipInfo.displayName,
|
24742 | value: extraTooltipInfo.value,
|
24743 | opacity: hiddenItemOpacity
|
24744 | }), count++;
|
24745 | }
|
24746 | } else for (var _i = 0, pointData_1 = pointData; _i < pointData_1.length; _i++) {
|
24747 | var point = pointData_1[_i];
|
24748 | if (count >= maxNumberOfItems) break;
|
24749 | null != point.value && (tooltipinfo.push({
|
24750 | header: point.category,
|
24751 | color: point.color,
|
24752 | displayName: point.seriesName || point.measureDisplayName,
|
24753 | value: point.measure
|
24754 | }), count++);
|
24755 | }
|
24756 | return 0 === tooltipinfo.length ? null : tooltipinfo;
|
24757 | }, LineChart.prototype.getTooltipInfoForCombo = function(tooltipEvent, pointX) {
|
24758 | var dataPoint, categoryIndex = this.getCategoryIndexFromTooltipEvent(tooltipEvent, pointX), seriesData = tooltipEvent.data;
|
24759 | return seriesData && seriesData.data && seriesData.data.length && (dataPoint = _.find(seriesData.data, function(dp) {
|
24760 | return dp.categoryIndex === categoryIndex;
|
24761 | })), dataPoint ? dataPoint.tooltipInfo : void 0;
|
24762 | }, LineChart.prototype.getCategoryIndexFromTooltipEvent = function(tooltipEvent, pointX) {
|
24763 | if (tooltipEvent.data && null != tooltipEvent.data.categoryIndex) return tooltipEvent.data.categoryIndex;
|
24764 | var seriesData = tooltipEvent.data, offsetX = 0;
|
24765 | if (seriesData && !_.isEmpty(seriesData.data) && this.xAxisProperties) {
|
24766 | pointX = this.adjustPathXCoordinate(pointX);
|
24767 | var firstPathPoint = _.find(seriesData.data, function(dataPoint, index, dataPoints) {
|
24768 | var nextDataPoint = dataPoints[index + 1];
|
24769 | return null != dataPoint.value && nextDataPoint && null != nextDataPoint.value;
|
24770 | });
|
24771 | offsetX = this.xAxisProperties.scale(this.getXValue(firstPathPoint)) + this.getXOfFirstCategory();
|
24772 | }
|
24773 | return this.findIndex(pointX, offsetX);
|
24774 | }, LineChart.prototype.getVisualCategoryAxisIsScalar = function() {
|
24775 | return this.data ? this.data.isScalar : !1;
|
24776 | }, LineChart.prototype.getSupportedCategoryAxisType = function() {
|
24777 | var dvCategories = this.dataViewCat ? this.dataViewCat.categories : void 0, categoryType = {
|
24778 | text: !0
|
24779 | };
|
24780 | if (!_.isEmpty(dvCategories)) {
|
24781 | var scalarKeys = LineChart.getScalarKeys(dvCategories[0]);
|
24782 | if (scalarKeys && !_.isEmpty(scalarKeys.values)) return visuals.axisType.both;
|
24783 | dvCategories[0].source && dvCategories[0].source.type && (categoryType = dvCategories[0].source.type);
|
24784 | }
|
24785 | var isOrdinal = visuals.AxisHelper.isOrdinal(categoryType);
|
24786 | return isOrdinal ? visuals.axisType.categorical : visuals.axisType.both;
|
24787 | }, LineChart.prototype.getPreferredPlotArea = function(isScalar, categoryCount, categoryThickness) {
|
24788 | return visuals.CartesianChart.getPreferredPlotArea(categoryCount, categoryThickness, this.currentViewport, this.isScrollable, isScalar, this.margin, !0);
|
24789 | }, LineChart.prototype.getCategoryCount = function(origCatgSize) {
|
24790 | var availableWidth = this.getAvailableWidth(), categoryThickness = visuals.CartesianChart.MinOrdinalRectThickness;
|
24791 | return Math.min(Math.round((availableWidth - categoryThickness * visuals.CartesianChart.OuterPaddingRatio * 2) / categoryThickness), origCatgSize);
|
24792 | }, LineChart.prototype.getAvailableWidth = function() {
|
24793 | return this.currentViewport.width - (this.margin.left + this.margin.right);
|
24794 | }, LineChart.prototype.getAvailableHeight = function() {
|
24795 | return this.currentViewport.height - (this.margin.top + this.margin.bottom);
|
24796 | }, LineChart.sliceSeries = function(series, newLength, startIndex) {
|
24797 | void 0 === startIndex && (startIndex = 0);
|
24798 | var newSeries = [];
|
24799 | if (series && series.length > 0) for (var i = 0, len = series.length; len > i; i++) newSeries[i] = powerbi.Prototype.inherit(series[i]),
|
24800 | newSeries[i].data = series[i].data.slice(startIndex, startIndex + newLength);
|
24801 | return newSeries;
|
24802 | }, LineChart.getScalarKeys = function(dataViewCategoryColumn) {
|
24803 | var categoryColumnObjects;
|
24804 | if (dataViewCategoryColumn && (categoryColumnObjects = dataViewCategoryColumn.objects),
|
24805 | !_.isEmpty(categoryColumnObjects)) {
|
24806 | for (var scalarKeys = void 0, categoryObjectsLength = categoryColumnObjects.length, i = 0; categoryObjectsLength > i; i++) {
|
24807 | var categoryObjects = categoryColumnObjects[i], scalarKey = powerbi.DataViewObjects.getValue(categoryObjects, visuals.lineChartProps.scalarKey.scalarKeyMin);
|
24808 | if (void 0 !== scalarKey) {
|
24809 | scalarKeys || (scalarKeys = {
|
24810 | values: new Array(categoryObjectsLength)
|
24811 | });
|
24812 | var key = {
|
24813 | min: scalarKey
|
24814 | };
|
24815 | scalarKeys.values[i] = key;
|
24816 | }
|
24817 | }
|
24818 | return scalarKeys;
|
24819 | }
|
24820 | }, LineChart.prototype.getXOfFirstCategory = function() {
|
24821 | if (!this.data.isScalar) {
|
24822 | var xScale = this.xAxisProperties.scale;
|
24823 | if (xScale.rangeBand) return xScale.rangeBand() / 2;
|
24824 | }
|
24825 | return 0;
|
24826 | }, LineChart.prototype.hasDataPoint = function(series) {
|
24827 | if (0 === series.length) return !1;
|
24828 | for (var i = 0, len = series.length; len > i; i++) if (series[i].data.length > 0) return !0;
|
24829 | return !1;
|
24830 | }, LineChart.prototype.getXValue = function(d) {
|
24831 | return this.data.isScalar ? d.categoryValue : d.categoryIndex;
|
24832 | }, LineChart.prototype.shouldDrawCircle = function(d, i) {
|
24833 | var dataLength = d.data.length, isLastPoint = i === dataLength - 1, isFirstPoint = 0 === i;
|
24834 | return i > dataLength - 1 || null === d.data[i] || null === d.data[i].value ? !1 : isFirstPoint && isLastPoint ? !0 : isFirstPoint && dataLength > 1 && null === d.data[i + 1].value ? !0 : !isFirstPoint && isLastPoint && null === d.data[i - 1].value ? !0 : !isFirstPoint && !isLastPoint && null === d.data[i - 1].value && null === d.data[i + 1].value;
|
24835 | }, LineChart.prototype.selectColumnForTooltip = function(columnIndex, force) {
|
24836 | void 0 === force && (force = !1);
|
24837 | var x = this.getChartX(columnIndex) + this.getXOfFirstCategory(), dataPoints = this.createTooltipDataPoints(columnIndex);
|
24838 | return dataPoints.length > 0 && this.setHoverLineForTooltip(x), this.setDotsForTooltip(x, dataPoints),
|
24839 | dataPoints;
|
24840 | }, LineChart.prototype.setHoverLineForTooltip = function(chartX) {
|
24841 | chartX = chartX || 0, this.hoverLine.attr("x1", chartX).attr("x2", chartX).attr("y1", 0).attr("y2", this.getAvailableHeight()).style("opacity", 1);
|
24842 | }, LineChart.prototype.setDotsForTooltip = function(chartX, dataPoints) {
|
24843 | var _this = this, isStackedArea = EnumExtensions.hasFlag(this.lineType, 16), dotYPosition = isStackedArea ? function(d) {
|
24844 | return _this.yAxisProperties.scale(d.stackedValue);
|
24845 | } : function(d) {
|
24846 | return _this.yAxisProperties.scale(d.value);
|
24847 | }, tooltipDots = this.hoverLineContext.selectAll(LineChart.HoverLineCircleDot.selector).data(dataPoints);
|
24848 | tooltipDots.enter().append(LineChart.CircleElementName).classed(LineChart.HoverLineCircleDot["class"], !0),
|
24849 | tooltipDots.filter(function(d) {
|
24850 | return d.value;
|
24851 | }).attr("fill", function(d) {
|
24852 | return d.color;
|
24853 | }).attr("r", 3).attr("cx", chartX).attr("cy", dotYPosition), tooltipDots.exit().remove();
|
24854 | }, LineChart.prototype.selectColumn = function(columnIndex, force) {
|
24855 | if (void 0 === force && (force = !1), force || this.lastInteractiveSelectedColumnIndex !== columnIndex) {
|
24856 | this.lastInteractiveSelectedColumnIndex = columnIndex;
|
24857 | var x = this.getChartX(columnIndex);
|
24858 | this.setHoverLine(x, columnIndex);
|
24859 | var legendItems = this.createLegendDataPoints(columnIndex);
|
24860 | legendItems && this.options.cartesianHost.updateLegend(legendItems);
|
24861 | }
|
24862 | }, LineChart.prototype.setHoverLine = function(chartX, columnIndex) {
|
24863 | this.hoverLine.attr("x1", chartX).attr("x2", chartX).attr("y1", 0).attr("y2", this.getAvailableHeight()).style("opacity", 1);
|
24864 | var that = this;
|
24865 | this.mainGraphicsContext.selectAll(LineChart.CategorySelector.selector).selectAll(LineChart.PathElementName).each(function(series) {
|
24866 | var _this = this, color = series.color, circleToChange = that.selectionCircles[series.lineIndex];
|
24867 | circleToChange.attr({
|
24868 | cx: chartX,
|
24869 | cy: function() {
|
24870 | var pathElement = d3.select(_this).node(), pos = that.getPosition(chartX, pathElement);
|
24871 | return pos.y;
|
24872 | }
|
24873 | }).style({
|
24874 | opacity: function() {
|
24875 | return _.some(series.data, function(value) {
|
24876 | return value.categoryIndex === columnIndex;
|
24877 | }) ? 1 : 0;
|
24878 | },
|
24879 | fill: color
|
24880 | }), that.dragHandle && that.dragHandle.attr("cx", chartX);
|
24881 | });
|
24882 | }, LineChart.prototype.getChartX = function(columnIndex) {
|
24883 | var x = 0;
|
24884 | this.data.isScalar ? columnIndex >= 0 && columnIndex < this.data.categoryData.length && (x = Math.max(0, this.xAxisProperties.scale(this.data.categoryData[columnIndex].categoryValue))) : x = Math.max(0, this.xAxisProperties.scale(columnIndex));
|
24885 | var rangeEnd = powerbi.visuals.AxisHelper.extent(this.xAxisProperties.scale)[1];
|
24886 | return x = Math.min(x, rangeEnd), isNaN(x) ? 0 : x;
|
24887 | }, LineChart.prototype.findIndex = function(pointX, offsetX) {
|
24888 | var xScale = this.scaleDetector.getScale().x;
|
24889 | powerbi.Double.equalWithPrecision(xScale, 1, 1e-5) || (pointX /= xScale), offsetX && (pointX += offsetX);
|
24890 | var index = powerbi.visuals.AxisHelper.invertScale(this.xAxisProperties.scale, pointX);
|
24891 | return this.data.isScalar && (index = visuals.AxisHelper.findClosestXAxisIndex(index, this.data.categoryData)),
|
24892 | index;
|
24893 | }, LineChart.prototype.getPosition = function(x, pathElement) {
|
24894 | for (var pos, target, pathLength = pathElement.getTotalLength(), beginning = 0, end = pathLength; ;) {
|
24895 | if (target = Math.floor((beginning + end) / 2), pos = pathElement.getPointAtLength(target),
|
24896 | visuals.SVGUtil.ensureValidSVGPoint(pos), (target === end || target === beginning) && pos.x !== x) break;
|
24897 | if (pos.x > x) end = target; else {
|
24898 | if (!(pos.x < x)) break;
|
24899 | beginning = target;
|
24900 | }
|
24901 | }
|
24902 | return pos;
|
24903 | }, LineChart.prototype.createTooltipDataPoints = function(columnIndex) {
|
24904 | var data = this.data;
|
24905 | if (!data || 0 === data.series.length || !data.categories || !data.categoryData) return [];
|
24906 | var category, dataPoints = [], categoryDataPoint = data.categoryData[columnIndex];
|
24907 | this.data.isScalar ? categoryDataPoint && (category = visuals.AxisHelper.isDateTime(this.xAxisProperties.axisType) && !data.scalarMetadata ? visuals.CartesianHelper.lookupXValue(this.data, categoryDataPoint.categoryValue, this.xAxisProperties.axisType, this.data.isScalar) : data.categories[columnIndex]) : category = visuals.CartesianHelper.lookupXValue(this.data, columnIndex, this.xAxisProperties.axisType, this.data.isScalar);
|
24908 | for (var formatStringProp = visuals.lineChartProps.general.formatString, _i = 0, _a = data.series; _i < _a.length; _i++) {
|
24909 | var series = _a[_i], lineData = series.data, lineDataPoint = void 0;
|
24910 | this.data.isScalar ? categoryDataPoint && (lineDataPoint = lineData.filter(function(data) {
|
24911 | return data.categoryValue === categoryDataPoint.categoryValue;
|
24912 | })[0]) : lineDataPoint = lineData[columnIndex];
|
24913 | var value = lineDataPoint && lineDataPoint.value;
|
24914 | if (null != value) {
|
24915 | var dataPoint = {
|
24916 | color: series.color,
|
24917 | category: visuals.valueFormatter.format(category, visuals.valueFormatter.getFormatString(series.xCol, formatStringProp)),
|
24918 | measureDisplayName: series.displayName,
|
24919 | measure: visuals.valueFormatter.format(value, visuals.valueFormatter.getFormatString(series.yCol, formatStringProp)),
|
24920 | value: value,
|
24921 | stackedValue: lineDataPoint.stackedValue,
|
24922 | extraTooltipInfo: lineDataPoint.extraTooltipInfo
|
24923 | };
|
24924 | data.hasDynamicSeries && (dataPoint.seriesDisplayName = data.seriesDisplayName,
|
24925 | dataPoint.seriesName = series.dynamicDisplayName), dataPoints.push(dataPoint);
|
24926 | }
|
24927 | }
|
24928 | return dataPoints;
|
24929 | }, LineChart.prototype.createLegendDataPoints = function(columnIndex) {
|
24930 | var data = this.data;
|
24931 | if (data && data.series && !(data.series.length < 1)) {
|
24932 | var category, legendDataPoints = [], categoryDataPoint = data.categoryData[columnIndex];
|
24933 | this.isInteractiveChart && categoryDataPoint && (this.data.isScalar ? (category = categoryDataPoint.categoryValue,
|
24934 | visuals.AxisHelper.isDateTime(this.xAxisProperties.axisType) && (category = new Date(category))) : category = visuals.CartesianHelper.lookupXValue(this.data, columnIndex, this.xAxisProperties.axisType, this.data.isScalar));
|
24935 | for (var formatStringProp = visuals.lineChartProps.general.formatString, seriesYCol = null, i = 0, len = data.series.length; len > i; i++) {
|
24936 | var series = data.series[i], lineData = series.data, measure = void 0;
|
24937 | if (this.isInteractiveChart) {
|
24938 | var lineDataPoint = void 0;
|
24939 | if (this.data.isScalar) {
|
24940 | if (categoryDataPoint) for (var targetCategoryValue = categoryDataPoint.categoryValue, i_1 = 0; i_1 < lineData.length; i_1++) if (lineData[i_1].categoryValue === targetCategoryValue) {
|
24941 | lineDataPoint = lineData[i_1];
|
24942 | break;
|
24943 | }
|
24944 | } else lineDataPoint = lineData[columnIndex];
|
24945 | measure = lineDataPoint && lineDataPoint.value;
|
24946 | }
|
24947 | var label = visuals.converterHelper.getFormattedLegendLabel(series.yCol, this.dataViewCat.values, formatStringProp);
|
24948 | seriesYCol = series.yCol, legendDataPoints.push({
|
24949 | color: series.color,
|
24950 | icon: visuals.LegendIcon.Line,
|
24951 | label: label,
|
24952 | category: visuals.valueFormatter.format(category, visuals.valueFormatter.getFormatString(series.xCol, formatStringProp)),
|
24953 | measure: visuals.valueFormatter.format(measure, visuals.valueFormatter.getFormatString(series.yCol, formatStringProp)),
|
24954 | identity: series.identity,
|
24955 | selected: series.selected
|
24956 | });
|
24957 | }
|
24958 | var dvValues = this.dataViewCat ? this.dataViewCat.values : null, title = dvValues && dvValues.source ? dvValues.source.displayName : "";
|
24959 | return {
|
24960 | title: title,
|
24961 | dataPoints: legendDataPoints,
|
24962 | grouped: data.hasDynamicSeries
|
24963 | };
|
24964 | }
|
24965 | }, LineChart.prototype.createLabelDataPoints = function() {
|
24966 | var labelSettings, axisFormatter, seriesLabelDataPoints, seriesDataPointsCandidates, seriesIndex, seriesCount, currentSeries, _this = this, xScale = this.xAxisProperties.scale, yScale = this.yAxisProperties.scale, lineshift = this.getXOfFirstCategory(), data = this.data, series = this.clippedData ? this.clippedData.series : data.series, baseLabelSettings = data.dataLabelsSettings, formattersCache = visuals.NewDataLabelUtils.createColumnFormatterCacheManager(), isStackedArea = EnumExtensions.hasFlag(this.lineType, 16), labelDataPointGroups = [], _loop_1 = function() {
|
24967 | currentSeries = series[seriesIndex], labelSettings = currentSeries.labelSettings || baseLabelSettings;
|
24968 | var densityAtMax = "100" === labelSettings.labelDensity, maxNumberOfLabels = this_1.advancedLineLabelsEnabled && !densityAtMax && data.isScalar ? LineChart.getNumberOfLabelsToRender(this_1.currentViewport.width, _.parseInt(labelSettings.labelDensity)) : currentSeries.data.length;
|
24969 | if (!labelSettings.show) return labelDataPointGroups[seriesIndex] = {
|
24970 | labelDataPoints: [],
|
24971 | maxNumberOfLabels: 0
|
24972 | }, "continue";
|
24973 | axisFormatter = visuals.NewDataLabelUtils.getDisplayUnitValueFromAxisFormatter(this_1.yAxisProperties.formatter, labelSettings);
|
24974 | var dataPoints = currentSeries.data;
|
24975 | seriesLabelDataPoints = [], seriesDataPointsCandidates = [];
|
24976 | var createLabelDataPoint = function(dataPoint, categoryIndex) {
|
24977 | if (null == dataPoint.value) return null;
|
24978 | var parentShape, formatString = dataPoint.labelFormatString, formatter = formattersCache.getOrCreate(formatString, labelSettings, axisFormatter), text = visuals.NewDataLabelUtils.getLabelFormattedText(formatter.format(dataPoint.value)), properties = {
|
24979 | text: text,
|
24980 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
24981 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize),
|
24982 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
24983 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties) + visuals.NewDataLabelUtils.LabelDensityPadding, textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties, !0), isParentRect = !1;
|
24984 | if (isStackedArea) {
|
24985 | var bottomPos = Math.max(dataPoint.stackedValue - dataPoint.value, yScale.domain()[0]), areaWidth = _this.currentViewport.width;
|
24986 | parentShape = {
|
24987 | rect: {
|
24988 | left: xScale(_this.getXValue(dataPoint)) - areaWidth / 2,
|
24989 | top: yScale(Math.max(dataPoint.stackedValue, dataPoint.stackedValue - dataPoint.value)),
|
24990 | width: areaWidth,
|
24991 | height: Math.abs(yScale(dataPoint.stackedValue) - yScale(bottomPos))
|
24992 | },
|
24993 | orientation: dataPoint.value >= 0 ? 1 : 2,
|
24994 | validPositions: LineChart.validStackedLabelPositions
|
24995 | }, isParentRect = !0;
|
24996 | } else parentShape = {
|
24997 | point: {
|
24998 | x: xScale(_this.getXValue(dataPoint)) + lineshift,
|
24999 | y: yScale(dataPoint.value)
|
25000 | },
|
25001 | radius: 0,
|
25002 | validPositions: densityAtMax ? [ 1 ] : _this.getValidLabelPositions(currentSeries, categoryIndex)
|
25003 | };
|
25004 | var labelDataPoint = {
|
25005 | isPreferred: !1,
|
25006 | text: text,
|
25007 | textSize: {
|
25008 | width: textWidth,
|
25009 | height: textHeight
|
25010 | },
|
25011 | outsideFill: labelSettings.labelColor ? labelSettings.labelColor : visuals.NewDataLabelUtils.defaultLabelColor,
|
25012 | insideFill: labelSettings.labelColor && isStackedArea ? labelSettings.labelColor : visuals.NewDataLabelUtils.defaultInsideLabelColor,
|
25013 | parentType: isParentRect ? 1 : 0,
|
25014 | parentShape: parentShape,
|
25015 | fontSize: labelSettings.fontSize,
|
25016 | identity: dataPoint.identity,
|
25017 | key: dataPoint.key
|
25018 | };
|
25019 | return labelDataPoint;
|
25020 | };
|
25021 | if (!_.isEmpty(dataPoints)) for (var categoryIndex = 0, categoryCount = dataPoints.length; categoryCount > categoryIndex; categoryIndex++) {
|
25022 | var labelDataPoint = createLabelDataPoint(dataPoints[categoryIndex], categoryIndex);
|
25023 | labelDataPoint && seriesLabelDataPoints.push(labelDataPoint);
|
25024 | }
|
25025 | labelDataPointGroups[seriesIndex] = {
|
25026 | labelDataPoints: seriesLabelDataPoints,
|
25027 | maxNumberOfLabels: maxNumberOfLabels
|
25028 | };
|
25029 | }, this_1 = this;
|
25030 | for (seriesIndex = 0, seriesCount = series.length; seriesCount > seriesIndex; seriesIndex++) {
|
25031 | _loop_1();
|
25032 | }
|
25033 | if (this.advancedLineLabelsEnabled && 16 !== this.lineType) {
|
25034 | var sorter = new visuals.MinMaxLabelDataPointSorter({
|
25035 | unsortedLabelDataPointGroups: labelDataPointGroups,
|
25036 | series: series,
|
25037 | viewport: this.currentViewport,
|
25038 | yAxisProperties: this.yAxisProperties
|
25039 | });
|
25040 | return sorter.getSortedDataLabels();
|
25041 | }
|
25042 | return labelDataPointGroups;
|
25043 | }, LineChart.getNumberOfLabelsToRender = function(viewPortWidth, labelDensity) {
|
25044 | if (null == labelDensity || 0 === labelDensity) return LineChart.minimumLabelsToRender;
|
25045 | var parsedAndNormalizedDensity = labelDensity / 100, maxNumberForViewport = Math.ceil(viewPortWidth / visuals.MinMaxLabelDataPointSorter.estimatedLabelWidth);
|
25046 | return 1 === parsedAndNormalizedDensity ? maxNumberForViewport : LineChart.minimumLabelsToRender + Math.floor(parsedAndNormalizedDensity * (maxNumberForViewport - LineChart.minimumLabelsToRender));
|
25047 | }, LineChart.prototype.adjustPathXCoordinate = function(x) {
|
25048 | var xScale = this.scaleDetector.getScale().x;
|
25049 | return x -= powerbi.Double.equalWithPrecision(xScale, 1, 1e-5) ? this.pathXAdjustment : this.pathXAdjustment * xScale;
|
25050 | }, LineChart.prototype.getValidLabelPositions = function(series, categoryIndex) {
|
25051 | if (!this.advancedLineLabelsEnabled) return [ 1 ];
|
25052 | var data = series.data, dataLength = data.length, isLastPoint = categoryIndex === dataLength - 1, isFirstPoint = 0 === categoryIndex, currentValue = data[categoryIndex].value, previousValue = isFirstPoint ? void 0 : data[categoryIndex - 1].value, nextValue = isLastPoint ? void 0 : data[categoryIndex + 1].value, previousRelativePosition = 1, nextRelativePosition = 1;
|
25053 | if (null == previousValue ? previousRelativePosition = 0 : previousValue > currentValue ? previousRelativePosition = 3 : currentValue > previousValue && (previousRelativePosition = 2),
|
25054 | null === nextValue ? nextRelativePosition = 0 : nextValue > currentValue ? nextRelativePosition = 3 : currentValue > nextValue && (nextRelativePosition = 2),
|
25055 | isFirstPoint) switch (nextRelativePosition) {
|
25056 | case 3:
|
25057 | return [ 2, 1 ];
|
25058 |
|
25059 | default:
|
25060 | return [ 1, 2 ];
|
25061 | }
|
25062 | if (isLastPoint) switch (previousRelativePosition) {
|
25063 | case 3:
|
25064 | return [ 2, 1 ];
|
25065 |
|
25066 | default:
|
25067 | return [ 1, 2 ];
|
25068 | }
|
25069 | switch (previousRelativePosition) {
|
25070 | case 0:
|
25071 | switch (nextRelativePosition) {
|
25072 | case 0:
|
25073 | return [ 1, 2, 8, 4 ];
|
25074 |
|
25075 | case 1:
|
25076 | return [ 1, 2, 4, 8 ];
|
25077 |
|
25078 | case 3:
|
25079 | return [ 2, 1, 4, 8 ];
|
25080 |
|
25081 | case 2:
|
25082 | return [ 1, 2, 4, 8 ];
|
25083 | }
|
25084 |
|
25085 | case 1:
|
25086 | switch (nextRelativePosition) {
|
25087 | case 0:
|
25088 | return [ 1, 2, 8, 4 ];
|
25089 |
|
25090 | case 1:
|
25091 | return [ 1, 2, 8, 4 ];
|
25092 |
|
25093 | case 3:
|
25094 | return [ 2, 1, 8, 4 ];
|
25095 |
|
25096 | case 2:
|
25097 | return [ 1, 2, 8, 4 ];
|
25098 | }
|
25099 |
|
25100 | case 3:
|
25101 | switch (nextRelativePosition) {
|
25102 | case 0:
|
25103 | return [ 2, 1, 8, 4 ];
|
25104 |
|
25105 | case 1:
|
25106 | return [ 2, 1, 4, 8 ];
|
25107 |
|
25108 | case 3:
|
25109 | return [ 2, 1, 8, 4 ];
|
25110 |
|
25111 | case 2:
|
25112 | return [ 1, 2, 8, 4 ];
|
25113 | }
|
25114 |
|
25115 | case 2:
|
25116 | switch (nextRelativePosition) {
|
25117 | case 0:
|
25118 | return [ 1, 2, 8, 4 ];
|
25119 |
|
25120 | case 1:
|
25121 | return [ 1, 2, 4, 8 ];
|
25122 |
|
25123 | case 3:
|
25124 | return [ 1, 2, 8, 4 ];
|
25125 |
|
25126 | case 2:
|
25127 | return [ 1, 2, 8, 4 ];
|
25128 | }
|
25129 | }
|
25130 | }, LineChart.ClassName = "lineChart", LineChart.MainGraphicsContextClassName = "mainGraphicsContext",
|
25131 | LineChart.CategorySelector = createClassAndSelector("cat"), LineChart.CategoryValuePoint = createClassAndSelector("dot"),
|
25132 | LineChart.CategoryPointSelector = createClassAndSelector("point"), LineChart.CategoryAreaSelector = createClassAndSelector("catArea"),
|
25133 | LineChart.HoverLineCircleDot = createClassAndSelector("circle-item"), LineChart.LineClassSelector = createClassAndSelector("line"),
|
25134 | LineChart.PointRadius = 5, LineChart.CircleRadius = 4, LineChart.PathElementName = "path",
|
25135 | LineChart.CircleElementName = "circle", LineChart.CircleClassName = "selection-circle",
|
25136 | LineChart.LineElementName = "line", LineChart.RectOverlayName = "rect", LineChart.ScalarOuterPadding = 10,
|
25137 | LineChart.interactivityStrokeWidth = 10, LineChart.minimumLabelsToRender = 4, LineChart.AreaFillOpacity = .4,
|
25138 | LineChart.DimmedAreaFillOpacity = .2, LineChart.validStackedLabelPositions = [ 1, 4, 2 ],
|
25139 | LineChart;
|
25140 | }();
|
25141 | visuals.LineChart = LineChart;
|
25142 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
25143 | }(powerbi || (powerbi = {}));
|
25144 | }, function(module, exports) {
|
25145 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi, InJs = (window.powerbitests,
|
25146 | window.InJs), Microsoft = (window.debug, window.jasmine, window.Microsoft);
|
25147 | !function(powerbi) {
|
25148 | var visuals;
|
25149 | !function(visuals) {
|
25150 | var Color = jsCommon.Color, PixelConverter = jsCommon.PixelConverter, Polygon = visuals.shapes.Polygon, DataRoleHelper = powerbi.data.DataRoleHelper;
|
25151 | visuals.MaxLevelOfDetail = 23, visuals.MinLevelOfDetail = 1, visuals.DefaultFillOpacity = .5,
|
25152 | visuals.DefaultBackgroundColor = "#000000", visuals.LeaderLineColor = "#000000";
|
25153 | var MapBubbleDataPointRenderer = function() {
|
25154 | function MapBubbleDataPointRenderer(tooltipsEnabled) {
|
25155 | this.tooltipsEnabled = tooltipsEnabled;
|
25156 | }
|
25157 | return MapBubbleDataPointRenderer.prototype.init = function(mapControl, mapDiv, addClearCatcher) {
|
25158 | this.mapControl = mapControl, this.root = mapDiv;
|
25159 | var root = d3.select(mapDiv[0]);
|
25160 | root.attr("drag-resize-disabled", "true");
|
25161 | var svg = this.svg = root.append("svg").style("position", "absolute").style("pointer-events", "none");
|
25162 | if (addClearCatcher) {
|
25163 | var clearSvg = this.clearSvg = d3.select(this.mapControl.getRootElement()).append("svg").style("position", "absolute");
|
25164 | this.clearCatcher = visuals.appendClearCatcher(clearSvg);
|
25165 | }
|
25166 | this.bubbleGraphicsContext = svg.append("g").classed("mapBubbles", !0), this.sliceGraphicsContext = svg.append("g").classed("mapSlices", !0),
|
25167 | this.labelBackgroundGraphicsContext = svg.append("g").classed(visuals.NewDataLabelUtils.labelBackgroundGraphicsContextClass["class"], !0),
|
25168 | this.labelGraphicsContext = svg.append("g").classed(visuals.NewDataLabelUtils.labelGraphicsContextClass["class"], !0),
|
25169 | this.sliceLayout = d3.layout.pie().sort(null).value(function(d) {
|
25170 | return d.value;
|
25171 | }), this.arc = d3.svg.arc(), this.clearMaxDataPointRadius(), this.dataLabelsSettings = visuals.dataLabelUtils.getDefaultMapLabelSettings();
|
25172 | }, MapBubbleDataPointRenderer.prototype.setData = function(data) {
|
25173 | this.mapData = data;
|
25174 | }, MapBubbleDataPointRenderer.prototype.clearDataPoints = function() {
|
25175 | this.mapData = {
|
25176 | dataPoints: [],
|
25177 | geocodingCategory: null,
|
25178 | hasDynamicSeries: !1,
|
25179 | hasSize: !1
|
25180 | };
|
25181 | }, MapBubbleDataPointRenderer.prototype.getDataPointCount = function() {
|
25182 | return this.mapData ? _.filter(this.mapData.dataPoints, function(value) {
|
25183 | return !!value.location;
|
25184 | }).length : 0;
|
25185 | }, MapBubbleDataPointRenderer.prototype.getDataPointPadding = function() {
|
25186 | return 2 * this.maxDataPointRadius;
|
25187 | }, MapBubbleDataPointRenderer.prototype.clearMaxDataPointRadius = function() {
|
25188 | this.maxDataPointRadius = 0;
|
25189 | }, MapBubbleDataPointRenderer.prototype.setMaxDataPointRadius = function(dataPointRadius) {
|
25190 | this.maxDataPointRadius = Math.max(dataPointRadius, this.maxDataPointRadius);
|
25191 | }, MapBubbleDataPointRenderer.prototype.getDefaultMap = function(geocodingCategory, dataPointCount) {
|
25192 | this.clearDataPoints();
|
25193 | }, MapBubbleDataPointRenderer.prototype.converter = function(viewport, dataView, labelSettings, interactivityService, tooltipsEnabled) {
|
25194 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
25195 | var mapControl = this.mapControl, widthOverTwo = viewport.width / 2, heightOverTwo = viewport.height / 2, strokeWidth = 1;
|
25196 | this.dataLabelsSettings = labelSettings;
|
25197 | var radiusScale = Math.min(viewport.width, viewport.height) / 384;
|
25198 | this.clearMaxDataPointRadius();
|
25199 | var grouped, dataValuesSource, bubbleData = [], sliceData = [], categorical = dataView ? dataView.categorical : null, sizeIndex = -1;
|
25200 | categorical && categorical.values && (grouped = categorical.values.grouped(), sizeIndex = DataRoleHelper.getMeasureIndexOfRole(grouped, "Size"),
|
25201 | dataValuesSource = categorical.values.source);
|
25202 | for (var dataPoints = this.mapData ? this.mapData.dataPoints : [], hasSize = this.mapData.hasSize, categoryIndex = 0, categoryCount = dataPoints.length; categoryCount > categoryIndex; categoryIndex++) {
|
25203 | var dataPoint = dataPoints[categoryIndex], categoryValue = dataPoint.categoryValue, location_1 = dataPoint.location;
|
25204 | if (location_1) {
|
25205 | var xy = mapControl.tryLocationToPixel(new Microsoft.Maps.Location(location_1.latitude, location_1.longitude)), x = xy.x + widthOverTwo, y = xy.y + heightOverTwo, radius = dataPoint.radius * radiusScale;
|
25206 | this.setMaxDataPointRadius(radius);
|
25207 | var subDataPoints = dataPoint.subDataPoints, seriesCount = subDataPoints.length;
|
25208 | if (1 === seriesCount) {
|
25209 | var subDataPoint = subDataPoints[0];
|
25210 | bubbleData.push({
|
25211 | x: x,
|
25212 | y: y,
|
25213 | labeltext: categoryValue,
|
25214 | radius: radius,
|
25215 | fill: subDataPoint.fill,
|
25216 | stroke: subDataPoint.stroke,
|
25217 | strokeWidth: strokeWidth,
|
25218 | tooltipInfo: subDataPoint.tooltipInfo,
|
25219 | identity: subDataPoint.identity,
|
25220 | selected: !1,
|
25221 | labelFill: labelSettings.labelColor
|
25222 | });
|
25223 | } else {
|
25224 | for (var slices = [], seriesIndex = 0; seriesCount > seriesIndex; seriesIndex++) {
|
25225 | var subDataPoint = subDataPoints[seriesIndex], value = hasSize ? subDataPoint.value : 1;
|
25226 | slices.push({
|
25227 | x: x,
|
25228 | y: y,
|
25229 | labeltext: categoryValue,
|
25230 | radius: radius,
|
25231 | fill: subDataPoint.fill,
|
25232 | stroke: subDataPoint.stroke,
|
25233 | strokeWidth: strokeWidth,
|
25234 | value: value,
|
25235 | tooltipInfo: subDataPoint.tooltipInfo,
|
25236 | identity: subDataPoint.identity,
|
25237 | selected: !1,
|
25238 | labelFill: labelSettings.labelColor
|
25239 | });
|
25240 | }
|
25241 | interactivityService && interactivityService.applySelectionStateToData(slices),
|
25242 | sliceData.push(slices);
|
25243 | }
|
25244 | }
|
25245 | }
|
25246 | return interactivityService && interactivityService.applySelectionStateToData(bubbleData),
|
25247 | {
|
25248 | bubbleData: bubbleData,
|
25249 | sliceData: sliceData
|
25250 | };
|
25251 | }, MapBubbleDataPointRenderer.prototype.updateInternal = function(data, viewport, dataChanged, interactivityService, redrawDataLabels) {
|
25252 | Map.removeTransform3d(this.root), this.mapRendererData = data, this.svg && this.svg.style("width", viewport.width.toString() + "px").style("height", viewport.height.toString() + "px"),
|
25253 | this.clearSvg && this.clearSvg.style("width", viewport.width.toString() + "px").style("height", viewport.height.toString() + "px");
|
25254 | var arc = this.arc, hasSelection = interactivityService && interactivityService.hasSelection(), bubbles = this.bubbleGraphicsContext.selectAll(".bubble").data(data.bubbleData, function(d) {
|
25255 | return d.identity.getKey();
|
25256 | });
|
25257 | bubbles.enter().append("circle").classed("bubble", !0), bubbles.attr("cx", function(d) {
|
25258 | return d.x;
|
25259 | }).attr("cy", function(d) {
|
25260 | return d.y;
|
25261 | }).attr("r", function(d) {
|
25262 | return d.radius;
|
25263 | }).style("fill", function(d) {
|
25264 | return d.fill;
|
25265 | }).style("stroke", function(d) {
|
25266 | return d.stroke;
|
25267 | }).style("fill-opacity", function(d) {
|
25268 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
25269 | }).style("strokeWidth", function(d) {
|
25270 | return d.strokeWidth;
|
25271 | }).style("stroke-opacity", function(d) {
|
25272 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
25273 | }).style("cursor", "default"), bubbles.exit().remove(), this.tooltipsEnabled && (visuals.TooltipManager.addTooltip(this.bubbleGraphicsContext, function(tooltipEvent) {
|
25274 | return tooltipEvent.data.tooltipInfo;
|
25275 | }), bubbles.style("pointer-events", "all"));
|
25276 | var sliceData = data.sliceData, sliceContainers = this.sliceGraphicsContext.selectAll(".sliceContainer").data(sliceData);
|
25277 | sliceContainers.enter().append("g").classed("sliceContainer", !0), sliceContainers.exit().remove();
|
25278 | var sliceLayout = this.sliceLayout, slices = sliceContainers.selectAll(".slice").data(function(d) {
|
25279 | return sliceLayout(d);
|
25280 | }, function(d) {
|
25281 | return d.data.identity.getKey();
|
25282 | });
|
25283 | slices.enter().append("path").classed("slice", !0), slices.style("fill", function(t) {
|
25284 | return t.data.fill;
|
25285 | }).style("fill-opacity", function(d) {
|
25286 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, hasSelection, !1);
|
25287 | }).style("stroke", function(t) {
|
25288 | return t.data.stroke;
|
25289 | }).style("strokeWidth", function(t) {
|
25290 | return t.data.strokeWidth;
|
25291 | }).style("stroke-opacity", function(d) {
|
25292 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, hasSelection, !1);
|
25293 | }).style("cursor", "default").attr("transform", function(t) {
|
25294 | return visuals.SVGUtil.translate(t.data.x, t.data.y);
|
25295 | }).attr("d", function(t) {
|
25296 | return arc.innerRadius(0).outerRadius(function(t) {
|
25297 | return t.data.radius;
|
25298 | })(t);
|
25299 | }), slices.exit().remove(), this.updateInternalDataLabels(viewport, redrawDataLabels),
|
25300 | this.tooltipsEnabled && (visuals.TooltipManager.addTooltip(this.sliceGraphicsContext, function(tooltipEvent) {
|
25301 | return tooltipEvent.data.data.tooltipInfo;
|
25302 | }), slices.style("pointer-events", "all"));
|
25303 | for (var allData = data.bubbleData.slice(), i = 0, ilen = sliceData.length; ilen > i; i++) allData.push.apply(allData, sliceData[i]);
|
25304 | var behaviorOptions = {
|
25305 | bubbleEventGroup: this.bubbleGraphicsContext,
|
25306 | sliceEventGroup: this.sliceGraphicsContext,
|
25307 | bubbles: bubbles,
|
25308 | slices: slices,
|
25309 | clearCatcher: this.clearCatcher,
|
25310 | dataPoints: allData
|
25311 | };
|
25312 | return behaviorOptions;
|
25313 | }, MapBubbleDataPointRenderer.prototype.updateInternalDataLabels = function(viewport, redrawDataLabels) {
|
25314 | var labelSettings = this.dataLabelsSettings, dataLabels = [];
|
25315 | if (labelSettings && (labelSettings.show || labelSettings.showCategory)) {
|
25316 | var labelDataPoints = this.createLabelDataPoints(), labelLayout = new powerbi.LabelLayout({
|
25317 | maximumOffset: visuals.NewDataLabelUtils.maxLabelOffset,
|
25318 | startingOffset: visuals.NewDataLabelUtils.startingLabelOffset
|
25319 | }), labelDataPointsGroup = {
|
25320 | labelDataPoints: labelDataPoints,
|
25321 | maxNumberOfLabels: labelDataPoints.length
|
25322 | };
|
25323 | dataLabels = labelLayout.layout([ labelDataPointsGroup ], {
|
25324 | width: viewport.width,
|
25325 | height: viewport.height
|
25326 | });
|
25327 | }
|
25328 | visuals.NewDataLabelUtils.drawLabelBackground(this.labelGraphicsContext, dataLabels, powerbi.visuals.DefaultBackgroundColor, powerbi.visuals.DefaultFillOpacity),
|
25329 | visuals.NewDataLabelUtils.drawDefaultLabels(this.labelGraphicsContext, dataLabels, !1);
|
25330 | }, MapBubbleDataPointRenderer.prototype.createLabelDataPoints = function() {
|
25331 | var data = this.mapRendererData, labelDataPoints = [], dataPoints = data.bubbleData;
|
25332 | dataPoints = dataPoints.concat(_.map(data.sliceData, function(value) {
|
25333 | return value[0];
|
25334 | }));
|
25335 | for (var labelSettings = this.dataLabelsSettings, _i = 0, dataPoints_1 = dataPoints; _i < dataPoints_1.length; _i++) {
|
25336 | var dataPoint = dataPoints_1[_i], text = dataPoint.labeltext, properties = {
|
25337 | text: text,
|
25338 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
25339 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize),
|
25340 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
25341 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties);
|
25342 | labelDataPoints.push({
|
25343 | isPreferred: !0,
|
25344 | text: text,
|
25345 | textSize: {
|
25346 | width: textWidth,
|
25347 | height: textHeight
|
25348 | },
|
25349 | outsideFill: labelSettings.labelColor ? labelSettings.labelColor : visuals.NewDataLabelUtils.defaultInsideLabelColor,
|
25350 | insideFill: visuals.NewDataLabelUtils.defaultInsideLabelColor,
|
25351 | parentType: 0,
|
25352 | parentShape: {
|
25353 | point: {
|
25354 | x: dataPoint.x,
|
25355 | y: dataPoint.y
|
25356 | },
|
25357 | radius: dataPoint.radius,
|
25358 | validPositions: MapBubbleDataPointRenderer.validLabelPositions
|
25359 | },
|
25360 | fontSize: labelSettings.fontSize,
|
25361 | identity: void 0,
|
25362 | hasBackground: !0
|
25363 | });
|
25364 | }
|
25365 | return labelDataPoints;
|
25366 | }, MapBubbleDataPointRenderer.validLabelPositions = [ 1, 2, 4, 8 ], MapBubbleDataPointRenderer;
|
25367 | }();
|
25368 | visuals.MapBubbleDataPointRenderer = MapBubbleDataPointRenderer;
|
25369 | var MapShapeDataPointRenderer = function() {
|
25370 | function MapShapeDataPointRenderer(fillMapDataLabelsEnabled, tooltipsEnabled) {
|
25371 | this.filledMapDataLabelsEnabled = fillMapDataLabelsEnabled, this.tooltipsEnabled = tooltipsEnabled;
|
25372 | }
|
25373 | return MapShapeDataPointRenderer.getFilledMapParams = function(category, dataCount) {
|
25374 | switch (category) {
|
25375 | case visuals.MapUtil.CategoryTypes.Continent:
|
25376 | case visuals.MapUtil.CategoryTypes.CountryRegion:
|
25377 | return 10 > dataCount ? {
|
25378 | level: 1,
|
25379 | maxPolygons: 50,
|
25380 | strokeWidth: 0
|
25381 | } : 30 > dataCount ? {
|
25382 | level: 1,
|
25383 | maxPolygons: 20,
|
25384 | strokeWidth: 0
|
25385 | } : {
|
25386 | level: 1,
|
25387 | maxPolygons: 5,
|
25388 | strokeWidth: 0
|
25389 | };
|
25390 |
|
25391 | default:
|
25392 | return 100 > dataCount ? {
|
25393 | level: 1,
|
25394 | maxPolygons: 5,
|
25395 | strokeWidth: 6
|
25396 | } : 200 > dataCount ? {
|
25397 | level: 0,
|
25398 | maxPolygons: 5,
|
25399 | strokeWidth: 6
|
25400 | } : {
|
25401 | level: 0,
|
25402 | maxPolygons: 5,
|
25403 | strokeWidth: 0
|
25404 | };
|
25405 | }
|
25406 | }, MapShapeDataPointRenderer.buildPaths = function(locations) {
|
25407 | for (var paths = [], i = 0; i < locations.length; i++) {
|
25408 | var location_2 = locations[i], polygon = location_2.geographic;
|
25409 | polygon.length > 2 && paths.push(location_2);
|
25410 | }
|
25411 | return paths;
|
25412 | }, MapShapeDataPointRenderer.prototype.init = function(mapControl, mapDiv, addClearCatcher) {
|
25413 | this.mapControl = mapControl, this.polygonInfo = new visuals.MapPolygonInfo(), this.root = mapDiv;
|
25414 | var root = d3.select(mapDiv[0]);
|
25415 | root.attr("drag-resize-disabled", "true");
|
25416 | var svg = this.svg = root.append("svg").style("position", "absolute").style("pointer-events", "none");
|
25417 | if (addClearCatcher) {
|
25418 | var clearSvg = this.clearSvg = d3.select(this.mapControl.getRootElement()).append("svg").style("position", "absolute");
|
25419 | this.clearCatcher = visuals.appendClearCatcher(clearSvg);
|
25420 | }
|
25421 | this.shapeGraphicsContext = svg.append("g").classed("mapShapes", !0), this.labelBackgroundGraphicsContext = svg.append("g").classed(visuals.NewDataLabelUtils.labelBackgroundGraphicsContextClass["class"], !0),
|
25422 | this.labelGraphicsContext = svg.append("g").classed(visuals.NewDataLabelUtils.labelGraphicsContextClass["class"], !0),
|
25423 | this.clearMaxShapeDimension(), this.dataLabelsSettings = visuals.dataLabelUtils.getDefaultMapLabelSettings();
|
25424 | }, MapShapeDataPointRenderer.prototype.setData = function(data) {
|
25425 | this.mapData = data;
|
25426 | }, MapShapeDataPointRenderer.prototype.clearDataPoints = function() {
|
25427 | this.mapData = {
|
25428 | dataPoints: [],
|
25429 | geocodingCategory: null,
|
25430 | hasDynamicSeries: !1,
|
25431 | hasSize: !1
|
25432 | };
|
25433 | }, MapShapeDataPointRenderer.prototype.getDataPointCount = function() {
|
25434 | return this.mapData ? _.filter(this.mapData.dataPoints, function(value) {
|
25435 | return !!value.paths;
|
25436 | }).length : 0;
|
25437 | }, MapShapeDataPointRenderer.prototype.converter = function(viewport, dataView, labelSettings, interactivityService) {
|
25438 | this.clearMaxShapeDimension(), this.dataLabelsSettings = labelSettings;
|
25439 | for (var strokeWidth = 1, shapeData = [], dataPoints = this.mapData ? this.mapData.dataPoints : [], categoryIndex = 0, categoryCount = dataPoints.length; categoryCount > categoryIndex; categoryIndex++) {
|
25440 | var categorical = dataView ? dataView.categorical : null, dataPoint = dataPoints[categoryIndex], subDataPoint = dataPoint.subDataPoints[0], paths = dataPoint.paths, grouped = void 0, sizeIndex = -1, dataValuesSource = void 0;
|
25441 | if (categorical && categorical.values && (grouped = categorical.values.grouped(),
|
25442 | sizeIndex = DataRoleHelper.getMeasureIndexOfRole(grouped, "Size"), dataValuesSource = categorical.values.source),
|
25443 | paths) for (var value = dataPoint.value, categoryValue = dataPoint.categoryValue, identity = subDataPoint.identity, idKey = identity.getKey(), formattersCache = visuals.NewDataLabelUtils.createColumnFormatterCacheManager(), mainShapeIndex = MapShapeDataPointRenderer.getIndexOfLargestShape(paths), pathIndex = 0, pathCount = paths.length; pathCount > pathIndex; pathIndex++) {
|
25444 | var path = paths[pathIndex], labelFormatString = dataView && dataView.categorical && !_.isEmpty(dataView.categorical.values) ? visuals.valueFormatter.getFormatString(dataView.categorical.values[0].source, visuals.filledMapProps.general.formatString) : void 0;
|
25445 | this.setMaxShapeDimension(path.absoluteBounds.width, path.absoluteBounds.height);
|
25446 | var formatter = formattersCache.getOrCreate(labelFormatString, labelSettings);
|
25447 | shapeData.push({
|
25448 | absolutePointArray: path.absolute,
|
25449 | path: path.absoluteString,
|
25450 | fill: subDataPoint.fill,
|
25451 | stroke: subDataPoint.stroke,
|
25452 | strokeWidth: strokeWidth,
|
25453 | tooltipInfo: subDataPoint.tooltipInfo,
|
25454 | identity: identity,
|
25455 | selected: !1,
|
25456 | key: JSON.stringify({
|
25457 | id: idKey,
|
25458 | pIdx: pathIndex
|
25459 | }),
|
25460 | displayLabel: pathIndex === mainShapeIndex,
|
25461 | labeltext: categoryValue,
|
25462 | catagoryLabeltext: null != value ? visuals.NewDataLabelUtils.getLabelFormattedText(formatter.format(value)) : void 0,
|
25463 | labelFormatString: labelFormatString
|
25464 | });
|
25465 | }
|
25466 | }
|
25467 | return interactivityService && interactivityService.applySelectionStateToData(shapeData),
|
25468 | {
|
25469 | shapeData: shapeData
|
25470 | };
|
25471 | }, MapShapeDataPointRenderer.prototype.updateInternal = function(data, viewport, dataChanged, interactivityService, redrawDataLabels) {
|
25472 | Map.removeTransform3d(this.root), this.mapRendererData = data, this.svg && this.svg.style("width", viewport.width.toString() + "px").style("height", viewport.height.toString() + "px"),
|
25473 | this.clearSvg && this.clearSvg.style("width", viewport.width.toString() + "px").style("height", viewport.height.toString() + "px"),
|
25474 | this.polygonInfo.reCalc(this.mapControl, viewport.width, viewport.height), this.shapeGraphicsContext.attr("transform", this.polygonInfo.transformToString(this.polygonInfo.transform));
|
25475 | var hasSelection = interactivityService && interactivityService.hasSelection(), shapes = this.shapeGraphicsContext.selectAll("polygon").data(data.shapeData, function(d) {
|
25476 | return d.key;
|
25477 | });
|
25478 | shapes.enter().append("polygon").classed("shape", !0).attr("points", function(d) {
|
25479 | return d.path;
|
25480 | }), shapes.style("fill", function(d) {
|
25481 | return d.fill;
|
25482 | }).style("fill-opacity", function(d) {
|
25483 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
25484 | }).style("cursor", "default"), dataChanged && shapes.attr("points", function(d) {
|
25485 | return d.path;
|
25486 | }), shapes.exit().remove(), this.updateInternalDataLabels(viewport, redrawDataLabels),
|
25487 | this.tooltipsEnabled && (visuals.TooltipManager.addTooltip(this.shapeGraphicsContext, function(tooltipEvent) {
|
25488 | return tooltipEvent.data.tooltipInfo;
|
25489 | }), shapes.style("pointer-events", "all"));
|
25490 | var behaviorOptions = {
|
25491 | shapeEventGroup: this.shapeGraphicsContext,
|
25492 | shapes: shapes,
|
25493 | clearCatcher: this.clearCatcher,
|
25494 | dataPoints: data.shapeData
|
25495 | };
|
25496 | return behaviorOptions;
|
25497 | }, MapShapeDataPointRenderer.prototype.getDataPointPadding = function() {
|
25498 | return 12;
|
25499 | }, MapShapeDataPointRenderer.getIndexOfLargestShape = function(paths) {
|
25500 | for (var largestShapeIndex = 0, largestShapeArea = 0, pathIndex = 0, pathCount = paths.length; pathCount > pathIndex; pathIndex++) {
|
25501 | var path = paths[pathIndex], polygon = new Polygon(path.absolute), currentShapeArea = Math.abs(Polygon.calculateAbsolutePolygonArea(polygon.polygonPoints));
|
25502 | currentShapeArea > largestShapeArea && (largestShapeIndex = pathIndex, largestShapeArea = currentShapeArea);
|
25503 | }
|
25504 | return largestShapeIndex;
|
25505 | }, MapShapeDataPointRenderer.prototype.updateInternalDataLabels = function(viewport, redrawDataLabels) {
|
25506 | var labels, labelSettings = this.dataLabelsSettings;
|
25507 | if (labelSettings && (labelSettings.show || labelSettings.showCategory)) {
|
25508 | var labelDataPoints = this.createLabelDataPoints();
|
25509 | void 0 === this.labelLayout && (this.labelLayout = new powerbi.FilledMapLabelLayout()),
|
25510 | labels = this.labelLayout.layout(labelDataPoints, {
|
25511 | width: viewport.width,
|
25512 | height: viewport.height
|
25513 | }, this.polygonInfo.transform, redrawDataLabels);
|
25514 | }
|
25515 | this.drawLabelStems(this.labelGraphicsContext, labels, labelSettings.show, labelSettings.showCategory),
|
25516 | visuals.NewDataLabelUtils.drawLabelBackground(this.labelGraphicsContext, labels, powerbi.visuals.DefaultBackgroundColor, powerbi.visuals.DefaultFillOpacity),
|
25517 | visuals.NewDataLabelUtils.drawDefaultLabels(this.labelGraphicsContext, labels, !1, labelSettings.show && labelSettings.showCategory);
|
25518 | }, MapShapeDataPointRenderer.prototype.clearMaxShapeDimension = function() {
|
25519 | this.maxShapeDimension = 0;
|
25520 | }, MapShapeDataPointRenderer.prototype.setMaxShapeDimension = function(width, height) {
|
25521 | this.maxShapeDimension = Math.max(width, this.maxShapeDimension), this.maxShapeDimension = Math.max(height, this.maxShapeDimension);
|
25522 | }, MapShapeDataPointRenderer.prototype.createLabelDataPoints = function() {
|
25523 | var data = this.mapRendererData, labelDataPoints = [];
|
25524 | if (this.filledMapDataLabelsEnabled) for (var dataShapes = data.shapeData, labelSettings = this.dataLabelsSettings, _i = 0, dataShapes_1 = dataShapes; _i < dataShapes_1.length; _i++) {
|
25525 | var dataShape = dataShapes_1[_i];
|
25526 | if (dataShape.displayLabel) {
|
25527 | var text = void 0, secondRowText = void 0, secondRowTextWidth = 0, hasSecondRow = !1;
|
25528 | if (this.dataLabelsSettings.show && !this.dataLabelsSettings.showCategory) {
|
25529 | if (text = dataShape.catagoryLabeltext, void 0 === text) continue;
|
25530 | } else if (this.dataLabelsSettings.showCategory && !this.dataLabelsSettings.show) {
|
25531 | if (text = dataShape.labeltext, void 0 === text) continue;
|
25532 | } else if (this.dataLabelsSettings.showCategory && this.dataLabelsSettings.show) {
|
25533 | if (text = dataShape.catagoryLabeltext, secondRowText = dataShape.labeltext, void 0 === text && void 0 === secondRowText) continue;
|
25534 | hasSecondRow = !0;
|
25535 | }
|
25536 | if (hasSecondRow) {
|
25537 | var secondRowProperties = {
|
25538 | text: secondRowText,
|
25539 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
25540 | fontSize: visuals.NewDataLabelUtils.LabelTextProperties.fontSize,
|
25541 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
25542 | };
|
25543 | secondRowTextWidth = powerbi.TextMeasurementService.measureSvgTextWidth(secondRowProperties);
|
25544 | }
|
25545 | var firstRowProperties = {
|
25546 | text: text,
|
25547 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
25548 | fontSize: visuals.NewDataLabelUtils.LabelTextProperties.fontSize,
|
25549 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
25550 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(firstRowProperties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(firstRowProperties);
|
25551 | secondRowText && void 0 !== dataShape.labeltext && void 0 !== dataShape.catagoryLabeltext && (textHeight = 2 * textHeight);
|
25552 | var labelDataPoint = {
|
25553 | parentType: 2,
|
25554 | parentShape: {
|
25555 | polygon: new Polygon(dataShape.absolutePointArray),
|
25556 | validPositions: MapShapeDataPointRenderer.validLabelPolygonPositions
|
25557 | },
|
25558 | text: text,
|
25559 | secondRowText: secondRowText,
|
25560 | textSize: {
|
25561 | width: Math.max(textWidth, secondRowTextWidth),
|
25562 | height: textHeight
|
25563 | },
|
25564 | insideFill: labelSettings.labelColor,
|
25565 | outsideFill: labelSettings.labelColor ? labelSettings.labelColor : visuals.NewDataLabelUtils.defaultInsideLabelColor,
|
25566 | isPreferred: !1,
|
25567 | identity: void 0,
|
25568 | hasBackground: !0
|
25569 | };
|
25570 | labelDataPoints.push(labelDataPoint);
|
25571 | }
|
25572 | }
|
25573 | return labelDataPoints;
|
25574 | }, MapShapeDataPointRenderer.prototype.drawLabelStems = function(labelsContext, dataLabels, showText, showCategory) {
|
25575 | var filteredLabels = _.filter(dataLabels, function(d) {
|
25576 | return d.isVisible;
|
25577 | }), key = function(d, index) {
|
25578 | return d.identity ? d.identity.getKeyWithoutHighlight() : index;
|
25579 | };
|
25580 | visuals.NewDataLabelUtils.drawLabelLeaderLines(labelsContext, filteredLabels, key, visuals.LeaderLineColor);
|
25581 | }, MapShapeDataPointRenderer.validLabelPolygonPositions = [ 256, 2, 1, 8, 4, 16, 32, 64, 128 ],
|
25582 | MapShapeDataPointRenderer;
|
25583 | }();
|
25584 | visuals.MapShapeDataPointRenderer = MapShapeDataPointRenderer;
|
25585 | var DefaultLocationZoomLevel = 11, Map = function() {
|
25586 | function Map(options) {
|
25587 | this.isDestroyed = !1, options.filledMap ? (this.dataPointRenderer = new MapShapeDataPointRenderer(options.filledMapDataLabelsEnabled, options.tooltipsEnabled),
|
25588 | this.filledMapDataLabelsEnabled = options.filledMapDataLabelsEnabled, this.isFilledMap = !0) : (this.dataPointRenderer = new MapBubbleDataPointRenderer(options.tooltipsEnabled),
|
25589 | this.isFilledMap = !1), this.mapControlFactory = options.mapControlFactory ? options.mapControlFactory : this.getDefaultMapControlFactory(),
|
25590 | this.behavior = options.behavior, this.tooltipsEnabled = options.tooltipsEnabled,
|
25591 | this.tooltipBucketEnabled = options.tooltipBucketEnabled, this.disableZooming = options.disableZooming,
|
25592 | this.disablePanning = options.disablePanning, this.isLegendScrollable = !!options.behavior,
|
25593 | this.viewChangeThrottleInterval = options.viewChangeThrottleInterval, this.enableCurrentLocation = options.enableCurrentLocation,
|
25594 | this.boundsHaveBeenUpdated = !1;
|
25595 | }
|
25596 | return Map.prototype.init = function(options) {
|
25597 | var _this = this, element = this.element = $("<div>");
|
25598 | element.appendTo(options.element), this.pendingGeocodingRender = !1, this.currentViewport = options.viewport,
|
25599 | this.style = options.style, this.colors = this.style.colorPalette.dataColors, this.behavior && (this.interactivityService = visuals.createInteractivityService(options.host)),
|
25600 | this.dataLabelsSettings = visuals.dataLabelUtils.getDefaultMapLabelSettings(), this.legend = powerbi.visuals.createLegend(element, options.interactivity && options.interactivity.isInteractiveLegend, this.interactivityService, this.isLegendScrollable),
|
25601 | this.legendHeight = 0, this.legendData = {
|
25602 | dataPoints: []
|
25603 | }, this.geoTaggingAnalyzerService = powerbi.createGeoTaggingAnalyzerService(options.host.getLocalizedString),
|
25604 | this.host = options.host, options.host.locale && (this.locale = options.host.locale()),
|
25605 | this.geocoder = options.host.geocoder(), this.promiseFactory = options.host.promiseFactory(),
|
25606 | this.resetBounds(), this.isDestroyed = !1, this.mapControlFactory.ensureMap(this.locale, function() {
|
25607 | _this.isDestroyed || (Map.removeHillShading(), Microsoft.Maps.loadModule("Microsoft.Maps.Overlays.Style", {
|
25608 | callback: function() {
|
25609 | _this.initialize(element[0]), _this.enableCurrentLocation && _this.createCurrentLocation(element);
|
25610 | }
|
25611 | }));
|
25612 | });
|
25613 | }, Map.prototype.destroy = function() {
|
25614 | this.isDestroyed = !0, this.geocodingContext && this.geocodingContext.timeout && this.geocodingContext.timeout.resolve(null);
|
25615 | }, Map.prototype.createCurrentLocation = function(element) {
|
25616 | var pushpin, _this = this, myLocBtn = InJs.DomFactory.div().addClass("mapCurrentLocation").appendTo(element);
|
25617 | myLocBtn.on("click", function() {
|
25618 | _this.isCurrentLocation ? (pushpin && _this.mapControl.entities.remove(pushpin),
|
25619 | _this.updateInternal(!1, !1), _this.isCurrentLocation = !1) : _this.host.geolocation().getCurrentPosition(function(position) {
|
25620 | var location = new Microsoft.Maps.Location(position.coords.latitude, position.coords.longitude);
|
25621 | pushpin && _this.mapControl.entities.remove(pushpin), pushpin = visuals.MapUtil.CurrentLocation.createPushpin(location),
|
25622 | _this.mapControl.entities.push(pushpin), _this.updateMapView(location, DefaultLocationZoomLevel),
|
25623 | _this.isCurrentLocation = !0;
|
25624 | });
|
25625 | });
|
25626 | }, Map.prototype.addDataPoint = function(dataPoint) {
|
25627 | var location = dataPoint.location;
|
25628 | this.updateBounds(location.latitude, location.longitude), this.scheduleRedraw();
|
25629 | }, Map.prototype.scheduleRedraw = function() {
|
25630 | var _this = this;
|
25631 | !this.pendingGeocodingRender && this.mapControl && (this.pendingGeocodingRender = !0,
|
25632 | setTimeout(function() {
|
25633 | _this.updateInternal(!0, !0), _this.pendingGeocodingRender = !1;
|
25634 | }, Map.ScheduleRedrawInterval));
|
25635 | }, Map.prototype.enqueueGeoCode = function(dataPoint) {
|
25636 | var _this = this, location = this.geocoder.tryGeocodeImmediate(dataPoint.geocodingQuery, this.geocodingCategory);
|
25637 | if (location) this.completeGeoCode(dataPoint, location); else {
|
25638 | var geocodingContext_1 = this.geocodingContext;
|
25639 | this.geocoder.geocode(dataPoint.geocodingQuery, this.geocodingCategory, {
|
25640 | timeout: geocodingContext_1.timeout.promise
|
25641 | }).then(function(location) {
|
25642 | !_this.isDestroyed && location && geocodingContext_1 === _this.geocodingContext && _this.completeGeoCode(dataPoint, location);
|
25643 | });
|
25644 | }
|
25645 | }, Map.prototype.completeGeoCode = function(dataPoint, location) {
|
25646 | dataPoint.location = location, this.addDataPoint(dataPoint);
|
25647 | }, Map.prototype.enqueueGeoCodeAndGeoShape = function(dataPoint, params) {
|
25648 | var _this = this, location = this.geocoder.tryGeocodeImmediate(dataPoint.geocodingQuery, this.geocodingCategory);
|
25649 | if (location) this.completeGeoCodeAndGeoShape(dataPoint, params, location); else {
|
25650 | var geocodingContext_2 = this.geocodingContext;
|
25651 | this.geocoder.geocode(dataPoint.geocodingQuery, this.geocodingCategory, {
|
25652 | timeout: geocodingContext_2.timeout.promise
|
25653 | }).then(function(location) {
|
25654 | !_this.isDestroyed && location && geocodingContext_2 === _this.geocodingContext && _this.completeGeoCodeAndGeoShape(dataPoint, params, location);
|
25655 | });
|
25656 | }
|
25657 | }, Map.prototype.completeGeoCodeAndGeoShape = function(dataPoint, params, location) {
|
25658 | dataPoint.location = location, this.enqueueGeoShape(dataPoint, params);
|
25659 | }, Map.prototype.enqueueGeoShape = function(dataPoint, params) {
|
25660 | var _this = this, result = this.geocoder.tryGeocodeBoundaryImmediate(dataPoint.location.latitude, dataPoint.location.longitude, this.geocodingCategory, params.level, params.maxPolygons);
|
25661 | if (result) this.completeGeoShape(dataPoint, params, result); else {
|
25662 | var geocodingContext_3 = this.geocodingContext;
|
25663 | this.geocoder.geocodeBoundary(dataPoint.location.latitude, dataPoint.location.longitude, this.geocodingCategory, params.level, params.maxPolygons, {
|
25664 | timeout: geocodingContext_3.timeout.promise
|
25665 | }).then(function(result) {
|
25666 | !_this.isDestroyed && result && geocodingContext_3 === _this.geocodingContext && _this.completeGeoShape(dataPoint, params, result);
|
25667 | });
|
25668 | }
|
25669 | }, Map.prototype.completeGeoShape = function(dataPoint, params, result) {
|
25670 | var paths;
|
25671 | 0 === result.locations.length || result.locations[0].geographic ? paths = MapShapeDataPointRenderer.buildPaths(result.locations) : (visuals.MapUtil.calcGeoData(result),
|
25672 | paths = MapShapeDataPointRenderer.buildPaths(result.locations)), dataPoint.paths = paths,
|
25673 | this.addDataPoint(dataPoint);
|
25674 | }, Map.prototype.getOptimumLevelOfDetail = function(width, height) {
|
25675 | var dataPointCount = this.dataPointRenderer.getDataPointCount();
|
25676 | if (0 === dataPointCount) return visuals.MapUtil.MinLevelOfDetail;
|
25677 | for (var threshold = this.dataPointRenderer.getDataPointPadding(), levelOfDetail = visuals.MapUtil.MaxLevelOfDetail; levelOfDetail >= visuals.MapUtil.MinLevelOfDetail; levelOfDetail--) {
|
25678 | var minXmaxY = visuals.MapUtil.latLongToPixelXY(this.minLatitude, this.minLongitude, levelOfDetail), maxXminY = visuals.MapUtil.latLongToPixelXY(this.maxLatitude, this.maxLongitude, levelOfDetail);
|
25679 | if (maxXminY.x - minXmaxY.x + threshold <= width && minXmaxY.y - maxXminY.y + threshold <= height) return 2 > dataPointCount && (levelOfDetail = Math.min(visuals.MapUtil.MaxAutoZoomLevel, levelOfDetail)),
|
25680 | levelOfDetail;
|
25681 | }
|
25682 | return visuals.MapUtil.MinLevelOfDetail;
|
25683 | }, Map.prototype.getViewCenter = function(levelOfDetail) {
|
25684 | var minXmaxY = visuals.MapUtil.latLongToPixelXY(this.minLatitude, this.minLongitude, levelOfDetail), maxXminY = visuals.MapUtil.latLongToPixelXY(this.maxLatitude, this.maxLongitude, levelOfDetail);
|
25685 | return visuals.MapUtil.pixelXYToLocation((minXmaxY.x + maxXminY.x) / 2, (maxXminY.y + minXmaxY.y) / 2, levelOfDetail);
|
25686 | }, Map.prototype.resetBounds = function() {
|
25687 | this.boundsHaveBeenUpdated = !1, this.minLongitude = visuals.MapUtil.MaxAllowedLongitude,
|
25688 | this.maxLongitude = visuals.MapUtil.MinAllowedLongitude, this.minLatitude = visuals.MapUtil.MaxAllowedLatitude,
|
25689 | this.maxLatitude = visuals.MapUtil.MinAllowedLatitude;
|
25690 | }, Map.prototype.updateBounds = function(latitude, longitude) {
|
25691 | this.boundsHaveBeenUpdated = !0, longitude < this.minLongitude && (this.minLongitude = longitude),
|
25692 | longitude > this.maxLongitude && (this.maxLongitude = longitude), latitude < this.minLatitude && (this.minLatitude = latitude),
|
25693 | latitude > this.maxLatitude && (this.maxLatitude = latitude);
|
25694 | }, Map.legendObject = function(dataView) {
|
25695 | return dataView && dataView.metadata && dataView.metadata.objects && dataView.metadata.objects.legend;
|
25696 | }, Map.isLegendHidden = function(dataView) {
|
25697 | var legendObject = Map.legendObject(dataView);
|
25698 | return null != legendObject && legendObject[visuals.legendProps.show] === !1;
|
25699 | }, Map.legendPosition = function(dataView) {
|
25700 | var legendObject = Map.legendObject(dataView);
|
25701 | return legendObject && visuals.LegendPosition[legendObject[visuals.legendProps.position]];
|
25702 | }, Map.getLegendFontSize = function(dataView) {
|
25703 | var legendObject = Map.legendObject(dataView);
|
25704 | return legendObject && legendObject[visuals.legendProps.fontSize] || visuals.SVGLegend.DefaultFontSizeInPt;
|
25705 | }, Map.isShowLegendTitle = function(dataView) {
|
25706 | var legendObject = Map.legendObject(dataView);
|
25707 | return legendObject && legendObject[visuals.legendProps.showTitle];
|
25708 | }, Map.prototype.legendTitle = function() {
|
25709 | var legendObject = Map.legendObject(this.dataView);
|
25710 | return legendObject && legendObject[visuals.legendProps.titleText] || this.legendData.title;
|
25711 | }, Map.prototype.renderLegend = function(legendData) {
|
25712 | var hideLegend = Map.isLegendHidden(this.dataView), showTitle = Map.isShowLegendTitle(this.dataView), title = this.legendTitle(), clonedLegendData = {
|
25713 | dataPoints: hideLegend ? [] : legendData.dataPoints,
|
25714 | grouped: legendData.grouped,
|
25715 | title: showTitle ? title : "",
|
25716 | fontSize: Map.getLegendFontSize(this.dataView)
|
25717 | }, targetOrientation = Map.legendPosition(this.dataView);
|
25718 | void 0 !== targetOrientation ? this.legend.changeOrientation(targetOrientation) : this.legend.changeOrientation(visuals.LegendPosition.Top),
|
25719 | this.legend.drawLegend(clonedLegendData, this.currentViewport);
|
25720 | }, Map.calculateGroupSizes = function(categorical, grouped, groupSizeTotals, sizeMeasureIndex, currentValueScale) {
|
25721 | for (var categoryCount = categorical.values[0].values.length, seriesCount = grouped.length, i = 0, len = categoryCount; len > i; ++i) {
|
25722 | var groupTotal = null;
|
25723 | if (sizeMeasureIndex >= 0) for (var j = 0; seriesCount > j; ++j) {
|
25724 | var value = grouped[j].values[sizeMeasureIndex].values[i];
|
25725 | value && (null === groupTotal ? groupTotal = value : groupTotal += value);
|
25726 | }
|
25727 | groupSizeTotals.push(groupTotal), groupTotal && (currentValueScale ? (currentValueScale.min = Math.min(currentValueScale.min, groupTotal),
|
25728 | currentValueScale.max = Math.max(currentValueScale.max, groupTotal)) : currentValueScale = {
|
25729 | min: groupTotal,
|
25730 | max: groupTotal
|
25731 | });
|
25732 | }
|
25733 | return currentValueScale;
|
25734 | }, Map.calculateRadius = function(range, value) {
|
25735 | var rangeDiff = range ? range.max - range.min : 0, radius = 6;
|
25736 | return null != range && null != value && 0 !== rangeDiff && (radius = 14 * ((value - range.min) / rangeDiff) + 6),
|
25737 | radius;
|
25738 | }, Map.getGeocodingCategory = function(categorical, geoTaggingAnalyzerService) {
|
25739 | if (categorical && categorical.categories && categorical.categories.length > 0 && categorical.categories[0].source) {
|
25740 | var type = categorical.categories[0].source.type;
|
25741 | if (type && type.categoryString) return geoTaggingAnalyzerService.getFieldType(type.categoryString);
|
25742 | var categoryName = categorical.categories[0].source.displayName, geotaggedResult = geoTaggingAnalyzerService.getFieldType(categoryName);
|
25743 | if (geotaggedResult) return geotaggedResult;
|
25744 | var roles = categorical.categories[0].source.roles;
|
25745 | if (roles) for (var roleNames = Object.keys(roles), i = 0, len = roleNames.length; len > i; ++i) {
|
25746 | var typeFromRoleName = geoTaggingAnalyzerService.getFieldType(roleNames[i]);
|
25747 | if (typeFromRoleName) return typeFromRoleName;
|
25748 | }
|
25749 | }
|
25750 | }, Map.hasSizeField = function(values, defaultIndexIfNoRole) {
|
25751 | if (_.isEmpty(values)) return !1;
|
25752 | for (var i = 0, ilen = values.length; ilen > i; i++) {
|
25753 | var roles = values[i].source.roles;
|
25754 | if (!roles && i === defaultIndexIfNoRole && values[i].source.type.numeric) return !0;
|
25755 | if (roles) for (var roleNames = Object.keys(roles), j = 0, jlen = roleNames.length; jlen > j; j++) {
|
25756 | var role = roleNames[j];
|
25757 | if ("Size" === role) return !0;
|
25758 | }
|
25759 | }
|
25760 | return !1;
|
25761 | }, Map.shouldEnumerateDataPoints = function(dataView, usesSizeForGradient) {
|
25762 | var hasSeries = DataRoleHelper.hasRoleInDataView(dataView, "Series"), gradientRole = usesSizeForGradient ? "Size" : "Gradient", hasGradientRole = DataRoleHelper.hasRoleInDataView(dataView, gradientRole);
|
25763 | return hasSeries || !hasGradientRole;
|
25764 | }, Map.shouldEnumerateCategoryLabels = function(isFilledMap, filledMapDataLabelsEnabled) {
|
25765 | return !isFilledMap || filledMapDataLabelsEnabled;
|
25766 | }, Map.prototype.enumerateObjectInstances = function(options) {
|
25767 | var enumeration = new visuals.ObjectEnumerationBuilder();
|
25768 | switch (options.objectName) {
|
25769 | case "dataPoint":
|
25770 | if (Map.shouldEnumerateDataPoints(this.dataView, this.isFilledMap)) {
|
25771 | var bubbleData = [], hasDynamicSeries = this.hasDynamicSeries;
|
25772 | if (!hasDynamicSeries) {
|
25773 | var mapData = this.dataPointRenderer.converter(this.getMapViewPort(), this.dataView, this.dataLabelsSettings, this.interactivityService, this.tooltipsEnabled);
|
25774 | bubbleData = mapData.bubbleData;
|
25775 | }
|
25776 | Map.enumerateDataPoints(enumeration, this.dataPointsToEnumerate, this.colors, hasDynamicSeries, this.defaultDataPointColor, this.showAllDataPoints, bubbleData);
|
25777 | }
|
25778 | break;
|
25779 |
|
25780 | case "categoryLabels":
|
25781 | Map.shouldEnumerateCategoryLabels(this.isFilledMap, this.filledMapDataLabelsEnabled) && visuals.dataLabelUtils.enumerateCategoryLabels(enumeration, this.dataLabelsSettings, !0, !0);
|
25782 | break;
|
25783 |
|
25784 | case "legend":
|
25785 | this.hasDynamicSeries && Map.enumerateLegend(enumeration, this.dataView, this.legend, this.legendTitle());
|
25786 | break;
|
25787 |
|
25788 | case "labels":
|
25789 | if (this.filledMapDataLabelsEnabled) {
|
25790 | this.dataLabelsSettings = this.dataLabelsSettings ? this.dataLabelsSettings : visuals.dataLabelUtils.getDefaultMapLabelSettings();
|
25791 | var labelSettingOptions = {
|
25792 | enumeration: enumeration,
|
25793 | dataLabelsSettings: this.dataLabelsSettings,
|
25794 | show: !0,
|
25795 | displayUnits: !0,
|
25796 | precision: !0
|
25797 | };
|
25798 | visuals.dataLabelUtils.enumerateDataLabels(labelSettingOptions);
|
25799 | }
|
25800 | }
|
25801 | return enumeration.complete();
|
25802 | }, Map.enumerateDataPoints = function(enumeration, dataPoints, colors, hasDynamicSeries, defaultDataPointColor, showAllDataPoints, bubbleData) {
|
25803 | var seriesLength = dataPoints && dataPoints.length;
|
25804 | if (hasDynamicSeries) for (var i = 0; seriesLength > i; i++) {
|
25805 | var dataPoint = dataPoints[i];
|
25806 | enumeration.pushInstance({
|
25807 | objectName: "dataPoint",
|
25808 | displayName: dataPoint.label,
|
25809 | selector: visuals.ColorHelper.normalizeSelector(dataPoint.identity.getSelector()),
|
25810 | properties: {
|
25811 | fill: {
|
25812 | solid: {
|
25813 | color: dataPoint.color
|
25814 | }
|
25815 | }
|
25816 | }
|
25817 | });
|
25818 | } else if (enumeration.pushInstance({
|
25819 | objectName: "dataPoint",
|
25820 | selector: null,
|
25821 | properties: {
|
25822 | defaultColor: {
|
25823 | solid: {
|
25824 | color: defaultDataPointColor || colors.getColorByIndex(0).value
|
25825 | }
|
25826 | }
|
25827 | }
|
25828 | }).pushInstance({
|
25829 | objectName: "dataPoint",
|
25830 | selector: null,
|
25831 | properties: {
|
25832 | showAllDataPoints: !!showAllDataPoints
|
25833 | }
|
25834 | }), bubbleData) for (var i = 0; i < bubbleData.length; i++) {
|
25835 | var bubbleDataPoint = bubbleData[i];
|
25836 | enumeration.pushInstance({
|
25837 | objectName: "dataPoint",
|
25838 | displayName: bubbleDataPoint.labeltext,
|
25839 | selector: visuals.ColorHelper.normalizeSelector(bubbleDataPoint.identity.getSelector()),
|
25840 | properties: {
|
25841 | fill: {
|
25842 | solid: {
|
25843 | color: Color.normalizeToHexString(bubbleDataPoint.fill)
|
25844 | }
|
25845 | }
|
25846 | }
|
25847 | });
|
25848 | }
|
25849 | }, Map.enumerateLegend = function(enumeration, dataView, legend, legendTitle) {
|
25850 | enumeration.pushInstance({
|
25851 | selector: null,
|
25852 | properties: {
|
25853 | show: !Map.isLegendHidden(dataView),
|
25854 | position: visuals.LegendPosition[legend.getOrientation()],
|
25855 | showTitle: Map.isShowLegendTitle(dataView),
|
25856 | titleText: legendTitle,
|
25857 | fontSize: Map.getLegendFontSize(dataView)
|
25858 | },
|
25859 | objectName: "legend"
|
25860 | });
|
25861 | }, Map.prototype.onDataChanged = function(options) {
|
25862 | var _this = this;
|
25863 | this.resetBounds(), this.geocodingContext && this.geocodingContext.timeout && this.geocodingContext.timeout.resolve(null),
|
25864 | this.geocodingContext = {
|
25865 | timeout: this.promiseFactory.defer()
|
25866 | }, this.behavior && this.behavior.resetZoomPan(), this.dataLabelsSettings = visuals.dataLabelUtils.getDefaultMapLabelSettings(),
|
25867 | this.defaultDataPointColor = null, this.showAllDataPoints = null;
|
25868 | var dataView = this.dataView = options.dataViews[0], isFilledMap = this.isFilledMap, warnings = [], data = {
|
25869 | dataPoints: [],
|
25870 | geocodingCategory: null,
|
25871 | hasDynamicSeries: !1,
|
25872 | hasSize: !1
|
25873 | };
|
25874 | if (dataView) {
|
25875 | if (dataView.metadata && dataView.metadata.objects) {
|
25876 | var objects = dataView.metadata.objects;
|
25877 | if (this.defaultDataPointColor = powerbi.DataViewObjects.getFillColor(objects, visuals.mapProps.dataPoint.defaultColor),
|
25878 | this.showAllDataPoints = powerbi.DataViewObjects.getValue(objects, visuals.mapProps.dataPoint.showAllDataPoints),
|
25879 | this.dataLabelsSettings.showCategory = powerbi.DataViewObjects.getValue(objects, visuals.filledMapProps.categoryLabels.show, this.dataLabelsSettings.showCategory),
|
25880 | isFilledMap) {
|
25881 | this.dataLabelsSettings.precision = powerbi.DataViewObjects.getValue(objects, visuals.filledMapProps.labels.labelPrecision, this.dataLabelsSettings.precision),
|
25882 | this.dataLabelsSettings.precision = this.dataLabelsSettings.precision !== visuals.dataLabelUtils.defaultLabelPrecision && this.dataLabelsSettings.precision < 0 ? 0 : this.dataLabelsSettings.precision,
|
25883 | this.dataLabelsSettings.displayUnits = powerbi.DataViewObjects.getValue(objects, visuals.filledMapProps.labels.labelDisplayUnits, this.dataLabelsSettings.displayUnits);
|
25884 | var datalabelsObj = objects.labels;
|
25885 | datalabelsObj && (this.dataLabelsSettings.show = void 0 !== datalabelsObj.show ? datalabelsObj.show : this.dataLabelsSettings.show,
|
25886 | void 0 !== datalabelsObj.color && (this.dataLabelsSettings.labelColor = datalabelsObj.color.solid.color));
|
25887 | } else {
|
25888 | var categoryLabelsObj = objects.categoryLabels;
|
25889 | categoryLabelsObj && visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(categoryLabelsObj, this.dataLabelsSettings);
|
25890 | }
|
25891 | }
|
25892 | var colorHelper = new visuals.ColorHelper(this.colors, visuals.mapProps.dataPoint.fill, this.defaultDataPointColor);
|
25893 | data = Map.converter(dataView, colorHelper, this.geoTaggingAnalyzerService, isFilledMap, this.tooltipBucketEnabled),
|
25894 | this.hasDynamicSeries = data.hasDynamicSeries, this.legendData = Map.createLegendData(dataView, colorHelper),
|
25895 | this.dataPointsToEnumerate = this.legendData.dataPoints, this.renderLegend(this.legendData),
|
25896 | null != data ? (this.geocodingCategory = data.geocodingCategory, this.mapControlFactory.ensureMap(this.locale, function() {
|
25897 | if (!_this.isDestroyed) {
|
25898 | Map.removeHillShading();
|
25899 | var params;
|
25900 | isFilledMap && (params = MapShapeDataPointRenderer.getFilledMapParams(_this.geocodingCategory, data.dataPoints.length));
|
25901 | for (var _i = 0, _a = data.dataPoints; _i < _a.length; _i++) {
|
25902 | var dataPoint = _a[_i];
|
25903 | if (dataPoint.location) isFilledMap && !dataPoint.paths ? _this.enqueueGeoShape(dataPoint, params) : _this.addDataPoint(dataPoint); else {
|
25904 | var categoryValue = dataPoint.categoryValue;
|
25905 | null != categoryValue && "" !== categoryValue && (isFilledMap ? _this.enqueueGeoCodeAndGeoShape(dataPoint, params) : _this.enqueueGeoCode(dataPoint));
|
25906 | }
|
25907 | }
|
25908 | }
|
25909 | })) : this.clearDataPoints(), isFilledMap && (this.geocodingCategory && this.geoTaggingAnalyzerService.isGeoshapable(this.geocodingCategory) || warnings.push(new visuals.FilledMapWithoutValidGeotagCategoryWarning()));
|
25910 | } else this.clearDataPoints(), this.renderLegend({
|
25911 | dataPoints: [],
|
25912 | title: void 0
|
25913 | }), this.dataPointsToEnumerate = [];
|
25914 | _.isEmpty(warnings) || this.host.setWarnings(warnings), this.dataPointRenderer.setData(data),
|
25915 | this.updateInternal(!0, !0);
|
25916 | }, Map.converter = function(dataView, colorHelper, geoTaggingAnalyzerService, isFilledMap, tooltipBucketEnabled) {
|
25917 | var reader = powerbi.data.createIDataViewCategoricalReader(dataView), dataPoints = [], hasDynamicSeries = reader.hasDynamicSeries(), seriesColumnIdentifier = reader.getSeriesColumnIdentityFields(), sizeQueryName = reader.getMeasureQueryName("Size");
|
25918 | null == sizeQueryName && (sizeQueryName = "");
|
25919 | var hasSize = reader.hasValues("Size"), geocodingCategory = null, formatStringProp = visuals.mapProps.general.formatString;
|
25920 | if (reader.hasCategories()) {
|
25921 | var categoryTotals = [], categoryTotalRange = void 0;
|
25922 | if (hasSize) {
|
25923 | for (var categoryMin = void 0, categoryMax = void 0, categoryIndex = 0, categoryCount = reader.getCategoryCount(); categoryCount > categoryIndex; categoryIndex++) {
|
25924 | for (var categoryTotal = void 0, seriesIndex = 0, seriesCount = reader.getSeriesCount(); seriesCount > seriesIndex; seriesIndex++) {
|
25925 | var currentValue = reader.getValue("Size", categoryIndex, seriesIndex);
|
25926 | null == categoryTotal && null != currentValue && (categoryTotal = 0), null != categoryTotal && (categoryTotal += currentValue);
|
25927 | }
|
25928 | categoryTotals.push(categoryTotal), null != categoryTotal && ((void 0 === categoryMin || categoryMin > categoryTotal) && (categoryMin = categoryTotal),
|
25929 | (void 0 === categoryMax || categoryTotal > categoryMax) && (categoryMax = categoryTotal));
|
25930 | }
|
25931 | categoryTotalRange = void 0 !== categoryMin && void 0 !== categoryMax ? {
|
25932 | max: categoryMax,
|
25933 | min: categoryMin
|
25934 | } : void 0;
|
25935 | }
|
25936 | var hasLatLongGroup = reader.hasCompositeCategories() && reader.hasCategoryWithRole("X") && reader.hasCategoryWithRole("Y"), hasCategoryGroup = reader.hasCategoryWithRole("Category");
|
25937 | if (geocodingCategory = Map.getGeocodingCategory(dataView.categorical, geoTaggingAnalyzerService),
|
25938 | hasLatLongGroup || hasCategoryGroup) for (var categoryIndex = 0, categoryCount = reader.getCategoryCount(); categoryCount > categoryIndex; categoryIndex++) {
|
25939 | var categoryValue = void 0, categoryObjects = hasCategoryGroup ? reader.getCategoryObjects("Category", categoryIndex) : reader.getCategoryObjects("Y", categoryIndex), location_3 = void 0, categoryTooltipItem = void 0, latitudeTooltipItem = void 0, longitudeTooltipItem = void 0, seriesTooltipItem = void 0, sizeTooltipItem = void 0, gradientTooltipItem = void 0;
|
25940 | if (hasCategoryGroup) {
|
25941 | if (categoryValue = visuals.converterHelper.formatFromMetadataColumn(reader.getCategoryValue("Category", categoryIndex), reader.getCategoryMetadataColumn("Category"), formatStringProp),
|
25942 | categoryTooltipItem = {
|
25943 | displayName: reader.getCategoryDisplayName("Category"),
|
25944 | value: categoryValue
|
25945 | }, reader.hasValues("Y") && reader.hasValues("X")) {
|
25946 | var latitude = reader.getFirstNonNullValueForCategory("Y", categoryIndex), longitude = reader.getFirstNonNullValueForCategory("X", categoryIndex);
|
25947 | null != latitude && null != longitude && (location_3 = {
|
25948 | latitude: latitude,
|
25949 | longitude: longitude
|
25950 | }), latitudeTooltipItem = {
|
25951 | displayName: reader.getValueDisplayName("Y"),
|
25952 | value: visuals.converterHelper.formatFromMetadataColumn(latitude, reader.getValueMetadataColumn("Y"), formatStringProp)
|
25953 | }, longitudeTooltipItem = {
|
25954 | displayName: reader.getValueDisplayName("X"),
|
25955 | value: visuals.converterHelper.formatFromMetadataColumn(longitude, reader.getValueMetadataColumn("X"), formatStringProp)
|
25956 | };
|
25957 | }
|
25958 | } else {
|
25959 | var latitude = reader.getCategoryValue("Y", categoryIndex), longitude = reader.getCategoryValue("X", categoryIndex);
|
25960 | null != latitude && null != longitude && (categoryValue = latitude + ", " + longitude,
|
25961 | location_3 = {
|
25962 | latitude: latitude,
|
25963 | longitude: longitude
|
25964 | }, latitudeTooltipItem = {
|
25965 | displayName: reader.getCategoryDisplayName("Y"),
|
25966 | value: visuals.converterHelper.formatFromMetadataColumn(latitude, reader.getCategoryMetadataColumn("Y"), formatStringProp)
|
25967 | }, longitudeTooltipItem = {
|
25968 | displayName: reader.getCategoryDisplayName("X"),
|
25969 | value: visuals.converterHelper.formatFromMetadataColumn(longitude, reader.getCategoryMetadataColumn("X"), formatStringProp)
|
25970 | });
|
25971 | }
|
25972 | var value = hasSize ? categoryTotals[categoryIndex] : void 0, subDataPoints = [], seriesCount = reader.getSeriesCount();
|
25973 | hasSize || hasDynamicSeries || (seriesCount = 1);
|
25974 | for (var seriesIndex = 0; seriesCount > seriesIndex; seriesIndex++) {
|
25975 | var color = void 0;
|
25976 | color = hasDynamicSeries ? colorHelper.getColorForSeriesValue(reader.getSeriesObjects(seriesIndex), seriesColumnIdentifier, reader.getSeriesName(seriesIndex)) : reader.hasCategoryWithRole("Series") ? colorHelper.getColorForSeriesValue(reader.getCategoryObjects("Series", categoryIndex), reader.getCategoryColumnIdentityFields("Series"), categoryValue) : colorHelper.getColorForMeasure(categoryObjects, sizeQueryName);
|
25977 | var colorRgb = Color.parseColorString(color), stroke = Color.hexString(Color.darken(colorRgb, Map.StrokeDarkenColorValue));
|
25978 | colorRgb.A = .6;
|
25979 | var fill = Color.rgbString(colorRgb), identityBuilder = new visuals.SelectionIdBuilder().withCategory(reader.getCategoryColumn(hasCategoryGroup ? "Category" : "Y"), categoryIndex).withMeasure(sizeQueryName);
|
25980 | hasDynamicSeries && (identityBuilder = identityBuilder.withSeries(reader.getSeriesValueColumns(), reader.getSeriesValueColumnGroup(seriesIndex))),
|
25981 | hasDynamicSeries && (seriesTooltipItem = {
|
25982 | displayName: reader.getSeriesDisplayName(),
|
25983 | value: visuals.converterHelper.formatFromMetadataColumn(reader.getSeriesName(seriesIndex), reader.getSeriesMetadataColumn(), formatStringProp)
|
25984 | });
|
25985 | var subsliceValue = void 0;
|
25986 | hasSize && (subsliceValue = reader.getValue("Size", categoryIndex, seriesIndex),
|
25987 | sizeTooltipItem = {
|
25988 | displayName: reader.getValueDisplayName("Size"),
|
25989 | value: visuals.converterHelper.formatFromMetadataColumn(subsliceValue, reader.getValueMetadataColumn("Size", seriesIndex), formatStringProp)
|
25990 | }), reader.hasValues("Gradient") && (gradientTooltipItem = {
|
25991 | displayName: reader.getValueDisplayName("Gradient"),
|
25992 | value: visuals.converterHelper.formatFromMetadataColumn(reader.getValue("Gradient", categoryIndex, seriesIndex), reader.getValueMetadataColumn("Gradient", seriesIndex), formatStringProp)
|
25993 | });
|
25994 | var tooltipInfo = [];
|
25995 | categoryTooltipItem && tooltipInfo.push(categoryTooltipItem), seriesTooltipItem && tooltipInfo.push(seriesTooltipItem),
|
25996 | latitudeTooltipItem && tooltipInfo.push(latitudeTooltipItem), longitudeTooltipItem && tooltipInfo.push(longitudeTooltipItem),
|
25997 | sizeTooltipItem && tooltipInfo.push(sizeTooltipItem), gradientTooltipItem && tooltipInfo.push(gradientTooltipItem),
|
25998 | tooltipBucketEnabled && visuals.TooltipBuilder.addTooltipBucketItem(reader, tooltipInfo, categoryIndex, seriesIndex),
|
25999 | (subsliceValue || !hasSize || 0 === subsliceValue && isFilledMap) && subDataPoints.push({
|
26000 | value: subsliceValue,
|
26001 | fill: fill,
|
26002 | stroke: stroke,
|
26003 | identity: identityBuilder.createSelectionId(),
|
26004 | tooltipInfo: tooltipInfo
|
26005 | });
|
26006 | }
|
26007 | (value || !hasSize || 0 === value && isFilledMap) && dataPoints.push({
|
26008 | geocodingQuery: categoryValue,
|
26009 | value: value,
|
26010 | categoryValue: categoryValue,
|
26011 | subDataPoints: subDataPoints,
|
26012 | radius: Map.calculateRadius(categoryTotalRange, value),
|
26013 | location: location_3
|
26014 | });
|
26015 | }
|
26016 | }
|
26017 | var mapData = {
|
26018 | dataPoints: dataPoints,
|
26019 | geocodingCategory: geocodingCategory,
|
26020 | hasDynamicSeries: hasDynamicSeries,
|
26021 | hasSize: hasSize
|
26022 | };
|
26023 | return mapData;
|
26024 | }, Map.createLegendData = function(dataView, colorHelper) {
|
26025 | var legendTitle, reader = powerbi.data.createIDataViewCategoricalReader(dataView), legendDataPoints = [];
|
26026 | if (reader.hasDynamicSeries()) {
|
26027 | legendTitle = reader.getSeriesDisplayName();
|
26028 | for (var seriesColumnIdentifier = reader.getSeriesColumnIdentityFields(), seriesIndex = 0, seriesCount = reader.getSeriesCount(); seriesCount > seriesIndex; seriesIndex++) {
|
26029 | var color = colorHelper.getColorForSeriesValue(reader.getSeriesObjects(seriesIndex), seriesColumnIdentifier, reader.getSeriesName(seriesIndex)), identity = new visuals.SelectionIdBuilder().withSeries(reader.getSeriesValueColumns(), reader.getSeriesValueColumnGroup(seriesIndex)).createSelectionId();
|
26030 | legendDataPoints.push({
|
26031 | color: color,
|
26032 | label: visuals.valueFormatter.format(reader.getSeriesName(seriesIndex)),
|
26033 | icon: visuals.LegendIcon.Circle,
|
26034 | identity: identity,
|
26035 | selected: !1
|
26036 | });
|
26037 | }
|
26038 | }
|
26039 | var legendData = {
|
26040 | dataPoints: legendDataPoints,
|
26041 | title: legendTitle
|
26042 | };
|
26043 | return legendData;
|
26044 | }, Map.prototype.swapLogoContainerChildElement = function() {
|
26045 | var logoContainer = this.element.find(".LogoContainer");
|
26046 | if (logoContainer) {
|
26047 | var aNode = logoContainer.find("a");
|
26048 | if (null == aNode) return;
|
26049 | var divNode = $("<div>");
|
26050 | aNode.children().clone().appendTo(divNode), aNode.remove(), divNode.appendTo(logoContainer);
|
26051 | }
|
26052 | }, Map.prototype.onResizing = function(viewport) {
|
26053 | this.currentViewport.width === viewport.width && this.currentViewport.height === viewport.height || (this.currentViewport = viewport,
|
26054 | this.renderLegend(this.legendData), this.updateInternal(!1, !1));
|
26055 | }, Map.prototype.initialize = function(container) {
|
26056 | var _this = this, mapOptions = {
|
26057 | credentials: visuals.MapUtil.Settings.BingKey,
|
26058 | showMapTypeSelector: !1,
|
26059 | enableClickableLogo: !1,
|
26060 | enableSearchLogo: !1,
|
26061 | mapTypeId: Microsoft.Maps.MapTypeId.road,
|
26062 | customizeOverlays: !0,
|
26063 | showDashboard: !1,
|
26064 | showScalebar: !1,
|
26065 | disableKeyboardInput: !0,
|
26066 | disableZooming: this.disableZooming,
|
26067 | disablePanning: this.disablePanning
|
26068 | }, divQuery = this.root = InJs.DomFactory.div().addClass(Map.MapContainer.cssClass).appendTo(container);
|
26069 | this.mapControl = this.mapControlFactory.createMapControl(divQuery[0], mapOptions),
|
26070 | void 0 !== this.viewChangeThrottleInterval ? Microsoft.Maps.Events.addThrottledHandler(this.mapControl, "viewchange", function() {
|
26071 | _this.onViewChanged();
|
26072 | }, this.viewChangeThrottleInterval) : Microsoft.Maps.Events.addHandler(this.mapControl, "viewchange", function() {
|
26073 | _this.onViewChanged();
|
26074 | }), Microsoft.Maps.Events.addHandler(this.mapControl, "viewchangeend", function() {
|
26075 | _this.onViewChangeEnded();
|
26076 | }), this.dataPointRenderer.init(this.mapControl, divQuery, !!this.behavior), this.pendingGeocodingRender || this.updateInternal(!0, !0);
|
26077 | }, Map.prototype.onViewChanged = function() {
|
26078 | this.updateOffsets(!1, !1), this.behavior && this.behavior.viewChanged(), this.swapLogoContainerChildElement();
|
26079 | }, Map.prototype.onViewChangeEnded = function() {
|
26080 | this.dataPointRenderer.updateInternalDataLabels(this.currentViewport, !0);
|
26081 | }, Map.prototype.getMapViewPort = function() {
|
26082 | var currentViewport = this.currentViewport, legendMargins = this.legend.getMargins(), mapViewport = {
|
26083 | width: currentViewport.width - legendMargins.width,
|
26084 | height: currentViewport.height - legendMargins.height
|
26085 | };
|
26086 | return mapViewport;
|
26087 | }, Map.removeTransform3d = function(mapRoot) {
|
26088 | var userAgent = window.navigator.userAgent.toLowerCase();
|
26089 | if (mapRoot && -1 === userAgent.indexOf("applewebkit")) {
|
26090 | var imageTiles = mapRoot.find("img");
|
26091 | imageTiles.css("transform", "");
|
26092 | }
|
26093 | }, Map.prototype.updateInternal = function(dataChanged, redrawDataLabels) {
|
26094 | if (this.mapControl) {
|
26095 | var isLegendVisible = this.legend.isVisible();
|
26096 | isLegendVisible || (this.legendData = {
|
26097 | dataPoints: []
|
26098 | });
|
26099 | var mapDiv = this.element.children(Map.MapContainer.selector), mapViewport = this.getMapViewPort();
|
26100 | if (mapDiv.height(mapViewport.height), mapDiv.width(mapViewport.width), this.updateOffsets(dataChanged, redrawDataLabels),
|
26101 | this.boundsHaveBeenUpdated && (!this.behavior || !this.behavior.hasReceivedZoomOrPanEvent())) {
|
26102 | var levelOfDetail = this.getOptimumLevelOfDetail(mapViewport.width, mapViewport.height), center = this.getViewCenter(levelOfDetail);
|
26103 | this.updateMapView(center, levelOfDetail);
|
26104 | }
|
26105 | }
|
26106 | }, Map.prototype.updateMapView = function(center, levelOfDetail) {
|
26107 | this.mapControl.setView({
|
26108 | center: center,
|
26109 | zoom: levelOfDetail,
|
26110 | animate: !0
|
26111 | });
|
26112 | }, Map.prototype.updateOffsets = function(dataChanged, redrawDataLabels) {
|
26113 | var data, dataView = this.dataView, viewport = this.getMapViewPort();
|
26114 | data = dataView && dataView.categorical ? this.dataPointRenderer.converter(viewport, this.dataView, this.dataLabelsSettings, this.interactivityService, this.tooltipsEnabled) : {
|
26115 | bubbleData: [],
|
26116 | shapeData: [],
|
26117 | sliceData: []
|
26118 | };
|
26119 | var behaviorOptions = this.dataPointRenderer.updateInternal(data, viewport, dataChanged, this.interactivityService, redrawDataLabels);
|
26120 | visuals.Legend.positionChartArea(d3.select(this.root[0]), this.legend), this.interactivityService && behaviorOptions && this.interactivityService.bind(behaviorOptions.dataPoints, this.behavior, behaviorOptions);
|
26121 | }, Map.prototype.onClearSelection = function() {
|
26122 | this.interactivityService.clearSelection(), this.updateOffsets(!1, !1);
|
26123 | }, Map.prototype.clearDataPoints = function() {
|
26124 | this.dataPointRenderer.clearDataPoints(), this.legend.drawLegend({
|
26125 | dataPoints: []
|
26126 | }, this.currentViewport);
|
26127 | }, Map.prototype.getDefaultMapControlFactory = function() {
|
26128 | return {
|
26129 | createMapControl: function(element, options) {
|
26130 | return new Microsoft.Maps.Map(element, options);
|
26131 | },
|
26132 | ensureMap: jsCommon.ensureMap
|
26133 | };
|
26134 | }, Map.removeHillShading = function() {
|
26135 | Microsoft.Maps.Globals.roadUriFormat = Microsoft.Maps.Globals.roadUriFormat.replace("&shading=hill", "");
|
26136 | }, Map.MapContainer = {
|
26137 | cssClass: "mapControl",
|
26138 | selector: ".mapControl"
|
26139 | }, Map.StrokeDarkenColorValue = 63.75, Map.ScheduleRedrawInterval = 3e3, Map;
|
26140 | }();
|
26141 | visuals.Map = Map;
|
26142 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
26143 | }(powerbi || (powerbi = {}));
|
26144 | }, function(module, exports) {
|
26145 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
26146 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
26147 | !function(powerbi) {
|
26148 | var visuals;
|
26149 | !function(visuals) {
|
26150 | function appendImage(selection) {
|
26151 | selection.append("div").classed("imgCon", !0).append("img");
|
26152 | }
|
26153 | function setImageStyle(selection, imageStyle) {
|
26154 | selection.selectAll(".imgCon").style({
|
26155 | height: getPixelString(imageStyle.maxHeight)
|
26156 | }).selectAll("img").style({
|
26157 | "max-height": getPixelString(imageStyle.maxHeight),
|
26158 | "max-width": getPixelString(imageStyle.maxWidth)
|
26159 | });
|
26160 | }
|
26161 | function getPixelString(value) {
|
26162 | return value + "px";
|
26163 | }
|
26164 | var getKpiImageMetadata = powerbi.visuals.KpiUtil.getKpiImageMetadata, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter, UrlUtils = jsCommon.UrlUtils, EdgeSettings = powerbi.visuals.controls.internal.TablixUtils.EdgeSettings, TitleFontFamily = visuals.Font.Family.semibold.css, DefaultFontFamily = visuals.Font.Family.regular.css, DefaultCaptionFontSizeInPt = 10, DefaultTitleFontSizeInPt = 13, DefaultDetailFontSizeInPt = 9, DefaultTitleColor = "#767676", DefaultTextColor = "#333333", DefaultCategoryColor = "#ACACAC", DefaultOutline = visuals.outline.none, DefaultOutlineColor = "#E8E8E8", DefaultOutlineWeight = 1, DefaultBarShow = !0, DefaultBarColor = "#A6A6A6", DefaultBarOutline = visuals.outline.leftOnly, DefaultBarWeight = 3, MultiRowCard = function() {
|
26165 | function MultiRowCard() {
|
26166 | this.isInteractivityOverflowHidden = !1;
|
26167 | }
|
26168 | return MultiRowCard.prototype.init = function(options) {
|
26169 | this.options = options, this.style = options.style;
|
26170 | var viewport = this.currentViewport = options.viewport, interactivity = this.interactivity = options.interactivity;
|
26171 | interactivity && "hidden" === interactivity.overflow && (this.isInteractivityOverflowHidden = !0);
|
26172 | var multiRowCardDiv = this.element = $("<div/>").addClass(MultiRowCard.MultiRowCardRoot["class"]).css({
|
26173 | height: getPixelString(viewport.height)
|
26174 | });
|
26175 | options.element.append(multiRowCardDiv), this.initializeCardRowSelection();
|
26176 | }, MultiRowCard.prototype.onDataChanged = function(options) {
|
26177 | var dataViews = options.dataViews;
|
26178 | if (dataViews && dataViews.length > 0) {
|
26179 | var dataView = this.dataView = dataViews[0], columnMetadata = dataView.table.columns, tableRows = dataView.table.rows, resetScrollbarPosition = options.operationKind !== powerbi.VisualDataChangeOperationKind.Append, data_1 = this.data = MultiRowCard.converter(dataView, columnMetadata.length, tableRows.length, this.isInteractivityOverflowHidden);
|
26180 | this.setCardDimensions(), this.listView.data(data_1.dataModel, function(d) {
|
26181 | return data_1.dataModel.indexOf(d);
|
26182 | }, resetScrollbarPosition);
|
26183 | } else this.data = {
|
26184 | dataModel: [],
|
26185 | dataColumnCount: 0,
|
26186 | cardTitleSettings: visuals.dataLabelUtils.getDefaultLabelSettings(!0, DefaultTitleColor, DefaultTitleFontSizeInPt),
|
26187 | categoryLabelsSettings: visuals.dataLabelUtils.getDefaultLabelSettings(!0, DefaultCategoryColor, DefaultDetailFontSizeInPt),
|
26188 | dataLabelsSettings: visuals.dataLabelUtils.getDefaultLabelSettings(!0, DefaultTextColor, DefaultCaptionFontSizeInPt),
|
26189 | cardSettings: MultiRowCard.getCardSettings(null)
|
26190 | };
|
26191 | this.waitingForData = !1;
|
26192 | }, MultiRowCard.getCardSettings = function(dataView) {
|
26193 | var objects = dataView && dataView.metadata && dataView.metadata.objects ? dataView.metadata.objects : null, outlineSettings = {
|
26194 | outline: powerbi.DataViewObjects.getValue(objects, visuals.multiRowCardProps.card.outline, DefaultOutline),
|
26195 | color: powerbi.DataViewObjects.getFillColor(objects, visuals.multiRowCardProps.card.outlineColor, DefaultOutlineColor),
|
26196 | weight: powerbi.DataViewObjects.getValue(objects, visuals.multiRowCardProps.card.outlineWeight, DefaultOutlineWeight)
|
26197 | }, barShow = powerbi.DataViewObjects.getValue(objects, visuals.multiRowCardProps.card.barShow, DefaultBarShow), barSettings = {
|
26198 | outline: barShow ? DefaultBarOutline : visuals.outline.none,
|
26199 | color: powerbi.DataViewObjects.getFillColor(objects, visuals.multiRowCardProps.card.barColor, DefaultBarColor),
|
26200 | weight: powerbi.DataViewObjects.getValue(objects, visuals.multiRowCardProps.card.barWeight, DefaultBarWeight)
|
26201 | }, cardPadding = powerbi.DataViewObjects.getValue(objects, visuals.multiRowCardProps.card.cardPadding, MultiRowCard.DefaultStyle.row.marginBottom), cardBackground = powerbi.DataViewObjects.getFillColor(objects, visuals.multiRowCardProps.card.cardBackground, MultiRowCard.DefaultStyle.row.background);
|
26202 | return {
|
26203 | outlineSettings: outlineSettings,
|
26204 | barSettings: barSettings,
|
26205 | cardPadding: cardPadding,
|
26206 | cardBackground: cardBackground
|
26207 | };
|
26208 | }, MultiRowCard.prototype.onResizing = function(viewport) {
|
26209 | var heightNotChanged = this.currentViewport.height === viewport.height;
|
26210 | if (this.currentViewport = viewport, this.element.css("height", getPixelString(viewport.height)),
|
26211 | this.dataView) {
|
26212 | var previousMaxColPerRow = this.maxColPerRow;
|
26213 | this.maxColPerRow = this.getMaxColPerRow();
|
26214 | var widthNotChanged = previousMaxColPerRow === this.maxColPerRow;
|
26215 | heightNotChanged && widthNotChanged || this.listView.viewport(viewport);
|
26216 | }
|
26217 | }, MultiRowCard.converter = function(dataView, columnCount, maxCards, isDashboardVisual) {
|
26218 | void 0 === isDashboardVisual && (isDashboardVisual = !1);
|
26219 | var cardTitleSettings, dataLabelsSettings, categoryLabelsSettings, details = [], tableDataRows = dataView.table.rows, columnMetadata = dataView.table.columns;
|
26220 | if (cardTitleSettings = visuals.dataLabelUtils.getDefaultLabelSettings(!0, DefaultTitleColor, DefaultTitleFontSizeInPt),
|
26221 | dataLabelsSettings = visuals.dataLabelUtils.getDefaultLabelSettings(!0, DefaultTextColor, DefaultCaptionFontSizeInPt),
|
26222 | categoryLabelsSettings = visuals.dataLabelUtils.getDefaultLabelSettings(!0, DefaultCategoryColor, DefaultDetailFontSizeInPt),
|
26223 | dataView.metadata && dataView.metadata.objects) {
|
26224 | var cardTitleLabelObjects = powerbi.DataViewObjects.getObject(dataView.metadata.objects, "cardTitle");
|
26225 | visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(cardTitleLabelObjects, cardTitleSettings);
|
26226 | var dataLabelObject = powerbi.DataViewObjects.getObject(dataView.metadata.objects, "dataLabels");
|
26227 | visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(dataLabelObject, dataLabelsSettings);
|
26228 | var categoryLabelObject = powerbi.DataViewObjects.getObject(dataView.metadata.objects, "categoryLabels");
|
26229 | visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(categoryLabelObject, categoryLabelsSettings);
|
26230 | }
|
26231 | for (var i = 0, len = maxCards; len > i; i++) {
|
26232 | for (var row = tableDataRows[i], isValuePromoted = void 0, title = void 0, showTitleAsURL = !1, showTitleAsImage = !1, showTitleAsKPI = !1, cardData = [], j = 0; columnCount > j; j++) {
|
26233 | var column = columnMetadata[j], statusGraphicInfo = getKpiImageMetadata(column, row[j]), columnCaption = void 0, statusGraphic = void 0;
|
26234 | statusGraphicInfo && (columnCaption = statusGraphicInfo["class"], statusGraphic = statusGraphicInfo.statusGraphic),
|
26235 | columnCaption || (columnCaption = visuals.valueFormatter.format(row[j], visuals.valueFormatter.getFormatString(column, MultiRowCard.formatStringProp)));
|
26236 | var showKPI = void 0 !== statusGraphicInfo && void 0 !== statusGraphicInfo.caption, columnDetail = columnMetadata[j].displayName;
|
26237 | isDashboardVisual || column.type.numeric || (void 0 === isValuePromoted ? (isValuePromoted = !0,
|
26238 | title = columnCaption, showTitleAsURL = visuals.converterHelper.isWebUrlColumn(column) && UrlUtils.isValidUrl(title),
|
26239 | showTitleAsImage = visuals.converterHelper.isImageUrlColumn(column) && UrlUtils.isValidImageUrl(columnCaption),
|
26240 | showTitleAsKPI = showKPI) : isValuePromoted && (isValuePromoted = !1)), cardData.push({
|
26241 | caption: columnCaption,
|
26242 | details: columnDetail,
|
26243 | showURL: visuals.converterHelper.isWebUrlColumn(column) && UrlUtils.isValidUrl(columnCaption),
|
26244 | showImage: visuals.converterHelper.isImageUrlColumn(column) && UrlUtils.isValidImageUrl(columnCaption),
|
26245 | showKPI: showKPI,
|
26246 | columnIndex: j
|
26247 | });
|
26248 | }
|
26249 | details.push({
|
26250 | title: isValuePromoted ? title : void 0,
|
26251 | showTitleAsURL: showTitleAsURL,
|
26252 | showTitleAsImage: showTitleAsImage,
|
26253 | showTitleAsKPI: showTitleAsKPI,
|
26254 | cardItemsData: isValuePromoted ? cardData.filter(function(d) {
|
26255 | return d.caption !== title;
|
26256 | }) : cardData
|
26257 | });
|
26258 | }
|
26259 | return {
|
26260 | dataModel: details,
|
26261 | dataColumnCount: details[0] ? details[0].cardItemsData.length : 0,
|
26262 | cardTitleSettings: cardTitleSettings,
|
26263 | categoryLabelsSettings: categoryLabelsSettings,
|
26264 | dataLabelsSettings: dataLabelsSettings,
|
26265 | cardSettings: MultiRowCard.getCardSettings(dataView)
|
26266 | };
|
26267 | }, MultiRowCard.getSortableRoles = function(options) {
|
26268 | if (options && options.dataViewMappings && !_.isEmpty(options.dataViewMappings)) for (var _i = 0, _a = options.dataViewMappings; _i < _a.length; _i++) {
|
26269 | var dataViewMapping = _a[_i];
|
26270 | if (dataViewMapping.table) {
|
26271 | var rows = dataViewMapping.table.rows;
|
26272 | if (rows && rows["for"] && rows["for"]["in"] && rows["for"]["in"].items) return [ MultiRowCard.ValuesRole ];
|
26273 | }
|
26274 | }
|
26275 | }, MultiRowCard.prototype.initializeCardRowSelection = function() {
|
26276 | var _this = this, isDashboardVisual = this.isInteractivityOverflowHidden, rowEnter = function(rowSelection) {
|
26277 | var cardRow = rowSelection.append("div").classed(MultiRowCard.Card["class"], !0);
|
26278 | isDashboardVisual ? cardRow.classed("mrtile", !0) : _this.cardHasTitle && cardRow.append("div").classed(MultiRowCard.Title["class"], !0).each(function(d) {
|
26279 | d.showTitleAsImage ? appendImage(d3.select(this)) : d.showTitleAsURL ? d3.select(this).append("a") : d.showTitleAsKPI && d3.select(this).append("div").classed(MultiRowCard.KPITitle["class"], !0).classed(d.title, !0).style({
|
26280 | display: "inline-block",
|
26281 | verticalAlign: "sub"
|
26282 | });
|
26283 | });
|
26284 | var cardItem = cardRow.selectAll(MultiRowCard.CardItemContainer.selector).data(function(d) {
|
26285 | return d.cardItemsData;
|
26286 | }).enter().append("div").classed(MultiRowCard.CardItemContainer["class"], !0);
|
26287 | cardItem.append("div").classed(MultiRowCard.Caption["class"], !0).each(function(d) {
|
26288 | d.showURL ? d3.select(this).append("a") : d.showImage ? appendImage(d3.select(this)) : d.showKPI && d3.select(this).append("div").classed(d.caption, !0).style({
|
26289 | display: "inline-block",
|
26290 | verticalAlign: "sub"
|
26291 | });
|
26292 | }), cardItem.append("div").classed(MultiRowCard.Details["class"], !0);
|
26293 | }, rowUpdate = function(rowSelection) {
|
26294 | var style = _this.getStyle(), dataLabelHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(MultiRowCard.getTextProperties(!1, style.caption.fontSize)), categoryLabelHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(MultiRowCard.getTextProperties(!1, style.details.fontSize)), titleLabelHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(MultiRowCard.getTextProperties(!0, style.title.fontSize)), rowBorderStyle = _this.getBorderStyles(style.row.border, style.row.padding);
|
26295 | rowSelection.style(rowBorderStyle).style({
|
26296 | "margin-bottom": isDashboardVisual ? "0px" : _this.isSingleRowCard ? "0px" : getPixelString(style.row.marginBottom),
|
26297 | background: style.row.background
|
26298 | }), !isDashboardVisual && _this.cardHasTitle && (rowSelection.selectAll(MultiRowCard.Title.selector).filter(function(d) {
|
26299 | return !d.showTitleAsImage && !d.showTitleAsKPI;
|
26300 | }).style({
|
26301 | "font-size": PixelConverter.fromPoint(style.title.fontSize),
|
26302 | "line-height": PixelConverter.toString(titleLabelHeight),
|
26303 | color: style.title.color
|
26304 | }), rowSelection.selectAll(MultiRowCard.Title.selector).filter(function(d) {
|
26305 | return !d.showTitleAsURL && !d.showTitleAsImage && !d.showTitleAsKPI;
|
26306 | }).text(function(d) {
|
26307 | return d.title;
|
26308 | }).attr("title", function(d) {
|
26309 | return d.title;
|
26310 | }), rowSelection.selectAll(MultiRowCard.TitleUrlSelector).text(function(d) {
|
26311 | return d.title;
|
26312 | }).attr({
|
26313 | href: function(d) {
|
26314 | return d.title;
|
26315 | },
|
26316 | target: "_blank"
|
26317 | }), rowSelection.selectAll(MultiRowCard.TitleImageSelector).attr("src", function(d) {
|
26318 | return d.title;
|
26319 | }), setImageStyle(rowSelection.selectAll(MultiRowCard.Title.selector), style.imageTitle),
|
26320 | rowSelection.selectAll(MultiRowCard.KPITitle.selector).each(function(d) {
|
26321 | var element = d3.select(this);
|
26322 | element.classed(d.title);
|
26323 | }));
|
26324 | var cardSelection = rowSelection.selectAll(MultiRowCard.Card.selector), cardBorderStyle = _this.getBorderStyles(style.card.border, style.card.padding);
|
26325 | cardSelection.style(cardBorderStyle), cardSelection.selectAll(MultiRowCard.Caption.selector).filter(function(d) {
|
26326 | return !d.showImage;
|
26327 | }).style({
|
26328 | "line-height": PixelConverter.toString(dataLabelHeight),
|
26329 | "font-size": PixelConverter.fromPoint(style.caption.fontSize)
|
26330 | }).filter(function(d) {
|
26331 | return !d.showKPI;
|
26332 | }).style({
|
26333 | color: style.caption.color
|
26334 | }).filter(function(d) {
|
26335 | return !d.showURL;
|
26336 | }).text(function(d) {
|
26337 | return d.caption;
|
26338 | }).attr("title", function(d) {
|
26339 | return d.caption;
|
26340 | }), cardSelection.selectAll(MultiRowCard.CaptionImageSelector).attr("src", function(d) {
|
26341 | return d.caption;
|
26342 | }).style(style.imageCaption);
|
26343 | var cardPaddingTop = getPixelString(style.cardItemContainer.padding.top);
|
26344 | cardSelection.selectAll(MultiRowCard.CardItemContainer.selector).style({
|
26345 | "padding-top": function(d) {
|
26346 | return _this.isInFirstRow(d.columnIndex) ? "" : cardPaddingTop;
|
26347 | },
|
26348 | "padding-right": function(d) {
|
26349 | return _this.isLastRowItem(d.columnIndex, _this.dataView.metadata.columns.length) ? "0px" : getPixelString(style.cardItemContainer.paddingRight);
|
26350 | },
|
26351 | width: function(d) {
|
26352 | return _this.getColumnWidth(d.columnIndex, _this.data.dataColumnCount);
|
26353 | }
|
26354 | }), setImageStyle(cardSelection.selectAll(MultiRowCard.Caption.selector), style.imageCaption),
|
26355 | cardSelection.selectAll(MultiRowCard.CaptionUrlSelector).attr({
|
26356 | href: function(d) {
|
26357 | return d.caption;
|
26358 | },
|
26359 | target: "_blank"
|
26360 | }).text(function(d) {
|
26361 | return d.caption;
|
26362 | }), style.details.isVisible && cardSelection.selectAll(MultiRowCard.Details.selector).text(function(d) {
|
26363 | return d.details;
|
26364 | }).style({
|
26365 | "font-size": PixelConverter.fromPoint(style.details.fontSize),
|
26366 | "line-height": PixelConverter.toString(categoryLabelHeight),
|
26367 | color: style.details.color
|
26368 | }).attr("title", function(d) {
|
26369 | return d.details;
|
26370 | });
|
26371 | }, rowExit = function(rowSelection) {
|
26372 | rowSelection.remove();
|
26373 | }, listViewOptions = {
|
26374 | rowHeight: void 0,
|
26375 | enter: rowEnter,
|
26376 | exit: rowExit,
|
26377 | update: rowUpdate,
|
26378 | loadMoreData: function() {
|
26379 | return _this.onLoadMoreData();
|
26380 | },
|
26381 | viewport: this.currentViewport,
|
26382 | baseContainer: d3.select(this.element.get(0)),
|
26383 | scrollEnabled: !this.isInteractivityOverflowHidden,
|
26384 | isReadMode: function() {
|
26385 | return 1 !== _this.options.host.getViewMode();
|
26386 | }
|
26387 | };
|
26388 | this.listView = visuals.ListViewFactory.createListView(listViewOptions);
|
26389 | }, MultiRowCard.prototype.getBorderStyles = function(border, padding) {
|
26390 | var hasBorder = {
|
26391 | top: null != border && null != border.top,
|
26392 | right: null != border && null != border.right,
|
26393 | bottom: null != border && null != border.bottom,
|
26394 | left: null != border && null != border.left
|
26395 | }, hasPadding = {
|
26396 | top: null != padding && null != padding.top,
|
26397 | right: null != padding && null != padding.right,
|
26398 | bottom: null != padding && null != padding.bottom,
|
26399 | left: null != padding && null != padding.left
|
26400 | };
|
26401 | return {
|
26402 | "border-top": hasBorder.top ? border.top.getCSS() : "",
|
26403 | "border-right": hasBorder.right ? border.right.getCSS() : "",
|
26404 | "border-bottom": hasBorder.bottom ? border.bottom.getCSS() : "",
|
26405 | "border-left": hasBorder.left ? border.left.getCSS() : "",
|
26406 | "padding-top": hasBorder.top && hasPadding.top ? getPixelString(padding.top) : "",
|
26407 | "padding-right": hasBorder.right && hasPadding.right ? getPixelString(padding.right) : "",
|
26408 | "padding-bottom": hasBorder.bottom && hasPadding.bottom ? getPixelString(padding.bottom) : "",
|
26409 | "padding-left": hasBorder.left && hasPadding.left ? getPixelString(padding.left) : ""
|
26410 | };
|
26411 | }, MultiRowCard.prototype.getMaxColPerRow = function() {
|
26412 | var rowWidth = this.currentViewport.width, minColumnWidth = this.getStyle().cardItemContainer.minWidth, columnCount = this.data.dataColumnCount, maxColumnPerRow = Math.floor(rowWidth / minColumnWidth) || 1;
|
26413 | return Math.min(columnCount, maxColumnPerRow);
|
26414 | }, MultiRowCard.prototype.getRowIndex = function(fieldIndex) {
|
26415 | return Math.floor(1 * fieldIndex / this.getMaxColPerRow());
|
26416 | }, MultiRowCard.prototype.getStyle = function() {
|
26417 | var defaultStyles = MultiRowCard.DefaultStyle, customStyles = this.getCustomStyles();
|
26418 | if (!this.isInteractivityOverflowHidden) return $.extend(!0, {}, defaultStyles, customStyles);
|
26419 | for (var viewportWidth = this.currentViewport.width, overrideStyle = {}, _i = 0, _a = MultiRowCard.tileMediaQueries; _i < _a.length; _i++) {
|
26420 | var currentQuery = _a[_i];
|
26421 | if (viewportWidth <= currentQuery.maxWidth) {
|
26422 | overrideStyle = currentQuery.style;
|
26423 | break;
|
26424 | }
|
26425 | }
|
26426 | return $.extend(!0, {}, defaultStyles, customStyles, overrideStyle);
|
26427 | }, MultiRowCard.prototype.getSurroundSettings = function(outlineSettings) {
|
26428 | var edge = new EdgeSettings(outlineSettings.weight, outlineSettings.color), outlineProp = outlineSettings.outline;
|
26429 | return {
|
26430 | top: visuals.outline.showTop(outlineProp) ? edge : null,
|
26431 | right: visuals.outline.showRight(outlineProp) ? edge : null,
|
26432 | bottom: visuals.outline.showBottom(outlineProp) ? edge : null,
|
26433 | left: visuals.outline.showLeft(outlineProp) ? edge : null
|
26434 | };
|
26435 | }, MultiRowCard.prototype.getCustomStyles = function() {
|
26436 | var dataLabelsSettings = this.data.dataLabelsSettings, categoryLabelSettings = this.data.categoryLabelsSettings, titleLabelSettings = this.data.cardTitleSettings, cardSettings = this.data.cardSettings, customStyle = {
|
26437 | row: {
|
26438 | border: this.getSurroundSettings(cardSettings.outlineSettings),
|
26439 | marginBottom: cardSettings.cardPadding,
|
26440 | background: cardSettings.cardBackground
|
26441 | },
|
26442 | card: {
|
26443 | border: this.getSurroundSettings(cardSettings.barSettings)
|
26444 | },
|
26445 | details: {
|
26446 | fontSize: categoryLabelSettings.fontSize,
|
26447 | color: categoryLabelSettings.labelColor,
|
26448 | isVisible: categoryLabelSettings.show
|
26449 | },
|
26450 | caption: {
|
26451 | fontSize: dataLabelsSettings.fontSize,
|
26452 | color: dataLabelsSettings.labelColor
|
26453 | },
|
26454 | title: {
|
26455 | fontSize: titleLabelSettings.fontSize,
|
26456 | color: titleLabelSettings.labelColor
|
26457 | }
|
26458 | };
|
26459 | return customStyle;
|
26460 | }, MultiRowCard.getTextProperties = function(isTitle, fontSizeInPt) {
|
26461 | return {
|
26462 | fontFamily: isTitle ? TitleFontFamily : DefaultFontFamily,
|
26463 | fontSize: PixelConverter.fromPoint(fontSizeInPt)
|
26464 | };
|
26465 | }, MultiRowCard.prototype.getColumnWidth = function(fieldIndex, columnCount) {
|
26466 | var maxColumnPerRow = this.getMaxColPerRow();
|
26467 | if (maxColumnPerRow >= columnCount) return 100 / columnCount + "%";
|
26468 | var rowIndex = this.getRowIndex(fieldIndex), totalRows = Math.ceil(1 * columnCount / maxColumnPerRow), lastRowCount = columnCount % maxColumnPerRow;
|
26469 | return totalRows > rowIndex || 0 === lastRowCount ? 100 / maxColumnPerRow + "%" : 100 / lastRowCount + "%";
|
26470 | }, MultiRowCard.prototype.isLastRowItem = function(fieldIndex, columnCount) {
|
26471 | if (fieldIndex + 1 === columnCount) return !0;
|
26472 | var maxColumnPerRow = this.getMaxColPerRow();
|
26473 | return maxColumnPerRow - fieldIndex % maxColumnPerRow === 1;
|
26474 | }, MultiRowCard.prototype.isInFirstRow = function(fieldIndex) {
|
26475 | return fieldIndex < this.getMaxColPerRow();
|
26476 | }, MultiRowCard.prototype.setCardDimensions = function() {
|
26477 | this.cardHasTitle = !1;
|
26478 | var dataModel = this.data.dataModel;
|
26479 | !this.isInteractivityOverflowHidden && dataModel && dataModel.length > 0 && (this.cardHasTitle = void 0 !== dataModel[0].title,
|
26480 | this.isSingleRowCard = 1 === dataModel.length);
|
26481 | }, MultiRowCard.prototype.onLoadMoreData = function() {
|
26482 | !this.waitingForData && this.dataView.metadata && this.dataView.metadata.segment && (this.options.host.loadMoreData(),
|
26483 | this.waitingForData = !0);
|
26484 | }, MultiRowCard.getDataLabelSettingsOptions = function(enumeration, labelSettings, show) {
|
26485 | return void 0 === show && (show = !1), {
|
26486 | enumeration: enumeration,
|
26487 | dataLabelsSettings: labelSettings,
|
26488 | show: show,
|
26489 | fontSize: !0
|
26490 | };
|
26491 | }, MultiRowCard.prototype.enumerateObjectInstances = function(options) {
|
26492 | var enumeration = new visuals.ObjectEnumerationBuilder(), cardTitleSettings = this.data.cardTitleSettings, dataLabelsSettings = this.data.dataLabelsSettings, categoryLabelsSettings = this.data.categoryLabelsSettings;
|
26493 | switch (options.objectName) {
|
26494 | case "cardTitle":
|
26495 | !this.isInteractivityOverflowHidden && this.cardHasTitle && visuals.dataLabelUtils.enumerateDataLabels(MultiRowCard.getDataLabelSettingsOptions(enumeration, cardTitleSettings));
|
26496 | break;
|
26497 |
|
26498 | case "dataLabels":
|
26499 | visuals.dataLabelUtils.enumerateDataLabels(MultiRowCard.getDataLabelSettingsOptions(enumeration, dataLabelsSettings));
|
26500 | break;
|
26501 |
|
26502 | case "categoryLabels":
|
26503 | visuals.dataLabelUtils.enumerateDataLabels(MultiRowCard.getDataLabelSettingsOptions(enumeration, categoryLabelsSettings, !0));
|
26504 | break;
|
26505 |
|
26506 | case visuals.multiRowCardProps.card.outline.objectName:
|
26507 | this.enumerateCard(enumeration);
|
26508 | }
|
26509 | return enumeration.complete();
|
26510 | }, MultiRowCard.prototype.enumerateCard = function(enumeration) {
|
26511 | var cardSettings = this.data.cardSettings, propNames = visuals.multiRowCardProps.card, properties = {}, outlineSettings = cardSettings.outlineSettings;
|
26512 | properties[propNames.outline.propertyName] = outlineSettings.outline, outlineSettings.outline !== visuals.outline.none && (properties[propNames.outlineColor.propertyName] = outlineSettings.color,
|
26513 | properties[propNames.outlineWeight.propertyName] = outlineSettings.weight);
|
26514 | var barSettings = cardSettings.barSettings, barShow = barSettings.outline !== visuals.outline.none;
|
26515 | properties[propNames.barShow.propertyName] = barShow, barShow && (properties[propNames.barColor.propertyName] = barSettings.color,
|
26516 | properties[propNames.barWeight.propertyName] = barSettings.weight), properties[propNames.cardPadding.propertyName] = cardSettings.cardPadding,
|
26517 | properties[propNames.cardBackground.propertyName] = cardSettings.cardBackground,
|
26518 | enumeration.pushInstance({
|
26519 | selector: null,
|
26520 | objectName: propNames.outline.objectName,
|
26521 | properties: properties
|
26522 | });
|
26523 | }, MultiRowCard.formatStringProp = {
|
26524 | objectName: "general",
|
26525 | propertyName: "formatString"
|
26526 | }, MultiRowCard.MultiRowCardRoot = createClassAndSelector("multiRowCard"), MultiRowCard.Card = createClassAndSelector("card"),
|
26527 | MultiRowCard.Title = createClassAndSelector("title"), MultiRowCard.CardItemContainer = createClassAndSelector("cardItemContainer"),
|
26528 | MultiRowCard.Caption = createClassAndSelector("caption"), MultiRowCard.Details = createClassAndSelector("details"),
|
26529 | MultiRowCard.TitleUrlSelector = MultiRowCard.Title.selector + " a", MultiRowCard.CaptionUrlSelector = MultiRowCard.Caption.selector + " a",
|
26530 | MultiRowCard.TitleImageSelector = MultiRowCard.Title.selector + " img", MultiRowCard.CaptionImageSelector = MultiRowCard.Caption.selector + " img",
|
26531 | MultiRowCard.KPITitle = createClassAndSelector("kpiTitle"), MultiRowCard.ValuesRole = "Values",
|
26532 | MultiRowCard.DefaultStyle = {
|
26533 | row: {
|
26534 | border: null,
|
26535 | marginBottom: 20,
|
26536 | background: void 0,
|
26537 | padding: {
|
26538 | top: 5,
|
26539 | right: 5,
|
26540 | bottom: 5,
|
26541 | left: 5
|
26542 | }
|
26543 | },
|
26544 | card: {
|
26545 | border: null,
|
26546 | padding: {
|
26547 | top: 10,
|
26548 | right: 10,
|
26549 | bottom: 10,
|
26550 | left: 10
|
26551 | }
|
26552 | },
|
26553 | cardItemContainer: {
|
26554 | paddingRight: 20,
|
26555 | minWidth: 120,
|
26556 | padding: {
|
26557 | top: 7
|
26558 | }
|
26559 | },
|
26560 | imageCaption: {
|
26561 | maxHeight: 75,
|
26562 | maxWidth: 100
|
26563 | },
|
26564 | imageTitle: {
|
26565 | maxHeight: 75,
|
26566 | maxWidth: 100
|
26567 | }
|
26568 | }, MultiRowCard.tileMediaQueries = [ {
|
26569 | maxWidth: 250,
|
26570 | style: {
|
26571 | cardItemContainer: {
|
26572 | minWidth: 110
|
26573 | },
|
26574 | imageCaption: {
|
26575 | maxHeight: 45
|
26576 | }
|
26577 | }
|
26578 | }, {
|
26579 | maxWidth: 490,
|
26580 | style: {
|
26581 | cardItemContainer: {
|
26582 | minWidth: 130
|
26583 | },
|
26584 | imageCaption: {
|
26585 | maxHeight: 52
|
26586 | }
|
26587 | }
|
26588 | }, {
|
26589 | maxWidth: 750,
|
26590 | style: {
|
26591 | cardItemContainer: {
|
26592 | minWidth: 120
|
26593 | },
|
26594 | imageCaption: {
|
26595 | maxHeight: 53
|
26596 | }
|
26597 | }
|
26598 | }, {
|
26599 | maxWidth: Number.MAX_VALUE,
|
26600 | style: {
|
26601 | cardItemContainer: {
|
26602 | padding: {
|
26603 | top: 5
|
26604 | }
|
26605 | }
|
26606 | }
|
26607 | } ], MultiRowCard;
|
26608 | }();
|
26609 | visuals.MultiRowCard = MultiRowCard;
|
26610 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
26611 | }(powerbi || (powerbi = {}));
|
26612 | }, function(module, exports) {
|
26613 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
26614 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
26615 | !function(powerbi) {
|
26616 | var visuals;
|
26617 | !function(visuals) {
|
26618 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, KeyUtils = jsCommon.KeyUtils, StringExtensions = jsCommon.StringExtensions, UrlUtils = jsCommon.UrlUtils, Textbox = function() {
|
26619 | function Textbox() {}
|
26620 | return Textbox.prototype.init = function(options) {
|
26621 | this.element = options.element, this.host = options.host, this.viewport = options.viewport,
|
26622 | this.readOnly = 0 === this.host.getViewMode(), this.paragraphs = [], this.refreshView();
|
26623 | }, Textbox.prototype.onResizing = function(viewport) {
|
26624 | this.viewport = viewport, this.updateSize();
|
26625 | }, Textbox.prototype.onDataChanged = function(options) {
|
26626 | var dataViews = options.dataViews;
|
26627 | if (this.paragraphs = [], dataViews && dataViews.length > 0) {
|
26628 | var objects = dataViews[0].metadata.objects;
|
26629 | objects && objects.general && (this.paragraphs = objects.general.paragraphs);
|
26630 | }
|
26631 | this.refreshView();
|
26632 | }, Textbox.prototype.destroy = function() {}, Textbox.prototype.focus = function() {
|
26633 | return this.editor ? (this.editor.focus(), !0) : void 0;
|
26634 | }, Textbox.prototype.onViewModeChanged = function(viewMode) {
|
26635 | this.readOnly = 0 === viewMode, this.refreshView();
|
26636 | }, Textbox.prototype.setSelection = function(start, end) {
|
26637 | this.editor && this.editor.setSelection(start, end);
|
26638 | }, Textbox.prototype.refreshView = function() {
|
26639 | var _this = this;
|
26640 | if (this.readOnly) {
|
26641 | this.editor && (this.saveContents(), this.editor.destroy(), this.editor = null),
|
26642 | this.element.empty();
|
26643 | var htmlContent = RichTextConversion.convertParagraphsToHtml(this.paragraphs);
|
26644 | htmlContent.addClass(Textbox.ClassName), htmlContent.css({
|
26645 | "font-family": RichText.defaultFont,
|
26646 | "font-size": RichText.defaultFontSize
|
26647 | }), this.element.append(htmlContent);
|
26648 | } else {
|
26649 | if (!this.editor) {
|
26650 | this.editor = new RichText.QuillWrapper(this.readOnly, this.host), this.editor.textChanged = function(delta, source) {
|
26651 | return _this.saveContents();
|
26652 | }, this.element.empty();
|
26653 | var editorElement = this.editor.getElement();
|
26654 | editorElement.addClass(Textbox.ClassName), editorElement.css({
|
26655 | "font-family": RichText.defaultFont,
|
26656 | "font-size": RichText.defaultFontSize
|
26657 | }), this.element.append(editorElement);
|
26658 | }
|
26659 | this.editor.setContents(RichTextConversion.convertParagraphsToOps(this.paragraphs));
|
26660 | }
|
26661 | this.updateSize();
|
26662 | }, Textbox.prototype.saveContents = function() {
|
26663 | if (this.editor) {
|
26664 | var contents = this.editor.getContents();
|
26665 | this.paragraphs = RichTextConversion.convertDeltaToParagraphs(contents);
|
26666 | var changes = [ {
|
26667 | objectName: "general",
|
26668 | properties: {
|
26669 | paragraphs: this.paragraphs
|
26670 | },
|
26671 | selector: null
|
26672 | } ];
|
26673 | this.host.persistProperties(changes);
|
26674 | }
|
26675 | }, Textbox.prototype.updateSize = function() {
|
26676 | this.editor && this.editor.resize(this.viewport);
|
26677 | }, Textbox.ClassName = "textbox", Textbox;
|
26678 | }();
|
26679 | visuals.Textbox = Textbox;
|
26680 | var RichTextConversion;
|
26681 | !function(RichTextConversion) {
|
26682 | function convertDeltaToParagraphs(contents) {
|
26683 | for (var paragraphs = [], paragraph = {
|
26684 | textRuns: []
|
26685 | }, i = 0, len = contents.ops.length; len > i; i++) {
|
26686 | var insertOp = contents.ops[i];
|
26687 | if ("string" == typeof insertOp.insert) {
|
26688 | var text = insertOp.insert, attributes = insertOp.attributes;
|
26689 | attributes && attributes.align && (paragraph.horizontalTextAlignment = attributes.align);
|
26690 | var start = 0, end = 0, newParagraph = void 0;
|
26691 | do {
|
26692 | if (end = text.indexOf("\n", start), 0 > end ? (newParagraph = !1, end = text.length) : newParagraph = !0,
|
26693 | end - start > 0) {
|
26694 | var span = text.substring(start, end), textRun = {
|
26695 | value: span
|
26696 | };
|
26697 | if (attributes) {
|
26698 | void 0 !== attributes.link && UrlUtils.isValidUrl(attributes.link) && (textRun.url = attributes.link);
|
26699 | var textStyle = convertFormatAttributesToTextStyle(attributes);
|
26700 | textStyle && (textRun.textStyle = textStyle);
|
26701 | }
|
26702 | paragraph.textRuns.push(textRun);
|
26703 | }
|
26704 | newParagraph && (0 === paragraph.textRuns.length && paragraph.textRuns.push({
|
26705 | value: ""
|
26706 | }), paragraphs.push(paragraph), paragraph = {
|
26707 | textRuns: []
|
26708 | }), start = end + 1;
|
26709 | } while (start < text.length);
|
26710 | }
|
26711 | }
|
26712 | return paragraph.textRuns.length > 0 && paragraph.textRuns[0].value.length > 0 && paragraphs.push(paragraph),
|
26713 | paragraphs;
|
26714 | }
|
26715 | function convertParagraphsToHtml(paragraphs) {
|
26716 | for (var $paragraphs = $(), paragraphIndex = 0, len = paragraphs.length; len > paragraphIndex; ++paragraphIndex) {
|
26717 | var paragraphDef = paragraphs[paragraphIndex], isParagraphEmpty = !0, $paragraph = $("<div>");
|
26718 | paragraphDef.horizontalTextAlignment && $paragraph.css("text-align", paragraphDef.horizontalTextAlignment);
|
26719 | for (var textRunIndex = 0, jlen = paragraphDef.textRuns.length; jlen > textRunIndex; ++textRunIndex) {
|
26720 | var textRunDef = paragraphDef.textRuns[textRunIndex], $textRun = $("<span>"), styleDef = textRunDef.textStyle;
|
26721 | if (styleDef) {
|
26722 | var css = {};
|
26723 | styleDef.fontFamily && (css["font-family"] = RichText.getCssFontFamily(removeQuotes(styleDef.fontFamily))),
|
26724 | styleDef.fontSize && (css["font-size"] = styleDef.fontSize), styleDef.fontStyle && (css["font-style"] = styleDef.fontStyle),
|
26725 | styleDef.fontWeight && (css["font-weight"] = styleDef.fontWeight), styleDef.textDecoration && (css["text-decoration"] = styleDef.textDecoration),
|
26726 | $textRun.css(css);
|
26727 | }
|
26728 | var text = textRunDef.value;
|
26729 | if (_.isEmpty(text) || (isParagraphEmpty = !1), void 0 !== textRunDef.url) {
|
26730 | var $link = void 0;
|
26731 | $link = UrlUtils.isValidUrl(textRunDef.url) ? $("<a>").attr("href", textRunDef.url).attr("target", "_blank").text(text) : $("<span>").text(text),
|
26732 | $textRun.append($link);
|
26733 | } else $textRun.text(text);
|
26734 | $paragraph.append($textRun);
|
26735 | }
|
26736 | isParagraphEmpty && $paragraph.append($("<br>")), $paragraphs = $paragraphs.add($paragraph);
|
26737 | }
|
26738 | return $paragraphs;
|
26739 | }
|
26740 | function convertParagraphsToOps(paragraphs) {
|
26741 | for (var ops = [], paragraphIndex = 0, len = paragraphs.length; len > paragraphIndex; ++paragraphIndex) for (var paragraphDef = paragraphs[paragraphIndex], textRunIndex = 0, jlen = paragraphDef.textRuns.length; jlen > textRunIndex; ++textRunIndex) {
|
26742 | var textRunDef = paragraphDef.textRuns[textRunIndex], formats = {};
|
26743 | paragraphDef.horizontalTextAlignment && (formats.align = paragraphDef.horizontalTextAlignment);
|
26744 | var styleDef = textRunDef.textStyle;
|
26745 | styleDef && (styleDef.fontFamily && (formats.font = RichText.getCssFontFamily(removeQuotes(styleDef.fontFamily))),
|
26746 | styleDef.fontSize && (formats.size = styleDef.fontSize), formats.italic = "italic" === styleDef.fontStyle,
|
26747 | formats.bold = "bold" === styleDef.fontWeight, formats.underline = "underline" === styleDef.textDecoration);
|
26748 | var text = textRunDef.value;
|
26749 | textRunDef.url && UrlUtils.isValidUrl(textRunDef.url) && (formats.link = textRunDef.url);
|
26750 | var op = {
|
26751 | insert: text,
|
26752 | attributes: formats
|
26753 | };
|
26754 | ops.push(op), textRunIndex !== jlen - 1 || StringExtensions.endsWith(text, "\n") || ops.push({
|
26755 | insert: "\n",
|
26756 | attributes: formats
|
26757 | });
|
26758 | }
|
26759 | return ops;
|
26760 | }
|
26761 | function convertFormatAttributesToTextStyle(attributes) {
|
26762 | var style = {};
|
26763 | if (attributes.bold && (style.fontWeight = "bold"), attributes.font) {
|
26764 | var font = removeQuotes(attributes.font);
|
26765 | font = RichText.getFontFamilyForBuiltInFont(font), style.fontFamily = font;
|
26766 | }
|
26767 | return attributes.italic && (style.fontStyle = "italic"), attributes.size && (style.fontSize = attributes.size),
|
26768 | attributes.underline && (style.textDecoration = "underline"), style;
|
26769 | }
|
26770 | function removeQuotes(text) {
|
26771 | return !StringExtensions.startsWith(text, "'") || StringExtensions.containsIgnoreCase(text, ",") ? text : text.slice(1, text.length - 1);
|
26772 | }
|
26773 | RichTextConversion.convertDeltaToParagraphs = convertDeltaToParagraphs, RichTextConversion.convertParagraphsToHtml = convertParagraphsToHtml,
|
26774 | RichTextConversion.convertParagraphsToOps = convertParagraphsToOps;
|
26775 | }(RichTextConversion || (RichTextConversion = {}));
|
26776 | var RichText;
|
26777 | !function(RichText) {
|
26778 | function getCssFontFamily(font) {
|
26779 | var family = fontMap[font];
|
26780 | return null == family && (family = font), family;
|
26781 | }
|
26782 | function getFontFamilyForBuiltInFont(font) {
|
26783 | var fontFamily = _.findKey(fontMap, function(value) {
|
26784 | return value === font || value.indexOf(font) > 0;
|
26785 | });
|
26786 | return fontFamily || font;
|
26787 | }
|
26788 | var fontMap = {
|
26789 | "Segoe (Bold)": visuals.Font.Family.bold.css,
|
26790 | "Segoe UI": visuals.Font.Family.regular.css,
|
26791 | "Segoe UI Light": visuals.Font.Family.light.css,
|
26792 | Heading: visuals.Font.Family.light.css,
|
26793 | Body: visuals.Font.Family.regular.css
|
26794 | }, fonts = [ "Arial", "Arial Black", "Arial Unicode MS", "Calibri", "Cambria", "Cambria Math", "Candara", "Comic Sans MS", "Consolas", "Constantia", "Corbel", "Courier New", "Georgia", "Lucida Sans Unicode", "Segoe (Bold)", "Segoe UI", "Segoe UI Light", "Symbol", "Tahoma", "Times New Roman", "Trebuchet MS", "Verdana", "Wingdings" ].map(function(font) {
|
26795 | return {
|
26796 | label: font,
|
26797 | value: getCssFontFamily(font)
|
26798 | };
|
26799 | });
|
26800 | RichText.defaultFont = getCssFontFamily("Segoe UI Light");
|
26801 | var fontSizes = [ "8", "9", "10", "10.5", "11", "12", "14", "16", "18", "20", "24", "28", "32", "36", "40", "42", "44", "54", "60", "66", "72", "80", "88", "96" ].map(function(size) {
|
26802 | return {
|
26803 | label: size,
|
26804 | value: size + "px"
|
26805 | };
|
26806 | });
|
26807 | RichText.defaultFontSize = "14px";
|
26808 | var textAlignments = [ "Left", "Center", "Right" ].map(function(alignment) {
|
26809 | return {
|
26810 | label: alignment,
|
26811 | value: alignment.toLowerCase()
|
26812 | };
|
26813 | });
|
26814 | RichText.getCssFontFamily = getCssFontFamily, RichText.getFontFamilyForBuiltInFont = getFontFamilyForBuiltInFont;
|
26815 | var QuillWrapper = function() {
|
26816 | function QuillWrapper(readOnly, host) {
|
26817 | var _this = this;
|
26818 | this.QuillPackage = {
|
26819 | javaScriptFiles: QuillWrapper.quillJsFiles,
|
26820 | cssFiles: QuillWrapper.quillCssFiles
|
26821 | }, this.textChanged = function(d, s) {}, this.host = host, this.$container = $("<div>"),
|
26822 | this.readOnly = readOnly, this.localizationProvider = {
|
26823 | get: function(stringId) {
|
26824 | return _this.host.getLocalizedString(stringId);
|
26825 | },
|
26826 | getOptional: function(stringId) {
|
26827 | return _this.host.getLocalizedString(stringId);
|
26828 | }
|
26829 | }, this.dependenciesLoaded = $.Deferred(), QuillWrapper.loadQuillResources ? (this.initialized = !1,
|
26830 | this.dependenciesLoaded.done(function() {
|
26831 | _this.rebuildQuillEditor(), _this.initialized = !0;
|
26832 | }), jsCommon.requires(this.QuillPackage, function() {
|
26833 | return _this.dependenciesLoaded.resolve();
|
26834 | })) : (this.rebuildQuillEditor(), this.initialized = !0, this.dependenciesLoaded.resolve());
|
26835 | }
|
26836 | return QuillWrapper.prototype.addModule = function(name, options) {
|
26837 | return this.editor ? this.editor.addModule(name, options) : void 0;
|
26838 | }, QuillWrapper.prototype.getElement = function() {
|
26839 | return this.$container;
|
26840 | }, QuillWrapper.prototype.getContents = function() {
|
26841 | return this.initialized ? this.editor.getContents() : void 0;
|
26842 | }, QuillWrapper.prototype.setContents = function(contents) {
|
26843 | var _this = this;
|
26844 | return this.initialized ? (this.editor.setHTML("", "api"), void (contents && this.editor.setContents(contents, "api"))) : void this.dependenciesLoaded.done(function() {
|
26845 | return _this.setContents(contents);
|
26846 | });
|
26847 | }, QuillWrapper.prototype.resize = function(viewport) {
|
26848 | this.$container.width(viewport.width), this.$container.height(viewport.height);
|
26849 | }, QuillWrapper.prototype.setReadOnly = function(readOnly) {
|
26850 | var readOnlyChanged = readOnly !== this.readOnly;
|
26851 | this.readOnly = readOnly, this.initialized && readOnlyChanged && this.rebuildQuillEditor();
|
26852 | }, QuillWrapper.prototype.setSelection = function(start, end) {
|
26853 | this.editor && this.editor.setSelection(start, end, "api");
|
26854 | }, QuillWrapper.prototype.getSelection = function() {
|
26855 | return this.editor ? this.editor.getSelection() : void 0;
|
26856 | }, QuillWrapper.prototype.focus = function() {
|
26857 | this.editor && 0 === $(document.activeElement).closest(this.$container).length && this.editor.focus();
|
26858 | }, QuillWrapper.prototype.destroy = function() {
|
26859 | this.host.setToolbar(null), this.$container.remove(), this.$container = null, this.$toolbarDiv = null,
|
26860 | this.$editorDiv = null, this.editor = null;
|
26861 | }, QuillWrapper.prototype.getSelectionAtCursor = function() {
|
26862 | var text = this.getTextWithoutTrailingBreak();
|
26863 | this.editor.focus();
|
26864 | var selection = this.getSelection();
|
26865 | return selection && selection.start === selection.end ? jsCommon.WordBreaker.find(selection.start, text) : selection;
|
26866 | }, QuillWrapper.prototype.getWord = function() {
|
26867 | var selection = this.getSelectionAtCursor();
|
26868 | return this.getTextWithoutTrailingBreak().slice(selection.start, selection.end);
|
26869 | }, QuillWrapper.prototype.insertLinkAtCursor = function(link, index) {
|
26870 | var endIndex = index + link.length;
|
26871 | return this.editor.insertText(index, link, "api"), this.editor.formatText(index, endIndex, "link", link, "api"),
|
26872 | this.setSelection(index, endIndex), this.onTextChanged(null, null), endIndex;
|
26873 | }, QuillWrapper.prototype.getEditorContainer = function() {
|
26874 | return this.editor ? $(this.editor.container) : void 0;
|
26875 | }, QuillWrapper.prototype.getTextWithoutTrailingBreak = function() {
|
26876 | return this.editor.getText().slice(0, -1);
|
26877 | }, QuillWrapper.prototype.rebuildQuillEditor = function() {
|
26878 | var _this = this, contents = null;
|
26879 | this.editor && (this.editor.removeAllListeners(), contents = this.editor.getContents()),
|
26880 | this.$container.empty(), this.$container.keydown(function(e) {
|
26881 | var which = e.which;
|
26882 | e.ctrlKey && KeyUtils.isCtrlDefaultKey(which) && e.stopPropagation(), (KeyUtils.isArrowKey(which) || KeyUtils.isNudgeModifierKey(which)) && e.stopPropagation();
|
26883 | });
|
26884 | var $editorDiv = this.$editorDiv = $("<div>");
|
26885 | $editorDiv.css("font-family", RichText.defaultFont), $editorDiv.css("font-size", RichText.defaultFontSize);
|
26886 | var configs = {
|
26887 | readOnly: this.readOnly,
|
26888 | formats: [ "bold", "italic", "underline", "font", "size", "link", "align" ],
|
26889 | styles: !1
|
26890 | };
|
26891 | if (this.editor = new Quill($editorDiv.get(0), configs), !this.readOnly) {
|
26892 | var $toolbarDiv = this.$toolbarDiv;
|
26893 | $toolbarDiv || (this.$toolbarDiv = $toolbarDiv = Toolbar.buildToolbar(this, this.localizationProvider)),
|
26894 | $toolbarDiv.addClass("unselectable"), this.host.setToolbar($toolbarDiv), this.editor.addModule("toolbar", {
|
26895 | container: $toolbarDiv.get(0)
|
26896 | }), $editorDiv.attr("drag-resize-disabled", "true");
|
26897 | }
|
26898 | this.$container.append($editorDiv), contents && this.setContents(contents);
|
26899 | var textChangeThrottler = new jsCommon.ThrottleUtility(QuillWrapper.textChangeThrottle);
|
26900 | this.editor.on("text-change", function(delta, source) {
|
26901 | "api" !== source && textChangeThrottler.run(function() {
|
26902 | return _this.onTextChanged(delta, source);
|
26903 | });
|
26904 | }), this.editor.root.addEventListener("blur", function(event) {
|
26905 | var target = event.relatedTarget || document.activeElement;
|
26906 | target && "SELECT" === target.tagName || "INPUT" === target.tagName || target.getAttribute("contentEditable") || _this.setSelection(null, null);
|
26907 | }, !1);
|
26908 | }, QuillWrapper.prototype.onTextChanged = function(delta, source) {
|
26909 | this.textChanged(delta, source);
|
26910 | }, QuillWrapper.textChangeThrottle = 200, QuillWrapper.loadQuillResources = !0,
|
26911 | QuillWrapper.quillJsFiles = [ powerbi.build + "/externals/quill.min.js" ], QuillWrapper.quillCssFiles = [ powerbi.build + "/externals/quill.base.css" ],
|
26912 | QuillWrapper;
|
26913 | }();
|
26914 | RichText.QuillWrapper = QuillWrapper;
|
26915 | var Toolbar;
|
26916 | !function(Toolbar) {
|
26917 | function buildToolbar(quillWrapper, localizationProvider) {
|
26918 | var linkTooltipTemplate = buildToolbarLinkInputTemplate(localizationProvider);
|
26919 | quillWrapper.addModule("link-tooltip", {
|
26920 | template: linkTooltipTemplate
|
26921 | });
|
26922 | var toolbarLinkInput = buildToolbarLinkInput(quillWrapper, getTooltip("Link", localizationProvider), localizationProvider.get("RichTextbox_Link_DefaultText")), fontPicker = picker(getTooltip("Font", localizationProvider), fonts, "font", RichText.defaultFont, function($option, option) {
|
26923 | return $option.css("font-family", option.value), $option;
|
26924 | }), $container = div().addClass("toolbar ql-toolbar").append(formatGroup().append(label(localizationProvider.get("RichTextbox_Font_Label"))).append(fontPicker).append(picker(getTooltip("Size", localizationProvider), fontSizes, "size", RichText.defaultFontSize))).append(formatGroup().append(formatButton(getTooltip("Bold", localizationProvider), "bold")).append(formatButton(getTooltip("Italic", localizationProvider), "italic")).append(formatButton(getTooltip("Underline", localizationProvider), "underline"))).append(formatGroup().append(toggleGroup("Text Alignment", textAlignments, "align", "Left", localizationProvider))).append(toolbarLinkInput);
|
26925 | return $container.on("mousedown", function(event) {
|
26926 | var target = event.target || document.activeElement;
|
26927 | "INPUT" !== target.tagName && "SELECT" !== target.tagName && event.preventDefault();
|
26928 | }), $container;
|
26929 | }
|
26930 | function setSelectValue($select, value) {
|
26931 | $select.val(value);
|
26932 | var evt = document.createEvent("UIEvent");
|
26933 | evt.initUIEvent("change", !1, !1, null, 0), $select.get(0).dispatchEvent(evt);
|
26934 | }
|
26935 | function linkTooltipTemplateGenerator(removeText, doneText) {
|
26936 | return $('\n <a href="#" class="url" target="_blank"></a>\n <input class="input" type="text">\n <span class="bar"> | </span>\n <a class="change"></a>\n <a class="remove">' + removeText + '</a>\n <a class="done">' + doneText + "</a>\n ");
|
26937 | }
|
26938 | function buildToolbarLinkInputTemplate(localizationProvider) {
|
26939 | var template = div(), doneText = localizationProvider.get("RichTextbox_Link_Done"), removeText = localizationProvider.get("RichTextbox_Link_Remove");
|
26940 | return template.append(linkTooltipTemplateGenerator(removeText, doneText)), template.html();
|
26941 | }
|
26942 | function formatGroup() {
|
26943 | return span().addClass("ql-format-group").attr("drag-resize-disabled", "true");
|
26944 | }
|
26945 | function label(text) {
|
26946 | return $("<label>").text(text);
|
26947 | }
|
26948 | function div() {
|
26949 | return $("<div>");
|
26950 | }
|
26951 | function span() {
|
26952 | return $("<span>");
|
26953 | }
|
26954 | function toggleGroup(title, list, format, defaultValue, localizationProvider) {
|
26955 | var tooltip = getTooltip(title, localizationProvider), $group = span().attr("title", tooltip).addClass("ql-toggle-group"), $select = selector(tooltip, list, defaultValue).addClass("ql-picker ql-" + format).css("display", "none"), $buttons = list.map(function(option) {
|
26956 | var $button = formatButton(getTooltip(option.label, localizationProvider), "align" + option.value).attr("data-value", option.value).click(function(e) {
|
26957 | return setSelectValue($select, option.value);
|
26958 | });
|
26959 | return $button;
|
26960 | });
|
26961 | return $select.change(function(e) {
|
26962 | for (var newValue = $select.val(), i = 0; i < $buttons.length; i++) $buttons[i].toggleClass("ql-active", $buttons[i].attr("data-value") === newValue);
|
26963 | }), $group.append($select), $group.append($buttons), $group;
|
26964 | }
|
26965 | function picker(tooltip, list, format, defaultValue, optionModifier) {
|
26966 | var $selector = selector(tooltip, list, defaultValue, optionModifier).addClass("ql-picker ql-" + format);
|
26967 | return $selector;
|
26968 | }
|
26969 | function selector(tooltip, list, defaultValue, optionModifier) {
|
26970 | for (var $selector = $("<select>").attr("title", tooltip), i = 0; i < list.length; i++) {
|
26971 | var option = list[i], $option = $("<option>").attr("value", option.value).text(option.label);
|
26972 | option.value === defaultValue && $option.attr("selected", "selected"), void 0 !== optionModifier && ($option = optionModifier($option, option)),
|
26973 | $selector.append($option);
|
26974 | }
|
26975 | return $selector;
|
26976 | }
|
26977 | function formatButton(tooltip, format) {
|
26978 | var $button = span().addClass("ql-format-button");
|
26979 | return null != tooltip && $button.attr("title", tooltip), null != format && ($button.addClass("ql-" + format),
|
26980 | $button.addClass("powervisuals-glyph " + format)), $button;
|
26981 | }
|
26982 | function getTooltip(name, localizationProvider) {
|
26983 | return localizationProvider.get("RichTextbox_" + name + "_ToolTip");
|
26984 | }
|
26985 | function clearLinkInput(linkTooltip) {
|
26986 | linkTooltip.removeClass("editing"), linkTooltip.removeClass("blank-editing"), linkTooltip.find(".input").val(DefaultLinkInputValue);
|
26987 | }
|
26988 | function buildToolbarLinkInput(quillWrapper, buttonTooltip, defaultLinkText) {
|
26989 | var linkTooltip = quillWrapper.getEditorContainer().find(Toolbar.selectors.linkTooltip.selector), toolbarLinkInput = formatGroup().addClass(Toolbar.selectors.toolbarUrlInput["class"]).append(formatButton(buttonTooltip, "link").append("<div>")).append(linkTooltip);
|
26990 | return toolbarLinkInput.on("keydown mousedown", function(event) {
|
26991 | if (event.keyCode === jsCommon.DOMConstants.enterKeyCode || event.target.classList.contains("done")) {
|
26992 | if (!linkTooltip.hasClass("blank-editing")) return !0;
|
26993 | var link = toolbarLinkInput.find(".input").val(), selection = quillWrapper.getSelectionAtCursor(), word = quillWrapper.getWord();
|
26994 | if (!word) {
|
26995 | var endCursor = quillWrapper.insertLinkAtCursor(link, selection.start);
|
26996 | return clearLinkInput(linkTooltip), quillWrapper.setSelection(endCursor, endCursor),
|
26997 | !1;
|
26998 | }
|
26999 | }
|
27000 | }), toolbarLinkInput.find(".input").blur(function(event) {
|
27001 | var blurTarget = event.relatedTarget;
|
27002 | (null === blurTarget || blurTarget && !blurTarget.classList.contains("done")) && clearLinkInput(linkTooltip);
|
27003 | }), toolbarLinkInput.find(".ql-link div").click(function(event) {
|
27004 | var target = event.target.parentElement;
|
27005 | if (target && target.classList.contains("ql-active")) return toolbarLinkInput.find(".change")[0].click(),
|
27006 | !1;
|
27007 | var word = quillWrapper.getWord();
|
27008 | if (!word) {
|
27009 | linkTooltip.addClass("editing blank-editing");
|
27010 | var inputElem = toolbarLinkInput.find(".input").get(0);
|
27011 | return inputElem.value = DefaultLinkInputValue, inputElem.selectionStart = inputElem.selectionEnd = DefaultLinkInputValue.length,
|
27012 | inputElem.focus(), !1;
|
27013 | }
|
27014 | }).mousedown(function(event) {
|
27015 | var linkButton = event.target.parentElement;
|
27016 | if (linkButton && !linkButton.classList.contains("ql-active")) {
|
27017 | var selection = quillWrapper.getSelectionAtCursor();
|
27018 | quillWrapper.setSelection(selection.start, selection.end);
|
27019 | }
|
27020 | }), toolbarLinkInput;
|
27021 | }
|
27022 | var DefaultLinkInputValue = "http://";
|
27023 | Toolbar.selectors = {
|
27024 | linkTooltip: createClassAndSelector("ql-link-tooltip"),
|
27025 | toolbarUrlInput: createClassAndSelector("toolbar-url-input")
|
27026 | }, Toolbar.buildToolbar = buildToolbar, Toolbar.setSelectValue = setSelectValue;
|
27027 | }(Toolbar || (Toolbar = {}));
|
27028 | }(RichText = visuals.RichText || (visuals.RichText = {}));
|
27029 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
27030 | }(powerbi || (powerbi = {}));
|
27031 | }, function(module, exports) {
|
27032 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
27033 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
27034 | !function(powerbi) {
|
27035 | var visuals;
|
27036 | !function(visuals) {
|
27037 | var SelectionManager = visuals.utility.SelectionManager;
|
27038 | visuals.cheerMeterProps = {
|
27039 | dataPoint: {
|
27040 | defaultColor: {
|
27041 | objectName: "dataPoint",
|
27042 | propertyName: "defaultColor"
|
27043 | },
|
27044 | fill: {
|
27045 | objectName: "dataPoint",
|
27046 | propertyName: "fill"
|
27047 | }
|
27048 | }
|
27049 | };
|
27050 | var CheerMeter = function() {
|
27051 | function CheerMeter() {
|
27052 | this.isFirstTime = !0;
|
27053 | }
|
27054 | return CheerMeter.converter = function(dataView) {
|
27055 | if (!dataView.categorical || !dataView.categorical.categories) return null;
|
27056 | var cat = dataView.categorical.categories[0];
|
27057 | if (!cat) return null;
|
27058 | var catValues = cat.values;
|
27059 | if (!catValues || _.isEmpty(dataView.categorical.values)) return null;
|
27060 | var values = dataView.categorical.values[0].values, objects = dataView.categorical.categories[0].objects, object1 = objects && objects.length > 0 ? objects[0] : void 0, object2 = objects && objects.length > 1 ? objects[1] : void 0, metadataObjects = dataView.metadata.objects, backgroundColor = CheerMeter.DefaultBackgroundColor;
|
27061 | if (metadataObjects) {
|
27062 | var general = metadataObjects.general;
|
27063 | if (general) {
|
27064 | var fill = general.fill;
|
27065 | fill && (backgroundColor = fill.solid.color);
|
27066 | }
|
27067 | }
|
27068 | var color1 = powerbi.DataViewObjects.getFillColor(object1, visuals.cheerMeterProps.dataPoint.fill, CheerMeter.DefaultFontColor), color2 = powerbi.DataViewObjects.getFillColor(object2, visuals.cheerMeterProps.dataPoint.fill, CheerMeter.DefaultFontColor), idn1 = visuals.SelectionIdBuilder.builder().withCategory(cat, 0).createSelectionId(), idn2 = visuals.SelectionIdBuilder.builder().withCategory(cat, 1).createSelectionId(), data = {
|
27069 | teamA: {
|
27070 | name: catValues[0],
|
27071 | value: values[0],
|
27072 | color: color1,
|
27073 | identity: idn1
|
27074 | },
|
27075 | teamB: {
|
27076 | name: catValues[1],
|
27077 | value: values[1],
|
27078 | color: color2,
|
27079 | identity: idn2
|
27080 | },
|
27081 | background: backgroundColor
|
27082 | };
|
27083 | return data;
|
27084 | }, CheerMeter.prototype.init = function(options) {
|
27085 | this.selectionManager = new SelectionManager({
|
27086 | hostServices: options.host
|
27087 | });
|
27088 | var svg = this.svg = d3.select(options.element.get(0)).append("svg");
|
27089 | this.textOne = svg.append("text").style("font-family", CheerMeter.DefaultFontFamily),
|
27090 | this.textTwo = svg.append("text").style("font-family", CheerMeter.DefaultFontFamily);
|
27091 | }, CheerMeter.prototype.update = function(options) {
|
27092 | if (options.dataViews[0]) {
|
27093 | var data = this.data = CheerMeter.converter(options.dataViews[0]);
|
27094 | if (data) {
|
27095 | var duration = options.suppressAnimations ? 0 : visuals.AnimatorCommon.MinervaAnimationDuration;
|
27096 | this.draw(data, duration, options.viewport);
|
27097 | }
|
27098 | }
|
27099 | }, CheerMeter.prototype.getRecomendedFontProperties = function(text1, text2, parentViewport) {
|
27100 | for (var i, textProperties = {
|
27101 | fontSize: "",
|
27102 | fontFamily: CheerMeter.DefaultFontFamily,
|
27103 | text: text1 + text2
|
27104 | }, min = 1, max = 1e3, maxWidth = parentViewport.width, width = 0; max >= min; ) if (i = (min + max) / 2 | 0,
|
27105 | textProperties.fontSize = i + "px", width = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties),
|
27106 | maxWidth > width) min = i + 1; else {
|
27107 | if (!(width > maxWidth)) break;
|
27108 | max = i - 1;
|
27109 | }
|
27110 | return textProperties.fontSize = i + "px", width = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties),
|
27111 | width > maxWidth && (i--, textProperties.fontSize = i + "px"), textProperties;
|
27112 | }, CheerMeter.prototype.calculateLayout = function(data, viewport) {
|
27113 | var text1 = data.teamA.name, text2 = data.teamB.name, avaliableViewport = {
|
27114 | height: viewport.height,
|
27115 | width: viewport.width - CheerMeter.PaddingBetweenText
|
27116 | }, recomendedFontProperties = this.getRecomendedFontProperties(text1, text2, avaliableViewport);
|
27117 | recomendedFontProperties.text = text1;
|
27118 | var width1 = 0 | powerbi.TextMeasurementService.measureSvgTextWidth(recomendedFontProperties);
|
27119 | recomendedFontProperties.text = text2;
|
27120 | var width2 = 0 | powerbi.TextMeasurementService.measureSvgTextWidth(recomendedFontProperties), padding = (viewport.width - width1 - width2 - CheerMeter.PaddingBetweenText) / 2 | 0;
|
27121 | recomendedFontProperties.text = text1 + text2;
|
27122 | var offsetHeight = 0 | powerbi.TextMeasurementService.measureSvgTextHeight(recomendedFontProperties), max = data.teamA.value + data.teamB.value, availableHeight = viewport.height - offsetHeight, y1 = (max - data.teamA.value) / max * availableHeight + offsetHeight / 2 | 0, y2 = (max - data.teamB.value) / max * availableHeight + offsetHeight / 2 | 0;
|
27123 | return {
|
27124 | x1: padding,
|
27125 | x2: padding + width1 + CheerMeter.PaddingBetweenText,
|
27126 | y1: y1,
|
27127 | y2: y2,
|
27128 | fontSize: recomendedFontProperties.fontSize
|
27129 | };
|
27130 | }, CheerMeter.prototype.ensureStartState = function(layout, viewport) {
|
27131 | if (this.isFirstTime) {
|
27132 | this.isFirstTime = !1;
|
27133 | var startY = viewport.height / 2;
|
27134 | this.textOne.attr({
|
27135 | x: layout.x1,
|
27136 | y: startY
|
27137 | }), this.textTwo.attr({
|
27138 | x: layout.x2,
|
27139 | y: startY
|
27140 | });
|
27141 | }
|
27142 | }, CheerMeter.prototype.clearSelection = function() {
|
27143 | var _this = this;
|
27144 | this.selectionManager.clear().then(function() {
|
27145 | _this.clearSelectionUI();
|
27146 | });
|
27147 | }, CheerMeter.prototype.clearSelectionUI = function() {
|
27148 | this.textOne.style("stroke", "#FFF").style("stroke-width", 0), this.textTwo.style("stroke", "#FFF").style("stroke-width", 0);
|
27149 | }, CheerMeter.prototype.updateSelectionUI = function(ids) {
|
27150 | this.textOne.style("stroke", "#FFF").style("stroke-width", SelectionManager.containsSelection(ids, this.data.teamA.identity) ? "2px" : "0px"),
|
27151 | this.textTwo.style("stroke", "#FFF").style("stroke-width", SelectionManager.containsSelection(ids, this.data.teamB.identity) ? "2px" : "0px");
|
27152 | }, CheerMeter.prototype.draw = function(data, duration, viewport) {
|
27153 | var _this = this, easeName = "back", textOne = this.textOne, textTwo = this.textTwo;
|
27154 | this.svg.attr({
|
27155 | height: viewport.height,
|
27156 | width: viewport.width
|
27157 | }).on("click", function() {
|
27158 | _this.clearSelection();
|
27159 | }).style("background-color", data.background);
|
27160 | var layout = this.calculateLayout(data, viewport);
|
27161 | this.ensureStartState(layout, viewport), textOne.style("font-size", layout.fontSize).style("fill", data.teamA.color).on("click", function() {
|
27162 | _this.selectionManager.select(data.teamA.identity, d3.event.ctrlKey).then(function(ids) {
|
27163 | _this.updateSelectionUI(ids);
|
27164 | }), d3.event.stopPropagation();
|
27165 | }).text(data.teamA.name), textTwo.style("font-size", layout.fontSize).style("fill", data.teamB.color).on("click", function() {
|
27166 | _this.selectionManager.select(data.teamB.identity, d3.event.ctrlKey).then(function(ids) {
|
27167 | _this.updateSelectionUI(ids);
|
27168 | }), d3.event.stopPropagation();
|
27169 | }).text(data.teamB.name), textOne.transition().duration(duration).ease(easeName).attr({
|
27170 | y: layout.y1,
|
27171 | x: layout.x1
|
27172 | }), textTwo.transition().duration(duration).ease(easeName).attr({
|
27173 | y: layout.y2,
|
27174 | x: layout.x2
|
27175 | });
|
27176 | }, CheerMeter.prototype.destroy = function() {
|
27177 | this.svg = null, this.textOne = this.textTwo = null;
|
27178 | }, CheerMeter.prototype.enumerateObjectInstances = function(options) {
|
27179 | var instances = [], data = this.data;
|
27180 | switch (options.objectName) {
|
27181 | case "dataPoint":
|
27182 | if (data) for (var teams = [ data.teamA, data.teamB ], i = 0; i < teams.length; i++) {
|
27183 | var slice = teams[i], color = slice.color, selector = slice.identity, dataPointInstance = {
|
27184 | objectName: "dataPoint",
|
27185 | displayName: slice.name,
|
27186 | selector: selector,
|
27187 | properties: {
|
27188 | fill: {
|
27189 | solid: {
|
27190 | color: color
|
27191 | }
|
27192 | }
|
27193 | }
|
27194 | };
|
27195 | instances.push(dataPointInstance);
|
27196 | }
|
27197 | break;
|
27198 |
|
27199 | case "general":
|
27200 | var general = {
|
27201 | objectName: "general",
|
27202 | displayName: "General",
|
27203 | selector: null,
|
27204 | properties: {
|
27205 | fill: {
|
27206 | solid: {
|
27207 | color: data ? data.background : CheerMeter.DefaultBackgroundColor
|
27208 | }
|
27209 | }
|
27210 | }
|
27211 | };
|
27212 | instances.push(general);
|
27213 | }
|
27214 | return instances;
|
27215 | }, CheerMeter.capabilities = {
|
27216 | dataRoles: [ {
|
27217 | displayName: "Category",
|
27218 | name: "Category",
|
27219 | kind: powerbi.VisualDataRoleKind.Grouping
|
27220 | }, {
|
27221 | displayName: "Noise Measure",
|
27222 | name: "Y",
|
27223 | kind: powerbi.VisualDataRoleKind.Measure
|
27224 | } ],
|
27225 | dataViewMappings: [ {
|
27226 | categorical: {
|
27227 | categories: {
|
27228 | "for": {
|
27229 | "in": "Category"
|
27230 | }
|
27231 | },
|
27232 | values: {
|
27233 | select: [ {
|
27234 | bind: {
|
27235 | to: "Y"
|
27236 | }
|
27237 | } ]
|
27238 | }
|
27239 | }
|
27240 | } ],
|
27241 | objects: {
|
27242 | dataPoint: {
|
27243 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
27244 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
27245 | properties: {
|
27246 | fill: {
|
27247 | displayName: powerbi.data.createDisplayNameGetter("Visual_Fill"),
|
27248 | type: {
|
27249 | fill: {
|
27250 | solid: {
|
27251 | color: !0
|
27252 | }
|
27253 | }
|
27254 | }
|
27255 | },
|
27256 | width: {
|
27257 | displayName: "",
|
27258 | type: {
|
27259 | numeric: !0
|
27260 | }
|
27261 | }
|
27262 | }
|
27263 | },
|
27264 | general: {
|
27265 | displayName: "General",
|
27266 | properties: {
|
27267 | fill: {
|
27268 | displayName: "Background color",
|
27269 | type: {
|
27270 | fill: {
|
27271 | solid: {
|
27272 | color: !0
|
27273 | }
|
27274 | }
|
27275 | }
|
27276 | }
|
27277 | }
|
27278 | }
|
27279 | }
|
27280 | }, CheerMeter.DefaultFontFamily = "cursive", CheerMeter.DefaultFontColor = "rgb(165, 172, 175)",
|
27281 | CheerMeter.DefaultBackgroundColor = "#243C18", CheerMeter.PaddingBetweenText = 15,
|
27282 | CheerMeter;
|
27283 | }();
|
27284 | visuals.CheerMeter = CheerMeter;
|
27285 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
27286 | }(powerbi || (powerbi = {}));
|
27287 | }, function(module, exports) {
|
27288 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
27289 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
27290 | !function(powerbi) {
|
27291 | var visuals;
|
27292 | !function(visuals) {
|
27293 | var Color = jsCommon.Color, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter, DataRoleHelper = powerbi.data.DataRoleHelper, ScatterChart = function() {
|
27294 | function ScatterChart(options) {
|
27295 | options && (this.tooltipsEnabled = options.tooltipsEnabled, this.tooltipBucketEnabled = options.tooltipBucketEnabled,
|
27296 | this.interactivityService = options.interactivityService, this.animator = options.animator),
|
27297 | this.renderer = new SvgRenderer();
|
27298 | }
|
27299 | return ScatterChart.prototype.init = function(options) {
|
27300 | this.options = options, this.element = options.element, this.currentViewport = options.viewport,
|
27301 | this.style = options.style, this.host = options.host, this.colors = this.style.colorPalette.dataColors,
|
27302 | this.interactivity = options.interactivity, this.cartesianVisualHost = options.cartesianHost,
|
27303 | this.isMobileChart = options.interactivity && options.interactivity.isInteractiveLegend;
|
27304 | var svg = this.svg = options.svg;
|
27305 | svg.classed(ScatterChart.ClassName + " " + visuals.PlayChart.ClassName, !0), this.renderer.init(svg, options.labelsContext, this.isMobileChart, this.tooltipsEnabled);
|
27306 | }, ScatterChart.getAdditionalTelemetry = function(dataView) {
|
27307 | var telemetry = {
|
27308 | hasSize: DataRoleHelper.hasRoleInDataView(dataView, "Size"),
|
27309 | hasPlayAxis: DataRoleHelper.hasRoleInDataView(dataView, "Play")
|
27310 | };
|
27311 | return telemetry;
|
27312 | }, ScatterChart.getObjectProperties = function(dataView, dataLabelsSettings) {
|
27313 | var objects;
|
27314 | objects = dataView && dataView.metadata && dataView.metadata.objects ? dataView.metadata.objects : {};
|
27315 | var objectProperties = {};
|
27316 | objectProperties.defaultDataPointColor = powerbi.DataViewObjects.getFillColor(objects, visuals.columnChartProps.dataPoint.defaultColor),
|
27317 | objectProperties.showAllDataPoints = powerbi.DataViewObjects.getValue(objects, visuals.columnChartProps.dataPoint.showAllDataPoints, !1);
|
27318 | var labelsObj = objects.categoryLabels;
|
27319 | labelsObj && dataLabelsSettings && visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(labelsObj, dataLabelsSettings);
|
27320 | var hasGradient = dataView && visuals.GradientUtils.hasGradientRole(dataView.categorical);
|
27321 | return objectProperties.fillPoint = powerbi.DataViewObjects.getValue(objects, visuals.scatterChartProps.fillPoint.show, hasGradient),
|
27322 | objectProperties.colorBorder = powerbi.DataViewObjects.getValue(objects, visuals.scatterChartProps.colorBorder.show, !1),
|
27323 | objectProperties.colorByCategory = powerbi.DataViewObjects.getValue(objects, visuals.scatterChartProps.colorByCategory.show, !1),
|
27324 | objectProperties;
|
27325 | }, ScatterChart.converter = function(dataView, options, playFrameInfo, tooltipsEnabled, tooltipBucketEnabled) {
|
27326 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
27327 | var categoryValues, categoryFormatter, categoryObjects, categoryIdentities, categoryQueryName, reader = powerbi.data.createIDataViewCategoricalReader(dataView), currentViewport = options.viewport, colorPalette = options.colors, interactivityService = options.interactivityService, categoryAxisProperties = options.categoryAxisProperties, valueAxisProperties = options.valueAxisProperties, dataViewCategorical = dataView.categorical, gradientValueColumn = visuals.GradientUtils.getGradientValueColumn(dataViewCategorical);
|
27328 | dataViewCategorical.categories && dataViewCategorical.categories.length > 0 ? (categoryValues = dataViewCategorical.categories[0].values,
|
27329 | categoryFormatter = visuals.valueFormatter.create({
|
27330 | format: visuals.valueFormatter.getFormatString(dataViewCategorical.categories[0].source, visuals.scatterChartProps.general.formatString),
|
27331 | value: categoryValues[0],
|
27332 | value2: categoryValues[categoryValues.length - 1]
|
27333 | }), categoryIdentities = dataViewCategorical.categories[0].identity, categoryObjects = dataViewCategorical.categories[0].objects,
|
27334 | categoryQueryName = dataViewCategorical.categories[0].source.queryName) : (categoryValues = [ null ],
|
27335 | categoryFormatter = visuals.valueFormatter.createDefaultFormatter(null));
|
27336 | var categories = dataViewCategorical.categories, dataValues = dataViewCategorical.values, hasDynamicSeries = !!dataValues.source, grouped = dataValues.grouped(), dvSource = dataValues.source, scatterMetadata = ScatterChart.getMetadata(grouped, dvSource), dataLabelsSettings = visuals.dataLabelUtils.getDefaultPointLabelSettings(), sizeRange = ScatterChart.getSizeRangeForGroups(grouped, scatterMetadata.idx.size), objProps = ScatterChart.getObjectProperties(dataView, dataLabelsSettings), dataPointSeries = ScatterChart.createDataPointSeries(reader, dataValues, scatterMetadata, categories, categoryValues, categoryFormatter, categoryIdentities, categoryObjects, colorPalette, currentViewport, hasDynamicSeries, dataLabelsSettings, gradientValueColumn, objProps.defaultDataPointColor, categoryQueryName, objProps.colorByCategory, playFrameInfo, tooltipsEnabled, tooltipBucketEnabled), dataPoints = _.reduce(dataPointSeries, function(a, s) {
|
27337 | return a.concat(s.dataPoints);
|
27338 | }, []), legendItems = hasDynamicSeries ? ScatterChart.createSeriesLegend(dataValues, colorPalette, dataValues, visuals.valueFormatter.getFormatString(dvSource, visuals.scatterChartProps.general.formatString), objProps.defaultDataPointColor) : [], legendTitle = dataValues && dvSource ? dvSource.displayName : "";
|
27339 | return legendTitle || (legendTitle = categories && categories.length > 0 && categories[0].source.displayName ? categories[0].source.displayName : ""),
|
27340 | categoryAxisProperties && null !== categoryAxisProperties.showAxisTitle && categoryAxisProperties.showAxisTitle === !1 && (scatterMetadata.axesLabels.x = null),
|
27341 | valueAxisProperties && null !== valueAxisProperties.showAxisTitle && valueAxisProperties.showAxisTitle === !1 && (scatterMetadata.axesLabels.y = null),
|
27342 | interactivityService && (interactivityService.applySelectionStateToData(dataPoints),
|
27343 | interactivityService.applySelectionStateToData(legendItems)), {
|
27344 | xCol: scatterMetadata.cols.x,
|
27345 | yCol: scatterMetadata.cols.y,
|
27346 | dataPoints: dataPoints,
|
27347 | dataPointSeries: dataPointSeries,
|
27348 | legendData: {
|
27349 | title: legendTitle,
|
27350 | dataPoints: legendItems,
|
27351 | grouped: hasDynamicSeries
|
27352 | },
|
27353 | axesLabels: scatterMetadata.axesLabels,
|
27354 | size: scatterMetadata.cols.size,
|
27355 | sizeRange: sizeRange,
|
27356 | dataLabelsSettings: dataLabelsSettings,
|
27357 | defaultDataPointColor: objProps.defaultDataPointColor,
|
27358 | hasDynamicSeries: hasDynamicSeries,
|
27359 | showAllDataPoints: objProps.showAllDataPoints,
|
27360 | fillPoint: objProps.fillPoint,
|
27361 | colorBorder: objProps.colorBorder,
|
27362 | colorByCategory: objProps.colorByCategory
|
27363 | };
|
27364 | }, ScatterChart.getSizeRangeForGroups = function(dataViewValueGroups, sizeColumnIndex) {
|
27365 | var result = {};
|
27366 | return dataViewValueGroups && dataViewValueGroups.forEach(function(group) {
|
27367 | var sizeColumn = ScatterChart.getMeasureValue(sizeColumnIndex, group.values), currentRange = visuals.AxisHelper.getRangeForColumn(sizeColumn);
|
27368 | (null == result.min || result.min > currentRange.min) && (result.min = currentRange.min),
|
27369 | (null == result.max || result.max < currentRange.max) && (result.max = currentRange.max);
|
27370 | }), result;
|
27371 | }, ScatterChart.createDataPointSeries = function(reader, dataValues, metadata, categories, categoryValues, categoryFormatter, categoryIdentities, categoryObjects, colorPalette, viewport, hasDynamicSeries, labelSettings, gradientValueColumn, defaultDataPointColor, categoryQueryName, colorByCategory, playFrameInfo, tooltipsEnabled, tooltipBucketEnabled) {
|
27372 | var hasX = reader.hasValues("X"), hasY = reader.hasValues("Y");
|
27373 | if (!hasX && !hasY) return [];
|
27374 | for (var dataPointSeries = [], indicies = metadata.idx, formatStringProp = visuals.scatterChartProps.general.formatString, dataValueSource = dataValues.source, grouped = dataValues.grouped(), colorHelper = new visuals.ColorHelper(colorPalette, visuals.scatterChartProps.dataPoint.fill, defaultDataPointColor), seriesIndex = 0, len = grouped.length; len > seriesIndex; seriesIndex++) {
|
27375 | var grouping = grouped[seriesIndex], seriesValues = grouping.values, measureX = ScatterChart.getMeasureValue(indicies.x, seriesValues), measureY = ScatterChart.getMeasureValue(indicies.y, seriesValues), measureSize = ScatterChart.getMeasureValue(indicies.size, seriesValues), seriesColor = void 0;
|
27376 | if (hasDynamicSeries) seriesColor = colorHelper.getColorForSeriesValue(grouping.objects, dataValues.identityFields, grouping.name); else if (!colorByCategory && !categoryObjects) {
|
27377 | var measureSource = null != measureSize ? measureSize.source.queryName : "";
|
27378 | seriesColor = colorHelper.getColorForMeasure(null, measureSource);
|
27379 | }
|
27380 | var series = {
|
27381 | identityKey: grouping && grouping.identity && grouping.identity.key || "",
|
27382 | dataPoints: [],
|
27383 | hasSize: !(!measureSize || !measureSize.values),
|
27384 | fill: seriesColor
|
27385 | };
|
27386 | dataPointSeries.push(series);
|
27387 | for (var categoryIndex = 0, ilen = categoryValues.length; ilen > categoryIndex; categoryIndex++) {
|
27388 | var categoryValue = categoryValues[categoryIndex], xVal = hasX ? visuals.AxisHelper.normalizeNonFiniteNumber(reader.getValue("X", categoryIndex, seriesIndex)) : 0, yVal = hasY ? visuals.AxisHelper.normalizeNonFiniteNumber(reader.getValue("Y", categoryIndex, seriesIndex)) : 0, size = visuals.AxisHelper.normalizeNonFiniteNumber(reader.getValue("Size", categoryIndex, seriesIndex));
|
27389 | if (null != xVal && null != yVal) {
|
27390 | var color = void 0;
|
27391 | if (hasDynamicSeries) color = colorHelper.getColorForSeriesValue(grouping.objects, dataValues.identityFields, grouping.name); else if (colorByCategory) color = colorHelper.getColorForSeriesValue(categoryObjects && categoryObjects[categoryIndex], dataValues.identityFields, categoryValue); else {
|
27392 | var measureSource = null != measureSize ? measureSize.source.queryName : "";
|
27393 | color = colorHelper.getColorForMeasure(categoryObjects && categoryObjects[categoryIndex], measureSource);
|
27394 | }
|
27395 | var category = _.isEmpty(categories) ? null : categories[0], identity = visuals.SelectionIdBuilder.builder().withCategory(category, categoryIndex).withSeries(dataValues, grouping).createSelectionId(), tooltipInfo = void 0;
|
27396 | tooltipsEnabled && (tooltipInfo = [], category && tooltipInfo.push({
|
27397 | displayName: category.source.displayName,
|
27398 | value: visuals.converterHelper.formatFromMetadataColumn(categoryValue, category.source, formatStringProp)
|
27399 | }), hasDynamicSeries && (category && category.source === dataValueSource || tooltipInfo.push({
|
27400 | displayName: dataValueSource.displayName,
|
27401 | value: visuals.converterHelper.formatFromMetadataColumn(grouping.name, dataValueSource, formatStringProp)
|
27402 | })), measureX && null != xVal && tooltipInfo.push({
|
27403 | displayName: measureX.source.displayName,
|
27404 | value: visuals.converterHelper.formatFromMetadataColumn(xVal, measureX.source, formatStringProp)
|
27405 | }), measureY && null != yVal && tooltipInfo.push({
|
27406 | displayName: measureY.source.displayName,
|
27407 | value: visuals.converterHelper.formatFromMetadataColumn(yVal, measureY.source, formatStringProp)
|
27408 | }), measureSize && null != measureSize.values[categoryIndex] && tooltipInfo.push({
|
27409 | displayName: measureSize.source.displayName,
|
27410 | value: visuals.converterHelper.formatFromMetadataColumn(measureSize.values[categoryIndex], measureSize.source, formatStringProp)
|
27411 | }), gradientValueColumn && null != gradientValueColumn.values[categoryIndex] && tooltipInfo.push({
|
27412 | displayName: gradientValueColumn.source.displayName,
|
27413 | value: visuals.converterHelper.formatFromMetadataColumn(gradientValueColumn.values[categoryIndex], gradientValueColumn.source, formatStringProp)
|
27414 | }), playFrameInfo && tooltipInfo.push({
|
27415 | displayName: playFrameInfo.column.displayName,
|
27416 | value: visuals.converterHelper.formatFromMetadataColumn(playFrameInfo.label, playFrameInfo.column, formatStringProp)
|
27417 | }), tooltipBucketEnabled && visuals.TooltipBuilder.addTooltipBucketItem(reader, tooltipInfo, categoryIndex, seriesIndex));
|
27418 | var dataPoint = {
|
27419 | x: xVal,
|
27420 | y: yVal,
|
27421 | size: size,
|
27422 | radius: {
|
27423 | sizeMeasure: measureSize,
|
27424 | index: categoryIndex
|
27425 | },
|
27426 | fill: color,
|
27427 | formattedCategory: ScatterChart.createLazyFormattedCategory(categoryFormatter, null != categories ? categoryValue : grouping.name),
|
27428 | selected: !1,
|
27429 | identity: identity,
|
27430 | tooltipInfo: tooltipInfo,
|
27431 | labelFill: labelSettings.labelColor
|
27432 | };
|
27433 | series.dataPoints.push(dataPoint);
|
27434 | }
|
27435 | }
|
27436 | }
|
27437 | return dataPointSeries;
|
27438 | }, ScatterChart.createLazyFormattedCategory = function(formatter, value) {
|
27439 | return new jsCommon.Lazy(function() {
|
27440 | return formatter.format(value);
|
27441 | });
|
27442 | }, ScatterChart.createSeriesLegend = function(dataValues, colorPalette, categorical, formatString, defaultDataPointColor) {
|
27443 | for (var grouped = dataValues.grouped(), colorHelper = new visuals.ColorHelper(colorPalette, visuals.scatterChartProps.dataPoint.fill, defaultDataPointColor), legendItems = [], i = 0, len = grouped.length; len > i; i++) {
|
27444 | var grouping = grouped[i], color = colorHelper.getColorForSeriesValue(grouping.objects, dataValues.identityFields, grouping.name);
|
27445 | legendItems.push({
|
27446 | color: color,
|
27447 | icon: visuals.LegendIcon.Circle,
|
27448 | label: visuals.valueFormatter.format(grouping.name, formatString),
|
27449 | identity: grouping.identity ? visuals.SelectionId.createWithId(grouping.identity) : visuals.SelectionId.createNull(),
|
27450 | selected: !1
|
27451 | });
|
27452 | }
|
27453 | return legendItems;
|
27454 | }, ScatterChart.getBubbleRadius = function(radiusData, sizeRange, viewport) {
|
27455 | var actualSizeDataRange = null, bubblePixelAreaSizeRange = null, measureSize = radiusData.sizeMeasure;
|
27456 | if (!measureSize) return ScatterChart.BubbleRadius;
|
27457 | var minSize = sizeRange.min ? sizeRange.min : 0, maxSize = sizeRange.max ? sizeRange.max : 0, min = Math.min(minSize, 0), max = Math.max(maxSize, 0);
|
27458 | if (actualSizeDataRange = {
|
27459 | minRange: min,
|
27460 | maxRange: max,
|
27461 | delta: max - min
|
27462 | }, bubblePixelAreaSizeRange = ScatterChart.getBubblePixelAreaSizeRange(viewport, ScatterChart.MinSizeRange, ScatterChart.MaxSizeRange),
|
27463 | measureSize.values) {
|
27464 | var sizeValue = measureSize.values[radiusData.index];
|
27465 | if (null != sizeValue) return ScatterChart.projectSizeToPixels(sizeValue, actualSizeDataRange, bubblePixelAreaSizeRange) / 2;
|
27466 | }
|
27467 | return ScatterChart.BubbleRadius;
|
27468 | }, ScatterChart.getMeasureValue = function(measureIndex, seriesValues) {
|
27469 | return measureIndex >= 0 ? seriesValues[measureIndex] : null;
|
27470 | }, ScatterChart.getMetadata = function(grouped, source) {
|
27471 | var xCol, yCol, sizeCol, xIndex = DataRoleHelper.getMeasureIndexOfRole(grouped, "X"), yIndex = DataRoleHelper.getMeasureIndexOfRole(grouped, "Y"), sizeIndex = DataRoleHelper.getMeasureIndexOfRole(grouped, "Size"), xAxisLabel = "", yAxisLabel = "";
|
27472 | if (grouped && grouped.length) {
|
27473 | var firstGroup = grouped[0];
|
27474 | xIndex >= 0 && (xCol = firstGroup.values[xIndex].source, xAxisLabel = firstGroup.values[xIndex].source.displayName),
|
27475 | yIndex >= 0 && (yCol = firstGroup.values[yIndex].source, yAxisLabel = firstGroup.values[yIndex].source.displayName),
|
27476 | sizeIndex >= 0 && (sizeCol = firstGroup.values[sizeIndex].source);
|
27477 | }
|
27478 | return {
|
27479 | idx: {
|
27480 | x: xIndex,
|
27481 | y: yIndex,
|
27482 | size: sizeIndex
|
27483 | },
|
27484 | cols: {
|
27485 | x: xCol,
|
27486 | y: yCol,
|
27487 | size: sizeCol
|
27488 | },
|
27489 | axesLabels: {
|
27490 | x: xAxisLabel,
|
27491 | y: yAxisLabel
|
27492 | }
|
27493 | };
|
27494 | }, ScatterChart.getDefaultData = function() {
|
27495 | return {
|
27496 | xCol: void 0,
|
27497 | yCol: void 0,
|
27498 | dataPoints: [],
|
27499 | dataPointSeries: [],
|
27500 | legendData: {
|
27501 | dataPoints: []
|
27502 | },
|
27503 | axesLabels: {
|
27504 | x: "",
|
27505 | y: ""
|
27506 | },
|
27507 | sizeRange: [],
|
27508 | dataLabelsSettings: visuals.dataLabelUtils.getDefaultPointLabelSettings(),
|
27509 | defaultDataPointColor: null,
|
27510 | hasDynamicSeries: !1
|
27511 | };
|
27512 | }, ScatterChart.prototype.renderAtFrame = function(data) {
|
27513 | this.data = data, this.cartesianVisualHost.triggerRender(!1);
|
27514 | }, ScatterChart.prototype.setData = function(dataViews) {
|
27515 | var _this = this;
|
27516 | if (this.data = ScatterChart.getDefaultData(), this.playAxis && this.playAxis.isCurrentlyPlaying() && this.playAxis.stop(),
|
27517 | dataViews.length > 0) {
|
27518 | var dataView = dataViews[0] || dataViews[1];
|
27519 | if (dataView) {
|
27520 | this.categoryAxisProperties = visuals.CartesianHelper.getCategoryAxisProperties(dataView.metadata, !0),
|
27521 | this.valueAxisProperties = visuals.CartesianHelper.getValueAxisProperties(dataView.metadata, !0),
|
27522 | this.dataView = dataView;
|
27523 | var converterOptions_1 = {
|
27524 | viewport: this.currentViewport,
|
27525 | colors: this.colors,
|
27526 | interactivityService: this.interactivityService,
|
27527 | categoryAxisProperties: this.categoryAxisProperties,
|
27528 | valueAxisProperties: this.valueAxisProperties
|
27529 | };
|
27530 | if (visuals.PlayChart.isDataViewPlayable(dataView)) {
|
27531 | this.playAxis || (this.playAxis = new visuals.PlayAxis({
|
27532 | animator: this.animator,
|
27533 | interactivityService: this.interactivityService,
|
27534 | isScrollable: !1
|
27535 | }), this.playAxis.init(this.options));
|
27536 | var playData = this.playAxis.setData(dataView, function(dataView, playFrameInfo) {
|
27537 | return ScatterChart.converter(dataView, converterOptions_1, playFrameInfo, _this.tooltipsEnabled, _this.tooltipBucketEnabled);
|
27538 | });
|
27539 | this.mergeSizeRanges(playData), this.data = playData.currentViewModel, this.playAxis.setRenderFunction(function(data) {
|
27540 | return _this.renderAtFrame(data);
|
27541 | });
|
27542 | } else this.playAxis && (this.playAxis.remove(), this.playAxis = null), dataView.categorical && dataView.categorical.values && (this.data = ScatterChart.converter(dataView, converterOptions_1, void 0, this.tooltipsEnabled, this.tooltipBucketEnabled));
|
27543 | }
|
27544 | } else this.playAxis && (this.playAxis.remove(), this.playAxis = null);
|
27545 | }, ScatterChart.prototype.mergeSizeRanges = function(playData) {
|
27546 | if (playData && playData.currentViewModel) {
|
27547 | for (var mergedSizeRange = playData.currentViewModel.sizeRange, _i = 0, _a = playData.allViewModels; _i < _a.length; _i++) {
|
27548 | var data_1 = _a[_i], sizeRange = data_1.sizeRange;
|
27549 | null != sizeRange.min && (mergedSizeRange.min = Math.min(mergedSizeRange.min, sizeRange.min)),
|
27550 | null != sizeRange.max && (mergedSizeRange.max = Math.max(mergedSizeRange.max, sizeRange.max));
|
27551 | }
|
27552 | for (var _b = 0, _c = playData.allViewModels; _b < _c.length; _b++) {
|
27553 | var data_2 = _c[_b];
|
27554 | data_2.sizeRange = mergedSizeRange;
|
27555 | }
|
27556 | }
|
27557 | }, ScatterChart.prototype.calculateLegend = function() {
|
27558 | return this.data && this.data.legendData;
|
27559 | }, ScatterChart.prototype.hasLegend = function() {
|
27560 | return this.data && this.data.hasDynamicSeries;
|
27561 | }, ScatterChart.prototype.enumerateObjectInstances = function(enumeration, options) {
|
27562 | switch (options.objectName) {
|
27563 | case "colorByCategory":
|
27564 | this.data && (this.data.hasDynamicSeries || enumeration.pushInstance({
|
27565 | objectName: "colorByCategory",
|
27566 | selector: null,
|
27567 | properties: {
|
27568 | show: this.data.colorByCategory
|
27569 | }
|
27570 | }));
|
27571 | break;
|
27572 |
|
27573 | case "dataPoint":
|
27574 | if (!this.playAxis) {
|
27575 | var categoricalDataView = this.dataView && this.dataView.categorical ? this.dataView.categorical : null;
|
27576 | if (!visuals.GradientUtils.hasGradientRole(categoricalDataView)) return this.enumerateDataPoints(enumeration);
|
27577 | }
|
27578 | break;
|
27579 |
|
27580 | case "categoryAxis":
|
27581 | enumeration.pushInstance({
|
27582 | selector: null,
|
27583 | properties: {
|
27584 | showAxisTitle: this.categoryAxisProperties && null != this.categoryAxisProperties.showAxisTitle ? this.categoryAxisProperties.showAxisTitle : !0
|
27585 | },
|
27586 | objectName: "categoryAxis"
|
27587 | });
|
27588 | break;
|
27589 |
|
27590 | case "valueAxis":
|
27591 | enumeration.pushInstance({
|
27592 | selector: null,
|
27593 | properties: {
|
27594 | showAxisTitle: this.valueAxisProperties && null != this.valueAxisProperties.showAxisTitle ? this.valueAxisProperties.showAxisTitle : !0
|
27595 | },
|
27596 | objectName: "valueAxis"
|
27597 | });
|
27598 | break;
|
27599 |
|
27600 | case "categoryLabels":
|
27601 | this.data ? visuals.dataLabelUtils.enumerateCategoryLabels(enumeration, this.data.dataLabelsSettings, !0) : visuals.dataLabelUtils.enumerateCategoryLabels(enumeration, null, !0);
|
27602 | break;
|
27603 |
|
27604 | case "fillPoint":
|
27605 | if (this.hasSizeMeasure()) return;
|
27606 | enumeration.pushInstance({
|
27607 | objectName: "fillPoint",
|
27608 | selector: null,
|
27609 | properties: {
|
27610 | show: this.data.fillPoint
|
27611 | }
|
27612 | });
|
27613 | break;
|
27614 |
|
27615 | case "colorBorder":
|
27616 | this.hasSizeMeasure() && enumeration.pushInstance({
|
27617 | objectName: "colorBorder",
|
27618 | selector: null,
|
27619 | properties: {
|
27620 | show: this.data.colorBorder
|
27621 | }
|
27622 | });
|
27623 | }
|
27624 | }, ScatterChart.prototype.hasSizeMeasure = function() {
|
27625 | var sizeRange = this.data.sizeRange;
|
27626 | return sizeRange && void 0 !== sizeRange.min;
|
27627 | }, ScatterChart.prototype.enumerateDataPoints = function(enumeration) {
|
27628 | var data = this.data;
|
27629 | if (data) {
|
27630 | var seriesCount = data.dataPoints.length;
|
27631 | if (data.hasDynamicSeries) for (var legendDataPointLength = data.legendData.dataPoints.length, i = 0; legendDataPointLength > i; i++) {
|
27632 | var series = data.legendData.dataPoints[i];
|
27633 | enumeration.pushInstance({
|
27634 | objectName: "dataPoint",
|
27635 | displayName: series.label,
|
27636 | selector: visuals.ColorHelper.normalizeSelector(series.identity.getSelector()),
|
27637 | properties: {
|
27638 | fill: {
|
27639 | solid: {
|
27640 | color: series.color
|
27641 | }
|
27642 | }
|
27643 | }
|
27644 | });
|
27645 | } else {
|
27646 | enumeration.pushInstance({
|
27647 | objectName: "dataPoint",
|
27648 | selector: null,
|
27649 | properties: {
|
27650 | defaultColor: {
|
27651 | solid: {
|
27652 | color: data.defaultDataPointColor || this.colors.getColorByIndex(0).value
|
27653 | }
|
27654 | }
|
27655 | }
|
27656 | }).pushInstance({
|
27657 | objectName: "dataPoint",
|
27658 | selector: null,
|
27659 | properties: {
|
27660 | showAllDataPoints: !!data.showAllDataPoints
|
27661 | }
|
27662 | });
|
27663 | for (var i = 0; seriesCount > i; i++) {
|
27664 | var seriesDataPoints = data.dataPoints[i];
|
27665 | enumeration.pushInstance({
|
27666 | objectName: "dataPoint",
|
27667 | displayName: seriesDataPoints.formattedCategory.getValue(),
|
27668 | selector: visuals.ColorHelper.normalizeSelector(seriesDataPoints.identity.getSelector(), !0),
|
27669 | properties: {
|
27670 | fill: {
|
27671 | solid: {
|
27672 | color: seriesDataPoints.fill
|
27673 | }
|
27674 | }
|
27675 | }
|
27676 | });
|
27677 | }
|
27678 | }
|
27679 | }
|
27680 | }, ScatterChart.prototype.supportsTrendLine = function() {
|
27681 | var data = this.data;
|
27682 | if (!data) return !1;
|
27683 | var dataView = this.dataView, reader = powerbi.data.createIDataViewCategoricalReader(dataView);
|
27684 | return !this.hasSizeMeasure() && data.dataPointSeries.length > 0 && reader.hasValues("X") && reader.hasValues("Y");
|
27685 | }, ScatterChart.getExtents = function(data) {
|
27686 | var dps = data.dataPoints;
|
27687 | return _.isEmpty(dps) ? {
|
27688 | minY: 0,
|
27689 | maxY: 0,
|
27690 | minX: 0,
|
27691 | maxX: 0
|
27692 | } : {
|
27693 | minY: d3.min(dps, function(d) {
|
27694 | return d.y;
|
27695 | }),
|
27696 | maxY: d3.max(dps, function(d) {
|
27697 | return d.y;
|
27698 | }),
|
27699 | minX: d3.min(dps, function(d) {
|
27700 | return d.x;
|
27701 | }),
|
27702 | maxX: d3.max(dps, function(d) {
|
27703 | return d.x;
|
27704 | })
|
27705 | };
|
27706 | }, ScatterChart.prototype.calculateAxesProperties = function(options) {
|
27707 | var data = this.data, viewport = this.currentViewport = options.viewport, margin = options.margin;
|
27708 | this.currentViewport = viewport, this.margin = margin;
|
27709 | var width = viewport.width - (margin.left + margin.right), height = viewport.height - (margin.top + margin.bottom), extents = {
|
27710 | minY: 0,
|
27711 | maxY: 10,
|
27712 | minX: 0,
|
27713 | maxX: 10
|
27714 | };
|
27715 | this.playAxis ? (extents = this.playAxis.getCartesianExtents(extents, ScatterChart.getExtents),
|
27716 | this.playAxis.setPlayControlPosition(options.playAxisControlLayout)) : _.isEmpty(data.dataPoints) || (extents = ScatterChart.getExtents(data));
|
27717 | var xDomain = [ extents.minX, extents.maxX ], combinedXDomain = visuals.AxisHelper.combineDomain(options.forcedXDomain, xDomain, options.ensureXDomain);
|
27718 | this.xAxisProperties = visuals.AxisHelper.createAxis({
|
27719 | pixelSpan: width,
|
27720 | dataDomain: combinedXDomain,
|
27721 | metaDataColumn: data.xCol,
|
27722 | formatString: visuals.valueFormatter.getFormatString(data.xCol, visuals.scatterChartProps.general.formatString),
|
27723 | outerPadding: 0,
|
27724 | isScalar: !0,
|
27725 | isVertical: !1,
|
27726 | forcedTickCount: options.forcedTickCount,
|
27727 | useTickIntervalForDisplayUnits: !0,
|
27728 | isCategoryAxis: !0,
|
27729 | scaleType: options.categoryAxisScaleType,
|
27730 | axisDisplayUnits: options.categoryAxisDisplayUnits,
|
27731 | axisPrecision: options.categoryAxisPrecision
|
27732 | }), this.xAxisProperties.axis.tickSize(-height, 0), this.xAxisProperties.axisLabel = this.data.axesLabels.x;
|
27733 | var combinedDomain = visuals.AxisHelper.combineDomain(options.forcedYDomain, [ extents.minY, extents.maxY ], options.ensureYDomain);
|
27734 | return this.yAxisProperties = visuals.AxisHelper.createAxis({
|
27735 | pixelSpan: height,
|
27736 | dataDomain: combinedDomain,
|
27737 | metaDataColumn: data.yCol,
|
27738 | formatString: visuals.valueFormatter.getFormatString(data.yCol, visuals.scatterChartProps.general.formatString),
|
27739 | outerPadding: 0,
|
27740 | isScalar: !0,
|
27741 | isVertical: !0,
|
27742 | forcedTickCount: options.forcedTickCount,
|
27743 | useTickIntervalForDisplayUnits: !0,
|
27744 | isCategoryAxis: !1,
|
27745 | scaleType: options.valueAxisScaleType,
|
27746 | axisDisplayUnits: options.valueAxisDisplayUnits,
|
27747 | axisPrecision: options.valueAxisPrecision
|
27748 | }), this.yAxisProperties.axisLabel = this.data.axesLabels.y, [ this.xAxisProperties, this.yAxisProperties ];
|
27749 | }, ScatterChart.prototype.overrideXScale = function(xProperties) {
|
27750 | this.xAxisProperties = xProperties;
|
27751 | }, ScatterChart.prototype.shouldSuppressAnimation = function() {
|
27752 | return this.data && this.data.dataPoints && this.data.dataPoints.length > ScatterChart.NoAnimationThreshold;
|
27753 | }, ScatterChart.prototype.render = function(suppressAnimations, resizeMode) {
|
27754 | if (this.data) {
|
27755 | var data = this.data, margin = this.margin, viewport = this.currentViewport, hasSelection = this.interactivityService && this.interactivityService.hasSelection(), plotArea = {
|
27756 | width: viewport.width - (margin.left + margin.right),
|
27757 | height: viewport.height - (margin.top + margin.bottom)
|
27758 | }, duration = visuals.AnimatorCommon.GetAnimationDuration(this.animator, suppressAnimations);
|
27759 | this.playAxis && this.playAxis.isCurrentlyPlaying() && (this.isMobileChart || duration > 0) && (duration = visuals.PlayChart.FrameAnimationDuration);
|
27760 | var easeType = this.playAxis ? "linear" : "cubic-in-out", fillMarkers = (!data.sizeRange || !data.sizeRange.min) && data.fillPoint, drawBubbles = this.hasSizeMeasure(), suppressDataPointRendering = 1 === resizeMode && data.dataPoints && data.dataPoints.length > ScatterChart.NoRenderResizeThreshold, viewModel = {
|
27761 | data: data,
|
27762 | drawBubbles: drawBubbles,
|
27763 | isPlay: !!this.playAxis,
|
27764 | xAxisProperties: this.xAxisProperties,
|
27765 | yAxisProperties: this.yAxisProperties,
|
27766 | viewport: plotArea,
|
27767 | hasSelection: hasSelection,
|
27768 | animationDuration: duration,
|
27769 | animationOptions: this.options.animation,
|
27770 | fillMarkers: fillMarkers,
|
27771 | easeType: easeType,
|
27772 | suppressDataPointRendering: suppressDataPointRendering
|
27773 | };
|
27774 | if (drawBubbles) {
|
27775 | var sortedData = data.dataPoints.sort(ScatterChart.sortBubbles);
|
27776 | viewModel.data = powerbi.Prototype.inherit(viewModel.data), viewModel.data.dataPoints = sortedData;
|
27777 | }
|
27778 | var labelDataPoints = [];
|
27779 | (data.dataLabelsSettings && data.dataLabelsSettings.show || data.dataLabelsSettings.showCategory) && (labelDataPoints = ScatterChartDataLabels.createLabelDataPoints(viewModel));
|
27780 | var behaviorOptions = this.renderer.render(viewModel, this.interactivityService);
|
27781 | this.isMobileChart && (behaviorOptions = {
|
27782 | data: behaviorOptions.data,
|
27783 | dataPointsSelection: behaviorOptions.dataPointsSelection,
|
27784 | eventGroup: behaviorOptions.eventGroup,
|
27785 | plotContext: behaviorOptions.plotContext,
|
27786 | host: this.cartesianVisualHost,
|
27787 | root: this.svg,
|
27788 | visualInitOptions: this.options,
|
27789 | xAxisProperties: this.xAxisProperties,
|
27790 | yAxisProperties: this.yAxisProperties,
|
27791 | background: d3.select(this.element.get(0))
|
27792 | });
|
27793 | var playRenderResult;
|
27794 | if (this.playAxis && (playRenderResult = this.playAxis.render(suppressAnimations, viewModel, viewport, margin),
|
27795 | this.interactivityService)) {
|
27796 | var playBehaviorOptions = {
|
27797 | traceLineRenderer: this.renderer.createTraceLineRenderer(playRenderResult.viewModel)
|
27798 | };
|
27799 | hasSelection && visuals.PlayChart.renderTraceLines(playRenderResult.allDataPoints, playBehaviorOptions.traceLineRenderer, !suppressAnimations),
|
27800 | behaviorOptions.playOptions = playBehaviorOptions;
|
27801 | }
|
27802 | return {
|
27803 | dataPoints: playRenderResult ? playRenderResult.allDataPoints : data.dataPoints,
|
27804 | behaviorOptions: behaviorOptions,
|
27805 | labelDataPoints: labelDataPoints,
|
27806 | labelsAreNumeric: !1
|
27807 | };
|
27808 | }
|
27809 | }, ScatterChart.getStrokeFill = function(d, colorBorder) {
|
27810 | if (null != d.size && colorBorder) {
|
27811 | var colorRgb = Color.parseColorString(d.fill);
|
27812 | return Color.hexString(Color.darken(colorRgb, ScatterChart.StrokeDarkenColorValue));
|
27813 | }
|
27814 | return d.fill;
|
27815 | }, ScatterChart.getBubblePixelAreaSizeRange = function(viewPort, minSizeRange, maxSizeRange) {
|
27816 | var ratio = 1;
|
27817 | if (viewPort.height > 0 && viewPort.width > 0) {
|
27818 | var minSize = Math.min(viewPort.height, viewPort.width);
|
27819 | ratio = minSize * minSize / ScatterChart.AreaOf300By300Chart;
|
27820 | }
|
27821 | var minRange = Math.round(minSizeRange * ratio), maxRange = Math.round(maxSizeRange * ratio);
|
27822 | return {
|
27823 | minRange: minRange,
|
27824 | maxRange: maxRange,
|
27825 | delta: maxRange - minRange
|
27826 | };
|
27827 | }, ScatterChart.project = function(value, actualSizeDataRange, bubblePixelAreaSizeRange) {
|
27828 | if (0 === actualSizeDataRange.delta || 0 === bubblePixelAreaSizeRange.delta) return ScatterChart.rangeContains(actualSizeDataRange, value) ? bubblePixelAreaSizeRange.minRange : null;
|
27829 | var relativeX = (value - actualSizeDataRange.minRange) / actualSizeDataRange.delta;
|
27830 | return bubblePixelAreaSizeRange.minRange + relativeX * bubblePixelAreaSizeRange.delta;
|
27831 | }, ScatterChart.projectSizeToPixels = function(size, actualSizeDataRange, bubblePixelAreaSizeRange) {
|
27832 | var projectedSize = 0;
|
27833 | if (actualSizeDataRange) {
|
27834 | if (projectedSize = bubblePixelAreaSizeRange.maxRange, 0 !== actualSizeDataRange.delta) {
|
27835 | var value = Math.min(Math.max(size, actualSizeDataRange.minRange), actualSizeDataRange.maxRange);
|
27836 | projectedSize = ScatterChart.project(value, actualSizeDataRange, bubblePixelAreaSizeRange);
|
27837 | }
|
27838 | projectedSize = 2 * Math.sqrt(projectedSize / Math.PI);
|
27839 | }
|
27840 | return Math.round(projectedSize);
|
27841 | }, ScatterChart.rangeContains = function(range, value) {
|
27842 | return range.minRange <= value && value <= range.maxRange;
|
27843 | }, ScatterChart.getMarkerFillOpacity = function(hasSize, shouldEnableFill, hasSelection, isSelected) {
|
27844 | return hasSize || shouldEnableFill ? hasSelection && !isSelected ? ScatterChart.DimmedBubbleOpacity : ScatterChart.DefaultBubbleOpacity : 0;
|
27845 | }, ScatterChart.getMarkerStrokeOpacity = function(hasSize, colorBorder, hasSelection, isSelected) {
|
27846 | return hasSize && colorBorder ? 1 : hasSelection && !isSelected ? ScatterChart.DimmedBubbleOpacity : ScatterChart.DefaultBubbleOpacity;
|
27847 | }, ScatterChart.getMarkerStrokeFill = function(hasSize, colorBorder, fill) {
|
27848 | if (hasSize && colorBorder) {
|
27849 | var colorRgb = Color.parseColorString(fill);
|
27850 | return Color.hexString(Color.darken(colorRgb, ScatterChart.StrokeDarkenColorValue));
|
27851 | }
|
27852 | return fill;
|
27853 | }, ScatterChart.getMarkerStyle = function(d, colorBorder, hasSelection, fillMarkers) {
|
27854 | return {
|
27855 | "stroke-opacity": ScatterChart.getMarkerStrokeOpacity(null != d.size, colorBorder, hasSelection, d.selected),
|
27856 | stroke: ScatterChart.getMarkerStrokeFill(null != d.size, colorBorder, d.fill),
|
27857 | fill: d.fill,
|
27858 | "fill-opacity": ScatterChart.getMarkerFillOpacity(null != d.size, fillMarkers, hasSelection, d.selected)
|
27859 | };
|
27860 | }, ScatterChart.getSeriesStyle = function(hasSize, colorBorder, hasSelection, fillMarkers, fill) {
|
27861 | return {
|
27862 | "stroke-opacity": ScatterChart.getMarkerStrokeOpacity(hasSize, colorBorder, hasSelection, !1),
|
27863 | stroke: ScatterChart.getMarkerStrokeFill(hasSize, colorBorder, fill),
|
27864 | fill: fill,
|
27865 | "fill-opacity": ScatterChart.getMarkerFillOpacity(hasSize, fillMarkers, hasSelection, !1)
|
27866 | };
|
27867 | }, ScatterChart.getBubbleOpacity = function(d, hasSelection) {
|
27868 | return hasSelection && !d.selected ? ScatterChart.DimmedBubbleOpacity : ScatterChart.DefaultBubbleOpacity;
|
27869 | }, ScatterChart.prototype.onClearSelection = function() {
|
27870 | this.interactivityService && this.interactivityService.clearSelection();
|
27871 | }, ScatterChart.prototype.getSupportedCategoryAxisType = function() {
|
27872 | return visuals.axisType.scalar;
|
27873 | }, ScatterChart.sortBubbles = function(a, b) {
|
27874 | var diff = b.radius.sizeMeasure.values[b.radius.index] - a.radius.sizeMeasure.values[a.radius.index];
|
27875 | return 0 !== diff ? diff : b.identity.getKey().localeCompare(a.identity.getKey());
|
27876 | }, ScatterChart.BubbleRadius = 6, ScatterChart.DefaultBubbleOpacity = .85, ScatterChart.DimmedBubbleOpacity = .4,
|
27877 | ScatterChart.StrokeDarkenColorValue = 63.75, ScatterChart.dataLabelLayoutStartingOffset = 2,
|
27878 | ScatterChart.dataLabelLayoutOffsetIterationDelta = 6, ScatterChart.dataLabelLayoutMaximumOffset = ScatterChart.dataLabelLayoutStartingOffset + 2 * ScatterChart.dataLabelLayoutOffsetIterationDelta,
|
27879 | ScatterChart.AreaOf300By300Chart = 9e4, ScatterChart.MinSizeRange = 200, ScatterChart.MaxSizeRange = 3e3,
|
27880 | ScatterChart.ClassName = "scatterChart", ScatterChart.NoAnimationThreshold = 1e3,
|
27881 | ScatterChart.NoRenderResizeThreshold = 1e3, ScatterChart;
|
27882 | }();
|
27883 | visuals.ScatterChart = ScatterChart;
|
27884 | var ScatterChartDataLabels, SvgRenderer = function() {
|
27885 | function SvgRenderer() {}
|
27886 | return SvgRenderer.prototype.init = function(element, labelsContext, isMobileChart, tooltipsEnabled) {
|
27887 | this.mainGraphicsG = element.append("g").classed(SvgRenderer.MainGraphicsContext["class"], !0),
|
27888 | this.isMobileChart = isMobileChart, isMobileChart && (this.mainGraphicsBackgroundRect = this.mainGraphicsG.append("rect").classed("backgroundRect", !0).attr({
|
27889 | width: "100%",
|
27890 | height: "100%"
|
27891 | })), this.mainGraphicsContext = this.mainGraphicsG.append("svg"), this.labelGraphicsContext = labelsContext,
|
27892 | this.tooltipsEnabled = tooltipsEnabled, this.mainGraphicsContext.attr("stroke-width", "1");
|
27893 | }, SvgRenderer.prototype.render = function(viewModel, interactivityService) {
|
27894 | var viewport = viewModel.viewport;
|
27895 | this.mainGraphicsContext.attr({
|
27896 | width: viewport.width,
|
27897 | height: viewport.height
|
27898 | });
|
27899 | var scatterMarkers;
|
27900 | return scatterMarkers = viewModel.suppressDataPointRendering ? this.removeScatterMarkers() : viewModel.animationDuration > 0 ? this.drawScatterMarkers(viewModel) : this.drawScatterMarkersNoAnimation(viewModel, viewModel.drawBubbles),
|
27901 | viewModel.drawBubbles && scatterMarkers.order(), this.tooltipsEnabled && visuals.TooltipManager.addTooltip(this.mainGraphicsContext, function(tooltipEvent) {
|
27902 | return tooltipEvent.data.tooltipInfo;
|
27903 | }), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(viewModel.animationOptions), {
|
27904 | dataPointsSelection: scatterMarkers,
|
27905 | eventGroup: this.mainGraphicsG,
|
27906 | data: viewModel.data,
|
27907 | plotContext: this.mainGraphicsContext
|
27908 | };
|
27909 | }, SvgRenderer.prototype.createTraceLineRenderer = function(viewModel) {
|
27910 | return new ScatterTraceLineRenderer(viewModel, this.mainGraphicsContext, this.tooltipsEnabled);
|
27911 | }, SvgRenderer.prototype.removeScatterMarkers = function() {
|
27912 | return this.mainGraphicsContext.selectAll(SvgRenderer.ScatterMarkerSeriesGroup.selector).remove(),
|
27913 | this.mainGraphicsContext.selectAll(SvgRenderer.DotClass.selector);
|
27914 | }, SvgRenderer.prototype.drawScatterMarkers = function(viewModel) {
|
27915 | var data = viewModel.data, xScale = viewModel.xAxisProperties.scale, yScale = viewModel.yAxisProperties.scale, fakeDataPointSeries = [ {
|
27916 | identityKey: "",
|
27917 | dataPoints: data.dataPoints
|
27918 | } ], fakeSeriesGroups = this.mainGraphicsContext.selectAll(SvgRenderer.ScatterMarkerSeriesGroup.selector).data(fakeDataPointSeries, function(s) {
|
27919 | return s.identityKey;
|
27920 | });
|
27921 | fakeSeriesGroups.enter().append("g").classed(SvgRenderer.ScatterMarkerSeriesGroup["class"], !0),
|
27922 | fakeSeriesGroups.exit().remove();
|
27923 | var markers = fakeSeriesGroups.selectAll(SvgRenderer.DotClass.selector).data(function(s) {
|
27924 | return s.dataPoints;
|
27925 | }, function(d) {
|
27926 | return d.identity.getKey();
|
27927 | });
|
27928 | return markers.enter().append("circle").classed(SvgRenderer.DotClass["class"], !0).style("opacity", 0).attr("r", 0),
|
27929 | markers.style({
|
27930 | "stroke-opacity": function(d) {
|
27931 | return ScatterChart.getMarkerStrokeOpacity(null != d.size, data.colorBorder, viewModel.hasSelection, d.selected);
|
27932 | },
|
27933 | stroke: function(d) {
|
27934 | return ScatterChart.getStrokeFill(d, data.colorBorder);
|
27935 | },
|
27936 | fill: function(d) {
|
27937 | return d.fill;
|
27938 | },
|
27939 | "fill-opacity": function(d) {
|
27940 | return ScatterChart.getMarkerFillOpacity(null != d.size, viewModel.fillMarkers, viewModel.hasSelection, d.selected);
|
27941 | }
|
27942 | }).transition().ease(viewModel.easeType).duration(viewModel.animationDuration).style("opacity", 1).attr({
|
27943 | r: function(d) {
|
27944 | return ScatterChart.getBubbleRadius(d.radius, data.sizeRange, viewModel.viewport);
|
27945 | },
|
27946 | cx: function(d) {
|
27947 | return xScale(d.x);
|
27948 | },
|
27949 | cy: function(d) {
|
27950 | return yScale(d.y);
|
27951 | }
|
27952 | }), markers.exit().transition().ease(viewModel.easeType).duration(viewModel.animationDuration).style("opacity", 0).attr("r", 0).remove(),
|
27953 | markers;
|
27954 | }, SvgRenderer.prototype.drawScatterMarkersNoAnimation = function(viewModel, isBubble) {
|
27955 | var seriesGroups, data = viewModel.data, xScale = viewModel.xAxisProperties.scale, yScale = viewModel.yAxisProperties.scale;
|
27956 | if (isBubble) {
|
27957 | var fakeDataPointSeries = [ {
|
27958 | identityKey: "",
|
27959 | dataPoints: data.dataPoints
|
27960 | } ];
|
27961 | seriesGroups = this.mainGraphicsContext.selectAll(SvgRenderer.ScatterMarkerSeriesGroup.selector).data(fakeDataPointSeries, function(s) {
|
27962 | return s.identityKey;
|
27963 | });
|
27964 | } else seriesGroups = this.mainGraphicsContext.selectAll(SvgRenderer.ScatterMarkerSeriesGroup.selector).data(data.dataPointSeries, function(s) {
|
27965 | return s.identityKey;
|
27966 | });
|
27967 | return seriesGroups.enter().append("g").classed(SvgRenderer.ScatterMarkerSeriesGroup["class"], !0),
|
27968 | seriesGroups.exit().remove(), seriesGroups.each(function(s) {
|
27969 | var seriesStyle = ScatterChart.getSeriesStyle(s.hasSize, data.colorBorder, viewModel.hasSelection, viewModel.fillMarkers, s.fill), g = d3.select(this);
|
27970 | SvgRenderer.applyStyle(this, seriesStyle);
|
27971 | var markers = g.selectAll(SvgRenderer.DotClass.selector).data(s.dataPoints, function(m) {
|
27972 | return m.identity.getKey();
|
27973 | });
|
27974 | markers.interrupt(), markers.enter().append("circle").classed(SvgRenderer.DotClass["class"], !0),
|
27975 | markers.exit().remove(), markers.each(function(d) {
|
27976 | var style = ScatterChart.getMarkerStyle(d, data.colorBorder, viewModel.hasSelection, viewModel.fillMarkers);
|
27977 | SvgRenderer.styleException(style, seriesStyle), SvgRenderer.applyStyle(this, style);
|
27978 | }), markers.attr({
|
27979 | r: function(d) {
|
27980 | return ScatterChart.getBubbleRadius(d.radius, data.sizeRange, viewModel.viewport);
|
27981 | },
|
27982 | cx: function(d) {
|
27983 | return xScale(d.x);
|
27984 | },
|
27985 | cy: function(d) {
|
27986 | return yScale(d.y);
|
27987 | }
|
27988 | });
|
27989 | }), this.mainGraphicsContext.selectAll(SvgRenderer.DotClass.selector);
|
27990 | }, SvgRenderer.styleException = function(elementStyle, seriesStyle) {
|
27991 | if (seriesStyle) for (var name_1 in elementStyle) elementStyle[name_1] === seriesStyle[name_1] && (elementStyle[name_1] = null);
|
27992 | }, SvgRenderer.applyStyle = function(element, style) {
|
27993 | for (var name_2 in style) {
|
27994 | var elementValue = element.style[name_2], styleValue = style[name_2];
|
27995 | if (null == styleValue) {
|
27996 | if ("" === elementValue) continue;
|
27997 | } else if (styleValue = styleValue.toString(), styleValue === elementValue) continue;
|
27998 | element.style[name_2] = styleValue;
|
27999 | }
|
28000 | }, SvgRenderer.DotClass = createClassAndSelector("dot"), SvgRenderer.MainGraphicsContext = createClassAndSelector("mainGraphicsContext"),
|
28001 | SvgRenderer.ScatterMarkerSeriesGroup = createClassAndSelector("scatterMarkerSeriesGroup"),
|
28002 | SvgRenderer;
|
28003 | }();
|
28004 | !function(ScatterChartDataLabels) {
|
28005 | function createLabelDataPoints(viewModel) {
|
28006 | for (var xScale = viewModel.xAxisProperties.scale, yScale = viewModel.yAxisProperties.scale, sizeRange = viewModel.data.sizeRange, labelDataPoints = [], dataPoints = viewModel.data.dataPoints, labelSettings = viewModel.data.dataLabelsSettings, preferredLabelsKeys = getPreferredLabelsKeys(viewModel), _i = 0, dataPoints_1 = dataPoints; _i < dataPoints_1.length; _i++) {
|
28007 | var dataPoint = dataPoints_1[_i], text = dataPoint.formattedCategory.getValue(), properties = {
|
28008 | text: text,
|
28009 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
28010 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt),
|
28011 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
28012 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties);
|
28013 | labelDataPoints.push({
|
28014 | isPreferred: preferredLabelsKeys ? isLabelPreferred(dataPoint.identity.getKey(), preferredLabelsKeys) : !1,
|
28015 | text: text,
|
28016 | textSize: {
|
28017 | width: textWidth,
|
28018 | height: textHeight
|
28019 | },
|
28020 | outsideFill: labelSettings.labelColor ? labelSettings.labelColor : visuals.NewDataLabelUtils.defaultLabelColor,
|
28021 | insideFill: visuals.NewDataLabelUtils.defaultInsideLabelColor,
|
28022 | parentType: 0,
|
28023 | parentShape: {
|
28024 | point: {
|
28025 | x: xScale(dataPoint.x),
|
28026 | y: yScale(dataPoint.y)
|
28027 | },
|
28028 | radius: ScatterChart.getBubbleRadius(dataPoint.radius, sizeRange, viewModel.viewport),
|
28029 | validPositions: validLabelPositions
|
28030 | },
|
28031 | identity: dataPoint.identity,
|
28032 | fontSize: labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt
|
28033 | });
|
28034 | }
|
28035 | return labelDataPoints;
|
28036 | }
|
28037 | function getPreferredLabelsKeys(viewModel) {
|
28038 | var width = viewModel.viewport.width, height = viewModel.viewport.height, visualCenter = new visuals.Point(width / 2, height / 2), quadrantsCenters = getQuadrantsCenters(width, height);
|
28039 | return getCandidateLabels(visualCenter, quadrantsCenters, viewModel);
|
28040 | }
|
28041 | function getQuadrantsCenters(visualWidth, visualHeight) {
|
28042 | var quadrantsCenters = [], quarterWidth = visualWidth / 4, quarterHeight = visualHeight / 4;
|
28043 | return quadrantsCenters.push(new visuals.Point(quarterWidth, quarterHeight)), quadrantsCenters.push(new visuals.Point(3 * quarterWidth, quarterHeight)),
|
28044 | quadrantsCenters.push(new visuals.Point(quarterWidth, 3 * quarterHeight)), quadrantsCenters.push(new visuals.Point(3 * quarterWidth, 3 * quarterHeight)),
|
28045 | quadrantsCenters;
|
28046 | }
|
28047 | function getCandidateLabels(visualCenter, quadrantsCenters, viewModel) {
|
28048 | for (var distance, minDistances = [ Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE ], ids = [], xScale = viewModel.xAxisProperties.scale, yScale = viewModel.yAxisProperties.scale, _i = 0, _a = viewModel.data.dataPoints; _i < _a.length; _i++) {
|
28049 | var dp = _a[_i], x = xScale(dp.x), y = yScale(dp.y), quadrantNumber = getPointQuadrantNumber(x, y, visualCenter);
|
28050 | viewModel.drawBubbles ? ids[quadrantNumber] || (ids[quadrantNumber] = dp.identity) : (distance = getDistanceBetweenPoints(quadrantsCenters[quadrantNumber].x, quadrantsCenters[quadrantNumber].y, x, y),
|
28051 | distance < minDistances[quadrantNumber] && (ids[quadrantNumber] = dp.identity, minDistances[quadrantNumber] = distance));
|
28052 | }
|
28053 | for (var preferredLabelsKeys = [], _b = 0, ids_1 = ids; _b < ids_1.length; _b++) {
|
28054 | var id = ids_1[_b];
|
28055 | id && preferredLabelsKeys.push(id.getKey());
|
28056 | }
|
28057 | return preferredLabelsKeys;
|
28058 | }
|
28059 | function getPointQuadrantNumber(x, y, centerPoint) {
|
28060 | return x > centerPoint.x && y <= centerPoint.y ? 0 : x <= centerPoint.x && y <= centerPoint.y ? 1 : x <= centerPoint.x && y > centerPoint.y ? 2 : 3;
|
28061 | }
|
28062 | function getDistanceBetweenPoints(x1, y1, x2, y2) {
|
28063 | return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
|
28064 | }
|
28065 | function isLabelPreferred(key, preferredLabelsKeys) {
|
28066 | for (var _i = 0, preferredLabelsKeys_1 = preferredLabelsKeys; _i < preferredLabelsKeys_1.length; _i++) {
|
28067 | var preferredLabel = preferredLabelsKeys_1[_i];
|
28068 | if (0 === key.localeCompare(preferredLabel)) return !0;
|
28069 | }
|
28070 | return !1;
|
28071 | }
|
28072 | var validLabelPositions = [ 2, 1, 8, 4, 16, 32, 64, 128 ];
|
28073 | ScatterChartDataLabels.createLabelDataPoints = createLabelDataPoints;
|
28074 | }(ScatterChartDataLabels || (ScatterChartDataLabels = {}));
|
28075 | var ScatterTraceLineRenderer = function() {
|
28076 | function ScatterTraceLineRenderer(viewModel, element, tooltipsEnabled) {
|
28077 | this.viewModel = viewModel, this.element = element, this.tooltipsEnabled = tooltipsEnabled;
|
28078 | }
|
28079 | return ScatterTraceLineRenderer.prototype.remove = function() {
|
28080 | this.element.selectAll(ScatterTraceLineRenderer.TraceLine.selector).remove(), this.element.selectAll(ScatterTraceLineRenderer.TraceBubble.selector).remove();
|
28081 | }, ScatterTraceLineRenderer.prototype.render = function(selectedPoints, shouldAnimate) {
|
28082 | var viewModel = this.viewModel, scatterViewModel = viewModel.viewModel, seriesPoints = [];
|
28083 | if (_.isEmpty(selectedPoints) || scatterViewModel.suppressDataPointRendering) this.remove(); else {
|
28084 | for (var currentFrameIndex_1 = viewModel.data.currentFrameIndex, hasBubbleAtCurrentFrame = [], selectedIndex = 0, selectedLen = selectedPoints.length; selectedLen > selectedIndex; selectedIndex++) {
|
28085 | seriesPoints[selectedIndex] = [], hasBubbleAtCurrentFrame[selectedIndex] = !1;
|
28086 | for (var frameIndex = 0, frameLen = viewModel.data.allViewModels.length; frameLen > frameIndex && currentFrameIndex_1 >= frameIndex; frameIndex++) {
|
28087 | var value = _.find(viewModel.data.allViewModels[frameIndex].dataPoints, function(value, index) {
|
28088 | return value.identity.getKey() === selectedPoints[selectedIndex].identity.getKey();
|
28089 | });
|
28090 | null != value && (value.frameIndex = frameIndex, seriesPoints[selectedIndex].push(value),
|
28091 | frameIndex === currentFrameIndex_1 && (hasBubbleAtCurrentFrame[selectedIndex] = !0));
|
28092 | }
|
28093 | }
|
28094 | var xScale_1 = scatterViewModel.xAxisProperties.scale, yScale_1 = scatterViewModel.yAxisProperties.scale, line_1 = d3.svg.line().x(function(d) {
|
28095 | return xScale_1(d.x);
|
28096 | }).y(function(d) {
|
28097 | return yScale_1(d.y);
|
28098 | }).defined(function(d) {
|
28099 | return null !== d.x && null !== d.y;
|
28100 | }), traceLines = this.element.selectAll(ScatterTraceLineRenderer.TraceLine.selector).data(selectedPoints, function(sp) {
|
28101 | return sp.identity.getKey();
|
28102 | });
|
28103 | traceLines.enter().append("path").classed(ScatterTraceLineRenderer.TraceLine["class"], !0);
|
28104 | var previousLengths_1 = [], newLengths_1 = [], reverse_1 = !1;
|
28105 | traceLines.each(function(d, i) {
|
28106 | var existingPath = this, previousLength = existingPath.hasAttribute("d") ? existingPath.getTotalLength() : 0;
|
28107 | previousLengths_1.push(previousLength);
|
28108 | var tempSvgPath = $("<svg><path></path></svg>"), tempPath = $("path", tempSvgPath);
|
28109 | tempPath.attr("d", line_1(seriesPoints[i]));
|
28110 | var newLength = seriesPoints[i].length > 0 ? tempPath.get()[0].getTotalLength() : 0;
|
28111 | newLengths_1.push(newLength), reverse_1 = reverse_1 || previousLength > newLength;
|
28112 | }), reverse_1 ? shouldAnimate ? traceLines.transition().ease("linear").duration(visuals.PlayChart.FrameAnimationDuration).attr("stroke-dashoffset", function(d, i) {
|
28113 | return previousLengths_1[i] - newLengths_1[i];
|
28114 | }).transition().ease("linear").duration(1).delay(visuals.PlayChart.FrameAnimationDuration).style("stroke", function(d) {
|
28115 | return ScatterChart.getStrokeFill(d, !0);
|
28116 | }).attr({
|
28117 | d: function(d, i) {
|
28118 | return line_1(seriesPoints[i]);
|
28119 | },
|
28120 | "stroke-dasharray": function(d, i) {
|
28121 | return newLengths_1[i] + " " + newLengths_1[i];
|
28122 | },
|
28123 | "stroke-dashoffset": 0
|
28124 | }) : traceLines.style("stroke", function(d) {
|
28125 | return ScatterChart.getStrokeFill(d, !0);
|
28126 | }).attr({
|
28127 | d: function(d, i) {
|
28128 | return line_1(seriesPoints[i]);
|
28129 | },
|
28130 | "stroke-dasharray": function(d, i) {
|
28131 | return newLengths_1[i] + " " + newLengths_1[i];
|
28132 | },
|
28133 | "stroke-dashoffset": 0
|
28134 | }) : (traceLines.style("stroke", function(d) {
|
28135 | return ScatterChart.getStrokeFill(d, !0);
|
28136 | }).attr({
|
28137 | d: function(d, i) {
|
28138 | return line_1(seriesPoints[i]);
|
28139 | },
|
28140 | "stroke-dasharray": function(d, i) {
|
28141 | return newLengths_1[i] + " " + newLengths_1[i];
|
28142 | },
|
28143 | "stroke-dashoffset": function(d, i) {
|
28144 | return newLengths_1[i] - previousLengths_1[i];
|
28145 | }
|
28146 | }), shouldAnimate ? traceLines.transition().ease("linear").duration(visuals.PlayChart.FrameAnimationDuration).attr("stroke-dashoffset", 0) : traceLines.attr("stroke-dashoffset", 0)),
|
28147 | traceLines.exit().remove();
|
28148 | for (var circlePoints = [], selectedIndex_1 = 0; selectedIndex_1 < seriesPoints.length; selectedIndex_1++) {
|
28149 | var points = seriesPoints[selectedIndex_1], newPoints = hasBubbleAtCurrentFrame[selectedIndex_1] ? points.slice(0, points.length - 1) : points;
|
28150 | circlePoints = circlePoints.concat(newPoints);
|
28151 | }
|
28152 | var circles = this.element.selectAll(ScatterTraceLineRenderer.TraceBubble.selector).data(circlePoints, function(d) {
|
28153 | return d.identity.getKey() + d.x + d.y + d.size;
|
28154 | });
|
28155 | circles.enter().append("circle").style("opacity", 0).classed(ScatterTraceLineRenderer.TraceBubble["class"], !0),
|
28156 | circles.attr("cx", function(d) {
|
28157 | return xScale_1(d.x);
|
28158 | }).attr("cy", function(d) {
|
28159 | return yScale_1(d.y);
|
28160 | }).attr("r", function(d) {
|
28161 | return ScatterChart.getBubbleRadius(d.radius, viewModel.data.currentViewModel.sizeRange, viewModel.viewport);
|
28162 | }).style({
|
28163 | "stroke-opacity": function(d) {
|
28164 | return ScatterChart.getBubbleOpacity(d, !0);
|
28165 | },
|
28166 | stroke: function(d) {
|
28167 | return ScatterChart.getStrokeFill(d, viewModel.data.currentViewModel.colorBorder);
|
28168 | },
|
28169 | fill: function(d) {
|
28170 | return d.fill;
|
28171 | },
|
28172 | "fill-opacity": function(d) {
|
28173 | return null != d.size ? .2 + d.frameIndex / currentFrameIndex_1 * .6 : 0;
|
28174 | }
|
28175 | }).transition().ease("linear").duration(visuals.PlayChart.FrameAnimationDuration).style("opacity", 1),
|
28176 | circles.exit().transition().ease("linear").duration(visuals.PlayChart.FrameAnimationDuration).style("opacity", 0).remove(),
|
28177 | this.tooltipsEnabled && visuals.TooltipManager.addTooltip(circles, function(tooltipEvent) {
|
28178 | return tooltipEvent.data.tooltipInfo;
|
28179 | }), circles.sort(function(d1, d2) {
|
28180 | return d2.size - d1.size;
|
28181 | });
|
28182 | }
|
28183 | }, ScatterTraceLineRenderer.TraceLine = createClassAndSelector("traceLine"), ScatterTraceLineRenderer.TraceBubble = createClassAndSelector("traceBubble"),
|
28184 | ScatterTraceLineRenderer;
|
28185 | }();
|
28186 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
28187 | }(powerbi || (powerbi = {}));
|
28188 | }, function(module, exports) {
|
28189 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
28190 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
28191 | !function(powerbi) {
|
28192 | var visuals;
|
28193 | !function(visuals) {
|
28194 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, createDataViewScopeIdentity = powerbi.data.createDataViewScopeIdentity, DataViewConcatenateCategoricalColumns = powerbi.data.DataViewConcatenateCategoricalColumns, DataViewMatrixUtils = powerbi.data.DataViewMatrixUtils, SQExprBuilder = powerbi.data.SQExprBuilder, PlayAxis = function() {
|
28195 | function PlayAxis(options) {
|
28196 | options && (this.interactivityService = options.interactivityService);
|
28197 | }
|
28198 | return PlayAxis.prototype.init = function(options) {
|
28199 | var _this = this;
|
28200 | this.element = options.element, this.svg = options.svg, this.host = options.host,
|
28201 | this.isMobileChart = options.interactivity && options.interactivity.isInteractiveLegend,
|
28202 | this.interactivityService && (this.playControl = new PlayControl(this.element, function(frameIndex) {
|
28203 | return _this.moveToFrameAndRender(frameIndex);
|
28204 | }, this.isMobileChart), this.playControl.onPlay(function() {
|
28205 | return _this.play();
|
28206 | }));
|
28207 | }, PlayAxis.prototype.setData = function(dataView, visualConverter) {
|
28208 | if (dataView) {
|
28209 | if (this.ridiculousFlagForPersistProperties && dataView.metadata) return this.ridiculousFlagForPersistProperties = !1,
|
28210 | this.playData;
|
28211 | dataView.matrix || dataView.categorical ? this.playData = PlayChart.converter(dataView, visualConverter) : this.playData = PlayChart.getDefaultPlayData();
|
28212 | } else this.playData = PlayChart.getDefaultPlayData();
|
28213 | return this.lastViewport = void 0, this.playData;
|
28214 | }, PlayAxis.prototype.render = function(suppressAnimations, viewModel, viewport, margin) {
|
28215 | var playData = this.playData, resized = !this.lastViewport || this.lastViewport.height !== viewport.height || this.lastViewport.width !== viewport.width;
|
28216 | if (this.lastViewport = viewport, resized && this.stop(), playData) {
|
28217 | var playViewModel = {
|
28218 | data: this.playData,
|
28219 | viewModel: viewModel,
|
28220 | viewport: viewport
|
28221 | }, hasSelection = !1;
|
28222 | if (this.interactivityService) {
|
28223 | var data_1 = playData.currentViewModel;
|
28224 | this.interactivityService.applySelectionStateToData(data_1.dataPoints), hasSelection = this.interactivityService.hasSelection();
|
28225 | }
|
28226 | this.updateCallout(viewport, margin), this.playControl && resized && this.playControl.rebuild(playData, viewport);
|
28227 | var allDataPoints = playData.allViewModels.map(function(vm) {
|
28228 | return vm.dataPoints;
|
28229 | }), flatAllDataPoints = _.flatten(allDataPoints);
|
28230 | return {
|
28231 | allDataPoints: flatAllDataPoints,
|
28232 | viewModel: playViewModel
|
28233 | };
|
28234 | }
|
28235 | }, PlayAxis.prototype.updateCallout = function(viewport, margin) {
|
28236 | var playData = this.playData, frameData = playData.frameData, currentFrameIndex = playData.currentFrameIndex, height = viewport.height, plotAreaHeight = height - margin.top - margin.bottom, width = viewport.width, plotAreaWidth = width - margin.left - margin.right, calloutDimension = Math.min(height, 1.3 * width), fontSize = Math.max(12, Math.round(calloutDimension / 7));
|
28237 | fontSize = Math.min(fontSize, 70);
|
28238 | var textProperties = {
|
28239 | fontSize: jsCommon.PixelConverter.toString(fontSize),
|
28240 | text: frameData[currentFrameIndex].text || "",
|
28241 | fontFamily: visuals.Font.Family.regular.css
|
28242 | }, textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(textProperties) - powerbi.TextMeasurementService.estimateSvgTextBaselineDelta(textProperties), calloutData = [];
|
28243 | if (currentFrameIndex < frameData.length && currentFrameIndex >= 0 && plotAreaHeight > textHeight) {
|
28244 | var maxTextWidth = plotAreaWidth - 2 * PlayAxis.calloutOffsetMultiplier * textHeight, calloutText = powerbi.TextMeasurementService.getTailoredTextOrDefault(textProperties, maxTextWidth);
|
28245 | calloutData = [ calloutText ];
|
28246 | }
|
28247 | var callout = this.svg.selectAll(PlayAxis.PlayCallout.selector).data(calloutData);
|
28248 | callout.enter().append("text").classed(PlayAxis.PlayCallout["class"], !0), callout.text(function(d) {
|
28249 | return d;
|
28250 | }).attr({
|
28251 | x: plotAreaWidth - PlayAxis.calloutOffsetMultiplier * textHeight,
|
28252 | y: function() {
|
28253 | return textHeight;
|
28254 | }
|
28255 | }).style({
|
28256 | "font-size": fontSize + "px",
|
28257 | "text-anchor": "end"
|
28258 | }), callout.exit().remove();
|
28259 | }, PlayAxis.prototype.play = function() {
|
28260 | var playData = this.playData;
|
28261 | if (this.isPlaying) this.stop(); else if (this.playControl) {
|
28262 | this.isPlaying = !0, this.playControl.play();
|
28263 | var indexToShow = Math.round(this.playControl.getCurrentIndex());
|
28264 | indexToShow >= playData.allViewModels.length - 1 ? playData.currentFrameIndex = -1 : playData.currentFrameIndex = indexToShow - 1,
|
28265 | this.playNextFrame(playData);
|
28266 | }
|
28267 | }, PlayAxis.prototype.playNextFrame = function(playData, startFrame, endFrame) {
|
28268 | var _this = this;
|
28269 | if (!this.isPlaying) return void this.stop();
|
28270 | var nextFrame = playData.currentFrameIndex + 1;
|
28271 | null != startFrame && null != endFrame && (nextFrame = Math.abs(endFrame - startFrame + 1),
|
28272 | startFrame = nextFrame), nextFrame < playData.allViewModels.length && nextFrame > -1 ? (playData.currentFrameIndex = nextFrame,
|
28273 | playData.currentViewModel = playData.allViewModels[nextFrame], this.renderDelegate(playData.currentViewModel),
|
28274 | this.playControl.setFrame(nextFrame), nextFrame < playData.allViewModels.length && window.setTimeout(function() {
|
28275 | _this.playNextFrame(playData, startFrame, endFrame);
|
28276 | }, PlayChart.FrameStepDuration)) : this.stop();
|
28277 | }, PlayAxis.prototype.stop = function() {
|
28278 | this.playControl && this.playControl.pause(), this.isPlaying = !1;
|
28279 | }, PlayAxis.prototype.remove = function() {
|
28280 | this.playControl && this.playControl.remove(), d3.selectAll(PlayAxis.PlayCallout.selector).remove();
|
28281 | }, PlayAxis.prototype.setRenderFunction = function(fn) {
|
28282 | this.renderDelegate = fn;
|
28283 | }, PlayAxis.prototype.getCartesianExtents = function(existingExtents, getExtents) {
|
28284 | return this.playData && this.playData.allViewModels && this.playData.allViewModels.length > 0 ? PlayChart.getMinMaxForAllFrames(this.playData, getExtents) : existingExtents;
|
28285 | }, PlayAxis.prototype.setPlayControlPosition = function(playControlLayout) {
|
28286 | if (this.playControl) {
|
28287 | var container = this.playControl.getContainer();
|
28288 | container.css("left", playControlLayout.left ? playControlLayout.left + "px" : ""),
|
28289 | container.css("top", playControlLayout.top ? playControlLayout.top + "px" : "");
|
28290 | }
|
28291 | }, PlayAxis.prototype.moveToFrameAndRender = function(frameIndex) {
|
28292 | var playData = this.playData;
|
28293 | if (this.isPlaying = !0, playData && frameIndex >= 0 && frameIndex < playData.allViewModels.length && frameIndex !== playData.currentFrameIndex) {
|
28294 | playData.currentFrameIndex = frameIndex;
|
28295 | var data_2 = playData.allViewModels[frameIndex];
|
28296 | playData.currentViewModel = data_2, this.renderDelegate(data_2);
|
28297 | }
|
28298 | this.isPlaying = !1;
|
28299 | }, PlayAxis.prototype.isCurrentlyPlaying = function() {
|
28300 | return this.isPlaying;
|
28301 | }, PlayAxis.PlayCallout = createClassAndSelector("play-callout"), PlayAxis.calloutOffsetMultiplier = .3,
|
28302 | PlayAxis;
|
28303 | }();
|
28304 | visuals.PlayAxis = PlayAxis;
|
28305 | var PlayChart, PlayControl = function() {
|
28306 | function PlayControl(element, renderDelegate, isMobileChart) {
|
28307 | this.isMobileChart = isMobileChart, this.createSliderDOM(element), this.renderDelegate = renderDelegate;
|
28308 | }
|
28309 | return PlayControl.prototype.getContainer = function() {
|
28310 | return this.playAxisContainer;
|
28311 | }, PlayControl.prototype.remove = function() {
|
28312 | this.playAxisContainer && this.playAxisContainer.remove();
|
28313 | }, PlayControl.prototype.pause = function() {
|
28314 | this.playButton.removeClass("pause").addClass("play");
|
28315 | }, PlayControl.prototype.play = function() {
|
28316 | this.playButton.removeClass("play").addClass("pause");
|
28317 | }, PlayControl.prototype.getCurrentIndex = function() {
|
28318 | return Math.round(this.noUiSlider.get());
|
28319 | }, PlayControl.prototype.onPlay = function(handler) {
|
28320 | this.playButtonCircle.off("click"), this.playButtonCircle.on("click", handler);
|
28321 | }, PlayControl.prototype.setFrame = function(frameIndex) {
|
28322 | this.noUiSlider.set([ frameIndex ]);
|
28323 | }, PlayControl.prototype.rebuild = function(playData, viewport) {
|
28324 | var _this = this, slider = this.slider;
|
28325 | this.noUiSlider && this.noUiSlider.destroy();
|
28326 | var labelData = playData.labelData, sliderSize = PlayControl.calucalateSliderSize(labelData, viewport.width), container = this.getContainer();
|
28327 | sliderSize.marginLeft > PlayControl.SliderMarginLeft && (container.css("padding-left", sliderSize.marginLeft - PlayControl.SliderMarginLeft + "px"),
|
28328 | container.css("box-sizing", "border-box"));
|
28329 | var skipStep = this.updateSliderControl(playData, sliderSize.width), width = PlayControl.adjustWidthRegardingLastItem(labelData, skipStep, sliderSize.width);
|
28330 | this.slider.css("width", width + "px"), this.noUiSlider.on("slide", function() {
|
28331 | var indexToShow = _this.getCurrentIndex();
|
28332 | _this.renderDelegate(indexToShow);
|
28333 | });
|
28334 | var nextLabelIndex = 0;
|
28335 | $(".noUi-value", slider).each(function(idx, elem) {
|
28336 | var actualWidth = labelData.labelInfo[nextLabelIndex].labelWidth;
|
28337 | $(elem).width(actualWidth), $(elem).css("margin-left", -actualWidth / 2 + "px"),
|
28338 | nextLabelIndex += skipStep;
|
28339 | });
|
28340 | }, PlayControl.prototype.updateSliderControl = function(playData, sliderWidth) {
|
28341 | var labelData = playData.labelData, sliderElement = this.slider.get(0), numFrames = playData.frameData.length, options = {
|
28342 | start: 0 === numFrames ? 0 : playData.currentFrameIndex,
|
28343 | step: 1,
|
28344 | range: {
|
28345 | min: 0,
|
28346 | max: 0 === numFrames ? 0 : numFrames - 1
|
28347 | }
|
28348 | }, pipOptions = null, skipMode = 0;
|
28349 | if (numFrames > 0) {
|
28350 | var filterPipLabels = PlayControl.createPipsFilterFn(playData, sliderWidth, labelData);
|
28351 | skipMode = filterPipLabels.skipStep, pipOptions = {
|
28352 | mode: "steps",
|
28353 | density: Math.ceil(100 / numFrames),
|
28354 | format: {
|
28355 | to: function(index) {
|
28356 | return playData.frameData[index].escapedText;
|
28357 | },
|
28358 | from: function(value) {
|
28359 | return playData.frameData.indexOf(value);
|
28360 | }
|
28361 | },
|
28362 | filter: filterPipLabels.filter
|
28363 | };
|
28364 | }
|
28365 | return options.pips = pipOptions, noUiSlider.create(sliderElement, options), this.noUiSlider = sliderElement.noUiSlider,
|
28366 | skipMode;
|
28367 | }, PlayControl.createPipsFilterFn = function(playData, sliderWidth, labelData) {
|
28368 | var maxLabelWidth = _.max(_.map(labelData.labelInfo, function(l) {
|
28369 | return l.labelWidth;
|
28370 | })), pipSize = 1, skipMode = 1, maxAllowedLabelWidth = playData.frameData.length > 1 ? sliderWidth / (playData.frameData.length - 1) : sliderWidth, widthRatio = maxLabelWidth / maxAllowedLabelWidth;
|
28371 | widthRatio > 1.25 ? (skipMode = Math.ceil(widthRatio), pipSize = 2) : (widthRatio > 1 || labelData.anyWordBreaks) && (pipSize = 2);
|
28372 | var filterPipLabels = function(index, type) {
|
28373 | return index % skipMode === 0 ? pipSize : 0;
|
28374 | };
|
28375 | return {
|
28376 | filter: filterPipLabels,
|
28377 | skipStep: skipMode
|
28378 | };
|
28379 | }, PlayControl.adjustWidthRegardingLastItem = function(labelData, skipMode, sliderWidth) {
|
28380 | var labelLenth = labelData.labelInfo.length, lastVisibleItemIndex = Math.floor((labelLenth - 1) / skipMode) * skipMode, distanceToEnd = sliderWidth + PlayControl.SliderMarginRight - sliderWidth / labelLenth * (lastVisibleItemIndex + 1), lastItemWidth = labelData.labelInfo[lastVisibleItemIndex].labelWidth, requiredWidth = lastItemWidth / 2 - distanceToEnd;
|
28381 | if (requiredWidth > 0) {
|
28382 | var maxMargin = PlayControl.SliderMaxMargin - PlayControl.SliderMarginRight;
|
28383 | return requiredWidth = requiredWidth > maxMargin ? maxMargin : requiredWidth, sliderWidth - requiredWidth;
|
28384 | }
|
28385 | return sliderWidth;
|
28386 | }, PlayControl.prototype.createSliderDOM = function(element) {
|
28387 | this.playAxisContainer = $('<div class="play-axis-container"></div>').appendTo(element).css("height", PlayControl.PlayControlHeight + "px"),
|
28388 | this.playButtonCircle = $('<div class="button-container"></div>').appendTo(this.playAxisContainer),
|
28389 | this.isMobileChart && this.playButtonCircle.addClass("mobile-button-container"),
|
28390 | this.playButton = $('<div class="play"></div>').appendTo(this.playButtonCircle),
|
28391 | this.slider = $('<div class="sliders"></div>').appendTo(this.playAxisContainer);
|
28392 | }, PlayControl.calucalateSliderSize = function(labelData, viewportWidth) {
|
28393 | var leftMargin = 0;
|
28394 | _.isEmpty(labelData.labelInfo) || (leftMargin = _.first(labelData.labelInfo).labelWidth / 2);
|
28395 | var sliderLeftMargin = Math.max(leftMargin, PlayControl.SliderMarginLeft);
|
28396 | sliderLeftMargin = Math.min(PlayControl.SliderMaxMargin, sliderLeftMargin);
|
28397 | var sliderWidth = Math.max(viewportWidth - sliderLeftMargin - PlayControl.SliderMarginRight, 1);
|
28398 | return {
|
28399 | width: sliderWidth,
|
28400 | marginLeft: sliderLeftMargin
|
28401 | };
|
28402 | }, PlayControl.SliderMarginLeft = 44, PlayControl.SliderMarginRight = 20, PlayControl.SliderMaxMargin = 100,
|
28403 | PlayControl.PlayControlHeight = 80, PlayControl;
|
28404 | }();
|
28405 | !function(PlayChart) {
|
28406 | function convertMatrixToCategorical(sourceDataView, frame) {
|
28407 | var matrix = sourceDataView.matrix, categorical = {
|
28408 | categories: [],
|
28409 | values: powerbi.data.DataViewTransform.createValueColumns()
|
28410 | };
|
28411 | if (_.isEmpty(matrix.columns.levels) || matrix.rows.levels.length < 2 && matrix.columns.levels.length < 2) return {
|
28412 | metadata: sourceDataView.metadata,
|
28413 | categorical: categorical
|
28414 | };
|
28415 | for (var CategoryRowLevelsStartingIndex = 1, categories = [], i_1 = CategoryRowLevelsStartingIndex, ilen = matrix.rows.levels.length; ilen > i_1; i_1++) {
|
28416 | var sourceColumn = matrix.rows.levels[i_1].sources[0];
|
28417 | categories.push({
|
28418 | source: sourceColumn,
|
28419 | values: [],
|
28420 | identity: [],
|
28421 | objects: void 0
|
28422 | });
|
28423 | }
|
28424 | var hasRowChildren = !_.isEmpty(matrix.rows.root.children), hasColChildren = !_.isEmpty(matrix.columns.root.children), hasSeries = matrix.columns.levels.length > 1 && hasColChildren, hasPlayAndCategory = matrix.rows.levels.length > 1 && hasRowChildren;
|
28425 | if (hasSeries && !hasPlayAndCategory) {
|
28426 | categorical.categories = void 0;
|
28427 | var node = matrix.columns.root;
|
28428 | categorical.values.source = matrix.columns.levels[0].sources[0];
|
28429 | for (var columnLength_1 = matrix.valueSources.length, i_2 = 0, len_1 = node.children.length; len_1 > i_2; i_2++) for (var columnNode = node.children[i_2], j = 0; columnLength_1 > j; j++) {
|
28430 | var source = _.create(matrix.valueSources[j], {
|
28431 | groupName: void 0 === columnNode.value ? null : columnNode.value
|
28432 | }), dataViewColumn = {
|
28433 | identity: columnNode.identity,
|
28434 | values: [],
|
28435 | source: source
|
28436 | };
|
28437 | categorical.values.push(dataViewColumn);
|
28438 | }
|
28439 | for (var playFrameNode = matrix.rows.root.children[frame], matrixIntersectionValues = playFrameNode.values, i = 0, len = node.children.length; len > i; i++) for (var j = 0; columnLength_1 > j; j++) categorical.values[i * columnLength_1 + j].values.push(matrixIntersectionValues[i * columnLength_1 + j].value);
|
28440 | } else if (hasSeries && hasRowChildren) {
|
28441 | var playFrameNode = matrix.rows.root.children[frame];
|
28442 | DataViewMatrixUtils.forEachLeafNode(playFrameNode.children, function(categoryGroupLeafNode, index, categoryHierarchicalGroupNodes) {
|
28443 | addMatrixHierarchicalGroupToCategories(categoryHierarchicalGroupNodes, categories);
|
28444 | }), categorical.categories = categories, categorical.values.source = matrix.columns.levels[0].sources[0];
|
28445 | for (var nodeQueue = [], columnNode = matrix.columns.root, seriesIndex_1 = -1; columnNode; ) {
|
28446 | if (columnNode.children && columnNode.children[0].children) for (var j = 0, jlen = columnNode.children.length; jlen > j; j++) nodeQueue.push(columnNode.children[j]); else if (columnNode.children && playFrameNode.children) {
|
28447 | for (var columnLength = columnNode.children.length, j = 0; columnLength > j; j++) {
|
28448 | var source = _.create(matrix.valueSources[j], {
|
28449 | groupName: columnNode.value
|
28450 | }), dataViewColumn = {
|
28451 | identity: columnNode.identity,
|
28452 | values: [],
|
28453 | source: source
|
28454 | };
|
28455 | categorical.values.push(dataViewColumn);
|
28456 | }
|
28457 | DataViewMatrixUtils.forEachLeafNode(playFrameNode.children, function(leafNode) {
|
28458 | for (var j = 0; columnLength > j; j++) categorical.values[seriesIndex_1 * columnLength + j].values.push(leafNode.values[seriesIndex_1 * columnLength + j].value);
|
28459 | });
|
28460 | }
|
28461 | nodeQueue.length > 0 ? (columnNode = nodeQueue[0], nodeQueue = nodeQueue.splice(1),
|
28462 | seriesIndex_1++) : columnNode = void 0;
|
28463 | }
|
28464 | } else if (hasPlayAndCategory) {
|
28465 | for (var playFrameNode = matrix.rows.root.children[frame], measureLength_1 = matrix.valueSources.length, j = 0; measureLength_1 > j; j++) {
|
28466 | var dataViewColumn = {
|
28467 | identity: void 0,
|
28468 | values: [],
|
28469 | source: matrix.valueSources[j]
|
28470 | };
|
28471 | categorical.values.push(dataViewColumn);
|
28472 | }
|
28473 | DataViewMatrixUtils.forEachLeafNode(playFrameNode.children, function(categoryGroupLeafNode, index, categoryHierarchicalGroupNodes) {
|
28474 | addMatrixHierarchicalGroupToCategories(categoryHierarchicalGroupNodes, categories);
|
28475 | for (var j = 0; measureLength_1 > j; j++) categorical.values[j].values.push(categoryGroupLeafNode.values[j].value);
|
28476 | }), categorical.categories = categories;
|
28477 | }
|
28478 | return DataViewConcatenateCategoricalColumns.applyToPlayChartCategorical(sourceDataView.metadata, visuals.scatterChartCapabilities.objects, "Category", categorical);
|
28479 | }
|
28480 | function addMatrixHierarchicalGroupToCategories(sourceCategoryHierarchicalGroupNodes, destinationCategories) {
|
28481 | var identity = sourceCategoryHierarchicalGroupNodes[0].identity;
|
28482 | if (sourceCategoryHierarchicalGroupNodes.length > 1) {
|
28483 | for (var identityExpr = identity.expr, i = 1, ilen = sourceCategoryHierarchicalGroupNodes.length; ilen > i; i++) {
|
28484 | var identityExprToAdd = sourceCategoryHierarchicalGroupNodes[i].identity.expr;
|
28485 | identityExpr = SQExprBuilder.and(identityExpr, identityExprToAdd);
|
28486 | }
|
28487 | identity = createDataViewScopeIdentity(identityExpr);
|
28488 | }
|
28489 | for (var j = 0, jlen = destinationCategories.length; jlen > j; j++) {
|
28490 | destinationCategories[j].identity.push(identity);
|
28491 | var node = sourceCategoryHierarchicalGroupNodes[j];
|
28492 | destinationCategories[j].values.push(node.value);
|
28493 | }
|
28494 | }
|
28495 | function getObjectProperties(dataViewMetadata, dataLabelsSettings) {
|
28496 | var objectProperties = {};
|
28497 | if (dataViewMetadata && dataViewMetadata.objects) {
|
28498 | var objects = dataViewMetadata.objects;
|
28499 | objectProperties.currentFrameIndex = powerbi.DataViewObjects.getValue(objects, visuals.scatterChartProps.currentFrameIndex.index, null);
|
28500 | }
|
28501 | return objectProperties;
|
28502 | }
|
28503 | function converter(dataView, visualConverter) {
|
28504 | var keySourceColumn, dataViewMetadata = dataView.metadata, dataLabelsSettings = visuals.dataLabelUtils.getDefaultPointLabelSettings(), objectProperties = getObjectProperties(dataViewMetadata, dataLabelsSettings), allViewModels = [], frameKeys = [], convertedData = void 0, matrixRows = dataView.matrix.rows, rowChildrenLength = matrixRows.root.children ? matrixRows.root.children.length : 0;
|
28505 | if (dataView.matrix && rowChildrenLength > 0 && !_.isEmpty(matrixRows.levels) && !_.isEmpty(matrixRows.levels[0].sources)) {
|
28506 | keySourceColumn = matrixRows.levels[0].sources[0];
|
28507 | var formatString = visuals.valueFormatter.getFormatString(keySourceColumn, visuals.scatterChartProps.general.formatString), keyFormatter = void 0;
|
28508 | if (keySourceColumn.type.numeric) {
|
28509 | var valueRange = Math.abs(matrixRows.root.children[rowChildrenLength - 1].value - matrixRows.root.children[0].value);
|
28510 | keyFormatter = visuals.valueFormatter.create({
|
28511 | format: formatString,
|
28512 | value: valueRange,
|
28513 | value2: 0
|
28514 | });
|
28515 | } else keyFormatter = visuals.valueFormatter.createDefaultFormatter(formatString, !0);
|
28516 | for (var i = 0, len = rowChildrenLength; len > i; i++) {
|
28517 | var key = matrixRows.root.children[i], frameLabelText = keyFormatter.format(key.value), frameLabelHtml = $("<div/>").text(frameLabelText).html();
|
28518 | frameKeys.push({
|
28519 | escapedText: frameLabelHtml,
|
28520 | text: frameLabelText
|
28521 | });
|
28522 | var dataViewCategorical = convertMatrixToCategorical(dataView, i), frameInfo = {
|
28523 | label: frameLabelHtml,
|
28524 | column: keySourceColumn
|
28525 | };
|
28526 | convertedData = visualConverter(dataViewCategorical, frameInfo), allViewModels.push(convertedData);
|
28527 | }
|
28528 | } else {
|
28529 | var dataViewCategorical = convertMatrixToCategorical(dataView, 0);
|
28530 | convertedData = visualConverter(dataViewCategorical), allViewModels.push(convertedData);
|
28531 | }
|
28532 | return objectProperties.currentFrameIndex = frameKeys.length - 1, {
|
28533 | allViewModels: allViewModels,
|
28534 | currentViewModel: convertedData,
|
28535 | frameData: frameKeys,
|
28536 | currentFrameIndex: objectProperties.currentFrameIndex,
|
28537 | labelData: getLabelData(frameKeys, keySourceColumn)
|
28538 | };
|
28539 | }
|
28540 | function getDefaultPlayData() {
|
28541 | var defaultData = {
|
28542 | frameData: [],
|
28543 | allViewModels: [],
|
28544 | currentFrameIndex: 0,
|
28545 | currentViewModel: void 0,
|
28546 | labelData: {
|
28547 | anyWordBreaks: !1,
|
28548 | labelInfo: []
|
28549 | }
|
28550 | };
|
28551 | return defaultData;
|
28552 | }
|
28553 | function getMinMaxForAllFrames(playData, getExtents) {
|
28554 | var extents = {
|
28555 | minY: 0,
|
28556 | maxY: 10,
|
28557 | minX: 0,
|
28558 | maxX: 10
|
28559 | };
|
28560 | if (playData.allViewModels && playData.allViewModels.length > 0) {
|
28561 | extents.minY = extents.minX = Number.MAX_VALUE, extents.maxY = extents.maxX = Number.MIN_VALUE;
|
28562 | for (var i = 0, len = playData.allViewModels.length; len > i; i++) {
|
28563 | var data_3 = playData.allViewModels[i], e = getExtents(data_3);
|
28564 | extents = {
|
28565 | minY: d3.min([ e.minY, extents.minY ]),
|
28566 | maxY: d3.max([ e.maxY, extents.maxY ]),
|
28567 | minX: d3.min([ e.minX, extents.minX ]),
|
28568 | maxX: d3.max([ e.maxX, extents.maxX ])
|
28569 | };
|
28570 | }
|
28571 | }
|
28572 | return extents;
|
28573 | }
|
28574 | function getLabelData(keys, keyColumn) {
|
28575 | for (var textProperties = {
|
28576 | fontFamily: visuals.Font.Family.regular.css,
|
28577 | fontSize: jsCommon.PixelConverter.toString(14)
|
28578 | }, labelInfo = [], anyWordBreaks = !1, _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
28579 | var key = keys_1[_i], labelWidth = jsCommon.WordBreaker.getMaxWordWidth(key.escapedText, powerbi.TextMeasurementService.measureSvgTextWidth, textProperties);
|
28580 | anyWordBreaks = anyWordBreaks || jsCommon.WordBreaker.hasBreakers(key.escapedText) || key.escapedText.indexOf("-") > -1,
|
28581 | labelInfo.push({
|
28582 | label: key.escapedText,
|
28583 | labelWidth: labelWidth
|
28584 | });
|
28585 | }
|
28586 | return {
|
28587 | labelInfo: labelInfo,
|
28588 | anyWordBreaks: anyWordBreaks,
|
28589 | labelFieldName: keyColumn && keyColumn.displayName
|
28590 | };
|
28591 | }
|
28592 | function isDataViewPlayable(dataView, playRole) {
|
28593 | void 0 === playRole && (playRole = "Play");
|
28594 | var firstRowSourceRoles = dataView.matrix && dataView.matrix.rows && dataView.matrix.rows.levels && dataView.matrix.rows.levels[0] && dataView.matrix.rows.levels[0].sources && dataView.matrix.rows.levels[0].sources[0] && dataView.matrix.rows.levels[0].sources[0].roles;
|
28595 | return firstRowSourceRoles && firstRowSourceRoles[playRole];
|
28596 | }
|
28597 | function renderTraceLines(allDataPoints, traceLineRenderer, shouldAnimate) {
|
28598 | var selectedDataPoints = _.filter(allDataPoints, function(d) {
|
28599 | return d.selected;
|
28600 | });
|
28601 | selectedDataPoints = _.uniq(selectedDataPoints, function(d) {
|
28602 | return d.identity.getKey();
|
28603 | }), traceLineRenderer.render(selectedDataPoints, shouldAnimate);
|
28604 | }
|
28605 | PlayChart.FrameStepDuration = 800, PlayChart.FrameAnimationDuration = 750, PlayChart.ClassName = "playChart",
|
28606 | PlayChart.convertMatrixToCategorical = convertMatrixToCategorical, PlayChart.converter = converter,
|
28607 | PlayChart.getDefaultPlayData = getDefaultPlayData, PlayChart.getMinMaxForAllFrames = getMinMaxForAllFrames,
|
28608 | PlayChart.isDataViewPlayable = isDataViewPlayable, PlayChart.renderTraceLines = renderTraceLines;
|
28609 | }(PlayChart = visuals.PlayChart || (visuals.PlayChart = {}));
|
28610 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
28611 | }(powerbi || (powerbi = {}));
|
28612 | }, function(module, exports) {
|
28613 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
28614 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
28615 | !function(powerbi) {
|
28616 | var visuals;
|
28617 | !function(visuals) {
|
28618 | var PixelConverter = jsCommon.PixelConverter, VerticalSlicerRenderer = function() {
|
28619 | function VerticalSlicerRenderer(options) {
|
28620 | this.textProperties = {
|
28621 | fontFamily: visuals.Font.Family.regular.css,
|
28622 | fontSize: "14px"
|
28623 | }, options && (this.behavior = options.behavior), this.domHelper = options.domHelper;
|
28624 | }
|
28625 | return VerticalSlicerRenderer.prototype.getDefaultValue = function() {
|
28626 | return this.data && this.data.defaultValue ? this.data.defaultValue.value : void 0;
|
28627 | }, VerticalSlicerRenderer.prototype.getIdentityFields = function() {
|
28628 | return visuals.SlicerUtil.DefaultValueHandler.getIdentityFields(this.dataView);
|
28629 | }, VerticalSlicerRenderer.prototype.getUpdatedSelfFilter = function(searchKey) {
|
28630 | if (!_.isEmpty(searchKey) && this.data.searchKey !== searchKey) {
|
28631 | var metadata = this.dataView && this.dataView.metadata;
|
28632 | if (metadata) {
|
28633 | var column = _.first(metadata.columns);
|
28634 | return column && column.expr ? visuals.SlicerUtil.getContainsFilter(column.expr, searchKey) : void 0;
|
28635 | }
|
28636 | }
|
28637 | }, VerticalSlicerRenderer.prototype.init = function(slicerInitOptions) {
|
28638 | var _this = this;
|
28639 | this.element = slicerInitOptions.visualInitOptions.element, this.currentViewport = slicerInitOptions.visualInitOptions.viewport;
|
28640 | var interactivityService, hostServices = this.hostServices = slicerInitOptions.visualInitOptions.host, settings = this.settings = visuals.Slicer.DefaultStyleProperties(), domHelper = this.domHelper, bodyViewport = domHelper.getSlicerBodyViewport(this.currentViewport, settings, this.textProperties);
|
28641 | this.behavior && (interactivityService = visuals.createInteractivityService(hostServices));
|
28642 | var containerDiv = document.createElement("div");
|
28643 | containerDiv.className = Selectors.Container["class"];
|
28644 | var container = this.container = d3.select(containerDiv), header = domHelper.createSlicerHeader(hostServices);
|
28645 | containerDiv.appendChild(header), this.header = d3.select(header), this.body = container.append("div").classed(visuals.SlicerUtil.Selectors.Body["class"], !0).style({
|
28646 | height: PixelConverter.toString(bodyViewport.height),
|
28647 | width: PixelConverter.toString(bodyViewport.width)
|
28648 | });
|
28649 | var rowEnter = function(rowSelection) {
|
28650 | _this.onEnterSelection(rowSelection);
|
28651 | }, rowUpdate = function(rowSelection) {
|
28652 | _this.onUpdateSelection(rowSelection, interactivityService);
|
28653 | }, rowExit = function(rowSelection) {
|
28654 | rowSelection.remove();
|
28655 | }, listViewOptions = {
|
28656 | rowHeight: domHelper.getRowHeight(settings, this.textProperties),
|
28657 | enter: rowEnter,
|
28658 | exit: rowExit,
|
28659 | update: rowUpdate,
|
28660 | loadMoreData: function() {
|
28661 | return slicerInitOptions.loadMoreData();
|
28662 | },
|
28663 | scrollEnabled: !0,
|
28664 | viewport: domHelper.getSlicerBodyViewport(this.currentViewport, settings, this.textProperties),
|
28665 | baseContainer: this.body,
|
28666 | isReadMode: function() {
|
28667 | return 1 !== _this.hostServices.getViewMode();
|
28668 | }
|
28669 | };
|
28670 | return this.listView = visuals.ListViewFactory.createListView(listViewOptions),
|
28671 | this.element.get(0).appendChild(containerDiv), interactivityService;
|
28672 | }, VerticalSlicerRenderer.prototype.render = function(options) {
|
28673 | var data = this.data = options.data;
|
28674 | this.currentViewport = options.viewport;
|
28675 | var dataView = options.dataView;
|
28676 | if (!dataView || !data) return void this.listView.empty();
|
28677 | this.dataView = dataView;
|
28678 | var settings = this.settings = data.slicerSettings, domHelper = this.domHelper;
|
28679 | domHelper.updateSlicerBodyDimensions(this.currentViewport, this.body, settings),
|
28680 | this.updateSelectionStyle(), this.listView.viewport(domHelper.getSlicerBodyViewport(this.currentViewport, settings, this.textProperties)).rowHeight(domHelper.getRowHeight(settings, this.textProperties)).data(data.slicerDataPoints, function(d) {
|
28681 | return $.inArray(d, data.slicerDataPoints);
|
28682 | }, options.resetScrollbarPosition);
|
28683 | }, VerticalSlicerRenderer.prototype.updateSelectionStyle = function() {
|
28684 | var settings = this.settings;
|
28685 | this.container.classed("isMultiSelectEnabled", settings && settings.selection && !settings.selection.singleSelect);
|
28686 | }, VerticalSlicerRenderer.prototype.onEnterSelection = function(rowSelection) {
|
28687 | var settings = this.settings, listItemElement = rowSelection.append("ul").append("li").classed(Selectors.ItemContainer["class"], !0), labelElement = listItemElement.append("div").classed(Selectors.Input["class"], !0);
|
28688 | labelElement.append("input").attr("type", "checkbox"), labelElement.append("span").classed(Selectors.Checkbox["class"], !0),
|
28689 | listItemElement.each(function(d, i) {
|
28690 | var item = d3.select(this);
|
28691 | d.isImage ? item.append("img").classed(visuals.SlicerUtil.Selectors.LabelImage["class"], !0) : item.append("span").classed(visuals.SlicerUtil.Selectors.LabelText["class"], !0),
|
28692 | null != d.count && item.append("span").classed(visuals.SlicerUtil.Selectors.CountText["class"], !0).style("font-size", PixelConverter.fromPoint(settings.slicerText.textSize));
|
28693 | });
|
28694 | }, VerticalSlicerRenderer.prototype.onUpdateSelection = function(rowSelection, interactivityService) {
|
28695 | var settings = this.settings, data = this.data;
|
28696 | if (data && settings) {
|
28697 | var domHelper = this.domHelper;
|
28698 | domHelper.styleSlicerHeader(this.header, settings, data.categorySourceName);
|
28699 | var headerText = this.header.select(visuals.SlicerUtil.Selectors.TitleHeader.selector);
|
28700 | headerText.attr("title", data.categorySourceName);
|
28701 | var labelText = rowSelection.selectAll(visuals.SlicerUtil.Selectors.LabelText.selector);
|
28702 | labelText.text(function(d) {
|
28703 | return d.value;
|
28704 | }).attr("title", function(d) {
|
28705 | return d.tooltip;
|
28706 | }), domHelper.setSlicerTextStyle(labelText, settings);
|
28707 | var labelImage = rowSelection.selectAll(visuals.SlicerUtil.Selectors.LabelImage.selector);
|
28708 | labelImage.empty() || labelImage.attr("src", function(d) {
|
28709 | return d.value;
|
28710 | });
|
28711 | var countText = rowSelection.selectAll(visuals.SlicerUtil.Selectors.CountText.selector);
|
28712 | if (countText.empty() || (countText.text(function(d) {
|
28713 | return d.count;
|
28714 | }), domHelper.setSlicerTextStyle(countText, settings)), interactivityService && this.body) {
|
28715 | var body = this.body.attr("width", this.currentViewport.width), slicerItemContainers = body.selectAll(Selectors.ItemContainer.selector), slicerItemLabels = body.selectAll(visuals.SlicerUtil.Selectors.LabelText.selector), slicerItemInputs = body.selectAll(Selectors.Input.selector), slicerClear = this.header.select(visuals.SlicerUtil.Selectors.Clear.selector), searchInput = this.header.select("input");
|
28716 | if (!searchInput.empty()) {
|
28717 | var element = searchInput.node(), exisingSearchKey = element && element.value;
|
28718 | (_.isEmpty(exisingSearchKey) || _.isEmpty(data.searchKey)) && searchInput.property("value", data.searchKey);
|
28719 | }
|
28720 | var behaviorOptions = {
|
28721 | dataPoints: data.slicerDataPoints,
|
28722 | slicerContainer: this.container,
|
28723 | itemContainers: slicerItemContainers,
|
28724 | itemLabels: slicerItemLabels,
|
28725 | itemInputs: slicerItemInputs,
|
28726 | clear: slicerClear,
|
28727 | interactivityService: interactivityService,
|
28728 | settings: data.slicerSettings,
|
28729 | searchInput: searchInput,
|
28730 | slicerValueHandler: this
|
28731 | }, orientationBehaviorOptions = {
|
28732 | behaviorOptions: behaviorOptions,
|
28733 | orientation: 0
|
28734 | };
|
28735 | interactivityService.bind(data.slicerDataPoints, this.behavior, orientationBehaviorOptions, {
|
28736 | overrideSelectionFromData: !0,
|
28737 | hasSelectionOverride: data.hasSelectionOverride,
|
28738 | slicerValueHandler: this
|
28739 | }), visuals.SlicerWebBehavior.styleSlicerItems(rowSelection.select(Selectors.Input.selector), data.hasSelectionOverride, interactivityService.isSelectionModeInverted());
|
28740 | } else visuals.SlicerWebBehavior.styleSlicerItems(rowSelection.select(Selectors.Input.selector), !1, !1);
|
28741 | }
|
28742 | }, VerticalSlicerRenderer;
|
28743 | }();
|
28744 | visuals.VerticalSlicerRenderer = VerticalSlicerRenderer;
|
28745 | var Selectors;
|
28746 | !function(Selectors) {
|
28747 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector;
|
28748 | Selectors.Container = createClassAndSelector("slicerContainer"), Selectors.ItemContainer = createClassAndSelector("slicerItemContainer"),
|
28749 | Selectors.Input = createClassAndSelector("slicerCheckbox"), Selectors.Checkbox = createClassAndSelector("checkbox");
|
28750 | }(Selectors || (Selectors = {}));
|
28751 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
28752 | }(powerbi || (powerbi = {}));
|
28753 | }, function(module, exports) {
|
28754 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
28755 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
28756 | !function(powerbi) {
|
28757 | var visuals;
|
28758 | !function(visuals) {
|
28759 | var PixelConverter = jsCommon.PixelConverter, ItemWidthSampleSize = 50, MinTextWidth = 80, LoadMoreDataThreshold = .8, DefaultStyleProperties = {
|
28760 | labelText: {
|
28761 | marginRight: 2,
|
28762 | paddingLeft: 8,
|
28763 | paddingRight: 8
|
28764 | }
|
28765 | }, HorizontalSlicerRenderer = function() {
|
28766 | function HorizontalSlicerRenderer(options) {
|
28767 | this.textProperties = {
|
28768 | fontFamily: visuals.Font.Family.regular.css,
|
28769 | fontSize: "14px"
|
28770 | }, options && (this.behavior = options.behavior), this.domHelper = options.domHelper,
|
28771 | this.dataStartIndex = 0;
|
28772 | }
|
28773 | return HorizontalSlicerRenderer.prototype.getDefaultValue = function() {
|
28774 | return this.data && this.data.defaultValue ? this.data.defaultValue.value : void 0;
|
28775 | }, HorizontalSlicerRenderer.prototype.getIdentityFields = function() {
|
28776 | return visuals.SlicerUtil.DefaultValueHandler.getIdentityFields(this.dataView);
|
28777 | }, HorizontalSlicerRenderer.prototype.getUpdatedSelfFilter = function(searchKey) {},
|
28778 | HorizontalSlicerRenderer.prototype.init = function(slicerInitOptions) {
|
28779 | this.element = slicerInitOptions.visualInitOptions.element, this.currentViewport = slicerInitOptions.visualInitOptions.viewport;
|
28780 | var hostServices = this.hostServices = slicerInitOptions.visualInitOptions.host;
|
28781 | this.behavior && (this.interactivityService = visuals.createInteractivityService(hostServices)),
|
28782 | this.loadMoreData = function() {
|
28783 | return slicerInitOptions.loadMoreData();
|
28784 | };
|
28785 | var containerDiv = document.createElement("div");
|
28786 | containerDiv.className = Selectors.container["class"];
|
28787 | var container = this.container = d3.select(containerDiv), header = this.domHelper.createSlicerHeader(this.hostServices);
|
28788 | containerDiv.appendChild(header), this.header = d3.select(header);
|
28789 | var body = this.body = container.append("div").classed(visuals.SlicerUtil.Selectors.Body["class"] + " " + Selectors.FlexDisplay["class"], !0);
|
28790 | return this.leftNavigationArrow = body.append("button").classed(Selectors.NavigationArrow["class"] + " " + Selectors.LeftNavigationArrow["class"], !0),
|
28791 | this.itemsContainer = body.append("div").classed(Selectors.ItemsContainer["class"] + " " + Selectors.FlexDisplay["class"], !0),
|
28792 | this.rightNavigationArrow = body.append("button").classed(Selectors.NavigationArrow["class"] + " " + Selectors.RightNavigationArrow["class"], !0),
|
28793 | this.element.get(0).appendChild(containerDiv), this.bindNavigationEvents(), this.interactivityService;
|
28794 | }, HorizontalSlicerRenderer.prototype.render = function(options) {
|
28795 | var data = options.data, dataView = options.dataView;
|
28796 | if (!dataView || !data) return void this.itemsContainer.selectAll("*").remove();
|
28797 | this.data = data, this.dataView = dataView;
|
28798 | var resized = this.currentViewport && options.viewport && (this.currentViewport.height !== options.viewport.height || this.currentViewport.width !== options.viewport.width);
|
28799 | this.isMaxWidthCalculated() && resized || (this.calculateAndSetMaxItemWidth(), this.calculateAndSetTotalItemWidth()),
|
28800 | this.currentViewport = options.viewport, this.updateStyle();
|
28801 | var availableWidthForItemsContainer = this.element.find(Selectors.ItemsContainer.selector).width();
|
28802 | this.itemsToDisplay = this.getNumberOfItemsToDisplay(availableWidthForItemsContainer),
|
28803 | 0 !== this.itemsToDisplay && this.renderCore();
|
28804 | }, HorizontalSlicerRenderer.prototype.renderCore = function() {
|
28805 | var data = this.data;
|
28806 | if (data && data.slicerDataPoints) {
|
28807 | this.normalizePosition(data.slicerDataPoints);
|
28808 | var itemsToDisplay = this.itemsToDisplay, dataStartIndex = this.dataStartIndex;
|
28809 | this.container.classed(Selectors.CanScrollRight["class"], dataStartIndex + this.itemsToDisplay <= data.slicerDataPoints.length - 1),
|
28810 | this.container.classed(Selectors.CanScrollLeft["class"], dataStartIndex > 0), this.renderItems(data.slicerSettings),
|
28811 | this.bindInteractivityService(), dataStartIndex + itemsToDisplay >= data.slicerDataPoints.length * LoadMoreDataThreshold && this.loadMoreData();
|
28812 | }
|
28813 | }, HorizontalSlicerRenderer.prototype.updateStyle = function() {
|
28814 | var viewport = this.currentViewport, data = this.data, defaultSettings = data.slicerSettings, domHelper = this.domHelper;
|
28815 | this.container.classed(Selectors.MultiSelectEnabled["class"], !defaultSettings.selection.singleSelect).style({
|
28816 | width: PixelConverter.toString(viewport.width),
|
28817 | height: PixelConverter.toString(viewport.height)
|
28818 | }), domHelper.styleSlicerHeader(this.header, defaultSettings, data.categorySourceName);
|
28819 | var headerTextProperties = domHelper.getHeaderTextProperties(defaultSettings);
|
28820 | this.header.attr("title", data.categorySourceName);
|
28821 | var bodyViewport = this.bodyViewport = domHelper.getSlicerBodyViewport(viewport, defaultSettings, headerTextProperties);
|
28822 | this.body.style({
|
28823 | height: PixelConverter.toString(bodyViewport.height),
|
28824 | width: PixelConverter.toString(bodyViewport.width)
|
28825 | });
|
28826 | }, HorizontalSlicerRenderer.prototype.renderItems = function(defaultSettings) {
|
28827 | var _this = this, itemsToDisplay = this.itemsToDisplay, dataStartIndex = this.dataStartIndex, materializedDataPoints = this.data.slicerDataPoints.slice(dataStartIndex, dataStartIndex + itemsToDisplay), items = this.itemsContainer.selectAll(visuals.SlicerUtil.Selectors.LabelText.selector).data(materializedDataPoints, function(d) {
|
28828 | return _.indexOf(_this.data.slicerDataPoints, d);
|
28829 | });
|
28830 | items.enter().append("div").classed(visuals.SlicerUtil.Selectors.LabelText["class"] + " " + Selectors.FlexDisplay["class"], !0),
|
28831 | items.order(), items.style({
|
28832 | "font-family": this.textProperties.fontFamily,
|
28833 | "padding-left": PixelConverter.toString(DefaultStyleProperties.labelText.paddingLeft),
|
28834 | "padding-right": PixelConverter.toString(DefaultStyleProperties.labelText.paddingRight),
|
28835 | "margin-right": function(d, i) {
|
28836 | return _this.isLastRowItem(i, itemsToDisplay) ? "0px" : PixelConverter.toString(DefaultStyleProperties.labelText.marginRight);
|
28837 | }
|
28838 | }), this.domHelper.setSlicerTextStyle(items, defaultSettings), items.exit().remove(),
|
28839 | window.setTimeout(function() {
|
28840 | items.attr("title", function(d) {
|
28841 | return d.tooltip;
|
28842 | }).text(function(d) {
|
28843 | return d.value;
|
28844 | });
|
28845 | var labels = _this.element.find(visuals.SlicerUtil.Selectors.LabelText.selector), item = labels.first(), itemWidth = item.width(), itemHeight = item.height();
|
28846 | labels.each(function(i, element) {
|
28847 | powerbi.TextMeasurementService.wordBreakOverflowingText(element, itemWidth, itemHeight);
|
28848 | });
|
28849 | });
|
28850 | }, HorizontalSlicerRenderer.prototype.bindInteractivityService = function() {
|
28851 | if (this.interactivityService && this.body) {
|
28852 | var body = this.body, itemsContainer = body.selectAll(Selectors.ItemsContainer.selector), itemLabels = body.selectAll(visuals.SlicerUtil.Selectors.LabelText.selector), clear = this.header.select(visuals.SlicerUtil.Selectors.Clear.selector), data_1 = this.data, behaviorOptions = {
|
28853 | dataPoints: data_1.slicerDataPoints,
|
28854 | slicerContainer: this.container,
|
28855 | itemsContainer: itemsContainer,
|
28856 | itemLabels: itemLabels,
|
28857 | clear: clear,
|
28858 | interactivityService: this.interactivityService,
|
28859 | settings: data_1.slicerSettings,
|
28860 | slicerValueHandler: this
|
28861 | }, orientationBehaviorOptions = {
|
28862 | behaviorOptions: behaviorOptions,
|
28863 | orientation: 1
|
28864 | };
|
28865 | this.interactivityService.bind(data_1.slicerDataPoints, this.behavior, orientationBehaviorOptions, {
|
28866 | overrideSelectionFromData: !0,
|
28867 | hasSelectionOverride: data_1.hasSelectionOverride
|
28868 | }), visuals.SlicerWebBehavior.styleSlicerItems(this.itemsContainer.selectAll(visuals.SlicerUtil.Selectors.LabelText.selector), this.interactivityService.hasSelection(), this.interactivityService.isSelectionModeInverted());
|
28869 | } else visuals.SlicerWebBehavior.styleSlicerItems(this.itemsContainer.selectAll(visuals.SlicerUtil.Selectors.LabelText.selector), !1, !1);
|
28870 | }, HorizontalSlicerRenderer.prototype.normalizePosition = function(points) {
|
28871 | var dataStartIndex = this.dataStartIndex;
|
28872 | dataStartIndex = Math.min(dataStartIndex, points.length - 1), this.dataStartIndex = Math.max(dataStartIndex, 0);
|
28873 | }, HorizontalSlicerRenderer.prototype.bindNavigationEvents = function() {
|
28874 | this.registerMouseWheelScrollEvents(), this.registerMouseClickEvents();
|
28875 | }, HorizontalSlicerRenderer.prototype.registerMouseClickEvents = function() {
|
28876 | var _this = this, rightNavigationArrow = this.container.selectAll(Selectors.RightNavigationArrow.selector), leftNavigationArrow = this.container.selectAll(Selectors.LeftNavigationArrow.selector);
|
28877 | rightNavigationArrow.on("click", function() {
|
28878 | _this.scrollRight();
|
28879 | }), leftNavigationArrow.on("click", function() {
|
28880 | _this.scrollLeft();
|
28881 | });
|
28882 | }, HorizontalSlicerRenderer.prototype.registerMouseWheelScrollEvents = function() {
|
28883 | var _this = this, scrollableElement = this.body.node();
|
28884 | scrollableElement.addEventListener("mousewheel", function(e) {
|
28885 | _this.onMouseWheel(e.wheelDelta);
|
28886 | }), scrollableElement.addEventListener("DOMMouseScroll", function(e) {
|
28887 | _this.onMouseWheel(e.detail);
|
28888 | });
|
28889 | }, HorizontalSlicerRenderer.prototype.onMouseWheel = function(wheelDelta) {
|
28890 | 0 > wheelDelta ? this.scrollRight() : wheelDelta > 0 && this.scrollLeft();
|
28891 | }, HorizontalSlicerRenderer.prototype.scrollRight = function() {
|
28892 | var itemsToDisplay = this.itemsToDisplay, startIndex = this.dataStartIndex, dataPointsLength = this.data.slicerDataPoints.length, lastItemIndex = dataPointsLength - 1;
|
28893 | itemsToDisplay + startIndex > lastItemIndex || (startIndex += 1 === itemsToDisplay ? itemsToDisplay : itemsToDisplay - 1,
|
28894 | itemsToDisplay + startIndex > lastItemIndex && (startIndex = lastItemIndex - itemsToDisplay + 1),
|
28895 | this.dataStartIndex = startIndex, this.renderCore());
|
28896 | }, HorizontalSlicerRenderer.prototype.scrollLeft = function() {
|
28897 | var itemsToDisplay = this.itemsToDisplay, startIndex = this.dataStartIndex, firstItemIndex = 0;
|
28898 | 0 !== startIndex && (1 === itemsToDisplay && (startIndex -= itemsToDisplay), startIndex = firstItemIndex > startIndex - itemsToDisplay ? firstItemIndex : startIndex - itemsToDisplay + 1,
|
28899 | this.dataStartIndex = startIndex, this.renderCore());
|
28900 | }, HorizontalSlicerRenderer.prototype.isLastRowItem = function(fieldIndex, columnsToDisplay) {
|
28901 | return fieldIndex === columnsToDisplay - 1;
|
28902 | }, HorizontalSlicerRenderer.prototype.getScaledTextWidth = function(textSize) {
|
28903 | return textSize / jsCommon.TextSizeDefaults.TextSizeMin * MinTextWidth;
|
28904 | }, HorizontalSlicerRenderer.prototype.isMaxWidthCalculated = function() {
|
28905 | return void 0 !== this.maxItemWidth;
|
28906 | }, HorizontalSlicerRenderer.prototype.calculateAndSetMaxItemWidth = function() {
|
28907 | var dataPointsLength = this.getDataPointsCount(), maxItemWidth = 0;
|
28908 | if (0 === dataPointsLength) return void (this.maxItemWidth = maxItemWidth);
|
28909 | var data = this.data, dataPoints = data.slicerDataPoints, sampleSize = Math.min(dataPointsLength, ItemWidthSampleSize), properties = jQuery.extend(!0, {}, this.textProperties), textSize = data.slicerSettings.slicerText.textSize;
|
28910 | properties.fontSize = PixelConverter.fromPoint(textSize);
|
28911 | for (var getMaxWordWidth = jsCommon.WordBreaker.getMaxWordWidth, i = 0; sampleSize > i; i++) {
|
28912 | var itemText = dataPoints[i].value;
|
28913 | properties.text = itemText, maxItemWidth = Math.max(maxItemWidth, getMaxWordWidth(itemText, powerbi.TextMeasurementService.measureSvgTextWidth, properties));
|
28914 | }
|
28915 | this.maxItemWidth = Math.min(maxItemWidth, this.getScaledTextWidth(textSize));
|
28916 | }, HorizontalSlicerRenderer.prototype.calculateAndSetTotalItemWidth = function() {
|
28917 | var data = this.data, itemPadding = DefaultStyleProperties.labelText.paddingLeft + DefaultStyleProperties.labelText.paddingRight + DefaultStyleProperties.labelText.marginRight, borderWidth = this.domHelper.getRowsOutlineWidth(data.slicerSettings.slicerText.outline, data.slicerSettings.general.outlineWeight);
|
28918 | this.totalItemWidth = this.maxItemWidth + itemPadding + borderWidth;
|
28919 | }, HorizontalSlicerRenderer.prototype.getNumberOfItemsToDisplay = function(widthAvailable) {
|
28920 | var totalItemWidth = this.totalItemWidth;
|
28921 | if (0 === totalItemWidth) return 0;
|
28922 | var dataPointsLength = this.getDataPointsCount(), numberOfItems = Math.min(dataPointsLength, Math.round(widthAvailable / totalItemWidth));
|
28923 | return Math.max(numberOfItems, 1);
|
28924 | }, HorizontalSlicerRenderer.prototype.getDataPointsCount = function() {
|
28925 | return _.size(this.data.slicerDataPoints);
|
28926 | }, HorizontalSlicerRenderer;
|
28927 | }();
|
28928 | visuals.HorizontalSlicerRenderer = HorizontalSlicerRenderer;
|
28929 | var Selectors;
|
28930 | !function(Selectors) {
|
28931 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector;
|
28932 | Selectors.container = createClassAndSelector("horizontalSlicerContainer"), Selectors.ItemsContainer = createClassAndSelector("slicerItemsContainer"),
|
28933 | Selectors.NavigationArrow = createClassAndSelector("navigationArrow"), Selectors.LeftNavigationArrow = createClassAndSelector("left"),
|
28934 | Selectors.RightNavigationArrow = createClassAndSelector("right"), Selectors.MultiSelectEnabled = createClassAndSelector("isMultiSelectEnabled"),
|
28935 | Selectors.FlexDisplay = createClassAndSelector("flexDisplay"), Selectors.CanScrollRight = createClassAndSelector("canScrollRight"),
|
28936 | Selectors.CanScrollLeft = createClassAndSelector("canScrollLeft");
|
28937 | }(Selectors || (Selectors = {}));
|
28938 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
28939 | }(powerbi || (powerbi = {}));
|
28940 | }, function(module, exports) {
|
28941 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
28942 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
28943 | !function(powerbi) {
|
28944 | var visuals;
|
28945 | !function(visuals) {
|
28946 | var DisplayNameKeys = visuals.SlicerUtil.DisplayNameKeys, DOMHelper = visuals.SlicerUtil.DOMHelper, SettingsHelper = visuals.SlicerUtil.SettingsHelper, Slicer = function() {
|
28947 | function Slicer(options) {
|
28948 | options && (this.behavior = options.behavior), this.domHelper = new DOMHelper();
|
28949 | }
|
28950 | return Slicer.DefaultStyleProperties = function() {
|
28951 | return {
|
28952 | general: {
|
28953 | outlineColor: "#808080",
|
28954 | outlineWeight: 1,
|
28955 | orientation: 0
|
28956 | },
|
28957 | header: {
|
28958 | borderBottomWidth: 1,
|
28959 | show: !0,
|
28960 | outline: visuals.outline.bottomOnly,
|
28961 | fontColor: "#000000",
|
28962 | textSize: 10
|
28963 | },
|
28964 | slicerText: {
|
28965 | color: "#666666",
|
28966 | outline: visuals.outline.none,
|
28967 | textSize: 10
|
28968 | },
|
28969 | selection: {
|
28970 | selectAllCheckboxEnabled: !1,
|
28971 | singleSelect: !0
|
28972 | },
|
28973 | search: {
|
28974 | enabled: !1
|
28975 | }
|
28976 | };
|
28977 | }, Slicer.prototype.init = function(options) {
|
28978 | this.initOptions = options, this.element = options.element, this.currentViewport = options.viewport,
|
28979 | this.hostServices = options.host;
|
28980 | var settings = this.settings = Slicer.DefaultStyleProperties();
|
28981 | this.slicerOrientation = settings.general.orientation, this.waitingForData = !1,
|
28982 | this.initializeSlicerRenderer(this.slicerOrientation);
|
28983 | }, Slicer.prototype.onDataChanged = function(options) {
|
28984 | var dataViews = options.dataViews;
|
28985 | if (!_.isEmpty(dataViews)) {
|
28986 | var existingDataView = this.dataView;
|
28987 | this.dataView = dataViews[0];
|
28988 | var resetScrollbarPosition = options.operationKind !== powerbi.VisualDataChangeOperationKind.Append && !powerbi.DataViewAnalysis.hasSameCategoryIdentity(existingDataView, this.dataView);
|
28989 | this.render(resetScrollbarPosition, !0);
|
28990 | }
|
28991 | }, Slicer.prototype.onResizing = function(finalViewport) {
|
28992 | this.currentViewport = finalViewport, this.render(!1);
|
28993 | }, Slicer.prototype.enumerateObjectInstances = function(options) {
|
28994 | return ObjectEnumerator.enumerateObjectInstances(options, this.slicerData, this.settings, this.dataView);
|
28995 | }, Slicer.prototype.loadMoreData = function() {
|
28996 | var dataView = this.dataView;
|
28997 | if (dataView) {
|
28998 | var dataViewMetadata = dataView.metadata;
|
28999 | !this.waitingForData && dataViewMetadata && dataViewMetadata.segment && (this.hostServices.loadMoreData(),
|
29000 | this.waitingForData = !0);
|
29001 | }
|
29002 | }, Slicer.prototype.onClearSelection = function() {
|
29003 | this.interactivityService && (this.interactivityService.clearSelection(), this.render(!1));
|
29004 | }, Slicer.prototype.render = function(resetScrollbarPosition, stopWaitingForData) {
|
29005 | var localizedSelectAllText = this.hostServices.getLocalizedString(DisplayNameKeys.SelectAll);
|
29006 | if (this.slicerData = visuals.DataConversion.convert(this.dataView, localizedSelectAllText, this.interactivityService, this.hostServices),
|
29007 | this.slicerData) {
|
29008 | this.slicerData.slicerSettings.general.outlineWeight = Math.max(this.slicerData.slicerSettings.general.outlineWeight, 0),
|
29009 | this.settings = this.slicerData.slicerSettings;
|
29010 | var slicerOrientation_1 = SettingsHelper.areSettingsDefined(this.slicerData) && this.slicerData.slicerSettings.general && this.slicerData.slicerSettings.general.orientation ? this.slicerData.slicerSettings.general.orientation : Slicer.DefaultStyleProperties().general.orientation, orientationHasChanged = this.orientationHasChanged(slicerOrientation_1);
|
29011 | orientationHasChanged && (this.slicerOrientation = slicerOrientation_1, this.element.empty(),
|
29012 | this.initializeSlicerRenderer(slicerOrientation_1));
|
29013 | }
|
29014 | this.slicerRenderer.render({
|
29015 | dataView: this.dataView,
|
29016 | data: this.slicerData,
|
29017 | viewport: this.currentViewport,
|
29018 | resetScrollbarPosition: resetScrollbarPosition
|
29019 | }), stopWaitingForData && (this.waitingForData = !1);
|
29020 | }, Slicer.prototype.orientationHasChanged = function(slicerOrientation) {
|
29021 | return this.slicerOrientation !== slicerOrientation;
|
29022 | }, Slicer.prototype.initializeSlicerRenderer = function(slicerOrientation) {
|
29023 | switch (slicerOrientation) {
|
29024 | case 1:
|
29025 | this.initializeHorizontalSlicer();
|
29026 | break;
|
29027 |
|
29028 | case 0:
|
29029 | this.initializeVerticalSlicer();
|
29030 | }
|
29031 | }, Slicer.prototype.initializeVerticalSlicer = function() {
|
29032 | var verticalSlicerRenderer = this.slicerRenderer = new visuals.VerticalSlicerRenderer({
|
29033 | domHelper: this.domHelper,
|
29034 | behavior: this.behavior
|
29035 | }), options = this.createInitOptions();
|
29036 | this.interactivityService = verticalSlicerRenderer.init(options);
|
29037 | }, Slicer.prototype.initializeHorizontalSlicer = function() {
|
29038 | var horizontalSlicerRenderer = this.slicerRenderer = new visuals.HorizontalSlicerRenderer({
|
29039 | domHelper: this.domHelper,
|
29040 | behavior: this.behavior
|
29041 | }), options = this.createInitOptions();
|
29042 | this.interactivityService = horizontalSlicerRenderer.init(options);
|
29043 | }, Slicer.prototype.createInitOptions = function() {
|
29044 | var _this = this;
|
29045 | return {
|
29046 | visualInitOptions: this.initOptions,
|
29047 | loadMoreData: function() {
|
29048 | return _this.loadMoreData();
|
29049 | }
|
29050 | };
|
29051 | }, Slicer;
|
29052 | }();
|
29053 | visuals.Slicer = Slicer;
|
29054 | var ObjectEnumerator;
|
29055 | !function(ObjectEnumerator) {
|
29056 | function enumerateObjectInstances(options, data, settings, dataView) {
|
29057 | if (data) switch (options.objectName) {
|
29058 | case "items":
|
29059 | return enumerateItems(data, settings);
|
29060 |
|
29061 | case "header":
|
29062 | return enumerateHeader(data, settings);
|
29063 |
|
29064 | case "general":
|
29065 | return enumerateGeneral(data, settings);
|
29066 |
|
29067 | case "selection":
|
29068 | if (shouldShowSelectionOption(dataView)) return enumerateSelection(data, settings);
|
29069 | }
|
29070 | }
|
29071 | function shouldShowSelectionOption(dataView) {
|
29072 | return !(dataView && dataView.metadata && dataView.metadata.columns && _.some(dataView.metadata.columns, function(column) {
|
29073 | return column.discourageAggregationAcrossGroups;
|
29074 | }));
|
29075 | }
|
29076 | function enumerateSelection(data, settings) {
|
29077 | var slicerSettings = settings, areSelectionSettingsDefined = SettingsHelper.areSettingsDefined(data) && data.slicerSettings.selection, selectAllCheckboxEnabled = areSelectionSettingsDefined && data.slicerSettings.selection.selectAllCheckboxEnabled ? data.slicerSettings.selection.selectAllCheckboxEnabled : slicerSettings.selection.selectAllCheckboxEnabled, singleSelect = data && data.slicerSettings && data.slicerSettings.selection && void 0 !== data.slicerSettings.selection.singleSelect ? data.slicerSettings.selection.singleSelect : slicerSettings.selection.singleSelect;
|
29078 | return [ {
|
29079 | selector: null,
|
29080 | objectName: "selection",
|
29081 | properties: {
|
29082 | selectAllCheckboxEnabled: selectAllCheckboxEnabled,
|
29083 | singleSelect: singleSelect
|
29084 | }
|
29085 | } ];
|
29086 | }
|
29087 | function enumerateHeader(data, settings) {
|
29088 | var slicerSettings = settings, areHeaderSettingsDefined = SettingsHelper.areSettingsDefined(data) && data.slicerSettings.header, fontColor = areHeaderSettingsDefined && data.slicerSettings.header.fontColor ? data.slicerSettings.header.fontColor : slicerSettings.header.fontColor, background = areHeaderSettingsDefined && data.slicerSettings.header.background ? data.slicerSettings.header.background : slicerSettings.header.background;
|
29089 | return [ {
|
29090 | selector: null,
|
29091 | objectName: "header",
|
29092 | properties: {
|
29093 | show: slicerSettings.header.show,
|
29094 | fontColor: fontColor,
|
29095 | background: background,
|
29096 | outline: slicerSettings.header.outline,
|
29097 | textSize: slicerSettings.header.textSize
|
29098 | }
|
29099 | } ];
|
29100 | }
|
29101 | function enumerateItems(data, settings) {
|
29102 | var slicerSettings = settings, areTextSettingsDefined = SettingsHelper.areSettingsDefined(data) && data.slicerSettings.slicerText, fontColor = areTextSettingsDefined && data.slicerSettings.slicerText.color ? data.slicerSettings.slicerText.color : slicerSettings.slicerText.color, background = areTextSettingsDefined && data.slicerSettings.slicerText.background ? data.slicerSettings.slicerText.background : slicerSettings.slicerText.background;
|
29103 | return [ {
|
29104 | selector: null,
|
29105 | objectName: "items",
|
29106 | properties: {
|
29107 | fontColor: fontColor,
|
29108 | background: background,
|
29109 | outline: slicerSettings.slicerText.outline,
|
29110 | textSize: slicerSettings.slicerText.textSize
|
29111 | }
|
29112 | } ];
|
29113 | }
|
29114 | function enumerateGeneral(data, settings) {
|
29115 | var slicerSettings = settings, areGeneralSettingsDefined = SettingsHelper.areSettingsDefined(data) && null != data.slicerSettings.general, outlineColor = areGeneralSettingsDefined && data.slicerSettings.general.outlineColor ? data.slicerSettings.general.outlineColor : slicerSettings.general.outlineColor, outlineWeight = areGeneralSettingsDefined && data.slicerSettings.general.outlineWeight ? data.slicerSettings.general.outlineWeight : slicerSettings.general.outlineWeight, orientation = areGeneralSettingsDefined && null != data.slicerSettings.general.orientation ? data.slicerSettings.general.orientation : slicerSettings.general.orientation;
|
29116 | return [ {
|
29117 | selector: null,
|
29118 | objectName: "general",
|
29119 | properties: {
|
29120 | outlineColor: outlineColor,
|
29121 | outlineWeight: outlineWeight,
|
29122 | orientation: orientation
|
29123 | }
|
29124 | } ];
|
29125 | }
|
29126 | ObjectEnumerator.enumerateObjectInstances = enumerateObjectInstances;
|
29127 | }(ObjectEnumerator || (ObjectEnumerator = {}));
|
29128 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
29129 | }(powerbi || (powerbi = {}));
|
29130 | }, function(module, exports) {
|
29131 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
29132 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
29133 | !function(powerbi) {
|
29134 | var visuals;
|
29135 | !function(visuals) {
|
29136 | var TablixUtils = visuals.controls.internal.TablixUtils, TablixObjects = visuals.controls.internal.TablixObjects, EdgeSettings = TablixUtils.EdgeSettings, EdgeType = TablixUtils.EdgeType, TableHierarchyNavigator = function() {
|
29137 | function TableHierarchyNavigator(tableDataView, isDataComplete, formatter) {
|
29138 | this.tableDataView = tableDataView, this.isDataComplete = isDataComplete, this.formatter = formatter;
|
29139 | }
|
29140 | return TableHierarchyNavigator.prototype.getColumnHierarchyDepth = function() {
|
29141 | return 1;
|
29142 | }, TableHierarchyNavigator.prototype.getRowHierarchyDepth = function() {
|
29143 | return 1;
|
29144 | }, TableHierarchyNavigator.prototype.getLeafCount = function(hierarchy) {
|
29145 | return hierarchy.length;
|
29146 | }, TableHierarchyNavigator.prototype.getLeafAt = function(hierarchy, index) {
|
29147 | return hierarchy[index];
|
29148 | }, TableHierarchyNavigator.prototype.getParent = function(item) {
|
29149 | return null;
|
29150 | }, TableHierarchyNavigator.prototype.getIndex = function(item) {
|
29151 | return item ? this.isRow(item) ? item.index : this.getColumnIndex(item) : -1;
|
29152 | }, TableHierarchyNavigator.prototype.isRow = function(item) {
|
29153 | if (!item) return !1;
|
29154 | var row = item;
|
29155 | return void 0 !== row.index && void 0 !== row.values;
|
29156 | }, TableHierarchyNavigator.prototype.getColumnIndex = function(item) {
|
29157 | return TableHierarchyNavigator.getIndex(this.tableDataView.columns, item);
|
29158 | }, TableHierarchyNavigator.prototype.isLeaf = function(item) {
|
29159 | return !0;
|
29160 | }, TableHierarchyNavigator.prototype.isRowHierarchyLeaf = function(cornerItem) {
|
29161 | return !1;
|
29162 | }, TableHierarchyNavigator.prototype.isColumnHierarchyLeaf = function(cornerItem) {
|
29163 | return !0;
|
29164 | }, TableHierarchyNavigator.prototype.isFirstItem = function(item, items) {
|
29165 | return item === items[0];
|
29166 | }, TableHierarchyNavigator.prototype.areAllParentsFirst = function(item, items) {
|
29167 | return this.isFirstItem(item, items);
|
29168 | }, TableHierarchyNavigator.prototype.isLastItem = function(item, items) {
|
29169 | return (items === this.tableDataView.columns || this.isDataComplete) && item === _.last(items);
|
29170 | }, TableHierarchyNavigator.prototype.areAllParentsLast = function(item, items) {
|
29171 | return this.isLastItem(item, items);
|
29172 | }, TableHierarchyNavigator.prototype.getChildren = function(item) {
|
29173 | return null;
|
29174 | }, TableHierarchyNavigator.prototype.getChildrenLevelDifference = function(item) {
|
29175 | return 1 / 0;
|
29176 | }, TableHierarchyNavigator.prototype.getCount = function(items) {
|
29177 | return items.length;
|
29178 | }, TableHierarchyNavigator.prototype.getAt = function(items, index) {
|
29179 | return items[index];
|
29180 | }, TableHierarchyNavigator.prototype.getLevel = function(item) {
|
29181 | return 0;
|
29182 | }, TableHierarchyNavigator.prototype.getIntersection = function(rowItem, columnItem) {
|
29183 | var value, isTotal = !1, position = new TablixUtils.CellPosition(), columnIndex = TableHierarchyNavigator.getIndex(this.tableDataView.columns, columnItem);
|
29184 | position.column.index = columnIndex, position.column.isFirst = 0 === columnIndex,
|
29185 | position.column.isLast = columnIndex === this.tableDataView.columns.length - 1;
|
29186 | var totalRow = rowItem;
|
29187 | if (null != totalRow.totalCells) isTotal = !0, value = totalRow.totalCells[columnIndex]; else {
|
29188 | var row = rowItem, rowIndex = row.index;
|
29189 | position.row.index = rowIndex, position.row.isFirst = 0 === rowIndex, position.row.isLast = this.isDataComplete && rowIndex === this.tableDataView.rows.length - 1,
|
29190 | value = row.values[columnIndex];
|
29191 | }
|
29192 | var cellItem = new TablixUtils.TablixVisualCell(value, isTotal, columnItem, this.formatter, !1);
|
29193 | cellItem.position = position;
|
29194 | var tableRow = rowItem;
|
29195 | if (tableRow && tableRow.values) {
|
29196 | var rowObjects = tableRow.values.objects;
|
29197 | if (rowObjects) {
|
29198 | var cellObject = rowObjects[columnIndex];
|
29199 | cellObject && (cellItem.backColor = TablixObjects.PropValuesBackColor.getValue(cellObject));
|
29200 | }
|
29201 | }
|
29202 | return cellItem;
|
29203 | }, TableHierarchyNavigator.prototype.getCorner = function(rowLevel, columnLevel) {
|
29204 | return null;
|
29205 | }, TableHierarchyNavigator.prototype.headerItemEquals = function(item1, item2) {
|
29206 | if (item1 === item2) return !0;
|
29207 | if (item1.displayName && item2.displayName) {
|
29208 | var column1 = item1, column2 = item2;
|
29209 | return powerbi.DataViewAnalysis.areMetadataColumnsEquivalent(column1, column2);
|
29210 | }
|
29211 | return this.isRow(item1) && this.isRow(item2) ? item1.index === item2.index : !1;
|
29212 | }, TableHierarchyNavigator.prototype.bodyCellItemEquals = function(item1, item2) {
|
29213 | return item1.isMatch(item2);
|
29214 | }, TableHierarchyNavigator.prototype.cornerCellItemEquals = function(item1, item2) {
|
29215 | return !0;
|
29216 | }, TableHierarchyNavigator.prototype.update = function(table, isDataComplete) {
|
29217 | this.tableDataView = table, this.isDataComplete = isDataComplete;
|
29218 | }, TableHierarchyNavigator.getIndex = function(items, item) {
|
29219 | for (var index = 0, len = items.length; len > index; index++) {
|
29220 | var arrayItem = items[index];
|
29221 | if (null != arrayItem.index && null != item.index && arrayItem.index === item.index) return index;
|
29222 | if (item === items[index]) return index;
|
29223 | }
|
29224 | return -1;
|
29225 | }, TableHierarchyNavigator;
|
29226 | }();
|
29227 | visuals.TableHierarchyNavigator = TableHierarchyNavigator;
|
29228 | var TableBinder = function() {
|
29229 | function TableBinder(options, dataView) {
|
29230 | this.options = options, dataView && this.updateDataView(dataView);
|
29231 | }
|
29232 | return TableBinder.prototype.updateDataView = function(dataView) {
|
29233 | this.tableDataView = dataView, this.formattingProperties = dataView.formattingProperties,
|
29234 | this.updateTextHeights(), this.hasImage() ? this.rowHeight = Math.max(this.textHeightValue, this.formattingProperties.grid.imageHeight) : this.rowHeight = this.textHeightValue;
|
29235 | }, TableBinder.prototype.updateTextHeights = function() {
|
29236 | this.fontSizeHeader = jsCommon.PixelConverter.fromPointToPixel(this.formattingProperties.general.textSize),
|
29237 | this.textPropsHeader = {
|
29238 | fontFamily: TablixUtils.FontFamilyHeader,
|
29239 | fontSize: jsCommon.PixelConverter.toString(this.fontSizeHeader)
|
29240 | }, this.textHeightHeader = Math.ceil(powerbi.TextMeasurementService.measureSvgTextHeight(this.textPropsHeader, "a")),
|
29241 | this.fontSizeValue = jsCommon.PixelConverter.fromPointToPixel(this.formattingProperties.general.textSize),
|
29242 | this.textPropsValue = {
|
29243 | fontFamily: TablixUtils.FontFamilyCell,
|
29244 | fontSize: jsCommon.PixelConverter.toString(this.fontSizeValue)
|
29245 | }, this.textHeightValue = Math.ceil(powerbi.TextMeasurementService.measureSvgTextHeight(this.textPropsValue, "a")),
|
29246 | this.fontSizeTotal = jsCommon.PixelConverter.fromPointToPixel(this.formattingProperties.general.textSize),
|
29247 | this.textPropsTotal = {
|
29248 | fontFamily: TablixUtils.FontFamilyTotal,
|
29249 | fontSize: jsCommon.PixelConverter.toString(this.fontSizeTotal)
|
29250 | }, this.textHeightTotal = Math.ceil(powerbi.TextMeasurementService.measureSvgTextHeight(this.textPropsTotal, "a"));
|
29251 | }, TableBinder.prototype.hasImage = function() {
|
29252 | return _.any(this.tableDataView.columns, function(col) {
|
29253 | return visuals.converterHelper.isImageUrlColumn(col);
|
29254 | });
|
29255 | }, TableBinder.prototype.onStartRenderingSession = function() {}, TableBinder.prototype.onEndRenderingSession = function() {},
|
29256 | TableBinder.prototype.bindRowHeader = function(item, cell) {
|
29257 | item.totalCells ? cell.contentHeight = this.textHeightTotal : cell.contentHeight = this.rowHeight,
|
29258 | TablixUtils.clearCellStyle(cell), this.options.onBindRowHeader && this.options.onBindRowHeader(item);
|
29259 | }, TableBinder.prototype.unbindRowHeader = function(item, cell) {}, TableBinder.prototype.bindColumnHeader = function(item, cell) {
|
29260 | var _this = this;
|
29261 | cell.extension.disableDragResize(), TablixUtils.resetCellCssClass(cell), TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixHeader),
|
29262 | TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixColumnHeaderLeaf);
|
29263 | var cellStyle = new TablixUtils.CellStyle();
|
29264 | cellStyle.fontFamily = TablixUtils.FontFamilyHeader, cellStyle.fontColor = TablixUtils.FontColorHeaders,
|
29265 | cellStyle.borders.bottom = new EdgeSettings(TablixObjects.PropGridOutlineWeight.defaultValue, TablixObjects.PropGridOutlineColor.defaultValue),
|
29266 | cell.contentHeight = this.textHeightHeader;
|
29267 | var element = cell.extension.contentHost;
|
29268 | if (this.sortIconsEnabled() && (element = TablixUtils.addSortIconToColumnHeader(item.sort, element),
|
29269 | item.sort && (cell.contentWidth = this.fontSizeHeader + TablixUtils.SortIconPadding)),
|
29270 | TablixUtils.setCellTextAndTooltip(item.displayName, element, cell.extension.contentHost),
|
29271 | cell.contentWidth += powerbi.TextMeasurementService.measureSvgTextWidth(this.textPropsHeader, item.displayName),
|
29272 | cell.contentWidth = Math.ceil(cell.contentWidth), this.options.onColumnHeaderClick) {
|
29273 | var handler = function(e) {
|
29274 | if (TablixUtils.isValidSortClick(e)) {
|
29275 | var sortDirection = TablixUtils.reverseSort(item.sort);
|
29276 | _this.options.onColumnHeaderClick(item.queryName ? item.queryName : item.displayName, sortDirection);
|
29277 | }
|
29278 | };
|
29279 | cell.extension.registerClickHandler(handler);
|
29280 | }
|
29281 | this.setColumnHeaderStyle(cell, cellStyle), cell.applyStyle(cellStyle);
|
29282 | }, TableBinder.prototype.setColumnHeaderStyle = function(cell, style) {
|
29283 | var propsGrid = this.formattingProperties.grid, props = this.formattingProperties.columnHeaders, propsTotal = this.formattingProperties.total, propsValues = this.formattingProperties.values;
|
29284 | style.borders.top = new EdgeSettings(), style.borders.top.applyParams(visuals.outline.showTop(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29285 | style.borders.bottom = new EdgeSettings(), style.borders.bottom.applyParams(visuals.outline.showBottom(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29286 | style.borders.left = new EdgeSettings(), cell.position.column.isFirst && (style.borders.left.applyParams(visuals.outline.showLeft(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29287 | visuals.outline.showLeft(props.outline) || !visuals.outline.showLeft(propsTotal.outline) && !visuals.outline.showLeft(propsValues.outline) || (style.paddings.left += propsGrid.outlineWeight)),
|
29288 | style.borders.right = new EdgeSettings(), cell.position.column.isLast ? (style.borders.right.applyParams(visuals.outline.showRight(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29289 | visuals.outline.showRight(props.outline) || !visuals.outline.showRight(propsTotal.outline) && !visuals.outline.showRight(propsValues.outline) || (style.paddings.right += propsGrid.outlineWeight)) : style.borders.right.applyParams(propsGrid.gridVertical, propsGrid.gridVerticalWeight, propsGrid.gridVerticalColor, EdgeType.Gridline),
|
29290 | style.fontColor = props.fontColor, style.backColor = props.backColor, style.paddings.top = style.paddings.bottom = propsGrid.rowPadding;
|
29291 | }, TableBinder.prototype.unbindColumnHeader = function(item, cell) {
|
29292 | TablixUtils.clearCellStyle(cell), TablixUtils.clearCellTextAndTooltip(cell), this.sortIconsEnabled() && TablixUtils.removeSortIcons(cell),
|
29293 | this.options.onColumnHeaderClick && cell.extension.unregisterClickHandler();
|
29294 | }, TableBinder.prototype.bindBodyCell = function(item, cell) {
|
29295 | TablixUtils.resetCellCssClass(cell), this.setBodyContent(item, cell), cell.contentWidth = Math.ceil(cell.contentWidth);
|
29296 | var cellStyle = new TablixUtils.CellStyle();
|
29297 | item.isTotal ? (TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixValueTotal),
|
29298 | TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTableFooter), cellStyle.fontFamily = TablixUtils.FontFamilyTotal,
|
29299 | cellStyle.borders.top = new EdgeSettings(TablixObjects.PropGridOutlineWeight.defaultValue, TablixObjects.PropGridOutlineColor.defaultValue)) : item.position.row.isLast ? TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTableBodyCellBottom) : (TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTableBodyCell),
|
29300 | cellStyle.borders.bottom = new EdgeSettings(TablixObjects.PropGridHorizontalWeight.defaultValue, TablixObjects.PropGridHorizontalColor.defaultValue)),
|
29301 | item.isNumeric && TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixValueNumeric),
|
29302 | item.isTotal ? this.setFooterStyle(cell, cellStyle) : this.setBodyStyle(item, cell, cellStyle),
|
29303 | cell.applyStyle(cellStyle);
|
29304 | }, TableBinder.prototype.setBodyContent = function(item, cell) {
|
29305 | var element = cell.extension.contentHost, imgHeight = this.formattingProperties.grid.imageHeight, text = item.textContent;
|
29306 | if (item.isTotal ? cell.contentHeight = this.textHeightTotal : item.isImage ? cell.contentHeight = imgHeight : cell.contentHeight = this.textHeightValue,
|
29307 | item.isUrl && item.isValidUrl) {
|
29308 | var showUrlIcon = this.formattingProperties.values.urlIcon;
|
29309 | return TablixUtils.appendATagToBodyCell(text, element, showUrlIcon), void (showUrlIcon ? cell.contentWidth = this.fontSizeValue : cell.contentWidth = powerbi.TextMeasurementService.measureSvgTextWidth(this.textPropsValue, text));
|
29310 | }
|
29311 | if (item.isImage && item.isValidUrl) return TablixUtils.appendImgTagToBodyCell(text, element, imgHeight),
|
29312 | void (cell.contentWidth = imgHeight * TablixUtils.ImageDefaultAspectRatio);
|
29313 | var kpi = item.kpiContent;
|
29314 | return kpi ? ($(element).append(kpi), void (cell.contentWidth = this.fontSizeValue)) : text ? (TablixUtils.setCellTextAndTooltip(text, element),
|
29315 | void (item.isTotal ? cell.contentWidth = powerbi.TextMeasurementService.measureSvgTextWidth(this.textPropsTotal, text) : cell.contentWidth = powerbi.TextMeasurementService.measureSvgTextWidth(this.textPropsValue, text))) : (TablixUtils.setCellTextAndTooltip(" ", element),
|
29316 | void (cell.contentWidth = 0));
|
29317 | }, TableBinder.prototype.setBodyStyle = function(item, cell, style) {
|
29318 | var propsGrid = this.formattingProperties.grid, props = this.formattingProperties.values, propsTotal = this.formattingProperties.total, propsColumns = this.formattingProperties.columnHeaders;
|
29319 | style.borders.top = new EdgeSettings(), cell.position.row.isFirst && style.borders.top.applyParams(visuals.outline.showTop(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29320 | style.borders.bottom = new EdgeSettings(), cell.position.row.isLast ? style.borders.bottom.applyParams(visuals.outline.showBottom(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline) : style.borders.bottom.applyParams(propsGrid.gridHorizontal, propsGrid.gridHorizontalWeight, propsGrid.gridHorizontalColor, EdgeType.Gridline),
|
29321 | style.borders.left = new EdgeSettings(), cell.position.column.isFirst && (style.borders.left.applyParams(visuals.outline.showLeft(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29322 | visuals.outline.showLeft(props.outline) || !visuals.outline.showLeft(propsTotal.outline) && !visuals.outline.showLeft(propsColumns.outline) || (style.paddings.left += propsGrid.outlineWeight)),
|
29323 | style.borders.right = new EdgeSettings(), cell.position.column.isLast ? (style.borders.right.applyParams(visuals.outline.showRight(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29324 | visuals.outline.showRight(props.outline) || !visuals.outline.showRight(propsTotal.outline) && !visuals.outline.showRight(propsColumns.outline) || (style.paddings.right += propsGrid.outlineWeight)) : style.borders.right.applyParams(propsGrid.gridVertical, propsGrid.gridVerticalWeight, propsGrid.gridVerticalColor, EdgeType.Gridline),
|
29325 | style.fontColor = cell.position.row.index % 2 === 0 ? props.fontColorPrimary : props.fontColorSecondary,
|
29326 | item.backColor ? style.backColor = item.backColor : style.backColor = cell.position.row.index % 2 === 0 ? props.backColorPrimary : props.backColorSecondary,
|
29327 | style.paddings.top = style.paddings.bottom = propsGrid.rowPadding;
|
29328 | }, TableBinder.prototype.setFooterStyle = function(cell, style) {
|
29329 | var props = this.formattingProperties.total, propsGrid = this.formattingProperties.grid, propsValues = this.formattingProperties.values, propsColumns = this.formattingProperties.columnHeaders;
|
29330 | style.borders.top = new EdgeSettings(), style.borders.top.applyParams(visuals.outline.showTop(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29331 | style.borders.bottom = new EdgeSettings(), style.borders.bottom.applyParams(visuals.outline.showBottom(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29332 | style.borders.left = new EdgeSettings(), cell.position.column.isFirst && (style.borders.left.applyParams(visuals.outline.showLeft(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29333 | visuals.outline.showLeft(props.outline) || !visuals.outline.showLeft(propsValues.outline) && !visuals.outline.showLeft(propsColumns.outline) || (style.paddings.left += propsGrid.outlineWeight)),
|
29334 | style.borders.right = new EdgeSettings(), cell.position.column.isLast ? (style.borders.right.applyParams(visuals.outline.showRight(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29335 | visuals.outline.showRight(props.outline) || !visuals.outline.showRight(propsValues.outline) && !visuals.outline.showRight(propsColumns.outline) || (style.paddings.right += propsGrid.outlineWeight)) : style.borders.right.applyParams(propsGrid.gridVertical, propsGrid.gridVerticalWeight, propsGrid.gridVerticalColor, EdgeType.Gridline),
|
29336 | style.fontColor = props.fontColor, style.backColor = props.backColor, style.paddings.top = style.paddings.bottom = propsGrid.rowPadding;
|
29337 | }, TableBinder.prototype.unbindBodyCell = function(item, cell) {
|
29338 | TablixUtils.clearCellStyle(cell), TablixUtils.clearCellTextAndTooltip(cell);
|
29339 | }, TableBinder.prototype.bindCornerCell = function(item, cell) {
|
29340 | cell.contentWidth = 0;
|
29341 | }, TableBinder.prototype.unbindCornerCell = function(item, cell) {}, TableBinder.prototype.bindEmptySpaceHeaderCell = function(cell) {},
|
29342 | TableBinder.prototype.unbindEmptySpaceHeaderCell = function(cell) {}, TableBinder.prototype.bindEmptySpaceFooterCell = function(cell) {},
|
29343 | TableBinder.prototype.unbindEmptySpaceFooterCell = function(cell) {}, TableBinder.prototype.getHeaderLabel = function(item) {
|
29344 | return item ? item.displayName : "";
|
29345 | }, TableBinder.prototype.getCellContent = function(item) {
|
29346 | return item;
|
29347 | }, TableBinder.prototype.hasRowGroups = function() {
|
29348 | return !1;
|
29349 | }, TableBinder.prototype.sortIconsEnabled = function() {
|
29350 | return 0 === this.options.layoutKind;
|
29351 | }, TableBinder;
|
29352 | }();
|
29353 | visuals.TableBinder = TableBinder;
|
29354 | var Table = function() {
|
29355 | function Table() {}
|
29356 | return Table.customizeQuery = function(options) {
|
29357 | var dataViewMapping = options.dataViewMappings[0];
|
29358 | if (dataViewMapping && dataViewMapping.table && dataViewMapping.metadata) {
|
29359 | var dataViewTableRows = dataViewMapping.table.rows, objects = dataViewMapping.metadata.objects;
|
29360 | dataViewTableRows["for"]["in"].subtotalType = TablixObjects.shouldShowTableTotals(objects) ? 1 : 0;
|
29361 | }
|
29362 | }, Table.getSortableRoles = function() {
|
29363 | return [ "Values" ];
|
29364 | }, Table.prototype.init = function(options) {
|
29365 | this.element = options.element, this.style = options.style, this.updateViewport(options.viewport),
|
29366 | this.formatter = visuals.valueFormatter.formatVariantMeasureValue, this.isInteractive = options.interactivity && null != options.interactivity.selection,
|
29367 | this.getLocalizedString = options.host.getLocalizedString, this.hostServices = options.host,
|
29368 | this.persistingObjects = !1, this.waitingForData = !1, this.lastAllowHeaderResize = !0,
|
29369 | this.waitingForSort = !1;
|
29370 | }, Table.converter = function(dataView) {
|
29371 | var table = dataView.table, visualTable = powerbi.Prototype.inherit(table);
|
29372 | visualTable.visualRows = [];
|
29373 | for (var i = 0; i < table.rows.length; i++) {
|
29374 | var visualRow = {
|
29375 | index: i,
|
29376 | values: table.rows[i]
|
29377 | };
|
29378 | visualTable.visualRows.push(visualRow);
|
29379 | }
|
29380 | return visualTable.formattingProperties = TablixObjects.getTableObjects(dataView),
|
29381 | visualTable;
|
29382 | }, Table.prototype.onResizing = function(finalViewport) {
|
29383 | this.updateViewport(finalViewport);
|
29384 | }, Table.prototype.getColumnWidthManager = function() {
|
29385 | return this.columnWidthManager;
|
29386 | }, Table.prototype.onDataChanged = function(options) {
|
29387 | var dataViews = options.dataViews;
|
29388 | if (dataViews && dataViews.length > 0) {
|
29389 | var previousDataView = this.dataView;
|
29390 | if (this.dataView = dataViews[0], this.persistingObjects) return void (this.persistingObjects = !1);
|
29391 | var visualTable = Table.converter(this.dataView);
|
29392 | options.operationKind === powerbi.VisualDataChangeOperationKind.Append ? (this.createOrUpdateHierarchyNavigator(visualTable),
|
29393 | this.tablixControl.updateModels(!1, visualTable.visualRows, visualTable.columns),
|
29394 | this.refreshControl(!1)) : (this.createOrUpdateHierarchyNavigator(visualTable),
|
29395 | this.createColumnWidthManager(), this.createTablixControl(visualTable), this.updateInternal(previousDataView, visualTable));
|
29396 | }
|
29397 | this.waitingForData = !1, this.waitingForSort = !1;
|
29398 | }, Table.prototype.createColumnWidthManager = function() {
|
29399 | var _this = this;
|
29400 | this.columnWidthManager ? this.columnWidthManager.updateDataView(this.dataView) : this.columnWidthManager = new visuals.controls.TablixColumnWidthManager(this.dataView, !1, function(objectInstances) {
|
29401 | return _this.persistColumnWidths(objectInstances);
|
29402 | });
|
29403 | }, Table.prototype.persistColumnWidths = function(objectInstances) {
|
29404 | this.persistingObjects = !0, this.hostServices.persistProperties(objectInstances);
|
29405 | }, Table.prototype.updateViewport = function(newViewport) {
|
29406 | this.currentViewport = newViewport, this.tablixControl && (this.tablixControl.viewport = this.currentViewport,
|
29407 | this.verifyHeaderResize(), this.refreshControl(!1));
|
29408 | }, Table.prototype.refreshControl = function(clear) {
|
29409 | (visuals.visibilityHelper.partiallyVisible(this.element) || 1 === this.getLayoutKind()) && this.tablixControl.refresh(clear);
|
29410 | }, Table.prototype.getLayoutKind = function() {
|
29411 | return this.isInteractive ? 0 : 1;
|
29412 | }, Table.prototype.createOrUpdateHierarchyNavigator = function(visualTable) {
|
29413 | var isDataComplete = !this.dataView.metadata.segment;
|
29414 | if (this.tablixControl) this.hierarchyNavigator.update(visualTable, isDataComplete); else {
|
29415 | var dataNavigator = new TableHierarchyNavigator(visualTable, isDataComplete, this.formatter);
|
29416 | this.hierarchyNavigator = dataNavigator;
|
29417 | }
|
29418 | }, Table.prototype.createTablixControl = function(visualTable) {
|
29419 | if (this.tablixControl) {
|
29420 | var binder = this.tablixControl.getBinder();
|
29421 | binder.updateDataView(visualTable);
|
29422 | } else this.tablixControl = this.createControl(this.hierarchyNavigator, visualTable);
|
29423 | }, Table.prototype.createControl = function(dataNavigator, visualTable) {
|
29424 | var _this = this, layoutKind = this.getLayoutKind(), textSize = visualTable.formattingProperties.general.textSize, tableBinderOptions = {
|
29425 | onBindRowHeader: function(item) {
|
29426 | return _this.onBindRowHeader(item);
|
29427 | },
|
29428 | onColumnHeaderClick: function(queryName, sortDirection) {
|
29429 | return _this.onColumnHeaderClick(queryName, sortDirection);
|
29430 | },
|
29431 | layoutKind: layoutKind
|
29432 | }, tableBinder = new TableBinder(tableBinderOptions, visualTable), layoutManager = 1 === layoutKind ? visuals.controls.internal.DashboardTablixLayoutManager.createLayoutManager(tableBinder) : visuals.controls.internal.CanvasTablixLayoutManager.createLayoutManager(tableBinder, this.columnWidthManager), tablixContainer = document.createElement("div");
|
29433 | this.element.append(tablixContainer);
|
29434 | var tablixOptions = {
|
29435 | interactive: this.isInteractive,
|
29436 | enableTouchSupport: !0,
|
29437 | layoutKind: layoutKind,
|
29438 | fontSize: TablixObjects.getTextSizeInPx(textSize)
|
29439 | };
|
29440 | return new visuals.controls.TablixControl(dataNavigator, layoutManager, tableBinder, tablixContainer, tablixOptions);
|
29441 | }, Table.prototype.updateInternal = function(previousDataView, visualTable) {
|
29442 | var _this = this, textSize = visualTable.formattingProperties.general.textSize;
|
29443 | 1 === this.getLayoutKind() && this.tablixControl.layoutManager.adjustContentSize(visuals.converterHelper.hasImageUrlColumn(this.dataView)),
|
29444 | this.tablixControl.fontSize = TablixObjects.getTextSizeInPx(textSize), this.verifyHeaderResize(),
|
29445 | this.tablixControl.updateModels(!0, visualTable.visualRows, visualTable.columns);
|
29446 | var totals = this.createTotalsRow(this.dataView);
|
29447 | this.tablixControl.rowDimension.setFooter(totals), this.tablixControl.viewport = this.currentViewport;
|
29448 | var shouldClearControl = this.shouldClearControl(previousDataView, this.dataView);
|
29449 | setTimeout(function() {
|
29450 | _this.refreshControl(shouldClearControl);
|
29451 | var widthChanged = _this.columnWidthManager.onColumnsRendered(_this.tablixControl.layoutManager.columnWidthsToPersist);
|
29452 | _this.persistingObjects && !widthChanged && (_this.persistingObjects = !1);
|
29453 | }, 0);
|
29454 | }, Table.prototype.shouldClearControl = function(previousDataView, newDataView) {
|
29455 | return this.waitingForSort && previousDataView && newDataView ? !powerbi.DataViewAnalysis.isMetadataEquivalent(previousDataView.metadata, newDataView.metadata) : !0;
|
29456 | }, Table.prototype.createTotalsRow = function(dataView) {
|
29457 | if (!TablixObjects.shouldShowTableTotals(dataView.metadata.objects)) return null;
|
29458 | var totals = dataView.table.totals;
|
29459 | if (!totals || 0 === totals.length) return null;
|
29460 | for (var totalRow = [], columns = dataView.table.columns, i = 0, len = columns.length; len > i; ++i) {
|
29461 | var column = columns[i], totalValue = totals[column.index];
|
29462 | null != totalValue ? totalRow.push(totalValue) : totalRow.push(0 === i ? this.getLocalizedString("TableTotalLabel") : "");
|
29463 | }
|
29464 | return {
|
29465 | totalCells: totalRow
|
29466 | };
|
29467 | }, Table.prototype.onBindRowHeader = function(item) {
|
29468 | this.needsMoreData(item) && (this.hostServices.loadMoreData(), this.waitingForData = !0);
|
29469 | }, Table.prototype.onColumnHeaderClick = function(queryName, sortDirection) {
|
29470 | this.waitingForSort = !0, this.hostServices.onCustomSort(TablixUtils.getCustomSortEventArgs(queryName, sortDirection));
|
29471 | }, Table.prototype.needsMoreData = function(item) {
|
29472 | if (this.waitingForData || !this.dataView.metadata || !this.dataView.metadata.segment) return !1;
|
29473 | var leafCount = this.tablixControl.rowDimension.getItemsCount(), loadMoreThreshold = leafCount * Table.preferredLoadMoreThreshold;
|
29474 | return this.hierarchyNavigator.getIndex(item) >= loadMoreThreshold;
|
29475 | }, Table.prototype.enumerateObjectInstances = function(options) {
|
29476 | var enumeration = new visuals.ObjectEnumerationBuilder();
|
29477 | return this.dataView && TablixObjects.enumerateObjectInstances(options, enumeration, this.dataView, visuals.controls.TablixType.Table),
|
29478 | enumeration.complete();
|
29479 | }, Table.prototype.enumerateObjectRepetition = function() {
|
29480 | var enumeration = [];
|
29481 | return this.dataView && TablixObjects.enumerateObjectRepetition(enumeration, this.dataView, visuals.controls.TablixType.Table),
|
29482 | enumeration;
|
29483 | }, Table.prototype.shouldAllowHeaderResize = function() {
|
29484 | return 1 === this.hostServices.getViewMode();
|
29485 | }, Table.prototype.onViewModeChanged = function(viewMode) {
|
29486 | this.updateViewport(this.currentViewport);
|
29487 | }, Table.prototype.verifyHeaderResize = function() {
|
29488 | var currentAllowHeaderResize = this.shouldAllowHeaderResize();
|
29489 | currentAllowHeaderResize !== this.lastAllowHeaderResize && (this.lastAllowHeaderResize = currentAllowHeaderResize,
|
29490 | this.tablixControl.layoutManager.setAllowHeaderResize(currentAllowHeaderResize));
|
29491 | }, Table.preferredLoadMoreThreshold = .8, Table;
|
29492 | }();
|
29493 | visuals.Table = Table;
|
29494 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
29495 | }(powerbi || (powerbi = {}));
|
29496 | }, function(module, exports) {
|
29497 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi, __extends = (window.powerbitests,
|
29498 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
29499 | function __() {
|
29500 | this.constructor = d;
|
29501 | }
|
29502 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
29503 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
29504 | });
|
29505 | !function(powerbi) {
|
29506 | var visuals;
|
29507 | !function(visuals) {
|
29508 | function createMatrixHierarchyNavigator(matrix, isDataComplete, formatter, compositeGroupSeparator) {
|
29509 | return new MatrixHierarchyNavigator(matrix, isDataComplete, formatter, compositeGroupSeparator);
|
29510 | }
|
29511 | var TablixUtils = visuals.controls.internal.TablixUtils, TablixObjects = visuals.controls.internal.TablixObjects, UrlUtils = jsCommon.UrlUtils, EdgeSettings = TablixUtils.EdgeSettings, EdgeType = TablixUtils.EdgeType, MatrixVisualBodyItem = function(_super) {
|
29512 | function MatrixVisualBodyItem() {
|
29513 | _super.apply(this, arguments);
|
29514 | }
|
29515 | return __extends(MatrixVisualBodyItem, _super), Object.defineProperty(MatrixVisualBodyItem.prototype, "isMeasure", {
|
29516 | get: function() {
|
29517 | return !0;
|
29518 | },
|
29519 | enumerable: !0,
|
29520 | configurable: !0
|
29521 | }), Object.defineProperty(MatrixVisualBodyItem.prototype, "isValidUrl", {
|
29522 | get: function() {
|
29523 | return !1;
|
29524 | },
|
29525 | enumerable: !0,
|
29526 | configurable: !0
|
29527 | }), Object.defineProperty(MatrixVisualBodyItem.prototype, "isValidImage", {
|
29528 | get: function() {
|
29529 | return !1;
|
29530 | },
|
29531 | enumerable: !0,
|
29532 | configurable: !0
|
29533 | }), MatrixVisualBodyItem;
|
29534 | }(TablixUtils.TablixVisualCell);
|
29535 | visuals.MatrixVisualBodyItem = MatrixVisualBodyItem, visuals.createMatrixHierarchyNavigator = createMatrixHierarchyNavigator;
|
29536 | var MatrixHierarchyNavigator = function() {
|
29537 | function MatrixHierarchyNavigator(matrix, isDataComplete, formatter, compositeGroupSeparator) {
|
29538 | this.matrix = matrix, this.rowHierarchy = MatrixHierarchyNavigator.wrapMatrixHierarchy(matrix.rows),
|
29539 | this.columnHierarchy = MatrixHierarchyNavigator.wrapMatrixHierarchy(matrix.columns),
|
29540 | this.formatter = formatter, this.compositeGroupSeparator = compositeGroupSeparator,
|
29541 | this.isDataComplete = isDataComplete, this.update();
|
29542 | }
|
29543 | return MatrixHierarchyNavigator.prototype.getDataViewMatrix = function() {
|
29544 | return this.matrix;
|
29545 | }, MatrixHierarchyNavigator.prototype.getColumnHierarchyDepth = function() {
|
29546 | return Math.max(this.columnHierarchy.levels.length, 1);
|
29547 | }, MatrixHierarchyNavigator.prototype.getRowHierarchyDepth = function() {
|
29548 | return Math.max(this.rowHierarchy.levels.length, 1);
|
29549 | }, MatrixHierarchyNavigator.prototype.getLeafCount = function(hierarchy) {
|
29550 | var matrixHierarchy = this.getMatrixHierarchy(hierarchy);
|
29551 | return matrixHierarchy ? matrixHierarchy.leafNodes.length : 0;
|
29552 | }, MatrixHierarchyNavigator.prototype.getLeafAt = function(hierarchy, index) {
|
29553 | var matrixHierarchy = this.getMatrixHierarchy(hierarchy);
|
29554 | return matrixHierarchy ? matrixHierarchy.leafNodes[index] : null;
|
29555 | }, MatrixHierarchyNavigator.prototype.getLeafIndex = function(item) {
|
29556 | return item.leafIndex;
|
29557 | }, MatrixHierarchyNavigator.prototype.getParent = function(item) {
|
29558 | return 0 === item.level ? null : item.parent;
|
29559 | }, MatrixHierarchyNavigator.prototype.getIndex = function(item) {
|
29560 | return item ? item.index : -1;
|
29561 | }, MatrixHierarchyNavigator.prototype.isLeaf = function(item) {
|
29562 | return !item.children || 0 === item.children.length;
|
29563 | }, MatrixHierarchyNavigator.prototype.isRowHierarchyLeaf = function(item) {
|
29564 | return !0;
|
29565 | }, MatrixHierarchyNavigator.prototype.isColumnHierarchyLeaf = function(item) {
|
29566 | return !1;
|
29567 | }, MatrixHierarchyNavigator.prototype.isFirstItem = function(item, items) {
|
29568 | return item === _.first(items);
|
29569 | }, MatrixHierarchyNavigator.prototype.areAllParentsFirst = function(item, items) {
|
29570 | if (!item) return !1;
|
29571 | var parent = this.getParent(item);
|
29572 | return parent ? this.isFirstItem(item, item.siblings) && this.areAllParentsFirst(parent, parent.siblings) : this.isFirstItem(item, item.siblings);
|
29573 | }, MatrixHierarchyNavigator.prototype.isLastItem = function(item, items) {
|
29574 | return item !== _.last(items) ? !1 : !this.isItemRow(item) || this.isDataComplete;
|
29575 | }, MatrixHierarchyNavigator.prototype.isItemRow = function(item) {
|
29576 | if (!item) return !1;
|
29577 | for (var firstLevelParent = item; firstLevelParent.parent; ) firstLevelParent = firstLevelParent.parent;
|
29578 | return firstLevelParent.siblings === this.rowHierarchy.root.children;
|
29579 | }, MatrixHierarchyNavigator.prototype.areAllParentsLast = function(item, items) {
|
29580 | if (!item) return !1;
|
29581 | var parent = this.getParent(item);
|
29582 | return parent ? this.isLastItem(item, item.siblings) && this.areAllParentsLast(parent, parent.siblings) : this.isLastItem(item, item.siblings);
|
29583 | }, MatrixHierarchyNavigator.prototype.getChildren = function(item) {
|
29584 | return item.children;
|
29585 | }, MatrixHierarchyNavigator.prototype.getChildrenLevelDifference = function(item) {
|
29586 | for (var diff = 1 / 0, children = this.getChildren(item), i = 0, ilen = children.length; ilen > i; i++) diff = Math.min(diff, children[i].level - item.level);
|
29587 | return diff;
|
29588 | }, MatrixHierarchyNavigator.prototype.getCount = function(items) {
|
29589 | return items.length;
|
29590 | }, MatrixHierarchyNavigator.prototype.getAt = function(items, index) {
|
29591 | return items[index];
|
29592 | }, MatrixHierarchyNavigator.prototype.getLevel = function(item) {
|
29593 | return item.level;
|
29594 | }, MatrixHierarchyNavigator.prototype.getIntersection = function(rowItem, columnItem) {
|
29595 | var node, valueSource, bodyCell, isSubtotalItem = rowItem.isSubtotal === !0 || columnItem.isSubtotal === !0, rowIndex = rowItem.leafIndex, colIndex = columnItem.leafIndex;
|
29596 | return node = rowItem.values ? rowItem.values[columnItem.leafIndex] : void 0, node ? (valueSource = this.matrix.valueSources[node.valueSourceIndex || 0],
|
29597 | bodyCell = new MatrixVisualBodyItem(node.value, isSubtotalItem, valueSource, this.formatter, !1)) : bodyCell = new MatrixVisualBodyItem(void 0, isSubtotalItem, void 0, this.formatter, !1),
|
29598 | bodyCell.position.row.index = rowIndex, bodyCell.position.row.indexInSiblings = rowItem.siblings.indexOf(rowItem),
|
29599 | bodyCell.position.row.isFirst = 0 === rowIndex, bodyCell.position.row.isLast = this.isDataComplete && rowIndex === this.rowHierarchy.leafNodes.length - 1,
|
29600 | bodyCell.position.column.index = colIndex, bodyCell.position.column.indexInSiblings = columnItem.siblings.indexOf(columnItem),
|
29601 | bodyCell.position.column.isFirst = 0 === colIndex, bodyCell.position.column.isLast = colIndex === this.columnHierarchy.leafNodes.length - 1,
|
29602 | bodyCell;
|
29603 | }, MatrixHierarchyNavigator.prototype.getCorner = function(rowLevel, columnLevel) {
|
29604 | var columnLevels = this.columnHierarchy.levels, rowLevels = this.rowHierarchy.levels;
|
29605 | if (columnLevel === columnLevels.length - 1 || 0 === columnLevels.length) {
|
29606 | var levelSource = rowLevels[rowLevel];
|
29607 | if (levelSource) return {
|
29608 | metadata: 1 === levelSource.sources.length ? levelSource.sources[0] : null,
|
29609 | displayName: _.map(levelSource.sources, function(source) {
|
29610 | return source.displayName;
|
29611 | }).join(this.compositeGroupSeparator),
|
29612 | isColumnHeaderLeaf: !0,
|
29613 | isRowHeaderLeaf: rowLevel === rowLevels.length - 1
|
29614 | };
|
29615 | }
|
29616 | if (rowLevel === rowLevels.length - 1) {
|
29617 | var levelSource = columnLevels[columnLevel];
|
29618 | if (levelSource) return {
|
29619 | metadata: 1 === levelSource.sources.length ? levelSource.sources[0] : null,
|
29620 | displayName: _.map(levelSource.sources, function(source) {
|
29621 | return source.displayName;
|
29622 | }).join(this.compositeGroupSeparator),
|
29623 | isColumnHeaderLeaf: !1,
|
29624 | isRowHeaderLeaf: !0
|
29625 | };
|
29626 | }
|
29627 | return {
|
29628 | metadata: null,
|
29629 | displayName: "",
|
29630 | isColumnHeaderLeaf: !1,
|
29631 | isRowHeaderLeaf: !1
|
29632 | };
|
29633 | }, MatrixHierarchyNavigator.prototype.headerItemEquals = function(item1, item2) {
|
29634 | return item1 && item2 ? item1 === item2 : !1;
|
29635 | }, MatrixHierarchyNavigator.prototype.bodyCellItemEquals = function(item1, item2) {
|
29636 | return item1.position.isMatch(item2.position);
|
29637 | }, MatrixHierarchyNavigator.prototype.cornerCellItemEquals = function(item1, item2) {
|
29638 | var corner1 = item1, corner2 = item2;
|
29639 | return corner1 && corner2 ? corner1.displayName === corner2.displayName && corner1.isColumnHeaderLeaf === corner2.isColumnHeaderLeaf && corner1.isRowHeaderLeaf === corner2.isRowHeaderLeaf && corner1.metadata === corner2.metadata : !1;
|
29640 | }, MatrixHierarchyNavigator.prototype.getMatrixColumnHierarchy = function() {
|
29641 | return this.columnHierarchy;
|
29642 | }, MatrixHierarchyNavigator.prototype.getMatrixRowHierarchy = function() {
|
29643 | return this.rowHierarchy;
|
29644 | }, MatrixHierarchyNavigator.prototype.update = function(dataViewMatrix, isDataComplete, updateColumns) {
|
29645 | void 0 === updateColumns && (updateColumns = !0), dataViewMatrix && (this.matrix = dataViewMatrix,
|
29646 | null != isDataComplete && (this.isDataComplete = isDataComplete), this.rowHierarchy = MatrixHierarchyNavigator.wrapMatrixHierarchy(dataViewMatrix.rows),
|
29647 | updateColumns && (this.columnHierarchy = MatrixHierarchyNavigator.wrapMatrixHierarchy(dataViewMatrix.columns))),
|
29648 | this.updateHierarchy(this.rowHierarchy), updateColumns && (this.updateHierarchy(this.columnHierarchy),
|
29649 | MatrixHierarchyNavigator.updateStaticColumnHeaders(this.columnHierarchy));
|
29650 | }, MatrixHierarchyNavigator.wrapMatrixHierarchy = function(hierarchy) {
|
29651 | var matrixHierarchy = powerbi.Prototype.inherit(hierarchy);
|
29652 | return matrixHierarchy.leafNodes = [], matrixHierarchy;
|
29653 | }, MatrixHierarchyNavigator.prototype.updateHierarchy = function(hierarchy) {
|
29654 | hierarchy.leafNodes.length > 0 && (hierarchy.leafNodes.length = 0), hierarchy.root.children && this.updateRecursive(hierarchy, hierarchy.root.children, null, hierarchy.leafNodes);
|
29655 | }, MatrixHierarchyNavigator.prototype.updateRecursive = function(hierarchy, nodes, parent, cache) {
|
29656 | for (var level, _this = this, formatStringPropID = TablixObjects.PropColumnFormatString.getPropertyID(), i = 0, ilen = nodes.length; ilen > i; i++) {
|
29657 | var node = nodes[i];
|
29658 | if (node.siblings = nodes, parent && (node.parent = parent), level || (level = hierarchy.levels[node.level]),
|
29659 | level) if (node.levelValues) {
|
29660 | var displayNames = _.map(node.levelValues, function(component) {
|
29661 | var source = level.sources[component.levelSourceIndex || 0];
|
29662 | return _this.formatter(component.value, source, formatStringPropID, !1);
|
29663 | });
|
29664 | node.valueFormatted = displayNames.join(this.compositeGroupSeparator), node.queryName = 1 !== level.sources.length ? void 0 : level.sources[0].queryName;
|
29665 | } else {
|
29666 | var source = level.sources[node.levelSourceIndex || 0];
|
29667 | node.valueFormatted = source.displayName, node.queryName = source.queryName;
|
29668 | }
|
29669 | node.index = i, node.children && node.children.length > 0 ? this.updateRecursive(hierarchy, node.children, node, cache) : (node.leafIndex = cache.length,
|
29670 | cache.push(node));
|
29671 | }
|
29672 | }, MatrixHierarchyNavigator.updateStaticColumnHeaders = function(columnHierarchy) {
|
29673 | var columnLeafNodes = columnHierarchy.leafNodes;
|
29674 | if (columnLeafNodes && columnLeafNodes.length > 0) for (var columnLeafSources = columnHierarchy.levels[columnLeafNodes[0].level].sources, i = 0, ilen = columnLeafNodes.length; ilen > i; i++) {
|
29675 | var columnLeafNode = columnLeafNodes[i];
|
29676 | if (!columnLeafNode.identity && _.isEmpty(columnLeafNode.levelValues)) {
|
29677 | var source = columnLeafSources[columnLeafNode.levelSourceIndex ? columnLeafNode.levelSourceIndex : 0];
|
29678 | source && (columnLeafNode.valueFormatted = source.displayName);
|
29679 | }
|
29680 | }
|
29681 | }, MatrixHierarchyNavigator.prototype.getMatrixHierarchy = function(rootNodes) {
|
29682 | var rowHierarchyRootNodes = this.rowHierarchy.root.children;
|
29683 | if (rowHierarchyRootNodes && rootNodes === rowHierarchyRootNodes) return this.rowHierarchy;
|
29684 | var columnHierarchyRootNodes = this.columnHierarchy.root.children;
|
29685 | return columnHierarchyRootNodes && rootNodes === columnHierarchyRootNodes ? this.columnHierarchy : null;
|
29686 | }, MatrixHierarchyNavigator;
|
29687 | }(), MatrixBinder = function() {
|
29688 | function MatrixBinder(hierarchyNavigator, options) {
|
29689 | this.hierarchyNavigator = hierarchyNavigator, this.options = options;
|
29690 | }
|
29691 | return MatrixBinder.prototype.onDataViewChanged = function(formattingProperties) {
|
29692 | this.formattingProperties = formattingProperties, this.updateTextHeights();
|
29693 | }, MatrixBinder.prototype.updateTextHeights = function() {
|
29694 | this.fontSizeHeader = jsCommon.PixelConverter.fromPointToPixel(this.formattingProperties.general.textSize),
|
29695 | this.textPropsHeader = {
|
29696 | fontFamily: TablixUtils.FontFamilyHeader,
|
29697 | fontSize: jsCommon.PixelConverter.toString(this.fontSizeHeader)
|
29698 | }, this.textHeightHeader = Math.ceil(powerbi.TextMeasurementService.measureSvgTextHeight(this.textPropsHeader, "a")),
|
29699 | this.fontSizeValue = jsCommon.PixelConverter.fromPointToPixel(this.formattingProperties.general.textSize),
|
29700 | this.textPropsValue = {
|
29701 | fontFamily: TablixUtils.FontFamilyCell,
|
29702 | fontSize: jsCommon.PixelConverter.toString(this.fontSizeValue)
|
29703 | }, this.textHeightValue = Math.ceil(powerbi.TextMeasurementService.measureSvgTextHeight(this.textPropsValue, "a")),
|
29704 | this.fontSizeTotal = jsCommon.PixelConverter.fromPointToPixel(this.formattingProperties.general.textSize),
|
29705 | this.textPropsTotal = {
|
29706 | fontFamily: TablixUtils.FontFamilyTotal,
|
29707 | fontSize: jsCommon.PixelConverter.toString(this.fontSizeTotal)
|
29708 | }, this.textHeightTotal = Math.ceil(powerbi.TextMeasurementService.measureSvgTextHeight(this.textPropsTotal, "a"));
|
29709 | }, MatrixBinder.prototype.onStartRenderingSession = function() {}, MatrixBinder.prototype.onEndRenderingSession = function() {},
|
29710 | MatrixBinder.prototype.bindRowHeader = function(item, cell) {
|
29711 | TablixUtils.resetCellCssClass(cell);
|
29712 | var cellStyle = new TablixUtils.CellStyle(), isLeaf = this.hierarchyNavigator && this.hierarchyNavigator.isLeaf(item);
|
29713 | isLeaf && (TablixUtils.addCellCssClass(cell, TablixUtils.CssClassMatrixRowHeaderLeaf),
|
29714 | cellStyle.borders.right = new EdgeSettings(TablixObjects.PropGridOutlineWeight.defaultValue, TablixObjects.PropGridOutlineColor.defaultValue)),
|
29715 | item.isSubtotal && (cellStyle.paddings.left = TablixUtils.CellPaddingLeftMatrixTotal),
|
29716 | cell.contentWidth = 0, this.bindHeader(item, cell, cell.extension.contentHost, this.getRowHeaderMetadata(item), cellStyle),
|
29717 | cell.contentWidth = Math.ceil(cell.contentWidth), this.options.onBindRowHeader && this.options.onBindRowHeader(item),
|
29718 | this.setRowHeaderStyle(cell, cellStyle), cell.applyStyle(cellStyle);
|
29719 | }, MatrixBinder.prototype.setRowHeaderStyle = function(cell, style) {
|
29720 | var propsGrid = this.formattingProperties.grid, props = this.formattingProperties.rowHeaders, propsValues = this.formattingProperties.values, propsCols = this.formattingProperties.columnHeaders;
|
29721 | style.borders.top = new EdgeSettings(), cell.position.row.isFirst && (style.borders.top.applyParams(visuals.outline.showTop(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29722 | !visuals.outline.showTop(props.outline) && visuals.outline.showTop(propsValues.outline) && (style.paddings.top += propsGrid.outlineWeight)),
|
29723 | style.borders.bottom = new EdgeSettings(), cell.position.row.isLast ? (style.borders.bottom.applyParams(visuals.outline.showBottom(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29724 | !visuals.outline.showBottom(props.outline) && visuals.outline.showBottom(propsValues.outline) && (style.paddings.bottom += propsGrid.outlineWeight)) : style.borders.bottom.applyParams(propsGrid.gridHorizontal, propsGrid.gridHorizontalWeight, propsGrid.gridHorizontalColor, EdgeType.Gridline),
|
29725 | style.borders.left = new EdgeSettings(), cell.position.column.isFirst && (style.borders.left.applyParams(visuals.outline.showLeft(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29726 | !visuals.outline.showLeft(props.outline) && visuals.outline.showLeft(propsCols.outline) && (style.paddings.left += propsGrid.outlineWeight)),
|
29727 | style.borders.right = new EdgeSettings(), cell.position.column.isLast ? style.borders.right.applyParams(visuals.outline.showRight(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline) : style.borders.right.applyParams(propsGrid.gridVertical, propsGrid.gridVerticalWeight, propsGrid.gridVerticalColor, EdgeType.Gridline),
|
29728 | style.fontColor = props.fontColor, style.backColor = props.backColor, style.paddings.top = style.paddings.bottom = propsGrid.rowPadding;
|
29729 | }, MatrixBinder.prototype.unbindRowHeader = function(item, cell) {
|
29730 | TablixUtils.clearCellStyle(cell), TablixUtils.clearCellTextAndTooltip(cell);
|
29731 | }, MatrixBinder.prototype.bindColumnHeader = function(item, cell) {
|
29732 | TablixUtils.resetCellCssClass(cell);
|
29733 | var cellStyle = new TablixUtils.CellStyle(), overwriteTotalLabel = !1, cellElement = cell.extension.contentHost;
|
29734 | cell.contentWidth = 0;
|
29735 | var isLeaf = this.hierarchyNavigator && this.hierarchyNavigator.isLeaf(item);
|
29736 | if (isLeaf) {
|
29737 | if (cellStyle.borders.bottom = new EdgeSettings(TablixObjects.PropGridOutlineWeight.defaultValue, TablixObjects.PropGridOutlineColor.defaultValue),
|
29738 | TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixColumnHeaderLeaf), TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixValueNumeric),
|
29739 | this.options.showSortIcons) {
|
29740 | var sortableHeaderColumnMetadata = this.getSortableHeaderColumnMetadata(item);
|
29741 | sortableHeaderColumnMetadata && (this.registerColumnHeaderClickHandler(sortableHeaderColumnMetadata, cell),
|
29742 | cellElement = TablixUtils.addSortIconToColumnHeader(sortableHeaderColumnMetadata.sort, cellElement),
|
29743 | sortableHeaderColumnMetadata.sort && (cell.contentWidth = this.fontSizeHeader + TablixUtils.SortIconPadding));
|
29744 | }
|
29745 | item.isSubtotal && item.parent && item.parent.children.length > 1 && item.parent.children[0].isSubtotal && (overwriteTotalLabel = !0);
|
29746 | }
|
29747 | cell.extension.disableDragResize(), this.bindHeader(item, cell, cellElement, this.getColumnHeaderMetadata(item), cellStyle, overwriteTotalLabel),
|
29748 | cell.contentWidth = Math.ceil(cell.contentWidth), this.setColumnHeaderStyle(cell, cellStyle),
|
29749 | cell.applyStyle(cellStyle);
|
29750 | }, MatrixBinder.prototype.setColumnHeaderStyle = function(cell, style) {
|
29751 | var propsGrid = this.formattingProperties.grid, props = this.formattingProperties.columnHeaders, propsValues = this.formattingProperties.values;
|
29752 | style.fontColor = props.fontColor, style.backColor = props.backColor, style.paddings.top = style.paddings.bottom = propsGrid.rowPadding,
|
29753 | style.borders.top = new EdgeSettings(), cell.position.row.isFirst && style.borders.top.applyParams(visuals.outline.showTop(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29754 | style.borders.bottom = new EdgeSettings(), cell.position.row.isLast ? style.borders.bottom.applyParams(visuals.outline.showBottom(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline) : style.borders.bottom.applyParams(propsGrid.gridHorizontal, propsGrid.gridHorizontalWeight, propsGrid.gridHorizontalColor, EdgeType.Gridline),
|
29755 | style.borders.left = new EdgeSettings(), cell.position.column.isFirst && !visuals.outline.showLeft(props.outline) && visuals.outline.showLeft(propsValues.outline) && (style.paddings.left += propsGrid.outlineWeight),
|
29756 | style.borders.right = new EdgeSettings(), cell.position.column.isLast ? (style.borders.right.applyParams(visuals.outline.showRight(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29757 | !visuals.outline.showRight(props.outline) && visuals.outline.showRight(propsValues.outline) && (style.paddings.right += propsGrid.outlineWeight)) : style.borders.right.applyParams(propsGrid.gridVertical, propsGrid.gridVerticalWeight, propsGrid.gridVerticalColor, EdgeType.Gridline);
|
29758 | }, MatrixBinder.prototype.unbindColumnHeader = function(item, cell) {
|
29759 | TablixUtils.clearCellStyle(cell), TablixUtils.clearCellTextAndTooltip(cell);
|
29760 | var sortableHeaderColumnMetadata = this.getSortableHeaderColumnMetadata(item);
|
29761 | sortableHeaderColumnMetadata && this.unregisterColumnHeaderClickHandler(cell), this.options.showSortIcons && TablixUtils.removeSortIcons(cell);
|
29762 | }, MatrixBinder.prototype.bindHeader = function(item, cell, cellElement, metadata, style, overwriteSubtotalLabel) {
|
29763 | TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixHeader), style.fontFamily = TablixUtils.FontFamilyHeader,
|
29764 | style.fontColor = TablixUtils.FontColorHeaders;
|
29765 | var imgHeight = this.formattingProperties.grid.imageHeight;
|
29766 | if (visuals.converterHelper.isImageUrlColumn(metadata) ? cell.contentHeight = imgHeight : item.isSubtotal ? cell.contentHeight = this.textHeightTotal : cell.contentHeight = this.textHeightValue,
|
29767 | item.isSubtotal && (TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixValueTotal),
|
29768 | style.fontFamily = TablixUtils.FontFamilyTotal, !overwriteSubtotalLabel)) return TablixUtils.setCellTextAndTooltip(this.options.totalLabel, cellElement, cell.extension.contentHost),
|
29769 | void (cell.contentWidth = powerbi.TextMeasurementService.measureSvgTextWidth(this.textPropsTotal, this.options.totalLabel));
|
29770 | var value = this.getHeaderLabel(item);
|
29771 | return value ? visuals.converterHelper.isWebUrlColumn(metadata) && UrlUtils.isValidUrl(value) ? (TablixUtils.appendATagToBodyCell(value, cellElement),
|
29772 | void (cell.contentWidth += powerbi.TextMeasurementService.measureSvgTextWidth(this.textPropsHeader, value))) : visuals.converterHelper.isImageUrlColumn(metadata) && UrlUtils.isValidImageUrl(value) ? (TablixUtils.appendImgTagToBodyCell(item.valueFormatted, cellElement, imgHeight),
|
29773 | void (cell.contentWidth += imgHeight * TablixUtils.ImageDefaultAspectRatio)) : (TablixUtils.setCellTextAndTooltip(value, cellElement, cell.extension.contentHost),
|
29774 | void (cell.contentWidth += powerbi.TextMeasurementService.measureSvgTextWidth(item.isSubtotal ? this.textPropsTotal : this.textPropsHeader, value))) : void (cellElement.innerHTML = TablixUtils.StringNonBreakingSpace);
|
29775 | }, MatrixBinder.prototype.registerColumnHeaderClickHandler = function(columnMetadata, cell) {
|
29776 | var _this = this;
|
29777 | if (this.options.onColumnHeaderClick) {
|
29778 | var handler = function(e) {
|
29779 | if (TablixUtils.isValidSortClick(e)) {
|
29780 | var sortDirection = TablixUtils.reverseSort(columnMetadata.sort);
|
29781 | _this.options.onColumnHeaderClick(columnMetadata.queryName ? columnMetadata.queryName : columnMetadata.displayName, sortDirection);
|
29782 | }
|
29783 | };
|
29784 | cell.extension.registerClickHandler(handler);
|
29785 | }
|
29786 | }, MatrixBinder.prototype.unregisterColumnHeaderClickHandler = function(cell) {
|
29787 | this.options.onColumnHeaderClick && cell.extension.unregisterClickHandler();
|
29788 | }, MatrixBinder.prototype.bindBodyCell = function(item, cell) {
|
29789 | TablixUtils.resetCellCssClass(cell);
|
29790 | var cellStyle = new TablixUtils.CellStyle();
|
29791 | cell.contentHeight = this.textHeightValue;
|
29792 | var kpi = item.kpiContent;
|
29793 | if (kpi) $(cell.extension.contentHost).append(kpi), cell.contentWidth = this.fontSizeValue; else {
|
29794 | var textProps = this.textPropsValue;
|
29795 | TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixValueNumeric), item.isTotal && (TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixValueTotal),
|
29796 | cellStyle.fontFamily = TablixUtils.FontFamilyTotal, cell.contentHeight = this.textHeightTotal,
|
29797 | textProps = this.textPropsTotal);
|
29798 | var textContent = item.textContent;
|
29799 | textContent && (TablixUtils.setCellTextAndTooltip(textContent, cell.extension.contentHost),
|
29800 | cell.contentWidth = powerbi.TextMeasurementService.measureSvgTextWidth(textProps, textContent));
|
29801 | }
|
29802 | cell.contentWidth = Math.ceil(cell.contentWidth), this.setBodyCellStyle(cell, item, cellStyle),
|
29803 | cell.applyStyle(cellStyle);
|
29804 | }, MatrixBinder.prototype.setBodyCellStyle = function(cell, item, style) {
|
29805 | var propsGrid = this.formattingProperties.grid, props = this.formattingProperties.values, propsTotal = this.formattingProperties.subtotals, propsRows = this.formattingProperties.rowHeaders, propsColumns = this.formattingProperties.columnHeaders;
|
29806 | style.paddings.top = style.paddings.bottom = propsGrid.rowPadding, style.borders.top = new EdgeSettings(),
|
29807 | cell.position.row.isFirst && (style.borders.top.applyParams(visuals.outline.showTop(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29808 | !visuals.outline.showTop(props.outline) && visuals.outline.showTop(propsRows.outline) && (style.paddings.top += propsGrid.outlineWeight)),
|
29809 | style.borders.bottom = new EdgeSettings(), cell.position.row.isLast ? (style.borders.bottom.applyParams(visuals.outline.showBottom(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29810 | !visuals.outline.showBottom(props.outline) && visuals.outline.showBottom(propsRows.outline) && (style.paddings.bottom += propsGrid.outlineWeight)) : style.borders.bottom.applyParams(propsGrid.gridHorizontal, propsGrid.gridHorizontalWeight, propsGrid.gridHorizontalColor),
|
29811 | style.borders.left = new EdgeSettings(), cell.position.column.isFirst && style.borders.left.applyParams(visuals.outline.showLeft(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29812 | style.borders.right = new EdgeSettings(), cell.position.column.isLast ? (style.borders.right.applyParams(visuals.outline.showRight(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29813 | !visuals.outline.showRight(props.outline) && visuals.outline.showRight(propsColumns.outline) && (style.paddings.right += propsGrid.outlineWeight)) : style.borders.right.applyParams(propsGrid.gridVertical, propsGrid.gridVerticalWeight, propsGrid.gridVerticalColor, EdgeType.Gridline);
|
29814 | var rowBandingIndex;
|
29815 | rowBandingIndex = this.formattingProperties.general.rowSubtotals && propsTotal.backColor ? item.position.row.indexInSiblings : item.position.row.index,
|
29816 | item.isTotal && propsTotal.fontColor ? style.fontColor = propsTotal.fontColor : style.fontColor = rowBandingIndex % 2 === 0 ? props.fontColorPrimary : props.fontColorSecondary,
|
29817 | item.isTotal && propsTotal.backColor ? style.backColor = propsTotal.backColor : style.backColor = rowBandingIndex % 2 === 0 ? props.backColorPrimary : props.backColorSecondary;
|
29818 | }, MatrixBinder.prototype.unbindBodyCell = function(item, cell) {
|
29819 | TablixUtils.clearCellStyle(cell), TablixUtils.clearCellTextAndTooltip(cell);
|
29820 | }, MatrixBinder.prototype.bindCornerCell = function(item, cell) {
|
29821 | TablixUtils.resetCellCssClass(cell);
|
29822 | var cellStyle = new TablixUtils.CellStyle();
|
29823 | cellStyle.fontFamily = TablixUtils.FontFamilyHeader, cellStyle.fontColor = TablixUtils.FontColorHeaders,
|
29824 | cell.contentHeight = this.textHeightHeader, cell.contentWidth = 0;
|
29825 | var cellElement = cell.extension.contentHost;
|
29826 | if (item.isColumnHeaderLeaf && (TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixColumnHeaderLeaf),
|
29827 | cellStyle.borders.bottom = new EdgeSettings(TablixObjects.PropGridOutlineWeight.defaultValue, TablixObjects.PropGridOutlineColor.defaultValue),
|
29828 | this.options.showSortIcons)) {
|
29829 | var cornerHeaderMetadata = this.getSortableCornerColumnMetadata(item);
|
29830 | cornerHeaderMetadata && (this.registerColumnHeaderClickHandler(cornerHeaderMetadata, cell),
|
29831 | cellElement = TablixUtils.addSortIconToColumnHeader(cornerHeaderMetadata ? cornerHeaderMetadata.sort : void 0, cellElement),
|
29832 | cornerHeaderMetadata.sort && (cell.contentWidth = this.fontSizeHeader + TablixUtils.SortIconPadding));
|
29833 | }
|
29834 | TablixUtils.setCellTextAndTooltip(item.displayName, cellElement, cell.extension.contentHost),
|
29835 | cell.contentWidth += powerbi.TextMeasurementService.measureSvgTextWidth(this.textPropsHeader, item.displayName),
|
29836 | cell.contentWidth = Math.ceil(cell.contentWidth), item.isRowHeaderLeaf && TablixUtils.addCellCssClass(cell, TablixUtils.CssClassMatrixRowHeaderLeaf),
|
29837 | TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixHeader), this.setCornerCellsStyle(cell, cellStyle),
|
29838 | cell.applyStyle(cellStyle), cell.extension.disableDragResize();
|
29839 | }, MatrixBinder.prototype.setCornerCellsStyle = function(cell, style) {
|
29840 | var propsGrid = this.formattingProperties.grid, propsCol = this.formattingProperties.columnHeaders, propsRow = this.formattingProperties.rowHeaders;
|
29841 | style.fontColor = propsCol.fontColor || propsRow.fontColor, style.backColor = propsCol.backColor || propsRow.backColor,
|
29842 | style.paddings.top = style.paddings.bottom = propsGrid.rowPadding, style.borders.top = new EdgeSettings(),
|
29843 | cell.position.row.isFirst && style.borders.top.applyParams(visuals.outline.showTop(propsCol.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29844 | style.borders.bottom = new EdgeSettings(), cell.position.row.isLast ? style.borders.bottom.applyParams(visuals.outline.showBottom(propsCol.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline) : style.borders.bottom.applyParams(propsGrid.gridHorizontal, propsGrid.gridHorizontalWeight, propsGrid.gridHorizontalColor, EdgeType.Gridline),
|
29845 | style.borders.left = new EdgeSettings(), cell.position.column.isFirst && (style.borders.left.applyParams(visuals.outline.showLeft(propsCol.outline), propsGrid.outlineWeight, propsGrid.outlineColor, EdgeType.Outline),
|
29846 | !visuals.outline.showLeft(propsCol.outline) && visuals.outline.showLeft(propsRow.outline) && (style.paddings.left += propsGrid.outlineWeight)),
|
29847 | style.borders.right = new EdgeSettings(), style.borders.right.applyParams(propsGrid.gridVertical, propsGrid.gridVerticalWeight, propsGrid.gridVerticalColor, EdgeType.Gridline);
|
29848 | }, MatrixBinder.prototype.unbindCornerCell = function(item, cell) {
|
29849 | TablixUtils.clearCellStyle(cell), TablixUtils.clearCellTextAndTooltip(cell), this.options.showSortIcons && TablixUtils.removeSortIcons(cell),
|
29850 | item.isColumnHeaderLeaf && this.unregisterColumnHeaderClickHandler(cell);
|
29851 | }, MatrixBinder.prototype.bindEmptySpaceHeaderCell = function(cell) {}, MatrixBinder.prototype.unbindEmptySpaceHeaderCell = function(cell) {},
|
29852 | MatrixBinder.prototype.bindEmptySpaceFooterCell = function(cell) {}, MatrixBinder.prototype.unbindEmptySpaceFooterCell = function(cell) {},
|
29853 | MatrixBinder.prototype.getHeaderLabel = function(item) {
|
29854 | return item.valueFormatted;
|
29855 | }, MatrixBinder.prototype.getCellContent = function(item) {
|
29856 | return item.textContent || "";
|
29857 | }, MatrixBinder.prototype.hasRowGroups = function() {
|
29858 | var dataView = this.hierarchyNavigator.getDataViewMatrix();
|
29859 | return !!(dataView && dataView.rows && dataView.rows.levels && 0 !== dataView.rows.levels.length);
|
29860 | }, MatrixBinder.prototype.getSortableCornerColumnMetadata = function(item) {
|
29861 | return item.isColumnHeaderLeaf ? item.metadata : void 0;
|
29862 | }, MatrixBinder.prototype.getRowHeaderMetadata = function(item) {
|
29863 | if (this.hierarchyNavigator && item) {
|
29864 | var dataView = this.hierarchyNavigator.getDataViewMatrix();
|
29865 | if (dataView && dataView.rows) return this.getHierarchyMetadata(dataView.rows, item.level);
|
29866 | }
|
29867 | }, MatrixBinder.prototype.getColumnHeaderMetadata = function(item) {
|
29868 | if (this.hierarchyNavigator && item) {
|
29869 | var dataView = this.hierarchyNavigator.getDataViewMatrix();
|
29870 | if (dataView && dataView.columns) return this.getHierarchyMetadata(dataView.columns, item.level);
|
29871 | }
|
29872 | }, MatrixBinder.prototype.getHierarchyMetadata = function(hierarchy, level) {
|
29873 | if (hierarchy && hierarchy.levels && !(hierarchy.levels.length < level)) {
|
29874 | var levelInfo = hierarchy.levels[level];
|
29875 | if (levelInfo && levelInfo.sources && 0 !== levelInfo.sources.length) return levelInfo.sources[0];
|
29876 | }
|
29877 | }, MatrixBinder.prototype.getSortableHeaderColumnMetadata = function(item) {
|
29878 | var dataView = this.hierarchyNavigator.getDataViewMatrix();
|
29879 | if (!dataView.rows || !dataView.rows.levels || 0 === dataView.rows.levels.length) return null;
|
29880 | var isMultiMeasure = dataView.valueSources && dataView.valueSources.length > 1, columnGroupCount = dataView.columns ? dataView.columns.levels.length : 0;
|
29881 | isMultiMeasure ? columnGroupCount-- : 1 === columnGroupCount && dataView.columns.levels[0] && dataView.columns.levels[0].sources && dataView.columns.levels[0].sources[0] && dataView.columns.levels[0].sources[0].roles && dataView.columns.levels[0].sources[0].roles.Values && (columnGroupCount = 0);
|
29882 | var valueIndex = -1;
|
29883 | return 0 === columnGroupCount ? valueIndex = item.levelSourceIndex : item.isSubtotal && (isMultiMeasure ? item.parent && 0 === item.parent.level && (valueIndex = item.levelSourceIndex) : 0 === item.level && (valueIndex = item.levelSourceIndex)),
|
29884 | -1 !== valueIndex ? (valueIndex = valueIndex ? valueIndex : 0, dataView.valueSources[valueIndex]) : null;
|
29885 | }, MatrixBinder;
|
29886 | }();
|
29887 | visuals.MatrixBinder = MatrixBinder;
|
29888 | var Matrix = function() {
|
29889 | function Matrix() {}
|
29890 | return Matrix.customizeQuery = function(options) {
|
29891 | var dataViewMapping = options.dataViewMappings[0];
|
29892 | if (dataViewMapping && dataViewMapping.matrix && dataViewMapping.metadata) {
|
29893 | var dataViewMatrix = dataViewMapping.matrix;
|
29894 | _.isEmpty(dataViewMatrix.columns["for"]["in"].items) || (dataViewMatrix.rows.dataReductionAlgorithm.window.count = 100);
|
29895 | var objects = dataViewMapping.metadata.objects;
|
29896 | dataViewMatrix.rows["for"]["in"].subtotalType = TablixObjects.shouldShowRowSubtotals(objects) ? 2 : 0,
|
29897 | dataViewMatrix.columns["for"]["in"].subtotalType = TablixObjects.shouldShowColumnSubtotals(objects) ? 2 : 0;
|
29898 | }
|
29899 | }, Matrix.getSortableRoles = function() {
|
29900 | return [ "Rows", "Values" ];
|
29901 | }, Matrix.prototype.init = function(options) {
|
29902 | this.element = options.element, this.style = options.style, this.updateViewport(options.viewport),
|
29903 | this.formatter = visuals.valueFormatter.formatVariantMeasureValue, this.isInteractive = options.interactivity && null != options.interactivity.selection,
|
29904 | this.hostServices = options.host, this.persistingObjects = !1, this.waitingForData = !1,
|
29905 | this.lastAllowHeaderResize = !0, this.waitingForSort = !1;
|
29906 | }, Matrix.converter = function(dataView) {
|
29907 | return TablixObjects.getMatrixObjects(dataView);
|
29908 | }, Matrix.prototype.onResizing = function(finalViewport) {
|
29909 | this.updateViewport(finalViewport);
|
29910 | }, Matrix.prototype.getColumnWidthManager = function() {
|
29911 | return this.columnWidthManager;
|
29912 | }, Matrix.prototype.onDataChanged = function(options) {
|
29913 | var dataViews = options.dataViews;
|
29914 | if (dataViews && dataViews.length > 0) {
|
29915 | var previousDataView = this.dataView;
|
29916 | this.dataView = dataViews[0];
|
29917 | var formattingProperties = Matrix.converter(this.dataView), textSize = formattingProperties.general.textSize;
|
29918 | if (options.operationKind === powerbi.VisualDataChangeOperationKind.Append) {
|
29919 | var rootChanged = previousDataView.matrix.rows.root !== this.dataView.matrix.rows.root;
|
29920 | this.createOrUpdateHierarchyNavigator(rootChanged), rootChanged && this.tablixControl.updateModels(!1, this.dataView.matrix.rows.root.children, this.dataView.matrix.columns.root.children),
|
29921 | this.refreshControl(!1);
|
29922 | } else {
|
29923 | this.createOrUpdateHierarchyNavigator(!0), this.createColumnWidthManager(), this.createTablixControl(textSize);
|
29924 | var binder = this.tablixControl.getBinder();
|
29925 | binder.onDataViewChanged(formattingProperties), this.updateInternal(textSize, previousDataView);
|
29926 | }
|
29927 | }
|
29928 | this.waitingForData = !1, this.waitingForSort = !1;
|
29929 | }, Matrix.prototype.createColumnWidthManager = function() {
|
29930 | var _this = this, columnHierarchy = this.hierarchyNavigator.getMatrixColumnHierarchy();
|
29931 | this.columnWidthManager ? this.persistingObjects || this.columnWidthManager.updateDataView(this.dataView, columnHierarchy.leafNodes) : this.columnWidthManager = new visuals.controls.TablixColumnWidthManager(this.dataView, !0, function(objectInstances) {
|
29932 | return _this.persistColumnWidths(objectInstances);
|
29933 | }, columnHierarchy.leafNodes);
|
29934 | }, Matrix.prototype.persistColumnWidths = function(objectInstances) {
|
29935 | this.persistingObjects = !0, this.hostServices.persistProperties(objectInstances);
|
29936 | }, Matrix.prototype.updateViewport = function(newViewport) {
|
29937 | this.currentViewport = newViewport, this.tablixControl && (this.tablixControl.viewport = this.currentViewport,
|
29938 | this.verifyHeaderResize(), this.refreshControl(!1));
|
29939 | }, Matrix.prototype.refreshControl = function(clear) {
|
29940 | (visuals.visibilityHelper.partiallyVisible(this.element) || 1 === this.getLayoutKind()) && this.tablixControl.refresh(clear);
|
29941 | }, Matrix.prototype.getLayoutKind = function() {
|
29942 | return this.isInteractive ? 0 : 1;
|
29943 | }, Matrix.prototype.createOrUpdateHierarchyNavigator = function(rootChanged) {
|
29944 | var isDataComplete = !this.dataView.metadata.segment;
|
29945 | if (this.tablixControl) this.hierarchyNavigator.update(this.dataView.matrix, isDataComplete, rootChanged); else {
|
29946 | var matrixNavigator = createMatrixHierarchyNavigator(this.dataView.matrix, isDataComplete, this.formatter, this.hostServices.getLocalizedString("ListJoin_Separator"));
|
29947 | this.hierarchyNavigator = matrixNavigator;
|
29948 | }
|
29949 | }, Matrix.prototype.createTablixControl = function(textSize) {
|
29950 | this.tablixControl || (this.tablixControl = this.createControl(this.hierarchyNavigator, textSize));
|
29951 | }, Matrix.prototype.createControl = function(matrixNavigator, textSize) {
|
29952 | var _this = this, layoutKind = this.getLayoutKind(), matrixBinderOptions = {
|
29953 | onBindRowHeader: function(item) {
|
29954 | _this.onBindRowHeader(item);
|
29955 | },
|
29956 | totalLabel: this.hostServices.getLocalizedString(Matrix.TotalLabel),
|
29957 | onColumnHeaderClick: function(queryName, sortDirection) {
|
29958 | return _this.onColumnHeaderClick(queryName, sortDirection);
|
29959 | },
|
29960 | showSortIcons: 0 === layoutKind
|
29961 | }, matrixBinder = new MatrixBinder(this.hierarchyNavigator, matrixBinderOptions), layoutManager = 1 === layoutKind ? visuals.controls.internal.DashboardTablixLayoutManager.createLayoutManager(matrixBinder) : visuals.controls.internal.CanvasTablixLayoutManager.createLayoutManager(matrixBinder, this.columnWidthManager), tablixContainer = document.createElement("div");
|
29962 | this.element.append(tablixContainer);
|
29963 | var tablixOptions = {
|
29964 | interactive: this.isInteractive,
|
29965 | enableTouchSupport: !0,
|
29966 | layoutKind: layoutKind,
|
29967 | fontSize: TablixObjects.getTextSizeInPx(textSize)
|
29968 | };
|
29969 | return new visuals.controls.TablixControl(matrixNavigator, layoutManager, matrixBinder, tablixContainer, tablixOptions);
|
29970 | }, Matrix.prototype.updateInternal = function(textSize, previousDataView) {
|
29971 | var _this = this;
|
29972 | 1 === this.getLayoutKind() && this.tablixControl.layoutManager.adjustContentSize(visuals.converterHelper.hasImageUrlColumn(this.dataView)),
|
29973 | this.tablixControl.fontSize = TablixObjects.getTextSizeInPx(textSize), this.verifyHeaderResize(),
|
29974 | this.tablixControl.updateModels(!this.persistingObjects, this.dataView.matrix.rows.root.children, this.dataView.matrix.columns.root.children),
|
29975 | this.tablixControl.viewport = this.currentViewport;
|
29976 | var shouldClearControl = this.shouldClearControl(previousDataView, this.dataView);
|
29977 | setTimeout(function() {
|
29978 | _this.refreshControl(shouldClearControl);
|
29979 | var widthChanged = _this.columnWidthManager.onColumnsRendered(_this.tablixControl.layoutManager.columnWidthsToPersist);
|
29980 | _this.persistingObjects && !widthChanged && (_this.persistingObjects = !1);
|
29981 | }, 0);
|
29982 | }, Matrix.prototype.shouldClearControl = function(previousDataView, newDataView) {
|
29983 | return this.waitingForSort && previousDataView && newDataView ? !powerbi.DataViewAnalysis.isMetadataEquivalent(previousDataView.metadata, newDataView.metadata) : !0;
|
29984 | }, Matrix.prototype.onBindRowHeader = function(item) {
|
29985 | this.needsMoreData(item) && (this.hostServices.loadMoreData(), this.waitingForData = !0);
|
29986 | }, Matrix.prototype.onColumnHeaderClick = function(queryName, sortDirection) {
|
29987 | this.waitingForSort = !0, this.hostServices.onCustomSort(TablixUtils.getCustomSortEventArgs(queryName, sortDirection));
|
29988 | }, Matrix.prototype.needsMoreData = function(item) {
|
29989 | if (this.waitingForData || !this.hierarchyNavigator.isLeaf(item) || !this.dataView.metadata || !this.dataView.metadata.segment) return !1;
|
29990 | var leafCount = this.tablixControl.rowDimension.getItemsCount(), loadMoreThreshold = leafCount * Matrix.preferredLoadMoreThreshold;
|
29991 | return this.hierarchyNavigator.getLeafIndex(item) >= loadMoreThreshold;
|
29992 | }, Matrix.prototype.enumerateObjectInstances = function(options) {
|
29993 | var enumeration = new visuals.ObjectEnumerationBuilder();
|
29994 | return this.dataView && TablixObjects.enumerateObjectInstances(options, enumeration, this.dataView, visuals.controls.TablixType.Matrix),
|
29995 | enumeration.complete();
|
29996 | }, Matrix.prototype.shouldAllowHeaderResize = function() {
|
29997 | return 1 === this.hostServices.getViewMode();
|
29998 | }, Matrix.prototype.onViewModeChanged = function(viewMode) {
|
29999 | this.updateViewport(this.currentViewport);
|
30000 | }, Matrix.prototype.verifyHeaderResize = function() {
|
30001 | var currentAllowHeaderResize = this.shouldAllowHeaderResize();
|
30002 | currentAllowHeaderResize !== this.lastAllowHeaderResize && (this.lastAllowHeaderResize = currentAllowHeaderResize,
|
30003 | this.tablixControl.layoutManager.setAllowHeaderResize(currentAllowHeaderResize));
|
30004 | }, Matrix.preferredLoadMoreThreshold = .8, Matrix.TotalLabel = "TableTotalLabel",
|
30005 | Matrix;
|
30006 | }();
|
30007 | visuals.Matrix = Matrix;
|
30008 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
30009 | }(powerbi || (powerbi = {}));
|
30010 | }, function(module, exports) {
|
30011 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
30012 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
30013 | !function(powerbi) {
|
30014 | var visuals;
|
30015 | !function(visuals) {
|
30016 | var CssConstants = jsCommon.CssConstants, Treemap = function() {
|
30017 | function Treemap(options) {
|
30018 | this.tooltipsEnabled = options && options.tooltipsEnabled, this.tooltipBucketEnabled = options && options.tooltipBucketEnabled,
|
30019 | options && options.animator && (this.animator = options.animator, this.isScrollable = options.isScrollable ? options.isScrollable : !1,
|
30020 | this.behavior = options.behavior);
|
30021 | }
|
30022 | return Treemap.getLayout = function(labelsSettings, alternativeScale) {
|
30023 | var formattersCache = visuals.dataLabelUtils.createColumnFormatterCacheManager(), majorLabelsEnabled = labelsSettings.showCategory, minorLabelsEnabled = labelsSettings.show || labelsSettings.showCategory;
|
30024 | return {
|
30025 | shapeClass: function(d) {
|
30026 | return Treemap.getNodeClass(d, !1);
|
30027 | },
|
30028 | shapeLayout: Treemap.createTreemapShapeLayout(!1),
|
30029 | highlightShapeClass: function(d) {
|
30030 | return Treemap.getNodeClass(d, !0);
|
30031 | },
|
30032 | highlightShapeLayout: Treemap.createTreemapShapeLayout(!0),
|
30033 | zeroShapeLayout: Treemap.createTreemapZeroShapeLayout(),
|
30034 | majorLabelClass: function(d) {
|
30035 | return Treemap.MajorLabelClassName;
|
30036 | },
|
30037 | majorLabelLayout: {
|
30038 | x: function(d) {
|
30039 | return d.x + Treemap.TextMargin;
|
30040 | },
|
30041 | y: function(d) {
|
30042 | return d.y + Treemap.TextMargin + Treemap.MajorLabelTextSize;
|
30043 | }
|
30044 | },
|
30045 | majorLabelText: function(d) {
|
30046 | return Treemap.createMajorLabelText(d, labelsSettings, alternativeScale, formattersCache);
|
30047 | },
|
30048 | minorLabelClass: function(d) {
|
30049 | return Treemap.MinorLabelClassName;
|
30050 | },
|
30051 | minorLabelLayout: {
|
30052 | x: function(d) {
|
30053 | return d.x + Treemap.TextMargin;
|
30054 | },
|
30055 | y: function(d) {
|
30056 | return d.y + d.dy - Treemap.TextMargin;
|
30057 | }
|
30058 | },
|
30059 | minorLabelText: function(d) {
|
30060 | return Treemap.createMinorLabelText(d, labelsSettings, alternativeScale, formattersCache);
|
30061 | },
|
30062 | areMajorLabelsEnabled: function() {
|
30063 | return majorLabelsEnabled;
|
30064 | },
|
30065 | areMinorLabelsEnabled: function() {
|
30066 | return minorLabelsEnabled;
|
30067 | }
|
30068 | };
|
30069 | }, Treemap.prototype.init = function(options) {
|
30070 | this.options = options;
|
30071 | var element = options.element;
|
30072 | element.empty(), this.svg = d3.select(element.get(0)).append("svg").style("position", "absolute").classed(Treemap.ClassName, !0),
|
30073 | this.shapeGraphicsContext = this.svg.append("g").classed(Treemap.ShapesClassName, !0),
|
30074 | this.labelGraphicsContext = this.svg.append("g").classed(Treemap.LabelsGroupClassName, !0),
|
30075 | this.element = element, this.currentViewport = {
|
30076 | height: options.viewport.height,
|
30077 | width: options.viewport.width
|
30078 | }, this.style = options.style, this.treemap = d3.layout.treemap().sticky(!1).sort(function(a, b) {
|
30079 | return a.size - b.size;
|
30080 | }).value(function(d) {
|
30081 | return d.size;
|
30082 | }).round(!1), this.behavior && (this.interactivityService = visuals.createInteractivityService(options.host)),
|
30083 | this.legend = visuals.createLegend(element, options.interactivity && options.interactivity.isInteractiveLegend, this.interactivityService, this.isScrollable),
|
30084 | this.colors = this.style.colorPalette.dataColors, this.hostService = options.host;
|
30085 | }, Treemap.converter = function(dataView, colors, labelSettings, interactivityService, viewport, legendObjectProperties, tooltipsEnabled, tooltipBucketEnabled) {
|
30086 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
30087 | var hasNegativeValues, allValuesAreNegative, hasHighlights, reader = powerbi.data.createIDataViewCategoricalReader(dataView), rootNode = {
|
30088 | key: "root",
|
30089 | name: "root",
|
30090 | originalValue: void 0,
|
30091 | children: [],
|
30092 | selected: !1,
|
30093 | highlightMultiplier: 0,
|
30094 | identity: visuals.SelectionId.createNull(),
|
30095 | color: void 0
|
30096 | }, allNodes = [], legendDataPoints = [], legendTitle = "", colorHelper = new visuals.ColorHelper(colors, visuals.treemapProps.dataPoint.fill), dataWasCulled = void 0;
|
30097 | if (dataView && dataView.metadata && dataView.metadata.objects) {
|
30098 | var objects = dataView.metadata.objects;
|
30099 | labelSettings.show = powerbi.DataViewObjects.getValue(objects, visuals.treemapProps.labels.show, labelSettings.show),
|
30100 | labelSettings.labelColor = powerbi.DataViewObjects.getFillColor(objects, visuals.treemapProps.labels.color, labelSettings.labelColor),
|
30101 | labelSettings.displayUnits = powerbi.DataViewObjects.getValue(objects, visuals.treemapProps.labels.labelDisplayUnits, labelSettings.displayUnits),
|
30102 | labelSettings.precision = powerbi.DataViewObjects.getValue(objects, visuals.treemapProps.labels.labelPrecision, labelSettings.precision),
|
30103 | labelSettings.showCategory = powerbi.DataViewObjects.getValue(objects, visuals.treemapProps.categoryLabels.show, labelSettings.showCategory);
|
30104 | }
|
30105 | if (reader.hasValues(visuals.treemapRoles.values) || reader.hasValues(visuals.treemapRoles.gradient)) {
|
30106 | var valueColumnRoleName = reader.hasValues(visuals.treemapRoles.values) ? visuals.treemapRoles.values : visuals.treemapRoles.gradient, categorical = dataView.categorical;
|
30107 | hasHighlights = reader.hasHighlights(valueColumnRoleName);
|
30108 | var formatStringProp = visuals.treemapProps.general.formatString, result = Treemap.getValuesFromCategoricalDataView(dataView, hasHighlights, valueColumnRoleName), values = result.values, highlights = result.highlights, totalValue = result.totalValue;
|
30109 | result.highlightsOverflow && (hasHighlights = !1, values = highlights), hasNegativeValues = result.hasNegativeValues,
|
30110 | allValuesAreNegative = result.allValuesAreNegative;
|
30111 | var cullableValue = Treemap.getCullableValue(totalValue, viewport), hasDynamicSeries = reader.hasDynamicSeries();
|
30112 | dataWasCulled = !1;
|
30113 | var gradientValueColumn = reader.getValueColumn(visuals.treemapRoles.gradient, 0);
|
30114 | if (null != categorical.categories || _.isEmpty(values)) {
|
30115 | if (categorical.categories && categorical.categories.length > 0) {
|
30116 | var seriesCount = reader.getSeriesCount(valueColumnRoleName), omitSecondLevel = 1 === seriesCount, categoryColumn = categorical.categories[0];
|
30117 | legendTitle = categoryColumn.source.displayName;
|
30118 | for (var categoryFormat = visuals.valueFormatter.getFormatString(categoryColumn.source, formatStringProp), categoryIndex = 0, categoryLen = values.length; categoryLen > categoryIndex; categoryIndex++) {
|
30119 | var objects = categoryColumn.objects && categoryColumn.objects[categoryIndex], color = colorHelper.getColorForSeriesValue(objects, categoryColumn.identityFields, categoryColumn.values[categoryIndex]), categoryValue = visuals.valueFormatter.format(categoryColumn.values[categoryIndex], categoryFormat), currentValues = values[categoryIndex], seriesIndex = 0, value = currentValues[seriesIndex], highlightValue = hasHighlights && highlights ? highlights[categoryIndex][seriesIndex] : void 0, tooltipInfo = void 0, categoryTooltipItem = void 0;
|
30120 | if (tooltipsEnabled) {
|
30121 | tooltipInfo = [], categoryTooltipItem = {
|
30122 | displayName: categoryColumn.source.displayName,
|
30123 | value: categoryValue
|
30124 | }, tooltipInfo.push(categoryTooltipItem);
|
30125 | var valueColumnMetadata = reader.getValueMetadataColumn(valueColumnRoleName, seriesIndex);
|
30126 | null != value && tooltipInfo.push({
|
30127 | displayName: valueColumnMetadata.displayName,
|
30128 | value: visuals.converterHelper.formatFromMetadataColumn(value, valueColumnMetadata, formatStringProp)
|
30129 | }), null != highlightValue && tooltipInfo.push({
|
30130 | displayName: visuals.ToolTipComponent.localizationOptions.highlightedValueDisplayName,
|
30131 | value: visuals.converterHelper.formatFromMetadataColumn(highlightValue, valueColumnMetadata, formatStringProp)
|
30132 | });
|
30133 | var gradientValueColumnMetadata = gradientValueColumn ? gradientValueColumn.source : void 0;
|
30134 | omitSecondLevel && gradientValueColumnMetadata && gradientValueColumnMetadata !== valueColumnMetadata && null != gradientValueColumn.values[categoryIndex] && tooltipInfo.push({
|
30135 | displayName: gradientValueColumnMetadata.displayName,
|
30136 | value: visuals.converterHelper.formatFromMetadataColumn(gradientValueColumn.values[categoryIndex], gradientValueColumnMetadata, formatStringProp)
|
30137 | }), tooltipBucketEnabled && visuals.TooltipBuilder.addTooltipBucketItem(reader, tooltipInfo, categoryIndex, seriesIndex);
|
30138 | }
|
30139 | var identity = visuals.SelectionIdBuilder.builder().withCategory(categoryColumn, categoryIndex).withMeasure(omitSecondLevel ? reader.getValueMetadataColumn(valueColumnRoleName, seriesIndex).queryName : void 0).createSelectionId(), key = JSON.stringify({
|
30140 | nodeKey: identity.getKey(),
|
30141 | depth: 1
|
30142 | }), node = {
|
30143 | key: key,
|
30144 | name: categoryValue,
|
30145 | originalValue: void 0,
|
30146 | color: color,
|
30147 | selected: !1,
|
30148 | identity: identity,
|
30149 | tooltipInfo: tooltipInfo,
|
30150 | highlightedTooltipInfo: tooltipInfo,
|
30151 | labelFormatString: 1 === seriesCount ? visuals.valueFormatter.getFormatString(reader.getValueMetadataColumn(valueColumnRoleName, seriesIndex), formatStringProp) : categoryFormat
|
30152 | };
|
30153 | hasHighlights && (node.highlightMultiplier = 0 !== value ? highlightValue / value : 0,
|
30154 | node.highlightValue = allValuesAreNegative && null != highlightValue ? Math.abs(highlightValue) : highlightValue,
|
30155 | node.originalHighlightValue = highlightValue), legendDataPoints.push({
|
30156 | label: categoryValue,
|
30157 | color: color,
|
30158 | icon: visuals.LegendIcon.Box,
|
30159 | identity: identity,
|
30160 | selected: !1
|
30161 | });
|
30162 | for (var total = 0, highlightTotal = 0; seriesCount > seriesIndex; seriesIndex++) {
|
30163 | var valueColumn = reader.getValueColumn(valueColumnRoleName, seriesIndex), value_1 = currentValues[seriesIndex], highlight = void 0, valueShape = Treemap.checkValueForShape(value_1, cullableValue, allValuesAreNegative, dataWasCulled);
|
30164 | if (dataWasCulled = valueShape.dataWasCulled, valueShape.validShape && (total += value_1,
|
30165 | hasHighlights && (highlight = highlights[categoryIndex][seriesIndex], highlightTotal += highlight),
|
30166 | !omitSecondLevel)) {
|
30167 | var childName = null;
|
30168 | childName = reader.hasDynamicSeries() ? visuals.converterHelper.formatFromMetadataColumn(reader.getSeriesName(seriesIndex), reader.getSeriesMetadataColumn(), formatStringProp) : visuals.converterHelper.formatFromMetadataColumn(reader.getValueDisplayName(valueColumnRoleName, seriesIndex), reader.getValueMetadataColumn(valueColumnRoleName, seriesIndex), formatStringProp);
|
30169 | var categoricalValues = categorical ? categorical.values : null, measureId = valueColumn.source.queryName, childIdentity = visuals.SelectionIdBuilder.builder().withCategory(categoryColumn, categoryIndex).withSeries(categoricalValues, valueColumn).withMeasure(measureId).createSelectionId(), childKey = JSON.stringify({
|
30170 | nodeKey: childIdentity.getKey(),
|
30171 | depth: 2
|
30172 | }), highlightedValue = hasHighlights && 0 !== highlight ? highlight : void 0, tooltipInfo_1 = void 0;
|
30173 | tooltipsEnabled && (tooltipInfo_1 = [], tooltipInfo_1.push(categoryTooltipItem),
|
30174 | hasDynamicSeries && (categoryColumn && categoryColumn.source === categoricalValues.source || tooltipInfo_1.push({
|
30175 | displayName: categoricalValues.source.displayName,
|
30176 | value: visuals.converterHelper.formatFromMetadataColumn(reader.getSeriesName(seriesIndex), categoricalValues.source, formatStringProp)
|
30177 | })), null != value_1 && tooltipInfo_1.push({
|
30178 | displayName: valueColumn.source.displayName,
|
30179 | value: visuals.converterHelper.formatFromMetadataColumn(value_1, valueColumn.source, formatStringProp)
|
30180 | }), null != highlightValue && tooltipInfo_1.push({
|
30181 | displayName: visuals.ToolTipComponent.localizationOptions.highlightedValueDisplayName,
|
30182 | value: visuals.converterHelper.formatFromMetadataColumn(highlightedValue, valueColumn.source, formatStringProp)
|
30183 | }), tooltipBucketEnabled && visuals.TooltipBuilder.addTooltipBucketItem(reader, tooltipInfo_1, categoryIndex, hasDynamicSeries ? seriesIndex : void 0));
|
30184 | var childNode = {
|
30185 | key: childKey,
|
30186 | name: childName,
|
30187 | size: allValuesAreNegative ? Math.abs(value_1) : value_1,
|
30188 | originalValue: value_1,
|
30189 | color: color,
|
30190 | selected: !1,
|
30191 | identity: childIdentity,
|
30192 | tooltipInfo: tooltipInfo_1,
|
30193 | highlightedTooltipInfo: tooltipInfo_1,
|
30194 | labelFormatString: visuals.valueFormatter.getFormatString(valueColumn.source, formatStringProp)
|
30195 | };
|
30196 | hasHighlights && (childNode.highlightMultiplier = 0 !== value_1 ? highlight / value_1 : 0,
|
30197 | childNode.highlightValue = allValuesAreNegative && null != highlight ? Math.abs(highlight) : null,
|
30198 | childNode.originalHighlightValue = highlight), null == node.children && (node.children = []),
|
30199 | node.children.push(childNode), allNodes.push(childNode);
|
30200 | }
|
30201 | }
|
30202 | total && (node.size = allValuesAreNegative ? Math.abs(total) : total, node.originalValue = total,
|
30203 | rootNode.children.push(node), allNodes.push(node)), hasHighlights && (node.highlightMultiplier = total ? highlightTotal / total : 0);
|
30204 | }
|
30205 | }
|
30206 | } else for (var seriesIndex = 0, seriesCount = reader.getSeriesCount(valueColumnRoleName); seriesCount > seriesIndex; seriesIndex++) {
|
30207 | var valueColumn = reader.getValueColumn(valueColumnRoleName, seriesIndex), value = values[0][seriesIndex], valueShape = Treemap.checkValueForShape(value, cullableValue, allValuesAreNegative, dataWasCulled);
|
30208 | if (dataWasCulled = valueShape.dataWasCulled, valueShape.validShape) {
|
30209 | var nodeName = hasDynamicSeries ? visuals.converterHelper.formatFromMetadataColumn(reader.getSeriesValueColumnGroup(seriesIndex).name, reader.getSeriesMetadataColumn(), formatStringProp) : visuals.converterHelper.formatFromMetadataColumn(reader.getValueDisplayName(valueColumnRoleName, seriesIndex), valueColumn.source, formatStringProp), identity = new visuals.SelectionIdBuilder().withSeries(dataView.categorical.values, hasDynamicSeries ? valueColumn : void 0).withMeasure(valueColumn.source.queryName).createSelectionId(), key = identity.getKey(), color = hasDynamicSeries ? colorHelper.getColorForSeriesValue(reader.getSeriesObjects(seriesIndex), categorical.values.identityFields, visuals.converterHelper.getSeriesName(valueColumn.source)) : colorHelper.getColorForMeasure(valueColumn.source.objects, valueColumn.source.queryName), highlightedValue = hasHighlights ? highlights[0][seriesIndex] : void 0, tooltipInfo = void 0;
|
30210 | if (tooltipsEnabled) {
|
30211 | if (tooltipInfo = [], hasDynamicSeries) {
|
30212 | var seriesMetadataColumn = reader.getSeriesMetadataColumn(), seriesValue = reader.getSeriesValueColumnGroup(seriesIndex).name;
|
30213 | tooltipInfo.push({
|
30214 | displayName: seriesMetadataColumn.displayName,
|
30215 | value: visuals.converterHelper.formatFromMetadataColumn(seriesValue, seriesMetadataColumn, formatStringProp)
|
30216 | });
|
30217 | }
|
30218 | null != value && tooltipInfo.push({
|
30219 | displayName: valueColumn.source.displayName,
|
30220 | value: visuals.converterHelper.formatFromMetadataColumn(value, valueColumn.source, formatStringProp)
|
30221 | }), null != highlightedValue && tooltipInfo.push({
|
30222 | displayName: visuals.ToolTipComponent.localizationOptions.highlightedValueDisplayName,
|
30223 | value: visuals.converterHelper.formatFromMetadataColumn(highlightedValue, valueColumn.source, formatStringProp)
|
30224 | }), tooltipBucketEnabled && visuals.TooltipBuilder.addTooltipBucketItem(reader, tooltipInfo, 0, hasDynamicSeries ? seriesIndex : void 0);
|
30225 | }
|
30226 | var node = {
|
30227 | key: key,
|
30228 | name: nodeName,
|
30229 | size: allValuesAreNegative ? Math.abs(value) : value,
|
30230 | originalValue: value,
|
30231 | color: color,
|
30232 | selected: !1,
|
30233 | identity: identity,
|
30234 | tooltipInfo: tooltipInfo,
|
30235 | highlightedTooltipInfo: tooltipInfo,
|
30236 | labelFormatString: visuals.valueFormatter.getFormatString(valueColumn.source, formatStringProp)
|
30237 | };
|
30238 | hasHighlights && highlights && (node.highlightMultiplier = 0 !== value ? highlightedValue / value : 0,
|
30239 | node.highlightValue = allValuesAreNegative && null != highlightedValue ? Math.abs(highlightedValue) : highlightedValue,
|
30240 | node.originalHighlightValue = highlightedValue), rootNode.children.push(node), allNodes.push(node),
|
30241 | legendDataPoints.push({
|
30242 | label: nodeName,
|
30243 | color: color,
|
30244 | icon: visuals.LegendIcon.Box,
|
30245 | identity: identity,
|
30246 | selected: !1
|
30247 | });
|
30248 | }
|
30249 | }
|
30250 | }
|
30251 | return interactivityService && (interactivityService.applySelectionStateToData(allNodes),
|
30252 | interactivityService.applySelectionStateToData(legendDataPoints)), {
|
30253 | root: rootNode,
|
30254 | hasHighlights: hasHighlights,
|
30255 | legendData: {
|
30256 | title: legendTitle,
|
30257 | dataPoints: legendDataPoints,
|
30258 | fontSize: visuals.SVGLegend.DefaultFontSizeInPt
|
30259 | },
|
30260 | dataLabelsSettings: labelSettings,
|
30261 | legendObjectProperties: legendObjectProperties,
|
30262 | dataWasCulled: dataWasCulled,
|
30263 | hasNegativeValues: hasNegativeValues,
|
30264 | allValuesAreNegative: allValuesAreNegative
|
30265 | };
|
30266 | }, Treemap.normalizedValue = function(value, allValuesAreNegative) {
|
30267 | return null == value || isNaN(value) ? 0 : value === Number.POSITIVE_INFINITY ? Number.MAX_VALUE : value === Number.NEGATIVE_INFINITY ? -Number.MAX_VALUE : allValuesAreNegative ? Math.abs(value) : 0 > value ? 0 : value;
|
30268 | }, Treemap.getValuesFromCategoricalDataView = function(dataView, hasHighlights, valueColumnRoleName) {
|
30269 | for (var reader = powerbi.data.createIDataViewCategoricalReader(dataView), categoryCount = reader.getCategoryCount() || 1, seriesCount = reader.getSeriesCount(valueColumnRoleName), values = [], highlights = [], totalValue = 0, i = 0; categoryCount > i; i++) values.push([]),
|
30270 | hasHighlights && highlights.push([]);
|
30271 | for (var hasNegativeValues, highlightsOverflow, allValuesAreNegative = void 0, seriesIndex = 0; seriesCount > seriesIndex; seriesIndex++) for (var categoryIndex = 0; categoryCount > categoryIndex; categoryIndex++) {
|
30272 | var value = reader.getValue(valueColumnRoleName, categoryIndex, seriesIndex);
|
30273 | values[categoryIndex].push(value);
|
30274 | var highlight = void 0;
|
30275 | hasHighlights && (highlight = reader.getHighlight(valueColumnRoleName, categoryIndex, seriesIndex),
|
30276 | highlights[categoryIndex].push(highlight), null == highlight && (highlight = 0)),
|
30277 | allValuesAreNegative = void 0 === allValuesAreNegative ? (hasHighlights ? 0 >= highlight : !0) && 0 >= value : allValuesAreNegative && (hasHighlights ? 0 >= highlight : !0) && 0 >= value,
|
30278 | hasNegativeValues || (hasNegativeValues = 0 > value || (hasHighlights ? 0 > highlight : !1));
|
30279 | }
|
30280 | allValuesAreNegative = !!allValuesAreNegative;
|
30281 | for (var seriesIndex = 0; seriesCount > seriesIndex; seriesIndex++) for (var categoryIndex = 0; categoryCount > categoryIndex; categoryIndex++) {
|
30282 | var value = values[categoryIndex][seriesIndex];
|
30283 | if (value = Treemap.normalizedValue(value, allValuesAreNegative), totalValue += value,
|
30284 | hasHighlights) {
|
30285 | var highlight = highlights[categoryIndex][seriesIndex];
|
30286 | highlight = Treemap.normalizedValue(highlight, allValuesAreNegative), !highlightsOverflow && highlight > value && (highlightsOverflow = !0);
|
30287 | }
|
30288 | }
|
30289 | return {
|
30290 | values: values,
|
30291 | highlights: hasHighlights ? highlights : void 0,
|
30292 | highlightsOverflow: hasHighlights ? highlightsOverflow : void 0,
|
30293 | totalValue: allValuesAreNegative ? Math.abs(totalValue) : totalValue,
|
30294 | hasNegativeValues: hasNegativeValues,
|
30295 | allValuesAreNegative: allValuesAreNegative
|
30296 | };
|
30297 | }, Treemap.getCullableValue = function(totalValue, viewport) {
|
30298 | var totalArea = viewport.width * viewport.height, culledPercent = Treemap.CullableArea / totalArea;
|
30299 | return culledPercent * totalValue;
|
30300 | }, Treemap.prototype.update = function(options) {
|
30301 | var dataViews = this.dataViews = options.dataViews;
|
30302 | this.currentViewport = options.viewport;
|
30303 | var dataViewCategorical = dataViews && dataViews.length > 0 && dataViews[0].categorical ? dataViews[0].categorical : void 0, labelSettings = visuals.dataLabelUtils.getDefaultTreemapLabelSettings(), legendObjectProperties = null;
|
30304 | if (dataViewCategorical) {
|
30305 | var dataView = dataViews[0], dataViewMetadata = dataView.metadata, objects = void 0;
|
30306 | dataViewMetadata && (objects = dataViewMetadata.objects), objects && (legendObjectProperties = objects.legend),
|
30307 | this.data = Treemap.converter(dataView, this.colors, labelSettings, this.interactivityService, this.currentViewport, legendObjectProperties, this.tooltipsEnabled, this.tooltipBucketEnabled);
|
30308 | } else {
|
30309 | var rootNode = {
|
30310 | key: "root",
|
30311 | name: "root",
|
30312 | originalValue: void 0,
|
30313 | children: [],
|
30314 | selected: !1,
|
30315 | highlightMultiplier: 0,
|
30316 | identity: visuals.SelectionId.createNull(),
|
30317 | color: void 0
|
30318 | }, legendData = {
|
30319 | title: "",
|
30320 | dataPoints: []
|
30321 | }, treeMapData = {
|
30322 | root: rootNode,
|
30323 | hasHighlights: !1,
|
30324 | legendData: legendData,
|
30325 | dataLabelsSettings: labelSettings,
|
30326 | dataWasCulled: !1,
|
30327 | hasNegativeValues: !1,
|
30328 | allValuesAreNegative: !1
|
30329 | };
|
30330 | this.data = treeMapData;
|
30331 | }
|
30332 | if (this.updateInternal(options.suppressAnimations), dataViews) {
|
30333 | var warnings = visuals.getInvalidValueWarnings(dataViews, !1, !1, !1);
|
30334 | this.data.allValuesAreNegative ? warnings.push(new visuals.AllNegativeValuesWarning()) : this.data.hasNegativeValues && warnings.push(new visuals.NegativeValuesNotSupportedWarning()),
|
30335 | this.hostService.setWarnings(warnings);
|
30336 | }
|
30337 | }, Treemap.prototype.onDataChanged = function(options) {
|
30338 | this.update({
|
30339 | suppressAnimations: options.suppressAnimations,
|
30340 | dataViews: options.dataViews,
|
30341 | viewport: this.currentViewport
|
30342 | });
|
30343 | }, Treemap.prototype.onResizing = function(viewport) {
|
30344 | this.update({
|
30345 | suppressAnimations: !0,
|
30346 | dataViews: this.dataViews,
|
30347 | viewport: viewport
|
30348 | });
|
30349 | }, Treemap.prototype.onClearSelection = function() {
|
30350 | this.interactivityService && this.interactivityService.clearSelection();
|
30351 | }, Treemap.prototype.enumerateObjectInstances = function(options) {
|
30352 | var data = this.data;
|
30353 | if (data) {
|
30354 | var objectName = options.objectName, enumeration = new visuals.ObjectEnumerationBuilder(), dataLabelsSettings = this.data.dataLabelsSettings ? this.data.dataLabelsSettings : visuals.dataLabelUtils.getDefaultTreemapLabelSettings();
|
30355 | switch (objectName) {
|
30356 | case "dataPoint":
|
30357 | var dataViewCat = this.dataViews && this.dataViews.length > 0 && this.dataViews[0] && this.dataViews[0].categorical, hasGradientRole = visuals.GradientUtils.hasGradientRole(dataViewCat);
|
30358 | hasGradientRole || this.enumerateDataPoints(enumeration, data);
|
30359 | break;
|
30360 |
|
30361 | case "legend":
|
30362 | return this.enumerateLegend(data);
|
30363 |
|
30364 | case "labels":
|
30365 | var labelSettingOptions = {
|
30366 | enumeration: enumeration,
|
30367 | dataLabelsSettings: dataLabelsSettings,
|
30368 | show: !0,
|
30369 | displayUnits: !0,
|
30370 | precision: !0
|
30371 | };
|
30372 | visuals.dataLabelUtils.enumerateDataLabels(labelSettingOptions);
|
30373 | break;
|
30374 |
|
30375 | case "categoryLabels":
|
30376 | visuals.dataLabelUtils.enumerateCategoryLabels(enumeration, dataLabelsSettings, !1, !0);
|
30377 | }
|
30378 | return enumeration.complete();
|
30379 | }
|
30380 | }, Treemap.prototype.enumerateDataPoints = function(enumeration, data) {
|
30381 | var rootChildren = data.root.children;
|
30382 | if (!_.isEmpty(rootChildren)) for (var y = 0; y < rootChildren.length; y++) {
|
30383 | var treemapNode = rootChildren[y];
|
30384 | enumeration.pushInstance({
|
30385 | displayName: treemapNode.name,
|
30386 | selector: visuals.ColorHelper.normalizeSelector(treemapNode.identity.getSelector()),
|
30387 | properties: {
|
30388 | fill: {
|
30389 | solid: {
|
30390 | color: treemapNode.color
|
30391 | }
|
30392 | }
|
30393 | },
|
30394 | objectName: "dataPoint"
|
30395 | });
|
30396 | }
|
30397 | }, Treemap.prototype.enumerateLegend = function(data) {
|
30398 | var legendObjectProperties = {
|
30399 | legend: data.legendObjectProperties
|
30400 | }, show = powerbi.DataViewObjects.getValue(legendObjectProperties, visuals.treemapProps.legend.show, this.legend.isVisible()), showTitle = powerbi.DataViewObjects.getValue(legendObjectProperties, visuals.treemapProps.legend.showTitle, !0), titleText = powerbi.DataViewObjects.getValue(legendObjectProperties, visuals.treemapProps.legend.titleText, this.data.legendData.title), labelColor = powerbi.DataViewObject.getValue(legendObjectProperties, visuals.legendProps.labelColor, this.data.legendData ? this.data.legendData.labelColor : visuals.LegendData.DefaultLegendLabelFillColor), labelFontSize = powerbi.DataViewObject.getValue(legendObjectProperties, visuals.legendProps.fontSize, this.data.legendData && this.data.legendData.fontSize ? this.data.legendData.fontSize : visuals.SVGLegend.DefaultFontSizeInPt);
|
30401 | return [ {
|
30402 | selector: null,
|
30403 | objectName: "legend",
|
30404 | properties: {
|
30405 | show: show,
|
30406 | position: visuals.LegendPosition[this.legend.getOrientation()],
|
30407 | showTitle: showTitle,
|
30408 | titleText: titleText,
|
30409 | labelColor: labelColor,
|
30410 | fontSize: labelFontSize
|
30411 | }
|
30412 | } ];
|
30413 | }, Treemap.checkValueForShape = function(value, cullableValue, allValuesAreNegative, dataWasCulled) {
|
30414 | var shouldCullValue = void 0;
|
30415 | return value ? (shouldCullValue = allValuesAreNegative ? Math.abs(value) < cullableValue : cullableValue > value,
|
30416 | shouldCullValue ? (dataWasCulled = dataWasCulled || shouldCullValue, {
|
30417 | validShape: !1,
|
30418 | dataWasCulled: dataWasCulled
|
30419 | }) : {
|
30420 | validShape: !0,
|
30421 | dataWasCulled: dataWasCulled
|
30422 | }) : {
|
30423 | validShape: !1,
|
30424 | dataWasCulled: dataWasCulled
|
30425 | };
|
30426 | }, Treemap.prototype.calculateTreemapSize = function() {
|
30427 | var legendMargins = this.legend.getMargins();
|
30428 | return {
|
30429 | height: this.currentViewport.height - legendMargins.height,
|
30430 | width: this.currentViewport.width - legendMargins.width
|
30431 | };
|
30432 | }, Treemap.prototype.initViewportDependantProperties = function(duration) {
|
30433 | void 0 === duration && (duration = 0);
|
30434 | var viewport = this.calculateTreemapSize();
|
30435 | this.svg.attr({
|
30436 | width: viewport.width,
|
30437 | height: viewport.height
|
30438 | }), visuals.Legend.positionChartArea(this.svg, this.legend), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options);
|
30439 | }, Treemap.hasChildrenWithIdentity = function(node) {
|
30440 | var children = node.children;
|
30441 | if (!children) return !1;
|
30442 | var count = children.length;
|
30443 | if (0 === count) return !1;
|
30444 | for (var i = count - 1; i >= 0; i--) if (children[i].identity.hasIdentity()) return !0;
|
30445 | return !1;
|
30446 | }, Treemap.canDisplayMajorLabel = function(node) {
|
30447 | if (1 !== node.depth) return !1;
|
30448 | if (_.isEmpty(node.name)) return !1;
|
30449 | var availableWidth = node.dx - 2 * Treemap.TextMargin;
|
30450 | if (availableWidth < Treemap.MinTextWidthForMajorLabel) return !1;
|
30451 | var textHeightWithMargin = Treemap.MajorLabelTextSize + 2 * Treemap.TextMargin;
|
30452 | return !(node.dy < textHeightWithMargin);
|
30453 | }, Treemap.canDisplayMinorLabel = function(node, labelSettings) {
|
30454 | if (node.depth < 1 || node.depth > 2) return !1;
|
30455 | if (1 === node.depth && (node.children || !labelSettings.show)) return !1;
|
30456 | if (_.isEmpty(node.name)) return !1;
|
30457 | var availableWidth = node.dx - 2 * Treemap.TextMargin;
|
30458 | if (availableWidth < Treemap.MinTextWidthForMinorLabel) return !1;
|
30459 | var textHeightWithMargin = Treemap.MinorLabelTextSize + 2 * Treemap.TextMargin;
|
30460 | if (node.dy < textHeightWithMargin) return !1;
|
30461 | if (1 === node.depth) {
|
30462 | var roomTop = node.y + Treemap.MajorLabelTextSize + 2 * Treemap.TextMargin;
|
30463 | if (node.y + node.dy - roomTop < textHeightWithMargin) return !1;
|
30464 | } else if (2 === node.depth) {
|
30465 | var parent_1 = node.parent, roomTop = Math.max(parent_1.y + Treemap.MajorLabelTextSize + 2 * Treemap.TextMargin, node.y);
|
30466 | if (node.y + node.dy - roomTop < textHeightWithMargin) return !1;
|
30467 | }
|
30468 | return !0;
|
30469 | }, Treemap.createMajorLabelText = function(node, labelsSettings, alternativeScale, formattersCache) {
|
30470 | var spaceAvaliableForLabels = node.dx - 2 * Treemap.TextMargin, baseTextProperties = Treemap.MajorLabelTextProperties, textProperties = {
|
30471 | text: node.name,
|
30472 | fontFamily: baseTextProperties.fontFamily,
|
30473 | fontSize: baseTextProperties.fontSize
|
30474 | };
|
30475 | return powerbi.TextMeasurementService.getTailoredTextOrDefault(textProperties, spaceAvaliableForLabels);
|
30476 | }, Treemap.createMinorLabelText = function(node, labelsSettings, alternativeScale, formattersCache) {
|
30477 | var spaceAvaliableForLabels = node.dx - 2 * Treemap.TextMargin, label = node.name;
|
30478 | if (labelsSettings.show) {
|
30479 | var measureFormatter = formattersCache.getOrCreate(node.labelFormatString, labelsSettings, alternativeScale);
|
30480 | label = visuals.dataLabelUtils.getLabelFormattedText({
|
30481 | label: null != node.originalHighlightValue ? node.originalHighlightValue : node.originalValue,
|
30482 | maxWidth: spaceAvaliableForLabels,
|
30483 | formatter: measureFormatter
|
30484 | }), labelsSettings.showCategory && 2 === node.depth && (label = visuals.dataLabelUtils.getLabelFormattedText({
|
30485 | label: node.name,
|
30486 | maxWidth: spaceAvaliableForLabels
|
30487 | }) + " " + label);
|
30488 | }
|
30489 | return visuals.dataLabelUtils.getLabelFormattedText({
|
30490 | label: label,
|
30491 | maxWidth: spaceAvaliableForLabels,
|
30492 | fontSize: labelsSettings.fontSize
|
30493 | });
|
30494 | }, Treemap.getFill = function(d, isHighlightRect) {
|
30495 | return d.depth > 1 && !d.identity.hasIdentity() && !isHighlightRect ? CssConstants.noneValue : Treemap.hasChildrenWithIdentity(d) ? CssConstants.noneValue : d.color;
|
30496 | }, Treemap.getFillOpacity = function(d, hasSelection, hasHighlights, isHighlightRect) {
|
30497 | return hasHighlights ? isHighlightRect ? null : Treemap.DimmedShapeOpacity.toString() : !hasSelection || d.selected ? null : d.depth > 1 && d.parent.selected ? null : Treemap.hasChildrenWithIdentity(d) ? null : Treemap.DimmedShapeOpacity.toString();
|
30498 | }, Treemap.prototype.updateInternal = function(suppressAnimations) {
|
30499 | var data = this.data, hasHighlights = data && data.hasHighlights, labelSettings = data ? data.dataLabelsSettings : null, duration = visuals.AnimatorCommon.GetAnimationDuration(this.animator, suppressAnimations);
|
30500 | this.options.interactivity && this.options.interactivity.isInteractiveLegend || !this.data || this.renderLegend(),
|
30501 | this.initViewportDependantProperties(duration);
|
30502 | var viewport = this.calculateTreemapSize();
|
30503 | this.treemap.size([ viewport.width, viewport.height ]);
|
30504 | var nodes = data && data.root ? this.treemap.nodes(data.root) : [], highlightNodes = nodes.filter(function(value) {
|
30505 | return null != value.highlightMultiplier && (!value.children || 0 === value.children.length);
|
30506 | }), majorLabeledNodes = [], minorLabeledNodes = [], alternativeScale = null;
|
30507 | labelSettings.showCategory && (majorLabeledNodes = nodes.filter(function(d) {
|
30508 | return Treemap.canDisplayMajorLabel(d);
|
30509 | })), (labelSettings.show || labelSettings.showCategory) && (minorLabeledNodes = nodes.filter(function(d) {
|
30510 | return Treemap.canDisplayMinorLabel(d, labelSettings);
|
30511 | }), 0 === labelSettings.displayUnits && (alternativeScale = d3.max(minorLabeledNodes, function(d) {
|
30512 | return Math.abs(d.value);
|
30513 | })));
|
30514 | var shapes, highlightShapes, majorLabels, minorLabels, result, treemapLayout = Treemap.getLayout(labelSettings, alternativeScale);
|
30515 | if (this.animator && !suppressAnimations) {
|
30516 | var options = {
|
30517 | viewModel: data,
|
30518 | nodes: nodes,
|
30519 | highlightNodes: highlightNodes,
|
30520 | majorLabeledNodes: majorLabeledNodes,
|
30521 | minorLabeledNodes: minorLabeledNodes,
|
30522 | shapeGraphicsContext: this.shapeGraphicsContext,
|
30523 | labelGraphicsContext: this.labelGraphicsContext,
|
30524 | interactivityService: this.interactivityService,
|
30525 | layout: treemapLayout,
|
30526 | labelSettings: labelSettings
|
30527 | };
|
30528 | result = this.animator.animate(options), shapes = result.shapes, highlightShapes = result.highlightShapes,
|
30529 | majorLabels = result.majorLabels, minorLabels = result.minorLabels;
|
30530 | }
|
30531 | if (!this.animator || suppressAnimations || result.failed) {
|
30532 | var hasSelection = this.interactivityService && this.interactivityService.hasSelection(), shapeGraphicsContext = this.shapeGraphicsContext;
|
30533 | shapes = Treemap.drawDefaultShapes(shapeGraphicsContext, nodes, hasSelection, hasHighlights, treemapLayout),
|
30534 | highlightShapes = Treemap.drawDefaultHighlightShapes(shapeGraphicsContext, highlightNodes, hasSelection, hasHighlights, treemapLayout);
|
30535 | var labelGraphicsContext = this.labelGraphicsContext;
|
30536 | majorLabels = Treemap.drawDefaultMajorLabels(labelGraphicsContext, majorLabeledNodes, labelSettings, treemapLayout),
|
30537 | minorLabels = Treemap.drawDefaultMinorLabels(labelGraphicsContext, minorLabeledNodes, labelSettings, treemapLayout);
|
30538 | }
|
30539 | if (this.interactivityService) {
|
30540 | var behaviorOptions = {
|
30541 | shapes: shapes,
|
30542 | highlightShapes: highlightShapes,
|
30543 | majorLabels: majorLabels,
|
30544 | minorLabels: minorLabels,
|
30545 | nodes: nodes,
|
30546 | hasHighlights: data.hasHighlights
|
30547 | };
|
30548 | this.interactivityService.bind(nodes, this.behavior, behaviorOptions);
|
30549 | }
|
30550 | this.tooltipsEnabled && (visuals.TooltipManager.addTooltip(shapes, function(tooltipEvent) {
|
30551 | return tooltipEvent.data.highlightedTooltipInfo ? tooltipEvent.data.highlightedTooltipInfo : tooltipEvent.data.tooltipInfo;
|
30552 | }), visuals.TooltipManager.addTooltip(highlightShapes, function(tooltipEvent) {
|
30553 | return tooltipEvent.data.highlightedTooltipInfo;
|
30554 | })), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options);
|
30555 | }, Treemap.prototype.renderLegend = function() {
|
30556 | var legendObjectProperties = this.data.legendObjectProperties;
|
30557 | if (legendObjectProperties) {
|
30558 | var legendData = this.data.legendData;
|
30559 | visuals.LegendData.update(legendData, legendObjectProperties);
|
30560 | var position = legendObjectProperties[visuals.legendProps.position];
|
30561 | position && this.legend.changeOrientation(visuals.LegendPosition[position]), this.legend.drawLegend(legendData, this.currentViewport);
|
30562 | } else this.legend.changeOrientation(visuals.LegendPosition.Top), this.legend.drawLegend({
|
30563 | dataPoints: []
|
30564 | }, this.currentViewport);
|
30565 | }, Treemap.getNodeClass = function(d, highlight) {
|
30566 | var nodeClass;
|
30567 | switch (d.depth) {
|
30568 | case 1:
|
30569 | nodeClass = Treemap.ParentGroupClassName;
|
30570 | break;
|
30571 |
|
30572 | case 2:
|
30573 | nodeClass = Treemap.NodeGroupClassName;
|
30574 | break;
|
30575 |
|
30576 | case 0:
|
30577 | nodeClass = Treemap.RootNodeClassName;
|
30578 | }
|
30579 | return nodeClass += " " + (highlight ? Treemap.HighlightNodeClassName : Treemap.TreemapNodeClassName);
|
30580 | }, Treemap.createTreemapShapeLayout = function(isHighlightRect) {
|
30581 | return void 0 === isHighlightRect && (isHighlightRect = !1), {
|
30582 | x: function(d) {
|
30583 | return d.x;
|
30584 | },
|
30585 | y: function(d) {
|
30586 | return d.y + (isHighlightRect ? d.dy * (1 - d.highlightMultiplier) : 0);
|
30587 | },
|
30588 | width: function(d) {
|
30589 | return Math.max(0, d.dx);
|
30590 | },
|
30591 | height: function(d) {
|
30592 | return Math.max(0, d.dy * (isHighlightRect ? d.highlightMultiplier : 1));
|
30593 | }
|
30594 | };
|
30595 | }, Treemap.createTreemapZeroShapeLayout = function() {
|
30596 | return {
|
30597 | x: function(d) {
|
30598 | return d.x;
|
30599 | },
|
30600 | y: function(d) {
|
30601 | return d.y + d.dy;
|
30602 | },
|
30603 | width: function(d) {
|
30604 | return Math.max(0, d.dx);
|
30605 | },
|
30606 | height: function(d) {
|
30607 | return 0;
|
30608 | }
|
30609 | };
|
30610 | }, Treemap.drawDefaultShapes = function(context, nodes, hasSelection, hasHighlights, layout) {
|
30611 | var isHighlightShape = !1, shapes = context.selectAll("." + Treemap.TreemapNodeClassName).data(nodes, function(d) {
|
30612 | return d.key;
|
30613 | });
|
30614 | return shapes.enter().append("rect").attr("class", layout.shapeClass), shapes.style("fill", function(d) {
|
30615 | return Treemap.getFill(d, isHighlightShape);
|
30616 | }).style("fill-opacity", function(d) {
|
30617 | return Treemap.getFillOpacity(d, hasSelection, hasHighlights, isHighlightShape);
|
30618 | }).attr(layout.shapeLayout), shapes.exit().remove(), shapes;
|
30619 | }, Treemap.drawDefaultHighlightShapes = function(context, nodes, hasSelection, hasHighlights, layout) {
|
30620 | var isHighlightShape = !0, highlightShapes = context.selectAll("." + Treemap.HighlightNodeClassName).data(nodes, function(d) {
|
30621 | return d.key + "highlight";
|
30622 | });
|
30623 | return highlightShapes.enter().append("rect").attr("class", layout.highlightShapeClass),
|
30624 | highlightShapes.style("fill", function(d) {
|
30625 | return Treemap.getFill(d, isHighlightShape);
|
30626 | }).style("fill-opacity", function(d) {
|
30627 | return Treemap.getFillOpacity(d, hasSelection, hasHighlights, isHighlightShape);
|
30628 | }).attr(layout.highlightShapeLayout), highlightShapes.exit().remove(), highlightShapes;
|
30629 | }, Treemap.drawDefaultMajorLabels = function(context, nodes, labelSettings, layout) {
|
30630 | var labels = context.selectAll("." + Treemap.MajorLabelClassName).data(nodes, function(d) {
|
30631 | return d.key;
|
30632 | });
|
30633 | return labels.enter().append("text").attr("class", layout.majorLabelClass), labels.attr(layout.majorLabelLayout).text(layout.majorLabelText).style("fill", function() {
|
30634 | return labelSettings.labelColor;
|
30635 | }), labels.exit().remove(), labels;
|
30636 | }, Treemap.drawDefaultMinorLabels = function(context, nodes, labelSettings, layout) {
|
30637 | var labels = context.selectAll("." + Treemap.MinorLabelClassName).data(nodes, function(d) {
|
30638 | return d.key;
|
30639 | });
|
30640 | return labels.enter().append("text").attr("class", layout.minorLabelClass), labels.attr(layout.minorLabelLayout).text(layout.minorLabelText).style("fill", function() {
|
30641 | return labelSettings.labelColor;
|
30642 | }), labels.exit().remove(), labels;
|
30643 | }, Treemap.cleanMinorLabels = function(context) {
|
30644 | var empty = [], labels = context.selectAll("." + Treemap.LabelsGroupClassName).selectAll("." + Treemap.MinorLabelClassName).data(empty);
|
30645 | labels.exit().remove();
|
30646 | }, Treemap.DimmedShapeOpacity = .4, Treemap.ClassName = "treemap", Treemap.LabelsGroupClassName = "labels",
|
30647 | Treemap.MajorLabelClassName = "majorLabel", Treemap.MinorLabelClassName = "minorLabel",
|
30648 | Treemap.ShapesClassName = "shapes", Treemap.TreemapNodeClassName = "treemapNode",
|
30649 | Treemap.RootNodeClassName = "rootNode", Treemap.ParentGroupClassName = "parentGroup",
|
30650 | Treemap.NodeGroupClassName = "nodeGroup", Treemap.HighlightNodeClassName = "treemapNodeHighlight",
|
30651 | Treemap.TextMargin = 5, Treemap.MinorLabelTextSize = 10, Treemap.MinTextWidthForMinorLabel = 18,
|
30652 | Treemap.MajorLabelTextSize = 12, Treemap.MinTextWidthForMajorLabel = 22, Treemap.MajorLabelTextProperties = {
|
30653 | fontFamily: visuals.Font.Family.regular.css,
|
30654 | fontSize: Treemap.MajorLabelTextSize + "px"
|
30655 | }, Treemap.CullableArea = 9, Treemap;
|
30656 | }();
|
30657 | visuals.Treemap = Treemap;
|
30658 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
30659 | }(powerbi || (powerbi = {}));
|
30660 | }, function(module, exports) {
|
30661 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi, __extends = (window.powerbitests,
|
30662 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
30663 | function __() {
|
30664 | this.constructor = d;
|
30665 | }
|
30666 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
30667 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
30668 | });
|
30669 | !function(powerbi) {
|
30670 | var visuals;
|
30671 | !function(visuals) {
|
30672 | var getKpiImageMetadata = powerbi.visuals.KpiUtil.getKpiImageMetadata, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, Card = function(_super) {
|
30673 | function Card(options) {
|
30674 | _super.call(this, Card.cardClassName), this.isScrollable = !1, this.displayUnitSystemType = powerbi.DisplayUnitSystemType.WholeUnits,
|
30675 | options && (this.isScrollable = !!options.isScrollable, options.animator && (this.animator = options.animator),
|
30676 | null != options.displayUnitSystemType && (this.displayUnitSystemType = options.displayUnitSystemType),
|
30677 | options.cardSmallViewportProperties && (this.cardSmallViewportProperties = options.cardSmallViewportProperties));
|
30678 | }
|
30679 | return __extends(Card, _super), Card.prototype.init = function(options) {
|
30680 | this.animationOptions = options.animation;
|
30681 | var element = options.element;
|
30682 | this.kpiImage = d3.select(element.get(0)).append("div").classed(Card.KPIImage["class"], !0);
|
30683 | var svg = this.svg = d3.select(element.get(0)).append("svg");
|
30684 | this.graphicsContext = svg.append("g"), this.currentViewport = options.viewport,
|
30685 | this.hostServices = options.host, this.style = options.style, this.updateViewportProperties(),
|
30686 | this.isScrollable && (svg.attr("class", Card.cardClassName), this.labelContext = svg.append("g"));
|
30687 | }, Card.prototype.onDataChanged = function(options) {
|
30688 | var value, dataView = options.dataViews[0];
|
30689 | if (dataView) {
|
30690 | this.getMetaDataColumn(dataView), dataView.single && (value = dataView.single.value),
|
30691 | this.cardFormatSetting = this.getDefaultFormatSettings();
|
30692 | var dataViewMetadata = dataView.metadata;
|
30693 | if (dataViewMetadata) {
|
30694 | var objects = dataViewMetadata.objects;
|
30695 | if (objects) {
|
30696 | var labelSettings = this.cardFormatSetting.labelSettings;
|
30697 | labelSettings.labelColor = powerbi.DataViewObjects.getFillColor(objects, visuals.cardProps.labels.color, labelSettings.labelColor),
|
30698 | labelSettings.precision = powerbi.DataViewObjects.getValue(objects, visuals.cardProps.labels.labelPrecision, labelSettings.precision),
|
30699 | labelSettings.fontSize = powerbi.DataViewObjects.getValue(objects, visuals.cardProps.labels.fontSize, labelSettings.fontSize),
|
30700 | labelSettings.precision !== visuals.dataLabelUtils.defaultLabelPrecision && labelSettings.precision < 0 && (labelSettings.precision = 0),
|
30701 | labelSettings.displayUnits = powerbi.DataViewObjects.getValue(objects, visuals.cardProps.labels.labelDisplayUnits, labelSettings.displayUnits),
|
30702 | labelSettings.showCategory = powerbi.DataViewObjects.getValue(objects, visuals.cardProps.categoryLabels.show, labelSettings.showCategory),
|
30703 | labelSettings.categoryLabelColor = powerbi.DataViewObjects.getFillColor(objects, visuals.cardProps.categoryLabels.color, labelSettings.categoryLabelColor),
|
30704 | this.cardFormatSetting.wordWrap = powerbi.DataViewObjects.getValue(objects, visuals.cardProps.wordWrap.show, this.cardFormatSetting.wordWrap),
|
30705 | this.cardFormatSetting.textSize = powerbi.DataViewObjects.getValue(objects, visuals.cardProps.categoryLabels.fontSize, this.cardFormatSetting.textSize);
|
30706 | }
|
30707 | }
|
30708 | }
|
30709 | this.updateInternal(value, !0, !0);
|
30710 | }, Card.prototype.onResizing = function(viewport) {
|
30711 | this.currentViewport = viewport, this.updateViewportProperties(), this.updateInternal(this.value, !0, !0);
|
30712 | }, Card.prototype.updateViewportProperties = function() {
|
30713 | var viewport = this.currentViewport;
|
30714 | this.svg.attr("width", viewport.width).attr("height", viewport.height);
|
30715 | }, Card.prototype.setTextProperties = function(text, fontSize) {
|
30716 | Card.cardTextProperties.fontSize = jsCommon.PixelConverter.fromPoint(fontSize),
|
30717 | Card.cardTextProperties.text = text;
|
30718 | }, Card.prototype.getCardFormatTextSize = function() {
|
30719 | return this.cardFormatSetting.textSize;
|
30720 | }, Card.prototype.isSmallViewport = function() {
|
30721 | return !!(this.cardSmallViewportProperties && this.currentViewport.width < this.cardSmallViewportProperties.cardSmallViewportWidth);
|
30722 | }, Card.prototype.getCardPrecision = function(isSmallViewport) {
|
30723 | return void 0 === isSmallViewport && (isSmallViewport = !1), isSmallViewport ? visuals.dataLabelUtils.defaultLabelPrecision : this.cardFormatSetting.labelSettings.precision;
|
30724 | }, Card.prototype.getCardDisplayUnits = function(isSmallViewport) {
|
30725 | return void 0 === isSmallViewport && (isSmallViewport = !1), isSmallViewport ? 0 : this.cardFormatSetting.labelSettings.displayUnits;
|
30726 | }, Card.prototype.getAdjustedFontHeight = function(availableWidth, textToMeasure, seedFontHeight) {
|
30727 | var adjustedFontHeight = _super.prototype.getAdjustedFontHeight.call(this, availableWidth, textToMeasure, seedFontHeight);
|
30728 | return Math.min(adjustedFontHeight, Card.DefaultStyle.card.maxFontSize);
|
30729 | }, Card.prototype.clear = function(valueOnly) {
|
30730 | void 0 === valueOnly && (valueOnly = !1), this.svg.select(Card.Value.selector).text(""),
|
30731 | valueOnly || this.svg.select(Card.Label.selector).text(""), _super.prototype.clear.call(this);
|
30732 | }, Card.prototype.updateInternal = function(target, suppressAnimations, forceUpdate) {
|
30733 | void 0 === forceUpdate && (forceUpdate = !1);
|
30734 | var start = this.value, duration = visuals.AnimatorCommon.GetAnimationDuration(this.animator, suppressAnimations);
|
30735 | if (void 0 === target) return void (void 0 !== start && this.clear());
|
30736 | var metaDataColumn = this.metaDataColumn, labelSettings = this.cardFormatSetting.labelSettings, isSmallViewport = this.isSmallViewport(), precision = this.getCardPrecision(isSmallViewport), displayUnits = this.getCardDisplayUnits(isSmallViewport), isDefaultDisplayUnit = 0 === displayUnits, format = this.getFormatString(metaDataColumn), formatter = visuals.valueFormatter.create({
|
30737 | format: format,
|
30738 | value: isDefaultDisplayUnit ? target : displayUnits,
|
30739 | precision: visuals.dataLabelUtils.getLabelPrecision(precision, format),
|
30740 | displayUnitSystemType: isDefaultDisplayUnit && precision === visuals.dataLabelUtils.defaultLabelPrecision ? this.displayUnitSystemType : powerbi.DisplayUnitSystemType.WholeUnits,
|
30741 | formatSingleValues: !!isDefaultDisplayUnit,
|
30742 | allowFormatBeautification: !0,
|
30743 | columnType: metaDataColumn ? metaDataColumn.type : void 0
|
30744 | }), formatSettings = this.cardFormatSetting, valueTextHeightInPx = jsCommon.PixelConverter.fromPointToPixel(labelSettings.fontSize), valueStyles = Card.DefaultStyle.value;
|
30745 | this.setTextProperties(target, this.getCardFormatTextSize());
|
30746 | var labelTextHeightInPx = labelSettings.showCategory ? powerbi.TextMeasurementService.estimateSvgTextHeight(Card.cardTextProperties) : 0, labelHeightWithPadding = labelTextHeightInPx + Card.DefaultStyle.label.paddingTop, width = this.currentViewport.width, height = this.currentViewport.height, translateX = this.getTranslateX(width), translateY = (height - labelHeightWithPadding - valueTextHeightInPx) / 2, statusGraphicInfo = getKpiImageMetadata(metaDataColumn, target, 1);
|
30747 | if (this.isScrollable) {
|
30748 | if (!forceUpdate && start === target) return;
|
30749 | if (start === target || !_.isEmpty(target) && "string" == typeof target || (target = formatter.format(target)),
|
30750 | statusGraphicInfo) this.graphicsContext.selectAll("text").remove(), this.displayStatusGraphic(statusGraphicInfo, translateX, translateY, valueTextHeightInPx); else {
|
30751 | this.kpiImage.selectAll("div").remove();
|
30752 | var translatedValueY = this.getTranslateY(valueTextHeightInPx + translateY), valueElement = this.graphicsContext.attr("transform", visuals.SVGUtil.translate(translateX, translatedValueY)).selectAll("text").data([ target ]);
|
30753 | if (valueElement.enter().append("text").attr("class", Card.Value["class"]), valueElement.text(function(d) {
|
30754 | return d;
|
30755 | }).style({
|
30756 | "font-size": jsCommon.PixelConverter.fromPoint(labelSettings.fontSize),
|
30757 | fill: labelSettings.labelColor,
|
30758 | "font-family": valueStyles.fontFamily,
|
30759 | "text-anchor": this.getTextAnchor()
|
30760 | }), formatSettings.wordWrap) {
|
30761 | var valueElementNode = valueElement.node();
|
30762 | powerbi.TextMeasurementService.wordBreak(valueElementNode, width, height - labelHeightWithPadding);
|
30763 | var numLines = valueElementNode.childElementCount;
|
30764 | if (numLines > 1) {
|
30765 | var valueTextLineHeight = valueTextHeightInPx;
|
30766 | valueTextHeightInPx *= numLines, translateY = (height - labelHeightWithPadding - valueTextHeightInPx) / 2,
|
30767 | translatedValueY = this.getTranslateY(valueTextLineHeight + translateY), this.graphicsContext.attr("transform", visuals.SVGUtil.translate(translateX, translatedValueY));
|
30768 | }
|
30769 | } else valueElement.call(visuals.AxisHelper.LabelLayoutStrategy.clip, width, powerbi.TextMeasurementService.svgEllipsis);
|
30770 | valueElement.append("title").text(function(d) {
|
30771 | return d;
|
30772 | }), valueElement.exit().remove();
|
30773 | }
|
30774 | if (labelSettings.showCategory && metaDataColumn && metaDataColumn.displayName) {
|
30775 | var labelData = [ metaDataColumn.displayName ], translatedLabelY = this.getTranslateY(valueTextHeightInPx + labelHeightWithPadding + translateY), labelElement = this.labelContext.attr("transform", visuals.SVGUtil.translate(translateX, translatedLabelY)).selectAll("text").data(labelData);
|
30776 | labelElement.enter().append("text").attr("class", Card.Label["class"]), labelElement.text(function(d) {
|
30777 | return d;
|
30778 | }).style({
|
30779 | "font-size": jsCommon.PixelConverter.fromPoint(this.getCardFormatTextSize()),
|
30780 | fill: labelSettings.categoryLabelColor,
|
30781 | "text-anchor": this.getTextAnchor()
|
30782 | });
|
30783 | var labelElementNode = labelElement.node();
|
30784 | labelElementNode && (formatSettings.wordWrap ? powerbi.TextMeasurementService.wordBreak(labelElementNode, width / 2, height - translatedLabelY) : labelElement.call(visuals.AxisHelper.LabelLayoutStrategy.clip, width, powerbi.TextMeasurementService.svgEllipsis)),
|
30785 | labelElement.append("title").text(function(d) {
|
30786 | return d;
|
30787 | }), labelElement.exit().remove();
|
30788 | } else this.labelContext.selectAll("text").remove();
|
30789 | } else statusGraphicInfo ? (this.graphicsContext.selectAll("text").remove(), this.displayStatusGraphic(statusGraphicInfo, translateX, translateY, valueTextHeightInPx)) : (this.kpiImage.selectAll("div").remove(),
|
30790 | this.doValueTransition(start, target, this.displayUnitSystemType, this.animationOptions, duration, forceUpdate, formatter),
|
30791 | this.graphicsContext.call(visuals.tooltipUtils.tooltipUpdate, [ target ]));
|
30792 | this.value = target;
|
30793 | }, Card.prototype.displayStatusGraphic = function(statusGraphicInfo, translateX, translateY, labelTextSizeInPx) {
|
30794 | this.graphicsContext.selectAll("text").remove();
|
30795 | var kpiImageDiv = this.kpiImage.select("div");
|
30796 | kpiImageDiv && !kpiImageDiv.empty() || (kpiImageDiv = this.kpiImage.append("div")),
|
30797 | kpiImageDiv.attr("class", statusGraphicInfo["class"]).style("position", "absolute").style("font-size", labelTextSizeInPx + "px");
|
30798 | var imageWidth = kpiImageDiv.node().offsetWidth, imageHeight = kpiImageDiv.node().offsetHeight;
|
30799 | kpiImageDiv.style("transform", visuals.SVGUtil.translateWithPixels(translateX - imageWidth / 2, this.getTranslateY(labelTextSizeInPx + translateY) - imageHeight));
|
30800 | }, Card.prototype.getDefaultFormatSettings = function() {
|
30801 | return {
|
30802 | labelSettings: visuals.dataLabelUtils.getDefaultCardLabelSettings(Card.DefaultStyle.value.color, Card.DefaultStyle.label.color, Card.DefaultStyle.value.textSize),
|
30803 | wordWrap: !1,
|
30804 | textSize: Card.DefaultStyle.label.textSize
|
30805 | };
|
30806 | }, Card.prototype.enumerateObjectInstances = function(options) {
|
30807 | this.cardFormatSetting || (this.cardFormatSetting = this.getDefaultFormatSettings());
|
30808 | var formatSettings = this.cardFormatSetting, enumeration = new visuals.ObjectEnumerationBuilder();
|
30809 | switch (options.objectName) {
|
30810 | case "categoryLabels":
|
30811 | visuals.dataLabelUtils.enumerateCategoryLabels(enumeration, formatSettings.labelSettings, !0, !0, formatSettings.textSize);
|
30812 | break;
|
30813 |
|
30814 | case "labels":
|
30815 | var labelSettingOptions = {
|
30816 | enumeration: enumeration,
|
30817 | dataLabelsSettings: formatSettings.labelSettings,
|
30818 | show: !0,
|
30819 | displayUnits: !0,
|
30820 | precision: !0,
|
30821 | fontSize: !0
|
30822 | };
|
30823 | visuals.dataLabelUtils.enumerateDataLabels(labelSettingOptions);
|
30824 | break;
|
30825 |
|
30826 | case "wordWrap":
|
30827 | enumeration.pushInstance({
|
30828 | objectName: "wordWrap",
|
30829 | selector: null,
|
30830 | properties: {
|
30831 | show: formatSettings.wordWrap
|
30832 | }
|
30833 | });
|
30834 | }
|
30835 | return enumeration.complete();
|
30836 | }, Card.cardClassName = "card", Card.Label = createClassAndSelector("label"), Card.Value = createClassAndSelector("value"),
|
30837 | Card.KPIImage = createClassAndSelector("caption"), Card.cardTextProperties = {
|
30838 | fontSize: null,
|
30839 | text: null,
|
30840 | fontFamily: visuals.dataLabelUtils.LabelTextProperties.fontFamily
|
30841 | }, Card.DefaultStyle = {
|
30842 | card: {
|
30843 | maxFontSize: 200
|
30844 | },
|
30845 | label: {
|
30846 | textSize: 12,
|
30847 | color: "#a6a6a6",
|
30848 | paddingTop: 8
|
30849 | },
|
30850 | value: {
|
30851 | textSize: 27,
|
30852 | color: "#333333",
|
30853 | fontFamily: visuals.Font.Family.regularSecondary.css
|
30854 | }
|
30855 | }, Card;
|
30856 | }(visuals.AnimatedText);
|
30857 | visuals.Card = Card;
|
30858 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
30859 | }(powerbi || (powerbi = {}));
|
30860 | }, function(module, exports) {
|
30861 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
30862 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
30863 | !function(powerbi) {
|
30864 | var visuals;
|
30865 | !function(visuals) {
|
30866 | var OwlHappiness;
|
30867 | !function(OwlHappiness) {
|
30868 | OwlHappiness[OwlHappiness.Sad = 0] = "Sad", OwlHappiness[OwlHappiness.Meh = 1] = "Meh",
|
30869 | OwlHappiness[OwlHappiness.Happy = 2] = "Happy";
|
30870 | }(OwlHappiness || (OwlHappiness = {}));
|
30871 | var OwlGauge = function() {
|
30872 | function OwlGauge() {}
|
30873 | return OwlGauge.converter = function(dataView) {
|
30874 | return {};
|
30875 | }, OwlGauge.getGaugeData = function(dataView) {
|
30876 | var settings = {
|
30877 | max: 100,
|
30878 | min: 0,
|
30879 | target: void 0,
|
30880 | value: 0,
|
30881 | tooltipItems: []
|
30882 | };
|
30883 | if (dataView && dataView.categorical && dataView.categorical.values && dataView.metadata && dataView.metadata.columns) for (var values = dataView.categorical.values, metadataColumns = dataView.metadata.columns, i = 0; i < values.length; i++) {
|
30884 | var col = metadataColumns[i], value = values[i].values[0] || 0;
|
30885 | col && col.roles && (col.roles[visuals.gaugeRoleNames.y] ? (settings.value = value,
|
30886 | value && settings.tooltipItems.push({
|
30887 | displayName: values[i].source.displayName,
|
30888 | value: visuals.converterHelper.formatFromMetadataColumn(value, values[i].source, visuals.Gauge.formatStringProp)
|
30889 | })) : col.roles[visuals.gaugeRoleNames.minValue] ? settings.min = value : col.roles[visuals.gaugeRoleNames.maxValue] ? settings.max = value : col.roles[visuals.gaugeRoleNames.targetValue] && (settings.target = value,
|
30890 | value && settings.tooltipItems.push({
|
30891 | displayName: values[i].source.displayName,
|
30892 | value: visuals.converterHelper.formatFromMetadataColumn(value, values[i].source, visuals.Gauge.formatStringProp)
|
30893 | })));
|
30894 | }
|
30895 | return settings;
|
30896 | }, OwlGauge.prototype.init = function(options) {
|
30897 | var _this = this;
|
30898 | this.rootElem = options.element, this.rootElem.addClass("owlGaugeVisual"), this.svgTailElem = $(OwlGauge.owlTailSvg),
|
30899 | this.svgBgElem = $(OwlGauge.visualBgSvg), this.svgBodyElem = $(OwlGauge.owlBodySvg),
|
30900 | this.rootElem.append(this.svgBgElem).append(this.svgTailElem).append(this.svgBodyElem),
|
30901 | OwlGauge.OwlDemoMode && window.setInterval(function() {
|
30902 | var randomPercentage = 100 * Math.random() + 1;
|
30903 | _this.updateGauge(randomPercentage);
|
30904 | }, 2e3), this.updateViewportSize(options.viewport.width, options.viewport.height);
|
30905 | }, OwlGauge.prototype.update = function(options) {
|
30906 | this.updateViewportSize(options.viewport.width, options.viewport.height);
|
30907 | var dataView = options.dataViews.length > 0 ? options.dataViews[0] : null;
|
30908 | if (dataView) {
|
30909 | var gaugeData = OwlGauge.getGaugeData(options.dataViews[0]), percentage = (gaugeData.value - gaugeData.min) / (gaugeData.max - gaugeData.min);
|
30910 | this.updateGauge(100 * percentage | 0);
|
30911 | } else this.updateGauge(0);
|
30912 | }, OwlGauge.prototype.updateGauge = function(percentage) {
|
30913 | if (percentage >= 0 && 100 >= percentage) {
|
30914 | var rotationDeg = -180 + 180 * percentage / 100;
|
30915 | this.svgBgElem.css({
|
30916 | transform: "rotate(" + rotationDeg + "deg)"
|
30917 | }), percentage >= 66 ? this.happinessLevel = OwlHappiness.Happy : percentage >= 33 ? this.happinessLevel = OwlHappiness.Meh : this.happinessLevel = OwlHappiness.Sad;
|
30918 | }
|
30919 | }, Object.defineProperty(OwlGauge.prototype, "happinessLevel", {
|
30920 | set: function(level) {
|
30921 | switch (this.rootElem.removeClass("sad").removeClass("meh").removeClass("happy"),
|
30922 | level) {
|
30923 | case OwlHappiness.Sad:
|
30924 | this.rootElem.addClass("sad");
|
30925 | break;
|
30926 |
|
30927 | case OwlHappiness.Meh:
|
30928 | this.rootElem.addClass("meh");
|
30929 | break;
|
30930 |
|
30931 | case OwlHappiness.Happy:
|
30932 | this.rootElem.addClass("happy");
|
30933 | }
|
30934 | },
|
30935 | enumerable: !0,
|
30936 | configurable: !0
|
30937 | }), OwlGauge.prototype.updateViewportSize = function(width, height) {
|
30938 | var _this = this, smoothingFn = window.setImmediate || window.requestAnimationFrame;
|
30939 | smoothingFn(function() {
|
30940 | _this.rootElem.css({
|
30941 | height: height,
|
30942 | width: width
|
30943 | }), _this.svgBodyElem.height(_this.svgBodyElem.width() * OwlGauge.owlBodyHeightMultiplier),
|
30944 | _this.svgBgElem.height(_this.svgBgElem.width() * OwlGauge.visualBgHeightMultiplier),
|
30945 | _this.svgTailElem.height(_this.svgTailElem.width() * OwlGauge.owlTailHeightMultiplier);
|
30946 | });
|
30947 | }, OwlGauge.owlBodySvg = '<svg version="1.1" class="owlGaugeBody" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 267.7 291.2" style="enable-background:new 0 0 267.7 291.2;" xml:space="preserve"> <style type="text/css"> .owlGaugeBody .st0{fill:#A87D50;} .owlGaugeBody .st1{fill:#C2B59B;} .owlGaugeBody .st2{fill:#EB2227;} .owlGaugeBody .st3{fill:#FFFFFF;} .owlGaugeBody .st4{fill:#F9D018;} .owlGaugeBody .st5{fill:none;} .owlGaugeBody .st6{fill:#83381B;} .owlGaugeBody .st7{fill:#231F20;} </style> <g id="XMLID_31_"> <g id="XMLID_34_"> <ellipse id="XMLID_21_" transform="matrix(0.9998 1.947640e-02 -1.947640e-02 0.9998 2.8614 -2.5802)" class="st0" cx="133.9" cy="145.6" rx="133.9" ry="145.6"/> <polygon id="XMLID_20_" class="st0" points="199.2,32.8 184,11.3 209,9.7 "/> <polygon id="XMLID_19_" class="st0" points="73.9,31.2 62.1,7.7 87.1,9.8 "/> <circle id="XMLID_18_" class="st1" cx="134.8" cy="189.2" r="89.8"/> <path id="XMLID_17_" class="st2" d="M140.1,88c-2.7,3.8-7.9,4.7-11.7,2c-2.7-1.9-3.9-5.1-3.4-8.1c0,0,9.6-41.8,9.6-41.8l6.9,40.8 C142,83.2,141.6,85.8,140.1,88z"/> <path id="XMLID_16_" class="st3" d="M164.6,16.2c-14.2,0-26.3,9.2-30.6,21.9c-4.1-13.1-16.3-22.6-30.8-22.6 C85.4,15.6,71,30,71,47.8s14.4,32.3,32.3,32.3c14.2,0,26.3-9.2,30.6-21.9c4.1,13.1,16.3,22.6,30.8,22.6 c17.8,0,32.3-14.4,32.3-32.3S182.4,16.2,164.6,16.2z"/> <path id="XMLID_15_" class="st4" d="M122,58.7l23.3-0.1c0,0-9,14.8-10.2,16.6c-1.2,1.9-2.2,0.1-2.2,0.1L122,58.7z"/> <rect id="XMLID_14_" x="-11.4" y="-68.8" class="st5" width="288.3" height="259.7"/> <g id="XMLID_37_"> <path id="XMLID_13_" class="st6" d="M121.6,125.5c0,3.7-3.5,6.6-7.7,6.6c-4.2,0-7.7-3-7.7-6.6"/> <path id="XMLID_12_" class="st6" d="M160.1,126.5c0,3.7-3.5,6.6-7.7,6.6s-7.7-3-7.7-6.6"/> <path id="XMLID_11_" class="st6" d="M142.4,148.1c0,3.7-3.5,6.6-7.7,6.6c-4.2,0-7.7-3-7.7-6.6"/> <path id="XMLID_10_" class="st6" d="M183.1,148.8c0,3.7-3.5,6.6-7.7,6.6c-4.2,0-7.7-3-7.7-6.6"/> <path id="XMLID_9_" class="st6" d="M160.9,177.4c0,3.7-3.5,6.6-7.7,6.6s-7.7-3-7.7-6.6"/> <path id="XMLID_8_" class="st6" d="M201.6,178c0,3.7-3.5,6.6-7.7,6.6s-7.7-3-7.7-6.6"/> <path id="XMLID_7_" class="st6" d="M76.4,177.4c0,3.7-3.5,6.6-7.7,6.6c-4.2,0-7.7-3-7.7-6.6"/> <path id="XMLID_6_" class="st6" d="M117,178c0,3.7-3.5,6.6-7.7,6.6s-7.7-3-7.7-6.6"/> <path id="XMLID_5_" class="st6" d="M98.6,148.1c0,3.7-3.5,6.6-7.7,6.6c-4.2,0-7.7-3-7.7-6.6"/> </g> <circle id="XMLID_4_" class="st7" cx="164.1" cy="49" r="6.4"/> <circle id="XMLID_3_" class="st7" cx="102.7" cy="47.7" r="6.4"/> </g> <path id="XMLID_2_" class="st0" d="M160.1,140.9c11.1-8.4,55.6-36,55.6-36l4.7,0.8l10.2,38.8c0,0-3,3-9.2,3.1 c-5.1,0.1-45.9-2.6-60.2-3.5C158.1,143.9,157.7,142.7,160.1,140.9z"/> <path id="XMLID_1_" class="st0" d="M110.6,140.8c-11.1-8.4-55.6-36-55.6-36l-4.7,0.8L40,144.4c0,0,3,3,9.2,3.1 c5.1,0.1,45.9-2.6,60.2-3.5C112.5,143.8,113,142.6,110.6,140.8z"/> </g> </svg>',
|
30948 | OwlGauge.owlTailSvg = '<svg version="1.1" class="owlGaugeTail" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 587.8 295.5" style="enable-background:new 0 0 587.8 295.5;" xml:space="preserve"> <style type="text/css"> .owlGaugeTail .st0{fill:#3B2416;} .owlGaugeTail .st1{fill:#5B4B43;} .owlGaugeTail .st2{fill:#603A17;} .owlGaugeTail .st3{fill:#726659;} </style> <g id="XMLID_55_"> <path id="XMLID_29_" class="st0" d="M85.2,106.2c-27.1,0-49.2,22-49.2,49.2c0,19.1,10.9,35.7,26.9,43.8c0,0,231.2,95.9,231.2,95.9 l-171-171C114.1,113.2,100.5,106.2,85.2,106.2z"/> <g id="XMLID_56_"> <path id="XMLID_28_" class="st1" d="M482.5,86.4c0-27.1-22-49.2-49.2-49.2c-19.1,0-35.7,10.9-43.8,26.9c0,0-95.9,231.2-95.9,231.2 l171-171C475.5,115.3,482.5,101.7,482.5,86.4z"/> <path id="XMLID_27_" class="st2" d="M573.5,281.3c19.2-19.2,19.2-50.3,0-69.5c-13.5-13.5-33-17.5-50-12c0,0-231.3,95.7-231.3,95.7 l241.8,0C548,296.9,562.6,292.1,573.5,281.3z"/> <path id="XMLID_26_" class="st3" d="M279.9,14.4c-19.2-19.2-50.3-19.2-69.5,0c-13.5,13.5-17.5,33-12,50c0,0,95.7,231.3,95.7,231.3 L294,54C295.4,39.8,290.7,25.2,279.9,14.4z"/> <path id="XMLID_25_" class="st2" d="M105.3,86.4c0-27.1,22-49.2,49.2-49.2c19.1,0,35.7,10.9,43.8,26.9c0,0,95.9,231.2,95.9,231.2 l-171-171C112.3,115.3,105.3,101.7,105.3,86.4z"/> <path id="XMLID_24_" class="st2" d="M14.4,281.4c-19.2-19.2-19.2-50.3,0-69.5c13.5-13.5,33-17.5,50-12c0,0,231.3,95.7,231.3,95.7 l-241.8,0C39.8,297,25.2,292.3,14.4,281.4z"/> <path id="XMLID_23_" class="st2" d="M308.2,14c19.2-19.2,50.3-19.2,69.5,0c13.5,13.5,17.5,33,12,50c0,0-95.7,231.3-95.7,231.3 l0-241.8C292.6,39.4,297.4,24.8,308.2,14z"/> <path id="XMLID_22_" class="st0" d="M503.2,106c27.1,0,49.2,22,49.2,49.2c0,19.1-10.9,35.7-26.9,43.8c0,0-231.2,95.9-231.2,95.9 l171-171C474.2,113,487.8,106,503.2,106z"/> </g> </g> </svg>',
|
30949 | OwlGauge.visualBgSvg = '<svg version="1.1" class="owlGaugeBg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="123.8 94.9 349.1 175.3" style="enable-background:new 123.8 94.9 349.1 175.3;" xml:space="preserve"> <style type="text/css"> .owlGaugeBg .st0{fill:#EF4137;} .owlGaugeBg .st1{fill:#FAAF42;} .owlGaugeBg .st2{fill:#F15B2A;} .owlGaugeBg .st3{fill:#F69321;} </style> <g id="XMLID_10_"> <path id="XMLID_8_" class="st0" d="M174.3,158c-16.1,0-29.2,13.1-29.2,29.2c0,11.4,6.5,21.2,16,26.1l137.3,57L196.9,168.7 C191.5,162.2,183.4,158,174.3,158z"/> <g id="XMLID_11_"> <path id="XMLID_7_" class="st1" d="M410.2,146.3c0-16.1-13.1-29.2-29.2-29.2c-11.4,0-21.2,6.5-26,16l-57,137.5L399.5,169 C406.1,163.5,410.2,155.4,410.2,146.3z"/> <path id="XMLID_6_" class="st0" d="M464.3,262.2c11.4-11.4,11.4-29.9,0-41.3c-8-8-19.6-10.4-29.7-7.1l-137.4,56.9h143.6 C449.2,271.4,457.9,268.6,464.3,262.2z"/> <path id="XMLID_5_" class="st2" d="M290,103.5c-11.4-11.4-29.9-11.4-41.3,0c-8,8-10.4,19.6-7.1,29.7l56.8,137.5V127 C299.2,118.6,296.4,109.9,290,103.5z"/> <path id="XMLID_4_" class="st3" d="M186.3,146.3c0-16.1,13.1-29.2,29.2-29.2c11.4,0,21.2,6.5,26,16l57,137.5L197,168.8 C190.5,163.5,186.3,155.4,186.3,146.3z"/> <path id="XMLID_3_" class="st2" d="M132.3,262.2c-11.4-11.4-11.4-29.9,0-41.3c8-8,19.6-10.4,29.7-7.1l137.4,56.9H155.8 C147.4,271.5,138.7,268.7,132.3,262.2z"/> <path id="XMLID_2_" class="st3" d="M306.8,103.2c11.4-11.4,29.9-11.4,41.3,0c8,8,10.4,19.6,7.1,29.7l-56.8,137.5V126.7 C297.5,118.3,300.3,109.7,306.8,103.2z"/> <path id="XMLID_1_" class="st2" d="M422.5,157.9c16.1,0,29.2,13.1,29.2,29.2c0,11.4-6.5,21.2-16,26.1l-137.3,57L400,168.6 C405.3,162.1,413.4,157.9,422.5,157.9z"/> </g> </g> </svg>',
|
30950 | OwlGauge.owlBodyHeightMultiplier = 291.2 / 267.7, OwlGauge.owlTailHeightMultiplier = 295.5 / 587.8,
|
30951 | OwlGauge.visualBgHeightMultiplier = 295.5 / 587.8, OwlGauge.OwlDemoMode = !1, OwlGauge.capabilities = {
|
30952 | dataRoles: [ {
|
30953 | displayName: "Category",
|
30954 | name: "Category",
|
30955 | kind: powerbi.VisualDataRoleKind.Grouping
|
30956 | }, {
|
30957 | displayName: "Y Axis",
|
30958 | name: "Y",
|
30959 | kind: powerbi.VisualDataRoleKind.Measure
|
30960 | } ],
|
30961 | dataViewMappings: [ {
|
30962 | categorical: {
|
30963 | categories: {
|
30964 | "for": {
|
30965 | "in": "Category"
|
30966 | },
|
30967 | dataReductionAlgorithm: {
|
30968 | top: {}
|
30969 | }
|
30970 | },
|
30971 | values: {
|
30972 | select: [ {
|
30973 | bind: {
|
30974 | to: "Y"
|
30975 | }
|
30976 | } ]
|
30977 | }
|
30978 | }
|
30979 | } ]
|
30980 | }, OwlGauge;
|
30981 | }();
|
30982 | visuals.OwlGauge = OwlGauge;
|
30983 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
30984 | }(powerbi || (powerbi = {}));
|
30985 | }, function(module, exports) {
|
30986 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
30987 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
30988 | !function(powerbi) {
|
30989 | var visuals;
|
30990 | !function(visuals) {
|
30991 | var NoMapLocationWarning = function() {
|
30992 | function NoMapLocationWarning() {}
|
30993 | return Object.defineProperty(NoMapLocationWarning.prototype, "code", {
|
30994 | get: function() {
|
30995 | return "NoMapLocation";
|
30996 | },
|
30997 | enumerable: !0,
|
30998 | configurable: !0
|
30999 | }), NoMapLocationWarning.prototype.getMessages = function(resourceProvider) {
|
31000 | var messageKey = "NoMapLocationMessage", titleKey = "NoMapLocationKey", detailKey = "NoMapLocationValue", visualMessage = {
|
31001 | message: resourceProvider.get(messageKey),
|
31002 | title: resourceProvider.get(titleKey),
|
31003 | detail: resourceProvider.get(detailKey)
|
31004 | };
|
31005 | return visualMessage;
|
31006 | }, NoMapLocationWarning;
|
31007 | }();
|
31008 | visuals.NoMapLocationWarning = NoMapLocationWarning;
|
31009 | var FilledMapWithoutValidGeotagCategoryWarning = function() {
|
31010 | function FilledMapWithoutValidGeotagCategoryWarning() {}
|
31011 | return Object.defineProperty(FilledMapWithoutValidGeotagCategoryWarning.prototype, "code", {
|
31012 | get: function() {
|
31013 | return "NoValidGeotaggedCategory";
|
31014 | },
|
31015 | enumerable: !0,
|
31016 | configurable: !0
|
31017 | }), FilledMapWithoutValidGeotagCategoryWarning.prototype.getMessages = function(resourceProvider) {
|
31018 | var messageKey = "NoValidGeotaggedCategoryMessage", titleKey = "NoValidGeotaggedCategoryKey", detailKey = "NoValidGeotaggedCategoryValue", visualMessage = {
|
31019 | message: resourceProvider.get(messageKey),
|
31020 | title: resourceProvider.get(titleKey),
|
31021 | detail: resourceProvider.get(detailKey)
|
31022 | };
|
31023 | return visualMessage;
|
31024 | }, FilledMapWithoutValidGeotagCategoryWarning;
|
31025 | }();
|
31026 | visuals.FilledMapWithoutValidGeotagCategoryWarning = FilledMapWithoutValidGeotagCategoryWarning;
|
31027 | var GeometryCulledWarning = function() {
|
31028 | function GeometryCulledWarning() {}
|
31029 | return Object.defineProperty(GeometryCulledWarning.prototype, "code", {
|
31030 | get: function() {
|
31031 | return "GeometryCulledWarning";
|
31032 | },
|
31033 | enumerable: !0,
|
31034 | configurable: !0
|
31035 | }), GeometryCulledWarning.prototype.getMessages = function(resourceProvider) {
|
31036 | var messageKey = "GeometryCulledWarningMessage", titleKey = "GeometryCulledWarningKey", detailKey = "GeometryCulledWarningVal", visualMessage = {
|
31037 | message: resourceProvider.get(messageKey),
|
31038 | title: resourceProvider.get(titleKey),
|
31039 | detail: resourceProvider.get(detailKey)
|
31040 | };
|
31041 | return visualMessage;
|
31042 | }, GeometryCulledWarning;
|
31043 | }();
|
31044 | visuals.GeometryCulledWarning = GeometryCulledWarning;
|
31045 | var NegativeValuesNotSupportedWarning = function() {
|
31046 | function NegativeValuesNotSupportedWarning() {}
|
31047 | return Object.defineProperty(NegativeValuesNotSupportedWarning.prototype, "code", {
|
31048 | get: function() {
|
31049 | return "NegativeValuesNotSupported";
|
31050 | },
|
31051 | enumerable: !0,
|
31052 | configurable: !0
|
31053 | }), NegativeValuesNotSupportedWarning.prototype.getMessages = function(resourceProvider) {
|
31054 | var messageKey = "VisualWarning_NegativeValues", visualMessage = {
|
31055 | message: resourceProvider.get(messageKey),
|
31056 | title: "",
|
31057 | detail: ""
|
31058 | };
|
31059 | return visualMessage;
|
31060 | }, NegativeValuesNotSupportedWarning;
|
31061 | }();
|
31062 | visuals.NegativeValuesNotSupportedWarning = NegativeValuesNotSupportedWarning;
|
31063 | var AllNegativeValuesWarning = function() {
|
31064 | function AllNegativeValuesWarning() {}
|
31065 | return Object.defineProperty(AllNegativeValuesWarning.prototype, "code", {
|
31066 | get: function() {
|
31067 | return "AllNegativeValuesNotSupported";
|
31068 | },
|
31069 | enumerable: !0,
|
31070 | configurable: !0
|
31071 | }), AllNegativeValuesWarning.prototype.getMessages = function(resourceProvider) {
|
31072 | var messageKey = "VisualWarning_AllNegativeValues", visualMessage = {
|
31073 | message: resourceProvider.get(messageKey),
|
31074 | title: "",
|
31075 | detail: ""
|
31076 | };
|
31077 | return visualMessage;
|
31078 | }, AllNegativeValuesWarning;
|
31079 | }();
|
31080 | visuals.AllNegativeValuesWarning = AllNegativeValuesWarning;
|
31081 | var NaNNotSupportedWarning = function() {
|
31082 | function NaNNotSupportedWarning() {}
|
31083 | return Object.defineProperty(NaNNotSupportedWarning.prototype, "code", {
|
31084 | get: function() {
|
31085 | return "NaNNotSupported";
|
31086 | },
|
31087 | enumerable: !0,
|
31088 | configurable: !0
|
31089 | }), NaNNotSupportedWarning.prototype.getMessages = function(resourceProvider) {
|
31090 | var messageKey = "VisualWarning_NanValues", visualMessage = {
|
31091 | message: resourceProvider.get(messageKey),
|
31092 | title: "",
|
31093 | detail: ""
|
31094 | };
|
31095 | return visualMessage;
|
31096 | }, NaNNotSupportedWarning;
|
31097 | }();
|
31098 | visuals.NaNNotSupportedWarning = NaNNotSupportedWarning;
|
31099 | var InfinityValuesNotSupportedWarning = function() {
|
31100 | function InfinityValuesNotSupportedWarning() {}
|
31101 | return Object.defineProperty(InfinityValuesNotSupportedWarning.prototype, "code", {
|
31102 | get: function() {
|
31103 | return "InfinityValuesNotSupported";
|
31104 | },
|
31105 | enumerable: !0,
|
31106 | configurable: !0
|
31107 | }), InfinityValuesNotSupportedWarning.prototype.getMessages = function(resourceProvider) {
|
31108 | var messageKey = "VisualWarning_InfinityValues", visualMessage = {
|
31109 | message: resourceProvider.get(messageKey),
|
31110 | title: "",
|
31111 | detail: ""
|
31112 | };
|
31113 | return visualMessage;
|
31114 | }, InfinityValuesNotSupportedWarning;
|
31115 | }();
|
31116 | visuals.InfinityValuesNotSupportedWarning = InfinityValuesNotSupportedWarning;
|
31117 | var ValuesOutOfRangeWarning = function() {
|
31118 | function ValuesOutOfRangeWarning() {}
|
31119 | return Object.defineProperty(ValuesOutOfRangeWarning.prototype, "code", {
|
31120 | get: function() {
|
31121 | return "ValuesOutOfRange";
|
31122 | },
|
31123 | enumerable: !0,
|
31124 | configurable: !0
|
31125 | }), ValuesOutOfRangeWarning.prototype.getMessages = function(resourceProvider) {
|
31126 | var messageKey = "VisualWarning_VisualizationOutOfRange", visualMessage = {
|
31127 | message: resourceProvider.get(messageKey),
|
31128 | title: "",
|
31129 | detail: ""
|
31130 | };
|
31131 | return visualMessage;
|
31132 | }, ValuesOutOfRangeWarning;
|
31133 | }();
|
31134 | visuals.ValuesOutOfRangeWarning = ValuesOutOfRangeWarning;
|
31135 | var ZeroValueWarning = function() {
|
31136 | function ZeroValueWarning() {}
|
31137 | return Object.defineProperty(ZeroValueWarning.prototype, "code", {
|
31138 | get: function() {
|
31139 | return "ZeroValuesNotSupported";
|
31140 | },
|
31141 | enumerable: !0,
|
31142 | configurable: !0
|
31143 | }), ZeroValueWarning.prototype.getMessages = function(resourceProvider) {
|
31144 | var messageKey = "VisualWarning_ZeroValues", visualMessage = {
|
31145 | message: resourceProvider.get(messageKey),
|
31146 | title: "",
|
31147 | detail: ""
|
31148 | };
|
31149 | return visualMessage;
|
31150 | }, ZeroValueWarning;
|
31151 | }();
|
31152 | visuals.ZeroValueWarning = ZeroValueWarning;
|
31153 | var VisualKPIDataMissingWarning = function() {
|
31154 | function VisualKPIDataMissingWarning() {}
|
31155 | return Object.defineProperty(VisualKPIDataMissingWarning.prototype, "code", {
|
31156 | get: function() {
|
31157 | return "VisualKPIDataMissing";
|
31158 | },
|
31159 | enumerable: !0,
|
31160 | configurable: !0
|
31161 | }), VisualKPIDataMissingWarning.prototype.getMessages = function(resourceProvider) {
|
31162 | var messageKey = "Visual_KPI_DataMissing", visualMessage = {
|
31163 | message: resourceProvider.get(messageKey),
|
31164 | title: "",
|
31165 | detail: ""
|
31166 | };
|
31167 | return visualMessage;
|
31168 | }, VisualKPIDataMissingWarning;
|
31169 | }();
|
31170 | visuals.VisualKPIDataMissingWarning = VisualKPIDataMissingWarning;
|
31171 | var ScriptVisualRefreshWarning = function() {
|
31172 | function ScriptVisualRefreshWarning() {}
|
31173 | return Object.defineProperty(ScriptVisualRefreshWarning.prototype, "code", {
|
31174 | get: function() {
|
31175 | return "ScriptVisualNotRefreshed";
|
31176 | },
|
31177 | enumerable: !0,
|
31178 | configurable: !0
|
31179 | }), ScriptVisualRefreshWarning.prototype.getMessages = function(resourceProvider) {
|
31180 | var messageKey = "ScriptVisualRefreshWarningMessage", detailKey = "ScriptVisualRefreshWarningValue", visualMessage = {
|
31181 | message: resourceProvider.get(messageKey),
|
31182 | title: resourceProvider.get(messageKey),
|
31183 | detail: resourceProvider.get(detailKey)
|
31184 | };
|
31185 | return visualMessage;
|
31186 | }, ScriptVisualRefreshWarning;
|
31187 | }();
|
31188 | visuals.ScriptVisualRefreshWarning = ScriptVisualRefreshWarning;
|
31189 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
31190 | }(powerbi || (powerbi = {}));
|
31191 | }, function(module, exports) {
|
31192 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
31193 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
31194 | !function(powerbi) {
|
31195 | var visuals;
|
31196 | !function(visuals) {
|
31197 | var PixelConverter = jsCommon.PixelConverter, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, WaterfallChart = function() {
|
31198 | function WaterfallChart(options) {
|
31199 | this.isScrollable = options.isScrollable, this.tooltipsEnabled = options.tooltipsEnabled,
|
31200 | this.tooltipBucketEnabled = options.tooltipBucketEnabled, this.interactivityService = options.interactivityService;
|
31201 | }
|
31202 | return WaterfallChart.prototype.init = function(options) {
|
31203 | this.svg = options.svg, this.svg.classed(WaterfallChart.WaterfallClassName, !0),
|
31204 | this.style = options.style, this.currentViewport = options.viewport, this.hostServices = options.host,
|
31205 | this.interactivity = options.interactivity, this.cartesianVisualHost = options.cartesianHost,
|
31206 | this.options = options, this.element = options.element, this.colors = this.style.colorPalette.dataColors,
|
31207 | this.mainGraphicsSVG = this.svg.append("svg"), this.mainGraphicsContext = this.mainGraphicsSVG.append("g").classed(WaterfallChart.MainGraphicsContextClassName, !0),
|
31208 | this.labelGraphicsContext = this.mainGraphicsSVG.append("g").classed(visuals.NewDataLabelUtils.labelGraphicsContextClass["class"], !0);
|
31209 | }, WaterfallChart.converter = function(dataView, palette, hostServices, dataLabelSettings, sentimentColors, interactivityService, tooltipsEnabled, tooltipBucketEnabled) {
|
31210 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
31211 | var categoryMetadata, totalTooltips, tooltipsCount, tooltipMetadataColumns, reader = powerbi.data.createIDataViewCategoricalReader(dataView), formatStringProp = WaterfallChart.formatStringProp, categories = dataView.categorical.categories || [], increaseColor = sentimentColors.increaseFill.solid.color, decreaseColor = sentimentColors.decreaseFill.solid.color, totalColor = sentimentColors.totalFill.solid.color, totalLabel = hostServices.getLocalizedString(WaterfallChart.TotalLabel), increaseLabel = hostServices.getLocalizedString(WaterfallChart.IncreaseLabel), decreaseLabel = hostServices.getLocalizedString(WaterfallChart.DecreaseLabel), legend = [ {
|
31212 | label: increaseLabel,
|
31213 | color: increaseColor,
|
31214 | icon: visuals.LegendIcon.Box,
|
31215 | identity: visuals.SelectionIdBuilder.builder().withMeasure("increase").createSelectionId(),
|
31216 | selected: !1
|
31217 | }, {
|
31218 | label: decreaseLabel,
|
31219 | color: decreaseColor,
|
31220 | icon: visuals.LegendIcon.Box,
|
31221 | identity: visuals.SelectionIdBuilder.builder().withMeasure("decrease").createSelectionId(),
|
31222 | selected: !1
|
31223 | }, {
|
31224 | label: totalLabel,
|
31225 | color: totalColor,
|
31226 | icon: visuals.LegendIcon.Box,
|
31227 | identity: visuals.SelectionIdBuilder.builder().withMeasure("total").createSelectionId(),
|
31228 | selected: !1
|
31229 | } ], pos = 0, posMin = 0, posMax = 0, dataPoints = [], categoryValues = [], valuesMetadata = void 0;
|
31230 | if (reader.hasValues("Tooltips") && (tooltipMetadataColumns = reader.getAllValueMetadataColumnsForRole("Tooltips", void 0)),
|
31231 | reader.hasValues("Y")) {
|
31232 | valuesMetadata = reader.getValueMetadataColumn("Y");
|
31233 | var labelFormatString = valuesMetadata.format;
|
31234 | if (_.isEmpty(categories)) pos = posMax = reader.getValue("Y", 0), posMin = 0; else {
|
31235 | var categoryColumn = categories[0];
|
31236 | categoryMetadata = categoryColumn.source, categoryValues = categoryColumn.values.slice(),
|
31237 | categoryValues.push(totalLabel), reader.hasValues("Tooltips") && (tooltipsCount = reader.getSeriesCount("Tooltips"),
|
31238 | totalTooltips = _.map(new Array(tooltipsCount), function() {
|
31239 | return 0;
|
31240 | }));
|
31241 | for (var categoryIndex = 0, catLen = reader.getCategoryCount(); catLen > categoryIndex; categoryIndex++) {
|
31242 | var category = categoryValues[categoryIndex], value = reader.getValue("Y", categoryIndex) || 0, identity = visuals.SelectionIdBuilder.builder().withCategory(categoryColumn, categoryIndex).withMeasure(valuesMetadata.queryName).createSelectionId(), tooltipInfo_1 = void 0;
|
31243 | if (tooltipsEnabled && (tooltipInfo_1 = [], tooltipInfo_1.push({
|
31244 | displayName: categoryMetadata.displayName,
|
31245 | value: visuals.converterHelper.formatFromMetadataColumn(category, categoryMetadata, formatStringProp)
|
31246 | }), null != value && tooltipInfo_1.push({
|
31247 | displayName: valuesMetadata.displayName,
|
31248 | value: visuals.converterHelper.formatFromMetadataColumn(value, valuesMetadata, formatStringProp)
|
31249 | }), tooltipBucketEnabled)) {
|
31250 | var tooltipValues = reader.getAllValuesForRole("Tooltips", categoryIndex);
|
31251 | if (tooltipValues && tooltipMetadataColumns) {
|
31252 | for (var i = 0; i < tooltipValues.length; i++) totalTooltips[i] += tooltipValues[i];
|
31253 | for (var j = 0; j < tooltipValues.length; j++) null != tooltipValues[j] && tooltipMetadataColumns[j] && tooltipInfo_1.push({
|
31254 | displayName: tooltipMetadataColumns[j].displayName,
|
31255 | value: visuals.converterHelper.formatFromMetadataColumn(tooltipValues[j], tooltipMetadataColumns[j], formatStringProp)
|
31256 | });
|
31257 | }
|
31258 | }
|
31259 | var color = value > 0 ? increaseColor : decreaseColor;
|
31260 | dataPoints.push({
|
31261 | value: value,
|
31262 | position: pos,
|
31263 | color: color,
|
31264 | categoryValue: category,
|
31265 | categoryIndex: categoryIndex,
|
31266 | seriesIndex: 0,
|
31267 | selected: !1,
|
31268 | identity: identity,
|
31269 | highlight: !1,
|
31270 | key: identity.getKey(),
|
31271 | tooltipInfo: tooltipInfo_1,
|
31272 | labelFill: dataLabelSettings.labelColor,
|
31273 | labelFormatString: labelFormatString
|
31274 | }), pos += value, pos > posMax && (posMax = pos), posMin > pos && (posMin = pos);
|
31275 | }
|
31276 | }
|
31277 | var tooltipInfo = void 0;
|
31278 | if (tooltipsEnabled && (tooltipInfo = [], categoryMetadata && tooltipInfo.push({
|
31279 | displayName: categoryMetadata.displayName,
|
31280 | value: totalLabel
|
31281 | }), null != pos && tooltipInfo.push({
|
31282 | displayName: valuesMetadata.displayName,
|
31283 | value: visuals.converterHelper.formatFromMetadataColumn(pos, valuesMetadata, formatStringProp)
|
31284 | }), tooltipBucketEnabled)) {
|
31285 | var tooltipValues = reader.getAllValuesForRole("Tooltips", 0, void 0);
|
31286 | if (totalTooltips = totalTooltips ? totalTooltips : tooltipValues, tooltipValues && tooltipMetadataColumns) for (var j = 0; j < totalTooltips.length; j++) null != totalTooltips[j] && tooltipInfo.push({
|
31287 | displayName: tooltipMetadataColumns[j].displayName,
|
31288 | value: visuals.converterHelper.formatFromMetadataColumn(totalTooltips[j], tooltipMetadataColumns[j], formatStringProp)
|
31289 | });
|
31290 | }
|
31291 | var totalIdentity = visuals.SelectionId.createNull();
|
31292 | dataPoints.push({
|
31293 | value: pos,
|
31294 | position: 0,
|
31295 | color: totalColor,
|
31296 | categoryValue: totalLabel,
|
31297 | categoryIndex: categoryIndex,
|
31298 | identity: totalIdentity,
|
31299 | seriesIndex: 0,
|
31300 | selected: !1,
|
31301 | highlight: !1,
|
31302 | key: totalIdentity.getKey(),
|
31303 | tooltipInfo: tooltipInfo,
|
31304 | labelFill: dataLabelSettings.labelColor,
|
31305 | labelFormatString: labelFormatString,
|
31306 | isTotal: !0
|
31307 | });
|
31308 | }
|
31309 | interactivityService && interactivityService.applySelectionStateToData(dataPoints);
|
31310 | var xAxisProperties = visuals.CartesianHelper.getCategoryAxisProperties(dataView.metadata), yAxisProperties = visuals.CartesianHelper.getValueAxisProperties(dataView.metadata), axesLabels = visuals.converterHelper.createAxesLabels(xAxisProperties, yAxisProperties, categoryMetadata, [ valuesMetadata ]);
|
31311 | return {
|
31312 | series: [ {
|
31313 | data: dataPoints
|
31314 | } ],
|
31315 | categories: categoryValues,
|
31316 | categoryMetadata: categoryMetadata,
|
31317 | valuesMetadata: valuesMetadata,
|
31318 | legend: {
|
31319 | dataPoints: legend
|
31320 | },
|
31321 | hasHighlights: !1,
|
31322 | positionMin: posMin,
|
31323 | positionMax: posMax,
|
31324 | dataLabelsSettings: dataLabelSettings,
|
31325 | sentimentColors: sentimentColors,
|
31326 | axesLabels: {
|
31327 | x: axesLabels.xAxisLabel,
|
31328 | y: axesLabels.yAxisLabel
|
31329 | }
|
31330 | };
|
31331 | }, WaterfallChart.prototype.setData = function(dataViews) {
|
31332 | var sentimentColors = this.getSentimentColorsFromObjects(null), dataView = dataViews.length > 0 ? dataViews[0] : void 0;
|
31333 | if (this.data = {
|
31334 | series: [ {
|
31335 | data: []
|
31336 | } ],
|
31337 | categories: [],
|
31338 | valuesMetadata: null,
|
31339 | legend: {
|
31340 | dataPoints: []
|
31341 | },
|
31342 | hasHighlights: !1,
|
31343 | categoryMetadata: null,
|
31344 | scalarCategoryAxis: !1,
|
31345 | positionMax: 0,
|
31346 | positionMin: 0,
|
31347 | dataLabelsSettings: visuals.dataLabelUtils.getDefaultLabelSettings(!1, void 0),
|
31348 | sentimentColors: sentimentColors,
|
31349 | axesLabels: {
|
31350 | x: null,
|
31351 | y: null
|
31352 | }
|
31353 | }, dataView) {
|
31354 | if (dataView.metadata && dataView.metadata.objects) {
|
31355 | var objects = dataView.metadata.objects, labelsObj = objects.labels;
|
31356 | labelsObj && visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(labelsObj, this.data.dataLabelsSettings),
|
31357 | sentimentColors = this.getSentimentColorsFromObjects(objects);
|
31358 | }
|
31359 | dataView.categorical && (this.data = WaterfallChart.converter(dataView, this.colors, this.hostServices, this.data.dataLabelsSettings, sentimentColors, this.interactivityService, this.tooltipsEnabled, this.tooltipBucketEnabled));
|
31360 | }
|
31361 | }, WaterfallChart.prototype.enumerateObjectInstances = function(enumeration, options) {
|
31362 | switch (options.objectName) {
|
31363 | case "sentimentColors":
|
31364 | this.enumerateSentimentColors(enumeration);
|
31365 | break;
|
31366 |
|
31367 | case "labels":
|
31368 | var labelSettingOptions = {
|
31369 | enumeration: enumeration,
|
31370 | dataLabelsSettings: this.data.dataLabelsSettings,
|
31371 | show: !0,
|
31372 | displayUnits: !0,
|
31373 | precision: !0,
|
31374 | fontSize: !0
|
31375 | };
|
31376 | visuals.dataLabelUtils.enumerateDataLabels(labelSettingOptions);
|
31377 | }
|
31378 | }, WaterfallChart.prototype.enumerateSentimentColors = function(enumeration) {
|
31379 | var sentimentColors = this.data.sentimentColors;
|
31380 | enumeration.pushInstance({
|
31381 | selector: null,
|
31382 | properties: {
|
31383 | increaseFill: sentimentColors.increaseFill,
|
31384 | decreaseFill: sentimentColors.decreaseFill,
|
31385 | totalFill: sentimentColors.totalFill
|
31386 | },
|
31387 | objectName: "sentimentColors"
|
31388 | });
|
31389 | }, WaterfallChart.prototype.calculateLegend = function() {
|
31390 | return this.data.legend;
|
31391 | }, WaterfallChart.prototype.hasLegend = function() {
|
31392 | return !0;
|
31393 | }, WaterfallChart.createClippedDataIfOverflowed = function(data, renderableDataCount) {
|
31394 | var clipped = data, dataPoints = data.series[0].data;
|
31395 | return data && renderableDataCount < dataPoints.length && (clipped = powerbi.Prototype.inherit(data),
|
31396 | clipped.series = [ {
|
31397 | data: dataPoints.slice(0, renderableDataCount)
|
31398 | } ], clipped.categories = data.categories.slice(0, renderableDataCount)), clipped;
|
31399 | }, WaterfallChart.prototype.calculateAxesProperties = function(options) {
|
31400 | var _this = this;
|
31401 | this.currentViewport = options.viewport, this.margin = options.margin;
|
31402 | var data = this.clippedData = this.data, categoryCount = data.categories.length, preferredPlotArea = this.getPreferredPlotArea(!1, categoryCount, visuals.CartesianChart.MinOrdinalRectThickness), cartesianLayout = visuals.CartesianChart.getLayout(null, {
|
31403 | availableWidth: preferredPlotArea.width,
|
31404 | categoryCount: categoryCount,
|
31405 | domain: null,
|
31406 | isScalar: !1,
|
31407 | isScrollable: this.isScrollable,
|
31408 | trimOrdinalDataOnOverflow: options.trimOrdinalDataOnOverflow
|
31409 | });
|
31410 | this.isScrollable || (data = this.clippedData = WaterfallChart.createClippedDataIfOverflowed(data, cartesianLayout.categoryCount));
|
31411 | var xAxisCreationOptions = WaterfallChart.getXAxisCreationOptions(data, preferredPlotArea.width, cartesianLayout, options), yAxisCreationOptions = WaterfallChart.getYAxisCreationOptions(data, preferredPlotArea.height, options), xAxisProperties = this.xAxisProperties = visuals.AxisHelper.createAxis(xAxisCreationOptions), yAxisProperties = this.yAxisProperties = visuals.AxisHelper.createAxis(yAxisCreationOptions), categoryWidth = this.xAxisProperties.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio), formattersCache = visuals.dataLabelUtils.createColumnFormatterCacheManager(), labelSettings = data.dataLabelsSettings, value2 = WaterfallChart.getDisplayUnitValueFromAxisFormatter(yAxisProperties, labelSettings);
|
31412 | return this.layout = {
|
31413 | categoryCount: cartesianLayout.categoryCount,
|
31414 | categoryThickness: cartesianLayout.categoryThickness,
|
31415 | isScalar: cartesianLayout.isScalar,
|
31416 | outerPaddingRatio: cartesianLayout.outerPaddingRatio,
|
31417 | categoryWidth: categoryWidth,
|
31418 | labelText: function(d) {
|
31419 | var formatter = formattersCache.getOrCreate(d.labelFormatString, labelSettings, value2);
|
31420 | return visuals.dataLabelUtils.getLabelFormattedText({
|
31421 | label: formatter.format(d.value)
|
31422 | });
|
31423 | },
|
31424 | labelLayout: visuals.dataLabelUtils.getLabelLayoutXYForWaterfall(xAxisProperties, categoryWidth, yAxisProperties, yAxisCreationOptions.dataDomain),
|
31425 | filter: function(d) {
|
31426 | return visuals.dataLabelUtils.doesDataLabelFitInShape(d, yAxisProperties, _this.layout);
|
31427 | },
|
31428 | style: {
|
31429 | fill: function(d) {
|
31430 | return d.isLabelInside ? visuals.dataLabelUtils.defaultInsideLabelColor : d.labelFill;
|
31431 | }
|
31432 | }
|
31433 | }, this.xAxisProperties.axisLabel = options.showCategoryAxisLabel ? data.axesLabels.x : null,
|
31434 | this.yAxisProperties.axisLabel = options.showValueAxisLabel ? data.axesLabels.y : null,
|
31435 | [ xAxisProperties, yAxisProperties ];
|
31436 | }, WaterfallChart.getDisplayUnitValueFromAxisFormatter = function(yAxisProperties, labelSettings) {
|
31437 | return yAxisProperties.formatter && yAxisProperties.formatter.displayUnit && 0 === labelSettings.displayUnits ? yAxisProperties.formatter.displayUnit.value : null;
|
31438 | }, WaterfallChart.lookupXValue = function(data, index, type) {
|
31439 | var dataPoints = data.series[0].data;
|
31440 | return index === dataPoints.length - 1 ? dataPoints[index].categoryValue : visuals.CartesianHelper.lookupXValue(data, index, type, !1);
|
31441 | }, WaterfallChart.getXAxisCreationOptions = function(data, width, layout, options) {
|
31442 | var categoryDataType = visuals.AxisHelper.getCategoryValueType(data.categoryMetadata), domain = visuals.AxisHelper.createDomain(data.series, categoryDataType, !1, options.forcedXDomain, options.ensureXDomain), categoryThickness = layout.categoryThickness, outerPadding = categoryThickness * layout.outerPaddingRatio;
|
31443 | return {
|
31444 | pixelSpan: width,
|
31445 | dataDomain: domain,
|
31446 | metaDataColumn: data.categoryMetadata,
|
31447 | formatString: visuals.valueFormatter.getFormatString(data.categoryMetadata, WaterfallChart.formatStringProp),
|
31448 | isScalar: !1,
|
31449 | outerPadding: outerPadding,
|
31450 | categoryThickness: categoryThickness,
|
31451 | getValueFn: function(index, type) {
|
31452 | return WaterfallChart.lookupXValue(data, index, type);
|
31453 | },
|
31454 | forcedTickCount: options.forcedTickCount,
|
31455 | isCategoryAxis: !0,
|
31456 | axisDisplayUnits: options.categoryAxisDisplayUnits,
|
31457 | axisPrecision: options.categoryAxisPrecision
|
31458 | };
|
31459 | }, WaterfallChart.getYAxisCreationOptions = function(data, height, options) {
|
31460 | var combinedDomain = visuals.AxisHelper.combineDomain(options.forcedYDomain, [ data.positionMin, data.positionMax ], options.ensureYDomain);
|
31461 | return {
|
31462 | pixelSpan: height,
|
31463 | dataDomain: combinedDomain,
|
31464 | isScalar: !0,
|
31465 | isVertical: !0,
|
31466 | metaDataColumn: data.valuesMetadata,
|
31467 | formatString: visuals.valueFormatter.getFormatString(data.valuesMetadata, WaterfallChart.formatStringProp),
|
31468 | outerPadding: 0,
|
31469 | forcedTickCount: options.forcedTickCount,
|
31470 | useTickIntervalForDisplayUnits: !0,
|
31471 | isCategoryAxis: !1,
|
31472 | axisDisplayUnits: options.valueAxisDisplayUnits,
|
31473 | axisPrecision: options.valueAxisPrecision
|
31474 | };
|
31475 | }, WaterfallChart.prototype.getPreferredPlotArea = function(isScalar, categoryCount, categoryThickness) {
|
31476 | return visuals.CartesianChart.getPreferredPlotArea(categoryCount, categoryThickness, this.currentViewport, this.isScrollable, isScalar, this.margin);
|
31477 | }, WaterfallChart.prototype.getVisualCategoryAxisIsScalar = function() {
|
31478 | return !1;
|
31479 | }, WaterfallChart.prototype.overrideXScale = function(xProperties) {
|
31480 | this.xAxisProperties = xProperties;
|
31481 | }, WaterfallChart.prototype.setFilteredData = function(startIndex, endIndex) {
|
31482 | var data = this.clippedData = powerbi.Prototype.inherit(this.data);
|
31483 | return data.series = [ {
|
31484 | data: data.series[0].data.slice(startIndex, endIndex)
|
31485 | } ], data.categories = data.categories.slice(startIndex, endIndex), data;
|
31486 | }, WaterfallChart.prototype.createRects = function(data) {
|
31487 | var mainGraphicsContext = this.mainGraphicsContext, colsSelection = mainGraphicsContext.selectAll(WaterfallChart.CategoryValueClasses.selector), cols = colsSelection.data(data, function(d) {
|
31488 | return d.key;
|
31489 | });
|
31490 | return cols.enter().append("rect").attr("class", function(d) {
|
31491 | return WaterfallChart.CategoryValueClasses["class"].concat(d.highlight ? "highlight" : "");
|
31492 | }), cols.exit().remove(), cols;
|
31493 | }, WaterfallChart.prototype.createConnectors = function(data) {
|
31494 | var mainGraphicsContext = this.mainGraphicsContext, connectorSelection = mainGraphicsContext.selectAll(WaterfallChart.WaterfallConnectorClasses.selector), connectors = connectorSelection.data(data.slice(0, data.length - 1), function(d) {
|
31495 | return d.key;
|
31496 | });
|
31497 | return connectors.enter().append("line").classed(WaterfallChart.WaterfallConnectorClasses["class"], !0),
|
31498 | connectors.exit().remove(), connectors;
|
31499 | }, WaterfallChart.prototype.render = function(suppressAnimations) {
|
31500 | var _this = this, dataPoints = this.clippedData.series[0].data, bars = this.createRects(dataPoints), connectors = this.createConnectors(dataPoints);
|
31501 | this.tooltipsEnabled && visuals.TooltipManager.addTooltip(bars, function(tooltipEvent) {
|
31502 | return tooltipEvent.data.tooltipInfo;
|
31503 | });
|
31504 | var hasSelection = this.interactivityService && this.interactivityService.hasSelection(), xScale = this.xAxisProperties.scale, yScale = this.yAxisProperties.scale, y0 = yScale(0);
|
31505 | this.mainGraphicsSVG.attr("height", this.getAvailableHeight()).attr("width", this.getAvailableWidth()),
|
31506 | bars.style("fill", function(d) {
|
31507 | return d.color;
|
31508 | }).style("fill-opacity", function(d) {
|
31509 | return d.isTotal ? visuals.ColumnUtil.DefaultOpacity : visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, _this.data.hasHighlights);
|
31510 | }).attr("width", this.layout.categoryWidth).attr("x", function(d) {
|
31511 | return xScale(d.categoryIndex);
|
31512 | }).attr("y", function(d) {
|
31513 | return WaterfallChart.getRectTop(yScale, d.position, d.value);
|
31514 | }).attr("height", function(d) {
|
31515 | return y0 - yScale(Math.abs(d.value));
|
31516 | }), connectors.attr({
|
31517 | x1: function(d) {
|
31518 | return xScale(d.categoryIndex);
|
31519 | },
|
31520 | y1: function(d) {
|
31521 | return yScale(d.position + d.value);
|
31522 | },
|
31523 | x2: function(d) {
|
31524 | return xScale(d.categoryIndex + 1) + _this.layout.categoryWidth;
|
31525 | },
|
31526 | y2: function(d) {
|
31527 | return yScale(d.position + d.value);
|
31528 | }
|
31529 | });
|
31530 | var labelSettings = this.data.dataLabelsSettings, labelDataPoints = [];
|
31531 | (labelSettings && labelSettings.show || labelSettings.showCategory) && (labelDataPoints = this.createLabelDataPoints());
|
31532 | var behaviorOptions = void 0;
|
31533 | return this.interactivityService && (behaviorOptions = {
|
31534 | bars: bars
|
31535 | }), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options), {
|
31536 | dataPoints: dataPoints,
|
31537 | behaviorOptions: behaviorOptions,
|
31538 | labelDataPoints: labelDataPoints,
|
31539 | labelsAreNumeric: !0
|
31540 | };
|
31541 | }, WaterfallChart.prototype.onClearSelection = function() {
|
31542 | this.interactivityService && this.interactivityService.clearSelection();
|
31543 | }, WaterfallChart.prototype.getSupportedCategoryAxisType = function() {
|
31544 | return visuals.axisType.categorical;
|
31545 | }, WaterfallChart.getRectTop = function(scale, pos, value) {
|
31546 | return 0 > value ? scale(pos) : scale(pos) - (scale(0) - scale(value));
|
31547 | }, WaterfallChart.prototype.getAvailableWidth = function() {
|
31548 | return this.currentViewport.width - (this.margin.left + this.margin.right);
|
31549 | }, WaterfallChart.prototype.getAvailableHeight = function() {
|
31550 | return this.currentViewport.height - (this.margin.top + this.margin.bottom);
|
31551 | }, WaterfallChart.prototype.getSentimentColorsFromObjects = function(objects) {
|
31552 | var defaultSentimentColors = this.colors.getSentimentColors(), increaseColor = powerbi.DataViewObjects.getFillColor(objects, visuals.waterfallChartProps.sentimentColors.increaseFill, defaultSentimentColors[2].value), decreaseColor = powerbi.DataViewObjects.getFillColor(objects, visuals.waterfallChartProps.sentimentColors.decreaseFill, defaultSentimentColors[0].value), totalColor = powerbi.DataViewObjects.getFillColor(objects, visuals.waterfallChartProps.sentimentColors.totalFill, WaterfallChart.defaultTotalColor);
|
31553 | return {
|
31554 | increaseFill: {
|
31555 | solid: {
|
31556 | color: increaseColor
|
31557 | }
|
31558 | },
|
31559 | decreaseFill: {
|
31560 | solid: {
|
31561 | color: decreaseColor
|
31562 | }
|
31563 | },
|
31564 | totalFill: {
|
31565 | solid: {
|
31566 | color: totalColor
|
31567 | }
|
31568 | }
|
31569 | };
|
31570 | }, WaterfallChart.prototype.createLabelDataPoints = function() {
|
31571 | for (var labelDataPoints = [], data = this.data, xScale = this.xAxisProperties.scale, yScale = this.yAxisProperties.scale, y0 = yScale(0), series = data.series, formattersCache = visuals.NewDataLabelUtils.createColumnFormatterCacheManager(), axisFormatter = visuals.NewDataLabelUtils.getDisplayUnitValueFromAxisFormatter(this.yAxisProperties.formatter, data.dataLabelsSettings), labelSettings = this.data.dataLabelsSettings, _i = 0, series_1 = series; _i < series_1.length; _i++) for (var currentSeries = series_1[_i], _a = 0, _b = currentSeries.data; _a < _b.length; _a++) {
|
31572 | var dataPoint = _b[_a], parentRect = {
|
31573 | left: xScale(dataPoint.categoryIndex),
|
31574 | top: WaterfallChart.getRectTop(yScale, dataPoint.position, dataPoint.value),
|
31575 | width: this.layout.categoryWidth,
|
31576 | height: y0 - yScale(Math.abs(dataPoint.value))
|
31577 | }, formatString = dataPoint.labelFormatString, formatter = formattersCache.getOrCreate(formatString, this.data.dataLabelsSettings, axisFormatter), text = visuals.NewDataLabelUtils.getLabelFormattedText(formatter.format(dataPoint.value)), properties = {
|
31578 | text: text,
|
31579 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
31580 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt),
|
31581 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
31582 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties, !0);
|
31583 | labelDataPoints.push({
|
31584 | isPreferred: !0,
|
31585 | text: text,
|
31586 | textSize: {
|
31587 | width: textWidth,
|
31588 | height: textHeight
|
31589 | },
|
31590 | outsideFill: labelSettings.labelColor ? labelSettings.labelColor : visuals.NewDataLabelUtils.defaultLabelColor,
|
31591 | insideFill: visuals.NewDataLabelUtils.defaultInsideLabelColor,
|
31592 | parentType: 1,
|
31593 | parentShape: {
|
31594 | rect: parentRect,
|
31595 | orientation: dataPoint.value >= 0 ? 1 : 2,
|
31596 | validPositions: 0 === dataPoint.value ? WaterfallChart.validZeroLabelPosition : WaterfallChart.validLabelPositions
|
31597 | },
|
31598 | fontSize: labelSettings.fontSize,
|
31599 | identity: void 0
|
31600 | });
|
31601 | }
|
31602 | return labelDataPoints;
|
31603 | }, WaterfallChart.formatStringProp = {
|
31604 | objectName: "general",
|
31605 | propertyName: "formatString"
|
31606 | }, WaterfallChart.WaterfallClassName = "waterfallChart", WaterfallChart.MainGraphicsContextClassName = "mainGraphicsContext",
|
31607 | WaterfallChart.IncreaseLabel = "Waterfall_IncreaseLabel", WaterfallChart.DecreaseLabel = "Waterfall_DecreaseLabel",
|
31608 | WaterfallChart.TotalLabel = "Waterfall_TotalLabel", WaterfallChart.CategoryValueClasses = createClassAndSelector("column"),
|
31609 | WaterfallChart.WaterfallConnectorClasses = createClassAndSelector("waterfall-connector"),
|
31610 | WaterfallChart.defaultTotalColor = "#00b8aa", WaterfallChart.validLabelPositions = [ 16, 4 ],
|
31611 | WaterfallChart.validZeroLabelPosition = [ 16, 8 ], WaterfallChart;
|
31612 | }();
|
31613 | visuals.WaterfallChart = WaterfallChart;
|
31614 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
31615 | }(powerbi || (powerbi = {}));
|
31616 | }, function(module, exports) {
|
31617 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
31618 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
31619 | !function(powerbi) {
|
31620 | var visuals;
|
31621 | !function(visuals) {
|
31622 | var TouchUtils = powerbi.visuals.controls.TouchUtils, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, ContainerClassName = createClassAndSelector("tooltip-container"), ContentContainerClassName = createClassAndSelector("tooltip-content-container"), ArrowClassName = createClassAndSelector("arrow"), TooltipHeaderClassName = createClassAndSelector("tooltip-header"), TooltipRowClassName = createClassAndSelector("tooltip-row"), TooltipColorCellClassName = createClassAndSelector("tooltip-color-cell"), TooltipTitleCellClassName = createClassAndSelector("tooltip-title-cell"), TooltipValueCellClassName = createClassAndSelector("tooltip-value-cell"), ToolTipComponent = function() {
|
31623 | function ToolTipComponent(tooltipOptions) {
|
31624 | this.tooltipOptions = tooltipOptions, this.isTooltipVisible = !1, tooltipOptions || (this.tooltipOptions = ToolTipComponent.DefaultTooltipOptions);
|
31625 | }
|
31626 | return ToolTipComponent.prototype.isTooltipComponentVisible = function() {
|
31627 | return this.isTooltipVisible;
|
31628 | }, ToolTipComponent.prototype.setTestScreenSize = function(width, height) {
|
31629 | this.customScreenWidth = width, this.customScreenHeight = height;
|
31630 | }, ToolTipComponent.prototype.show = function(tooltipData, clickedArea) {
|
31631 | this.isTooltipVisible = !0, this.tooltipContainer || (this.tooltipContainer = this.createTooltipContainer()),
|
31632 | this.setTooltipContent(tooltipData), this.tooltipContainer.style("visibility", "visible").transition().duration(0).style("opacity", this.tooltipOptions.opacity),
|
31633 | this.setPosition(clickedArea);
|
31634 | }, ToolTipComponent.prototype.move = function(tooltipData, clickedArea) {
|
31635 | this.isTooltipVisible && (tooltipData && this.setTooltipContent(tooltipData), this.setPosition(clickedArea));
|
31636 | }, ToolTipComponent.prototype.hide = function() {
|
31637 | this.isTooltipVisible && (this.isTooltipVisible = !1, this.tooltipContainer.transition().duration(this.tooltipOptions.animationDuration).style("opacity", 0).each("end", function() {
|
31638 | this.style.visibility = "hidden";
|
31639 | }));
|
31640 | }, ToolTipComponent.prototype.createTooltipContainer = function() {
|
31641 | var container = d3.select(ToolTipComponent.parentContainerSelector).append("div").attr("class", ContainerClassName["class"]);
|
31642 | return container.append("div").attr("class", ArrowClassName["class"]), container.append("div").attr("class", ContentContainerClassName["class"]),
|
31643 | container;
|
31644 | }, ToolTipComponent.prototype.setTooltipContent = function(tooltipData) {
|
31645 | if (!_.isEqual(tooltipData, this.currentTooltipData)) {
|
31646 | this.currentTooltipData = tooltipData;
|
31647 | var rowsSelector = TooltipRowClassName.selector, contentContainer = this.tooltipContainer.select(ContentContainerClassName.selector);
|
31648 | if (contentContainer.selectAll(TooltipHeaderClassName.selector).remove(), contentContainer.selectAll(TooltipRowClassName.selector).remove(),
|
31649 | 0 !== tooltipData.length) {
|
31650 | tooltipData[0].header && contentContainer.append("div").attr("class", TooltipHeaderClassName["class"]).text(tooltipData[0].header);
|
31651 | var tooltipRow = contentContainer.selectAll(rowsSelector).data(tooltipData), newRow = tooltipRow.enter().append("div").attr("class", TooltipRowClassName["class"]);
|
31652 | if (_.any(tooltipData, function(tooltipItem) {
|
31653 | return tooltipItem.color;
|
31654 | })) {
|
31655 | var newColorCell = newRow.filter(function(d) {
|
31656 | return d.color;
|
31657 | }).append("div").attr("class", TooltipColorCellClassName["class"]);
|
31658 | newColorCell.append("svg").attr({
|
31659 | width: "100%",
|
31660 | height: "15px"
|
31661 | }).append("circle").attr({
|
31662 | cx: "5",
|
31663 | cy: "8",
|
31664 | r: "5"
|
31665 | }).style({
|
31666 | fill: function(d) {
|
31667 | return d.color;
|
31668 | },
|
31669 | "fill-opacity": function(d) {
|
31670 | return null != d.opacity ? d.opacity : 1;
|
31671 | }
|
31672 | });
|
31673 | }
|
31674 | var newTitleCell = newRow.append("div").attr("class", TooltipTitleCellClassName["class"]), newValueCell = newRow.append("div").attr("class", TooltipValueCellClassName["class"]);
|
31675 | newTitleCell.text(function(d) {
|
31676 | return d.displayName;
|
31677 | }), newValueCell.text(function(d) {
|
31678 | return d.value;
|
31679 | });
|
31680 | }
|
31681 | }
|
31682 | }, ToolTipComponent.prototype.getTooltipPosition = function(clickedArea, clickedScreenArea) {
|
31683 | var tooltipContainerBounds = this.tooltipContainer.node().getBoundingClientRect(), centerPointOffset = Math.floor(clickedArea.width / 2), offsetX = 0, offsetY = 0, centerPoint = new TouchUtils.Point(clickedArea.x + centerPointOffset, clickedArea.y + centerPointOffset), arrowOffset = 7;
|
31684 | return 0 === clickedScreenArea ? (offsetX += 3 * arrowOffset + centerPointOffset,
|
31685 | offsetY -= 2 * arrowOffset + centerPointOffset) : 1 === clickedScreenArea ? (offsetX -= 2 * arrowOffset + tooltipContainerBounds.width + centerPointOffset,
|
31686 | offsetY -= 2 * arrowOffset + centerPointOffset) : 3 === clickedScreenArea ? (offsetX += 3 * arrowOffset + centerPointOffset,
|
31687 | offsetY -= tooltipContainerBounds.height - 2 * arrowOffset + centerPointOffset) : 2 === clickedScreenArea && (offsetX -= 2 * arrowOffset + tooltipContainerBounds.width + centerPointOffset,
|
31688 | offsetY -= tooltipContainerBounds.height - 2 * arrowOffset + centerPointOffset),
|
31689 | centerPoint.offset(offsetX, offsetY), centerPoint;
|
31690 | }, ToolTipComponent.prototype.setPosition = function(clickedArea) {
|
31691 | var clickedScreenArea = this.getClickedScreenArea(clickedArea), tooltipPosition = this.getTooltipPosition(clickedArea, clickedScreenArea);
|
31692 | this.setTooltipContainerClass(clickedScreenArea), this.tooltipContainer.style({
|
31693 | left: tooltipPosition.x + "px",
|
31694 | top: tooltipPosition.y + "px"
|
31695 | }), this.setArrowPosition(clickedScreenArea);
|
31696 | }, ToolTipComponent.prototype.setTooltipContainerClass = function(clickedScreenArea) {
|
31697 | var tooltipContainerClassName;
|
31698 | switch (clickedScreenArea) {
|
31699 | case 0:
|
31700 | case 3:
|
31701 | tooltipContainerClassName = "left";
|
31702 | break;
|
31703 |
|
31704 | case 1:
|
31705 | case 2:
|
31706 | tooltipContainerClassName = "right";
|
31707 | }
|
31708 | this.tooltipContainer.attr("class", ContainerClassName["class"]).classed(tooltipContainerClassName, !0);
|
31709 | }, ToolTipComponent.prototype.setArrowPosition = function(clickedScreenArea) {
|
31710 | var arrowClassName, arrow = this.getArrowElement();
|
31711 | arrowClassName = 0 === clickedScreenArea ? "top left" : 1 === clickedScreenArea ? "top right" : 3 === clickedScreenArea ? "bottom left" : "bottom right",
|
31712 | arrow.attr("class", "arrow").classed(arrowClassName, !0);
|
31713 | }, ToolTipComponent.prototype.getArrowElement = function() {
|
31714 | return this.tooltipContainer.select(ArrowClassName.selector);
|
31715 | }, ToolTipComponent.prototype.getClickedScreenArea = function(clickedArea) {
|
31716 | var screenWidth = this.customScreenWidth || window.innerWidth, screenHeight = this.customScreenHeight || window.innerHeight, centerPointOffset = clickedArea.width / 2, centerPoint = new TouchUtils.Point(clickedArea.x + centerPointOffset, clickedArea.y + centerPointOffset), halfWidth = screenWidth / 2, halfHeight = screenHeight / 2;
|
31717 | return centerPoint.x < halfWidth && centerPoint.y < halfHeight ? 0 : centerPoint.x >= halfWidth && centerPoint.y < halfHeight ? 1 : centerPoint.x < halfWidth && centerPoint.y >= halfHeight ? 3 : centerPoint.x >= halfWidth && centerPoint.y >= halfHeight ? 2 : void 0;
|
31718 | }, ToolTipComponent.DefaultTooltipOptions = {
|
31719 | opacity: 1,
|
31720 | animationDuration: 250,
|
31721 | offsetX: 10,
|
31722 | offsetY: 10
|
31723 | }, ToolTipComponent.parentContainerSelector = "body", ToolTipComponent.highlightedValueDisplayNameResorceKey = "Tooltip_HighlightedValueDisplayName",
|
31724 | ToolTipComponent;
|
31725 | }();
|
31726 | visuals.ToolTipComponent = ToolTipComponent;
|
31727 | var TooltipManager;
|
31728 | !function(TooltipManager) {
|
31729 | function addTooltip(selection, getTooltipInfoDelegate, reloadTooltipDataOnMouseMove, onMouseOutDelegate) {
|
31730 | if (TooltipManager.ShowTooltips) {
|
31731 | var rootNode = d3.select(ToolTipComponent.parentContainerSelector).node();
|
31732 | selection.on("mouseover", function() {
|
31733 | var target = d3.event.target, data = d3.select(target).datum();
|
31734 | if (!handleTouchTimeoutId && canDisplayTooltip(d3.event)) {
|
31735 | mouseCoordinates = getCoordinates(rootNode, !0);
|
31736 | var elementCoordinates = getCoordinates(target, !0), tooltipEvent = {
|
31737 | data: data,
|
31738 | coordinates: mouseCoordinates,
|
31739 | elementCoordinates: elementCoordinates,
|
31740 | context: target,
|
31741 | isTouchEvent: !1
|
31742 | };
|
31743 | clearTooltipTimeout();
|
31744 | var delay = TooltipManager.ToolTipInstance.isTooltipComponentVisible() ? 16 : tooltipMouseOverDelay;
|
31745 | tooltipTimeoutId = showDelayedTooltip(tooltipEvent, getTooltipInfoDelegate, delay);
|
31746 | }
|
31747 | }), selection.on("mouseout", function() {
|
31748 | handleTouchTimeoutId || (clearTooltipTimeout(), tooltipTimeoutId = hideDelayedTooltip()),
|
31749 | onMouseOutDelegate && onMouseOutDelegate();
|
31750 | }), selection.on("mousemove", function() {
|
31751 | var target = d3.event.target, data = d3.select(target).datum();
|
31752 | if (!handleTouchTimeoutId && canDisplayTooltip(d3.event)) {
|
31753 | mouseCoordinates = getCoordinates(rootNode, !0);
|
31754 | var elementCoordinates = getCoordinates(target, !0), tooltipEvent = {
|
31755 | data: data,
|
31756 | coordinates: mouseCoordinates,
|
31757 | elementCoordinates: elementCoordinates,
|
31758 | context: target,
|
31759 | isTouchEvent: !1
|
31760 | };
|
31761 | moveTooltipEventHandler(tooltipEvent, getTooltipInfoDelegate, reloadTooltipDataOnMouseMove);
|
31762 | }
|
31763 | });
|
31764 | var touchStartEventName = getTouchStartEventName(), touchEndEventName = getTouchEndEventName(), isPointerEvent = "pointerdown" === touchStartEventName || "MSPointerDown" === touchStartEventName;
|
31765 | GlobalTooltipEventsAttached || (attachGlobalEvents(touchStartEventName), GlobalTooltipEventsAttached = !0),
|
31766 | selection.on(touchStartEventName, function() {
|
31767 | var target = d3.event.target, data = d3.select(target).datum();
|
31768 | hideTooltipEventHandler();
|
31769 | var coordinates = getCoordinates(rootNode, isPointerEvent), elementCoordinates = getCoordinates(target, isPointerEvent), tooltipEvent = {
|
31770 | data: data,
|
31771 | coordinates: coordinates,
|
31772 | elementCoordinates: elementCoordinates,
|
31773 | context: target,
|
31774 | isTouchEvent: !0
|
31775 | };
|
31776 | clearTooltipTimeout(), tooltipTimeoutId = showDelayedTooltip(tooltipEvent, getTooltipInfoDelegate, tooltipTouchDelay);
|
31777 | }), selection.on(touchEndEventName, function() {
|
31778 | clearTooltipTimeout(), handleTouchTimeoutId && clearTimeout(handleTouchTimeoutId),
|
31779 | handleTouchTimeoutId = setTimeout(function() {
|
31780 | handleTouchTimeoutId = 0;
|
31781 | }, handleTouchDelay);
|
31782 | });
|
31783 | }
|
31784 | }
|
31785 | function showDelayedTooltip(tooltipEvent, getTooltipInfoDelegate, delayInMs) {
|
31786 | return setTimeout(function() {
|
31787 | return showTooltipEventHandler(tooltipEvent, getTooltipInfoDelegate);
|
31788 | }, delayInMs);
|
31789 | }
|
31790 | function hideDelayedTooltip() {
|
31791 | return setTimeout(function() {
|
31792 | return hideTooltipEventHandler();
|
31793 | }, tooltipMouseOutDelay);
|
31794 | }
|
31795 | function setLocalizedStrings(localizationOptions) {
|
31796 | ToolTipComponent.localizationOptions = localizationOptions;
|
31797 | }
|
31798 | function showTooltipEventHandler(tooltipEvent, getTooltipInfoDelegate) {
|
31799 | var tooltipInfo = tooltipData || getTooltipInfoDelegate(tooltipEvent);
|
31800 | if (!_.isEmpty(tooltipInfo)) {
|
31801 | var coordinates = mouseCoordinates || tooltipEvent.coordinates, clickedArea = getClickedArea(coordinates[0], coordinates[1], tooltipEvent.isTouchEvent);
|
31802 | TooltipManager.ToolTipInstance.show(tooltipInfo, clickedArea);
|
31803 | }
|
31804 | }
|
31805 | function moveTooltipEventHandler(tooltipEvent, getTooltipInfoDelegate, reloadTooltipDataOnMouseMove) {
|
31806 | tooltipData = void 0, reloadTooltipDataOnMouseMove && (tooltipData = getTooltipInfoDelegate(tooltipEvent));
|
31807 | var clickedArea = getClickedArea(tooltipEvent.coordinates[0], tooltipEvent.coordinates[1], tooltipEvent.isTouchEvent);
|
31808 | TooltipManager.ToolTipInstance.move(tooltipData, clickedArea);
|
31809 | }
|
31810 | function hideTooltipEventHandler() {
|
31811 | TooltipManager.ToolTipInstance.hide();
|
31812 | }
|
31813 | function clearTooltipTimeout() {
|
31814 | tooltipTimeoutId && clearTimeout(tooltipTimeoutId);
|
31815 | }
|
31816 | function canDisplayTooltip(d3Event) {
|
31817 | var cadDisplay = !0, mouseEvent = d3Event;
|
31818 | if (void 0 !== mouseEvent.buttons) {
|
31819 | var hasMouseButtonPressed = 0 !== mouseEvent.buttons;
|
31820 | cadDisplay = !hasMouseButtonPressed;
|
31821 | }
|
31822 | return cadDisplay;
|
31823 | }
|
31824 | function getTouchStartEventName() {
|
31825 | var eventName = "touchstart";
|
31826 | return window.PointerEvent ? eventName = "pointerdown" : window.MSPointerEvent && (eventName = "MSPointerDown"),
|
31827 | eventName;
|
31828 | }
|
31829 | function getTouchEndEventName() {
|
31830 | var eventName = "touchend";
|
31831 | return window.PointerEvent ? eventName = "pointerup" : window.MSPointerEvent && (eventName = "MSPointerUp"),
|
31832 | eventName;
|
31833 | }
|
31834 | function getCoordinates(rootNode, isPointerEvent) {
|
31835 | var coordinates;
|
31836 | if (isPointerEvent) {
|
31837 | for (var e = d3.event, s = void 0; s = e.sourceEvent; ) e = s;
|
31838 | var rect = rootNode.getBoundingClientRect();
|
31839 | coordinates = [ e.clientX - rect.left - rootNode.clientLeft, e.clientY - rect.top - rootNode.clientTop ];
|
31840 | } else {
|
31841 | var touchCoordinates = d3.touches(rootNode);
|
31842 | touchCoordinates && touchCoordinates.length > 0 && (coordinates = touchCoordinates[0]);
|
31843 | }
|
31844 | return coordinates;
|
31845 | }
|
31846 | function attachGlobalEvents(touchStartEventName) {
|
31847 | d3.select(ToolTipComponent.parentContainerSelector).on(touchStartEventName, function(d, i) {
|
31848 | TooltipManager.ToolTipInstance.hide();
|
31849 | });
|
31850 | }
|
31851 | function getClickedArea(x, y, isTouchEvent) {
|
31852 | var width = 0, pointX = x, pointY = y;
|
31853 | if (isTouchEvent) {
|
31854 | width = 12;
|
31855 | var offset = width / 2;
|
31856 | pointX = Math.max(x - offset, 0), pointY = Math.max(y - offset, 0);
|
31857 | }
|
31858 | return new TouchUtils.Rectangle(pointX, pointY, width, width);
|
31859 | }
|
31860 | TooltipManager.ShowTooltips = !0, TooltipManager.ToolTipInstance = new ToolTipComponent();
|
31861 | var tooltipTimeoutId, mouseCoordinates, tooltipData, GlobalTooltipEventsAttached = !1, tooltipMouseOverDelay = 350, tooltipMouseOutDelay = 500, tooltipTouchDelay = 350, handleTouchDelay = 1e3, handleTouchTimeoutId = 0;
|
31862 | TooltipManager.addTooltip = addTooltip, TooltipManager.showDelayedTooltip = showDelayedTooltip,
|
31863 | TooltipManager.hideDelayedTooltip = hideDelayedTooltip, TooltipManager.setLocalizedStrings = setLocalizedStrings;
|
31864 | }(TooltipManager = visuals.TooltipManager || (visuals.TooltipManager = {}));
|
31865 | var TooltipBuilder;
|
31866 | !function(TooltipBuilder) {
|
31867 | function createTooltipInfo(formatStringProp, dataViewCat, categoryValue, value, categories, seriesData, seriesIndex, categoryIndex, highlightedValue, gradientValueColumn) {
|
31868 | var categorySource, seriesSource = [], valuesSource = void 0;
|
31869 | seriesIndex = 0 | seriesIndex;
|
31870 | var categoriesData = dataViewCat ? dataViewCat.categories : categories;
|
31871 | if (categoriesData && categoriesData.length > 0) if (categoriesData.length > 1) {
|
31872 | for (var compositeCategoriesData = [], i = 0, ilen = categoriesData.length; ilen > i; i++) compositeCategoriesData.push(categoriesData[i].source);
|
31873 | categorySource = {
|
31874 | value: categoryValue,
|
31875 | metadata: compositeCategoriesData
|
31876 | };
|
31877 | } else categorySource = {
|
31878 | value: categoryValue,
|
31879 | metadata: [ categoriesData[0].source ]
|
31880 | };
|
31881 | if (dataViewCat && dataViewCat.values) {
|
31882 | if (categorySource && categorySource.metadata[0] === dataViewCat.values.source || (valuesSource = dataViewCat.values.source),
|
31883 | dataViewCat.values.length > 0) {
|
31884 | var valueColumn = dataViewCat.values[seriesIndex], isAutoGeneratedColumn = !!(valueColumn && valueColumn.source && valueColumn.source.isAutoGeneratedColumn);
|
31885 | isAutoGeneratedColumn || seriesSource.push({
|
31886 | value: value,
|
31887 | highlightedValue: highlightedValue,
|
31888 | metadata: valueColumn
|
31889 | });
|
31890 | }
|
31891 | var gradientToolTipData = createGradientToolTipData(gradientValueColumn, categoryIndex);
|
31892 | null != gradientToolTipData && seriesSource.push(gradientToolTipData);
|
31893 | }
|
31894 | if (seriesData) for (var i = 0, len = seriesData.length; len > i; i++) {
|
31895 | var singleSeriesData = seriesData[i];
|
31896 | categorySource && categorySource.metadata[0] === singleSeriesData.metadata.source || seriesSource.push({
|
31897 | value: singleSeriesData.value,
|
31898 | metadata: singleSeriesData.metadata
|
31899 | });
|
31900 | }
|
31901 | var tooltipInfo = createTooltipData(formatStringProp, categorySource, valuesSource, seriesSource);
|
31902 | return tooltipInfo;
|
31903 | }
|
31904 | function createGradientToolTipData(gradientValueColumn, categoryIndex) {
|
31905 | return gradientValueColumn ? {
|
31906 | value: gradientValueColumn.values[categoryIndex],
|
31907 | metadata: {
|
31908 | source: gradientValueColumn.source,
|
31909 | values: []
|
31910 | }
|
31911 | } : null;
|
31912 | }
|
31913 | function createTooltipData(formatStringProp, categoryValue, valuesSource, seriesValues) {
|
31914 | var items = [];
|
31915 | if (categoryValue) if (categoryValue.metadata.length > 1) {
|
31916 | for (var displayName = "", i = 0, ilen = categoryValue.metadata.length; ilen > i; i++) 0 !== i && (displayName += "/"),
|
31917 | displayName += categoryValue.metadata[i].displayName;
|
31918 | var categoryFormattedValue = getFormattedValue(categoryValue.metadata[0], formatStringProp, categoryValue.value);
|
31919 | items.push({
|
31920 | displayName: displayName,
|
31921 | value: categoryFormattedValue
|
31922 | });
|
31923 | } else {
|
31924 | var categoryFormattedValue = getFormattedValue(categoryValue.metadata[0], formatStringProp, categoryValue.value);
|
31925 | items.push({
|
31926 | displayName: categoryValue.metadata[0].displayName,
|
31927 | value: categoryFormattedValue
|
31928 | });
|
31929 | }
|
31930 | if (valuesSource) {
|
31931 | var dynamicValue = void 0;
|
31932 | if (seriesValues.length > 0) {
|
31933 | var dynamicValueMetadata = seriesValues[0].metadata.source;
|
31934 | dynamicValue = getFormattedValue(valuesSource, formatStringProp, dynamicValueMetadata.groupName);
|
31935 | }
|
31936 | items.push({
|
31937 | displayName: valuesSource.displayName,
|
31938 | value: dynamicValue
|
31939 | });
|
31940 | }
|
31941 | for (var i = 0; i < seriesValues.length; i++) {
|
31942 | var seriesData = seriesValues[i];
|
31943 | if (seriesData && seriesData.metadata) {
|
31944 | var seriesMetadataColumn = seriesData.metadata.source, value = seriesData.value, highlightedValue = seriesData.highlightedValue;
|
31945 | if (value || 0 === value) {
|
31946 | var formattedValue = getFormattedValue(seriesMetadataColumn, formatStringProp, value);
|
31947 | items.push({
|
31948 | displayName: seriesMetadataColumn.displayName,
|
31949 | value: formattedValue
|
31950 | });
|
31951 | }
|
31952 | if (highlightedValue || 0 === highlightedValue) {
|
31953 | var formattedHighlightedValue = getFormattedValue(seriesMetadataColumn, formatStringProp, highlightedValue), displayName = ToolTipComponent.localizationOptions.highlightedValueDisplayName;
|
31954 | items.push({
|
31955 | displayName: displayName,
|
31956 | value: formattedHighlightedValue
|
31957 | });
|
31958 | }
|
31959 | }
|
31960 | }
|
31961 | return items;
|
31962 | }
|
31963 | function addTooltipBucketItem(reader, tooltipInfo, categoryIndex, seriesIndex) {
|
31964 | var tooltipValues = reader.getAllValuesForRole("Tooltips", categoryIndex, seriesIndex), tooltipMetadataColumns = reader.getAllValueMetadataColumnsForRole("Tooltips", seriesIndex);
|
31965 | if (tooltipValues && tooltipMetadataColumns) for (var j = 0; j < tooltipValues.length; j++) null != tooltipValues[j] && tooltipMetadataColumns[j] && tooltipInfo.push({
|
31966 | displayName: tooltipMetadataColumns[j].displayName,
|
31967 | value: visuals.converterHelper.formatFromMetadataColumn(tooltipValues[j], tooltipMetadataColumns[j], visuals.Gauge.formatStringProp)
|
31968 | });
|
31969 | }
|
31970 | function getFormattedValue(column, formatStringProp, value) {
|
31971 | var formatString = getFormatStringFromColumn(column, formatStringProp);
|
31972 | return visuals.valueFormatter.format(value, formatString);
|
31973 | }
|
31974 | function getFormatStringFromColumn(column, formatStringProp) {
|
31975 | if (column) {
|
31976 | var formatString = visuals.valueFormatter.getFormatString(column, formatStringProp, !0);
|
31977 | return formatString || column.format;
|
31978 | }
|
31979 | return null;
|
31980 | }
|
31981 | TooltipBuilder.createTooltipInfo = createTooltipInfo, TooltipBuilder.createGradientToolTipData = createGradientToolTipData,
|
31982 | TooltipBuilder.addTooltipBucketItem = addTooltipBucketItem;
|
31983 | }(TooltipBuilder = visuals.TooltipBuilder || (visuals.TooltipBuilder = {}));
|
31984 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
31985 | }(powerbi || (powerbi = {}));
|
31986 | }, function(module, exports) {
|
31987 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
31988 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
31989 | !function(powerbi) {
|
31990 | var visuals;
|
31991 | !function(visuals) {
|
31992 | var visualStyles;
|
31993 | !function(visualStyles) {
|
31994 | function create(dataColors) {
|
31995 | return void 0 === dataColors && (dataColors = new visuals.DataColorPalette()), {
|
31996 | titleText: {
|
31997 | color: {
|
31998 | value: "#333"
|
31999 | }
|
32000 | },
|
32001 | subTitleText: {
|
32002 | color: {
|
32003 | value: "#919191"
|
32004 | }
|
32005 | },
|
32006 | colorPalette: {
|
32007 | foreground: {
|
32008 | value: "#333"
|
32009 | },
|
32010 | background: {
|
32011 | value: "#fff"
|
32012 | },
|
32013 | dataColors: dataColors
|
32014 | },
|
32015 | labelText: {
|
32016 | color: {
|
32017 | value: "#333"
|
32018 | },
|
32019 | fontSize: "11px"
|
32020 | },
|
32021 | isHighContrast: !1
|
32022 | };
|
32023 | }
|
32024 | visualStyles.create = create;
|
32025 | }(visualStyles = visuals.visualStyles || (visuals.visualStyles = {}));
|
32026 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
32027 | }(powerbi || (powerbi = {}));
|
32028 | }, function(module, exports) {
|
32029 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
32030 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
32031 | !function(powerbi) {
|
32032 | var visuals;
|
32033 | !function(visuals) {
|
32034 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, DonutChart = function() {
|
32035 | function DonutChart(options) {
|
32036 | options && (this.sliceWidthRatio = options.sliceWidthRatio, this.animator = options.animator,
|
32037 | this.isScrollable = options.isScrollable ? options.isScrollable : !1, this.disableGeometricCulling = options.disableGeometricCulling ? options.disableGeometricCulling : !1,
|
32038 | this.behavior = options.behavior, this.tooltipsEnabled = options.tooltipsEnabled,
|
32039 | this.tooltipBucketEnabled = options.tooltipBucketEnabled, options.smallViewPortProperties && (this.maxHeightToScaleDonutLegend = options.smallViewPortProperties.maxHeightToScaleDonutLegend)),
|
32040 | null == this.sliceWidthRatio && (this.sliceWidthRatio = DonutChart.defaultSliceWidthRatio);
|
32041 | }
|
32042 | return DonutChart.converter = function(dataView, colors, defaultDataPointColor, viewport, disableGeometricCulling, interactivityService, tooltipsEnabled, tooltipBucketEnabled) {
|
32043 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
32044 | var converter = new DonutChartConversion.DonutChartConverter(dataView, colors, defaultDataPointColor, tooltipsEnabled, tooltipBucketEnabled);
|
32045 | converter.convert();
|
32046 | var d3PieLayout = d3.layout.pie().sort(null).value(function(d) {
|
32047 | return d.percentage;
|
32048 | });
|
32049 | interactivityService && (interactivityService.applySelectionStateToData(converter.dataPoints),
|
32050 | interactivityService.applySelectionStateToData(converter.legendData.dataPoints));
|
32051 | var culledDataPoints = !disableGeometricCulling && viewport ? DonutChart.cullDataByViewport(converter.dataPoints, converter.maxValue, viewport) : converter.dataPoints;
|
32052 | return {
|
32053 | dataPointsToDeprecate: culledDataPoints,
|
32054 | dataPoints: d3PieLayout(culledDataPoints),
|
32055 | unCulledDataPoints: converter.dataPoints,
|
32056 | dataPointsToEnumerate: converter.legendData.dataPoints,
|
32057 | legendData: converter.legendData,
|
32058 | hasHighlights: converter.hasHighlights,
|
32059 | highlightsOverflow: converter.highlightsOverflow,
|
32060 | dataLabelsSettings: converter.dataLabelsSettings,
|
32061 | legendObjectProperties: converter.legendObjectProperties,
|
32062 | maxValue: converter.maxValue,
|
32063 | visibleGeometryCulled: converter.dataPoints.length !== culledDataPoints.length,
|
32064 | hasNegativeValues: converter.hasNegativeValues,
|
32065 | allValuesAreNegative: converter.allValuesAreNegative
|
32066 | };
|
32067 | }, DonutChart.prototype.init = function(options) {
|
32068 | this.options = options;
|
32069 | var element = options.element;
|
32070 | element.empty(), this.parentViewport = options.viewport, this.currentViewport = {
|
32071 | height: options.viewport.height,
|
32072 | width: options.viewport.width
|
32073 | }, this.formatter = visuals.valueFormatter.format, this.data = {
|
32074 | dataPointsToDeprecate: [],
|
32075 | dataPointsToEnumerate: [],
|
32076 | dataPoints: [],
|
32077 | unCulledDataPoints: [],
|
32078 | legendData: {
|
32079 | title: "",
|
32080 | dataPoints: [],
|
32081 | fontSize: visuals.SVGLegend.DefaultFontSizeInPt
|
32082 | },
|
32083 | hasHighlights: !1,
|
32084 | highlightsOverflow: !1,
|
32085 | dataLabelsSettings: visuals.dataLabelUtils.getDefaultDonutLabelSettings(),
|
32086 | hasNegativeValues: !1,
|
32087 | allValuesAreNegative: !1
|
32088 | }, this.drilled = !1, this.allowDrilldown = !1, this.style = options.style, this.colors = this.style.colorPalette.dataColors,
|
32089 | this.radius = 0, this.isInteractive = options.interactivity && options.interactivity.isInteractiveLegend;
|
32090 | var donutChartSettings = this.settings;
|
32091 | if (this.behavior && (this.interactivityService = visuals.createInteractivityService(options.host)),
|
32092 | this.legend = visuals.createLegend(element, options.interactivity && options.interactivity.isInteractiveLegend, this.interactivityService, this.isScrollable),
|
32093 | this.hostService = options.host, this.isInteractive) {
|
32094 | this.chartRotationAnimationDuration = donutChartSettings && donutChartSettings.chartRotationAnimationDuration ? donutChartSettings.chartRotationAnimationDuration : 0;
|
32095 | var legendContainer = this.legendContainer = d3.select(element.get(0)).append("div").classed(DonutChart.InteractiveLegendClassName, !0);
|
32096 | this.interactivityState = {
|
32097 | interactiveLegend: new DonutChartInteractiveLegend(this, legendContainer, this.colors, options, this.settings),
|
32098 | valueToAngleFactor: 0,
|
32099 | sliceAngles: [],
|
32100 | currentRotate: 0,
|
32101 | interactiveChosenSliceFinishedSetting: !1,
|
32102 | lastChosenInteractiveSliceIndex: 0,
|
32103 | totalDragAngleDifference: 0,
|
32104 | currentIndexDrag: 0,
|
32105 | previousIndexDrag: 0,
|
32106 | previousDragAngle: 0,
|
32107 | donutCenter: {
|
32108 | x: 0,
|
32109 | y: 0
|
32110 | }
|
32111 | };
|
32112 | }
|
32113 | this.svg = d3.select(element.get(0)).append("svg").style("position", "absolute").classed(DonutChart.ClassName, !0),
|
32114 | this.behavior && (this.clearCatcher = visuals.appendClearCatcher(this.svg)), this.mainGraphicsContext = this.svg.append("g"),
|
32115 | this.mainGraphicsContext.append("g").classed("slices", !0), this.labelGraphicsContext = this.svg.append("g").classed(visuals.NewDataLabelUtils.labelGraphicsContextClass["class"], !0),
|
32116 | this.pie = d3.layout.pie().sort(null).value(function(d) {
|
32117 | return d.percentage;
|
32118 | });
|
32119 | }, DonutChart.prototype.update = function(options) {
|
32120 | var viewport = options.viewport;
|
32121 | this.parentViewport = viewport;
|
32122 | var dataViews = this.dataViews = options.dataViews;
|
32123 | if (dataViews && dataViews.length > 0 && dataViews[0].categorical) {
|
32124 | var dataViewMetadata = dataViews[0].metadata, defaultDataPointColor = void 0;
|
32125 | if (dataViewMetadata) {
|
32126 | var objects = dataViewMetadata.objects;
|
32127 | objects && (defaultDataPointColor = powerbi.DataViewObjects.getFillColor(objects, visuals.donutChartProps.dataPoint.defaultColor));
|
32128 | }
|
32129 | this.data = DonutChart.converter(dataViews[0], this.colors, defaultDataPointColor, this.currentViewport, this.disableGeometricCulling, this.interactivityService, this.tooltipsEnabled, this.tooltipBucketEnabled),
|
32130 | this.data.defaultDataPointColor = defaultDataPointColor, this.options.interactivity && this.options.interactivity.isInteractiveLegend || this.renderLegend();
|
32131 | } else this.data = {
|
32132 | dataPointsToDeprecate: [],
|
32133 | dataPointsToEnumerate: [],
|
32134 | dataPoints: [],
|
32135 | unCulledDataPoints: [],
|
32136 | legendData: {
|
32137 | title: "",
|
32138 | dataPoints: []
|
32139 | },
|
32140 | hasHighlights: !1,
|
32141 | highlightsOverflow: !1,
|
32142 | dataLabelsSettings: visuals.dataLabelUtils.getDefaultDonutLabelSettings(),
|
32143 | hasNegativeValues: !1,
|
32144 | allValuesAreNegative: !1
|
32145 | };
|
32146 | if (this.initViewportDependantProperties(), this.initDonutProperties(), this.updateInternal(this.data, options.suppressAnimations),
|
32147 | this.hasSetData = !0, dataViews) {
|
32148 | var warnings = visuals.getInvalidValueWarnings(dataViews, !1, !1, !1);
|
32149 | this.data.allValuesAreNegative ? warnings.push(new visuals.AllNegativeValuesWarning()) : this.data.hasNegativeValues && warnings.push(new visuals.NegativeValuesNotSupportedWarning()),
|
32150 | this.hostService.setWarnings(warnings);
|
32151 | }
|
32152 | }, DonutChart.prototype.onDataChanged = function(options) {
|
32153 | this.update({
|
32154 | dataViews: options.dataViews,
|
32155 | suppressAnimations: options.suppressAnimations,
|
32156 | viewport: this.currentViewport
|
32157 | });
|
32158 | }, DonutChart.prototype.onResizing = function(viewport) {
|
32159 | this.update({
|
32160 | dataViews: this.dataViews,
|
32161 | suppressAnimations: !0,
|
32162 | viewport: viewport
|
32163 | });
|
32164 | }, DonutChart.prototype.enumerateObjectInstances = function(options) {
|
32165 | var enumeration = new visuals.ObjectEnumerationBuilder(), dataLabelsSettings = this.data && this.data.dataLabelsSettings ? this.data.dataLabelsSettings : visuals.dataLabelUtils.getDefaultDonutLabelSettings();
|
32166 | switch (options.objectName) {
|
32167 | case "legend":
|
32168 | this.enumerateLegend(enumeration);
|
32169 | break;
|
32170 |
|
32171 | case "dataPoint":
|
32172 | this.enumerateDataPoints(enumeration);
|
32173 | break;
|
32174 |
|
32175 | case "labels":
|
32176 | var labelSettingOptions = {
|
32177 | enumeration: enumeration,
|
32178 | dataLabelsSettings: dataLabelsSettings,
|
32179 | show: !0,
|
32180 | displayUnits: !0,
|
32181 | precision: !0,
|
32182 | fontSize: !0,
|
32183 | labelStyle: !0
|
32184 | };
|
32185 | visuals.dataLabelUtils.enumerateDataLabels(labelSettingOptions);
|
32186 | }
|
32187 | return enumeration.complete();
|
32188 | }, DonutChart.prototype.enumerateDataPoints = function(enumeration) {
|
32189 | var data = this.data;
|
32190 | if (data) for (var dataPoints = data.dataPointsToEnumerate, dataPointsLength = dataPoints.length, i = 0; dataPointsLength > i; i++) {
|
32191 | var dataPoint = dataPoints[i];
|
32192 | enumeration.pushInstance({
|
32193 | objectName: "dataPoint",
|
32194 | displayName: dataPoint.label,
|
32195 | selector: visuals.ColorHelper.normalizeSelector(dataPoint.identity.getSelector()),
|
32196 | properties: {
|
32197 | fill: {
|
32198 | solid: {
|
32199 | color: dataPoint.color
|
32200 | }
|
32201 | }
|
32202 | }
|
32203 | });
|
32204 | }
|
32205 | }, DonutChart.prototype.enumerateLegend = function(enumeration) {
|
32206 | var data = this.data;
|
32207 | if (data) {
|
32208 | var legendObjectProperties = {
|
32209 | legend: data.legendObjectProperties
|
32210 | }, show = powerbi.DataViewObjects.getValue(legendObjectProperties, visuals.donutChartProps.legend.show, this.legend.isVisible()), showTitle = powerbi.DataViewObjects.getValue(legendObjectProperties, visuals.donutChartProps.legend.showTitle, !0), titleText = powerbi.DataViewObjects.getValue(legendObjectProperties, visuals.donutChartProps.legend.titleText, this.data.legendData.title), labelColor = powerbi.DataViewObject.getValue(legendObjectProperties, visuals.legendProps.labelColor, this.data.legendData.labelColor), labelFontSize = powerbi.DataViewObject.getValue(legendObjectProperties, visuals.legendProps.fontSize, this.data.legendData.fontSize);
|
32211 | enumeration.pushInstance({
|
32212 | selector: null,
|
32213 | objectName: "legend",
|
32214 | properties: {
|
32215 | show: show,
|
32216 | position: visuals.LegendPosition[this.legend.getOrientation()],
|
32217 | showTitle: showTitle,
|
32218 | titleText: titleText,
|
32219 | labelColor: labelColor,
|
32220 | fontSize: labelFontSize
|
32221 | }
|
32222 | });
|
32223 | }
|
32224 | }, DonutChart.prototype.setInteractiveChosenSlice = function(sliceIndex) {
|
32225 | var _this = this;
|
32226 | if (0 !== this.interactivityState.sliceAngles.length) {
|
32227 | this.interactivityState.lastChosenInteractiveSliceIndex = sliceIndex, this.interactivityState.interactiveChosenSliceFinishedSetting = !1;
|
32228 | var viewport = this.currentViewport, moduledIndex = sliceIndex % this.data.dataPoints.length, angle = this.interactivityState.sliceAngles[moduledIndex];
|
32229 | this.svg.select("g").transition().duration(this.chartRotationAnimationDuration).ease("elastic").attr("transform", visuals.SVGUtil.translateAndRotate(viewport.width / 2, viewport.height / 2, 0, 0, angle)).each("end", function() {
|
32230 | _this.interactivityState.interactiveChosenSliceFinishedSetting = !0;
|
32231 | }), this.interactivityState.currentRotate = angle, this.interactivityState.interactiveLegend.updateLegend(moduledIndex),
|
32232 | this.svg.selectAll(".slice").attr("opacity", function(d, index) {
|
32233 | return index === moduledIndex ? 1 : .6;
|
32234 | }), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options);
|
32235 | }
|
32236 | }, DonutChart.prototype.calculateRadius = function() {
|
32237 | var viewport = this.currentViewport;
|
32238 | if (!this.isInteractive && this.data && this.data.dataLabelsSettings.show) {
|
32239 | var hw = viewport.height / viewport.width, denom = 2 + 1 / (1 + Math.exp(-5 * (hw - 1)));
|
32240 | return Math.min(viewport.height, viewport.width) / denom;
|
32241 | }
|
32242 | return Math.min(viewport.height, viewport.width) / 2;
|
32243 | }, DonutChart.prototype.getScaleForLegendArrow = function() {
|
32244 | var ratio = 1;
|
32245 | return this.maxHeightToScaleDonutLegend && this.currentViewport.height < this.maxHeightToScaleDonutLegend && (ratio = this.currentViewport.height / this.maxHeightToScaleDonutLegend),
|
32246 | ratio;
|
32247 | }, DonutChart.prototype.initViewportDependantProperties = function(duration) {
|
32248 | void 0 === duration && (duration = 0), this.currentViewport.height = this.parentViewport.height,
|
32249 | this.currentViewport.width = this.parentViewport.width;
|
32250 | var viewport = this.currentViewport;
|
32251 | if (this.isInteractive) viewport.height -= DonutChart.InteractiveLegendContainerHeight; else {
|
32252 | var legendMargins = this.legend.getMargins();
|
32253 | viewport.height -= legendMargins.height, viewport.width -= legendMargins.width;
|
32254 | }
|
32255 | this.svg.attr({
|
32256 | width: viewport.width,
|
32257 | height: viewport.height
|
32258 | }), this.isInteractive ? (this.legendContainer.style({
|
32259 | width: "100%",
|
32260 | height: DonutChart.InteractiveLegendContainerHeight + "px",
|
32261 | overflow: "hidden",
|
32262 | top: 0
|
32263 | }), this.svg.style("top", DonutChart.InteractiveLegendContainerHeight)) : visuals.Legend.positionChartArea(this.svg, this.legend),
|
32264 | this.previousRadius = this.radius;
|
32265 | var radius = this.radius = this.calculateRadius(), halfViewportWidth = viewport.width / 2, halfViewportHeight = viewport.height / 2;
|
32266 | this.arc = d3.svg.arc(), this.outerArc = d3.svg.arc().innerRadius(radius * DonutChart.OuterArcRadiusRatio).outerRadius(radius * DonutChart.OuterArcRadiusRatio),
|
32267 | this.isInteractive ? (this.mainGraphicsContext.attr("transform", visuals.SVGUtil.translate(halfViewportWidth, halfViewportHeight)),
|
32268 | this.labelGraphicsContext.attr("transform", visuals.SVGUtil.translate(halfViewportWidth, halfViewportHeight))) : (this.mainGraphicsContext.transition().duration(duration).attr("transform", visuals.SVGUtil.translate(halfViewportWidth, halfViewportHeight)),
|
32269 | this.labelGraphicsContext.transition().duration(duration).attr("transform", visuals.SVGUtil.translate(halfViewportWidth, halfViewportHeight))),
|
32270 | visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options);
|
32271 | }, DonutChart.prototype.initDonutProperties = function() {
|
32272 | this.donutProperties = {
|
32273 | viewport: this.currentViewport,
|
32274 | radius: this.radius,
|
32275 | arc: this.arc.innerRadius(0).outerRadius(this.radius * DonutChart.InnerArcRadiusRatio),
|
32276 | outerArc: this.outerArc,
|
32277 | innerArcRadiusRatio: DonutChart.InnerArcRadiusRatio,
|
32278 | outerArcRadiusRatio: DonutChart.OuterArcRadiusRatio,
|
32279 | dataLabelsSettings: this.data.dataLabelsSettings
|
32280 | };
|
32281 | }, DonutChart.prototype.mergeDatasets = function(first, second) {
|
32282 | var secondSet = d3.set();
|
32283 | second.forEach(function(d) {
|
32284 | secondSet.add(d.identity ? d.identity.getKey() : d.data.identity.getKey());
|
32285 | });
|
32286 | var onlyFirst = first.filter(function(d) {
|
32287 | return !secondSet.has(d.identity ? d.identity.getKey() : d.data.identity.getKey());
|
32288 | }).map(function(d) {
|
32289 | var derived = powerbi.Prototype.inherit(d);
|
32290 | return void 0 === derived.percentage ? derived.data.percentage = 0 : derived.percentage = 0,
|
32291 | derived;
|
32292 | });
|
32293 | return d3.merge([ second, onlyFirst ]);
|
32294 | }, DonutChart.prototype.updateInternal = function(data, suppressAnimations, duration) {
|
32295 | void 0 === duration && (duration = 0);
|
32296 | var viewport = this.currentViewport;
|
32297 | if (duration = duration || visuals.AnimatorCommon.GetAnimationDuration(this.animator, suppressAnimations),
|
32298 | this.animator) {
|
32299 | var shapes_1, layout = DonutChart.getLayout(this.radius, this.sliceWidthRatio, viewport), result = void 0, highlightShapes = void 0, labelSettings = data.dataLabelsSettings, labels = [];
|
32300 | if (labelSettings && labelSettings.show && (labels = this.createLabels()), !suppressAnimations) {
|
32301 | var animationOptions = {
|
32302 | viewModel: data,
|
32303 | colors: this.colors,
|
32304 | graphicsContext: this.mainGraphicsContext,
|
32305 | labelGraphicsContext: this.labelGraphicsContext,
|
32306 | interactivityService: this.interactivityService,
|
32307 | layout: layout,
|
32308 | radius: this.radius,
|
32309 | sliceWidthRatio: this.sliceWidthRatio,
|
32310 | viewport: viewport,
|
32311 | labels: labels,
|
32312 | innerArcRadiusRatio: DonutChart.InnerArcRadiusRatio
|
32313 | };
|
32314 | result = this.animator.animate(animationOptions), shapes_1 = result.shapes, highlightShapes = result.highlightShapes;
|
32315 | }
|
32316 | (suppressAnimations || result.failed) && (shapes_1 = DonutChart.drawDefaultShapes(this.svg, data, layout, this.colors, this.radius, this.interactivityService && this.interactivityService.hasSelection(), this.sliceWidthRatio, this.data.defaultDataPointColor),
|
32317 | highlightShapes = DonutChart.drawDefaultHighlightShapes(this.svg, data, layout, this.colors, this.radius, this.sliceWidthRatio),
|
32318 | visuals.NewDataLabelUtils.drawDefaultLabels(this.labelGraphicsContext, labels, !1, !0, !0),
|
32319 | visuals.NewDataLabelUtils.drawLabelLeaderLines(this.labelGraphicsContext, labels)),
|
32320 | this.assignInteractions(shapes_1, highlightShapes, data), this.tooltipsEnabled && (visuals.TooltipManager.addTooltip(shapes_1, function(tooltipEvent) {
|
32321 | return tooltipEvent.data.data.tooltipInfo;
|
32322 | }), visuals.TooltipManager.addTooltip(highlightShapes, function(tooltipEvent) {
|
32323 | return tooltipEvent.data.data.tooltipInfo;
|
32324 | }));
|
32325 | } else this.updateInternalToMove(data, duration);
|
32326 | visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options);
|
32327 | }, DonutChart.prototype.createLabels = function() {
|
32328 | var labelLayout = new powerbi.DonutLabelLayout({
|
32329 | maximumOffset: visuals.NewDataLabelUtils.maxLabelOffset,
|
32330 | startingOffset: visuals.NewDataLabelUtils.startingLabelOffset
|
32331 | }, this.donutProperties), labelDataPoints = this.createLabelDataPoints();
|
32332 | return labelLayout.layout(labelDataPoints);
|
32333 | }, DonutChart.prototype.createLabelDataPoints = function() {
|
32334 | var data = this.data, labelDataPoints = [], measureFormatterCache = visuals.dataLabelUtils.createColumnFormatterCacheManager(), alternativeScale = null;
|
32335 | 0 === data.dataLabelsSettings.displayUnits && (alternativeScale = d3.max(data.dataPoints, function(d) {
|
32336 | return Math.abs(d.data.measure);
|
32337 | }));
|
32338 | for (var i = 0; i < this.data.dataPoints.length; i++) {
|
32339 | var label = this.createLabelDataPoint(data.dataPoints[i], alternativeScale, measureFormatterCache);
|
32340 | labelDataPoints.push(label);
|
32341 | }
|
32342 | return labelDataPoints;
|
32343 | }, DonutChart.prototype.createLabelDataPoint = function(d, alternativeScale, measureFormatterCache) {
|
32344 | var dataLabel, dataLabelSize, categoryLabel, categoryLabelSize, textSize, labelPoint = this.outerArc.centroid(d), labelX = visuals.DonutLabelUtils.getXPositionForDonutLabel(labelPoint[0]), labelY = labelPoint[1], labelSettings = this.data.dataLabelsSettings, measureFormatter = measureFormatterCache.getOrCreate(d.data.labelFormatString, labelSettings, alternativeScale), position = 0 > labelX ? 4 : 8, pointPosition = {
|
32345 | point: {
|
32346 | x: labelX,
|
32347 | y: labelY
|
32348 | },
|
32349 | validPositions: [ position ],
|
32350 | radius: 0
|
32351 | }, outsideFill = labelSettings.labelColor ? labelSettings.labelColor : visuals.NewDataLabelUtils.defaultLabelColor, labelSettingsStyle = labelSettings.labelStyle, fontSize = labelSettings.fontSize, tooltip = "";
|
32352 | switch (labelSettingsStyle !== visuals.labelStyle.both && labelSettingsStyle !== visuals.labelStyle.data || (dataLabel = measureFormatter.format(null != d.data.originalHighlightValue ? d.data.originalHighlightValue : d.data.originalMeasure),
|
32353 | dataLabelSize = visuals.NewDataLabelUtils.getTextSize(dataLabel, fontSize)), labelSettingsStyle !== visuals.labelStyle.both && labelSettingsStyle !== visuals.labelStyle.category || (categoryLabel = d.data.label,
|
32354 | categoryLabelSize = visuals.NewDataLabelUtils.getTextSize(categoryLabel, fontSize)),
|
32355 | labelSettingsStyle) {
|
32356 | case visuals.labelStyle.both:
|
32357 | var text = categoryLabel + " (" + dataLabel + ")";
|
32358 | tooltip = text, textSize = visuals.NewDataLabelUtils.getTextSize(text, fontSize);
|
32359 | break;
|
32360 |
|
32361 | case visuals.labelStyle.category:
|
32362 | textSize = _.clone(categoryLabelSize), tooltip = categoryLabel;
|
32363 | break;
|
32364 |
|
32365 | case visuals.labelStyle.data:
|
32366 | textSize = _.clone(dataLabelSize), tooltip = dataLabel;
|
32367 | }
|
32368 | var leaderLinePoints = visuals.DonutLabelUtils.getLabelLeaderLineForDonutChart(d, this.donutProperties, pointPosition.point), leaderLinesSize = visuals.DonutLabelUtils.getLabelLeaderLinesSizeForDonutChart(leaderLinePoints);
|
32369 | return {
|
32370 | isPreferred: !0,
|
32371 | text: "",
|
32372 | tooltip: tooltip,
|
32373 | textSize: textSize,
|
32374 | outsideFill: outsideFill,
|
32375 | fontSize: fontSize,
|
32376 | identity: d.data.identity,
|
32377 | parentShape: pointPosition,
|
32378 | insideFill: visuals.NewDataLabelUtils.defaultInsideLabelColor,
|
32379 | parentType: 0,
|
32380 | alternativeScale: alternativeScale,
|
32381 | donutArcDescriptor: d,
|
32382 | angle: (d.startAngle + d.endAngle) / 2 - Math.PI / 2,
|
32383 | dataLabel: dataLabel,
|
32384 | dataLabelSize: dataLabelSize,
|
32385 | categoryLabel: categoryLabel,
|
32386 | categoryLabelSize: categoryLabelSize,
|
32387 | leaderLinePoints: leaderLinePoints,
|
32388 | linesSize: leaderLinesSize
|
32389 | };
|
32390 | }, DonutChart.prototype.renderLegend = function() {
|
32391 | if (!this.isInteractive) {
|
32392 | var legendObjectProperties = this.data.legendObjectProperties;
|
32393 | if (legendObjectProperties) {
|
32394 | var legendData = this.data.legendData;
|
32395 | visuals.LegendData.update(legendData, legendObjectProperties);
|
32396 | var position = legendObjectProperties[visuals.legendProps.position];
|
32397 | position && this.legend.changeOrientation(visuals.LegendPosition[position]), this.legend.drawLegend(legendData, this.parentViewport);
|
32398 | } else this.legend.changeOrientation(visuals.LegendPosition.Top), this.legend.drawLegend({
|
32399 | dataPoints: []
|
32400 | }, this.parentViewport);
|
32401 | }
|
32402 | }, DonutChart.prototype.addInteractiveLegendArrow = function() {
|
32403 | if (this.data && this.data.dataPoints && 0 !== this.data.dataPoints.length) {
|
32404 | var arrowHeightOffset = 11, arrowWidthOffset = 16.5;
|
32405 | if (!this.interactiveLegendArrow) {
|
32406 | var interactiveLegendArrow = this.svg.append("g");
|
32407 | interactiveLegendArrow.append("path").classed(DonutChart.InteractiveLegendArrowClassName, !0).attr("d", "M1.5,2.6C0.65,1.15,1.85,0,3,0l27,0c1.65,0,2.35,1.15,1.5,2.6L18,26.45c-0.8,1.45-2.15,1.45-2.95,0L1.95,2.6z"),
|
32408 | this.interactiveLegendArrow = interactiveLegendArrow;
|
32409 | }
|
32410 | var viewport = this.currentViewport, scaleRatio = this.getScaleForLegendArrow(), distanceBetweenLegendAndArrow = (viewport.height - 2 * this.radius) / 2 + arrowHeightOffset * scaleRatio, middleOfChart = viewport.width / 2 - arrowWidthOffset * scaleRatio;
|
32411 | this.interactiveLegendArrow.attr("transform", visuals.SVGUtil.translateAndScale(middleOfChart, distanceBetweenLegendAndArrow, scaleRatio));
|
32412 | }
|
32413 | }, DonutChart.prototype.calculateSliceAngles = function() {
|
32414 | var angles = [], data = this.data.dataPoints;
|
32415 | if (0 === data.length) return this.interactivityState.valueToAngleFactor = 0, void (this.interactivityState.sliceAngles = []);
|
32416 | for (var sum = 0, i = 0, ilen = data.length; ilen > i; i++) sum += data[i].data.percentage;
|
32417 | this.interactivityState.valueToAngleFactor = 360 / sum;
|
32418 | for (var currentAngle = 0, i = 0, ilen = data.length; ilen > i; i++) {
|
32419 | var relativeAngle = data[i].data.percentage * this.interactivityState.valueToAngleFactor;
|
32420 | currentAngle += relativeAngle, angles.push(relativeAngle / 2 - currentAngle);
|
32421 | }
|
32422 | this.interactivityState.sliceAngles = angles;
|
32423 | }, DonutChart.prototype.assignInteractions = function(slices, highlightSlices, data) {
|
32424 | if (this.isInteractive) this.assignInteractiveChartInteractions(slices); else if (this.interactivityService) {
|
32425 | var dataPoints = data.dataPoints.map(function(value) {
|
32426 | return value.data;
|
32427 | }), behaviorOptions = {
|
32428 | clearCatcher: this.clearCatcher,
|
32429 | slices: slices,
|
32430 | highlightSlices: highlightSlices,
|
32431 | allowDrilldown: this.allowDrilldown,
|
32432 | visual: this,
|
32433 | hasHighlights: data.hasHighlights
|
32434 | };
|
32435 | this.interactivityService.bind(dataPoints, this.behavior, behaviorOptions);
|
32436 | }
|
32437 | }, DonutChart.prototype.assignInteractiveChartInteractions = function(slice) {
|
32438 | var _this = this, svg = this.svg;
|
32439 | this.interactivityState.interactiveChosenSliceFinishedSetting = !0;
|
32440 | var svgRect = svg.node().getBoundingClientRect();
|
32441 | this.interactivityState.donutCenter = {
|
32442 | x: svgRect.left + svgRect.width / 2,
|
32443 | y: svgRect.top + svgRect.height / 2
|
32444 | }, this.interactivityState.totalDragAngleDifference = 0, this.interactivityState.currentRotate = 0,
|
32445 | this.calculateSliceAngles(), slice.on("click", function(d, clickedIndex) {
|
32446 | d3.event.defaultPrevented || _this.setInteractiveChosenSlice(clickedIndex);
|
32447 | });
|
32448 | var drag = d3.behavior.drag().origin(Object).on("dragstart", function() {
|
32449 | return _this.interactiveDragStart();
|
32450 | }).on("drag", function() {
|
32451 | return _this.interactiveDragMove();
|
32452 | }).on("dragend", function() {
|
32453 | return _this.interactiveDragEnd();
|
32454 | });
|
32455 | svg.style("touch-action", "none").call(drag);
|
32456 | }, DonutChart.prototype.getAngleFromDragEvent = function() {
|
32457 | var pageX, pageY, interactivityState = this.interactivityState, sourceEvent = d3.event.sourceEvent;
|
32458 | if (-1 !== sourceEvent.type.toLowerCase().indexOf("touch")) {
|
32459 | if (1 !== sourceEvent.touches.length) return null;
|
32460 | var touch = sourceEvent.touches[0];
|
32461 | pageX = touch.pageX, pageY = touch.pageY;
|
32462 | } else pageX = sourceEvent.pageX, pageY = sourceEvent.pageY;
|
32463 | var adjustedCoordinates = {
|
32464 | x: pageX - interactivityState.donutCenter.x,
|
32465 | y: -pageY + interactivityState.donutCenter.y
|
32466 | }, angleToThePlane = 180 * Math.atan2(adjustedCoordinates.y, adjustedCoordinates.x) / Math.PI;
|
32467 | return angleToThePlane;
|
32468 | }, DonutChart.prototype.interactiveDragStart = function() {
|
32469 | this.interactivityState.totalDragAngleDifference = 0, this.interactivityState.previousDragAngle = this.getAngleFromDragEvent();
|
32470 | }, DonutChart.prototype.interactiveDragMove = function() {
|
32471 | var data = this.data.dataPoints, viewport = this.currentViewport, interactivityState = this.interactivityState;
|
32472 | if (interactivityState.interactiveChosenSliceFinishedSetting === !0) {
|
32473 | var currentDragAngle = this.getAngleFromDragEvent();
|
32474 | if (!currentDragAngle) return;
|
32475 | var angleDragDiff = interactivityState.previousDragAngle - currentDragAngle;
|
32476 | interactivityState.totalDragAngleDifference += angleDragDiff, interactivityState.previousDragAngle = currentDragAngle,
|
32477 | interactivityState.currentRotate += angleDragDiff, this.svg.select("g").attr("transform", visuals.SVGUtil.translateAndRotate(viewport.width / 2, viewport.height / 2, 0, 0, this.interactivityState.currentRotate));
|
32478 | var currentHigherLimit = data[0].data.percentage * interactivityState.valueToAngleFactor, currentAngle = interactivityState.currentRotate <= 0 ? -1 * interactivityState.currentRotate % 360 : 360 - interactivityState.currentRotate % 360;
|
32479 | interactivityState.currentIndexDrag = 0;
|
32480 | for (var dataLength = data.length; interactivityState.currentIndexDrag < dataLength && currentAngle > currentHigherLimit; ) interactivityState.currentIndexDrag < dataLength - 1 && (currentHigherLimit += data[interactivityState.currentIndexDrag + 1].data.percentage * interactivityState.valueToAngleFactor),
|
32481 | interactivityState.currentIndexDrag++;
|
32482 | interactivityState.currentIndexDrag !== interactivityState.previousIndexDrag && (interactivityState.interactiveLegend.updateLegend(interactivityState.currentIndexDrag),
|
32483 | this.svg.selectAll(".slice").attr("opacity", function(d, index) {
|
32484 | return index === interactivityState.currentIndexDrag ? DonutChart.OpaqueOpacity : DonutChart.SemiTransparentOpacity;
|
32485 | }), interactivityState.previousIndexDrag = interactivityState.currentIndexDrag);
|
32486 | }
|
32487 | }, DonutChart.prototype.interactiveDragEnd = function() {
|
32488 | 0 !== this.interactivityState.totalDragAngleDifference && (this.setInteractiveChosenSlice(this.interactivityState.currentIndexDrag),
|
32489 | d3.event.sourceEvent.stopPropagation());
|
32490 | }, DonutChart.prototype.updateInternalToMove = function(data, duration) {
|
32491 | void 0 === duration && (duration = 0);
|
32492 | var svg = this.svg, pie = this.pie, key = this.key, arc = this.arc, radius = this.radius, previousRadius = this.previousRadius, sliceWidthRatio = this.sliceWidthRatio, existingData = this.svg.select(".slices").selectAll("path" + DonutChart.sliceClass.selector).data().map(function(d) {
|
32493 | return d.data;
|
32494 | });
|
32495 | 0 === existingData.length && (existingData = data.dataPointsToDeprecate);
|
32496 | var is = this.mergeDatasets(existingData, data.dataPointsToDeprecate), slice = svg.select(".slices").selectAll("path" + DonutChart.sliceClass.selector).data(pie(data.dataPointsToDeprecate), key);
|
32497 | slice.enter().insert("path").classed(DonutChart.sliceClass["class"], !0).each(function(d) {
|
32498 | this._current = d;
|
32499 | }), slice = svg.select(".slices").selectAll("path" + DonutChart.sliceClass.selector).data(pie(is), key);
|
32500 | var innerRadius = radius * sliceWidthRatio;
|
32501 | if (DonutChart.isSingleColor(data.dataPoints), slice.style("fill", function(d) {
|
32502 | return d.data.color;
|
32503 | }).style("fill-opacity", function(d) {
|
32504 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, !1, data.hasHighlights);
|
32505 | }).style("stroke", "white").style("stroke-dasharray", function(d) {
|
32506 | return DonutChart.drawStrokeForDonutChart(radius, DonutChart.InnerArcRadiusRatio, d, sliceWidthRatio);
|
32507 | }).style("stroke-width", function(d) {
|
32508 | return d.data.strokeWidth;
|
32509 | }).transition().duration(duration).attrTween("d", function(d) {
|
32510 | var i = d3.interpolate(this._current, d), k = d3.interpolate(previousRadius * DonutChart.InnerArcRadiusRatio, radius * DonutChart.InnerArcRadiusRatio);
|
32511 | return this._current = i(0), function(t) {
|
32512 | return arc.innerRadius(innerRadius).outerRadius(k(t))(i(t));
|
32513 | };
|
32514 | }), slice = svg.select(".slices").selectAll("path" + DonutChart.sliceClass.selector).data(pie(data.dataPointsToDeprecate), key),
|
32515 | slice.exit().transition().delay(duration).duration(0).remove(), !this.isInteractive) {
|
32516 | var labelSettings = data.dataLabelsSettings, labels = [];
|
32517 | labelSettings && labelSettings.show && (labels = this.createLabels()), visuals.NewDataLabelUtils.drawDefaultLabels(this.labelGraphicsContext, labels, !1, !0),
|
32518 | visuals.NewDataLabelUtils.drawLabelLeaderLines(this.labelGraphicsContext, labels);
|
32519 | }
|
32520 | var highlightSlices = void 0;
|
32521 | data.hasHighlights ? (highlightSlices = svg.select(".slices").selectAll("path" + DonutChart.sliceHighlightClass.selector).data(pie(data.dataPointsToDeprecate), key),
|
32522 | highlightSlices.enter().insert("path").classed(DonutChart.sliceHighlightClass["class"], !0).each(function(d) {
|
32523 | this._current = d;
|
32524 | }), DonutChart.isSingleColor(data.dataPoints), highlightSlices.style("fill", function(d) {
|
32525 | return d.data.color;
|
32526 | }).style("fill-opacity", 1).style("stroke", "white").style("stroke-dasharray", function(d) {
|
32527 | return DonutChart.drawStrokeForDonutChart(radius, DonutChart.InnerArcRadiusRatio, d, sliceWidthRatio, d.data.highlightRatio);
|
32528 | }).style("stroke-width", function(d) {
|
32529 | return 0 === d.data.highlightRatio ? 0 : d.data.strokeWidth;
|
32530 | }).transition().duration(duration).attrTween("d", function(d) {
|
32531 | var i = d3.interpolate(this._current, d), k = d3.interpolate(previousRadius * DonutChart.InnerArcRadiusRatio, DonutChart.getHighlightRadius(radius, sliceWidthRatio, d.data.highlightRatio));
|
32532 | return this._current = i(0), function(t) {
|
32533 | return arc.innerRadius(innerRadius).outerRadius(k(t))(i(t));
|
32534 | };
|
32535 | }), highlightSlices.exit().transition().delay(duration).duration(0).remove()) : svg.selectAll("path" + DonutChart.sliceHighlightClass.selector).transition().delay(duration).duration(0).remove(),
|
32536 | this.assignInteractions(slice, highlightSlices, data), this.tooltipsEnabled && (visuals.TooltipManager.addTooltip(slice, function(tooltipEvent) {
|
32537 | return tooltipEvent.data.data.tooltipInfo;
|
32538 | }), data.hasHighlights && visuals.TooltipManager.addTooltip(highlightSlices, function(tooltipEvent) {
|
32539 | return tooltipEvent.data.data.tooltipInfo;
|
32540 | })), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options), this.isInteractive && (this.addInteractiveLegendArrow(),
|
32541 | this.interactivityState.interactiveLegend.drawLegend(this.data.dataPointsToDeprecate),
|
32542 | this.setInteractiveChosenSlice(this.interactivityState.lastChosenInteractiveSliceIndex ? this.interactivityState.lastChosenInteractiveSliceIndex : 0));
|
32543 | }, DonutChart.drawDefaultShapes = function(graphicsContext, donutData, layout, colors, radius, hasSelection, sliceWidthRatio, defaultColor) {
|
32544 | var shapes = graphicsContext.select(".slices").selectAll("path" + DonutChart.sliceClass.selector).data(donutData.dataPoints, function(d) {
|
32545 | return d.data.identity.getKey();
|
32546 | });
|
32547 | return shapes.enter().insert("path").classed(DonutChart.sliceClass["class"], !0),
|
32548 | DonutChart.isSingleColor(donutData.dataPoints), shapes.style("fill", function(d) {
|
32549 | return d.data.color;
|
32550 | }).style("fill-opacity", function(d) {
|
32551 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, hasSelection, donutData.hasHighlights);
|
32552 | }).style("stroke-dasharray", function(d) {
|
32553 | return DonutChart.drawStrokeForDonutChart(radius, DonutChart.InnerArcRadiusRatio, d, sliceWidthRatio);
|
32554 | }).style("stroke-width", function(d) {
|
32555 | return d.data.strokeWidth;
|
32556 | }).attr(layout.shapeLayout), shapes.exit().remove(), shapes;
|
32557 | }, DonutChart.drawDefaultHighlightShapes = function(graphicsContext, donutData, layout, colors, radius, sliceWidthRatio) {
|
32558 | var shapes = graphicsContext.select(".slices").selectAll("path" + DonutChart.sliceHighlightClass.selector).data(donutData.dataPoints.filter(function(value) {
|
32559 | return null != value.data.highlightRatio;
|
32560 | }), function(d) {
|
32561 | return d.data.identity.getKey();
|
32562 | });
|
32563 | return shapes.enter().insert("path").classed(DonutChart.sliceHighlightClass["class"], !0).each(function(d) {
|
32564 | this._current = d;
|
32565 | }), DonutChart.isSingleColor(donutData.dataPoints), shapes.style("fill", function(d) {
|
32566 | return d.data.color;
|
32567 | }).style("fill-opacity", function(d) {
|
32568 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !0, !1, donutData.hasHighlights);
|
32569 | }).style("stroke", "white").style("stroke-dasharray", function(d) {
|
32570 | return DonutChart.drawStrokeForDonutChart(radius, DonutChart.InnerArcRadiusRatio, d, sliceWidthRatio, d.data.highlightRatio);
|
32571 | }).style("stroke-width", function(d) {
|
32572 | return 0 === d.data.highlightRatio ? 0 : d.data.strokeWidth;
|
32573 | }).attr(layout.highlightShapeLayout), shapes.exit().remove(), shapes;
|
32574 | }, DonutChart.isSingleColor = function(dataPoints) {
|
32575 | if (dataPoints.length > 1) {
|
32576 | var lastPoint = dataPoints.length - 1;
|
32577 | dataPoints[lastPoint].data.isLastInDonut = dataPoints[lastPoint].data.color === dataPoints[0].data.color;
|
32578 | }
|
32579 | }, DonutChart.drawStrokeForDonutChart = function(radius, innerArcRadiusRatio, d, sliceWidthRatio, highlightRatio) {
|
32580 | void 0 === highlightRatio && (highlightRatio = 1);
|
32581 | var sectionWithoutStroke, sectionWithStroke, sliceRadius = radius * innerArcRadiusRatio * highlightRatio, sliceArc = (d.endAngle - d.startAngle) * sliceRadius;
|
32582 | if (sliceWidthRatio) {
|
32583 | var innerRadius = radius * sliceWidthRatio, outerRadius = highlightRatio * radius * (DonutChart.InnerArcRadiusRatio - sliceWidthRatio), innerSliceArc = (d.endAngle - d.startAngle) * innerRadius;
|
32584 | if (d.data.highlightRatio && (sliceArc = (d.endAngle - d.startAngle) * (outerRadius + innerRadius)),
|
32585 | d.data.isLastInDonut) return "0 " + sliceArc + " " + outerRadius + " " + innerSliceArc + " " + outerRadius;
|
32586 | sectionWithoutStroke = sliceArc + outerRadius + innerSliceArc, sectionWithStroke = outerRadius;
|
32587 | } else d.data.isLastInDonut ? (sectionWithoutStroke = sliceArc, sectionWithStroke = 2 * sliceRadius) : (sectionWithoutStroke = sliceArc + sliceRadius,
|
32588 | sectionWithStroke = sliceRadius);
|
32589 | return "0 " + sectionWithoutStroke + " " + sectionWithStroke;
|
32590 | }, DonutChart.prototype.onClearSelection = function() {
|
32591 | this.interactivityService && this.interactivityService.clearSelection();
|
32592 | }, DonutChart.getLayout = function(radius, sliceWidthRatio, viewport) {
|
32593 | var innerRadius = radius * sliceWidthRatio, arc = d3.svg.arc().innerRadius(innerRadius), arcWithRadius = arc.outerRadius(radius * DonutChart.InnerArcRadiusRatio);
|
32594 | return {
|
32595 | shapeLayout: {
|
32596 | d: function(d) {
|
32597 | return arcWithRadius(d);
|
32598 | }
|
32599 | },
|
32600 | highlightShapeLayout: {
|
32601 | d: function(d) {
|
32602 | var highlightArc = arc.outerRadius(DonutChart.getHighlightRadius(radius, sliceWidthRatio, d.data.highlightRatio));
|
32603 | return highlightArc(d);
|
32604 | }
|
32605 | },
|
32606 | zeroShapeLayout: {
|
32607 | d: function(d) {
|
32608 | var zeroWithZeroRadius = arc.outerRadius(innerRadius || DonutChart.EffectiveZeroValue);
|
32609 | return zeroWithZeroRadius(d);
|
32610 | }
|
32611 | }
|
32612 | };
|
32613 | }, DonutChart.getHighlightRadius = function(radius, sliceWidthRatio, highlightRatio) {
|
32614 | var innerRadius = radius * sliceWidthRatio;
|
32615 | return innerRadius + highlightRatio * radius * (DonutChart.InnerArcRadiusRatio - sliceWidthRatio);
|
32616 | }, DonutChart.cullDataByViewport = function(dataPoints, maxValue, viewport) {
|
32617 | for (var prevPointColor, estimatedRadius = Math.min(viewport.width, viewport.height) / 2, cullRatio = this.invisibleArcLengthInPixels / (estimatedRadius * DonutChart.twoPi), cullableValue = cullRatio * maxValue, culledDataPoints = [], _i = 0, dataPoints_1 = dataPoints; _i < dataPoints_1.length; _i++) {
|
32618 | var datapoint = dataPoints_1[_i];
|
32619 | datapoint.measure >= cullableValue && (datapoint.strokeWidth = prevPointColor === datapoint.color ? 1 : 0,
|
32620 | prevPointColor = datapoint.color, culledDataPoints.push(datapoint));
|
32621 | }
|
32622 | return culledDataPoints;
|
32623 | }, DonutChart.ClassName = "donutChart", DonutChart.InteractiveLegendClassName = "donutLegend",
|
32624 | DonutChart.InteractiveLegendArrowClassName = "donutLegendArrow", DonutChart.OuterArcRadiusRatio = .9,
|
32625 | DonutChart.InnerArcRadiusRatio = .8, DonutChart.OpaqueOpacity = 1, DonutChart.SemiTransparentOpacity = .6,
|
32626 | DonutChart.defaultSliceWidthRatio = .48, DonutChart.invisibleArcLengthInPixels = 3,
|
32627 | DonutChart.sliceClass = createClassAndSelector("slice"), DonutChart.sliceHighlightClass = createClassAndSelector("slice-highlight"),
|
32628 | DonutChart.twoPi = 2 * Math.PI, DonutChart.InteractiveLegendContainerHeight = 70,
|
32629 | DonutChart.EffectiveZeroValue = 1e-9, DonutChart.PolylineOpacity = .5, DonutChart;
|
32630 | }();
|
32631 | visuals.DonutChart = DonutChart;
|
32632 | var DonutChartConversion, DonutChartInteractiveLegend = function() {
|
32633 | function DonutChartInteractiveLegend(donutChart, legendContainer, colors, visualInitOptions, settings) {
|
32634 | this.legendContainerParent = legendContainer, this.colors = colors, this.donutChart = donutChart,
|
32635 | this.visualInitOptions = visualInitOptions, this.legendItemsPositions = [], this.legendTransitionAnimationDuration = settings && settings.legendTransitionAnimationDuration ? settings.legendTransitionAnimationDuration : 0;
|
32636 | }
|
32637 | return DonutChartInteractiveLegend.prototype.drawLegend = function(data) {
|
32638 | var _this = this;
|
32639 | this.data = data, this.currentNumberOfLegendItems = data.length, this.currentIndex = 0,
|
32640 | this.leftMostIndex = 0, this.rightMostIndex = data.length - 1, this.legendContainerParent.select(DonutChartInteractiveLegend.LegendContainerSelector).empty() && (this.legendContainer = this.legendContainerParent.append("div").classed(DonutChartInteractiveLegend.LegendContainerClassName, !0));
|
32641 | var legendItems = this.legendContainer.selectAll(DonutChartInteractiveLegend.LegendItemSelector).data(data), legendContainerWidth = this.legendContainerWidth = this.legendContainer.node().getBoundingClientRect().width, initialXOffset = legendContainerWidth / 2 - .4 * legendContainerWidth / 2 + DonutChartInteractiveLegend.ItemMargin, currX = initialXOffset;
|
32642 | this.currentXOffset = initialXOffset;
|
32643 | var createLegendItem = function(itemDiv, datum) {
|
32644 | itemDiv.attr("data-legend-index", datum.index).css({
|
32645 | position: "absolute",
|
32646 | left: currX
|
32647 | });
|
32648 | var itemCategory = visuals.valueFormatter.format(datum.label), itemValue = visuals.valueFormatter.format(datum.originalMeasure, datum.measureFormat), itemPercentage = visuals.valueFormatter.format(datum.percentage, "0.00 %;-0.00 %;0.00 %"), itemColor = datum.color, itemValueSpan = DonutChartInteractiveLegend.createBasicLegendItemSpan(DonutChartInteractiveLegend.LegendItemValueClassName, itemValue, 11), itemCategorySpan = DonutChartInteractiveLegend.createBasicLegendItemSpan(DonutChartInteractiveLegend.LegendItemCategoryClassName, itemCategory, 11), itemPercentageSpan = DonutChartInteractiveLegend.createBasicLegendItemSpan(DonutChartInteractiveLegend.LegendItemPercentageClassName, itemPercentage, 20), valueSpanWidth = DonutChartInteractiveLegend.spanWidth(itemValueSpan), categorySpanWidth = DonutChartInteractiveLegend.spanWidth(itemCategorySpan), precentageSpanWidth = DonutChartInteractiveLegend.spanWidth(itemPercentageSpan), currentLegendBoxWidth = DonutChartInteractiveLegend.legendBoxSize(valueSpanWidth, categorySpanWidth, precentageSpanWidth);
|
32649 | itemDiv.css("width", currentLegendBoxWidth);
|
32650 | var getLeftValue = function(spanWidth) {
|
32651 | return currentLegendBoxWidth - spanWidth > 0 ? (currentLegendBoxWidth - spanWidth) / 2 : 0;
|
32652 | }, marginLeftValue = getLeftValue(valueSpanWidth), marginLeftCategory = getLeftValue(categorySpanWidth), marginLeftPrecentage = getLeftValue(precentageSpanWidth);
|
32653 | DonutChartInteractiveLegend.createLegendItemSpan(itemCategorySpan, marginLeftCategory),
|
32654 | DonutChartInteractiveLegend.createLegendItemSpan(itemValueSpan, marginLeftValue),
|
32655 | DonutChartInteractiveLegend.createLegendItemSpan(itemPercentageSpan, marginLeftPrecentage).css("color", itemColor),
|
32656 | itemDiv.append(itemCategorySpan), itemDiv.append(itemPercentageSpan), itemDiv.append(itemValueSpan),
|
32657 | _this.legendItemsPositions.push({
|
32658 | startX: currX,
|
32659 | boxWidth: currentLegendBoxWidth
|
32660 | }), currX += currentLegendBoxWidth + DonutChartInteractiveLegend.ItemMargin;
|
32661 | };
|
32662 | legendItems.enter().insert("div").classed(DonutChartInteractiveLegend.LegendItemClassName, !0).each(function(d) {
|
32663 | createLegendItem($(this), d);
|
32664 | }), legendItems.exit().remove(), this.assignInteractions();
|
32665 | }, DonutChartInteractiveLegend.prototype.updateLegend = function(sliceIndex) {
|
32666 | var _this = this, legendContainerWidth = this.legendContainerWidth;
|
32667 | this.currentIndex = sliceIndex, this.updateLabelBlocks(sliceIndex);
|
32668 | var legendTransitionAnimationDuration = this.legendTransitionAnimationDuration, nextXOffset = -1 * (this.legendItemsPositions[sliceIndex].startX + this.legendItemsPositions[sliceIndex].boxWidth / 2 - legendContainerWidth / 2);
|
32669 | this.legendContainer.transition().styleTween("-webkit-transform", function(d, i, a) {
|
32670 | return d3.interpolate(visuals.SVGUtil.translateWithPixels(_this.currentXOffset, 0), visuals.SVGUtil.translateWithPixels(nextXOffset, 0));
|
32671 | }).styleTween("transform", function(d, i, a) {
|
32672 | return d3.interpolate(visuals.SVGUtil.translateWithPixels(_this.currentXOffset, 0), visuals.SVGUtil.translateWithPixels(nextXOffset, 0));
|
32673 | }).duration(legendTransitionAnimationDuration).ease("bounce").each("end", function() {
|
32674 | _this.currentXOffset = nextXOffset;
|
32675 | }), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.visualInitOptions);
|
32676 | }, DonutChartInteractiveLegend.prototype.assignInteractions = function() {
|
32677 | var _this = this, currentDX = 0, hasChanged = !1, dragStart = function() {
|
32678 | currentDX = 0, hasChanged = !1;
|
32679 | }, dragMove = function() {
|
32680 | if (currentDX += d3.event.dx, !(hasChanged || Math.abs(currentDX) < DonutChartInteractiveLegend.MinimumSwipeDX)) {
|
32681 | var dragDirectionLeft = 0 > currentDX;
|
32682 | _this.dragLegend(dragDirectionLeft), hasChanged = !0;
|
32683 | }
|
32684 | }, drag = d3.behavior.drag().origin(Object).on("drag", dragMove).on("dragstart", dragStart);
|
32685 | this.legendContainer.style({
|
32686 | "touch-action": "none",
|
32687 | cursor: "pointer"
|
32688 | }).call(drag);
|
32689 | }, DonutChartInteractiveLegend.prototype.dragLegend = function(dragDirectionLeft) {
|
32690 | this.currentNumberOfLegendItems > DonutChartInteractiveLegend.MinimumItemsInLegendForCycled - 1 ? this.currentIndex = this.getCyclingCurrentIndex(dragDirectionLeft) : this.shouldChangeIndexInNonCycling(dragDirectionLeft) && (dragDirectionLeft ? this.currentIndex++ : this.currentIndex--),
|
32691 | this.donutChart.setInteractiveChosenSlice(this.currentIndex);
|
32692 | }, DonutChartInteractiveLegend.prototype.shouldChangeIndexInNonCycling = function(dragDirectionLeft) {
|
32693 | return !(0 === this.currentIndex && !dragDirectionLeft || this.currentIndex === this.currentNumberOfLegendItems - 1 && dragDirectionLeft);
|
32694 | }, DonutChartInteractiveLegend.prototype.getCyclingCurrentIndex = function(dragDirectionLeft) {
|
32695 | var dataLen = this.data.length, delta = dragDirectionLeft ? 1 : -1, newIndex = (this.currentIndex + delta) % (dataLen || 1);
|
32696 | return 0 > newIndex ? newIndex + dataLen : newIndex;
|
32697 | }, DonutChartInteractiveLegend.prototype.updateLegendItemsBlocks = function(rightSidedShift, numberOfLegendItemsBlocksToShift) {
|
32698 | var legendContainer$ = $(this.legendContainer[0]);
|
32699 | if (rightSidedShift) {
|
32700 | var smallestItem = legendContainer$.find("[data-legend-index=" + this.leftMostIndex + "]");
|
32701 | smallestItem.remove().insertAfter(legendContainer$.find("[data-legend-index=" + this.rightMostIndex + "]"));
|
32702 | var newX = this.legendItemsPositions[this.rightMostIndex].startX + this.legendItemsPositions[this.rightMostIndex].boxWidth + DonutChartInteractiveLegend.ItemMargin;
|
32703 | this.legendItemsPositions[this.leftMostIndex].startX = newX, smallestItem.css("left", newX),
|
32704 | this.rightMostIndex = this.leftMostIndex, this.leftMostIndex = (this.leftMostIndex + 1) % this.data.length;
|
32705 | } else {
|
32706 | var highestItem = legendContainer$.find("[data-legend-index=" + this.rightMostIndex + "]");
|
32707 | highestItem.remove().insertBefore(legendContainer$.find("[data-legend-index=" + this.leftMostIndex + "]"));
|
32708 | var newX = this.legendItemsPositions[this.leftMostIndex].startX - this.legendItemsPositions[this.rightMostIndex].boxWidth - DonutChartInteractiveLegend.ItemMargin;
|
32709 | this.legendItemsPositions[this.rightMostIndex].startX = newX, highestItem.css("left", newX),
|
32710 | this.leftMostIndex = this.rightMostIndex, this.rightMostIndex = this.rightMostIndex - 1 === -1 ? this.legendItemsPositions.length - 1 : this.rightMostIndex - 1;
|
32711 | }
|
32712 | numberOfLegendItemsBlocksToShift - 1 !== 0 && this.updateLegendItemsBlocks(rightSidedShift, numberOfLegendItemsBlocksToShift - 1);
|
32713 | }, DonutChartInteractiveLegend.prototype.updateLabelBlocks = function(index) {
|
32714 | this.currentNumberOfLegendItems > DonutChartInteractiveLegend.MinimumItemsInLegendForCycled ? (this.rightMostIndex === index && this.updateLegendItemsBlocks(!0, 2),
|
32715 | this.leftMostIndex === index && this.updateLegendItemsBlocks(!1, 2), (this.rightMostIndex === index + 1 || 0 === this.rightMostIndex && index === this.currentNumberOfLegendItems - 1) && this.updateLegendItemsBlocks(!0, 1),
|
32716 | (this.leftMostIndex === index - 1 || this.leftMostIndex === this.currentNumberOfLegendItems - 1 && 0 === index) && this.updateLegendItemsBlocks(!1, 1)) : this.currentNumberOfLegendItems === DonutChartInteractiveLegend.MinimumItemsInLegendForCycled && (this.rightMostIndex === index && this.updateLegendItemsBlocks(!0, 1),
|
32717 | this.leftMostIndex === index && this.updateLegendItemsBlocks(!1, 1));
|
32718 | }, DonutChartInteractiveLegend.createBasicLegendItemSpan = function(spanClass, text, fontSize) {
|
32719 | return $("<span/>").addClass(spanClass).css({
|
32720 | "white-space": "nowrap",
|
32721 | "font-size": fontSize + "px"
|
32722 | }).text(text);
|
32723 | }, DonutChartInteractiveLegend.createLegendItemSpan = function(existingSpan, marginLeft) {
|
32724 | return existingSpan.css({
|
32725 | overflow: "hidden",
|
32726 | "text-overflow": "ellipsis",
|
32727 | display: "inline-block",
|
32728 | width: "100%",
|
32729 | "margin-left": marginLeft
|
32730 | }), existingSpan;
|
32731 | }, DonutChartInteractiveLegend.legendBoxSize = function(valueSpanWidth, categorySpanWidth, precentageSpanWidth) {
|
32732 | var boxSize = valueSpanWidth > categorySpanWidth ? valueSpanWidth : categorySpanWidth;
|
32733 | return boxSize = boxSize > precentageSpanWidth ? boxSize : precentageSpanWidth,
|
32734 | boxSize = boxSize > DonutChartInteractiveLegend.MaxLegendItemBoxSize ? DonutChartInteractiveLegend.MaxLegendItemBoxSize : boxSize + 2;
|
32735 | }, DonutChartInteractiveLegend.spanWidth = function(span) {
|
32736 | return this.FakeElementSpan || (this.FakeElementSpan = $("<span>").hide().appendTo(document.body)),
|
32737 | this.FakeElementSpan.empty(), this.FakeElementSpan.append(span), this.FakeElementSpan.width();
|
32738 | }, DonutChartInteractiveLegend.LegendContainerClassName = "legend-container", DonutChartInteractiveLegend.LegendContainerSelector = ".legend-container",
|
32739 | DonutChartInteractiveLegend.LegendItemClassName = "legend-item", DonutChartInteractiveLegend.LegendItemSelector = ".legend-item",
|
32740 | DonutChartInteractiveLegend.LegendItemCategoryClassName = "category", DonutChartInteractiveLegend.LegendItemPercentageClassName = "percentage",
|
32741 | DonutChartInteractiveLegend.LegendItemValueClassName = "value", DonutChartInteractiveLegend.MaxLegendItemBoxSize = 160,
|
32742 | DonutChartInteractiveLegend.ItemMargin = 30, DonutChartInteractiveLegend.MinimumSwipeDX = 15,
|
32743 | DonutChartInteractiveLegend.MinimumItemsInLegendForCycled = 3, DonutChartInteractiveLegend;
|
32744 | }();
|
32745 | !function(DonutChartConversion) {
|
32746 | var DonutChartConverter = function() {
|
32747 | function DonutChartConverter(dataView, colors, defaultDataPointColor, tooltipsEnabled, tooltipBucketEnabled) {
|
32748 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
32749 | var reader = this.reader = powerbi.data.createIDataViewCategoricalReader(dataView), dataViewCategorical = dataView.categorical;
|
32750 | if (this.dataViewCategorical = dataViewCategorical, this.dataViewMetadata = dataView.metadata,
|
32751 | this.tooltipsEnabled = tooltipsEnabled, this.tooltipBucketEnabled = tooltipBucketEnabled,
|
32752 | this.colorHelper = new visuals.ColorHelper(colors, visuals.donutChartProps.dataPoint.fill, defaultDataPointColor),
|
32753 | this.maxValue = 0, this.hasNegativeValues = !1, this.allValuesAreNegative = !1,
|
32754 | dataViewCategorical.categories && dataViewCategorical.categories.length > 0) {
|
32755 | var category = dataViewCategorical.categories[0];
|
32756 | this.categoryIdentities = category.identity, this.categoryValues = category.values,
|
32757 | this.allCategoryObjects = category.objects, this.categoryColumnRef = category.identityFields,
|
32758 | this.categoryFormatString = visuals.valueFormatter.getFormatString(category.source, visuals.donutChartProps.general.formatString);
|
32759 | }
|
32760 | if (this.isDynamicSeries = reader.hasDynamicSeries(), this.highlightsOverflow = !1,
|
32761 | this.total = 0, this.highlightTotal = 0, this.dataPoints = [], this.legendDataPoints = [],
|
32762 | this.dataLabelsSettings = null, reader.hasValues("Y")) {
|
32763 | var seriesCount = this.seriesCount = reader.getSeriesCount("Y");
|
32764 | this.hasHighlights = reader.hasHighlights("Y");
|
32765 | var categoryCount = reader.getCategoryCount() || 1;
|
32766 | this.allValuesAreNegative = void 0;
|
32767 | for (var categoryIndex = 0; categoryCount > categoryIndex; categoryIndex++) for (var seriesIndex = 0; seriesCount > seriesIndex; seriesIndex++) {
|
32768 | var value = reader.getValue("Y", categoryIndex, seriesIndex), highlight = void 0;
|
32769 | this.hasHighlights && (highlight = reader.getHighlight("Y", categoryIndex, seriesIndex),
|
32770 | null == highlight && (highlight = 0)), void 0 === this.allValuesAreNegative ? this.allValuesAreNegative = (this.hasHighlights ? 0 >= highlight : !0) && 0 >= value : this.allValuesAreNegative = this.allValuesAreNegative && (this.hasHighlights ? 0 >= highlight : !0) && 0 >= value,
|
32771 | this.hasNegativeValues || (this.hasNegativeValues = 0 > value || (this.hasHighlights ? 0 > highlight : !1));
|
32772 | }
|
32773 | this.allValuesAreNegative = !!this.allValuesAreNegative;
|
32774 | for (var categoryIndex = 0; categoryCount > categoryIndex; categoryIndex++) for (var seriesIndex = 0; seriesCount > seriesIndex; seriesIndex++) {
|
32775 | var value = reader.getValue("Y", categoryIndex, seriesIndex);
|
32776 | if (value = DonutChartConverter.normalizedValue(value, this.allValuesAreNegative),
|
32777 | this.total += value, this.hasHighlights) {
|
32778 | var highlight = reader.getHighlight("Y", categoryIndex, seriesIndex);
|
32779 | highlight = DonutChartConverter.normalizedValue(highlight, this.allValuesAreNegative),
|
32780 | this.highlightTotal += highlight, !this.highlightsOverflow && highlight > value && (this.highlightsOverflow = !0);
|
32781 | }
|
32782 | }
|
32783 | }
|
32784 | }
|
32785 | return DonutChartConverter.normalizedValue = function(value, allValuesAreNegative) {
|
32786 | return null == value || isNaN(value) ? 0 : value === Number.POSITIVE_INFINITY ? Number.MAX_VALUE : value === Number.NEGATIVE_INFINITY ? -Number.MAX_VALUE : allValuesAreNegative ? Math.abs(value) : 0 > value ? 0 : value;
|
32787 | }, DonutChartConverter.prototype.convert = function() {
|
32788 | var convertedData, reader = this.reader;
|
32789 | convertedData = 0 !== this.total ? this.categoryValues ? this.convertCategoricalWithSlicing() : this.isDynamicSeries ? this.convertSeries() : this.convertMeasures() : [],
|
32790 | this.dataLabelsSettings = this.convertDataLabelSettings();
|
32791 | var dataViewMetadata = this.dataViewMetadata;
|
32792 | if (dataViewMetadata) {
|
32793 | var objects = dataViewMetadata.objects;
|
32794 | objects && (this.legendObjectProperties = objects.legend);
|
32795 | }
|
32796 | var category = _.isEmpty(this.dataViewCategorical.categories) ? null : this.dataViewCategorical.categories[0];
|
32797 | this.dataPoints = [];
|
32798 | for (var prevPointColor, formatStringProp = visuals.donutChartProps.general.formatString, pctFormatString = visuals.valueFormatter.getLocalizedString("Percentage"), i = 0, dataPointCount = convertedData.length; dataPointCount > i; i++) {
|
32799 | var point = convertedData[i], originalMeasure = point.measure, normalizedMeasure = DonutChartConverter.normalizedValue(point.measure, this.allValuesAreNegative), originalHighlight = point.highlightMeasure, normalizedHighlight = DonutChartConverter.normalizedValue(point.highlightMeasure, this.allValuesAreNegative), percentage = this.total > 0 ? normalizedMeasure / this.total : 0, highlightRatio = void 0, highlightPercentage = void 0;
|
32800 | normalizedMeasure > this.maxValue && (this.maxValue = normalizedMeasure), normalizedHighlight > this.maxValue && (this.maxValue = normalizedHighlight),
|
32801 | this.hasHighlights && (this.highlightsOverflow ? (originalMeasure = originalHighlight,
|
32802 | normalizedMeasure = normalizedHighlight, percentage = this.highlightTotal > 0 ? normalizedHighlight / this.highlightTotal : 0,
|
32803 | highlightRatio = 1) : highlightRatio = 0 !== normalizedMeasure ? normalizedHighlight / normalizedMeasure : 0,
|
32804 | highlightRatio || (highlightRatio = DonutChart.EffectiveZeroValue), highlightPercentage = percentage * highlightRatio);
|
32805 | var categoryValue = point.categoryLabel, categorical = this.dataViewCategorical, valueIndex = void 0;
|
32806 | valueIndex = null != point.seriesIndex ? point.seriesIndex : i;
|
32807 | var valuesMetadata = reader.getValueMetadataColumn("Y", valueIndex), value = this.hasHighlights && this.highlightsOverflow ? originalHighlight : originalMeasure, highlightValue = this.hasHighlights && !this.highlightsOverflow ? originalHighlight : void 0, formatString = visuals.valueFormatter.getFormatString(valuesMetadata, formatStringProp), pct = visuals.valueFormatter.format(percentage, pctFormatString), valueAndPct = void 0;
|
32808 | null != value && null != pct && (valueAndPct = visuals.valueFormatter.format(value, formatString) + " (" + pct + ")");
|
32809 | var highlightValueAndPct = void 0;
|
32810 | if (null != highlightValue && null != highlightPercentage) {
|
32811 | var highlightedPct = visuals.valueFormatter.format(highlightPercentage, pctFormatString);
|
32812 | highlightValueAndPct = visuals.valueFormatter.format(highlightValue, formatString) + " (" + highlightedPct + ")";
|
32813 | }
|
32814 | var tooltipInfo = void 0;
|
32815 | this.tooltipsEnabled && (tooltipInfo = [], category && tooltipInfo.push({
|
32816 | displayName: category.source.displayName,
|
32817 | value: categoryValue
|
32818 | }), this.isDynamicSeries && (category && category.source === categorical.values.source || tooltipInfo.push({
|
32819 | displayName: categorical.values.source.displayName,
|
32820 | value: point.label
|
32821 | })), null != valueAndPct && tooltipInfo.push({
|
32822 | displayName: valuesMetadata.displayName,
|
32823 | value: valueAndPct
|
32824 | }), null != highlightValueAndPct && tooltipInfo.push({
|
32825 | displayName: visuals.ToolTipComponent.localizationOptions.highlightedValueDisplayName,
|
32826 | value: highlightValueAndPct
|
32827 | }), this.tooltipBucketEnabled && visuals.TooltipBuilder.addTooltipBucketItem(reader, tooltipInfo, this.categoryValues ? point.categoryIndex : 0, this.isDynamicSeries ? point.seriesIndex : void 0));
|
32828 | var strokeWidth = prevPointColor === point.color && percentage && percentage > 0 ? 1 : 0;
|
32829 | prevPointColor = percentage && percentage > 0 ? point.color : prevPointColor, this.dataPoints.push({
|
32830 | identity: point.identity,
|
32831 | measure: normalizedMeasure,
|
32832 | originalMeasure: originalMeasure,
|
32833 | measureFormat: point.measureFormat,
|
32834 | percentage: percentage,
|
32835 | index: point.index,
|
32836 | label: point.label,
|
32837 | highlightRatio: highlightRatio,
|
32838 | highlightValue: this.hasHighlights && !this.highlightsOverflow ? normalizedHighlight : void 0,
|
32839 | originalHighlightValue: this.hasHighlights && !this.highlightsOverflow ? originalHighlight : void 0,
|
32840 | selected: !1,
|
32841 | tooltipInfo: tooltipInfo,
|
32842 | color: point.color,
|
32843 | strokeWidth: strokeWidth,
|
32844 | labelFormatString: valuesMetadata.format
|
32845 | });
|
32846 | }
|
32847 | this.legendData = this.convertLegendData();
|
32848 | }, DonutChartConverter.prototype.getLegendTitle = function() {
|
32849 | if (0 !== this.total) {
|
32850 | var dvValuesSourceName = this.dataViewCategorical.values && this.dataViewCategorical.values.source ? this.dataViewCategorical.values.source.displayName : "", dvCategorySourceName = this.dataViewCategorical.categories && this.dataViewCategorical.categories.length > 0 && this.dataViewCategorical.categories[0].source ? this.dataViewCategorical.categories[0].source.displayName : "";
|
32851 | return this.categoryValues ? dvCategorySourceName : dvValuesSourceName;
|
32852 | }
|
32853 | return "";
|
32854 | }, DonutChartConverter.prototype.convertCategoricalWithSlicing = function() {
|
32855 | for (var reader = this.reader, dataViewCategorical = this.dataViewCategorical, formatStringProp = visuals.donutChartProps.general.formatString, dataPoints = [], categoryIndex = 0, categoryCount = this.categoryValues.length; categoryCount > categoryIndex; categoryIndex++) {
|
32856 | for (var categoryValue = this.categoryValues[categoryIndex], thisCategoryObjects = this.allCategoryObjects ? this.allCategoryObjects[categoryIndex] : void 0, legendIdentity = visuals.SelectionId.createWithId(this.categoryIdentities[categoryIndex]), color = this.colorHelper.getColorForSeriesValue(thisCategoryObjects, this.categoryColumnRef, categoryValue), categoryLabel = visuals.valueFormatter.format(categoryValue, this.categoryFormatString), seriesIndex = 0; seriesIndex < this.seriesCount; seriesIndex++) {
|
32857 | var value = reader.getValue("Y", categoryIndex, seriesIndex), highlightValue = this.hasHighlights ? reader.getHighlight("Y", categoryIndex, seriesIndex) : void 0, valueColumn = reader.getValueColumn("Y", seriesIndex), label = categoryLabel;
|
32858 | (this.isDynamicSeries || reader.getSeriesCount("Y") > 1) && (label = visuals.converterHelper.getFormattedLegendLabel(valueColumn.source, dataViewCategorical.values, formatStringProp));
|
32859 | var measure = valueColumn.source.queryName, identity = visuals.SelectionIdBuilder.builder().withCategory(dataViewCategorical.categories[0], categoryIndex).withSeries(dataViewCategorical.values, this.isDynamicSeries ? valueColumn : void 0).withMeasure(measure).createSelectionId(), dataPoint = {
|
32860 | identity: identity,
|
32861 | measureFormat: visuals.valueFormatter.getFormatString(valueColumn.source, formatStringProp, !0),
|
32862 | measure: value,
|
32863 | highlightMeasure: highlightValue,
|
32864 | index: categoryIndex * this.seriesCount + seriesIndex,
|
32865 | label: label,
|
32866 | categoryLabel: categoryLabel,
|
32867 | color: color,
|
32868 | categoryIndex: categoryIndex,
|
32869 | seriesIndex: seriesIndex
|
32870 | };
|
32871 | dataPoints.push(dataPoint);
|
32872 | }
|
32873 | this.legendDataPoints.push({
|
32874 | label: categoryLabel,
|
32875 | color: color,
|
32876 | icon: visuals.LegendIcon.Box,
|
32877 | identity: legendIdentity,
|
32878 | selected: !1
|
32879 | });
|
32880 | }
|
32881 | return dataPoints;
|
32882 | }, DonutChartConverter.prototype.convertMeasures = function() {
|
32883 | for (var reader = this.reader, dataPoints = [], formatStringProp = visuals.donutChartProps.general.formatString, measureIndex = 0; measureIndex < this.seriesCount; measureIndex++) {
|
32884 | var value = reader.getValue("Y", 0, measureIndex), highlightValue = this.hasHighlights ? reader.getHighlight("Y", 0, measureIndex) : void 0, valueColumn = reader.getValueColumn("Y", measureIndex), measureFormat = visuals.valueFormatter.getFormatString(valueColumn.source, formatStringProp, !0), measureLabel = valueColumn.source.displayName, identity = visuals.SelectionId.createWithMeasure(valueColumn.source.queryName), color = this.colorHelper.getColorForMeasure(valueColumn.source.objects, valueColumn.source.queryName), dataPoint = {
|
32885 | identity: identity,
|
32886 | measureFormat: measureFormat,
|
32887 | measure: value,
|
32888 | highlightMeasure: highlightValue,
|
32889 | index: measureIndex,
|
32890 | label: measureLabel,
|
32891 | categoryLabel: measureLabel,
|
32892 | color: color
|
32893 | };
|
32894 | dataPoints.push(dataPoint), this.legendDataPoints.push({
|
32895 | label: dataPoint.label,
|
32896 | color: dataPoint.color,
|
32897 | icon: visuals.LegendIcon.Box,
|
32898 | identity: dataPoint.identity,
|
32899 | selected: !1
|
32900 | });
|
32901 | }
|
32902 | return dataPoints;
|
32903 | }, DonutChartConverter.prototype.convertSeries = function() {
|
32904 | for (var reader = this.reader, dataViewCategorical = this.dataViewCategorical, dataPoints = [], formatStringProp = visuals.donutChartProps.general.formatString, seriesIndex = 0; seriesIndex < this.seriesCount; seriesIndex++) {
|
32905 | var value = reader.getValue("Y", 0, seriesIndex), highlightValue = this.hasHighlights ? reader.getHighlight("Y", 0, seriesIndex) : void 0, valueColumn = reader.getValueColumn("Y", seriesIndex), seriesFormat = visuals.valueFormatter.getFormatString(valueColumn.source, formatStringProp, !0), label = visuals.converterHelper.getFormattedLegendLabel(valueColumn.source, dataViewCategorical.values, formatStringProp), identity = new visuals.SelectionIdBuilder().withSeries(dataViewCategorical.values, valueColumn).withMeasure(valueColumn.source.queryName).createSelectionId(), seriesName = visuals.converterHelper.getSeriesName(valueColumn.source), objects = reader.getSeriesObjects(seriesIndex), color = this.colorHelper.getColorForSeriesValue(objects, dataViewCategorical.values.identityFields, seriesName), dataPoint = {
|
32906 | identity: identity,
|
32907 | measureFormat: seriesFormat,
|
32908 | measure: value,
|
32909 | highlightMeasure: highlightValue,
|
32910 | index: seriesIndex,
|
32911 | label: label,
|
32912 | categoryLabel: label,
|
32913 | color: color,
|
32914 | seriesIndex: seriesIndex
|
32915 | };
|
32916 | dataPoints.push(dataPoint), this.legendDataPoints.push({
|
32917 | label: dataPoint.label,
|
32918 | color: dataPoint.color,
|
32919 | icon: visuals.LegendIcon.Box,
|
32920 | identity: dataPoint.identity,
|
32921 | selected: !1
|
32922 | });
|
32923 | }
|
32924 | return dataPoints;
|
32925 | }, DonutChartConverter.prototype.convertDataLabelSettings = function() {
|
32926 | var dataViewMetadata = this.dataViewMetadata, dataLabelsSettings = visuals.dataLabelUtils.getDefaultDonutLabelSettings();
|
32927 | if (dataViewMetadata) {
|
32928 | var objects = dataViewMetadata.objects;
|
32929 | if (objects) {
|
32930 | var labelsObj = objects.labels;
|
32931 | labelsObj && visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(labelsObj, dataLabelsSettings);
|
32932 | }
|
32933 | }
|
32934 | return dataLabelsSettings;
|
32935 | }, DonutChartConverter.prototype.convertLegendData = function() {
|
32936 | return {
|
32937 | dataPoints: this.legendDataPoints,
|
32938 | labelColor: visuals.LegendData.DefaultLegendLabelFillColor,
|
32939 | title: this.getLegendTitle(),
|
32940 | fontSize: visuals.SVGLegend.DefaultFontSizeInPt
|
32941 | };
|
32942 | }, DonutChartConverter;
|
32943 | }();
|
32944 | DonutChartConversion.DonutChartConverter = DonutChartConverter;
|
32945 | }(DonutChartConversion || (DonutChartConversion = {}));
|
32946 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
32947 | }(powerbi || (powerbi = {}));
|
32948 | }, function(module, exports) {
|
32949 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
32950 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
32951 | !function(powerbi) {
|
32952 | var visuals;
|
32953 | !function(visuals) {
|
32954 | var Utility = jsCommon.Utility, ScriptVisual = function() {
|
32955 | function ScriptVisual(options) {
|
32956 | this.canRefresh = options.canRefresh;
|
32957 | }
|
32958 | return ScriptVisual.prototype.init = function(options) {
|
32959 | this.element = options.element, this.hostServices = options.host, this.canRefresh || this.hostServices.setWarnings([ new visuals.ScriptVisualRefreshWarning() ]);
|
32960 | }, ScriptVisual.prototype.update = function(options) {
|
32961 | var dataViews = options.dataViews;
|
32962 | if (dataViews && 0 !== dataViews.length) {
|
32963 | var dataView = dataViews[0];
|
32964 | if (dataView && dataView.metadata) {
|
32965 | var imageUrl = this.getImageUrl(dataView), div = this.ensureHtmlElement();
|
32966 | if (imageUrl && Utility.isValidImageDataUrl(imageUrl)) {
|
32967 | var viewport = options.viewport;
|
32968 | div.css({
|
32969 | height: viewport.height,
|
32970 | width: viewport.width,
|
32971 | backgroundImage: "url(" + imageUrl + ")"
|
32972 | });
|
32973 | } else div.css({
|
32974 | backgroundImage: "none"
|
32975 | });
|
32976 | }
|
32977 | }
|
32978 | }, ScriptVisual.prototype.onResizing = function(finalViewport) {
|
32979 | var div = this.ensureHtmlElement();
|
32980 | div.css({
|
32981 | height: finalViewport.height,
|
32982 | width: finalViewport.width
|
32983 | });
|
32984 | }, ScriptVisual.prototype.getImageUrl = function(dataView) {
|
32985 | return dataView.scriptResult && dataView.scriptResult.imageBase64 ? "data:image/png;base64," + dataView.scriptResult.imageBase64 : null;
|
32986 | }, ScriptVisual.prototype.ensureHtmlElement = function() {
|
32987 | var div = this.imageBackgroundElement;
|
32988 | return div || (div = $("<div class='imageBackground' />"), this.imageBackgroundElement = div,
|
32989 | this.imageBackgroundElement.appendTo(this.element)), div;
|
32990 | }, ScriptVisual;
|
32991 | }();
|
32992 | visuals.ScriptVisual = ScriptVisual;
|
32993 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
32994 | }(powerbi || (powerbi = {}));
|
32995 | }, function(module, exports) {
|
32996 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
32997 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
32998 | !function(powerbi) {
|
32999 | var visuals;
|
33000 | !function(visuals) {
|
33001 | var system;
|
33002 | !function(system) {
|
33003 | var DebugVisual = function() {
|
33004 | function DebugVisual() {}
|
33005 | return DebugVisual.prototype.reloadAdapter = function(auto) {
|
33006 | var _this = this;
|
33007 | if (void 0 === auto && (auto = !1), this.dataViewShowing) {
|
33008 | if (auto) return;
|
33009 | this.toggleDataview(!1);
|
33010 | }
|
33011 | var developerMode = powerbi.localStorageService.getData("DEVELOPER_MODE_ENABLED");
|
33012 | if (!developerMode) {
|
33013 | this.toggleAutoReload(!1);
|
33014 | var errorMessage = this.buildErrorMessage({
|
33015 | message: this.host.getLocalizedString("DebugVisual_Enabled_Error_Message"),
|
33016 | moreMessage: this.host.getLocalizedString("DebugVisual_Enabled_Error_Learn_More"),
|
33017 | moreLinkHref: "https://aka.ms/powerbideveloperenablederror",
|
33018 | moreLinkText: this.host.getLocalizedString("DebugVisual_Enabled_Error_Learn_More_Link"),
|
33019 | type: "blockedsite"
|
33020 | });
|
33021 | return this.container.html(errorMessage), void this.setCapabilities({});
|
33022 | }
|
33023 | var baseUrl = powerbi.localStorageService.getData("DEVELOPMENT_SERVER_URL") || "https://localhost:8080/assets/";
|
33024 | this.statusLoading || (this.statusLoading = !0, $.get(baseUrl + "status").done(function(status) {
|
33025 | if (status && (!auto || _this.lastUpdateStatus !== status)) {
|
33026 | if (_this.lastUpdateStatus = status, "error" === status) {
|
33027 | var errorMessage = _this.buildErrorMessage({
|
33028 | message: _this.host.getLocalizedString("DebugVisual_Compile_Error_Message"),
|
33029 | moreMessage: _this.host.getLocalizedString("DebugVisual_Compile_Error_Learn_More"),
|
33030 | moreLinkHref: "https://aka.ms/powerbideveloperpbivizcompileerror",
|
33031 | moreLinkText: _this.host.getLocalizedString("DebugVisual_Compile_Error_Learn_More_Link"),
|
33032 | type: "repair"
|
33033 | });
|
33034 | return _this.container.html(errorMessage), void _this.setCapabilities({});
|
33035 | }
|
33036 | $.getJSON(baseUrl + "pbiviz.json").done(function(pbivizJson) {
|
33037 | pbivizJson.capabilities && pbivizJson.visual && pbivizJson.visual.guid && (_this.visualGuid !== pbivizJson.visual.guid && (_this.visualGuid = pbivizJson.visual.guid),
|
33038 | $.getScript(baseUrl + "visual.js").done(function() {
|
33039 | powerbi.visuals.plugins[_this.visualGuid] && (powerbi.visuals.plugins[_this.visualGuid].capabilities = pbivizJson.capabilities,
|
33040 | powerbi.extensibility.translateVisualPlugin(powerbi.visuals.plugins[_this.visualGuid]),
|
33041 | $.get(baseUrl + "visual.css").done(function(data) {
|
33042 | $("#css-DEBUG").remove(), $("<style/>", {
|
33043 | id: "css-DEBUG",
|
33044 | html: data
|
33045 | }).appendTo($("head")), _this.loadVisual(_this.visualGuid), _this.setCapabilities(powerbi.visuals.plugins[_this.visualGuid].capabilities);
|
33046 | }));
|
33047 | }));
|
33048 | });
|
33049 | }
|
33050 | }).fail(function() {
|
33051 | _this.toggleAutoReload(!1);
|
33052 | var errorMessage = _this.buildErrorMessage({
|
33053 | message: _this.host.getLocalizedString("DebugVisual_Server_Error_Message"),
|
33054 | moreMessage: _this.host.getLocalizedString("DebugVisual_Server_Error_Learn_More"),
|
33055 | moreLinkHref: "https://aka.ms/powerbideveloperpbivizservererror",
|
33056 | moreLinkText: _this.host.getLocalizedString("DebugVisual_Server_Error_Learn_More_Link"),
|
33057 | type: "error"
|
33058 | });
|
33059 | _this.container.html(errorMessage), _this.setCapabilities({});
|
33060 | }).always(function() {
|
33061 | _this.statusLoading = !1;
|
33062 | }));
|
33063 | }, DebugVisual.prototype.loadVisual = function(guid) {
|
33064 | this.visualContainer.attr("class", "visual-" + guid), this.visualContainer.empty(),
|
33065 | this.container.empty().append(this.visualContainer);
|
33066 | var adapter = this.adapter = powerbi.extensibility.createVisualAdapter(powerbi.visuals.plugins[guid]);
|
33067 | if (adapter.init && adapter.init(this.optionsForVisual), adapter.update && this.lastUpdateOptions) {
|
33068 | var lastUpdateOptions = powerbi.Prototype.inherit(this.lastUpdateOptions);
|
33069 | lastUpdateOptions.type = powerbi.VisualUpdateType.All, adapter.update(lastUpdateOptions);
|
33070 | }
|
33071 | }, DebugVisual.prototype.toggleAutoReload = function(value) {
|
33072 | var _this = this;
|
33073 | this.autoReloadInterval && value !== !0 ? (this.autoRefreshBtn.addClass("pbi-glyph-play"),
|
33074 | this.autoRefreshBtn.removeClass("pbi-glyph-stop"), this.refreshBtn.show(), clearInterval(this.autoReloadInterval),
|
33075 | this.autoReloadInterval = void 0) : this.autoReloadInterval || value === !1 || (this.autoRefreshBtn.removeClass("pbi-glyph-play"),
|
33076 | this.autoRefreshBtn.addClass("pbi-glyph-stop"), this.refreshBtn.hide(), this.autoReloadInterval = setInterval(function() {
|
33077 | return _this.reloadAdapter(!0);
|
33078 | }, DebugVisual.autoReloadPollTime));
|
33079 | }, DebugVisual.prototype.toggleDataview = function(value) {
|
33080 | this.dataViewShowing && value !== !0 ? (this.dataViewShowing = !1, this.dataBtn.toggleClass("active", !1),
|
33081 | this.reloadAdapter()) : this.dataViewShowing || value === !1 || (this.dataViewShowing = !0,
|
33082 | this.dataBtn.toggleClass("active", !0), this.loadVisual("dataViewer"));
|
33083 | }, DebugVisual.prototype.createRefreshBtn = function() {
|
33084 | var _this = this, label = this.host.getLocalizedString("DebugVisual_Reload_Visual_Button_Title"), refreshBtn = this.refreshBtn = $('<i title="' + label + '" class="controlBtn glyphicon pbi-glyph-refresh"></i>');
|
33085 | return refreshBtn.on("click", function() {
|
33086 | return _this.reloadAdapter();
|
33087 | }), refreshBtn;
|
33088 | }, DebugVisual.prototype.createAutoRefreshBtn = function() {
|
33089 | var _this = this, label = this.host.getLocalizedString("DebugVisual_Toggle_Auto_Reload_Button_Title"), autoRefreshBtn = this.autoRefreshBtn = $('<i title="' + label + '" class="controlBtn glyphicon pbi-glyph-play"></i>');
|
33090 | return autoRefreshBtn.on("click", function() {
|
33091 | return _this.toggleAutoReload();
|
33092 | }), autoRefreshBtn;
|
33093 | }, DebugVisual.prototype.createDataBtn = function() {
|
33094 | var _this = this, label = this.host.getLocalizedString("DebugVisual_Show_Dataview_Button_Title"), dataBtn = this.dataBtn = $('<i title="' + label + '" class="controlBtn glyphicon pbi-glyph-seedata"></i>');
|
33095 | return dataBtn.on("click", function() {
|
33096 | return _this.toggleDataview();
|
33097 | }), dataBtn;
|
33098 | }, DebugVisual.prototype.createHelpBtn = function() {
|
33099 | var label = this.host.getLocalizedString("DebugVisual_Help_Button_Title"), helpBtn = $('<a href="https://aka.ms/powerbideveloperhelp" target="_blank"><i title="' + label + '" class="controlBtn glyphicon pbi-glyph-question"></i></a>');
|
33100 | return helpBtn;
|
33101 | }, DebugVisual.prototype.createSmilyBtn = function() {
|
33102 | var label = this.host.getLocalizedString("DebugVisual_Feedback_Button_Title"), smilyBtn = $('<a href="https://aka.ms/powerbideveloperfeedback" target="_blank"><i title="' + label + '" class="controlBtn glyphicon pbi-glyph-smiley"></i></a>');
|
33103 | return smilyBtn;
|
33104 | }, DebugVisual.prototype.buildControls = function() {
|
33105 | var controlsContainer = $('<div class="debugVisual-controlsContainer"></div>');
|
33106 | return controlsContainer.append(this.createRefreshBtn(), this.createAutoRefreshBtn(), this.createDataBtn(), this.createHelpBtn(), this.createSmilyBtn()),
|
33107 | controlsContainer;
|
33108 | }, DebugVisual.prototype.buildErrorMessage = function(options) {
|
33109 | return _.template(DebugVisual.errorMessageTemplate)(options);
|
33110 | }, DebugVisual.prototype.setCapabilities = function(capabilities) {
|
33111 | powerbi.visuals.plugins.debugVisual.capabilities = capabilities, this.host.visualCapabilitiesChanged();
|
33112 | }, DebugVisual.prototype.init = function(options) {
|
33113 | this.host = options.host;
|
33114 | var container = this.container = $('<div class="debugVisualContainer"></div>'), visualContainer = this.visualContainer = $('<div class="visual"></div>');
|
33115 | this.dataViewShowing = !1, container.append(visualContainer), options.element.append(container);
|
33116 | var optionsForVisual = this.optionsForVisual = powerbi.Prototype.inherit(options);
|
33117 | optionsForVisual.element = visualContainer, this.host.setToolbar(this.buildControls()),
|
33118 | this.reloadAdapter();
|
33119 | }, DebugVisual.prototype.update = function(options) {
|
33120 | var visualOptions = this.lastUpdateOptions = powerbi.Prototype.inherit(options), height = options.viewport.height, width = options.viewport.width;
|
33121 | this.visualContainer.height(height).width(width), this.adapter && this.adapter.update && this.adapter.update(visualOptions);
|
33122 | }, DebugVisual.prototype.enumerateObjectInstances = function(options) {
|
33123 | return this.adapter && this.adapter.enumerateObjectInstances ? this.adapter.enumerateObjectInstances(options) : [];
|
33124 | }, DebugVisual.prototype.destroy = function() {
|
33125 | this.adapter && this.adapter.destroy && this.adapter.destroy(), this.toggleAutoReload(!1),
|
33126 | this.container = null, this.visualContainer = null, this.host.setToolbar(null);
|
33127 | }, DebugVisual.capabilities = {}, DebugVisual.autoReloadPollTime = 300, DebugVisual.errorMessageTemplate = '\n <div class="errorContainer">\n <div class="errorMessage">\n <div ng-switch="$ctrl.errorInfo.overlayType">\n <div class="glyphicon pbi-glyph-<%= type %> glyph-med"></div>\n </div>\n <div>\n <div class="errorSpan"><%= message %></div>\n <span class="errorSeeMore"><%= moreMessage %></span>\n <a class="errorSeeMore" href="<%= moreLinkHref %>" target="_blank"><%= moreLinkText %></a>\n </div>\n </div>\n </div>\n ',
|
33128 | DebugVisual;
|
33129 | }();
|
33130 | system.DebugVisual = DebugVisual;
|
33131 | }(system = visuals.system || (visuals.system = {}));
|
33132 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
33133 | }(powerbi || (powerbi = {}));
|
33134 | }, function(module, exports) {
|
33135 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
33136 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
33137 | !function(powerbi) {
|
33138 | var visuals;
|
33139 | !function(visuals) {
|
33140 | var plugins;
|
33141 | !function(plugins) {
|
33142 | plugins.animatedNumber = {
|
33143 | name: "animatedNumber",
|
33144 | capabilities: visuals.capabilities.animatedNumber,
|
33145 | create: function() {
|
33146 | return new visuals.AnimatedNumber();
|
33147 | }
|
33148 | }, plugins.areaChart = {
|
33149 | name: "areaChart",
|
33150 | watermarkKey: "area",
|
33151 | capabilities: visuals.capabilities.lineChart,
|
33152 | create: function() {
|
33153 | return new visuals.CartesianChart({
|
33154 | chartType: 1
|
33155 | });
|
33156 | },
|
33157 | customizeQuery: visuals.LineChart.customizeQuery,
|
33158 | getSortableRoles: function(visualSortableOptions) {
|
33159 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
33160 | },
|
33161 | getAdditionalTelemetry: function(dataView) {
|
33162 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33163 | }
|
33164 | }, plugins.barChart = {
|
33165 | name: "barChart",
|
33166 | watermarkKey: "bar",
|
33167 | capabilities: visuals.capabilities.barChart,
|
33168 | create: function() {
|
33169 | return new visuals.CartesianChart({
|
33170 | chartType: 6
|
33171 | });
|
33172 | },
|
33173 | customizeQuery: visuals.ColumnChart.customizeQuery,
|
33174 | getSortableRoles: function(visualSortableOptions) {
|
33175 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
33176 | },
|
33177 | getAdditionalTelemetry: function(dataView) {
|
33178 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33179 | }
|
33180 | }, plugins.basicShape = {
|
33181 | name: "basicShape",
|
33182 | capabilities: visuals.basicShapeCapabilities,
|
33183 | create: function() {
|
33184 | return new visuals.BasicShapeVisual();
|
33185 | }
|
33186 | }, plugins.card = {
|
33187 | name: "card",
|
33188 | watermarkKey: "card",
|
33189 | capabilities: visuals.capabilities.card,
|
33190 | create: function() {
|
33191 | return new visuals.Card();
|
33192 | }
|
33193 | }, plugins.multiRowCard = {
|
33194 | name: "multiRowCard",
|
33195 | watermarkKey: "multiRowCard",
|
33196 | capabilities: visuals.capabilities.multiRowCard,
|
33197 | create: function() {
|
33198 | return new visuals.MultiRowCard();
|
33199 | },
|
33200 | getSortableRoles: function(visualSortableOptions) {
|
33201 | return visuals.MultiRowCard.getSortableRoles(visualSortableOptions);
|
33202 | }
|
33203 | }, plugins.clusteredBarChart = {
|
33204 | name: "clusteredBarChart",
|
33205 | watermarkKey: "clusteredBar",
|
33206 | capabilities: visuals.capabilities.clusteredBarChart,
|
33207 | create: function() {
|
33208 | return new visuals.CartesianChart({
|
33209 | chartType: 5
|
33210 | });
|
33211 | },
|
33212 | customizeQuery: visuals.ColumnChart.customizeQuery,
|
33213 | getSortableRoles: function(visualSortableOptions) {
|
33214 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
33215 | },
|
33216 | getAdditionalTelemetry: function(dataView) {
|
33217 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33218 | }
|
33219 | }, plugins.clusteredColumnChart = {
|
33220 | name: "clusteredColumnChart",
|
33221 | watermarkKey: "clusteredColumn",
|
33222 | capabilities: visuals.capabilities.clusteredColumnChart,
|
33223 | create: function() {
|
33224 | return new visuals.CartesianChart({
|
33225 | chartType: 3
|
33226 | });
|
33227 | },
|
33228 | customizeQuery: visuals.ColumnChart.customizeQuery,
|
33229 | getSortableRoles: function(visualSortableOptions) {
|
33230 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
33231 | },
|
33232 | getAdditionalTelemetry: function(dataView) {
|
33233 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33234 | }
|
33235 | }, plugins.columnChart = {
|
33236 | name: "columnChart",
|
33237 | watermarkKey: "column",
|
33238 | capabilities: visuals.capabilities.columnChart,
|
33239 | create: function() {
|
33240 | return new visuals.CartesianChart({
|
33241 | chartType: 4
|
33242 | });
|
33243 | },
|
33244 | customizeQuery: visuals.ColumnChart.customizeQuery,
|
33245 | getSortableRoles: function(visualSortableOptions) {
|
33246 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
33247 | },
|
33248 | getAdditionalTelemetry: function(dataView) {
|
33249 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33250 | }
|
33251 | }, plugins.comboChart = {
|
33252 | name: "comboChart",
|
33253 | watermarkKey: "combo",
|
33254 | capabilities: visuals.capabilities.comboChart,
|
33255 | customizeQuery: visuals.ComboChart.customizeQuery,
|
33256 | create: function() {
|
33257 | return new visuals.CartesianChart({
|
33258 | chartType: 10
|
33259 | });
|
33260 | },
|
33261 | getSortableRoles: function(visualSortableOptions) {
|
33262 | return visuals.ComboChart.getSortableRoles(visualSortableOptions);
|
33263 | },
|
33264 | getAdditionalTelemetry: function(dataView) {
|
33265 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33266 | }
|
33267 | }, plugins.dataDotChart = {
|
33268 | name: "dataDotChart",
|
33269 | capabilities: visuals.capabilities.dataDotChart,
|
33270 | create: function() {
|
33271 | return new visuals.CartesianChart({
|
33272 | chartType: 11
|
33273 | });
|
33274 | },
|
33275 | getAdditionalTelemetry: function(dataView) {
|
33276 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33277 | }
|
33278 | }, plugins.dataDotClusteredColumnComboChart = {
|
33279 | name: "dataDotClusteredColumnComboChart",
|
33280 | watermarkKey: "combo",
|
33281 | capabilities: visuals.capabilities.dataDotClusteredColumnComboChart,
|
33282 | customizeQuery: visuals.ComboChart.customizeQuery,
|
33283 | create: function() {
|
33284 | return new visuals.CartesianChart({
|
33285 | chartType: 15
|
33286 | });
|
33287 | },
|
33288 | getAdditionalTelemetry: function(dataView) {
|
33289 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33290 | }
|
33291 | }, plugins.dataDotStackedColumnComboChart = {
|
33292 | name: "dataDotStackedColumnComboChart",
|
33293 | watermarkKey: "combo",
|
33294 | capabilities: visuals.capabilities.dataDotStackedColumnComboChart,
|
33295 | customizeQuery: visuals.ComboChart.customizeQuery,
|
33296 | create: function() {
|
33297 | return new visuals.CartesianChart({
|
33298 | chartType: 16
|
33299 | });
|
33300 | },
|
33301 | getAdditionalTelemetry: function(dataView) {
|
33302 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33303 | }
|
33304 | }, plugins.donutChart = {
|
33305 | name: "donutChart",
|
33306 | watermarkKey: "donut",
|
33307 | capabilities: visuals.capabilities.donutChart,
|
33308 | create: function() {
|
33309 | return new visuals.DonutChart();
|
33310 | }
|
33311 | }, plugins.funnel = {
|
33312 | name: "funnel",
|
33313 | watermarkKey: "funnel",
|
33314 | capabilities: visuals.capabilities.funnel,
|
33315 | create: function() {
|
33316 | return new visuals.FunnelChart();
|
33317 | }
|
33318 | }, plugins.gauge = {
|
33319 | name: "gauge",
|
33320 | watermarkKey: "gauge",
|
33321 | capabilities: visuals.capabilities.gauge,
|
33322 | create: function() {
|
33323 | return new visuals.Gauge();
|
33324 | }
|
33325 | }, plugins.hundredPercentStackedBarChart = {
|
33326 | name: "hundredPercentStackedBarChart",
|
33327 | watermarkKey: "100stackedbar",
|
33328 | capabilities: visuals.capabilities.hundredPercentStackedBarChart,
|
33329 | create: function() {
|
33330 | return new visuals.CartesianChart({
|
33331 | chartType: 7
|
33332 | });
|
33333 | },
|
33334 | customizeQuery: visuals.ColumnChart.customizeQuery,
|
33335 | getSortableRoles: function(visualSortableOptions) {
|
33336 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
33337 | },
|
33338 | getAdditionalTelemetry: function(dataView) {
|
33339 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33340 | }
|
33341 | }, plugins.hundredPercentStackedColumnChart = {
|
33342 | name: "hundredPercentStackedColumnChart",
|
33343 | watermarkKey: "100stackedcolumn",
|
33344 | capabilities: visuals.capabilities.hundredPercentStackedColumnChart,
|
33345 | create: function() {
|
33346 | return new visuals.CartesianChart({
|
33347 | chartType: 8
|
33348 | });
|
33349 | },
|
33350 | customizeQuery: visuals.ColumnChart.customizeQuery,
|
33351 | getSortableRoles: function(visualSortableOptions) {
|
33352 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
33353 | },
|
33354 | getAdditionalTelemetry: function(dataView) {
|
33355 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33356 | }
|
33357 | }, plugins.image = {
|
33358 | name: "image",
|
33359 | capabilities: visuals.capabilities.image,
|
33360 | create: function() {
|
33361 | return new visuals.ImageVisual();
|
33362 | }
|
33363 | }, plugins.lineChart = {
|
33364 | name: "lineChart",
|
33365 | watermarkKey: "line",
|
33366 | capabilities: visuals.capabilities.lineChart,
|
33367 | create: function() {
|
33368 | return new visuals.CartesianChart({
|
33369 | chartType: 0
|
33370 | });
|
33371 | },
|
33372 | customizeQuery: visuals.LineChart.customizeQuery,
|
33373 | getSortableRoles: function(visualSortableOptions) {
|
33374 | return visuals.LineChart.getSortableRoles(visualSortableOptions);
|
33375 | },
|
33376 | getAdditionalTelemetry: function(dataView) {
|
33377 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33378 | }
|
33379 | }, plugins.lineStackedColumnComboChart = {
|
33380 | name: "lineStackedColumnComboChart",
|
33381 | watermarkKey: "combo",
|
33382 | capabilities: visuals.capabilities.lineStackedColumnComboChart,
|
33383 | customizeQuery: visuals.ComboChart.customizeQuery,
|
33384 | create: function() {
|
33385 | return new visuals.CartesianChart({
|
33386 | chartType: 14
|
33387 | });
|
33388 | },
|
33389 | getSortableRoles: function(visualSortableOptions) {
|
33390 | return visuals.ComboChart.getSortableRoles(visualSortableOptions);
|
33391 | },
|
33392 | getAdditionalTelemetry: function(dataView) {
|
33393 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33394 | }
|
33395 | }, plugins.lineClusteredColumnComboChart = {
|
33396 | name: "lineClusteredColumnComboChart",
|
33397 | watermarkKey: "combo",
|
33398 | capabilities: visuals.capabilities.lineClusteredColumnComboChart,
|
33399 | customizeQuery: visuals.ComboChart.customizeQuery,
|
33400 | create: function() {
|
33401 | return new visuals.CartesianChart({
|
33402 | chartType: 13
|
33403 | });
|
33404 | },
|
33405 | getSortableRoles: function(visualSortableOptions) {
|
33406 | return visuals.ComboChart.getSortableRoles(visualSortableOptions);
|
33407 | },
|
33408 | getAdditionalTelemetry: function(dataView) {
|
33409 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33410 | }
|
33411 | }, plugins.map = {
|
33412 | name: "map",
|
33413 | watermarkKey: "map",
|
33414 | capabilities: visuals.capabilities.map,
|
33415 | create: function() {
|
33416 | return new visuals.Map({
|
33417 | filledMap: !1
|
33418 | });
|
33419 | }
|
33420 | }, plugins.filledMap = {
|
33421 | name: "filledMap",
|
33422 | watermarkKey: "filledMap",
|
33423 | capabilities: visuals.capabilities.filledMap,
|
33424 | create: function() {
|
33425 | return new visuals.Map({
|
33426 | filledMap: !0
|
33427 | });
|
33428 | }
|
33429 | }, plugins.treemap = {
|
33430 | name: "treemap",
|
33431 | watermarkKey: "tree",
|
33432 | capabilities: visuals.capabilities.treemap,
|
33433 | create: function() {
|
33434 | return new visuals.Treemap();
|
33435 | }
|
33436 | }, plugins.pieChart = {
|
33437 | name: "pieChart",
|
33438 | watermarkKey: "pie",
|
33439 | capabilities: visuals.capabilities.donutChart,
|
33440 | create: function() {
|
33441 | return new visuals.DonutChart({
|
33442 | sliceWidthRatio: 0
|
33443 | });
|
33444 | }
|
33445 | }, plugins.scatterChart = {
|
33446 | name: "scatterChart",
|
33447 | watermarkKey: "scatterplot",
|
33448 | capabilities: visuals.capabilities.scatterChart,
|
33449 | create: function() {
|
33450 | return new visuals.CartesianChart({
|
33451 | chartType: 9
|
33452 | });
|
33453 | },
|
33454 | getAdditionalTelemetry: function(dataView) {
|
33455 | return visuals.ScatterChart.getAdditionalTelemetry(dataView);
|
33456 | }
|
33457 | }, plugins.stackedAreaChart = {
|
33458 | name: "stackedAreaChart",
|
33459 | watermarkKey: "stackedarea",
|
33460 | capabilities: visuals.capabilities.lineChart,
|
33461 | create: function() {
|
33462 | return new visuals.CartesianChart({
|
33463 | chartType: 2
|
33464 | });
|
33465 | },
|
33466 | customizeQuery: visuals.LineChart.customizeQuery,
|
33467 | getSortableRoles: function(visualSortableOptions) {
|
33468 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
33469 | },
|
33470 | getAdditionalTelemetry: function(dataView) {
|
33471 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33472 | }
|
33473 | }, plugins.table = {
|
33474 | name: "table",
|
33475 | watermarkKey: "table",
|
33476 | capabilities: visuals.capabilities.table,
|
33477 | create: function() {
|
33478 | return new visuals.Table();
|
33479 | },
|
33480 | customizeQuery: visuals.Table.customizeQuery,
|
33481 | getSortableRoles: function(visualSortableOptions) {
|
33482 | return visuals.Table.getSortableRoles();
|
33483 | }
|
33484 | }, plugins.matrix = {
|
33485 | name: "matrix",
|
33486 | watermarkKey: "matrix",
|
33487 | capabilities: visuals.capabilities.matrix,
|
33488 | create: function() {
|
33489 | return new visuals.Matrix();
|
33490 | },
|
33491 | customizeQuery: visuals.Matrix.customizeQuery,
|
33492 | getSortableRoles: function(visualSortableOptions) {
|
33493 | return visuals.Matrix.getSortableRoles();
|
33494 | }
|
33495 | }, plugins.slicer = {
|
33496 | name: "slicer",
|
33497 | watermarkKey: "slicer",
|
33498 | capabilities: visuals.capabilities.slicer,
|
33499 | create: function() {
|
33500 | return new visuals.Slicer();
|
33501 | }
|
33502 | }, plugins.textbox = {
|
33503 | name: "textbox",
|
33504 | capabilities: visuals.capabilities.textbox,
|
33505 | create: function() {
|
33506 | return new visuals.Textbox();
|
33507 | }
|
33508 | }, plugins.waterfallChart = {
|
33509 | name: "waterfallChart",
|
33510 | watermarkKey: "waterfall",
|
33511 | capabilities: visuals.capabilities.waterfallChart,
|
33512 | create: function() {
|
33513 | return new visuals.CartesianChart({
|
33514 | chartType: 12
|
33515 | });
|
33516 | },
|
33517 | getAdditionalTelemetry: function(dataView) {
|
33518 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33519 | }
|
33520 | }, plugins.cheerMeter = {
|
33521 | name: "cheerMeter",
|
33522 | capabilities: visuals.CheerMeter.capabilities,
|
33523 | create: function() {
|
33524 | return new visuals.CheerMeter();
|
33525 | }
|
33526 | }, plugins.consoleWriter = {
|
33527 | name: "consoleWriter",
|
33528 | capabilities: visuals.samples.consoleWriterCapabilities,
|
33529 | create: function() {
|
33530 | return new visuals.samples.ConsoleWriter();
|
33531 | }
|
33532 | }, plugins.helloIVisual = {
|
33533 | name: "helloIVisual",
|
33534 | capabilities: visuals.samples.HelloIVisual.capabilities,
|
33535 | create: function() {
|
33536 | return new visuals.samples.HelloIVisual();
|
33537 | }
|
33538 | }, plugins.owlGauge = {
|
33539 | name: "owlGauge",
|
33540 | watermarkKey: "gauge",
|
33541 | capabilities: visuals.OwlGauge.capabilities,
|
33542 | create: function() {
|
33543 | return new visuals.OwlGauge();
|
33544 | }
|
33545 | }, plugins.scriptVisual = {
|
33546 | name: "scriptVisual",
|
33547 | watermarkKey: "scriptvisual",
|
33548 | capabilities: visuals.capabilities.scriptVisual,
|
33549 | create: function() {
|
33550 | return new visuals.ScriptVisual({
|
33551 | canRefresh: !1
|
33552 | });
|
33553 | }
|
33554 | }, plugins.kpi = {
|
33555 | name: "kpi",
|
33556 | watermarkKey: "kpi",
|
33557 | capabilities: visuals.capabilities.kpi,
|
33558 | create: function() {
|
33559 | return new visuals.KPIStatusWithHistory();
|
33560 | }
|
33561 | }, plugins.debugVisual = {
|
33562 | name: "debugVisual",
|
33563 | watermarkKey: "kpi",
|
33564 | capabilities: visuals.system.DebugVisual.capabilities,
|
33565 | create: function() {
|
33566 | return new visuals.system.DebugVisual();
|
33567 | }
|
33568 | };
|
33569 | }(plugins = visuals.plugins || (visuals.plugins = {}));
|
33570 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
33571 | }(powerbi || (powerbi = {}));
|
33572 | }, function(module, exports) {
|
33573 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
33574 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
33575 | !function(powerbi) {
|
33576 | var visuals;
|
33577 | !function(visuals) {
|
33578 | var CanvasBackgroundHelper;
|
33579 | !function(CanvasBackgroundHelper) {
|
33580 | function getDefaultColor() {
|
33581 | return "#FFFFFF";
|
33582 | }
|
33583 | function getDefaultValues() {
|
33584 | return {
|
33585 | color: getDefaultColor()
|
33586 | };
|
33587 | }
|
33588 | CanvasBackgroundHelper.getDefaultColor = getDefaultColor, CanvasBackgroundHelper.getDefaultValues = getDefaultValues;
|
33589 | }(CanvasBackgroundHelper = visuals.CanvasBackgroundHelper || (visuals.CanvasBackgroundHelper = {}));
|
33590 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
33591 | }(powerbi || (powerbi = {}));
|
33592 | }, function(module, exports) {
|
33593 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
33594 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
33595 | !function(powerbi) {
|
33596 | var visuals;
|
33597 | !function(visuals) {
|
33598 | var defaultMaxValue = 100, DateRange = function() {
|
33599 | function DateRange(min, max, start, end) {
|
33600 | var interval = d3.time.day;
|
33601 | this.scale = d3.time.scale().domain([ min, max ]).range([ 0, defaultMaxValue ]).nice(interval),
|
33602 | this.value = {
|
33603 | min: start || min,
|
33604 | max: end || max
|
33605 | }, this.setValue(this.value);
|
33606 | }
|
33607 | return DateRange.prototype.getScaledValue = function() {
|
33608 | return this.scaledValue;
|
33609 | }, DateRange.prototype.setValue = function(original) {
|
33610 | this.value = original, this.scaledValue = {
|
33611 | min: this.scale(original.min),
|
33612 | max: this.scale(original.max)
|
33613 | };
|
33614 | }, DateRange.prototype.getValue = function() {
|
33615 | return this.value;
|
33616 | }, DateRange.prototype.setScaledValue = function(value) {
|
33617 | this.scaledValue = value, this.value = {
|
33618 | min: this.scale.invert(value.min),
|
33619 | max: this.scale.invert(value.max)
|
33620 | };
|
33621 | }, DateRange;
|
33622 | }();
|
33623 | visuals.DateRange = DateRange;
|
33624 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
33625 | }(powerbi || (powerbi = {}));
|
33626 | }, function(module, exports) {
|
33627 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
33628 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
33629 | !function(powerbi) {
|
33630 | var visuals;
|
33631 | !function(visuals) {
|
33632 | function wrapFormattingElements(elements) {
|
33633 | return {
|
33634 | grid: [ {
|
33635 | properties: {
|
33636 | outlineColor: powerbi.createSolidFillDefinition(elements.grid.outlineColor),
|
33637 | outlineWeight: SQExprBuilder.integer(valueOrDefault(elements.grid.outlineWeight, defaultOutlineWeight)),
|
33638 | gridVertical: SQExprBuilder["boolean"](elements.grid.gridVertical),
|
33639 | gridVerticalColor: powerbi.createSolidFillDefinition(elements.grid.gridVerticalColor),
|
33640 | gridVerticalWeight: SQExprBuilder.integer(valueOrDefault(elements.grid.gridVerticalWeight, defaultGridlineVerticalWeight)),
|
33641 | gridHorizontal: SQExprBuilder["boolean"](elements.grid.gridHorizontal),
|
33642 | gridHorizontalColor: powerbi.createSolidFillDefinition(elements.grid.gridHorizontalColor),
|
33643 | gridHorizontalWeight: SQExprBuilder.integer(valueOrDefault(elements.grid.gridHorizontalWeight, defaultGridlineHorizontalWeight)),
|
33644 | rowPadding: SQExprBuilder.integer(elements.grid.rowPadding)
|
33645 | }
|
33646 | } ],
|
33647 | columnHeaders: [ {
|
33648 | properties: {
|
33649 | outline: SQExprBuilder.text(elements.columnHeaders.outline),
|
33650 | fontColor: powerbi.createSolidFillDefinition(elements.columnHeaders.fontColor),
|
33651 | backColor: powerbi.createSolidFillDefinition(elements.columnHeaders.backColor)
|
33652 | }
|
33653 | } ],
|
33654 | values: [ {
|
33655 | properties: {
|
33656 | outline: SQExprBuilder.text(elements.values.outline),
|
33657 | fontColorPrimary: powerbi.createSolidFillDefinition(elements.values.fontColorPrimary),
|
33658 | backColorPrimary: powerbi.createSolidFillDefinition(elements.values.backColorPrimary),
|
33659 | fontColorSecondary: powerbi.createSolidFillDefinition(elements.values.fontColorSecondary),
|
33660 | backColorSecondary: powerbi.createSolidFillDefinition(elements.values.backColorSecondary)
|
33661 | }
|
33662 | } ],
|
33663 | total: [ {
|
33664 | properties: {
|
33665 | outline: SQExprBuilder.text(elements.total.outline),
|
33666 | fontColor: powerbi.createSolidFillDefinition(elements.total.fontColor),
|
33667 | backColor: powerbi.createSolidFillDefinition(elements.total.backColor)
|
33668 | }
|
33669 | } ]
|
33670 | };
|
33671 | }
|
33672 | var TablixObjects = visuals.controls.internal.TablixObjects, Color = jsCommon.Color, SQExprBuilder = powerbi.data.SQExprBuilder, valueOrDefault = jsCommon.Utility.valueOrDefault, defaultOutlineWeight = TablixObjects.PropGridOutlineWeight.defaultValue, defaultGridlineHorizontalWeight = TablixObjects.PropGridHorizontalWeight.defaultValue, defaultGridlineVerticalWeight = TablixObjects.PropGridVerticalWeight.defaultValue, defaultColumnsOutline = TablixObjects.PropColumnsOutline.defaultValue, defaultValuesOutline = TablixObjects.PropValuesOutline.defaultValue, defaultTotalOutline = TablixObjects.PropTotalOutline.defaultValue, rowPaddingNormal = 3;
|
33673 | visuals.tableStylePresets = {
|
33674 | displayName: powerbi.data.createDisplayNameGetter("Visual_Table_StylePreset_SectionTitle"),
|
33675 | presets: {
|
33676 | None: {
|
33677 | displayName: powerbi.data.createDisplayNameGetter("Visual_Table_StylePreset_None"),
|
33678 | evaluate: function(theme) {
|
33679 | return wrapFormattingElements({
|
33680 | grid: {
|
33681 | outlineColor: TablixObjects.PropGridOutlineColor.defaultValue,
|
33682 | gridVertical: TablixObjects.PropGridVertical.defaultValue,
|
33683 | gridVerticalColor: TablixObjects.PropGridVerticalColor.defaultValue,
|
33684 | gridHorizontal: TablixObjects.PropGridHorizontalTable.defaultValue,
|
33685 | gridHorizontalColor: TablixObjects.PropGridHorizontalColor.defaultValue,
|
33686 | rowPadding: TablixObjects.PropGridRowPadding.defaultValue
|
33687 | },
|
33688 | columnHeaders: {
|
33689 | outline: defaultColumnsOutline,
|
33690 | fontColor: TablixObjects.PropColumnsFontColor.defaultValue,
|
33691 | backColor: TablixObjects.PropColumnsBackColor.defaultValue
|
33692 | },
|
33693 | values: {
|
33694 | outline: defaultValuesOutline,
|
33695 | fontColorPrimary: TablixObjects.PropValuesOutline.defaultValue,
|
33696 | backColorPrimary: TablixObjects.PropValuesOutline.defaultValue,
|
33697 | fontColorSecondary: TablixObjects.PropValuesOutline.defaultValue,
|
33698 | backColorSecondary: TablixObjects.PropValuesOutline.defaultValue
|
33699 | },
|
33700 | total: {
|
33701 | outline: defaultTotalOutline,
|
33702 | fontColor: TablixObjects.PropTotalFontColor.defaultValue,
|
33703 | backColor: TablixObjects.PropTotalBackColor.defaultValue
|
33704 | }
|
33705 | });
|
33706 | }
|
33707 | },
|
33708 | Minimal: {
|
33709 | displayName: powerbi.data.createDisplayNameGetter("Visual_Table_StylePreset_Minimal"),
|
33710 | evaluate: function(theme) {
|
33711 | var backColor = theme.colorPalette.background.value, foreColor = theme.colorPalette.foreground.value, outlineColor = theme.colorPalette.tableAccent.value, gridColor = Color.hexBlend(foreColor, .12, backColor);
|
33712 | return wrapFormattingElements({
|
33713 | grid: {
|
33714 | outlineColor: outlineColor,
|
33715 | gridVertical: !1,
|
33716 | gridVerticalColor: gridColor,
|
33717 | gridVerticalWeight: defaultGridlineVerticalWeight,
|
33718 | gridHorizontal: !0,
|
33719 | gridHorizontalColor: gridColor,
|
33720 | gridHorizontalWeight: defaultGridlineHorizontalWeight,
|
33721 | rowPadding: rowPaddingNormal
|
33722 | },
|
33723 | columnHeaders: {
|
33724 | outline: defaultColumnsOutline,
|
33725 | fontColor: foreColor,
|
33726 | backColor: backColor
|
33727 | },
|
33728 | values: {
|
33729 | outline: defaultValuesOutline,
|
33730 | fontColorPrimary: foreColor,
|
33731 | backColorPrimary: backColor,
|
33732 | fontColorSecondary: foreColor,
|
33733 | backColorSecondary: backColor
|
33734 | },
|
33735 | total: {
|
33736 | outline: defaultTotalOutline,
|
33737 | fontColor: foreColor,
|
33738 | backColor: backColor
|
33739 | }
|
33740 | });
|
33741 | }
|
33742 | }
|
33743 | }
|
33744 | };
|
33745 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
33746 | }(powerbi || (powerbi = {}));
|
33747 | }, function(module, exports, __webpack_require__) {
|
33748 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
33749 | window.jasmine, window.Microsoft;
|
33750 | window.jsCommon = window.jsCommon || {}, window.powerbi = window.powerbi || {},
|
33751 | window.debug = window.debug || {}, window.InJs = window.InJs || {}, __webpack_require__(264);
|
33752 | }, function(module, exports, __webpack_require__) {
|
33753 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
33754 | window.jasmine, window.Microsoft;
|
33755 | __webpack_require__(265), __webpack_require__(266), __webpack_require__(267), __webpack_require__(268),
|
33756 | __webpack_require__(269), __webpack_require__(270), __webpack_require__(271), __webpack_require__(272),
|
33757 | __webpack_require__(273), __webpack_require__(274), __webpack_require__(275), __webpack_require__(276),
|
33758 | __webpack_require__(277), __webpack_require__(278), __webpack_require__(279), __webpack_require__(280),
|
33759 | __webpack_require__(281), __webpack_require__(282), __webpack_require__(283), __webpack_require__(284),
|
33760 | __webpack_require__(285), __webpack_require__(286), __webpack_require__(287), __webpack_require__(288),
|
33761 | __webpack_require__(289), __webpack_require__(290), __webpack_require__(291), __webpack_require__(292),
|
33762 | __webpack_require__(293), __webpack_require__(294), __webpack_require__(295), __webpack_require__(296),
|
33763 | __webpack_require__(297), __webpack_require__(298), __webpack_require__(288), __webpack_require__(299),
|
33764 | __webpack_require__(300), __webpack_require__(301), __webpack_require__(302);
|
33765 | }, function(module, exports) {
|
33766 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
33767 | window.jasmine, window.Microsoft;
|
33768 | }, function(module, exports) {
|
33769 | var jsCommon, jsCommon = window.jsCommon;
|
33770 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
33771 | window.Microsoft;
|
33772 | !function(jsCommon) {
|
33773 | var DOMConstants;
|
33774 | !function(DOMConstants) {
|
33775 | DOMConstants.escKeyCode = 27, DOMConstants.enterKeyCode = 13, DOMConstants.tabKeyCode = 9,
|
33776 | DOMConstants.upArrowKeyCode = 38, DOMConstants.downArrowKeyCode = 40, DOMConstants.leftArrowKeyCode = 37,
|
33777 | DOMConstants.rightArrowKeyCode = 39, DOMConstants.homeKeyCode = 36, DOMConstants.endKeyCode = 35,
|
33778 | DOMConstants.backSpaceKeyCode = 8, DOMConstants.deleteKeyCode = 46, DOMConstants.spaceKeyCode = 32,
|
33779 | DOMConstants.shiftKeyCode = 16, DOMConstants.ctrlKeyCode = 17, DOMConstants.altKeyCode = 18,
|
33780 | DOMConstants.aKeyCode = 65, DOMConstants.cKeyCode = 67, DOMConstants.sKeyCode = 83,
|
33781 | DOMConstants.vKeyCode = 86, DOMConstants.wKeyCode = 87, DOMConstants.xKeyCode = 88,
|
33782 | DOMConstants.yKeyCode = 89, DOMConstants.zKeyCode = 90, DOMConstants.DocumentBody = "body",
|
33783 | DOMConstants.Anchor = "a", DOMConstants.EditableTextElements = ":text, textarea",
|
33784 | DOMConstants.EditableNumericElements = '[type="number"]', DOMConstants.disabledAttributeOrValue = "disabled",
|
33785 | DOMConstants.readonlyAttributeOrValue = "readonly", DOMConstants.idAttribute = "id",
|
33786 | DOMConstants.styleAttribute = "style", DOMConstants.hrefAttribute = "href", DOMConstants.targetAttribute = "target",
|
33787 | DOMConstants.blankValue = "_blank", DOMConstants.selfValue = "_self", DOMConstants.classAttribute = "class",
|
33788 | DOMConstants.titleAttribute = "title", DOMConstants.srcAttribute = "src", DOMConstants.contextmenuEventName = "contextmenu",
|
33789 | DOMConstants.blurEventName = "blur", DOMConstants.keyUpEventName = "keyup", DOMConstants.inputEventName = "input",
|
33790 | DOMConstants.changeEventName = "change", DOMConstants.cutEventName = "cut", DOMConstants.keyDownEventName = "keydown",
|
33791 | DOMConstants.mouseMoveEventName = "mousemove", DOMConstants.mouseDownEventName = "mousedown",
|
33792 | DOMConstants.mouseEnterEventName = "mouseenter", DOMConstants.mouseLeaveEventName = "mouseleave",
|
33793 | DOMConstants.mouseOverEventName = "mouseover", DOMConstants.mouseOutEventName = "mouseout",
|
33794 | DOMConstants.mouseClickEventName = "click", DOMConstants.pasteEventName = "paste",
|
33795 | DOMConstants.scrollEventName = "scroll", DOMConstants.dropEventName = "drop", DOMConstants.focusEventName = "focus",
|
33796 | DOMConstants.focusInEventName = "focusin", DOMConstants.focusOutEventName = "focusout",
|
33797 | DOMConstants.selectEventName = "select", DOMConstants.messageEventName = "message",
|
33798 | DOMConstants.loadEventName = "load", DOMConstants.beforeUnload = "beforeunload",
|
33799 | DOMConstants.inputAndSelectEventNames = "input, select";
|
33800 | }(DOMConstants = jsCommon.DOMConstants || (jsCommon.DOMConstants = {}));
|
33801 | }(jsCommon || (jsCommon = {}));
|
33802 | }, function(module, exports) {
|
33803 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
33804 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
33805 | !function(powerbi) {
|
33806 | powerbi.RS_AccessDeniedDueToRLSGroup = "rsAccessDeniedDueToRLSGroup", powerbi.RS_CannotRetrieveModel = "rsCannotRetrieveModel",
|
33807 | function(PowerBIErrorResourceType) {
|
33808 | PowerBIErrorResourceType[PowerBIErrorResourceType.ResourceCodeReference = 0] = "ResourceCodeReference",
|
33809 | PowerBIErrorResourceType[PowerBIErrorResourceType.EmbeddedString = 1] = "EmbeddedString";
|
33810 | }(powerbi.PowerBIErrorResourceType || (powerbi.PowerBIErrorResourceType = {}));
|
33811 | var PowerBIErrorResourceType = powerbi.PowerBIErrorResourceType, ServiceErrorToClientError = function() {
|
33812 | function ServiceErrorToClientError(serviceError) {
|
33813 | this.m_serviceError = serviceError;
|
33814 | }
|
33815 | return Object.defineProperty(ServiceErrorToClientError.prototype, "code", {
|
33816 | get: function() {
|
33817 | return ServiceErrorToClientError.codeName;
|
33818 | },
|
33819 | enumerable: !0,
|
33820 | configurable: !0
|
33821 | }), Object.defineProperty(ServiceErrorToClientError.prototype, "ignorable", {
|
33822 | get: function() {
|
33823 | return !1;
|
33824 | },
|
33825 | enumerable: !0,
|
33826 | configurable: !0
|
33827 | }), Object.defineProperty(ServiceErrorToClientError.prototype, "requestId", {
|
33828 | get: function() {
|
33829 | return this.httpRequestId;
|
33830 | },
|
33831 | set: function(value) {
|
33832 | this.httpRequestId = value;
|
33833 | },
|
33834 | enumerable: !0,
|
33835 | configurable: !0
|
33836 | }), ServiceErrorToClientError.prototype.getDetails = function(resourceProvider) {
|
33837 | var errorDetails;
|
33838 | return errorDetails = 6 === this.m_serviceError.statusCode ? PowerBIErrorDetailHelper.GetDetailsFromTransformError(resourceProvider, this.m_serviceError) : PowerBIErrorDetailHelper.GetDetailsFromServerError(resourceProvider, this.m_serviceError),
|
33839 | PowerBIErrorDetailHelper.addAdditionalInfo(errorDetails, this.m_serviceError.errorDetails, resourceProvider),
|
33840 | PowerBIErrorDetailHelper.addDebugErrorInfo(errorDetails, this.code, this.m_serviceError.message || null, this.m_serviceError.stackTrace || null),
|
33841 | errorDetails;
|
33842 | }, ServiceErrorToClientError.codeName = "ServiceErrorToClientError", ServiceErrorToClientError;
|
33843 | }();
|
33844 | powerbi.ServiceErrorToClientError = ServiceErrorToClientError;
|
33845 | var PowerBIErrorDetailHelper = function() {
|
33846 | function PowerBIErrorDetailHelper() {}
|
33847 | return PowerBIErrorDetailHelper.addAdditionalInfo = function(errorDetails, pbiErrorDetails, localize) {
|
33848 | if (pbiErrorDetails) for (var i = 0; i < pbiErrorDetails.length; i++) {
|
33849 | var element = pbiErrorDetails[i], localizedCode = localize.getOptional(PowerBIErrorDetailHelper.serverErrorPrefix + element.code), additionErrorInfoKeyValuePair = {
|
33850 | errorInfoKey: localizedCode ? localizedCode : element.code,
|
33851 | errorInfoValue: element.detail.type === PowerBIErrorResourceType.ResourceCodeReference ? localize.get(PowerBIErrorDetailHelper.serverErrorPrefix + element.detail.value) : element.detail.value
|
33852 | };
|
33853 | errorDetails.displayableErrorInfo.push(additionErrorInfoKeyValuePair);
|
33854 | }
|
33855 | return errorDetails;
|
33856 | }, PowerBIErrorDetailHelper.addDebugErrorInfo = function(errorDetails, errorCode, message, stackTrace) {
|
33857 | return errorDetails.debugErrorInfo = errorDetails.debugErrorInfo || [], errorCode && errorDetails.debugErrorInfo.push({
|
33858 | errorInfoKey: powerbi.ClientErrorStrings.ClientErrorCode,
|
33859 | errorInfoValue: errorCode
|
33860 | }), message && errorDetails.debugErrorInfo.push({
|
33861 | errorInfoKey: powerbi.ClientErrorStrings.ErrorDetails,
|
33862 | errorInfoValue: message
|
33863 | }), stackTrace && errorDetails.debugErrorInfo.push({
|
33864 | errorInfoKey: powerbi.ClientErrorStrings.StackTrace,
|
33865 | errorInfoValue: stackTrace
|
33866 | }), errorDetails;
|
33867 | }, PowerBIErrorDetailHelper.GetDetailsFromTransformError = function(localize, serviceError) {
|
33868 | var message = localize.get("ServiceError_CannotLoadVisual"), key = localize.get("ServiceError_CannotLoadVisual"), val = serviceError.message, additionalInfo = [];
|
33869 | additionalInfo.push({
|
33870 | errorInfoKey: key,
|
33871 | errorInfoValue: val
|
33872 | });
|
33873 | var errorDetails = {
|
33874 | message: message,
|
33875 | displayableErrorInfo: additionalInfo
|
33876 | };
|
33877 | return errorDetails;
|
33878 | }, PowerBIErrorDetailHelper.GetDetailsFromServerError = function(localize, serviceError) {
|
33879 | var message = "", key = "", val = "", errorCodeHandled = !1;
|
33880 | switch (serviceError.errorCode) {
|
33881 | case powerbi.RS_AccessDeniedDueToRLSGroup:
|
33882 | message = localize.get("ServiceError_ModelCannotLoad"), key = localize.get("ServiceError_ModelFetchingFailureKey"),
|
33883 | val = localize.get("DsrError_NoPermissionDueToRLSGroupMessage"), errorCodeHandled = !0;
|
33884 | break;
|
33885 |
|
33886 | case powerbi.RS_CannotRetrieveModel:
|
33887 | message = localize.get("ServiceError_ModelCannotLoad"), key = localize.get("ServiceError_ModelFetchingFailureKey"),
|
33888 | val = localize.get("DsrError_CanNotRetrieveModelMessage"), errorCodeHandled = !0;
|
33889 | }
|
33890 | if (!errorCodeHandled) switch (serviceError.statusCode) {
|
33891 | case 2:
|
33892 | message = localize.get("ServiceError_ModelCannotLoad"), key = localize.get("ServiceError_ModelConvertFailureKey"),
|
33893 | val = localize.get("ServiceError_ModelConvertFailureValue");
|
33894 | break;
|
33895 |
|
33896 | case 3:
|
33897 | message = localize.get("ServiceError_ModelCannotLoad"), key = localize.get("ServiceError_ModelCreationFailureKey"),
|
33898 | val = localize.get("ServiceError_ModelCreationFailureValue");
|
33899 | break;
|
33900 |
|
33901 | case 1:
|
33902 | message = localize.get("ServiceError_ModelCannotLoad"), key = localize.get("ServiceError_ModelFetchingFailureKey"),
|
33903 | val = localize.get("ServiceError_ModelFetchingFailureValue");
|
33904 | break;
|
33905 |
|
33906 | case 4:
|
33907 | message = localize.get("ServiceError_CannotLoadVisual"), key = localize.get("ServiceError_ExecuteSemanticQueryErrorKey"),
|
33908 | val = localize.get("ServiceError_ExecuteSemanticQueryErrorValue");
|
33909 | break;
|
33910 |
|
33911 | case 5:
|
33912 | message = localize.get("ServiceError_CannotLoadVisual"), key = localize.get("ServiceError_ExecuteSemanticQueryInvalidStreamFormatKey"),
|
33913 | val = localize.get("ServiceError_ExecuteSemanticQueryInvalidStreamFormatValue");
|
33914 | break;
|
33915 |
|
33916 | case 0:
|
33917 | default:
|
33918 | message = localize.get("ServiceError_GeneralError"), key = localize.get("ServiceError_GeneralErrorKey"),
|
33919 | val = localize.get("ServiceError_GeneralErrorValue");
|
33920 | }
|
33921 | var additionalInfo = [];
|
33922 | additionalInfo.push({
|
33923 | errorInfoKey: key,
|
33924 | errorInfoValue: val
|
33925 | });
|
33926 | var errorDetails = {
|
33927 | message: message,
|
33928 | displayableErrorInfo: additionalInfo
|
33929 | };
|
33930 | return errorDetails;
|
33931 | }, PowerBIErrorDetailHelper.serverErrorPrefix = "ServerError_", PowerBIErrorDetailHelper;
|
33932 | }();
|
33933 | powerbi.PowerBIErrorDetailHelper = PowerBIErrorDetailHelper;
|
33934 | }(powerbi || (powerbi = {}));
|
33935 | }, function(module, exports) {
|
33936 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
33937 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
33938 | !function(powerbi) {}(powerbi || (powerbi = {}));
|
33939 | }, function(module, exports) {
|
33940 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
33941 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
33942 | !function(powerbi) {
|
33943 | function createGeoTaggingAnalyzerService(getLocalized) {
|
33944 | return new GeoTaggingAnalyzerService(getLocalized);
|
33945 | }
|
33946 | powerbi.CategoryTypes = {
|
33947 | Address: "Address",
|
33948 | City: "City",
|
33949 | Continent: "Continent",
|
33950 | CountryRegion: "Country",
|
33951 | County: "County",
|
33952 | Longitude: "Longitude",
|
33953 | Latitude: "Latitude",
|
33954 | Place: "Place",
|
33955 | PostalCode: "PostalCode",
|
33956 | StateOrProvince: "StateOrProvince"
|
33957 | }, powerbi.createGeoTaggingAnalyzerService = createGeoTaggingAnalyzerService;
|
33958 | var EnglishBackup = {
|
33959 | GeotaggingString_Continent: "continent",
|
33960 | GeotaggingString_Continents: "continents",
|
33961 | GeotaggingString_Country: "country",
|
33962 | GeotaggingString_Countries: "countries",
|
33963 | GeotaggingString_State: "state",
|
33964 | GeotaggingString_States: "states",
|
33965 | GeotaggingString_City: "city",
|
33966 | GeotaggingString_Cities: "cities",
|
33967 | GeotaggingString_Town: "town",
|
33968 | GeotaggingString_Towns: "towns",
|
33969 | GeotaggingString_Province: "province",
|
33970 | GeotaggingString_Provinces: "provinces",
|
33971 | GeotaggingString_County: "county",
|
33972 | GeotaggingString_Counties: "counties",
|
33973 | GeotaggingString_Village: "village",
|
33974 | GeotaggingString_Villages: "villages",
|
33975 | GeotaggingString_Post: "post",
|
33976 | GeotaggingString_Zip: "zip",
|
33977 | GeotaggingString_Code: "code",
|
33978 | GeotaggingString_Place: "place",
|
33979 | GeotaggingString_Places: "places",
|
33980 | GeotaggingString_Address: "address",
|
33981 | GeotaggingString_Addresses: "addresses",
|
33982 | GeotaggingString_Street: "street",
|
33983 | GeotaggingString_Streets: "streets",
|
33984 | GeotaggingString_Longitude: "longitude",
|
33985 | GeotaggingString_Longitude_Short: "lon",
|
33986 | GeotaggingString_Longitude_Short2: "long",
|
33987 | GeotaggingString_Latitude: "latitude",
|
33988 | GeotaggingString_Latitude_Short: "lat",
|
33989 | GeotaggingString_PostalCode: "postal code",
|
33990 | GeotaggingString_PostalCodes: "postal codes",
|
33991 | GeotaggingString_ZipCode: "zip code",
|
33992 | GeotaggingString_ZipCodes: "zip codes",
|
33993 | GeotaggingString_Territory: "territory",
|
33994 | GeotaggingString_Territories: "territories",
|
33995 | GeotaggingString_VRMBackCompat_CountryRegion: "CountryRegion",
|
33996 | GeotaggingString_VRMBackCompat_StateOrProvince: "StateOrProvince"
|
33997 | }, GeoTaggingAnalyzerService = function() {
|
33998 | function GeoTaggingAnalyzerService(getLocalized) {
|
33999 | this.GeotaggingString_VRMBackCompat_CountryRegion = "CountryRegion", this.GeotaggingString_VRMBackCompat_StateOrProvince = "StateOrProvince",
|
34000 | this.GeotaggingString_Continent = getLocalized("GeotaggingString_Continent").toLowerCase(),
|
34001 | this.GeotaggingString_Continents = getLocalized("GeotaggingString_Continents").toLowerCase(),
|
34002 | this.GeotaggingString_Country = getLocalized("GeotaggingString_Country").toLowerCase(),
|
34003 | this.GeotaggingString_Countries = getLocalized("GeotaggingString_Countries").toLowerCase(),
|
34004 | this.GeotaggingString_State = getLocalized("GeotaggingString_State").toLowerCase(),
|
34005 | this.GeotaggingString_States = getLocalized("GeotaggingString_States").toLowerCase(),
|
34006 | this.GeotaggingString_City = getLocalized("GeotaggingString_City").toLowerCase(),
|
34007 | this.GeotaggingString_Cities = getLocalized("GeotaggingString_Cities").toLowerCase(),
|
34008 | this.GeotaggingString_Town = getLocalized("GeotaggingString_Town").toLowerCase(),
|
34009 | this.GeotaggingString_Towns = getLocalized("GeotaggingString_Towns").toLowerCase(),
|
34010 | this.GeotaggingString_Province = getLocalized("GeotaggingString_Province").toLowerCase(),
|
34011 | this.GeotaggingString_Provinces = getLocalized("GeotaggingString_Provinces").toLowerCase(),
|
34012 | this.GeotaggingString_County = getLocalized("GeotaggingString_County").toLowerCase(),
|
34013 | this.GeotaggingString_Counties = getLocalized("GeotaggingString_Counties").toLowerCase(),
|
34014 | this.GeotaggingString_Village = getLocalized("GeotaggingString_Village").toLowerCase(),
|
34015 | this.GeotaggingString_Villages = getLocalized("GeotaggingString_Villages").toLowerCase(),
|
34016 | this.GeotaggingString_Post = getLocalized("GeotaggingString_Post").toLowerCase(),
|
34017 | this.GeotaggingString_Zip = getLocalized("GeotaggingString_Zip").toLowerCase(),
|
34018 | this.GeotaggingString_Code = getLocalized("GeotaggingString_Code").toLowerCase(),
|
34019 | this.GeotaggingString_Place = getLocalized("GeotaggingString_Place").toLowerCase(),
|
34020 | this.GeotaggingString_Places = getLocalized("GeotaggingString_Places").toLowerCase(),
|
34021 | this.GeotaggingString_Address = getLocalized("GeotaggingString_Address").toLowerCase(),
|
34022 | this.GeotaggingString_Addresses = getLocalized("GeotaggingString_Addresses").toLowerCase(),
|
34023 | this.GeotaggingString_Street = getLocalized("GeotaggingString_Street").toLowerCase(),
|
34024 | this.GeotaggingString_Streets = getLocalized("GeotaggingString_Streets").toLowerCase(),
|
34025 | this.GeotaggingString_Longitude = getLocalized("GeotaggingString_Longitude").toLowerCase(),
|
34026 | this.GeotaggingString_Longitude_Short = getLocalized("GeotaggingString_Longitude_Short").toLowerCase(),
|
34027 | this.GeotaggingString_Longitude_Short2 = getLocalized("GeotaggingString_Longitude_Short2").toLowerCase(),
|
34028 | this.GeotaggingString_Latitude = getLocalized("GeotaggingString_Latitude").toLowerCase(),
|
34029 | this.GeotaggingString_Latitude_Short = getLocalized("GeotaggingString_Latitude_Short").toLowerCase(),
|
34030 | this.GeotaggingString_PostalCode = getLocalized("GeotaggingString_PostalCode").toLowerCase(),
|
34031 | this.GeotaggingString_PostalCodes = getLocalized("GeotaggingString_PostalCodes").toLowerCase(),
|
34032 | this.GeotaggingString_ZipCode = getLocalized("GeotaggingString_ZipCode").toLowerCase(),
|
34033 | this.GeotaggingString_ZipCodes = getLocalized("GeotaggingString_ZipCodes").toLowerCase(),
|
34034 | this.GeotaggingString_Territory = getLocalized("GeotaggingString_Territory").toLowerCase(),
|
34035 | this.GeotaggingString_Territories = getLocalized("GeotaggingString_Territories").toLowerCase();
|
34036 | }
|
34037 | return GeoTaggingAnalyzerService.prototype.isLongitudeOrLatitude = function(fieldRefName) {
|
34038 | return this.isLongitude(fieldRefName) || this.isLatitude(fieldRefName);
|
34039 | }, GeoTaggingAnalyzerService.prototype.isGeographic = function(fieldRefName) {
|
34040 | return this.isLongitudeOrLatitude(fieldRefName) || this.isGeocodable(fieldRefName);
|
34041 | }, GeoTaggingAnalyzerService.prototype.isGeocodable = function(fieldRefName) {
|
34042 | return this.isAddress(fieldRefName) || this.isCity(fieldRefName) || this.isContinent(fieldRefName) || this.isCountry(fieldRefName) || this.isCounty(fieldRefName) || this.isStateOrProvince(fieldRefName) || this.isPlace(fieldRefName) || this.isPostalCode(fieldRefName) || this.isTerritory(fieldRefName);
|
34043 | }, GeoTaggingAnalyzerService.prototype.isGeoshapable = function(fieldRefName) {
|
34044 | return this.isCity(fieldRefName) || this.isCountry(fieldRefName) || this.isCounty(fieldRefName) || this.isStateOrProvince(fieldRefName) || this.isPostalCode(fieldRefName) || this.isTerritory(fieldRefName) || this.isGeoshapableEnglish(fieldRefName);
|
34045 | }, GeoTaggingAnalyzerService.prototype.isGeoshapableEnglish = function(fieldRefName) {
|
34046 | return this.isEnglishCity(fieldRefName) || this.isEnglishCountry(fieldRefName) || this.isEnglishCounty(fieldRefName) || this.isEnglishStateOrProvince(fieldRefName) || this.isEnglishPostalCode(fieldRefName) || this.isEnglishTerritory(fieldRefName);
|
34047 | }, GeoTaggingAnalyzerService.prototype.isAddress = function(fieldRefName) {
|
34048 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_Address, this.GeotaggingString_Addresses, this.GeotaggingString_Street, this.GeotaggingString_Streets ]);
|
34049 | }, GeoTaggingAnalyzerService.prototype.isPlace = function(fieldRefName) {
|
34050 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_Place, this.GeotaggingString_Places ]);
|
34051 | }, GeoTaggingAnalyzerService.prototype.isCity = function(fieldRefName) {
|
34052 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_City, this.GeotaggingString_Cities, this.GeotaggingString_Town, this.GeotaggingString_Towns, this.GeotaggingString_Village, this.GeotaggingString_Villages ]);
|
34053 | }, GeoTaggingAnalyzerService.prototype.isStateOrProvince = function(fieldRefName) {
|
34054 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_State, this.GeotaggingString_States, this.GeotaggingString_Province, this.GeotaggingString_Provinces, this.GeotaggingString_VRMBackCompat_StateOrProvince ]);
|
34055 | }, GeoTaggingAnalyzerService.prototype.isCountry = function(fieldRefName) {
|
34056 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_Country, this.GeotaggingString_Countries, this.GeotaggingString_VRMBackCompat_CountryRegion ]);
|
34057 | }, GeoTaggingAnalyzerService.prototype.isCounty = function(fieldRefName) {
|
34058 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_County, this.GeotaggingString_Counties ]);
|
34059 | }, GeoTaggingAnalyzerService.prototype.isContinent = function(fieldRefName) {
|
34060 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_Continent, this.GeotaggingString_Continents ]);
|
34061 | }, GeoTaggingAnalyzerService.prototype.isPostalCode = function(fieldRefName) {
|
34062 | var result = GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_Post, this.GeotaggingString_Zip ]) && GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_Code ]) || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_PostalCode, this.GeotaggingString_PostalCodes, this.GeotaggingString_ZipCode, this.GeotaggingString_ZipCodes ]);
|
34063 | if (!result) {
|
34064 | var whiteSpaceRegex = /\s+/, fieldNameWithoutWhitespace = fieldRefName.replace(whiteSpaceRegex, "");
|
34065 | result = GeoTaggingAnalyzerService.hasMatches(fieldNameWithoutWhitespace, [ this.GeotaggingString_PostalCode.replace(whiteSpaceRegex, ""), this.GeotaggingString_PostalCodes.replace(whiteSpaceRegex, ""), this.GeotaggingString_ZipCode.replace(whiteSpaceRegex, ""), this.GeotaggingString_ZipCodes.replace(whiteSpaceRegex, "") ]);
|
34066 | }
|
34067 | return result;
|
34068 | }, GeoTaggingAnalyzerService.prototype.isLongitude = function(fieldRefName) {
|
34069 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_Longitude ]) || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_Longitude_Short ], !0) || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_Longitude_Short2 ], !0);
|
34070 | }, GeoTaggingAnalyzerService.prototype.isLatitude = function(fieldRefName) {
|
34071 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_Latitude ]) || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_Latitude_Short ], !0);
|
34072 | }, GeoTaggingAnalyzerService.prototype.isTerritory = function(fieldRefName) {
|
34073 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_Territory, this.GeotaggingString_Territories ]);
|
34074 | }, GeoTaggingAnalyzerService.hasMatches = function(fieldName, possibleMatches, useStrict) {
|
34075 | for (var nonWordRegex = /\W/, value = fieldName.toLowerCase(), i = 0, len = possibleMatches.length; len > i; i++) {
|
34076 | var possibleMatch = possibleMatches[i].toLowerCase();
|
34077 | if (useStrict) {
|
34078 | var indexofpossibleMatch = value.indexOf(possibleMatch);
|
34079 | if (indexofpossibleMatch > -1) {
|
34080 | var wordEndFlag = void 0, wordBeginFlag = void 0;
|
34081 | if (wordEndFlag = wordBeginFlag = !0, indexofpossibleMatch - 1 > 0 && (wordBeginFlag = nonWordRegex.test(value[indexofpossibleMatch - 1])),
|
34082 | indexofpossibleMatch + possibleMatch.length < value.length && (wordEndFlag = nonWordRegex.test(value[indexofpossibleMatch + possibleMatch.length])),
|
34083 | wordBeginFlag && wordEndFlag) return !0;
|
34084 | }
|
34085 | } else if (value.indexOf(possibleMatch) > -1) return !0;
|
34086 | }
|
34087 | return !1;
|
34088 | }, GeoTaggingAnalyzerService.prototype.getFieldType = function(fieldName) {
|
34089 | return null != fieldName ? this.isLatitude(fieldName) ? powerbi.CategoryTypes.Latitude : this.isLongitude(fieldName) ? powerbi.CategoryTypes.Longitude : this.isPostalCode(fieldName) ? powerbi.CategoryTypes.PostalCode : this.isAddress(fieldName) ? powerbi.CategoryTypes.Address : this.isPlace(fieldName) ? powerbi.CategoryTypes.Place : this.isCity(fieldName) ? powerbi.CategoryTypes.City : this.isCountry(fieldName) ? powerbi.CategoryTypes.CountryRegion : this.isCounty(fieldName) ? powerbi.CategoryTypes.County : this.isStateOrProvince(fieldName) ? powerbi.CategoryTypes.StateOrProvince : this.isContinent(fieldName) ? powerbi.CategoryTypes.Continent : this.getEnglishFieldType(fieldName) : void 0;
|
34090 | }, GeoTaggingAnalyzerService.prototype.isEnglishAddress = function(fieldRefName) {
|
34091 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_Address, EnglishBackup.GeotaggingString_Addresses, EnglishBackup.GeotaggingString_Street, EnglishBackup.GeotaggingString_Streets ]);
|
34092 | }, GeoTaggingAnalyzerService.prototype.isEnglishPlace = function(fieldRefName) {
|
34093 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_Place, EnglishBackup.GeotaggingString_Places ]);
|
34094 | }, GeoTaggingAnalyzerService.prototype.isEnglishCity = function(fieldRefName) {
|
34095 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_City, EnglishBackup.GeotaggingString_Cities, EnglishBackup.GeotaggingString_Town, EnglishBackup.GeotaggingString_Towns, EnglishBackup.GeotaggingString_Village, EnglishBackup.GeotaggingString_Villages ]);
|
34096 | }, GeoTaggingAnalyzerService.prototype.isEnglishStateOrProvince = function(fieldRefName) {
|
34097 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_State, EnglishBackup.GeotaggingString_States, EnglishBackup.GeotaggingString_Province, EnglishBackup.GeotaggingString_Provinces, EnglishBackup.GeotaggingString_VRMBackCompat_StateOrProvince ]);
|
34098 | }, GeoTaggingAnalyzerService.prototype.isEnglishCountry = function(fieldRefName) {
|
34099 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_Country, EnglishBackup.GeotaggingString_Countries, EnglishBackup.GeotaggingString_VRMBackCompat_CountryRegion ]);
|
34100 | }, GeoTaggingAnalyzerService.prototype.isEnglishCounty = function(fieldRefName) {
|
34101 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_County, EnglishBackup.GeotaggingString_Counties ]);
|
34102 | }, GeoTaggingAnalyzerService.prototype.isEnglishContinent = function(fieldRefName) {
|
34103 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_Continent, EnglishBackup.GeotaggingString_Continents ]);
|
34104 | }, GeoTaggingAnalyzerService.prototype.isEnglishPostalCode = function(fieldRefName) {
|
34105 | var result = GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_Post, EnglishBackup.GeotaggingString_Zip ]) && GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ this.GeotaggingString_Code ]) || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_PostalCode, EnglishBackup.GeotaggingString_PostalCodes, EnglishBackup.GeotaggingString_ZipCode, EnglishBackup.GeotaggingString_ZipCodes ]);
|
34106 | if (!result) {
|
34107 | var whiteSpaceRegexPattern = new RegExp("s");
|
34108 | result = GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_PostalCode.replace(whiteSpaceRegexPattern, ""), EnglishBackup.GeotaggingString_PostalCodes.replace(whiteSpaceRegexPattern, ""), EnglishBackup.GeotaggingString_ZipCode.replace(whiteSpaceRegexPattern, ""), EnglishBackup.GeotaggingString_ZipCodes.replace(whiteSpaceRegexPattern, "") ]);
|
34109 | }
|
34110 | return result;
|
34111 | }, GeoTaggingAnalyzerService.prototype.isEnglishLongitude = function(fieldRefName) {
|
34112 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_Longitude ]) || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_Longitude_Short ], !0) || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_Longitude_Short2 ], !0);
|
34113 | }, GeoTaggingAnalyzerService.prototype.isEnglishLatitude = function(fieldRefName) {
|
34114 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_Latitude ]) || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_Latitude_Short ], !0);
|
34115 | }, GeoTaggingAnalyzerService.prototype.isEnglishTerritory = function(fieldRefName) {
|
34116 | return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [ EnglishBackup.GeotaggingString_Territory, EnglishBackup.GeotaggingString_Territories ]);
|
34117 | }, GeoTaggingAnalyzerService.prototype.getEnglishFieldType = function(fieldName) {
|
34118 | return null != fieldName ? this.isEnglishLatitude(fieldName) ? powerbi.CategoryTypes.Latitude : this.isEnglishLongitude(fieldName) ? powerbi.CategoryTypes.Longitude : this.isEnglishPostalCode(fieldName) ? powerbi.CategoryTypes.PostalCode : this.isEnglishAddress(fieldName) ? powerbi.CategoryTypes.Address : this.isEnglishPlace(fieldName) ? powerbi.CategoryTypes.Place : this.isEnglishCity(fieldName) ? powerbi.CategoryTypes.City : this.isEnglishCountry(fieldName) ? powerbi.CategoryTypes.CountryRegion : this.isEnglishCounty(fieldName) ? powerbi.CategoryTypes.County : this.isEnglishStateOrProvince(fieldName) ? powerbi.CategoryTypes.StateOrProvince : this.isEnglishContinent(fieldName) ? powerbi.CategoryTypes.Continent : void 0 : void 0;
|
34119 | }, GeoTaggingAnalyzerService;
|
34120 | }();
|
34121 | powerbi.GeoTaggingAnalyzerService = GeoTaggingAnalyzerService;
|
34122 | }(powerbi || (powerbi = {}));
|
34123 | }, function(module, exports, __webpack_require__) {
|
34124 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
34125 | window.jasmine, window.Microsoft;
|
34126 | }, function(module, exports) {
|
34127 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
34128 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
34129 | !function(powerbi) {
|
34130 | var ClientErrorStrings;
|
34131 | !function(ClientErrorStrings) {
|
34132 | ClientErrorStrings.ClientErrorCode = "Client Error Code", ClientErrorStrings.ErrorCode = "Error Code",
|
34133 | ClientErrorStrings.ErrorDetails = "Error Details", ClientErrorStrings.HttpRequestId = "HTTP Request Id",
|
34134 | ClientErrorStrings.JobId = "Job Id", ClientErrorStrings.ODataErrorMessage = "OData Error Message",
|
34135 | ClientErrorStrings.StackTrace = "Stack Trace";
|
34136 | }(ClientErrorStrings = powerbi.ClientErrorStrings || (powerbi.ClientErrorStrings = {}));
|
34137 | var UnknownClientError = function() {
|
34138 | function UnknownClientError(code) {
|
34139 | this.errorCode = code;
|
34140 | }
|
34141 | return Object.defineProperty(UnknownClientError.prototype, "code", {
|
34142 | get: function() {
|
34143 | return this.errorCode;
|
34144 | },
|
34145 | enumerable: !0,
|
34146 | configurable: !0
|
34147 | }), Object.defineProperty(UnknownClientError.prototype, "ignorable", {
|
34148 | get: function() {
|
34149 | return !1;
|
34150 | },
|
34151 | enumerable: !0,
|
34152 | configurable: !0
|
34153 | }), UnknownClientError.prototype.getDetails = function(resourceProvider) {
|
34154 | var details = {
|
34155 | message: resourceProvider.get("ClientError_UnknownClientErrorValue"),
|
34156 | displayableErrorInfo: [ {
|
34157 | errorInfoKey: resourceProvider.get("ClientError_UnknownClientErrorKey"),
|
34158 | errorInfoValue: resourceProvider.get("ClientError_UnknownClientErrorValue")
|
34159 | } ],
|
34160 | debugErrorInfo: [ {
|
34161 | errorInfoKey: ClientErrorStrings.ClientErrorCode,
|
34162 | errorInfoValue: this.code
|
34163 | } ]
|
34164 | };
|
34165 | return details;
|
34166 | }, UnknownClientError;
|
34167 | }();
|
34168 | powerbi.UnknownClientError = UnknownClientError;
|
34169 | var HttpClientError = function() {
|
34170 | function HttpClientError(httpStatusCode, requestId) {
|
34171 | this.httpStatusCode = httpStatusCode, this.httpRequestId = requestId;
|
34172 | }
|
34173 | return Object.defineProperty(HttpClientError.prototype, "code", {
|
34174 | get: function() {
|
34175 | return "HttpClientError";
|
34176 | },
|
34177 | enumerable: !0,
|
34178 | configurable: !0
|
34179 | }), Object.defineProperty(HttpClientError.prototype, "ignorable", {
|
34180 | get: function() {
|
34181 | return !1;
|
34182 | },
|
34183 | enumerable: !0,
|
34184 | configurable: !0
|
34185 | }), Object.defineProperty(HttpClientError.prototype, "requestId", {
|
34186 | get: function() {
|
34187 | return this.httpRequestId;
|
34188 | },
|
34189 | enumerable: !0,
|
34190 | configurable: !0
|
34191 | }), HttpClientError.prototype.getDetails = function(resourceProvider) {
|
34192 | var details = {
|
34193 | message: null,
|
34194 | displayableErrorInfo: [ {
|
34195 | errorInfoKey: resourceProvider.get("DsrError_Key"),
|
34196 | errorInfoValue: resourceProvider.get("DsrError_UnknownErrorValue")
|
34197 | }, {
|
34198 | errorInfoKey: resourceProvider.get("ClientError_HttpResponseStatusCodeKey"),
|
34199 | errorInfoValue: this.httpStatusCode.toString()
|
34200 | } ],
|
34201 | debugErrorInfo: [ {
|
34202 | errorInfoKey: ClientErrorStrings.HttpRequestId,
|
34203 | errorInfoValue: this.httpRequestId
|
34204 | }, {
|
34205 | errorInfoKey: ClientErrorStrings.ClientErrorCode,
|
34206 | errorInfoValue: this.code
|
34207 | } ]
|
34208 | };
|
34209 | return details;
|
34210 | }, HttpClientError;
|
34211 | }();
|
34212 | powerbi.HttpClientError = HttpClientError;
|
34213 | var IgnorableClientError = function() {
|
34214 | function IgnorableClientError() {}
|
34215 | return Object.defineProperty(IgnorableClientError.prototype, "code", {
|
34216 | get: function() {
|
34217 | return "IgnorableClientError";
|
34218 | },
|
34219 | enumerable: !0,
|
34220 | configurable: !0
|
34221 | }), Object.defineProperty(IgnorableClientError.prototype, "ignorable", {
|
34222 | get: function() {
|
34223 | return !0;
|
34224 | },
|
34225 | enumerable: !0,
|
34226 | configurable: !0
|
34227 | }), IgnorableClientError.prototype.getDetails = function(resourceProvider) {
|
34228 | var details = {
|
34229 | message: "",
|
34230 | displayableErrorInfo: []
|
34231 | };
|
34232 | return details;
|
34233 | }, IgnorableClientError;
|
34234 | }();
|
34235 | powerbi.IgnorableClientError = IgnorableClientError;
|
34236 | }(powerbi || (powerbi = {}));
|
34237 | }, function(module, exports) {
|
34238 | var jsCommon, jsCommon = window.jsCommon;
|
34239 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
34240 | window.Microsoft;
|
34241 | !function(jsCommon) {
|
34242 | var ArrayExtensions;
|
34243 | !function(ArrayExtensions) {
|
34244 | function intersect(target, other) {
|
34245 | for (var result = [], i = target.length - 1; i >= 0; --i) -1 !== other.indexOf(target[i]) && result.push(target[i]);
|
34246 | return result;
|
34247 | }
|
34248 | function diff(target, other) {
|
34249 | for (var result = [], i = target.length - 1; i >= 0; --i) {
|
34250 | var value = target[i];
|
34251 | -1 === other.indexOf(value) && result.push(value);
|
34252 | }
|
34253 | return result;
|
34254 | }
|
34255 | function distinct(source) {
|
34256 | for (var result = [], i = 0, len = source.length; len > i; i++) {
|
34257 | var value = source[i];
|
34258 | -1 === result.indexOf(value) && result.push(value);
|
34259 | }
|
34260 | return result;
|
34261 | }
|
34262 | function union(target, source) {
|
34263 | for (var i = 0, len = source.length; len > i; ++i) unionSingle(target, source[i]);
|
34264 | }
|
34265 | function unionSingle(target, value) {
|
34266 | target.indexOf(value) < 0 && target.push(value);
|
34267 | }
|
34268 | function range(source, startIndex, endIndex) {
|
34269 | for (var result = [], i = startIndex; endIndex >= i; ++i) result.push(source[i]);
|
34270 | return result;
|
34271 | }
|
34272 | function take(source, count) {
|
34273 | for (var result = [], i = 0; count > i; ++i) result.push(source[i]);
|
34274 | return result;
|
34275 | }
|
34276 | function copy(source) {
|
34277 | return take(source, source.length);
|
34278 | }
|
34279 | function sequenceEqual(left, right, comparison) {
|
34280 | if (left || (left = null), right || (right = null), left === right) return !0;
|
34281 | if (!!left != !!right) return !1;
|
34282 | var len = left.length;
|
34283 | if (len !== right.length) return !1;
|
34284 | for (var i = 0; len > i && comparison(left[i], right[i]); ) ++i;
|
34285 | return i === len;
|
34286 | }
|
34287 | function emptyToNull(array) {
|
34288 | return array && 0 === array.length ? null : array;
|
34289 | }
|
34290 | function indexOf(array, predicate) {
|
34291 | for (var i = 0, len = array.length; len > i; ++i) if (predicate(array[i])) return i;
|
34292 | return -1;
|
34293 | }
|
34294 | function rotate(array, offset) {
|
34295 | if (0 === offset) return array.slice();
|
34296 | var rotated = array.slice(offset);
|
34297 | return Array.prototype.push.apply(rotated, array.slice(0, offset)), rotated;
|
34298 | }
|
34299 | function createWithId() {
|
34300 | return extendWithId([]);
|
34301 | }
|
34302 | function extendWithId(array) {
|
34303 | var extended = array;
|
34304 | return extended.withId = withId, extended;
|
34305 | }
|
34306 | function findWithId(array, id) {
|
34307 | for (var i = 0, len = array.length; len > i; i++) {
|
34308 | var item = array[i];
|
34309 | if (item.id === id) return item;
|
34310 | }
|
34311 | }
|
34312 | function withId(id) {
|
34313 | return ArrayExtensions.findWithId(this, id);
|
34314 | }
|
34315 | function createWithName() {
|
34316 | return extendWithName([]);
|
34317 | }
|
34318 | function extendWithName(array) {
|
34319 | var extended = array;
|
34320 | return extended.withName = withName, extended;
|
34321 | }
|
34322 | function findItemWithName(array, name) {
|
34323 | var index = indexWithName(array, name);
|
34324 | return index >= 0 ? array[index] : void 0;
|
34325 | }
|
34326 | function indexWithName(array, name) {
|
34327 | for (var i = 0, len = array.length; len > i; i++) {
|
34328 | var item = array[i];
|
34329 | if (item.name === name) return i;
|
34330 | }
|
34331 | return -1;
|
34332 | }
|
34333 | function insertSorted(list, value) {
|
34334 | for (var len = list.length, i = len - 1; i >= 0; i--) {
|
34335 | var diff_1 = list[i] - value;
|
34336 | if (0 === diff_1) return !1;
|
34337 | if (!(diff_1 > 0)) return list.splice(i + 1, 0, value), !0;
|
34338 | }
|
34339 | return list.unshift(value), !0;
|
34340 | }
|
34341 | function removeFirst(list, value) {
|
34342 | var index = list.indexOf(value);
|
34343 | return 0 > index ? !1 : (list.splice(index, 1), !0);
|
34344 | }
|
34345 | function withName(name) {
|
34346 | var array = this;
|
34347 | return findItemWithName(array, name);
|
34348 | }
|
34349 | function clear(array) {
|
34350 | if (array) for (;array.length > 0; ) array.pop();
|
34351 | }
|
34352 | function isUndefinedOrEmpty(array) {
|
34353 | return !array || 0 === array.length;
|
34354 | }
|
34355 | function swap(array, firstIndex, secondIndex) {
|
34356 | var temp = array[firstIndex];
|
34357 | array[firstIndex] = array[secondIndex], array[secondIndex] = temp;
|
34358 | }
|
34359 | function isInArray(array, lookupItem, compareCallback) {
|
34360 | return _.any(array, function(item) {
|
34361 | return compareCallback(item, lookupItem);
|
34362 | });
|
34363 | }
|
34364 | function isArrayOrInheritedArray(obj) {
|
34365 | for (var nextPrototype = obj; null != nextPrototype; ) {
|
34366 | if (_.isArray(nextPrototype)) return !0;
|
34367 | nextPrototype = Object.getPrototypeOf(nextPrototype);
|
34368 | }
|
34369 | return !1;
|
34370 | }
|
34371 | function isSorted(values, compareFunction) {
|
34372 | var ilen = values.length;
|
34373 | if (ilen >= 2) for (var i = 1; ilen > i; i++) if (compareFunction(values[i - 1], values[i]) > 0) return !1;
|
34374 | return !0;
|
34375 | }
|
34376 | function isSortedNumeric(values, descendingOrder) {
|
34377 | var compareFunction = descendingOrder ? function(a, b) {
|
34378 | return b - a;
|
34379 | } : function(a, b) {
|
34380 | return a - b;
|
34381 | };
|
34382 | return isSorted(values, compareFunction);
|
34383 | }
|
34384 | ArrayExtensions.intersect = intersect, ArrayExtensions.diff = diff, ArrayExtensions.distinct = distinct,
|
34385 | ArrayExtensions.union = union, ArrayExtensions.unionSingle = unionSingle, ArrayExtensions.range = range,
|
34386 | ArrayExtensions.take = take, ArrayExtensions.copy = copy, ArrayExtensions.sequenceEqual = sequenceEqual,
|
34387 | ArrayExtensions.emptyToNull = emptyToNull, ArrayExtensions.indexOf = indexOf, ArrayExtensions.rotate = rotate,
|
34388 | ArrayExtensions.createWithId = createWithId, ArrayExtensions.extendWithId = extendWithId,
|
34389 | ArrayExtensions.findWithId = findWithId, ArrayExtensions.createWithName = createWithName,
|
34390 | ArrayExtensions.extendWithName = extendWithName, ArrayExtensions.findItemWithName = findItemWithName,
|
34391 | ArrayExtensions.indexWithName = indexWithName, ArrayExtensions.insertSorted = insertSorted,
|
34392 | ArrayExtensions.removeFirst = removeFirst, ArrayExtensions.clear = clear, ArrayExtensions.isUndefinedOrEmpty = isUndefinedOrEmpty,
|
34393 | ArrayExtensions.swap = swap, ArrayExtensions.isInArray = isInArray, ArrayExtensions.isArrayOrInheritedArray = isArrayOrInheritedArray,
|
34394 | ArrayExtensions.isSorted = isSorted, ArrayExtensions.isSortedNumeric = isSortedNumeric;
|
34395 | }(ArrayExtensions = jsCommon.ArrayExtensions || (jsCommon.ArrayExtensions = {}));
|
34396 | }(jsCommon || (jsCommon = {}));
|
34397 | }, function(module, exports) {
|
34398 | var InJs, InJs = (window.jsCommon, window.powerbi, window.powerbitests, window.InJs);
|
34399 | window.debug, window.jasmine, window.Microsoft;
|
34400 | !function(InJs) {
|
34401 | var DomFactory;
|
34402 | !function(DomFactory) {
|
34403 | function div() {
|
34404 | return $("<div/>");
|
34405 | }
|
34406 | function span() {
|
34407 | return $("<span/>");
|
34408 | }
|
34409 | function checkbox() {
|
34410 | return $('<input type="checkbox"/>');
|
34411 | }
|
34412 | function ul() {
|
34413 | return $("<ul/>");
|
34414 | }
|
34415 | function li() {
|
34416 | return $("<li/>");
|
34417 | }
|
34418 | function button() {
|
34419 | return $('<input type="button"/>');
|
34420 | }
|
34421 | function select() {
|
34422 | return $("<select/>");
|
34423 | }
|
34424 | function textBox() {
|
34425 | return $('<input type="text"/>');
|
34426 | }
|
34427 | function img() {
|
34428 | return $("<img/>");
|
34429 | }
|
34430 | function iframe() {
|
34431 | return $("<iframe/>");
|
34432 | }
|
34433 | DomFactory.div = div, DomFactory.span = span, DomFactory.checkbox = checkbox, DomFactory.ul = ul,
|
34434 | DomFactory.li = li, DomFactory.button = button, DomFactory.select = select, DomFactory.textBox = textBox,
|
34435 | DomFactory.img = img, DomFactory.iframe = iframe;
|
34436 | }(DomFactory = InJs.DomFactory || (InJs.DomFactory = {}));
|
34437 | }(InJs || (InJs = {}));
|
34438 | }, function(module, exports) {
|
34439 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
34440 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
34441 | !function(powerbi) {
|
34442 | function applyDefault(value, defaultValue) {
|
34443 | return void 0 !== value ? value : defaultValue;
|
34444 | }
|
34445 | var Double;
|
34446 | !function(Double) {
|
34447 | function pow10(exp) {
|
34448 | return exp >= 0 ? exp < Double.POSITIVE_POWERS.length ? Double.POSITIVE_POWERS[exp] : 1 / 0 : (exp = -exp,
|
34449 | exp > 0 && exp < Double.NEGATIVE_POWERS.length ? Double.NEGATIVE_POWERS[exp] : 0);
|
34450 | }
|
34451 | function log10(val) {
|
34452 | if (val > 1 && 1e16 > val) return 1e8 > val ? 1e4 > val ? 100 > val ? 10 > val ? 0 : 1 : 1e3 > val ? 2 : 3 : 1e6 > val ? 1e5 > val ? 4 : 5 : 1e7 > val ? 6 : 7 : 1e12 > val ? 1e10 > val ? 1e9 > val ? 8 : 9 : 1e11 > val ? 10 : 11 : 1e14 > val ? 1e13 > val ? 12 : 13 : 1e15 > val ? 14 : 15;
|
34453 | if (val > 1e-16 && 1 > val) return 1e-8 > val ? 1e-12 > val ? 1e-14 > val ? 1e-15 > val ? -16 : -15 : 1e-13 > val ? -14 : -13 : 1e-10 > val ? 1e-11 > val ? -12 : -11 : 1e-9 > val ? -10 : -9 : 1e-4 > val ? 1e-6 > val ? 1e-7 > val ? -8 : -7 : 1e-5 > val ? -6 : -5 : .01 > val ? .001 > val ? -4 : -3 : .1 > val ? -2 : -1;
|
34454 | var log10 = Math.log(val) / Double.LOG_E_10;
|
34455 | return Double.floorWithPrecision(log10);
|
34456 | }
|
34457 | function getPrecision(x, decimalDigits) {
|
34458 | if (void 0 === decimalDigits && (decimalDigits = Double.DEFAULT_PRECISION_IN_DECIMAL_DIGITS),
|
34459 | x) {
|
34460 | var exp = Double.log10(Math.abs(x));
|
34461 | if (exp < Double.MIN_EXP) return 0;
|
34462 | var precisionExp = Math.max(exp - decimalDigits, -Double.NEGATIVE_POWERS.length + 1);
|
34463 | return Double.pow10(precisionExp);
|
34464 | }
|
34465 | }
|
34466 | function equalWithPrecision(x, y, precision) {
|
34467 | return precision = applyDefault(precision, Double.DEFAULT_PRECISION), x === y || Math.abs(x - y) < precision;
|
34468 | }
|
34469 | function lessWithPrecision(x, y, precision) {
|
34470 | return precision = applyDefault(precision, Double.DEFAULT_PRECISION), y > x && Math.abs(x - y) > precision;
|
34471 | }
|
34472 | function lessOrEqualWithPrecision(x, y, precision) {
|
34473 | return precision = applyDefault(precision, Double.DEFAULT_PRECISION), y > x || Math.abs(x - y) < precision;
|
34474 | }
|
34475 | function greaterWithPrecision(x, y, precision) {
|
34476 | return precision = applyDefault(precision, Double.DEFAULT_PRECISION), x > y && Math.abs(x - y) > precision;
|
34477 | }
|
34478 | function greaterOrEqualWithPrecision(x, y, precision) {
|
34479 | return precision = applyDefault(precision, Double.DEFAULT_PRECISION), x > y || Math.abs(x - y) < precision;
|
34480 | }
|
34481 | function floorWithPrecision(x, precision) {
|
34482 | precision = applyDefault(precision, Double.DEFAULT_PRECISION);
|
34483 | var roundX = Math.round(x);
|
34484 | return Math.abs(x - roundX) < precision ? roundX : Math.floor(x);
|
34485 | }
|
34486 | function ceilWithPrecision(x, precision) {
|
34487 | precision = applyDefault(precision, Double.DEFAULT_PRECISION);
|
34488 | var roundX = Math.round(x);
|
34489 | return Math.abs(x - roundX) < precision ? roundX : Math.ceil(x);
|
34490 | }
|
34491 | function floorToPrecision(x, precision) {
|
34492 | return precision = applyDefault(precision, Double.DEFAULT_PRECISION), 0 === precision || 0 === x ? x : Math.floor(x / precision) * precision;
|
34493 | }
|
34494 | function ceilToPrecision(x, precision) {
|
34495 | return precision = applyDefault(precision, Double.DEFAULT_PRECISION), 0 === precision || 0 === x ? x : Math.ceil(x / precision) * precision;
|
34496 | }
|
34497 | function roundToPrecision(x, precision) {
|
34498 | if (precision = applyDefault(precision, Double.DEFAULT_PRECISION), 0 === precision || 0 === x) return x;
|
34499 | var result = Math.round(x / precision) * precision, decimalDigits = Math.round(Double.log10(Math.abs(x)) - Double.log10(precision)) + 1;
|
34500 | return decimalDigits > 0 && 16 > decimalDigits && (result = parseFloat(result.toPrecision(decimalDigits))),
|
34501 | result;
|
34502 | }
|
34503 | function ensureInRange(x, min, max) {
|
34504 | return void 0 === x || null === x ? x : min > x ? min : x > max ? max : x;
|
34505 | }
|
34506 | function round(x) {
|
34507 | return .5 + x << 0;
|
34508 | }
|
34509 | function project(value, fromMin, fromSize, toMin, toSize) {
|
34510 | if (0 === fromSize || 0 === toSize) return value >= fromMin && fromMin + fromSize >= value ? toMin : NaN;
|
34511 | var relativeX = (value - fromMin) / fromSize, projectedX = toMin + relativeX * toSize;
|
34512 | return projectedX;
|
34513 | }
|
34514 | function removeDecimalNoise(value) {
|
34515 | return roundToPrecision(value, getPrecision(value));
|
34516 | }
|
34517 | function isInteger(value) {
|
34518 | return null !== value && value % 1 === 0;
|
34519 | }
|
34520 | function toIncrement(value, increment) {
|
34521 | return Math.round(value / increment) * increment;
|
34522 | }
|
34523 | Double.MIN_VALUE = -Number.MAX_VALUE, Double.MAX_VALUE = Number.MAX_VALUE, Double.MIN_EXP = -308,
|
34524 | Double.MAX_EXP = 308, Double.EPSILON = 1e-323, Double.DEFAULT_PRECISION = 1e-4,
|
34525 | Double.DEFAULT_PRECISION_IN_DECIMAL_DIGITS = 12, Double.LOG_E_10 = Math.log(10),
|
34526 | Double.POSITIVE_POWERS = [ 1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22, 1e23, 1e24, 1e25, 1e26, 1e27, 1e28, 1e29, 1e30, 1e31, 1e32, 1e33, 1e34, 1e35, 1e36, 1e37, 1e38, 1e39, 1e40, 1e41, 1e42, 1e43, 1e44, 1e45, 1e46, 1e47, 1e48, 1e49, 1e50, 1e51, 1e52, 1e53, 1e54, 1e55, 1e56, 1e57, 1e58, 1e59, 1e60, 1e61, 1e62, 1e63, 1e64, 1e65, 1e66, 1e67, 1e68, 1e69, 1e70, 1e71, 1e72, 1e73, 1e74, 1e75, 1e76, 1e77, 1e78, 1e79, 1e80, 1e81, 1e82, 1e83, 1e84, 1e85, 1e86, 1e87, 1e88, 1e89, 1e90, 1e91, 1e92, 1e93, 1e94, 1e95, 1e96, 1e97, 1e98, 1e99, 1e100, 1e101, 1e102, 1e103, 1e104, 1e105, 1e106, 1e107, 1e108, 1e109, 1e110, 1e111, 1e112, 1e113, 1e114, 1e115, 1e116, 1e117, 1e118, 1e119, 1e120, 1e121, 1e122, 1e123, 1e124, 1e125, 1e126, 1e127, 1e128, 1e129, 1e130, 1e131, 1e132, 1e133, 1e134, 1e135, 1e136, 1e137, 1e138, 1e139, 1e140, 1e141, 1e142, 1e143, 1e144, 1e145, 1e146, 1e147, 1e148, 1e149, 1e150, 1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159, 1e160, 1e161, 1e162, 1e163, 1e164, 1e165, 1e166, 1e167, 1e168, 1e169, 1e170, 1e171, 1e172, 1e173, 1e174, 1e175, 1e176, 1e177, 1e178, 1e179, 1e180, 1e181, 1e182, 1e183, 1e184, 1e185, 1e186, 1e187, 1e188, 1e189, 1e190, 1e191, 1e192, 1e193, 1e194, 1e195, 1e196, 1e197, 1e198, 1e199, 1e200, 1e201, 1e202, 1e203, 1e204, 1e205, 1e206, 1e207, 1e208, 1e209, 1e210, 1e211, 1e212, 1e213, 1e214, 1e215, 1e216, 1e217, 1e218, 1e219, 1e220, 1e221, 1e222, 1e223, 1e224, 1e225, 1e226, 1e227, 1e228, 1e229, 1e230, 1e231, 1e232, 1e233, 1e234, 1e235, 1e236, 1e237, 1e238, 1e239, 1e240, 1e241, 1e242, 1e243, 1e244, 1e245, 1e246, 1e247, 1e248, 1e249, 1e250, 1e251, 1e252, 1e253, 1e254, 1e255, 1e256, 1e257, 1e258, 1e259, 1e260, 1e261, 1e262, 1e263, 1e264, 1e265, 1e266, 1e267, 1e268, 1e269, 1e270, 1e271, 1e272, 1e273, 1e274, 1e275, 1e276, 1e277, 1e278, 1e279, 1e280, 1e281, 1e282, 1e283, 1e284, 1e285, 1e286, 1e287, 1e288, 1e289, 1e290, 1e291, 1e292, 1e293, 1e294, 1e295, 1e296, 1e297, 1e298, 1e299, 1e300, 1e301, 1e302, 1e303, 1e304, 1e305, 1e306, 1e307, 1e308 ],
|
34527 | Double.NEGATIVE_POWERS = [ 1, .1, .01, .001, 1e-4, 1e-5, 1e-6, 1e-7, 1e-8, 1e-9, 1e-10, 1e-11, 1e-12, 1e-13, 1e-14, 1e-15, 1e-16, 1e-17, 1e-18, 1e-19, 1e-20, 1e-21, 1e-22, 1e-23, 1e-24, 1e-25, 1e-26, 1e-27, 1e-28, 1e-29, 1e-30, 1e-31, 1e-32, 1e-33, 1e-34, 1e-35, 1e-36, 1e-37, 1e-38, 1e-39, 1e-40, 1e-41, 1e-42, 1e-43, 1e-44, 1e-45, 1e-46, 1e-47, 1e-48, 1e-49, 1e-50, 1e-51, 1e-52, 1e-53, 1e-54, 1e-55, 1e-56, 1e-57, 1e-58, 1e-59, 1e-60, 1e-61, 1e-62, 1e-63, 1e-64, 1e-65, 1e-66, 1e-67, 1e-68, 1e-69, 1e-70, 1e-71, 1e-72, 1e-73, 1e-74, 1e-75, 1e-76, 1e-77, 1e-78, 1e-79, 1e-80, 1e-81, 1e-82, 1e-83, 1e-84, 1e-85, 1e-86, 1e-87, 1e-88, 1e-89, 1e-90, 1e-91, 1e-92, 1e-93, 1e-94, 1e-95, 1e-96, 1e-97, 1e-98, 1e-99, 1e-100, 1e-101, 1e-102, 1e-103, 1e-104, 1e-105, 1e-106, 1e-107, 1e-108, 1e-109, 1e-110, 1e-111, 1e-112, 1e-113, 1e-114, 1e-115, 1e-116, 1e-117, 1e-118, 1e-119, 1e-120, 1e-121, 1e-122, 1e-123, 1e-124, 1e-125, 1e-126, 1e-127, 1e-128, 1e-129, 1e-130, 1e-131, 1e-132, 1e-133, 1e-134, 1e-135, 1e-136, 1e-137, 1e-138, 1e-139, 1e-140, 1e-141, 1e-142, 1e-143, 1e-144, 1e-145, 1e-146, 1e-147, 1e-148, 1e-149, 1e-150, 1e-151, 1e-152, 1e-153, 1e-154, 1e-155, 1e-156, 1e-157, 1e-158, 1e-159, 1e-160, 1e-161, 1e-162, 1e-163, 1e-164, 1e-165, 1e-166, 1e-167, 1e-168, 1e-169, 1e-170, 1e-171, 1e-172, 1e-173, 1e-174, 1e-175, 1e-176, 1e-177, 1e-178, 1e-179, 1e-180, 1e-181, 1e-182, 1e-183, 1e-184, 1e-185, 1e-186, 1e-187, 1e-188, 1e-189, 1e-190, 1e-191, 1e-192, 1e-193, 1e-194, 1e-195, 1e-196, 1e-197, 1e-198, 1e-199, 1e-200, 1e-201, 1e-202, 1e-203, 1e-204, 1e-205, 1e-206, 1e-207, 1e-208, 1e-209, 1e-210, 1e-211, 1e-212, 1e-213, 1e-214, 1e-215, 1e-216, 1e-217, 1e-218, 1e-219, 1e-220, 1e-221, 1e-222, 1e-223, 1e-224, 1e-225, 1e-226, 1e-227, 1e-228, 1e-229, 1e-230, 1e-231, 1e-232, 1e-233, 1e-234, 1e-235, 1e-236, 1e-237, 1e-238, 1e-239, 1e-240, 1e-241, 1e-242, 1e-243, 1e-244, 1e-245, 1e-246, 1e-247, 1e-248, 1e-249, 1e-250, 1e-251, 1e-252, 1e-253, 1e-254, 1e-255, 1e-256, 1e-257, 1e-258, 1e-259, 1e-260, 1e-261, 1e-262, 1e-263, 1e-264, 1e-265, 1e-266, 1e-267, 1e-268, 1e-269, 1e-270, 1e-271, 1e-272, 1e-273, 1e-274, 1e-275, 1e-276, 1e-277, 1e-278, 1e-279, 1e-280, 1e-281, 1e-282, 1e-283, 1e-284, 1e-285, 1e-286, 1e-287, 1e-288, 1e-289, 1e-290, 1e-291, 1e-292, 1e-293, 1e-294, 1e-295, 1e-296, 1e-297, 1e-298, 1e-299, 1e-300, 1e-301, 1e-302, 1e-303, 1e-304, 1e-305, 1e-306, 1e-307, 1e-308, 1e-309, 1e-310, 1e-311, 1e-312, 1e-313, 1e-314, 1e-315, 1e-316, 1e-317, 1e-318, 1e-319, 1e-320, 1e-321, 1e-322, 1e-323, 0 ],
|
34528 | Double.pow10 = pow10, Double.log10 = log10, Double.getPrecision = getPrecision,
|
34529 | Double.equalWithPrecision = equalWithPrecision, Double.lessWithPrecision = lessWithPrecision,
|
34530 | Double.lessOrEqualWithPrecision = lessOrEqualWithPrecision, Double.greaterWithPrecision = greaterWithPrecision,
|
34531 | Double.greaterOrEqualWithPrecision = greaterOrEqualWithPrecision, Double.floorWithPrecision = floorWithPrecision,
|
34532 | Double.ceilWithPrecision = ceilWithPrecision, Double.floorToPrecision = floorToPrecision,
|
34533 | Double.ceilToPrecision = ceilToPrecision, Double.roundToPrecision = roundToPrecision,
|
34534 | Double.ensureInRange = ensureInRange, Double.round = round, Double.project = project,
|
34535 | Double.removeDecimalNoise = removeDecimalNoise, Double.isInteger = isInteger, Double.toIncrement = toIncrement;
|
34536 | }(Double = powerbi.Double || (powerbi.Double = {}));
|
34537 | }(powerbi || (powerbi = {}));
|
34538 | }, function(module, exports) {
|
34539 | var jsCommon, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
34540 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
34541 | !function(jsCommon) {
|
34542 | var Color, Double = powerbi.Double;
|
34543 | !function(Color) {
|
34544 | function rotate(rgbString, rotateFactor) {
|
34545 | if (0 === rotateFactor) return rgbString;
|
34546 | var originalRgb = parseColorString(rgbString), originalHsv = rgbToHsv(originalRgb), rotatedHsv = rotateHsv(originalHsv, rotateFactor), rotatedRgb = hsvToRgb(rotatedHsv);
|
34547 | return hexString(rotatedRgb);
|
34548 | }
|
34549 | function normalizeToHexString(color) {
|
34550 | var rgb = parseColorString(color);
|
34551 | return hexString(rgb);
|
34552 | }
|
34553 | function parseColorString(color) {
|
34554 | if (color.indexOf("#") >= 0) {
|
34555 | if (7 === color.length) {
|
34556 | var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(color);
|
34557 | if (null == result || result.length < 4) return;
|
34558 | return {
|
34559 | R: parseInt(result[1], 16),
|
34560 | G: parseInt(result[2], 16),
|
34561 | B: parseInt(result[3], 16)
|
34562 | };
|
34563 | }
|
34564 | if (4 === color.length) {
|
34565 | var result = /^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(color);
|
34566 | if (null == result || result.length < 4) return;
|
34567 | return {
|
34568 | R: parseInt(result[1] + result[1], 16),
|
34569 | G: parseInt(result[2] + result[2], 16),
|
34570 | B: parseInt(result[3] + result[3], 16)
|
34571 | };
|
34572 | }
|
34573 | } else {
|
34574 | if (color.indexOf("rgb(") >= 0) {
|
34575 | var result = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/.exec(color);
|
34576 | if (null == result || result.length < 4) return;
|
34577 | return {
|
34578 | R: parseInt(result[1], 10),
|
34579 | G: parseInt(result[2], 10),
|
34580 | B: parseInt(result[3], 10)
|
34581 | };
|
34582 | }
|
34583 | if (color.indexOf("rgba(") >= 0) {
|
34584 | var result = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*(?:\.\d+)?)\)$/.exec(color);
|
34585 | if (null == result || result.length < 5) return;
|
34586 | return {
|
34587 | R: parseInt(result[1], 10),
|
34588 | G: parseInt(result[2], 10),
|
34589 | B: parseInt(result[3], 10),
|
34590 | A: parseFloat(result[4])
|
34591 | };
|
34592 | }
|
34593 | }
|
34594 | }
|
34595 | function rgbToHsv(rgbColor) {
|
34596 | var s, h, r = rgbColor.R / 255, g = rgbColor.G / 255, b = rgbColor.B / 255, min = Math.min(r, Math.min(g, b)), max = Math.max(r, Math.max(g, b)), v = max, delta = max - min;
|
34597 | return 0 === max || 0 === delta ? (s = 0, h = 0) : (s = delta / max, h = r === max ? (g - b) / delta : g === max ? 2 + (b - r) / delta : 4 + (r - g) / delta),
|
34598 | h /= 6, 0 > h && (h += 1), {
|
34599 | H: h,
|
34600 | S: s,
|
34601 | V: v
|
34602 | };
|
34603 | }
|
34604 | function hsvToRgb(hsvColor) {
|
34605 | var r, g, b, h = hsvColor.H, s = hsvColor.S, v = hsvColor.V;
|
34606 | if (0 === s) r = v, g = v, b = v; else {
|
34607 | var p = void 0, q = void 0, t = void 0, fractionalSector = void 0, sectorNumber = void 0, sectorPos = void 0;
|
34608 | switch (sectorPos = 6 * h, sectorNumber = Math.floor(sectorPos), fractionalSector = sectorPos - sectorNumber,
|
34609 | p = v * (1 - s), q = v * (1 - s * fractionalSector), t = v * (1 - s * (1 - fractionalSector)),
|
34610 | sectorNumber) {
|
34611 | case 0:
|
34612 | r = v, g = t, b = p;
|
34613 | break;
|
34614 |
|
34615 | case 1:
|
34616 | r = q, g = v, b = p;
|
34617 | break;
|
34618 |
|
34619 | case 2:
|
34620 | r = p, g = v, b = t;
|
34621 | break;
|
34622 |
|
34623 | case 3:
|
34624 | r = p, g = q, b = v;
|
34625 | break;
|
34626 |
|
34627 | case 4:
|
34628 | r = t, g = p, b = v;
|
34629 | break;
|
34630 |
|
34631 | case 5:
|
34632 | r = v, g = p, b = q;
|
34633 | }
|
34634 | }
|
34635 | return {
|
34636 | R: Math.floor(255 * r),
|
34637 | G: Math.floor(255 * g),
|
34638 | B: Math.floor(255 * b)
|
34639 | };
|
34640 | }
|
34641 | function rotateHsv(hsvColor, rotateFactor) {
|
34642 | var newH = hsvColor.H + rotateFactor;
|
34643 | return {
|
34644 | H: newH > 1 ? newH - 1 : newH,
|
34645 | S: hsvColor.S,
|
34646 | V: hsvColor.V
|
34647 | };
|
34648 | }
|
34649 | function darken(color, diff) {
|
34650 | var flooredNumber = Math.floor(diff);
|
34651 | return {
|
34652 | R: Math.max(0, color.R - flooredNumber),
|
34653 | G: Math.max(0, color.G - flooredNumber),
|
34654 | B: Math.max(0, color.B - flooredNumber)
|
34655 | };
|
34656 | }
|
34657 | function rgbString(color) {
|
34658 | return null == color.A ? "rgb(" + color.R + "," + color.G + "," + color.B + ")" : "rgba(" + color.R + "," + color.G + "," + color.B + "," + color.A + ")";
|
34659 | }
|
34660 | function hexString(color) {
|
34661 | return "#" + componentToHex(color.R) + componentToHex(color.G) + componentToHex(color.B);
|
34662 | }
|
34663 | function hexBlend(foreColor, opacity, backColor) {
|
34664 | return hexString(rgbBlend(parseColorString(foreColor), opacity, parseColorString(backColor)));
|
34665 | }
|
34666 | function rgbBlend(foreColor, opacity, backColor) {
|
34667 | return opacity = Double.ensureInRange(opacity, 0, 1), {
|
34668 | R: channelBlend(foreColor.R, opacity, backColor.R),
|
34669 | G: channelBlend(foreColor.G, opacity, backColor.G),
|
34670 | B: channelBlend(foreColor.B, opacity, backColor.B)
|
34671 | };
|
34672 | }
|
34673 | function channelBlend(foreChannel, opacity, backChannel) {
|
34674 | return opacity = Double.ensureInRange(opacity, 0, 1), foreChannel = Double.ensureInRange(foreChannel, 0, 255),
|
34675 | backChannel = Double.ensureInRange(backChannel, 0, 255), Math.round(opacity * foreChannel + (1 - opacity) * backChannel);
|
34676 | }
|
34677 | function componentToHex(hexComponent) {
|
34678 | var clamped = Double.ensureInRange(hexComponent, 0, 255), hex = clamped.toString(16).toUpperCase();
|
34679 | return 1 === hex.length ? "0" + hex : hex;
|
34680 | }
|
34681 | Color.rotate = rotate, Color.normalizeToHexString = normalizeToHexString, Color.parseColorString = parseColorString,
|
34682 | Color.darken = darken, Color.rgbString = rgbString, Color.hexString = hexString,
|
34683 | Color.hexBlend = hexBlend, Color.rgbBlend = rgbBlend, Color.channelBlend = channelBlend;
|
34684 | }(Color = jsCommon.Color || (jsCommon.Color = {}));
|
34685 | }(jsCommon || (jsCommon = {}));
|
34686 | }, function(module, exports) {
|
34687 | var jsCommon, jsCommon = window.jsCommon;
|
34688 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
34689 | window.Microsoft;
|
34690 | !function(jsCommon) {
|
34691 | var CssConstants;
|
34692 | !function(CssConstants) {
|
34693 | function createClassAndSelector(className) {
|
34694 | return {
|
34695 | "class": className,
|
34696 | selector: "." + className
|
34697 | };
|
34698 | }
|
34699 | CssConstants.createClassAndSelector = createClassAndSelector, CssConstants.styleAttribute = "style",
|
34700 | CssConstants.pixelUnits = "px", CssConstants.heightProperty = "height", CssConstants.widthProperty = "width",
|
34701 | CssConstants.topProperty = "top", CssConstants.bottomProperty = "bottom", CssConstants.leftProperty = "left",
|
34702 | CssConstants.rightProperty = "right", CssConstants.marginTopProperty = "margin-top",
|
34703 | CssConstants.marginLeftProperty = "margin-left", CssConstants.displayProperty = "display",
|
34704 | CssConstants.backgroundProperty = "background", CssConstants.backgroundColorProperty = "background-color",
|
34705 | CssConstants.backgroundRepeatProperty = "background-repeat", CssConstants.backgroundSizeProperty = "background-size",
|
34706 | CssConstants.backgroundImageProperty = "background-image", CssConstants.textShadowProperty = "text-shadow",
|
34707 | CssConstants.textAlignProperty = "text-align", CssConstants.borderTopWidthProperty = "border-top-width",
|
34708 | CssConstants.borderBottomWidthProperty = "border-bottom-width", CssConstants.borderLeftWidthProperty = "border-left-width",
|
34709 | CssConstants.borderRightWidthProperty = "border-right-width", CssConstants.fontSizeProperty = "font-size",
|
34710 | CssConstants.fontWeightProperty = "font-weight", CssConstants.colorProperty = "color",
|
34711 | CssConstants.opacityProperty = "opacity", CssConstants.paddingLeftProperty = "padding-left",
|
34712 | CssConstants.paddingRightProperty = "padding-right", CssConstants.positionProperty = "position",
|
34713 | CssConstants.maxWidthProperty = "max-width", CssConstants.minWidthProperty = "min-width",
|
34714 | CssConstants.overflowProperty = "overflow", CssConstants.overflowXProperty = "overflow-x",
|
34715 | CssConstants.overflowYProperty = "overflow-y", CssConstants.transformProperty = "transform",
|
34716 | CssConstants.webkitTransformProperty = "-webkit-transform", CssConstants.cursorProperty = "cursor",
|
34717 | CssConstants.visibilityProperty = "visibility", CssConstants.absoluteValue = "absolute",
|
34718 | CssConstants.zeroPixelValue = "0px", CssConstants.autoValue = "auto", CssConstants.hiddenValue = "hidden",
|
34719 | CssConstants.noneValue = "none", CssConstants.blockValue = "block", CssConstants.inlineBlockValue = "inline-block",
|
34720 | CssConstants.transparentValue = "transparent", CssConstants.boldValue = "bold",
|
34721 | CssConstants.visibleValue = "visible", CssConstants.tableRowValue = "table-row",
|
34722 | CssConstants.coverValue = "cover", CssConstants.pointerValue = "pointer", CssConstants.scrollValue = "scroll";
|
34723 | }(CssConstants = jsCommon.CssConstants || (jsCommon.CssConstants = {}));
|
34724 | }(jsCommon || (jsCommon = {}));
|
34725 | }, function(module, exports) {
|
34726 | var debug, debug = (window.jsCommon, window.powerbi, window.powerbitests, window.InJs,
|
34727 | window.debug);
|
34728 | window.jasmine, window.Microsoft;
|
34729 | !function(debug) {
|
34730 | function assert(condition, message) {
|
34731 | condition !== !0 && assertFail(message || "condition: " + condition);
|
34732 | }
|
34733 | function assertValue(value, message) {
|
34734 | null !== value && void 0 !== value || assertFail(message || "condition: " + value);
|
34735 | }
|
34736 | function assertNonEmpty(value, message) {
|
34737 | null != value && value.length > 0 || assertFail(message || "condition: " + value);
|
34738 | }
|
34739 | function assertAnyValue(value, message) {}
|
34740 | function assertFail(message) {
|
34741 | (debug.assertFailFunction || alert)("Debug Assert failed: " + message);
|
34742 | }
|
34743 | debug.assert = assert, debug.assertValue = assertValue, debug.assertNonEmpty = assertNonEmpty,
|
34744 | debug.assertAnyValue = assertAnyValue, debug.assertFail = assertFail;
|
34745 | }(debug || (debug = {}));
|
34746 | }, function(module, exports) {
|
34747 | var jsCommon, jsCommon = window.jsCommon;
|
34748 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
34749 | window.Microsoft;
|
34750 | !function(jsCommon) {
|
34751 | function getStackTrace(leadingFramesToRemove) {
|
34752 | void 0 === leadingFramesToRemove && (leadingFramesToRemove = 1);
|
34753 | var stackTrace, stackSegments;
|
34754 | try {
|
34755 | throw new Error();
|
34756 | } catch (error) {
|
34757 | stackTrace = error.stack, null != stackTrace && (stackSegments = stackTrace.split("\n"),
|
34758 | stackSegments.splice(1, leadingFramesToRemove), stackTrace = stackSegments.join("\n"));
|
34759 | }
|
34760 | return stackTrace;
|
34761 | }
|
34762 | var Errors;
|
34763 | !function(Errors) {
|
34764 | function infoNavAppAlreadyPresent() {
|
34765 | return {
|
34766 | name: "infoNavAppAlreadyPresent",
|
34767 | message: "Cannot initialize embedded scenario when the InfoNav App is already present in this context",
|
34768 | stack: getExceptionStackTrace()
|
34769 | };
|
34770 | }
|
34771 | function invalidOperation(message) {
|
34772 | return {
|
34773 | name: "invalidOperation",
|
34774 | message: message,
|
34775 | stack: getExceptionStackTrace()
|
34776 | };
|
34777 | }
|
34778 | function argument(argumentName, message) {
|
34779 | return {
|
34780 | name: "invalidArgumentError",
|
34781 | argument: argumentName,
|
34782 | message: message,
|
34783 | stack: getExceptionStackTrace()
|
34784 | };
|
34785 | }
|
34786 | function argumentNull(argumentName) {
|
34787 | return {
|
34788 | name: "argumentNull",
|
34789 | argument: argumentName,
|
34790 | message: "Argument was null",
|
34791 | stack: getExceptionStackTrace()
|
34792 | };
|
34793 | }
|
34794 | function argumentUndefined(argumentName) {
|
34795 | return {
|
34796 | name: "argumentUndefined",
|
34797 | argument: argumentName,
|
34798 | message: "Argument was undefined",
|
34799 | stack: getExceptionStackTrace()
|
34800 | };
|
34801 | }
|
34802 | function argumentOutOfRange(argumentName) {
|
34803 | return {
|
34804 | name: "argumentOutOfRange",
|
34805 | argument: argumentName,
|
34806 | message: "Argument was out of range",
|
34807 | stack: getExceptionStackTrace()
|
34808 | };
|
34809 | }
|
34810 | function pureVirtualMethodException(className, methodName) {
|
34811 | return {
|
34812 | name: "pureVirtualMethodException",
|
34813 | message: "This method must be overriden by the derived class:" + className + "." + methodName,
|
34814 | stack: getExceptionStackTrace()
|
34815 | };
|
34816 | }
|
34817 | function notImplementedException(message) {
|
34818 | return {
|
34819 | name: "notImplementedException",
|
34820 | message: message,
|
34821 | stack: getExceptionStackTrace()
|
34822 | };
|
34823 | }
|
34824 | function getExceptionStackTrace() {
|
34825 | return getStackTrace(2);
|
34826 | }
|
34827 | Errors.infoNavAppAlreadyPresent = infoNavAppAlreadyPresent, Errors.invalidOperation = invalidOperation,
|
34828 | Errors.argument = argument, Errors.argumentNull = argumentNull, Errors.argumentUndefined = argumentUndefined,
|
34829 | Errors.argumentOutOfRange = argumentOutOfRange, Errors.pureVirtualMethodException = pureVirtualMethodException,
|
34830 | Errors.notImplementedException = notImplementedException;
|
34831 | }(Errors = jsCommon.Errors || (jsCommon.Errors = {})), jsCommon.getStackTrace = getStackTrace;
|
34832 | }(jsCommon || (jsCommon = {}));
|
34833 | }, function(module, exports) {
|
34834 | var jsCommon = window.jsCommon;
|
34835 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
34836 | window.Microsoft;
|
34837 | $.fn.multiline = function(text) {
|
34838 | return this.text(text), this.html(this.html().replace(/\n/g, "<br/>")), this;
|
34839 | }, $.fn.togglePanelControl = function() {
|
34840 | return this.each(function() {
|
34841 | $(this).addClass("ui-accordion ui-accordion-icons ui-widget ui-helper-reset").find(".accordionHeader").addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom").hover(function() {
|
34842 | $(this).toggleClass("ui-state-hover");
|
34843 | }).prepend('<span class="ui-icon ui-icon-triangle-1-e"></span>').click(function() {
|
34844 | return $(this).toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom").find("> .ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s").end().next().slideToggle(),
|
34845 | !1;
|
34846 | }).next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").hide();
|
34847 | });
|
34848 | };
|
34849 | var jsCommon;
|
34850 | !function(jsCommon) {
|
34851 | var JQueryConstants;
|
34852 | !function(JQueryConstants) {
|
34853 | JQueryConstants.VisibleSelector = ":visible";
|
34854 | }(JQueryConstants = jsCommon.JQueryConstants || (jsCommon.JQueryConstants = {}));
|
34855 | }(jsCommon || (jsCommon = {}));
|
34856 | }, function(module, exports) {
|
34857 | var jsCommon, jsCommon = window.jsCommon;
|
34858 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
34859 | window.Microsoft;
|
34860 | !function(jsCommon) {
|
34861 | var Lazy = function() {
|
34862 | function Lazy(factoryMethod) {
|
34863 | jsCommon.Utility.throwIfNullOrUndefined(factoryMethod, this, "constructor", "factoryMethod"),
|
34864 | this.factoryMethod = factoryMethod;
|
34865 | }
|
34866 | return Lazy.prototype.getValue = function() {
|
34867 | return null !== this.factoryMethod && (this.value = this.factoryMethod(), this.factoryMethod = null),
|
34868 | this.value;
|
34869 | }, Lazy;
|
34870 | }();
|
34871 | jsCommon.Lazy = Lazy;
|
34872 | }(jsCommon || (jsCommon = {}));
|
34873 | }, function(module, exports) {
|
34874 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
34875 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
34876 | !function(powerbi) {
|
34877 | var Prototype;
|
34878 | !function(Prototype) {
|
34879 | function inherit(obj, extension) {
|
34880 | function wrapCtor() {}
|
34881 | wrapCtor.prototype = obj;
|
34882 | var inherited = new wrapCtor();
|
34883 | return extension && extension(inherited), inherited;
|
34884 | }
|
34885 | function inheritSingle(obj) {
|
34886 | var proto = Object.getPrototypeOf(obj);
|
34887 | return proto !== Object.prototype && proto !== Array.prototype || (obj = inherit(obj)),
|
34888 | obj;
|
34889 | }
|
34890 | function overrideArray(prototype, override) {
|
34891 | if (prototype) {
|
34892 | for (var overwritten, i = 0, len = prototype.length; len > i; i++) {
|
34893 | var value = override(prototype[i]);
|
34894 | value && (overwritten || (overwritten = inherit(prototype)), overwritten[i] = value);
|
34895 | }
|
34896 | return overwritten;
|
34897 | }
|
34898 | }
|
34899 | Prototype.inherit = inherit, Prototype.inheritSingle = inheritSingle, Prototype.overrideArray = overrideArray;
|
34900 | }(Prototype = powerbi.Prototype || (powerbi.Prototype = {}));
|
34901 | }(powerbi || (powerbi = {}));
|
34902 | }, function(module, exports) {
|
34903 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
34904 | window.jasmine, window.Microsoft;
|
34905 | }, function(module, exports) {
|
34906 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
34907 | window.jasmine, window.Microsoft;
|
34908 | }, function(module, exports) {
|
34909 | var jsCommon, jsCommon = window.jsCommon;
|
34910 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
34911 | window.Microsoft;
|
34912 | !function(jsCommon) {
|
34913 | var Formatting;
|
34914 | !function(Formatting) {
|
34915 | function findDateFormat(value, format, cultureName) {
|
34916 | switch (format) {
|
34917 | case "m":
|
34918 | format = "M";
|
34919 | break;
|
34920 |
|
34921 | case "O":
|
34922 | case "o":
|
34923 | format = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'0000'";
|
34924 | break;
|
34925 |
|
34926 | case "R":
|
34927 | case "r":
|
34928 | value = new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds()),
|
34929 | format = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
|
34930 | break;
|
34931 |
|
34932 | case "s":
|
34933 | format = "S";
|
34934 | break;
|
34935 |
|
34936 | case "u":
|
34937 | value = new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds()),
|
34938 | format = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'";
|
34939 | break;
|
34940 |
|
34941 | case "U":
|
34942 | value = new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds()),
|
34943 | format = "F";
|
34944 | break;
|
34945 |
|
34946 | case "y":
|
34947 | case "Y":
|
34948 | switch (cultureName) {
|
34949 | case "default":
|
34950 | case "en":
|
34951 | case "en-US":
|
34952 | format = "MMMM, yyyy";
|
34953 | break;
|
34954 |
|
34955 | default:
|
34956 | format = "Y";
|
34957 | }
|
34958 | }
|
34959 | return {
|
34960 | value: value,
|
34961 | format: format
|
34962 | };
|
34963 | }
|
34964 | function fixDateTimeFormat(format) {
|
34965 | if (format = format.replace(/%K/g, "zzz"), format = format.replace(/K/g, "zzz"),
|
34966 | format = format.replace(/fffffff/g, "fff0000"), format = format.replace(/ffffff/g, "fff000"),
|
34967 | format = format.replace(/fffff/g, "fff00"), format = format.replace(/ffff/g, "fff0"),
|
34968 | format = format.replace(/yyyyy/g, "0yyyy"), format = format.replace(/(^y|^)yyy(^y|$)/g, "yyyy"),
|
34969 | regexCache || (regexCache = [ "d", "f", "F", "g", "h", "H", "K", "m", "M", "s", "t", "y", "z", ":", "/" ].map(function(s) {
|
34970 | return {
|
34971 | r: new RegExp("%" + s + "(?!" + s + ")", "g"),
|
34972 | s: s
|
34973 | };
|
34974 | })), -1 !== format.indexOf("%") && format.length > 2) for (var i = 0; i < regexCache.length; i++) format = format.replace(regexCache[i].r, regexCache[i].s);
|
34975 | return format;
|
34976 | }
|
34977 | var regexCache;
|
34978 | Formatting.findDateFormat = findDateFormat, Formatting.fixDateTimeFormat = fixDateTimeFormat;
|
34979 | }(Formatting = jsCommon.Formatting || (jsCommon.Formatting = {}));
|
34980 | }(jsCommon || (jsCommon = {}));
|
34981 | }, function(module, exports) {
|
34982 | var jsCommon, jsCommon = window.jsCommon;
|
34983 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
34984 | window.Microsoft;
|
34985 | !function(jsCommon) {
|
34986 | function requires(dependency, to) {
|
34987 | void 0 === to && (to = $.noop), loadStyleSheets(dependency.cssFiles || []);
|
34988 | var scriptsToRun = dependency.javaScriptFilesWithCallback || [];
|
34989 | if (dependency.javaScriptFiles) for (var i = 0, len = dependency.javaScriptFiles.length; len > i; ++i) scriptsToRun.push({
|
34990 | javascriptFile: dependency.javaScriptFiles[i]
|
34991 | });
|
34992 | loadJavaScriptFiles(scriptsToRun, to);
|
34993 | }
|
34994 | function loadStyleSheets(hrefList) {
|
34995 | hrefList.forEach(function(href) {
|
34996 | -1 === styleSheetLoaded.indexOf(href) && (styleSheetLoaded.push(href), loadStyleSheet(href));
|
34997 | });
|
34998 | }
|
34999 | function loadJavaScriptFiles(scripts, callback) {
|
35000 | function parseIfLoadingComplete() {
|
35001 | --loadingCount || parseJavaScriptSourceCodes(scripts, sourceCodeList);
|
35002 | }
|
35003 | function makeCallbackIfParsingComplete() {
|
35004 | --parsingCount || callback();
|
35005 | }
|
35006 | var loadingCount = scripts.length, parsingCount = loadingCount, sourceCodeList = [];
|
35007 | scripts.forEach(function(script, index) {
|
35008 | var file = script.javascriptFile;
|
35009 | -1 === javaScriptFilesLoaded.indexOf(file) ? file in javaScriptFilesLoading ? javaScriptFilesLoading[file].push(function() {
|
35010 | parseIfLoadingComplete(), makeCallbackIfParsingComplete();
|
35011 | }) : (javaScriptFilesLoading[file] = [ function() {
|
35012 | makeCallbackIfParsingComplete();
|
35013 | } ], isExternalUrl(file) ? (sourceCodeList[index] = script, parseIfLoadingComplete()) : loadJavaScriptSourceCode(file, function(sourceCode) {
|
35014 | sourceCodeList[index] = {
|
35015 | javascriptFile: sourceCode
|
35016 | }, parseIfLoadingComplete();
|
35017 | })) : (parseIfLoadingComplete(), makeCallbackIfParsingComplete());
|
35018 | });
|
35019 | }
|
35020 | function loadStyleSheet(href) {
|
35021 | var link = linkElement.cloneNode();
|
35022 | link.href = href, firstScriptInHeadElement ? headElement.insertBefore(link, firstScriptInHeadElement) : headElement.appendChild(link);
|
35023 | }
|
35024 | function loadJavaScriptSourceCode(src, onload) {
|
35025 | webGet(src, function() {
|
35026 | onload(this.responseText);
|
35027 | });
|
35028 | }
|
35029 | function parseJavaScript(script, onComplete) {
|
35030 | if (void 0 === onComplete && (onComplete = $.noop), !script) return void onComplete();
|
35031 | var sourceCodeOrFileName = script.javascriptFile, targetCallback = onComplete;
|
35032 | if (script.onLoadCallback) {
|
35033 | var promiseAsCallback = function() {
|
35034 | script.onLoadCallback().then(onComplete);
|
35035 | };
|
35036 | targetCallback = promiseAsCallback;
|
35037 | }
|
35038 | isExternalUrl(sourceCodeOrFileName) ? loadExternalJavaScriptFile(sourceCodeOrFileName, targetCallback) : parseInternalJavaScriptCode(sourceCodeOrFileName, targetCallback);
|
35039 | }
|
35040 | function parseInternalJavaScriptCode(sourceCode, onComplete) {
|
35041 | void 0 === onComplete && (onComplete = $.noop);
|
35042 | var script;
|
35043 | sourceCode && (script = scriptElement.cloneNode(), script.setAttribute("type", "text/javascript"),
|
35044 | script.innerHTML = sourceCode, headElement.appendChild(script)), setTimeout(onComplete, 0);
|
35045 | }
|
35046 | function loadExternalJavaScriptFile(src, onload) {
|
35047 | var script;
|
35048 | src && (script = scriptElement.cloneNode(), script.setAttribute("src", src), script.setAttribute("charset", "utf-8"),
|
35049 | script.onload = onload, headElement.appendChild(script));
|
35050 | }
|
35051 | function parseJavaScriptSourceCodes(scripts, sourceCodeList) {
|
35052 | asyncLoop(sourceCodeList, parseJavaScript, function() {
|
35053 | scripts.forEach(function(script) {
|
35054 | var file = script.javascriptFile, listeners = javaScriptFilesLoading[file];
|
35055 | listeners && listeners.forEach(function(listener) {
|
35056 | listener();
|
35057 | }), delete javaScriptFilesLoading[file], -1 === javaScriptFilesLoaded.indexOf(file) && javaScriptFilesLoaded.push(file);
|
35058 | });
|
35059 | });
|
35060 | }
|
35061 | function webGet(src, onload, onerror) {
|
35062 | var xhr = new XMLHttpRequest();
|
35063 | try {
|
35064 | xhr.open("GET", src, !0), xhr.onload = onload, xhr.onerror = onerror, xhr.send(null);
|
35065 | } catch (e) {}
|
35066 | }
|
35067 | function isExternalUrl(url) {
|
35068 | var origin = location.protocol + "//" + location.host + "/";
|
35069 | return /^http[s]?:\/\/.+/i.test(url) && 0 !== url.indexOf(origin);
|
35070 | }
|
35071 | function _() {
|
35072 | for (var args = [], _i = 0; _i < arguments.length; _i++) args[_i - 0] = arguments[_i];
|
35073 | }
|
35074 | function asyncSteps() {
|
35075 | for (var args = [], _i = 0; _i < arguments.length; _i++) args[_i - 0] = arguments[_i];
|
35076 | if (0 !== args.length) {
|
35077 | for (var steps = [], i = args.length; i--; ) !function(j) {
|
35078 | steps[j] = function() {
|
35079 | args[j](steps[j + 1] || _);
|
35080 | };
|
35081 | }(i);
|
35082 | steps[0]();
|
35083 | }
|
35084 | }
|
35085 | function asyncLoop(enumerable, func, callback) {
|
35086 | for (var steps = [], i = 0, len = enumerable.length; len - 1 > i; i++) !function(i) {
|
35087 | steps[i] = function(next) {
|
35088 | func(enumerable[i], next);
|
35089 | };
|
35090 | }(i);
|
35091 | steps[len - 1] = function(next) {
|
35092 | func(enumerable[len - 1], callback);
|
35093 | }, asyncSteps.apply(null, steps);
|
35094 | }
|
35095 | var doc = document, headElement = doc.head, firstScriptInHeadElement = headElement.getElementsByTagName("script")[0], linkElement = doc.createElement("link"), scriptElement = doc.createElement("script"), styleSheetLoaded = [], javaScriptFilesLoaded = [], javaScriptFilesLoading = [];
|
35096 | linkElement.setAttribute("rel", "stylesheet"), jsCommon.requires = requires;
|
35097 | }(jsCommon || (jsCommon = {}));
|
35098 | }, function(module, exports) {
|
35099 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
35100 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
35101 | !function(powerbi) {
|
35102 | function createJQueryPromiseFactory() {
|
35103 | return new JQueryPromiseFactory();
|
35104 | }
|
35105 | powerbi.createJQueryPromiseFactory = createJQueryPromiseFactory;
|
35106 | var JQueryPromiseFactory = function() {
|
35107 | function JQueryPromiseFactory() {}
|
35108 | return JQueryPromiseFactory.prototype.defer = function() {
|
35109 | return new JQueryDeferredWrapper($.Deferred());
|
35110 | }, JQueryPromiseFactory.prototype.reject = function(reason) {
|
35111 | var deferred = this.defer();
|
35112 | return deferred.reject(reason), deferred.promise;
|
35113 | }, JQueryPromiseFactory.prototype.resolve = function(value) {
|
35114 | var deferred = this.defer();
|
35115 | return deferred.resolve(value), deferred.promise;
|
35116 | }, JQueryPromiseFactory.prototype.all = function(promises) {
|
35117 | var unwrappedPromises = jQuery.map(promises, function(value) {
|
35118 | return value && value.promise ? value.promise : value;
|
35119 | });
|
35120 | return new JQueryPromiseWrapper($.when.apply($, unwrappedPromises));
|
35121 | }, JQueryPromiseFactory.prototype.allSettled = function(promises) {
|
35122 | var deferred = this.defer(), promiseCount = promises.length;
|
35123 | if (promiseCount > 0) for (var resolvedCount_1 = 0, results_1 = [], _loop_1 = function(i) {
|
35124 | promises[i].then(function(result) {
|
35125 | results_1[i] = {
|
35126 | value: result,
|
35127 | type: 0
|
35128 | };
|
35129 | })["catch"](function(result) {
|
35130 | results_1[i] = {
|
35131 | value: result,
|
35132 | type: 1
|
35133 | };
|
35134 | })["finally"](function() {
|
35135 | resolvedCount_1++, resolvedCount_1 === promiseCount && deferred.resolve(results_1);
|
35136 | });
|
35137 | }, i = 0; promiseCount > i; i++) _loop_1(i); else deferred.resolve([]);
|
35138 | return deferred.promise;
|
35139 | }, JQueryPromiseFactory.prototype.when = function(value) {
|
35140 | var unwrappedPromise = value && value.promise ? value.promise : value;
|
35141 | return new JQueryPromiseWrapper($.when(unwrappedPromise));
|
35142 | }, JQueryPromiseFactory;
|
35143 | }(), JQueryDeferredWrapper = function() {
|
35144 | function JQueryDeferredWrapper(deferred) {
|
35145 | this.deferred = deferred, this.promise = new JQueryPromiseWrapper(deferred.promise());
|
35146 | }
|
35147 | return JQueryDeferredWrapper.prototype.resolve = function(value) {
|
35148 | this.deferred.resolve(value);
|
35149 | }, JQueryDeferredWrapper.prototype.reject = function(reason) {
|
35150 | this.deferred.reject(reason);
|
35151 | }, JQueryDeferredWrapper;
|
35152 | }(), JQueryPromiseWrapper = function() {
|
35153 | function JQueryPromiseWrapper(promise) {
|
35154 | this.promise = promise;
|
35155 | }
|
35156 | return JQueryPromiseWrapper.prototype.then = function(a, b) {
|
35157 | return new JQueryPromiseWrapper(this.promise.then(JQueryPromiseWrapper.wrapCallback(a), JQueryPromiseWrapper.wrapCallback(b)));
|
35158 | }, JQueryPromiseWrapper.prototype["catch"] = function(callback) {
|
35159 | return this.then(null, callback);
|
35160 | }, JQueryPromiseWrapper.prototype["finally"] = function(callback) {
|
35161 | return this.promise.always(JQueryPromiseWrapper.wrapCallback(callback)), this;
|
35162 | }, JQueryPromiseWrapper.wrapCallback = function(callback) {
|
35163 | return callback ? function(arg) {
|
35164 | var value = callback(arg);
|
35165 | return value instanceof JQueryPromiseWrapper ? value.promise : value;
|
35166 | } : callback;
|
35167 | }, JQueryPromiseWrapper;
|
35168 | }();
|
35169 | }(powerbi || (powerbi = {}));
|
35170 | }, function(module, exports) {
|
35171 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
35172 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
35173 | !function(powerbi) {
|
35174 | var LocalStorageService = function() {
|
35175 | function LocalStorageService() {}
|
35176 | return LocalStorageService.prototype.getData = function(key) {
|
35177 | try {
|
35178 | if (localStorage) {
|
35179 | var value = localStorage[key];
|
35180 | if (value) return JSON.parse(value);
|
35181 | }
|
35182 | } catch (exception) {}
|
35183 | return null;
|
35184 | }, LocalStorageService.prototype.setData = function(key, data) {
|
35185 | try {
|
35186 | localStorage && (localStorage[key] = JSON.stringify(data));
|
35187 | } catch (e) {}
|
35188 | }, LocalStorageService;
|
35189 | }(), EphemeralStorageService = function() {
|
35190 | function EphemeralStorageService(clearCacheInterval) {
|
35191 | this.cache = {}, this.clearCacheInterval = null != clearCacheInterval ? clearCacheInterval : EphemeralStorageService.defaultClearCacheInterval,
|
35192 | this.clearCache();
|
35193 | }
|
35194 | return EphemeralStorageService.prototype.getData = function(key) {
|
35195 | return this.cache[key];
|
35196 | }, EphemeralStorageService.prototype.setData = function(key, data) {
|
35197 | var _this = this;
|
35198 | this.cache[key] = data, null == this.clearCacheTimerId && (this.clearCacheTimerId = setTimeout(function() {
|
35199 | return _this.clearCache();
|
35200 | }, this.clearCacheInterval));
|
35201 | }, EphemeralStorageService.prototype.clearCache = function() {
|
35202 | this.cache = {}, this.clearCacheTimerId = void 0;
|
35203 | }, EphemeralStorageService.defaultClearCacheInterval = 864e5, EphemeralStorageService;
|
35204 | }();
|
35205 | powerbi.EphemeralStorageService = EphemeralStorageService, powerbi.localStorageService = new LocalStorageService(),
|
35206 | powerbi.ephemeralStorageService = new EphemeralStorageService();
|
35207 | }(powerbi || (powerbi = {}));
|
35208 | }, function(module, exports) {
|
35209 | var jsCommon, jsCommon = window.jsCommon;
|
35210 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
35211 | window.Microsoft;
|
35212 | !function(jsCommon) {
|
35213 | var WordBreaker;
|
35214 | !function(WordBreaker) {
|
35215 | function search(index, content, backward) {
|
35216 | if (backward) {
|
35217 | for (var i = index - 1; i > -1; i--) if (hasBreakers(content[i])) return i + 1;
|
35218 | } else for (var i = index, ilen = content.length; ilen > i; i++) if (hasBreakers(content[i])) return i;
|
35219 | return backward ? 0 : content.length;
|
35220 | }
|
35221 | function find(index, content) {
|
35222 | var result = {
|
35223 | start: 0,
|
35224 | end: 0
|
35225 | };
|
35226 | return 0 === content.length ? result : (result.start = search(index, content, !0),
|
35227 | result.end = search(index, content, !1), result);
|
35228 | }
|
35229 | function hasBreakers(content) {
|
35230 | return BREAKERS_REGEX.lastIndex = 0, BREAKERS_REGEX.test(content);
|
35231 | }
|
35232 | function wordCount(content) {
|
35233 | var count = 1;
|
35234 | for (BREAKERS_REGEX.lastIndex = 0, BREAKERS_REGEX.exec(content); 0 !== BREAKERS_REGEX.lastIndex; ) count++,
|
35235 | BREAKERS_REGEX.exec(content);
|
35236 | return count;
|
35237 | }
|
35238 | function getMaxWordWidth(content, textWidthMeasurer, properties) {
|
35239 | for (var words = split(content), maxWidth = 0, _i = 0, words_1 = words; _i < words_1.length; _i++) {
|
35240 | var w = words_1[_i];
|
35241 | properties.text = w, maxWidth = Math.max(maxWidth, textWidthMeasurer(properties));
|
35242 | }
|
35243 | return maxWidth;
|
35244 | }
|
35245 | function split(content) {
|
35246 | return content.split(BREAKERS_REGEX);
|
35247 | }
|
35248 | function getWidth(content, properties, textWidthMeasurer) {
|
35249 | return properties.text = content, textWidthMeasurer(properties);
|
35250 | }
|
35251 | function truncate(content, properties, truncator, maxWidth) {
|
35252 | return properties.text = content, truncator(properties, maxWidth);
|
35253 | }
|
35254 | function splitByWidth(content, properties, textWidthMeasurer, maxWidth, maxNumLines, truncator) {
|
35255 | truncator = truncator ? truncator : function(properties, maxWidth) {
|
35256 | return properties.text;
|
35257 | };
|
35258 | for (var result = [], words = split(content), usedWidth = 0, wordsInLine = [], _i = 0, words_2 = words; _i < words_2.length; _i++) {
|
35259 | var word = words_2[_i];
|
35260 | if (maxNumLines > 0 && result.length >= maxNumLines - 1) wordsInLine.push(word); else {
|
35261 | var wordWidth = 0 === wordsInLine.length ? getWidth(word, properties, textWidthMeasurer) : getWidth(SPACE + word, properties, textWidthMeasurer);
|
35262 | if (usedWidth + wordWidth > maxWidth) {
|
35263 | if (0 === wordsInLine.length) {
|
35264 | result.push(truncate(word, properties, truncator, maxWidth)), usedWidth = 0, wordsInLine = [];
|
35265 | continue;
|
35266 | }
|
35267 | result.push(truncate(wordsInLine.join(SPACE), properties, truncator, maxWidth)),
|
35268 | usedWidth = 0, wordsInLine = [];
|
35269 | }
|
35270 | wordsInLine.push(word), usedWidth += wordWidth;
|
35271 | }
|
35272 | }
|
35273 | return _.isEmpty(wordsInLine) || result.push(truncate(wordsInLine.join(SPACE), properties, truncator, maxWidth)),
|
35274 | result;
|
35275 | }
|
35276 | var SPACE = " ", BREAKERS_REGEX = /[\s\n]+/g;
|
35277 | WordBreaker.find = find, WordBreaker.hasBreakers = hasBreakers, WordBreaker.wordCount = wordCount,
|
35278 | WordBreaker.getMaxWordWidth = getMaxWordWidth, WordBreaker.splitByWidth = splitByWidth;
|
35279 | }(WordBreaker = jsCommon.WordBreaker || (jsCommon.WordBreaker = {}));
|
35280 | }(jsCommon || (jsCommon = {}));
|
35281 | }, function(module, exports) {
|
35282 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
35283 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
35284 | !function(powerbi) {
|
35285 | var TextMeasurementService;
|
35286 | !function(TextMeasurementService) {
|
35287 | function ensureDOM() {
|
35288 | spanElement || (spanElement = $("<span/>"), $("body").append(spanElement), svgTextElement = d3.select($("body").get(0)).append("svg").style({
|
35289 | height: "0px",
|
35290 | width: "0px",
|
35291 | position: "absolute"
|
35292 | }).append("text"), canvasCtx = $("<canvas/>").get(0).getContext("2d"), fallbackFontFamily = window.getComputedStyle(svgTextElement.node()).fontFamily);
|
35293 | }
|
35294 | function removeSpanElement() {
|
35295 | spanElement && spanElement.remove && spanElement.remove(), spanElement = null;
|
35296 | }
|
35297 | function measureSvgTextWidth(textProperties, text) {
|
35298 | return ensureDOM(), canvasCtx.font = (textProperties.fontStyle || "") + " " + (textProperties.fontVariant || "") + " " + (textProperties.fontWeight || "") + " " + textProperties.fontSize + " " + (textProperties.fontFamily || fallbackFontFamily),
|
35299 | canvasCtx.measureText(text || textProperties.text).width;
|
35300 | }
|
35301 | function measureSvgTextRect(textProperties, text) {
|
35302 | return ensureDOM(), svgTextElement.style(null), svgTextElement.text(text || textProperties.text).attr({
|
35303 | visibility: "hidden",
|
35304 | "font-family": textProperties.fontFamily || fallbackFontFamily,
|
35305 | "font-variant": textProperties.fontVariant,
|
35306 | "font-size": textProperties.fontSize,
|
35307 | "font-weight": textProperties.fontWeight,
|
35308 | "font-style": textProperties.fontStyle,
|
35309 | "white-space": textProperties.whiteSpace || "nowrap"
|
35310 | }), svgTextElement.node().getBBox();
|
35311 | }
|
35312 | function measureSvgTextHeight(textProperties, text) {
|
35313 | return measureSvgTextRect(textProperties, text).height;
|
35314 | }
|
35315 | function estimateSvgTextRect(textProperties) {
|
35316 | var propertiesKey = textProperties.fontFamily + textProperties.fontSize, rect = powerbi.ephemeralStorageService.getData(propertiesKey);
|
35317 | if (null == rect) {
|
35318 | var estimatedTextProperties = {
|
35319 | fontFamily: textProperties.fontFamily,
|
35320 | fontSize: textProperties.fontSize,
|
35321 | text: "M"
|
35322 | };
|
35323 | rect = TextMeasurementService.measureSvgTextRect(estimatedTextProperties), rect.height > 0 && powerbi.ephemeralStorageService.setData(propertiesKey, rect);
|
35324 | }
|
35325 | return rect;
|
35326 | }
|
35327 | function estimateSvgTextBaselineDelta(textProperties) {
|
35328 | var rect = estimateSvgTextRect(textProperties);
|
35329 | return rect.y + rect.height;
|
35330 | }
|
35331 | function estimateSvgTextHeight(textProperties, tightFightForNumeric) {
|
35332 | void 0 === tightFightForNumeric && (tightFightForNumeric = !1);
|
35333 | var height = estimateSvgTextRect(textProperties).height;
|
35334 | return tightFightForNumeric && (height *= .7), height;
|
35335 | }
|
35336 | function measureSvgTextElementWidth(svgElement) {
|
35337 | return measureSvgTextWidth(getSvgMeasurementProperties(svgElement));
|
35338 | }
|
35339 | function getMeasurementProperties(element) {
|
35340 | return {
|
35341 | text: element.val() || element.text(),
|
35342 | fontFamily: element.css("font-family"),
|
35343 | fontSize: element.css("font-size"),
|
35344 | fontWeight: element.css("font-weight"),
|
35345 | fontStyle: element.css("font-style"),
|
35346 | fontVariant: element.css("font-variant"),
|
35347 | whiteSpace: element.css("white-space")
|
35348 | };
|
35349 | }
|
35350 | function getSvgMeasurementProperties(svgElement) {
|
35351 | var style = window.getComputedStyle(svgElement, null);
|
35352 | return {
|
35353 | text: svgElement.textContent,
|
35354 | fontFamily: style.fontFamily,
|
35355 | fontSize: style.fontSize,
|
35356 | fontWeight: style.fontWeight,
|
35357 | fontStyle: style.fontStyle,
|
35358 | fontVariant: style.fontVariant,
|
35359 | whiteSpace: style.whiteSpace
|
35360 | };
|
35361 | }
|
35362 | function getDivElementWidth(element) {
|
35363 | return getComputedStyle(element[0]).width;
|
35364 | }
|
35365 | function getTailoredTextOrDefault(textProperties, maxWidth) {
|
35366 | ensureDOM();
|
35367 | var strLength = textProperties.text.length;
|
35368 | if (0 === strLength) return textProperties.text;
|
35369 | var width = measureSvgTextWidth(textProperties);
|
35370 | if (maxWidth > width) return textProperties.text;
|
35371 | for (var copiedTextProperties = powerbi.Prototype.inherit(textProperties), text = copiedTextProperties.text = ellipsis + copiedTextProperties.text, min = 1, max = text.length, i = ellipsis.length; max >= min; ) if (i = (min + max) / 2 | 0,
|
35372 | copiedTextProperties.text = text.substr(0, i), width = measureSvgTextWidth(copiedTextProperties),
|
35373 | maxWidth > width) min = i + 1; else {
|
35374 | if (!(width > maxWidth)) break;
|
35375 | max = i - 1;
|
35376 | }
|
35377 | return copiedTextProperties.text = text.substr(0, i), width = measureSvgTextWidth(copiedTextProperties),
|
35378 | width > maxWidth && i--, text.substr(ellipsis.length, i - ellipsis.length) + ellipsis;
|
35379 | }
|
35380 | function svgEllipsis(textElement, maxWidth) {
|
35381 | var properties = getSvgMeasurementProperties(textElement), originalText = properties.text, tailoredText = getTailoredTextOrDefault(properties, maxWidth);
|
35382 | originalText !== tailoredText && (textElement.textContent = tailoredText);
|
35383 | }
|
35384 | function wordBreak(textElement, maxWidth, maxHeight, linePadding) {
|
35385 | void 0 === linePadding && (linePadding = 0);
|
35386 | var properties = getSvgMeasurementProperties(textElement), height = estimateSvgTextHeight(properties) + linePadding, maxNumLines = Math.max(1, Math.floor(maxHeight / height)), node = d3.select(textElement), firstDY = node.attr("y"), labelText = textElement.textContent;
|
35387 | textElement.textContent = null;
|
35388 | for (var words = jsCommon.WordBreaker.splitByWidth(labelText, properties, measureSvgTextWidth, maxWidth, maxNumLines), i = 0, ilen = words.length; ilen > i; i++) properties.text = words[i],
|
35389 | node.append("tspan").attr({
|
35390 | x: 0,
|
35391 | dy: 0 === i ? firstDY : height
|
35392 | }).text(getTailoredTextOrDefault(properties, maxWidth));
|
35393 | }
|
35394 | function wordBreakOverflowingText(textElement, maxWidth, maxHeight, linePadding) {
|
35395 | void 0 === linePadding && (linePadding = 0);
|
35396 | var properties = getSvgMeasurementProperties(textElement), height = estimateSvgTextHeight(properties) + linePadding, maxNumLines = Math.max(1, Math.floor(maxHeight / height)), labelText = textElement.textContent;
|
35397 | textElement.textContent = null;
|
35398 | var words = jsCommon.WordBreaker.splitByWidth(labelText, properties, measureSvgTextWidth, maxWidth, maxNumLines), spanItem = d3.select(textElement).selectAll(OverflowingText.selector).data(words, function(d) {
|
35399 | return $.inArray(d, words);
|
35400 | });
|
35401 | spanItem.enter().append("span").classed(OverflowingText["class"], !0).text(function(d) {
|
35402 | return d;
|
35403 | }).style("width", jsCommon.PixelConverter.toString(maxWidth));
|
35404 | }
|
35405 | var spanElement, svgTextElement, canvasCtx, fallbackFontFamily, ellipsis = "…", OverflowingText = jsCommon.CssConstants.createClassAndSelector("overflowingText");
|
35406 | TextMeasurementService.removeSpanElement = removeSpanElement, TextMeasurementService.measureSvgTextWidth = measureSvgTextWidth,
|
35407 | TextMeasurementService.measureSvgTextRect = measureSvgTextRect, TextMeasurementService.measureSvgTextHeight = measureSvgTextHeight,
|
35408 | TextMeasurementService.estimateSvgTextBaselineDelta = estimateSvgTextBaselineDelta,
|
35409 | TextMeasurementService.estimateSvgTextHeight = estimateSvgTextHeight, TextMeasurementService.measureSvgTextElementWidth = measureSvgTextElementWidth,
|
35410 | TextMeasurementService.getMeasurementProperties = getMeasurementProperties, TextMeasurementService.getSvgMeasurementProperties = getSvgMeasurementProperties,
|
35411 | TextMeasurementService.getDivElementWidth = getDivElementWidth, TextMeasurementService.getTailoredTextOrDefault = getTailoredTextOrDefault,
|
35412 | TextMeasurementService.svgEllipsis = svgEllipsis, TextMeasurementService.wordBreak = wordBreak,
|
35413 | TextMeasurementService.wordBreakOverflowingText = wordBreakOverflowingText;
|
35414 | }(TextMeasurementService = powerbi.TextMeasurementService || (powerbi.TextMeasurementService = {}));
|
35415 | }(powerbi || (powerbi = {}));
|
35416 | }, function(module, exports) {
|
35417 | var jsCommon, jsCommon = window.jsCommon;
|
35418 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
35419 | window.Microsoft;
|
35420 | !function(jsCommon) {
|
35421 | var KeyUtils, DOMConstants = jsCommon.DOMConstants;
|
35422 | !function(KeyUtils) {
|
35423 | function isArrowKey(keyCode) {
|
35424 | return keyCode === DOMConstants.downArrowKeyCode || keyCode === DOMConstants.upArrowKeyCode || keyCode === DOMConstants.leftArrowKeyCode || keyCode === DOMConstants.rightArrowKeyCode;
|
35425 | }
|
35426 | function isCtrlDefaultKey(keyCode) {
|
35427 | return keyCode === DOMConstants.aKeyCode || keyCode === DOMConstants.cKeyCode || keyCode === DOMConstants.xKeyCode || keyCode === DOMConstants.vKeyCode;
|
35428 | }
|
35429 | function isNudgeModifierKey(keyCode) {
|
35430 | return keyCode === DOMConstants.shiftKeyCode;
|
35431 | }
|
35432 | KeyUtils.isArrowKey = isArrowKey, KeyUtils.isCtrlDefaultKey = isCtrlDefaultKey,
|
35433 | KeyUtils.isNudgeModifierKey = isNudgeModifierKey;
|
35434 | }(KeyUtils = jsCommon.KeyUtils || (jsCommon.KeyUtils = {}));
|
35435 | }(jsCommon || (jsCommon = {}));
|
35436 | }, function(module, exports) {
|
35437 | var jsCommon, jsCommon = window.jsCommon;
|
35438 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
35439 | window.Microsoft;
|
35440 | !function(jsCommon) {
|
35441 | var ThrottleUtility = function() {
|
35442 | function ThrottleUtility(delay) {
|
35443 | this.timerFactory = jsCommon.TimerPromiseFactory.instance, this.delay = 0, delay && (this.delay = delay);
|
35444 | }
|
35445 | return ThrottleUtility.prototype.run = function(fn) {
|
35446 | var _this = this;
|
35447 | this.fn ? this.fn = fn : (this.fn = fn, this.timerFactory.create(this.delay).done(function() {
|
35448 | return _this.timerComplete(_this.fn);
|
35449 | }));
|
35450 | }, ThrottleUtility.prototype.timerComplete = function(fn) {
|
35451 | fn(), this.fn = null;
|
35452 | }, ThrottleUtility;
|
35453 | }();
|
35454 | jsCommon.ThrottleUtility = ThrottleUtility;
|
35455 | }(jsCommon || (jsCommon = {}));
|
35456 | }, function(module, exports) {
|
35457 | var jsCommon, jsCommon = window.jsCommon;
|
35458 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
35459 | window.Microsoft;
|
35460 | !function(jsCommon) {
|
35461 | var TimerPromiseFactory = function() {
|
35462 | function TimerPromiseFactory() {}
|
35463 | return TimerPromiseFactory.prototype.create = function(delayInMs) {
|
35464 | var deferred = $.Deferred();
|
35465 | return window.setTimeout(function() {
|
35466 | return deferred.resolve();
|
35467 | }, delayInMs), deferred;
|
35468 | }, TimerPromiseFactory.instance = new TimerPromiseFactory(), TimerPromiseFactory;
|
35469 | }();
|
35470 | jsCommon.TimerPromiseFactory = TimerPromiseFactory;
|
35471 | }(jsCommon || (jsCommon = {}));
|
35472 | }, function(module, exports) {
|
35473 | var jsCommon, jsCommon = window.jsCommon;
|
35474 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
35475 | window.Microsoft;
|
35476 | !function(jsCommon) {
|
35477 | !function(HttpStatusCode) {
|
35478 | HttpStatusCode[HttpStatusCode.OK = 200] = "OK", HttpStatusCode[HttpStatusCode.BadRequest = 400] = "BadRequest",
|
35479 | HttpStatusCode[HttpStatusCode.Unauthorized = 401] = "Unauthorized", HttpStatusCode[HttpStatusCode.Forbidden = 403] = "Forbidden",
|
35480 | HttpStatusCode[HttpStatusCode.RequestEntityTooLarge = 413] = "RequestEntityTooLarge";
|
35481 | }(jsCommon.HttpStatusCode || (jsCommon.HttpStatusCode = {}));
|
35482 | var HttpConstants;
|
35483 | jsCommon.HttpStatusCode;
|
35484 | !function(HttpConstants) {
|
35485 | HttpConstants.ApplicationOctetStream = "application/octet-stream", HttpConstants.MultiPartFormData = "multipart/form-data";
|
35486 | }(HttpConstants = jsCommon.HttpConstants || (jsCommon.HttpConstants = {}));
|
35487 | var StringExtensions;
|
35488 | !function(StringExtensions) {
|
35489 | function format() {
|
35490 | for (var args = [], _i = 0; _i < arguments.length; _i++) args[_i - 0] = arguments[_i];
|
35491 | var s = args[0];
|
35492 | if (isNullOrUndefinedOrWhiteSpaceString(s)) return s;
|
35493 | for (var i = 0; i < args.length - 1; i++) {
|
35494 | var reg = new RegExp("\\{" + i + "\\}", "gm");
|
35495 | s = s.replace(reg, args[i + 1]);
|
35496 | }
|
35497 | return s;
|
35498 | }
|
35499 | function equalIgnoreCase(a, b) {
|
35500 | return StringExtensions.normalizeCase(a) === StringExtensions.normalizeCase(b);
|
35501 | }
|
35502 | function startsWithIgnoreCase(a, b) {
|
35503 | var normalizedSearchString = StringExtensions.normalizeCase(b);
|
35504 | return 0 === StringExtensions.normalizeCase(a).indexOf(normalizedSearchString);
|
35505 | }
|
35506 | function startsWith(a, b) {
|
35507 | return 0 === a.indexOf(b);
|
35508 | }
|
35509 | function contains(source, substring) {
|
35510 | return null == source ? !1 : -1 !== source.indexOf(substring);
|
35511 | }
|
35512 | function containsIgnoreCase(source, substring) {
|
35513 | return null == source ? !1 : contains(normalizeCase(source), normalizeCase(substring));
|
35514 | }
|
35515 | function normalizeCase(value) {
|
35516 | return Utility.throwIfNullOrUndefined(value, StringExtensions, "normalizeCase", "value"),
|
35517 | value.toUpperCase();
|
35518 | }
|
35519 | function isNullOrEmpty(value) {
|
35520 | return null == value || 0 === value.length;
|
35521 | }
|
35522 | function isNullOrUndefinedOrWhiteSpaceString(str) {
|
35523 | return StringExtensions.isNullOrEmpty(str) || StringExtensions.isNullOrEmpty(str.trim());
|
35524 | }
|
35525 | function containsWhitespace(str) {
|
35526 | Utility.throwIfNullOrUndefined(str, this, "containsWhitespace", "str");
|
35527 | var expr = /\s/;
|
35528 | return expr.test(str);
|
35529 | }
|
35530 | function isWhitespace(str) {
|
35531 | return Utility.throwIfNullOrUndefined(str, this, "isWhitespace", "str"), "" === str.trim();
|
35532 | }
|
35533 | function trimTrailingWhitespace(str) {
|
35534 | return Utility.throwIfNullOrUndefined(str, this, "trimTrailingWhitespace", "str"),
|
35535 | str.replace(/\s+$/, "");
|
35536 | }
|
35537 | function trimWhitespace(str) {
|
35538 | return Utility.throwIfNullOrUndefined(str, this, "trimWhitespace", "str"), str.replace(/^\s+/, "").replace(/\s+$/, "");
|
35539 | }
|
35540 | function getLengthDifference(left, right) {
|
35541 | return Utility.throwIfNullOrUndefined(left, this, "getLengthDifference", "left"),
|
35542 | Utility.throwIfNullOrUndefined(right, this, "getLengthDifference", "right"), Math.abs(left.length - right.length);
|
35543 | }
|
35544 | function repeat(char, count) {
|
35545 | for (var result = "", i = 0; count > i; i++) result += char;
|
35546 | return result;
|
35547 | }
|
35548 | function replaceAll(text, textToFind, textToReplace) {
|
35549 | if (!textToFind) return text;
|
35550 | var pattern = escapeStringForRegex(textToFind);
|
35551 | return text.replace(new RegExp(pattern, "gi"), textToReplace);
|
35552 | }
|
35553 | function ensureUniqueNames(names) {
|
35554 | for (var usedNames = {}, _i = 0, names_1 = names; _i < names_1.length; _i++) {
|
35555 | var name_1 = names_1[_i];
|
35556 | usedNames[name_1] = !1;
|
35557 | }
|
35558 | for (var uniqueNames = [], _a = 0, names_2 = names; _a < names_2.length; _a++) {
|
35559 | var name_2 = names_2[_a], uniqueName = name_2;
|
35560 | if (usedNames[uniqueName]) for (var counter = 0; void 0 !== usedNames[uniqueName]; ) uniqueName = name_2 + "." + ++counter;
|
35561 | uniqueNames.push(uniqueName), usedNames[uniqueName] = !0;
|
35562 | }
|
35563 | return uniqueNames;
|
35564 | }
|
35565 | function findUniqueName(usedNames, baseName) {
|
35566 | for (var i = 0, uniqueName = baseName; usedNames[uniqueName]; ) uniqueName = baseName + ++i;
|
35567 | return uniqueName;
|
35568 | }
|
35569 | function constructCommaSeparatedList(list, resourceProvider, maxValue) {
|
35570 | if (!list || 0 === list.length) return "";
|
35571 | null !== maxValue && void 0 !== maxValue || (maxValue = Number.MAX_VALUE);
|
35572 | for (var length = Math.min(maxValue, list.length), replacedList = [], j = 0; 2 > j; j++) for (var targetValue = "{" + j + "}", replaceValue = "_|_<" + j + ">_|_", i = 0; length > i; i++) list[i].indexOf(targetValue) > -1 && (list[i] = list[i].replace(targetValue, replaceValue),
|
35573 | replacedList.push({
|
35574 | targetValue: targetValue,
|
35575 | replaceValue: replaceValue
|
35576 | }));
|
35577 | for (var commaSeparatedList = "", i = 0; length > i; i++) commaSeparatedList = 0 === i ? list[i] : StringExtensions.format(resourceProvider.get("FilterRestatement_Comma"), commaSeparatedList, list[i]);
|
35578 | for (var i = 0; i < replacedList.length; i++) commaSeparatedList = commaSeparatedList.replace(replacedList[i].replaceValue, replacedList[i].targetValue);
|
35579 | return commaSeparatedList;
|
35580 | }
|
35581 | function escapeStringForRegex(s) {
|
35582 | return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1");
|
35583 | }
|
35584 | function normalizeFileName(fileName) {
|
35585 | return fileName.replace(/[\<\>\:"\/\\\|\?*]/g, "");
|
35586 | }
|
35587 | function stringifyAsPrettyJSON(object) {
|
35588 | return JSON.stringify(object);
|
35589 | }
|
35590 | function deriveClsCompliantName(input, fallback) {
|
35591 | var result = input.replace(/^[^A-Za-z]*/g, "").replace(/[ :\.\/\\\-\u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]/g, "_").replace(/[\W]/g, "");
|
35592 | return result.length > 0 ? result : fallback;
|
35593 | }
|
35594 | function stripTagDelimiters(s) {
|
35595 | return s.replace(HtmlTagRegex, "");
|
35596 | }
|
35597 | var HtmlTagRegex = new RegExp("[<>]", "g");
|
35598 | StringExtensions.format = format, StringExtensions.equalIgnoreCase = equalIgnoreCase,
|
35599 | StringExtensions.startsWithIgnoreCase = startsWithIgnoreCase, StringExtensions.startsWith = startsWith,
|
35600 | StringExtensions.contains = contains, StringExtensions.containsIgnoreCase = containsIgnoreCase,
|
35601 | StringExtensions.normalizeCase = normalizeCase, StringExtensions.isNullOrEmpty = isNullOrEmpty,
|
35602 | StringExtensions.isNullOrUndefinedOrWhiteSpaceString = isNullOrUndefinedOrWhiteSpaceString,
|
35603 | StringExtensions.containsWhitespace = containsWhitespace, StringExtensions.isWhitespace = isWhitespace,
|
35604 | StringExtensions.trimTrailingWhitespace = trimTrailingWhitespace, StringExtensions.trimWhitespace = trimWhitespace,
|
35605 | StringExtensions.getLengthDifference = getLengthDifference, StringExtensions.repeat = repeat,
|
35606 | StringExtensions.replaceAll = replaceAll, StringExtensions.ensureUniqueNames = ensureUniqueNames,
|
35607 | StringExtensions.findUniqueName = findUniqueName, StringExtensions.constructCommaSeparatedList = constructCommaSeparatedList,
|
35608 | StringExtensions.escapeStringForRegex = escapeStringForRegex, StringExtensions.normalizeFileName = normalizeFileName,
|
35609 | StringExtensions.stringifyAsPrettyJSON = stringifyAsPrettyJSON, StringExtensions.deriveClsCompliantName = deriveClsCompliantName,
|
35610 | StringExtensions.stripTagDelimiters = stripTagDelimiters;
|
35611 | }(StringExtensions = jsCommon.StringExtensions || (jsCommon.StringExtensions = {}));
|
35612 | var Utility = function() {
|
35613 | function Utility() {}
|
35614 | return Utility.throwIfNullOrUndefined = function(value, context, methodName, parameterName) {
|
35615 | null === value ? Utility.throwException(jsCommon.Errors.argumentNull(Utility.getComponentName(context) + methodName + "." + parameterName)) : typeof value === Utility.Undefined && Utility.throwException(jsCommon.Errors.argumentUndefined(Utility.getComponentName(context) + methodName + "." + parameterName));
|
35616 | }, Utility.throwIfNullOrEmpty = function(value, context, methodName, parameterName) {
|
35617 | Utility.throwIfNullOrUndefined(value, context, methodName, parameterName), value.length || Utility.throwException(jsCommon.Errors.argumentOutOfRange(Utility.getComponentName(context) + methodName + "." + parameterName));
|
35618 | }, Utility.throwIfNullOrEmptyString = function(value, context, methodName, parameterName) {
|
35619 | Utility.throwIfNullOrUndefined(value, context, methodName, parameterName), value.length < 1 && Utility.throwException(jsCommon.Errors.argumentOutOfRange(Utility.getComponentName(context) + methodName + "." + parameterName));
|
35620 | }, Utility.throwIfNullEmptyOrWhitespaceString = function(value, context, methodName, parameterName) {
|
35621 | Utility.throwIfNullOrUndefined(value, context, methodName, parameterName), StringExtensions.isNullOrUndefinedOrWhiteSpaceString(value) && Utility.throwException(jsCommon.Errors.argumentOutOfRange(Utility.getComponentName(context) + methodName + "." + parameterName));
|
35622 | }, Utility.throwIfNotTrue = function(condition, context, methodName, parameterName) {
|
35623 | condition || Utility.throwException(jsCommon.Errors.argument(parameterName, Utility.getComponentName(context) + methodName + "." + parameterName));
|
35624 | }, Utility.isString = function(value) {
|
35625 | return "string" == typeof value;
|
35626 | }, Utility.isBoolean = function(value) {
|
35627 | return "boolean" == typeof value;
|
35628 | }, Utility.isNumber = function(value) {
|
35629 | return "number" == typeof value;
|
35630 | }, Utility.isDate = function(value) {
|
35631 | return Utility.isObject(value) && value instanceof Date;
|
35632 | }, Utility.isObject = function(value) {
|
35633 | return null != value && "object" == typeof value;
|
35634 | }, Utility.isNullOrUndefined = function(value) {
|
35635 | return null === value || typeof value === Utility.Undefined;
|
35636 | }, Utility.valueOrDefault = function(value, defaultValue) {
|
35637 | return null != value ? value : defaultValue;
|
35638 | }, Utility.urlCombine = function(baseUrl, path) {
|
35639 | if (Utility.throwIfNullOrUndefined(baseUrl, null, "urlCombine", "baseUrl"), Utility.throwIfNullOrUndefined(path, null, "urlCombine", "path"),
|
35640 | StringExtensions.isNullOrUndefinedOrWhiteSpaceString(path)) return baseUrl;
|
35641 | if (StringExtensions.isNullOrUndefinedOrWhiteSpaceString(baseUrl)) return path;
|
35642 | var finalUrl = baseUrl;
|
35643 | return "/" === finalUrl.charAt(finalUrl.length - 1) ? "/" === path.charAt(0) && (path = path.slice(1)) : "/" !== path.charAt(0) && (path = "/" + path),
|
35644 | finalUrl + path;
|
35645 | }, Utility.getAbsoluteUri = function(path) {
|
35646 | Utility.throwIfNullOrUndefined(path, null, "getAbsoluteUri", "path");
|
35647 | var url = path;
|
35648 | return url && -1 === url.indexOf("http") && (url = Utility.urlCombine(clusterUri, url)),
|
35649 | url;
|
35650 | }, Utility.getStaticResourceUri = function(path) {
|
35651 | Utility.throwIfNullOrUndefined(path, null, "getStaticResourceUri", "path");
|
35652 | var url = path;
|
35653 | return url && -1 === url.indexOf("http") && (url = jsCommon.Utility.urlCombine(Utility.staticContentLocation, url)),
|
35654 | url;
|
35655 | }, Utility.getComponentName = function(context) {
|
35656 | return context ? (typeof context).toString() + "." : "";
|
35657 | }, Utility.throwException = function(e) {
|
35658 | throw jsCommon.Trace.error(StringExtensions.format("Throwing exception: {0}", JSON.stringify(e)), null == e.stack),
|
35659 | e;
|
35660 | }, Utility.createClassSelector = function(className) {
|
35661 | return Utility.throwIfNullOrEmptyString(className, null, "CreateClassSelector", "className"),
|
35662 | "." + className;
|
35663 | }, Utility.createIdSelector = function(id) {
|
35664 | return Utility.throwIfNullOrEmptyString(id, null, "CreateIdSelector", "id"), "#" + id;
|
35665 | }, Utility.generateGuid = function() {
|
35666 | var guid = "", idx = 0;
|
35667 | for (idx = 0; 32 > idx; idx += 1) {
|
35668 | var guidDigitsItem = 16 * Math.random() | 0;
|
35669 | switch (idx) {
|
35670 | case 8:
|
35671 | case 12:
|
35672 | case 16:
|
35673 | case 20:
|
35674 | guid += "-";
|
35675 | }
|
35676 | guid += guidDigitsItem.toString(16);
|
35677 | }
|
35678 | return guid;
|
35679 | }, Utility.getCookieValue = function(key) {
|
35680 | for (var keyValuePairs = document.cookie.split(";"), i = 0; i < keyValuePairs.length; i++) {
|
35681 | var keyValue = keyValuePairs[i], split = keyValue.split("=");
|
35682 | if (split.length > 0 && split[0].trim() === key) return keyValue.substr(keyValue.indexOf("=") + 1);
|
35683 | }
|
35684 | return null;
|
35685 | }, Utility.getDomainForUrl = function(url) {
|
35686 | var hrefObject = Utility.getHrefObjectFromUrl(url);
|
35687 | return hrefObject.prop("protocol") + "//" + hrefObject.prop("hostname");
|
35688 | }, Utility.getHostNameForUrl = function(url) {
|
35689 | var hrefObject = Utility.getHrefObjectFromUrl(url);
|
35690 | return Utility.urlCombine(hrefObject.prop("hostname"), hrefObject.prop("pathname"));
|
35691 | }, Utility.getUrlWithoutQueryString = function(url) {
|
35692 | var hrefObject = Utility.getHrefObjectFromUrl(url);
|
35693 | return hrefObject.prop("protocol") + "//" + Utility.urlCombine(hrefObject.prop("host"), hrefObject.prop("pathname"));
|
35694 | }, Utility.getProtocolFromUrl = function(url) {
|
35695 | return Utility.getHrefObjectFromUrl(url).prop("protocol").replace(":", "");
|
35696 | }, Utility.getHrefObjectFromUrl = function(url) {
|
35697 | var aObject = $("<a>");
|
35698 | return aObject = aObject.prop("href", url);
|
35699 | }, Utility.convertWcfToJsDictionary = function(wcfDictionary) {
|
35700 | for (var result = {}, i = 0; i < wcfDictionary.length; i++) {
|
35701 | var keyValuePair = wcfDictionary[i];
|
35702 | result[keyValuePair.Key] = keyValuePair.Value;
|
35703 | }
|
35704 | return result;
|
35705 | }, Utility.getDateFromWcfJsonString = function(jsonDate, fromUtcMilliseconds) {
|
35706 | if (StringExtensions.isNullOrEmpty(jsonDate)) return null;
|
35707 | var begIndex = jsonDate.indexOf("("), endIndex = jsonDate.indexOf(")");
|
35708 | if (-1 !== begIndex && -1 !== endIndex) {
|
35709 | var milliseconds = parseInt(jsonDate.substring(begIndex + 1, endIndex), 10);
|
35710 | if (fromUtcMilliseconds) return new Date(milliseconds);
|
35711 | var retValue = new Date(0);
|
35712 | return retValue.setUTCMilliseconds(milliseconds), retValue;
|
35713 | }
|
35714 | return null;
|
35715 | }, Utility.getOuterHtml = function(content) {
|
35716 | return $("<div>").append(content).html();
|
35717 | }, Utility.compareInt = function(a, b) {
|
35718 | return a - b;
|
35719 | }, Utility.getIndexOfMinValue = function(a) {
|
35720 | for (var retValue = 0, currentMinValue = a[0], i = 0; i < a.length; i++) a[i] < currentMinValue && (currentMinValue = a[i],
|
35721 | retValue = i);
|
35722 | return retValue;
|
35723 | }, Utility.extractUrlFromCssBackgroundImage = function(input) {
|
35724 | return input.replace(/"/g, "").replace(/url\(|\)$/gi, "");
|
35725 | }, Utility.isValidImageDataUrl = function(url) {
|
35726 | var regex = new RegExp("data:(image/(png|jpg|jpeg|gif|svg))");
|
35727 | return regex.test(url);
|
35728 | }, Utility.isLocalUrl = function(url) {
|
35729 | return _.startsWith(url, "data:") || _.startsWith(url, "blob:");
|
35730 | }, Utility.saveAsFile = function(content, fileName) {
|
35731 | var contentBlob = new Blob([ content ], {
|
35732 | type: HttpConstants.ApplicationOctetStream
|
35733 | }), url = window.webkitURL || URL, urlLink = url.createObjectURL(contentBlob), fileNameLink = fileName || urlLink;
|
35734 | if (window.navigator.msSaveOrOpenBlob) return void window.navigator.msSaveOrOpenBlob(contentBlob, fileNameLink);
|
35735 | var hyperlink = document.createElement("a");
|
35736 | hyperlink.href = urlLink, hyperlink.target = "_blank", hyperlink.download = fileNameLink,
|
35737 | document.body.appendChild(hyperlink), hyperlink.click(), document.body.removeChild(hyperlink);
|
35738 | }, Utility.getType = function(obj) {
|
35739 | Utility.throwIfNullEmptyOrWhitespaceString(obj.__type, this, "getType", "obj");
|
35740 | var parts = obj.__type.split(":");
|
35741 | return 2 !== parts.length && jsCommon.Errors.argument("obj.__type", "Type String not in expected format [Type]#[Namespace]: " + obj.__type),
|
35742 | parts[1] !== Utility.TypeNamespace && jsCommon.Errors.argument("obj.__type", "Type Namespace not expected: " + parts[1]),
|
35743 | parts[0];
|
35744 | }, Utility.isEventSupported = function(eventName, element) {
|
35745 | eventName = "on" + eventName;
|
35746 | var isSupported = eventName in element;
|
35747 | return isSupported || (element.setAttribute || (element = document.createElement("div")),
|
35748 | element.setAttribute && element.removeAttribute && (element.setAttribute(eventName, ""),
|
35749 | isSupported = "function" == typeof element[eventName], "undefined" != typeof element[eventName] && (element[eventName] = null),
|
35750 | element.removeAttribute(eventName))), element = null, isSupported;
|
35751 | }, Utility.toPixel = function(pixelAmount) {
|
35752 | return Utility.throwIfNullOrUndefined(pixelAmount, this, "toPixel", "pixelAmount"),
|
35753 | pixelAmount.toString() + jsCommon.CssConstants.pixelUnits;
|
35754 | }, Utility.getPropertyCount = function(object) {
|
35755 | return Utility.throwIfNullOrUndefined(object, this, "getPropertyCount", "object"),
|
35756 | Object.getOwnPropertyNames(object).length;
|
35757 | }, Utility.getFileExtension = function(filePath) {
|
35758 | if (filePath) {
|
35759 | var index = filePath.lastIndexOf(".");
|
35760 | if (index >= 0) return filePath.substr(index + 1);
|
35761 | }
|
35762 | return "";
|
35763 | }, Utility.extractFileNameFromPath = function(filePath) {
|
35764 | return filePath.replace(/^.*[\\\/]/, "");
|
35765 | }, Utility.canUseClipboard = function() {
|
35766 | return "undefined" == typeof MSApp;
|
35767 | }, Utility.is64BitOperatingSystem = function() {
|
35768 | return -1 !== navigator.userAgent.indexOf("WOW64") || -1 !== navigator.userAgent.indexOf("Win64");
|
35769 | }, Utility.parseNumber = function(value, defaultValue) {
|
35770 | if (null === value) return null;
|
35771 | if (void 0 === value) return defaultValue;
|
35772 | var result = Number(value);
|
35773 | return isFinite(result) ? result : isNaN(result) && "number" != typeof value && "NaN" !== value ? defaultValue : result;
|
35774 | }, Utility.getURLParamValue = function(name) {
|
35775 | var results = new RegExp("[?&]" + name + "=([^&#]*)").exec(window.location.href);
|
35776 | return null == results ? null : results[1] || 0;
|
35777 | }, Utility.getLocalTimeZoneString = function() {
|
35778 | var localTimeZoneString, timeSummer = new Date(Date.UTC(2005, 6, 30, 0, 0, 0, 0)), summerOffset = -1 * timeSummer.getTimezoneOffset(), timeWinter = new Date(Date.UTC(2005, 12, 30, 0, 0, 0, 0)), winterOffset = -1 * timeWinter.getTimezoneOffset();
|
35779 | return localTimeZoneString = -720 === summerOffset && -720 === winterOffset ? "Dateline Standard Time" : -660 === summerOffset && -660 === winterOffset ? "UTC-11" : -660 === summerOffset && -660 === winterOffset ? "Samoa Standard Time" : -600 === summerOffset && -600 === winterOffset ? "Hawaiian Standard Time" : -480 === summerOffset && -540 === winterOffset ? "Alaskan Standard Time" : -420 === summerOffset && -480 === winterOffset ? "Pacific Standard Time" : -420 === summerOffset && -420 === winterOffset ? "US Mountain Standard Time" : -360 === summerOffset && -420 === winterOffset ? "Mountain Standard Time" : -360 === summerOffset && -360 === winterOffset ? "Central America Standard Time" : -300 === summerOffset && -360 === winterOffset ? "Central Standard Time" : -300 === summerOffset && -300 === winterOffset ? "SA Pacific Standard Time" : -240 === summerOffset && -300 === winterOffset ? "Eastern Standard Time" : -270 === summerOffset && -270 === winterOffset ? "Venezuela Standard Time" : -240 === summerOffset && -240 === winterOffset ? "SA Western Standard Time" : -240 === summerOffset && -180 === winterOffset ? "Central Brazilian Standard Time" : -180 === summerOffset && -240 === winterOffset ? "Atlantic Standard Time" : -180 === summerOffset && -180 === winterOffset ? "Montevideo Standard Time" : -180 === summerOffset && -120 === winterOffset ? "E. South America Standard Time" : -150 === summerOffset && -210 === winterOffset ? "Mid-Atlantic Standard Time" : -120 === summerOffset && -120 === winterOffset ? "SA Eastern Standard Time" : 0 === summerOffset && 0 === winterOffset ? "UTC" : 60 === summerOffset && 0 === winterOffset ? "GMT Standard Time" : 60 === summerOffset && 120 === winterOffset ? "Namibia Standard Time" : 120 === summerOffset && 60 === winterOffset ? "Romance Standard Time" : 120 === summerOffset && 120 === winterOffset ? "South Africa Standard Time" : 180 === summerOffset && 120 === winterOffset ? "GTB Standard Time" : 180 === summerOffset && 180 === winterOffset ? "E. Africa Standard Time" : 240 === summerOffset && 180 === winterOffset ? "Russian Standard Time" : 240 === summerOffset && 240 === winterOffset ? "Arabian Standard Time" : 270 === summerOffset && 210 === winterOffset ? "Iran Standard Time" : 270 === summerOffset && 270 === winterOffset ? "Afghanistan Standard Time" : 300 === summerOffset && 240 === winterOffset ? "Pakistan Standard Time" : 300 === summerOffset && 300 === winterOffset ? "West Asia Standard Time" : 330 === summerOffset && 330 === winterOffset ? "India Standard Time" : 345 === summerOffset && 345 === winterOffset ? "Nepal Standard Time" : 360 === summerOffset && 300 === winterOffset ? "N. Central Asia Standard Time" : 360 === summerOffset && 360 === winterOffset ? "Central Asia Standard Time" : 390 === summerOffset && 390 === winterOffset ? "Myanmar Standard Time" : 420 === summerOffset && 360 === winterOffset ? "North Asia Standard Time" : 420 === summerOffset && 420 === winterOffset ? "SE Asia Standard Time" : 480 === summerOffset && 420 === winterOffset ? "North Asia East Standard Time" : 480 === summerOffset && 480 === winterOffset ? "China Standard Time" : 540 === summerOffset && 480 === winterOffset ? "Yakutsk Standard Time" : 540 === summerOffset && 540 === winterOffset ? "Tokyo Standard Time" : 570 === summerOffset && 570 === winterOffset ? "Cen. Australia Standard Time" : 600 === summerOffset && 600 === winterOffset ? "E. Australia Standard Time" : 600 === summerOffset && 660 === winterOffset ? "AUS Eastern Standard Time" : 660 === summerOffset && 600 === winterOffset ? "Tasmania Standard Time" : 660 === summerOffset && 660 === winterOffset ? "West Pacific Standard Time" : 690 === summerOffset && 690 === winterOffset ? "Central Pacific Standard Time" : 720 === summerOffset && 660 === winterOffset ? "Magadan Standard Time" : 720 === summerOffset && 720 === winterOffset ? "Fiji Standard Time" : 720 === summerOffset && 780 === winterOffset ? "New Zealand Standard Time" : 780 === summerOffset && 780 === winterOffset ? "Tonga Standard Time" : "UTC";
|
35780 | }, Utility.TypeNamespace = "http://schemas.microsoft.com/sqlbi/2013/01/NLRuntimeService",
|
35781 | Utility.JsonContentType = "application/json", Utility.JpegContentType = "image/jpeg",
|
35782 | Utility.XJavascriptContentType = "application/x-javascript", Utility.JsonDataType = "json",
|
35783 | Utility.BlobDataType = "blob", Utility.HttpGetMethod = "GET", Utility.HttpPostMethod = "POST",
|
35784 | Utility.HttpPutMethod = "PUT", Utility.HttpDeleteMethod = "DELETE", Utility.HttpContentTypeHeader = "Content-Type",
|
35785 | Utility.HttpAcceptHeader = "Accept", Utility.Undefined = "undefined", Utility.staticContentLocation = window.location.protocol + "//" + window.location.host,
|
35786 | Utility;
|
35787 | }();
|
35788 | jsCommon.Utility = Utility;
|
35789 | var VersionUtility = function() {
|
35790 | function VersionUtility() {}
|
35791 | return VersionUtility.compareVersions = function(versionA, versionB) {
|
35792 | for (var a = versionA.split(".").map(parseFloat), b = versionB.split(".").map(parseFloat), versionParts = Math.max(a.length, b.length), i = 0; versionParts > i; i++) {
|
35793 | var partA = a[i] || 0, partB = b[i] || 0;
|
35794 | if (partA > partB) return 1;
|
35795 | if (partB > partA) return -1;
|
35796 | }
|
35797 | return 0;
|
35798 | }, VersionUtility;
|
35799 | }();
|
35800 | jsCommon.VersionUtility = VersionUtility;
|
35801 | var PerformanceUtil;
|
35802 | !function(PerformanceUtil) {
|
35803 | function create(name) {
|
35804 | return new PerfMarker(name);
|
35805 | }
|
35806 | var PerfMarker = function() {
|
35807 | function PerfMarker(name) {
|
35808 | this._name = name, this._start = PerfMarker.begin(name);
|
35809 | }
|
35810 | return PerfMarker.begin = function(name) {
|
35811 | return void 0 !== window.performance && void 0 !== performance.mark ? (console.time,
|
35812 | name = "Begin " + name, performance.mark(name), name) : void 0;
|
35813 | }, PerfMarker.prototype.end = function() {
|
35814 | if (void 0 !== window.performance && void 0 !== performance.mark && void 0 !== performance.measure) {
|
35815 | var name = this._name, end = "End " + name;
|
35816 | performance.mark(end), performance.measure(name, this._start, end), console.timeEnd;
|
35817 | }
|
35818 | }, PerfMarker;
|
35819 | }();
|
35820 | PerformanceUtil.PerfMarker = PerfMarker, PerformanceUtil.create = create;
|
35821 | }(PerformanceUtil = jsCommon.PerformanceUtil || (jsCommon.PerformanceUtil = {}));
|
35822 | var DeferUtility;
|
35823 | !function(DeferUtility) {
|
35824 | function deferUntilNextFrame(callback) {
|
35825 | var isWaiting, args, context;
|
35826 | return window.requestAnimationFrame || (window.requestAnimationFrame = function(func) {
|
35827 | return setTimeout(func, 20);
|
35828 | }), function() {
|
35829 | isWaiting || (isWaiting = !0, args = arguments, context = this, window.requestAnimationFrame(function() {
|
35830 | isWaiting = !1, callback.apply(context, args);
|
35831 | }));
|
35832 | };
|
35833 | }
|
35834 | DeferUtility.deferUntilNextFrame = deferUntilNextFrame;
|
35835 | }(DeferUtility = jsCommon.DeferUtility || (jsCommon.DeferUtility = {}));
|
35836 | }(jsCommon || (jsCommon = {}));
|
35837 | }, function(module, exports) {
|
35838 | var jsCommon, jsCommon = window.jsCommon;
|
35839 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
35840 | window.Microsoft;
|
35841 | !function(jsCommon) {
|
35842 | var TraceItem = function() {
|
35843 | function TraceItem(text, type, sessionId, requestId) {
|
35844 | this.text = text, this.type = type, this.sessionId = sessionId, this.requestId = requestId,
|
35845 | this.timeStamp = new Date();
|
35846 | }
|
35847 | return TraceItem.prototype.toString = function() {
|
35848 | var resultString = "";
|
35849 | return resultString += jsCommon.StringExtensions.format("{0} ({1}): {2}", TraceItem.traceTypeStrings[this.type], this.timeStamp.toUTCString(), this.text),
|
35850 | this.requestId && (resultString += "\n(Request id: " + this.requestId + ")"), resultString;
|
35851 | }, TraceItem.traceTypeStrings = [ "INFORMATION", "VERBOSE", "WARNING", "ERROR", "EXPECTEDERROR", "UNEXPECTEDERROR", "FATAL" ],
|
35852 | TraceItem;
|
35853 | }();
|
35854 | jsCommon.TraceItem = TraceItem;
|
35855 | }(jsCommon || (jsCommon = {}));
|
35856 | }, function(module, exports) {
|
35857 | var jsCommon, jsCommon = window.jsCommon;
|
35858 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
35859 | window.Microsoft;
|
35860 | !function(jsCommon) {
|
35861 | var UrlUtils;
|
35862 | !function(UrlUtils) {
|
35863 | function isValidUrl(value) {
|
35864 | if (jsCommon.StringExtensions.isNullOrEmpty(value)) return !1;
|
35865 | var match = jsCommon.RegExpExtensions.run(urlRegex, value);
|
35866 | return !(!match || 0 !== match.index);
|
35867 | }
|
35868 | function isValidImageUrl(url) {
|
35869 | return isValidUrl(url);
|
35870 | }
|
35871 | function findAllValidUrls(text) {
|
35872 | if (jsCommon.StringExtensions.isNullOrEmpty(text)) return [];
|
35873 | for (var matches, urlRanges = [], start = 0; null !== (matches = jsCommon.RegExpExtensions.run(urlRegex, text, start)); ) {
|
35874 | var url = matches[0], end = matches.index + url.length;
|
35875 | urlRanges.push({
|
35876 | start: matches.index,
|
35877 | end: end,
|
35878 | text: url
|
35879 | }), start = end;
|
35880 | }
|
35881 | return urlRanges;
|
35882 | }
|
35883 | function getBase64ContentFromDataUri(uri) {
|
35884 | if (0 !== uri.indexOf("data:")) throw new Error("Expected data uri");
|
35885 | var base64Token = ";base64,", indexBase64TokenStart = uri.indexOf(base64Token);
|
35886 | if (0 > indexBase64TokenStart) throw new Error("Expected base 64 content in data url");
|
35887 | var indexBase64Start = indexBase64TokenStart + base64Token.length;
|
35888 | return uri.substr(indexBase64Start, uri.length - indexBase64Start);
|
35889 | }
|
35890 | var urlRegex = /http[s]?:\/\/(\S)+/gi;
|
35891 | UrlUtils.isValidUrl = isValidUrl, UrlUtils.isValidImageUrl = isValidImageUrl, UrlUtils.findAllValidUrls = findAllValidUrls,
|
35892 | UrlUtils.getBase64ContentFromDataUri = getBase64ContentFromDataUri;
|
35893 | }(UrlUtils = jsCommon.UrlUtils || (jsCommon.UrlUtils = {}));
|
35894 | }(jsCommon || (jsCommon = {}));
|
35895 | }, function(module, exports) {
|
35896 | var jsCommon, jsCommon = window.jsCommon;
|
35897 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
35898 | window.Microsoft;
|
35899 | !function(jsCommon) {
|
35900 | var BrowserUtils;
|
35901 | !function(BrowserUtils) {
|
35902 | function isChrome() {
|
35903 | var vendorName = window.navigator.vendor || "", userAgent = window.navigator.userAgent.toLowerCase();
|
35904 | return vendorName.toLowerCase().indexOf("google") > -1 && userAgent.indexOf("chrome") > -1 && -1 === userAgent.indexOf("edge") && -1 === userAgent.indexOf("opr");
|
35905 | }
|
35906 | function isInternetExplorerOrEdge() {
|
35907 | var userAgent = window.navigator.userAgent.toLowerCase();
|
35908 | return userAgent.indexOf("msie") > -1 || userAgent.indexOf("trident") > -1 || userAgent.indexOf("edge") > -1;
|
35909 | }
|
35910 | function getInternetExplorerVersion() {
|
35911 | var retValue = 0;
|
35912 | if ("Microsoft Internet Explorer" === navigator.appName || window.navigator.userAgent.indexOf("MSIE") >= 0) {
|
35913 | var re = new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})"), result = re.exec(window.navigator.userAgent);
|
35914 | result && (retValue = parseFloat(result[1]));
|
35915 | }
|
35916 | return retValue;
|
35917 | }
|
35918 | function isFirefox() {
|
35919 | return navigator.userAgent.toLowerCase().indexOf("firefox") > -1;
|
35920 | }
|
35921 | BrowserUtils.isChrome = isChrome, BrowserUtils.isInternetExplorerOrEdge = isInternetExplorerOrEdge,
|
35922 | BrowserUtils.getInternetExplorerVersion = getInternetExplorerVersion, BrowserUtils.isFirefox = isFirefox;
|
35923 | }(BrowserUtils = jsCommon.BrowserUtils || (jsCommon.BrowserUtils = {}));
|
35924 | }(jsCommon || (jsCommon = {}));
|
35925 | }, function(module, exports) {
|
35926 | var jsCommon, jsCommon = window.jsCommon;
|
35927 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
35928 | window.Microsoft;
|
35929 | !function(jsCommon) {
|
35930 | var EnumExtensions;
|
35931 | !function(EnumExtensions) {
|
35932 | function hasFlag(value, flag) {
|
35933 | return (value & flag) === flag;
|
35934 | }
|
35935 | function setFlag(value, flag) {
|
35936 | return value |= flag;
|
35937 | }
|
35938 | function resetFlag(value, flag) {
|
35939 | return value &= ~flag;
|
35940 | }
|
35941 | function toString(enumType, value) {
|
35942 | return enumType[value];
|
35943 | }
|
35944 | EnumExtensions.hasFlag = hasFlag, EnumExtensions.setFlag = setFlag, EnumExtensions.resetFlag = resetFlag,
|
35945 | EnumExtensions.toString = toString;
|
35946 | }(EnumExtensions = jsCommon.EnumExtensions || (jsCommon.EnumExtensions = {}));
|
35947 | var StringExtensions;
|
35948 | !function(StringExtensions) {
|
35949 | function endsWith(str, suffix) {
|
35950 | return -1 !== str.indexOf(suffix, str.length - suffix.length);
|
35951 | }
|
35952 | StringExtensions.endsWith = endsWith;
|
35953 | }(StringExtensions = jsCommon.StringExtensions || (jsCommon.StringExtensions = {}));
|
35954 | var LogicExtensions;
|
35955 | !function(LogicExtensions) {
|
35956 | function XOR(a, b) {
|
35957 | return (a || b) && !(a && b);
|
35958 | }
|
35959 | LogicExtensions.XOR = XOR;
|
35960 | }(LogicExtensions = jsCommon.LogicExtensions || (jsCommon.LogicExtensions = {}));
|
35961 | var JsonComparer;
|
35962 | !function(JsonComparer) {
|
35963 | function equals(x, y) {
|
35964 | return x === y ? !0 : JSON.stringify(x) === JSON.stringify(y);
|
35965 | }
|
35966 | JsonComparer.equals = equals;
|
35967 | }(JsonComparer = jsCommon.JsonComparer || (jsCommon.JsonComparer = {}));
|
35968 | var TextSizeDefaults;
|
35969 | !function(TextSizeDefaults) {
|
35970 | function getScale(textSize) {
|
35971 | return (textSize - TextSizeDefaults.TextSizeMin) / TextSizeRange;
|
35972 | }
|
35973 | TextSizeDefaults.TextSizeMin = 8, TextSizeDefaults.TextSizeMax = 40;
|
35974 | var TextSizeRange = TextSizeDefaults.TextSizeMax - TextSizeDefaults.TextSizeMin;
|
35975 | TextSizeDefaults.getScale = getScale;
|
35976 | }(TextSizeDefaults = jsCommon.TextSizeDefaults || (jsCommon.TextSizeDefaults = {}));
|
35977 | var PixelConverter;
|
35978 | !function(PixelConverter) {
|
35979 | function toString(px) {
|
35980 | return px + PixelString;
|
35981 | }
|
35982 | function fromPoint(pt) {
|
35983 | return toString(fromPointToPixel(pt));
|
35984 | }
|
35985 | function fromPointToPixel(pt) {
|
35986 | return PxPtRatio * pt;
|
35987 | }
|
35988 | function toPoint(px) {
|
35989 | return px / PxPtRatio;
|
35990 | }
|
35991 | var PxPtRatio = 4 / 3, PixelString = "px";
|
35992 | PixelConverter.toString = toString, PixelConverter.fromPoint = fromPoint, PixelConverter.fromPointToPixel = fromPointToPixel,
|
35993 | PixelConverter.toPoint = toPoint;
|
35994 | }(PixelConverter = jsCommon.PixelConverter || (jsCommon.PixelConverter = {}));
|
35995 | var RegExpExtensions;
|
35996 | !function(RegExpExtensions) {
|
35997 | function run(regex, value, start) {
|
35998 | return regex.lastIndex = start || 0, regex.exec(value);
|
35999 | }
|
36000 | RegExpExtensions.run = run;
|
36001 | }(RegExpExtensions = jsCommon.RegExpExtensions || (jsCommon.RegExpExtensions = {}));
|
36002 | }(jsCommon || (jsCommon = {}));
|
36003 | }, function(module, exports) {
|
36004 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
36005 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
36006 | !function(powerbi) {
|
36007 | var visuals;
|
36008 | !function(visuals) {
|
36009 | var utility;
|
36010 | !function(utility) {
|
36011 | var StyleUtils;
|
36012 | !function(StyleUtils) {
|
36013 | function getRotateAngleFromElement(element) {
|
36014 | var rawElemStyle = element.get(0).style, transformString = rawElemStyle.transform || rawElemStyle.webkitTransform;
|
36015 | if (transformString) {
|
36016 | var transform = transformString.match(/rotate\((-?\d+(?:\.\d*)?)deg\)/);
|
36017 | if (transform) return parseFloat(transform[1]);
|
36018 | }
|
36019 | return 0;
|
36020 | }
|
36021 | function getTranslateTransformFromElement(element) {
|
36022 | var rawElemStyle = element.get(0).style, transformString = rawElemStyle.transform || rawElemStyle.webkitTransform, retValue = {
|
36023 | x: 0,
|
36024 | y: 0
|
36025 | };
|
36026 | if (transformString && transformString.length > 0) {
|
36027 | var transform = transformString.match(/translate\((-?\d+(?:\.\d*)?)px, (-?\d+(?:\.\d*)?)px\)/);
|
36028 | transform && (retValue.x = parseFloat(transform[1]), retValue.y = parseFloat(transform[2]));
|
36029 | }
|
36030 | return retValue;
|
36031 | }
|
36032 | function getPadding(element) {
|
36033 | return element ? {
|
36034 | left: parseFloat(element.css("padding-left")) || 0,
|
36035 | right: parseFloat(element.css("padding-right")) || 0,
|
36036 | top: parseFloat(element.css("padding-top")) || 0,
|
36037 | bottom: parseFloat(element.css("padding-bottom")) || 0
|
36038 | } : void 0;
|
36039 | }
|
36040 | StyleUtils.getRotateAngleFromElement = getRotateAngleFromElement, StyleUtils.getTranslateTransformFromElement = getTranslateTransformFromElement,
|
36041 | StyleUtils.getPadding = getPadding;
|
36042 | }(StyleUtils = utility.StyleUtils || (utility.StyleUtils = {}));
|
36043 | }(utility = visuals.utility || (visuals.utility = {}));
|
36044 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
36045 | }(powerbi || (powerbi = {}));
|
36046 | }, function(module, exports, __webpack_require__) {
|
36047 | var jsCommon, jsCommon = window.jsCommon;
|
36048 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
36049 | window.Microsoft;
|
36050 | !function(jsCommon) {
|
36051 | var ConsoleTracer = function() {
|
36052 | function ConsoleTracer() {}
|
36053 | return ConsoleTracer.prototype.logTrace = function(trace) {
|
36054 | switch (trace.type) {
|
36055 | case jsCommon.TraceType.Information:
|
36056 | break;
|
36057 |
|
36058 | case jsCommon.TraceType.UnexpectedError:
|
36059 | case jsCommon.TraceType.Error:
|
36060 | case jsCommon.TraceType.Fatal:
|
36061 | break;
|
36062 |
|
36063 | case jsCommon.TraceType.ExpectedError:
|
36064 | case jsCommon.TraceType.Warning:
|
36065 | break;
|
36066 |
|
36067 | case jsCommon.TraceType.Verbose: }
|
36068 | }, ConsoleTracer;
|
36069 | }();
|
36070 | jsCommon.ConsoleTracer = ConsoleTracer;
|
36071 | var Trace;
|
36072 | !function(Trace) {
|
36073 | function warning(text, requestId) {
|
36074 | logTraceInternal(new jsCommon.TraceItem(text, jsCommon.TraceType.Warning, requestId));
|
36075 | }
|
36076 | function error(text, includeStackTrace, requestId) {
|
36077 | includeStackTrace && (text = jsCommon.StringExtensions.format("{0}.\nStack:\n{1}", text, jsCommon.getStackTrace())),
|
36078 | logTraceInternal(new jsCommon.TraceItem(text, jsCommon.TraceType.Error, requestId));
|
36079 | }
|
36080 | function verbose(text, requestId) {
|
36081 | logTraceInternal(new jsCommon.TraceItem(text, jsCommon.TraceType.Verbose, requestId));
|
36082 | }
|
36083 | function addListener(listener) {
|
36084 | listeners.push(listener);
|
36085 | }
|
36086 | function removeListener(listener) {
|
36087 | var index = listeners.indexOf(listener);
|
36088 | index >= 0 && listeners.splice(index, 1);
|
36089 | }
|
36090 | function resetListeners() {
|
36091 | listeners = new Array(defaultListener);
|
36092 | }
|
36093 | function reset() {
|
36094 | lastTraceIndex = -1;
|
36095 | }
|
36096 | function getTraces() {
|
36097 | if (!(0 > lastTraceIndex)) {
|
36098 | for (var result = new Array(lastTraceIndex + 1), i = 0; lastTraceIndex >= i; i++) result[i] = traces[i];
|
36099 | return result;
|
36100 | }
|
36101 | }
|
36102 | function disableDefaultListener() {
|
36103 | removeListener(defaultListener);
|
36104 | }
|
36105 | function enableDefaultListener() {
|
36106 | addListener(defaultListener);
|
36107 | }
|
36108 | function logTraceInternal(trace) {
|
36109 | lastTraceIndex + 1 >= traceMaxCount && reset(), traces[++lastTraceIndex] = trace;
|
36110 | for (var i = 0, len = listeners.length; len > i; i++) listeners[i].logTrace(trace);
|
36111 | }
|
36112 | var traceMaxCount = 1e3, traces = new Array(traceMaxCount), lastTraceIndex = -1, defaultListener = new ConsoleTracer(), listeners = new Array(defaultListener);
|
36113 | Trace.warning = warning, Trace.error = error, Trace.verbose = verbose, Trace.addListener = addListener,
|
36114 | Trace.removeListener = removeListener, Trace.resetListeners = resetListeners, Trace.reset = reset,
|
36115 | Trace.getTraces = getTraces, Trace.disableDefaultListener = disableDefaultListener,
|
36116 | Trace.enableDefaultListener = enableDefaultListener;
|
36117 | }(Trace = jsCommon.Trace || (jsCommon.Trace = {}));
|
36118 | }(jsCommon || (jsCommon = {}));
|
36119 | }, function(module, exports) {
|
36120 | var jsCommon, jsCommon = window.jsCommon;
|
36121 | window.powerbi, window.powerbitests, window.InJs, window.debug, window.jasmine,
|
36122 | window.Microsoft;
|
36123 | !function(jsCommon) {
|
36124 | !function(TraceType) {
|
36125 | TraceType[TraceType.Information = 0] = "Information", TraceType[TraceType.Verbose = 1] = "Verbose",
|
36126 | TraceType[TraceType.Warning = 2] = "Warning", TraceType[TraceType.Error = 3] = "Error",
|
36127 | TraceType[TraceType.ExpectedError = 4] = "ExpectedError", TraceType[TraceType.UnexpectedError = 5] = "UnexpectedError",
|
36128 | TraceType[TraceType.Fatal = 6] = "Fatal";
|
36129 | }(jsCommon.TraceType || (jsCommon.TraceType = {}));
|
36130 | jsCommon.TraceType;
|
36131 | }(jsCommon || (jsCommon = {}));
|
36132 | }, function(module, exports) {
|
36133 | var jsCommon, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
36134 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
36135 | !function(jsCommon) {
|
36136 | function ensurePowerView(action) {
|
36137 | void 0 === action && (action = _.noop), jsCommon.requires(PowerViewPackage, action);
|
36138 | }
|
36139 | function ensureMap(locale, action) {
|
36140 | var mapPackageWithLocale = powerbi.Prototype.inherit(MapPackage);
|
36141 | if (!_.isEmpty(locale)) {
|
36142 | var localeSplit = locale.split("-", 2);
|
36143 | mapPackageWithLocale.javaScriptFilesWithCallback[0].javascriptFile = MSMapcontrol.concat("&mkt=" + locale + "&ur=" + (localeSplit.length > 1 ? localeSplit[1] : locale));
|
36144 | }
|
36145 | jsCommon.requires(mapPackageWithLocale, action);
|
36146 | }
|
36147 | function mapControlLoaded() {
|
36148 | MSMapcontrolLoaded = !0, WaitForMSMapLoad && (WaitForMSMapLoad.resolve(), WaitForMSMapLoad = void 0);
|
36149 | }
|
36150 | function waitForMapControlLoaded() {
|
36151 | var task;
|
36152 | return MSMapcontrolLoaded ? (task = $.Deferred(), task.resolve()) : task = WaitForMSMapLoad = $.Deferred(),
|
36153 | task.promise();
|
36154 | }
|
36155 | var MSMapcontrol = "https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1&onscriptload=globalMapControlLoaded", MSMapcontrolLoaded = !1, WaitForMSMapLoad = null, PowerViewPackage = {
|
36156 | javaScriptFiles: [ powerbi.build + "/externals/pv/webclient.js" ],
|
36157 | cssFiles: [ powerbi.build + "/externals/pv/Styles/_all.css" ],
|
36158 | javaScriptFilesWithCallback: [ {
|
36159 | javascriptFile: MSMapcontrol,
|
36160 | onLoadCallback: waitForMapControlLoaded
|
36161 | } ]
|
36162 | };
|
36163 | jsCommon.ensurePowerView = ensurePowerView;
|
36164 | var MapPackage = {
|
36165 | javaScriptFilesWithCallback: [ {
|
36166 | javascriptFile: MSMapcontrol,
|
36167 | onLoadCallback: waitForMapControlLoaded
|
36168 | } ]
|
36169 | };
|
36170 | jsCommon.ensureMap = ensureMap, jsCommon.mapControlLoaded = mapControlLoaded, jsCommon.waitForMapControlLoaded = waitForMapControlLoaded;
|
36171 | }(jsCommon || (jsCommon = {})), globalMapControlLoaded = function() {
|
36172 | jsCommon.mapControlLoaded();
|
36173 | };
|
36174 | }, function(module, exports) {
|
36175 | var InJs, InJs = (window.jsCommon, window.powerbi, window.powerbitests, window.InJs);
|
36176 | window.debug, window.jasmine, window.Microsoft;
|
36177 | !function(InJs) {
|
36178 | !function(TraceType) {
|
36179 | TraceType[TraceType.information = 0] = "information", TraceType[TraceType.verbose = 1] = "verbose",
|
36180 | TraceType[TraceType.warning = 2] = "warning", TraceType[TraceType.error = 3] = "error",
|
36181 | TraceType[TraceType.expectedError = 4] = "expectedError", TraceType[TraceType.unexpectedError = 5] = "unexpectedError",
|
36182 | TraceType[TraceType.fatal = 6] = "fatal";
|
36183 | }(InJs.TraceType || (InJs.TraceType = {}));
|
36184 | InJs.TraceType;
|
36185 | }(InJs || (InJs = {}));
|
36186 | }, function(module, exports, __webpack_require__) {
|
36187 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
36188 | window.jasmine, window.Microsoft;
|
36189 | window.jsCommon = window.jsCommon || {}, window.powerbi = window.powerbi || {},
|
36190 | window.debug = window.debug || {}, window.InJs = window.InJs || {}, __webpack_require__(304),
|
36191 | __webpack_require__(307), __webpack_require__(308), __webpack_require__(309), __webpack_require__(310),
|
36192 | __webpack_require__(311), __webpack_require__(312), __webpack_require__(313), __webpack_require__(314),
|
36193 | __webpack_require__(315), __webpack_require__(316), __webpack_require__(317), __webpack_require__(318),
|
36194 | __webpack_require__(319), __webpack_require__(320), __webpack_require__(321), __webpack_require__(322),
|
36195 | __webpack_require__(323), __webpack_require__(324), __webpack_require__(325), __webpack_require__(326),
|
36196 | __webpack_require__(327), __webpack_require__(328), __webpack_require__(329), __webpack_require__(330),
|
36197 | __webpack_require__(331), __webpack_require__(332), __webpack_require__(333), __webpack_require__(334),
|
36198 | __webpack_require__(335), __webpack_require__(336), __webpack_require__(337), __webpack_require__(338),
|
36199 | __webpack_require__(339), __webpack_require__(340), __webpack_require__(341), __webpack_require__(342),
|
36200 | __webpack_require__(343), __webpack_require__(344), __webpack_require__(345), __webpack_require__(346),
|
36201 | __webpack_require__(347), __webpack_require__(348), __webpack_require__(349), __webpack_require__(350),
|
36202 | __webpack_require__(351);
|
36203 | }, function(module, exports, __webpack_require__) {
|
36204 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
36205 | window.jasmine, window.Microsoft;
|
36206 | __webpack_require__(305), __webpack_require__(306);
|
36207 | }, function(module, exports) {
|
36208 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
36209 | window.jasmine, window.Microsoft;
|
36210 | }, function(module, exports) {
|
36211 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
36212 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
36213 | !function(powerbi) {
|
36214 | !function(VisualDataRoleKind) {
|
36215 | VisualDataRoleKind[VisualDataRoleKind.Grouping = 0] = "Grouping", VisualDataRoleKind[VisualDataRoleKind.Measure = 1] = "Measure",
|
36216 | VisualDataRoleKind[VisualDataRoleKind.GroupingOrMeasure = 2] = "GroupingOrMeasure";
|
36217 | }(powerbi.VisualDataRoleKind || (powerbi.VisualDataRoleKind = {}));
|
36218 | powerbi.VisualDataRoleKind;
|
36219 | !function(VisualDataChangeOperationKind) {
|
36220 | VisualDataChangeOperationKind[VisualDataChangeOperationKind.Create = 0] = "Create",
|
36221 | VisualDataChangeOperationKind[VisualDataChangeOperationKind.Append = 1] = "Append";
|
36222 | }(powerbi.VisualDataChangeOperationKind || (powerbi.VisualDataChangeOperationKind = {}));
|
36223 | powerbi.VisualDataChangeOperationKind;
|
36224 | !function(VisualUpdateType) {
|
36225 | VisualUpdateType[VisualUpdateType.Data = 2] = "Data", VisualUpdateType[VisualUpdateType.Resize = 4] = "Resize",
|
36226 | VisualUpdateType[VisualUpdateType.ViewMode = 8] = "ViewMode", VisualUpdateType[VisualUpdateType.Style = 16] = "Style",
|
36227 | VisualUpdateType[VisualUpdateType.ResizeEnd = 32] = "ResizeEnd", VisualUpdateType[VisualUpdateType.All = 62] = "All";
|
36228 | }(powerbi.VisualUpdateType || (powerbi.VisualUpdateType = {}));
|
36229 | powerbi.VisualUpdateType;
|
36230 | !function(VisualPermissions) {}(powerbi.VisualPermissions || (powerbi.VisualPermissions = {}));
|
36231 | var visuals;
|
36232 | powerbi.VisualPermissions;
|
36233 | !function(visuals) {
|
36234 | var telemetry;
|
36235 | !function(telemetry) {
|
36236 | !function(ErrorSource) {
|
36237 | ErrorSource[ErrorSource.PowerBI = 0] = "PowerBI", ErrorSource[ErrorSource.External = 1] = "External",
|
36238 | ErrorSource[ErrorSource.User = 2] = "User";
|
36239 | }(telemetry.ErrorSource || (telemetry.ErrorSource = {}));
|
36240 | telemetry.ErrorSource;
|
36241 | }(telemetry = visuals.telemetry || (visuals.telemetry = {}));
|
36242 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
36243 | }(powerbi || (powerbi = {}));
|
36244 | }, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports) {}, function(module, exports, __webpack_require__) {
|
36245 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
36246 | window.jasmine, window.Microsoft;
|
36247 | window.jsCommon = window.jsCommon || {}, window.powerbi = window.powerbi || {},
|
36248 | window.debug = window.debug || {}, window.InJs = window.InJs || {}, __webpack_require__(353);
|
36249 | }, function(module, exports, __webpack_require__) {
|
36250 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
36251 | window.jasmine, window.Microsoft;
|
36252 | __webpack_require__(354), __webpack_require__(355), __webpack_require__(356), __webpack_require__(357),
|
36253 | __webpack_require__(358), __webpack_require__(359), __webpack_require__(360), __webpack_require__(361),
|
36254 | __webpack_require__(362), __webpack_require__(363), __webpack_require__(364), __webpack_require__(365),
|
36255 | __webpack_require__(366), __webpack_require__(367), __webpack_require__(368), __webpack_require__(369),
|
36256 | __webpack_require__(370), __webpack_require__(371), __webpack_require__(372), __webpack_require__(373),
|
36257 | __webpack_require__(374), __webpack_require__(375), __webpack_require__(376), __webpack_require__(377),
|
36258 | __webpack_require__(378), __webpack_require__(379), __webpack_require__(380), __webpack_require__(381),
|
36259 | __webpack_require__(382), __webpack_require__(383), __webpack_require__(384), __webpack_require__(385),
|
36260 | __webpack_require__(386), __webpack_require__(387), __webpack_require__(388), __webpack_require__(389),
|
36261 | __webpack_require__(390), __webpack_require__(391), __webpack_require__(392), __webpack_require__(393),
|
36262 | __webpack_require__(394), __webpack_require__(395), __webpack_require__(396), __webpack_require__(397),
|
36263 | __webpack_require__(398), __webpack_require__(399), __webpack_require__(400), __webpack_require__(401),
|
36264 | __webpack_require__(402), __webpack_require__(403), __webpack_require__(404), __webpack_require__(405),
|
36265 | __webpack_require__(406), __webpack_require__(407), __webpack_require__(408), __webpack_require__(409),
|
36266 | __webpack_require__(410), __webpack_require__(411), __webpack_require__(412), __webpack_require__(413),
|
36267 | __webpack_require__(414), __webpack_require__(415), __webpack_require__(416), __webpack_require__(417),
|
36268 | __webpack_require__(418), __webpack_require__(419), __webpack_require__(420), __webpack_require__(421),
|
36269 | __webpack_require__(422), __webpack_require__(423), __webpack_require__(424), __webpack_require__(425),
|
36270 | __webpack_require__(426), __webpack_require__(427), __webpack_require__(428), __webpack_require__(429),
|
36271 | __webpack_require__(430), __webpack_require__(431), __webpack_require__(432), __webpack_require__(433),
|
36272 | __webpack_require__(434), __webpack_require__(435), __webpack_require__(436), __webpack_require__(437);
|
36273 | }, function(module, exports) {
|
36274 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
36275 | window.jasmine, window.Microsoft;
|
36276 | }, function(module, exports) {
|
36277 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
36278 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
36279 | function __() {
|
36280 | this.constructor = d;
|
36281 | }
|
36282 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
36283 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
36284 | });
|
36285 | !function(powerbi) {
|
36286 | var data;
|
36287 | !function(data) {
|
36288 | var DefaultSQExprVisitorWithArg = function() {
|
36289 | function DefaultSQExprVisitorWithArg() {}
|
36290 | return DefaultSQExprVisitorWithArg.prototype.visitEntity = function(expr, arg) {
|
36291 | return this.visitDefault(expr, arg);
|
36292 | }, DefaultSQExprVisitorWithArg.prototype.visitColumnRef = function(expr, arg) {
|
36293 | return this.visitDefault(expr, arg);
|
36294 | }, DefaultSQExprVisitorWithArg.prototype.visitMeasureRef = function(expr, arg) {
|
36295 | return this.visitDefault(expr, arg);
|
36296 | }, DefaultSQExprVisitorWithArg.prototype.visitAggr = function(expr, arg) {
|
36297 | return this.visitDefault(expr, arg);
|
36298 | }, DefaultSQExprVisitorWithArg.prototype.visitPercentile = function(expr, arg) {
|
36299 | return this.visitDefault(expr, arg);
|
36300 | }, DefaultSQExprVisitorWithArg.prototype.visitHierarchy = function(expr, arg) {
|
36301 | return this.visitDefault(expr, arg);
|
36302 | }, DefaultSQExprVisitorWithArg.prototype.visitHierarchyLevel = function(expr, arg) {
|
36303 | return this.visitDefault(expr, arg);
|
36304 | }, DefaultSQExprVisitorWithArg.prototype.visitPropertyVariationSource = function(expr, arg) {
|
36305 | return this.visitDefault(expr, arg);
|
36306 | }, DefaultSQExprVisitorWithArg.prototype.visitSelectRef = function(expr, arg) {
|
36307 | return this.visitDefault(expr, arg);
|
36308 | }, DefaultSQExprVisitorWithArg.prototype.visitBetween = function(expr, arg) {
|
36309 | return this.visitDefault(expr, arg);
|
36310 | }, DefaultSQExprVisitorWithArg.prototype.visitIn = function(expr, arg) {
|
36311 | return this.visitDefault(expr, arg);
|
36312 | }, DefaultSQExprVisitorWithArg.prototype.visitAnd = function(expr, arg) {
|
36313 | return this.visitDefault(expr, arg);
|
36314 | }, DefaultSQExprVisitorWithArg.prototype.visitOr = function(expr, arg) {
|
36315 | return this.visitDefault(expr, arg);
|
36316 | }, DefaultSQExprVisitorWithArg.prototype.visitCompare = function(expr, arg) {
|
36317 | return this.visitDefault(expr, arg);
|
36318 | }, DefaultSQExprVisitorWithArg.prototype.visitContains = function(expr, arg) {
|
36319 | return this.visitDefault(expr, arg);
|
36320 | }, DefaultSQExprVisitorWithArg.prototype.visitExists = function(expr, arg) {
|
36321 | return this.visitDefault(expr, arg);
|
36322 | }, DefaultSQExprVisitorWithArg.prototype.visitNot = function(expr, arg) {
|
36323 | return this.visitDefault(expr, arg);
|
36324 | }, DefaultSQExprVisitorWithArg.prototype.visitStartsWith = function(expr, arg) {
|
36325 | return this.visitDefault(expr, arg);
|
36326 | }, DefaultSQExprVisitorWithArg.prototype.visitConstant = function(expr, arg) {
|
36327 | return this.visitDefault(expr, arg);
|
36328 | }, DefaultSQExprVisitorWithArg.prototype.visitDateSpan = function(expr, arg) {
|
36329 | return this.visitDefault(expr, arg);
|
36330 | }, DefaultSQExprVisitorWithArg.prototype.visitDateAdd = function(expr, arg) {
|
36331 | return this.visitDefault(expr, arg);
|
36332 | }, DefaultSQExprVisitorWithArg.prototype.visitNow = function(expr, arg) {
|
36333 | return this.visitDefault(expr, arg);
|
36334 | }, DefaultSQExprVisitorWithArg.prototype.visitDefaultValue = function(expr, arg) {
|
36335 | return this.visitDefault(expr, arg);
|
36336 | }, DefaultSQExprVisitorWithArg.prototype.visitAnyValue = function(expr, arg) {
|
36337 | return this.visitDefault(expr, arg);
|
36338 | }, DefaultSQExprVisitorWithArg.prototype.visitArithmetic = function(expr, arg) {
|
36339 | return this.visitDefault(expr, arg);
|
36340 | }, DefaultSQExprVisitorWithArg.prototype.visitFillRule = function(expr, arg) {
|
36341 | return this.visitDefault(expr, arg);
|
36342 | }, DefaultSQExprVisitorWithArg.prototype.visitResourcePackageItem = function(expr, arg) {
|
36343 | return this.visitDefault(expr, arg);
|
36344 | }, DefaultSQExprVisitorWithArg.prototype.visitScopedEval = function(expr, arg) {
|
36345 | return this.visitDefault(expr, arg);
|
36346 | }, DefaultSQExprVisitorWithArg.prototype.visitWithRef = function(expr, arg) {
|
36347 | return this.visitDefault(expr, arg);
|
36348 | }, DefaultSQExprVisitorWithArg.prototype.visitTransformTableRef = function(expr, arg) {
|
36349 | return this.visitDefault(expr, arg);
|
36350 | }, DefaultSQExprVisitorWithArg.prototype.visitTransformOutputRoleRef = function(expr, arg) {
|
36351 | return this.visitDefault(expr, arg);
|
36352 | }, DefaultSQExprVisitorWithArg.prototype.visitDefault = function(expr, arg) {},
|
36353 | DefaultSQExprVisitorWithArg;
|
36354 | }();
|
36355 | data.DefaultSQExprVisitorWithArg = DefaultSQExprVisitorWithArg;
|
36356 | var DefaultSQExprVisitor = function(_super) {
|
36357 | function DefaultSQExprVisitor() {
|
36358 | _super.apply(this, arguments);
|
36359 | }
|
36360 | return __extends(DefaultSQExprVisitor, _super), DefaultSQExprVisitor;
|
36361 | }(DefaultSQExprVisitorWithArg);
|
36362 | data.DefaultSQExprVisitor = DefaultSQExprVisitor;
|
36363 | var DefaultSQExprVisitorWithTraversal = function() {
|
36364 | function DefaultSQExprVisitorWithTraversal() {}
|
36365 | return DefaultSQExprVisitorWithTraversal.prototype.visitEntity = function(expr) {
|
36366 | this.visitDefault(expr);
|
36367 | }, DefaultSQExprVisitorWithTraversal.prototype.visitColumnRef = function(expr) {
|
36368 | expr.source.accept(this);
|
36369 | }, DefaultSQExprVisitorWithTraversal.prototype.visitMeasureRef = function(expr) {
|
36370 | expr.source.accept(this);
|
36371 | }, DefaultSQExprVisitorWithTraversal.prototype.visitAggr = function(expr) {
|
36372 | expr.arg.accept(this);
|
36373 | }, DefaultSQExprVisitorWithTraversal.prototype.visitPercentile = function(expr) {
|
36374 | expr.arg.accept(this);
|
36375 | }, DefaultSQExprVisitorWithTraversal.prototype.visitHierarchy = function(expr) {
|
36376 | expr.arg.accept(this);
|
36377 | }, DefaultSQExprVisitorWithTraversal.prototype.visitHierarchyLevel = function(expr) {
|
36378 | expr.arg.accept(this);
|
36379 | }, DefaultSQExprVisitorWithTraversal.prototype.visitPropertyVariationSource = function(expr) {
|
36380 | expr.arg.accept(this);
|
36381 | }, DefaultSQExprVisitorWithTraversal.prototype.visitSelectRef = function(expr) {
|
36382 | this.visitDefault(expr);
|
36383 | }, DefaultSQExprVisitorWithTraversal.prototype.visitBetween = function(expr) {
|
36384 | expr.arg.accept(this), expr.lower.accept(this), expr.upper.accept(this);
|
36385 | }, DefaultSQExprVisitorWithTraversal.prototype.visitIn = function(expr) {
|
36386 | for (var args = expr.args, i = 0, len = args.length; len > i; i++) args[i].accept(this);
|
36387 | for (var values = expr.values, i = 0, len = values.length; len > i; i++) for (var valueTuple = values[i], j = 0, jlen = valueTuple.length; jlen > j; j++) valueTuple[j].accept(this);
|
36388 | }, DefaultSQExprVisitorWithTraversal.prototype.visitAnd = function(expr) {
|
36389 | expr.left.accept(this), expr.right.accept(this);
|
36390 | }, DefaultSQExprVisitorWithTraversal.prototype.visitOr = function(expr) {
|
36391 | expr.left.accept(this), expr.right.accept(this);
|
36392 | }, DefaultSQExprVisitorWithTraversal.prototype.visitCompare = function(expr) {
|
36393 | expr.left.accept(this), expr.right.accept(this);
|
36394 | }, DefaultSQExprVisitorWithTraversal.prototype.visitContains = function(expr) {
|
36395 | expr.left.accept(this), expr.right.accept(this);
|
36396 | }, DefaultSQExprVisitorWithTraversal.prototype.visitExists = function(expr) {
|
36397 | expr.arg.accept(this);
|
36398 | }, DefaultSQExprVisitorWithTraversal.prototype.visitNot = function(expr) {
|
36399 | expr.arg.accept(this);
|
36400 | }, DefaultSQExprVisitorWithTraversal.prototype.visitStartsWith = function(expr) {
|
36401 | expr.left.accept(this), expr.right.accept(this);
|
36402 | }, DefaultSQExprVisitorWithTraversal.prototype.visitConstant = function(expr) {
|
36403 | this.visitDefault(expr);
|
36404 | }, DefaultSQExprVisitorWithTraversal.prototype.visitDateSpan = function(expr) {
|
36405 | expr.arg.accept(this);
|
36406 | }, DefaultSQExprVisitorWithTraversal.prototype.visitDateAdd = function(expr) {
|
36407 | expr.arg.accept(this);
|
36408 | }, DefaultSQExprVisitorWithTraversal.prototype.visitNow = function(expr) {
|
36409 | this.visitDefault(expr);
|
36410 | }, DefaultSQExprVisitorWithTraversal.prototype.visitDefaultValue = function(expr) {
|
36411 | this.visitDefault(expr);
|
36412 | }, DefaultSQExprVisitorWithTraversal.prototype.visitAnyValue = function(expr) {
|
36413 | this.visitDefault(expr);
|
36414 | }, DefaultSQExprVisitorWithTraversal.prototype.visitArithmetic = function(expr) {
|
36415 | expr.left.accept(this), expr.right.accept(this);
|
36416 | }, DefaultSQExprVisitorWithTraversal.prototype.visitFillRule = function(expr) {
|
36417 | expr.input.accept(this);
|
36418 | var rule = expr.rule, gradient2 = rule.linearGradient2, gradient3 = rule.linearGradient3;
|
36419 | gradient2 && this.visitLinearGradient2(gradient2), gradient3 && this.visitLinearGradient3(gradient3);
|
36420 | }, DefaultSQExprVisitorWithTraversal.prototype.visitLinearGradient2 = function(gradient2) {
|
36421 | this.visitFillRuleStop(gradient2.min), this.visitFillRuleStop(gradient2.max);
|
36422 | }, DefaultSQExprVisitorWithTraversal.prototype.visitLinearGradient3 = function(gradient3) {
|
36423 | this.visitFillRuleStop(gradient3.min), this.visitFillRuleStop(gradient3.mid), this.visitFillRuleStop(gradient3.max);
|
36424 | }, DefaultSQExprVisitorWithTraversal.prototype.visitResourcePackageItem = function(expr) {
|
36425 | this.visitDefault(expr);
|
36426 | }, DefaultSQExprVisitorWithTraversal.prototype.visitScopedEval = function(expr) {
|
36427 | expr.expression.accept(this);
|
36428 | for (var _i = 0, _a = expr.scope; _i < _a.length; _i++) {
|
36429 | var scopeExpr = _a[_i];
|
36430 | scopeExpr.accept(this);
|
36431 | }
|
36432 | }, DefaultSQExprVisitorWithTraversal.prototype.visitWithRef = function(expr) {
|
36433 | this.visitDefault(expr);
|
36434 | }, DefaultSQExprVisitorWithTraversal.prototype.visitTransformTableRef = function(expr) {
|
36435 | this.visitDefault(expr);
|
36436 | }, DefaultSQExprVisitorWithTraversal.prototype.visitTransformOutputRoleRef = function(expr) {
|
36437 | this.visitDefault(expr);
|
36438 | }, DefaultSQExprVisitorWithTraversal.prototype.visitDefault = function(expr) {},
|
36439 | DefaultSQExprVisitorWithTraversal.prototype.visitFillRuleStop = function(stop) {
|
36440 | stop.color.accept(this);
|
36441 | var value = stop.value;
|
36442 | value && value.accept(this);
|
36443 | }, DefaultSQExprVisitorWithTraversal;
|
36444 | }();
|
36445 | data.DefaultSQExprVisitorWithTraversal = DefaultSQExprVisitorWithTraversal;
|
36446 | }(data = powerbi.data || (powerbi.data = {}));
|
36447 | }(powerbi || (powerbi = {}));
|
36448 | }, function(module, exports) {
|
36449 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
36450 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
36451 | !function(powerbi) {
|
36452 | function createEnumType(members) {
|
36453 | return new EnumType(members);
|
36454 | }
|
36455 | powerbi.createEnumType = createEnumType;
|
36456 | var EnumType = function() {
|
36457 | function EnumType(allMembers) {
|
36458 | this.allMembers = allMembers;
|
36459 | }
|
36460 | return EnumType.prototype.members = function(validMembers) {
|
36461 | var allMembers = this.allMembers;
|
36462 | if (!validMembers) return allMembers;
|
36463 | for (var membersToReturn = [], _i = 0, allMembers_1 = allMembers; _i < allMembers_1.length; _i++) {
|
36464 | var member = allMembers_1[_i];
|
36465 | _.contains(validMembers, member.value) && membersToReturn.push(member);
|
36466 | }
|
36467 | return membersToReturn;
|
36468 | }, EnumType;
|
36469 | }();
|
36470 | }(powerbi || (powerbi = {}));
|
36471 | }, function(module, exports) {
|
36472 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
36473 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
36474 | !function(powerbi) {
|
36475 | function createSolidFillDefinition(color) {
|
36476 | return {
|
36477 | solid: {
|
36478 | color: SQExprBuilder.text(color)
|
36479 | }
|
36480 | };
|
36481 | }
|
36482 | var SQExprBuilder = powerbi.data.SQExprBuilder;
|
36483 | powerbi.createSolidFillDefinition = createSolidFillDefinition;
|
36484 | var FillSolidColorTypeDescriptor;
|
36485 | !function(FillSolidColorTypeDescriptor) {
|
36486 | function nullable(descriptor) {
|
36487 | if (descriptor === !0) return !1;
|
36488 | var advancedDescriptor = descriptor;
|
36489 | return !!advancedDescriptor.nullable;
|
36490 | }
|
36491 | FillSolidColorTypeDescriptor.nullable = nullable;
|
36492 | }(FillSolidColorTypeDescriptor = powerbi.FillSolidColorTypeDescriptor || (powerbi.FillSolidColorTypeDescriptor = {}));
|
36493 | }(powerbi || (powerbi = {}));
|
36494 | }, function(module, exports) {
|
36495 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
36496 | window.jasmine, window.Microsoft;
|
36497 | }, function(module, exports) {
|
36498 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
36499 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
36500 | !function(powerbi) {
|
36501 | var ImageDefinition;
|
36502 | !function(ImageDefinition) {
|
36503 | ImageDefinition.urlType = {
|
36504 | misc: {
|
36505 | imageUrl: !0
|
36506 | }
|
36507 | };
|
36508 | }(ImageDefinition = powerbi.ImageDefinition || (powerbi.ImageDefinition = {}));
|
36509 | }(powerbi || (powerbi = {}));
|
36510 | }, function(module, exports) {
|
36511 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
36512 | window.jasmine, window.Microsoft;
|
36513 | }, function(module, exports) {
|
36514 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
36515 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
36516 | !function(powerbi) {
|
36517 | var StructuralTypeDescriptor;
|
36518 | !function(StructuralTypeDescriptor) {
|
36519 | function isValid(type) {
|
36520 | return !!(type.fill || type.fillRule || type.filter || type.expression || type.image || type.paragraphs);
|
36521 | }
|
36522 | StructuralTypeDescriptor.isValid = isValid;
|
36523 | }(StructuralTypeDescriptor = powerbi.StructuralTypeDescriptor || (powerbi.StructuralTypeDescriptor = {}));
|
36524 | }(powerbi || (powerbi = {}));
|
36525 | }, function(module, exports) {
|
36526 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
36527 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
36528 | !function(powerbi) {
|
36529 | function getPrimitiveType(extendedType) {
|
36530 | return extendedType & PrimitiveTypeMask;
|
36531 | }
|
36532 | function isPrimitiveType(extendedType) {
|
36533 | return (extendedType & PrimitiveTypeWithFlagsMask) === extendedType;
|
36534 | }
|
36535 | function getCategoryFromExtendedType(extendedType) {
|
36536 | if (isPrimitiveType(extendedType)) return null;
|
36537 | var category = ExtendedType[extendedType];
|
36538 | if (category) {
|
36539 | var delimIdx = category.lastIndexOf("_");
|
36540 | if (delimIdx > 0) {
|
36541 | var baseCategory = category.slice(0, delimIdx);
|
36542 | ExtendedType[baseCategory] && (category = baseCategory);
|
36543 | }
|
36544 | }
|
36545 | return category || null;
|
36546 | }
|
36547 | function toExtendedType(primitiveType, category) {
|
36548 | var primitiveString = PrimitiveType[primitiveType], t = ExtendedType[primitiveString];
|
36549 | if (null == t && (t = ExtendedType.Null), primitiveType && category) {
|
36550 | var categoryType = ExtendedType[category];
|
36551 | if (categoryType) {
|
36552 | var categoryPrimitiveType = getPrimitiveType(categoryType);
|
36553 | categoryPrimitiveType === PrimitiveType.Null ? (categoryType = t | categoryType,
|
36554 | ExtendedType[categoryType] && (t = categoryType)) : categoryPrimitiveType === primitiveType && (t = categoryType);
|
36555 | }
|
36556 | }
|
36557 | return t;
|
36558 | }
|
36559 | function matchesExtendedTypeWithAnyPrimitive(a, b) {
|
36560 | return (a & PrimitiveTypeFlagsExcludedMask) === (b & PrimitiveTypeFlagsExcludedMask);
|
36561 | }
|
36562 | var EnumExtensions = jsCommon.EnumExtensions, ValueType = function() {
|
36563 | function ValueType(type, category, enumType) {
|
36564 | this.underlyingType = type, this.category = category, EnumExtensions.hasFlag(type, ExtendedType.Temporal) && (this.temporalType = new TemporalType(type)),
|
36565 | EnumExtensions.hasFlag(type, ExtendedType.Geography) && (this.geographyType = new GeographyType(type)),
|
36566 | EnumExtensions.hasFlag(type, ExtendedType.Miscellaneous) && (this.miscType = new MiscellaneousType(type)),
|
36567 | EnumExtensions.hasFlag(type, ExtendedType.Formatting) && (this.formattingType = new FormattingType(type)),
|
36568 | EnumExtensions.hasFlag(type, ExtendedType.Enumeration) && (this.enumType = enumType),
|
36569 | EnumExtensions.hasFlag(type, ExtendedType.Scripting) && (this.scriptingType = new ScriptType(type));
|
36570 | }
|
36571 | return ValueType.fromDescriptor = function(descriptor) {
|
36572 | if (descriptor = descriptor || {}, descriptor.text) return ValueType.fromExtendedType(ExtendedType.Text);
|
36573 | if (descriptor.integer) return ValueType.fromExtendedType(ExtendedType.Integer);
|
36574 | if (descriptor.numeric) return ValueType.fromExtendedType(ExtendedType.Double);
|
36575 | if (descriptor.bool) return ValueType.fromExtendedType(ExtendedType.Boolean);
|
36576 | if (descriptor.dateTime) return ValueType.fromExtendedType(ExtendedType.DateTime);
|
36577 | if (descriptor.duration) return ValueType.fromExtendedType(ExtendedType.Duration);
|
36578 | if (descriptor.binary) return ValueType.fromExtendedType(ExtendedType.Binary);
|
36579 | if (descriptor.none) return ValueType.fromExtendedType(ExtendedType.None);
|
36580 | if (descriptor.scripting && descriptor.scripting.source) return ValueType.fromExtendedType(ExtendedType.ScriptSource);
|
36581 | if (descriptor.enumeration) return ValueType.fromEnum(descriptor.enumeration);
|
36582 | if (descriptor.temporal) {
|
36583 | if (descriptor.temporal.year) return ValueType.fromExtendedType(ExtendedType.Year_Integer);
|
36584 | if (descriptor.temporal.month) return ValueType.fromExtendedType(ExtendedType.Month_Integer);
|
36585 | }
|
36586 | if (descriptor.geography) {
|
36587 | if (descriptor.geography.address) return ValueType.fromExtendedType(ExtendedType.Address);
|
36588 | if (descriptor.geography.city) return ValueType.fromExtendedType(ExtendedType.City);
|
36589 | if (descriptor.geography.continent) return ValueType.fromExtendedType(ExtendedType.Continent);
|
36590 | if (descriptor.geography.country) return ValueType.fromExtendedType(ExtendedType.Country);
|
36591 | if (descriptor.geography.county) return ValueType.fromExtendedType(ExtendedType.County);
|
36592 | if (descriptor.geography.region) return ValueType.fromExtendedType(ExtendedType.Region);
|
36593 | if (descriptor.geography.postalCode) return ValueType.fromExtendedType(ExtendedType.PostalCode_Text);
|
36594 | if (descriptor.geography.stateOrProvince) return ValueType.fromExtendedType(ExtendedType.StateOrProvince);
|
36595 | if (descriptor.geography.place) return ValueType.fromExtendedType(ExtendedType.Place);
|
36596 | if (descriptor.geography.latitude) return ValueType.fromExtendedType(ExtendedType.Latitude_Double);
|
36597 | if (descriptor.geography.longitude) return ValueType.fromExtendedType(ExtendedType.Longitude_Double);
|
36598 | }
|
36599 | if (descriptor.misc) {
|
36600 | if (descriptor.misc.image) return ValueType.fromExtendedType(ExtendedType.Image);
|
36601 | if (descriptor.misc.imageUrl) return ValueType.fromExtendedType(ExtendedType.ImageUrl);
|
36602 | if (descriptor.misc.webUrl) return ValueType.fromExtendedType(ExtendedType.WebUrl);
|
36603 | if (descriptor.misc.barcode) return ValueType.fromExtendedType(ExtendedType.Barcode_Text);
|
36604 | }
|
36605 | if (descriptor.formatting) {
|
36606 | if (descriptor.formatting.color) return ValueType.fromExtendedType(ExtendedType.Color);
|
36607 | if (descriptor.formatting.formatString) return ValueType.fromExtendedType(ExtendedType.FormatString);
|
36608 | if (descriptor.formatting.alignment) return ValueType.fromExtendedType(ExtendedType.Alignment);
|
36609 | if (descriptor.formatting.labelDisplayUnits) return ValueType.fromExtendedType(ExtendedType.LabelDisplayUnits);
|
36610 | if (descriptor.formatting.fontSize) return ValueType.fromExtendedType(ExtendedType.FontSize);
|
36611 | if (descriptor.formatting.labelDensity) return ValueType.fromExtendedType(ExtendedType.LabelDensity);
|
36612 | }
|
36613 | return descriptor.extendedType ? ValueType.fromExtendedType(descriptor.extendedType) : descriptor.operations && descriptor.operations.searchEnabled ? ValueType.fromExtendedType(ExtendedType.SearchEnabled) : ValueType.fromExtendedType(ExtendedType.Null);
|
36614 | }, ValueType.fromExtendedType = function(extendedType) {
|
36615 | extendedType = extendedType || ExtendedType.Null;
|
36616 | var primitiveType = getPrimitiveType(extendedType), category = getCategoryFromExtendedType(extendedType);
|
36617 | return ValueType.fromPrimitiveTypeAndCategory(primitiveType, category);
|
36618 | }, ValueType.fromPrimitiveTypeAndCategory = function(primitiveType, category) {
|
36619 | primitiveType = primitiveType || PrimitiveType.Null, category = category || null;
|
36620 | var id = primitiveType.toString();
|
36621 | return category && (id += "|" + category), ValueType.typeCache[id] || (ValueType.typeCache[id] = new ValueType(toExtendedType(primitiveType, category), category));
|
36622 | }, ValueType.fromEnum = function(enumType) {
|
36623 | return new ValueType(ExtendedType.Enumeration, null, enumType);
|
36624 | }, ValueType.isCompatibleTo = function(type, otherTypes) {
|
36625 | for (var valueType = ValueType.fromDescriptor(type), _i = 0, otherTypes_1 = otherTypes; _i < otherTypes_1.length; _i++) {
|
36626 | var otherType = otherTypes_1[_i], otherValueType = ValueType.fromDescriptor(otherType);
|
36627 | if (otherValueType.isCompatibleFrom(valueType)) return !0;
|
36628 | }
|
36629 | return !1;
|
36630 | }, ValueType.prototype.isCompatibleFrom = function(other) {
|
36631 | var otherPrimitiveType = other.primitiveType;
|
36632 | return this === other || this.primitiveType === otherPrimitiveType || otherPrimitiveType === PrimitiveType.Null;
|
36633 | }, ValueType.prototype.equals = function(other) {
|
36634 | return _.isEqual(this, other);
|
36635 | }, Object.defineProperty(ValueType.prototype, "primitiveType", {
|
36636 | get: function() {
|
36637 | return getPrimitiveType(this.underlyingType);
|
36638 | },
|
36639 | enumerable: !0,
|
36640 | configurable: !0
|
36641 | }), Object.defineProperty(ValueType.prototype, "extendedType", {
|
36642 | get: function() {
|
36643 | return this.underlyingType;
|
36644 | },
|
36645 | enumerable: !0,
|
36646 | configurable: !0
|
36647 | }), Object.defineProperty(ValueType.prototype, "categoryString", {
|
36648 | get: function() {
|
36649 | return this.category;
|
36650 | },
|
36651 | enumerable: !0,
|
36652 | configurable: !0
|
36653 | }), Object.defineProperty(ValueType.prototype, "text", {
|
36654 | get: function() {
|
36655 | return this.primitiveType === PrimitiveType.Text;
|
36656 | },
|
36657 | enumerable: !0,
|
36658 | configurable: !0
|
36659 | }), Object.defineProperty(ValueType.prototype, "numeric", {
|
36660 | get: function() {
|
36661 | return EnumExtensions.hasFlag(this.underlyingType, ExtendedType.Numeric);
|
36662 | },
|
36663 | enumerable: !0,
|
36664 | configurable: !0
|
36665 | }), Object.defineProperty(ValueType.prototype, "integer", {
|
36666 | get: function() {
|
36667 | return this.primitiveType === PrimitiveType.Integer;
|
36668 | },
|
36669 | enumerable: !0,
|
36670 | configurable: !0
|
36671 | }), Object.defineProperty(ValueType.prototype, "bool", {
|
36672 | get: function() {
|
36673 | return this.primitiveType === PrimitiveType.Boolean;
|
36674 | },
|
36675 | enumerable: !0,
|
36676 | configurable: !0
|
36677 | }), Object.defineProperty(ValueType.prototype, "dateTime", {
|
36678 | get: function() {
|
36679 | return this.primitiveType === PrimitiveType.DateTime || this.primitiveType === PrimitiveType.Date || this.primitiveType === PrimitiveType.Time;
|
36680 | },
|
36681 | enumerable: !0,
|
36682 | configurable: !0
|
36683 | }), Object.defineProperty(ValueType.prototype, "duration", {
|
36684 | get: function() {
|
36685 | return this.primitiveType === PrimitiveType.Duration;
|
36686 | },
|
36687 | enumerable: !0,
|
36688 | configurable: !0
|
36689 | }), Object.defineProperty(ValueType.prototype, "binary", {
|
36690 | get: function() {
|
36691 | return this.primitiveType === PrimitiveType.Binary;
|
36692 | },
|
36693 | enumerable: !0,
|
36694 | configurable: !0
|
36695 | }), Object.defineProperty(ValueType.prototype, "none", {
|
36696 | get: function() {
|
36697 | return this.primitiveType === PrimitiveType.None;
|
36698 | },
|
36699 | enumerable: !0,
|
36700 | configurable: !0
|
36701 | }), Object.defineProperty(ValueType.prototype, "temporal", {
|
36702 | get: function() {
|
36703 | return this.temporalType;
|
36704 | },
|
36705 | enumerable: !0,
|
36706 | configurable: !0
|
36707 | }), Object.defineProperty(ValueType.prototype, "geography", {
|
36708 | get: function() {
|
36709 | return this.geographyType;
|
36710 | },
|
36711 | enumerable: !0,
|
36712 | configurable: !0
|
36713 | }), Object.defineProperty(ValueType.prototype, "misc", {
|
36714 | get: function() {
|
36715 | return this.miscType;
|
36716 | },
|
36717 | enumerable: !0,
|
36718 | configurable: !0
|
36719 | }), Object.defineProperty(ValueType.prototype, "formatting", {
|
36720 | get: function() {
|
36721 | return this.formattingType;
|
36722 | },
|
36723 | enumerable: !0,
|
36724 | configurable: !0
|
36725 | }), Object.defineProperty(ValueType.prototype, "enum", {
|
36726 | get: function() {
|
36727 | return this.enumType;
|
36728 | },
|
36729 | enumerable: !0,
|
36730 | configurable: !0
|
36731 | }), Object.defineProperty(ValueType.prototype, "scripting", {
|
36732 | get: function() {
|
36733 | return this.scriptingType;
|
36734 | },
|
36735 | enumerable: !0,
|
36736 | configurable: !0
|
36737 | }), ValueType.typeCache = {}, ValueType;
|
36738 | }();
|
36739 | powerbi.ValueType = ValueType;
|
36740 | var ScriptType = function() {
|
36741 | function ScriptType(type) {
|
36742 | this.underlyingType = type;
|
36743 | }
|
36744 | return Object.defineProperty(ScriptType.prototype, "source", {
|
36745 | get: function() {
|
36746 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.ScriptSource);
|
36747 | },
|
36748 | enumerable: !0,
|
36749 | configurable: !0
|
36750 | }), ScriptType;
|
36751 | }();
|
36752 | powerbi.ScriptType = ScriptType;
|
36753 | var TemporalType = function() {
|
36754 | function TemporalType(type) {
|
36755 | this.underlyingType = type;
|
36756 | }
|
36757 | return Object.defineProperty(TemporalType.prototype, "year", {
|
36758 | get: function() {
|
36759 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.Year);
|
36760 | },
|
36761 | enumerable: !0,
|
36762 | configurable: !0
|
36763 | }), Object.defineProperty(TemporalType.prototype, "month", {
|
36764 | get: function() {
|
36765 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.Month);
|
36766 | },
|
36767 | enumerable: !0,
|
36768 | configurable: !0
|
36769 | }), TemporalType;
|
36770 | }();
|
36771 | powerbi.TemporalType = TemporalType;
|
36772 | var GeographyType = function() {
|
36773 | function GeographyType(type) {
|
36774 | this.underlyingType = type;
|
36775 | }
|
36776 | return Object.defineProperty(GeographyType.prototype, "address", {
|
36777 | get: function() {
|
36778 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.Address);
|
36779 | },
|
36780 | enumerable: !0,
|
36781 | configurable: !0
|
36782 | }), Object.defineProperty(GeographyType.prototype, "city", {
|
36783 | get: function() {
|
36784 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.City);
|
36785 | },
|
36786 | enumerable: !0,
|
36787 | configurable: !0
|
36788 | }), Object.defineProperty(GeographyType.prototype, "continent", {
|
36789 | get: function() {
|
36790 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.Continent);
|
36791 | },
|
36792 | enumerable: !0,
|
36793 | configurable: !0
|
36794 | }), Object.defineProperty(GeographyType.prototype, "country", {
|
36795 | get: function() {
|
36796 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.Country);
|
36797 | },
|
36798 | enumerable: !0,
|
36799 | configurable: !0
|
36800 | }), Object.defineProperty(GeographyType.prototype, "county", {
|
36801 | get: function() {
|
36802 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.County);
|
36803 | },
|
36804 | enumerable: !0,
|
36805 | configurable: !0
|
36806 | }), Object.defineProperty(GeographyType.prototype, "region", {
|
36807 | get: function() {
|
36808 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.Region);
|
36809 | },
|
36810 | enumerable: !0,
|
36811 | configurable: !0
|
36812 | }), Object.defineProperty(GeographyType.prototype, "postalCode", {
|
36813 | get: function() {
|
36814 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.PostalCode);
|
36815 | },
|
36816 | enumerable: !0,
|
36817 | configurable: !0
|
36818 | }), Object.defineProperty(GeographyType.prototype, "stateOrProvince", {
|
36819 | get: function() {
|
36820 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.StateOrProvince);
|
36821 | },
|
36822 | enumerable: !0,
|
36823 | configurable: !0
|
36824 | }), Object.defineProperty(GeographyType.prototype, "place", {
|
36825 | get: function() {
|
36826 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.Place);
|
36827 | },
|
36828 | enumerable: !0,
|
36829 | configurable: !0
|
36830 | }), Object.defineProperty(GeographyType.prototype, "latitude", {
|
36831 | get: function() {
|
36832 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.Latitude);
|
36833 | },
|
36834 | enumerable: !0,
|
36835 | configurable: !0
|
36836 | }), Object.defineProperty(GeographyType.prototype, "longitude", {
|
36837 | get: function() {
|
36838 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.Longitude);
|
36839 | },
|
36840 | enumerable: !0,
|
36841 | configurable: !0
|
36842 | }), GeographyType;
|
36843 | }();
|
36844 | powerbi.GeographyType = GeographyType;
|
36845 | var MiscellaneousType = function() {
|
36846 | function MiscellaneousType(type) {
|
36847 | this.underlyingType = type;
|
36848 | }
|
36849 | return Object.defineProperty(MiscellaneousType.prototype, "image", {
|
36850 | get: function() {
|
36851 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.Image);
|
36852 | },
|
36853 | enumerable: !0,
|
36854 | configurable: !0
|
36855 | }), Object.defineProperty(MiscellaneousType.prototype, "imageUrl", {
|
36856 | get: function() {
|
36857 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.ImageUrl);
|
36858 | },
|
36859 | enumerable: !0,
|
36860 | configurable: !0
|
36861 | }), Object.defineProperty(MiscellaneousType.prototype, "webUrl", {
|
36862 | get: function() {
|
36863 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.WebUrl);
|
36864 | },
|
36865 | enumerable: !0,
|
36866 | configurable: !0
|
36867 | }), Object.defineProperty(MiscellaneousType.prototype, "barcode", {
|
36868 | get: function() {
|
36869 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.Barcode);
|
36870 | },
|
36871 | enumerable: !0,
|
36872 | configurable: !0
|
36873 | }), MiscellaneousType;
|
36874 | }();
|
36875 | powerbi.MiscellaneousType = MiscellaneousType;
|
36876 | var FormattingType = function() {
|
36877 | function FormattingType(type) {
|
36878 | this.underlyingType = type;
|
36879 | }
|
36880 | return Object.defineProperty(FormattingType.prototype, "color", {
|
36881 | get: function() {
|
36882 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.Color);
|
36883 | },
|
36884 | enumerable: !0,
|
36885 | configurable: !0
|
36886 | }), Object.defineProperty(FormattingType.prototype, "formatString", {
|
36887 | get: function() {
|
36888 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.FormatString);
|
36889 | },
|
36890 | enumerable: !0,
|
36891 | configurable: !0
|
36892 | }), Object.defineProperty(FormattingType.prototype, "alignment", {
|
36893 | get: function() {
|
36894 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.Alignment);
|
36895 | },
|
36896 | enumerable: !0,
|
36897 | configurable: !0
|
36898 | }), Object.defineProperty(FormattingType.prototype, "labelDisplayUnits", {
|
36899 | get: function() {
|
36900 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.LabelDisplayUnits);
|
36901 | },
|
36902 | enumerable: !0,
|
36903 | configurable: !0
|
36904 | }), Object.defineProperty(FormattingType.prototype, "fontSize", {
|
36905 | get: function() {
|
36906 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.FontSize);
|
36907 | },
|
36908 | enumerable: !0,
|
36909 | configurable: !0
|
36910 | }), Object.defineProperty(FormattingType.prototype, "labelDensity", {
|
36911 | get: function() {
|
36912 | return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, ExtendedType.LabelDensity);
|
36913 | },
|
36914 | enumerable: !0,
|
36915 | configurable: !0
|
36916 | }), FormattingType;
|
36917 | }();
|
36918 | powerbi.FormattingType = FormattingType, function(PrimitiveType) {
|
36919 | PrimitiveType[PrimitiveType.Null = 0] = "Null", PrimitiveType[PrimitiveType.Text = 1] = "Text",
|
36920 | PrimitiveType[PrimitiveType.Decimal = 2] = "Decimal", PrimitiveType[PrimitiveType.Double = 3] = "Double",
|
36921 | PrimitiveType[PrimitiveType.Integer = 4] = "Integer", PrimitiveType[PrimitiveType.Boolean = 5] = "Boolean",
|
36922 | PrimitiveType[PrimitiveType.Date = 6] = "Date", PrimitiveType[PrimitiveType.DateTime = 7] = "DateTime",
|
36923 | PrimitiveType[PrimitiveType.DateTimeZone = 8] = "DateTimeZone", PrimitiveType[PrimitiveType.Time = 9] = "Time",
|
36924 | PrimitiveType[PrimitiveType.Duration = 10] = "Duration", PrimitiveType[PrimitiveType.Binary = 11] = "Binary",
|
36925 | PrimitiveType[PrimitiveType.None = 12] = "None";
|
36926 | }(powerbi.PrimitiveType || (powerbi.PrimitiveType = {}));
|
36927 | var PrimitiveType = powerbi.PrimitiveType;
|
36928 | !function(ExtendedType) {
|
36929 | ExtendedType[ExtendedType.Numeric = 256] = "Numeric", ExtendedType[ExtendedType.Temporal = 512] = "Temporal",
|
36930 | ExtendedType[ExtendedType.Geography = 1024] = "Geography", ExtendedType[ExtendedType.Miscellaneous = 2048] = "Miscellaneous",
|
36931 | ExtendedType[ExtendedType.Formatting = 4096] = "Formatting", ExtendedType[ExtendedType.Scripting = 8192] = "Scripting",
|
36932 | ExtendedType[ExtendedType.Null = 0] = "Null", ExtendedType[ExtendedType.Text = 1] = "Text",
|
36933 | ExtendedType[ExtendedType.Decimal = 258] = "Decimal", ExtendedType[ExtendedType.Double = 259] = "Double",
|
36934 | ExtendedType[ExtendedType.Integer = 260] = "Integer", ExtendedType[ExtendedType.Boolean = 5] = "Boolean",
|
36935 | ExtendedType[ExtendedType.Date = 518] = "Date", ExtendedType[ExtendedType.DateTime = 519] = "DateTime",
|
36936 | ExtendedType[ExtendedType.DateTimeZone = 520] = "DateTimeZone", ExtendedType[ExtendedType.Time = 521] = "Time",
|
36937 | ExtendedType[ExtendedType.Duration = 10] = "Duration", ExtendedType[ExtendedType.Binary = 11] = "Binary",
|
36938 | ExtendedType[ExtendedType.None = 12] = "None", ExtendedType[ExtendedType.Year = 66048] = "Year",
|
36939 | ExtendedType[ExtendedType.Year_Text = 66049] = "Year_Text", ExtendedType[ExtendedType.Year_Integer = 66308] = "Year_Integer",
|
36940 | ExtendedType[ExtendedType.Year_Date = 66054] = "Year_Date", ExtendedType[ExtendedType.Year_DateTime = 66055] = "Year_DateTime",
|
36941 | ExtendedType[ExtendedType.Month = 131584] = "Month", ExtendedType[ExtendedType.Month_Text = 131585] = "Month_Text",
|
36942 | ExtendedType[ExtendedType.Month_Integer = 131844] = "Month_Integer", ExtendedType[ExtendedType.Month_Date = 131590] = "Month_Date",
|
36943 | ExtendedType[ExtendedType.Month_DateTime = 131591] = "Month_DateTime", ExtendedType[ExtendedType.Address = 6554625] = "Address",
|
36944 | ExtendedType[ExtendedType.City = 6620161] = "City", ExtendedType[ExtendedType.Continent = 6685697] = "Continent",
|
36945 | ExtendedType[ExtendedType.Country = 6751233] = "Country", ExtendedType[ExtendedType.County = 6816769] = "County",
|
36946 | ExtendedType[ExtendedType.Region = 6882305] = "Region", ExtendedType[ExtendedType.PostalCode = 6947840] = "PostalCode",
|
36947 | ExtendedType[ExtendedType.PostalCode_Text = 6947841] = "PostalCode_Text", ExtendedType[ExtendedType.PostalCode_Integer = 6948100] = "PostalCode_Integer",
|
36948 | ExtendedType[ExtendedType.StateOrProvince = 7013377] = "StateOrProvince", ExtendedType[ExtendedType.Place = 7078913] = "Place",
|
36949 | ExtendedType[ExtendedType.Latitude = 7144448] = "Latitude", ExtendedType[ExtendedType.Latitude_Decimal = 7144706] = "Latitude_Decimal",
|
36950 | ExtendedType[ExtendedType.Latitude_Double = 7144707] = "Latitude_Double", ExtendedType[ExtendedType.Longitude = 7209984] = "Longitude",
|
36951 | ExtendedType[ExtendedType.Longitude_Decimal = 7210242] = "Longitude_Decimal", ExtendedType[ExtendedType.Longitude_Double = 7210243] = "Longitude_Double",
|
36952 | ExtendedType[ExtendedType.Image = 13109259] = "Image", ExtendedType[ExtendedType.ImageUrl = 13174785] = "ImageUrl",
|
36953 | ExtendedType[ExtendedType.WebUrl = 13240321] = "WebUrl", ExtendedType[ExtendedType.Barcode = 13305856] = "Barcode",
|
36954 | ExtendedType[ExtendedType.Barcode_Text = 13305857] = "Barcode_Text", ExtendedType[ExtendedType.Barcode_Integer = 13306116] = "Barcode_Integer",
|
36955 | ExtendedType[ExtendedType.Color = 19664897] = "Color", ExtendedType[ExtendedType.FormatString = 19730433] = "FormatString",
|
36956 | ExtendedType[ExtendedType.Alignment = 20058113] = "Alignment", ExtendedType[ExtendedType.LabelDisplayUnits = 20123649] = "LabelDisplayUnits",
|
36957 | ExtendedType[ExtendedType.FontSize = 20189443] = "FontSize", ExtendedType[ExtendedType.LabelDensity = 20254979] = "LabelDensity",
|
36958 | ExtendedType[ExtendedType.Enumeration = 26214401] = "Enumeration", ExtendedType[ExtendedType.ScriptSource = 32776193] = "ScriptSource",
|
36959 | ExtendedType[ExtendedType.SearchEnabled = 65541] = "SearchEnabled";
|
36960 | }(powerbi.ExtendedType || (powerbi.ExtendedType = {}));
|
36961 | var ExtendedType = powerbi.ExtendedType, PrimitiveTypeMask = 255, PrimitiveTypeWithFlagsMask = 65535, PrimitiveTypeFlagsExcludedMask = 4294901760;
|
36962 | }(powerbi || (powerbi = {}));
|
36963 | }, function(module, exports) {
|
36964 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
36965 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
36966 | !function(powerbi) {
|
36967 | var data;
|
36968 | !function(data) {
|
36969 | !function(DataShapeBindingLimitType) {
|
36970 | DataShapeBindingLimitType[DataShapeBindingLimitType.Top = 0] = "Top", DataShapeBindingLimitType[DataShapeBindingLimitType.First = 1] = "First",
|
36971 | DataShapeBindingLimitType[DataShapeBindingLimitType.Last = 2] = "Last", DataShapeBindingLimitType[DataShapeBindingLimitType.Sample = 3] = "Sample",
|
36972 | DataShapeBindingLimitType[DataShapeBindingLimitType.Bottom = 4] = "Bottom";
|
36973 | }(data.DataShapeBindingLimitType || (data.DataShapeBindingLimitType = {}));
|
36974 | data.DataShapeBindingLimitType;
|
36975 | !function(SubtotalType) {
|
36976 | SubtotalType[SubtotalType.None = 0] = "None", SubtotalType[SubtotalType.Before = 1] = "Before",
|
36977 | SubtotalType[SubtotalType.After = 2] = "After";
|
36978 | }(data.SubtotalType || (data.SubtotalType = {}));
|
36979 | data.SubtotalType;
|
36980 | }(data = powerbi.data || (powerbi.data = {}));
|
36981 | }(powerbi || (powerbi = {}));
|
36982 | }, function(module, exports) {
|
36983 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
36984 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
36985 | !function(powerbi) {
|
36986 | var data;
|
36987 | !function(data) {
|
36988 | var DataShapeBindingDataReduction;
|
36989 | !function(DataShapeBindingDataReduction) {
|
36990 | function createFrom(reduction) {
|
36991 | if (reduction) {
|
36992 | var result;
|
36993 | return reduction.top && (result = {
|
36994 | Top: {}
|
36995 | }, reduction.top.count && (result.Top.Count = reduction.top.count)), reduction.bottom && (result = {
|
36996 | Bottom: {}
|
36997 | }, reduction.bottom.count && (result.Bottom.Count = reduction.bottom.count)), reduction.sample && (result = {
|
36998 | Sample: {}
|
36999 | }, reduction.sample.count && (result.Sample.Count = reduction.sample.count)), reduction.window && (result = {
|
37000 | Window: {}
|
37001 | }, reduction.window.count && (result.Window.Count = reduction.window.count)), result;
|
37002 | }
|
37003 | }
|
37004 | DataShapeBindingDataReduction.createFrom = createFrom;
|
37005 | }(DataShapeBindingDataReduction = data.DataShapeBindingDataReduction || (data.DataShapeBindingDataReduction = {}));
|
37006 | }(data = powerbi.data || (powerbi.data = {}));
|
37007 | }(powerbi || (powerbi = {}));
|
37008 | }, function(module, exports) {
|
37009 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
37010 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
37011 | !function(powerbi) {
|
37012 | var data;
|
37013 | !function(data) {
|
37014 | var FederatedConceptualSchema = function() {
|
37015 | function FederatedConceptualSchema(options) {
|
37016 | this.schemas = options.schemas, options.links && (this.links = options.links);
|
37017 | }
|
37018 | return FederatedConceptualSchema.prototype.schema = function(name) {
|
37019 | return this.schemas[name];
|
37020 | }, FederatedConceptualSchema;
|
37021 | }();
|
37022 | data.FederatedConceptualSchema = FederatedConceptualSchema;
|
37023 | }(data = powerbi.data || (powerbi.data = {}));
|
37024 | }(powerbi || (powerbi = {}));
|
37025 | }, function(module, exports) {
|
37026 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
37027 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
37028 | !function(powerbi) {
|
37029 | var data;
|
37030 | !function(data_1) {
|
37031 | var Selector;
|
37032 | !function(Selector) {
|
37033 | function filterFromSelector(selectors, isNot) {
|
37034 | if (!_.isEmpty(selectors)) {
|
37035 | for (var exprs = [], i = 0, ilen = selectors.length; ilen > i; i++) {
|
37036 | var identity = selectors[i], data_2 = identity.data, exprToAdd = void 0;
|
37037 | if (data_2 && data_2.length) for (var j = 0, jlen = data_2.length; jlen > j; j++) exprToAdd = data_1.SQExprBuilder.and(exprToAdd, identity.data[j].expr);
|
37038 | exprToAdd && exprs.push(exprToAdd);
|
37039 | }
|
37040 | return _.isEmpty(exprs) ? void 0 : powerbi.DataViewScopeIdentity.filterFromExprs(exprs, isNot);
|
37041 | }
|
37042 | }
|
37043 | function matchesData(selector, identities) {
|
37044 | var selectorData = selector.data;
|
37045 | if (selectorData.length !== identities.length) return !1;
|
37046 | for (var i = 0, len = selectorData.length; len > i; i++) {
|
37047 | var dataItem = selector.data[i], selectorDataItem = dataItem;
|
37048 | if (selectorDataItem.expr) {
|
37049 | if (!powerbi.DataViewScopeIdentity.equals(selectorDataItem, identities[i])) return !1;
|
37050 | } else if (!data_1.DataViewScopeWildcard.matches(dataItem, identities[i])) return !1;
|
37051 | }
|
37052 | return !0;
|
37053 | }
|
37054 | function matchesKeys(selector, keysList) {
|
37055 | var selectorData = selector.data, selectorDataLength = selectorData.length;
|
37056 | if (selectorDataLength !== keysList.length) return !1;
|
37057 | for (var i = 0; selectorDataLength > i; i++) {
|
37058 | var selectorDataItem = selector.data[i], selectorDataExprs = void 0;
|
37059 | if (selectorDataItem.expr) selectorDataExprs = data_1.ScopeIdentityExtractor.getKeys(selectorDataItem.expr); else {
|
37060 | if (!selectorDataItem.exprs) return !1;
|
37061 | selectorDataExprs = selectorDataItem.exprs;
|
37062 | }
|
37063 | if (selectorDataExprs && !data_1.SQExprUtils.sequenceEqual(keysList[i], selectorDataExprs)) return !1;
|
37064 | }
|
37065 | return !0;
|
37066 | }
|
37067 | function equals(x, y) {
|
37068 | return x = x || null, y = y || null, x === y ? !0 : !x != !y ? !1 : x.id !== y.id ? !1 : x.metadata !== y.metadata ? !1 : !!equalsDataArray(x.data, y.data);
|
37069 | }
|
37070 | function equalsDataArray(x, y) {
|
37071 | if (x = x || null, y = y || null, x === y) return !0;
|
37072 | if (!x != !y) return !1;
|
37073 | if (x.length !== y.length) return !1;
|
37074 | for (var i = 0, len = x.length; len > i; i++) if (!equalsData(x[i], y[i])) return !1;
|
37075 | return !0;
|
37076 | }
|
37077 | function equalsData(x, y) {
|
37078 | var selector1 = x, selector2 = y;
|
37079 | return selector1.expr && selector2.expr ? powerbi.DataViewScopeIdentity.equals(selector1, selector2) : selector1.exprs && selector2.exprs ? data_1.DataViewScopeWildcard.equals(selector1, selector2) : selector1.roles && selector2.roles ? data_1.DataViewRoleWildcard.equals(selector1, selector2) : !1;
|
37080 | }
|
37081 | function getKey(selector) {
|
37082 | var toStringify = {};
|
37083 | if (selector.data) {
|
37084 | for (var data_3 = [], i = 0, ilen = selector.data.length; ilen > i; i++) data_3.push(selector.data[i].key);
|
37085 | toStringify.data = data_3;
|
37086 | }
|
37087 | return selector.metadata && (toStringify.metadata = selector.metadata), selector.id && (toStringify.id = selector.id),
|
37088 | JSON.stringify(toStringify);
|
37089 | }
|
37090 | function containsWildcard(selector) {
|
37091 | var dataItems = selector.data;
|
37092 | if (!dataItems) return !1;
|
37093 | for (var _i = 0, dataItems_1 = dataItems; _i < dataItems_1.length; _i++) {
|
37094 | var dataItem = dataItems_1[_i], wildCard = dataItem;
|
37095 | if (wildCard.exprs || wildCard.roles) return !0;
|
37096 | }
|
37097 | return !1;
|
37098 | }
|
37099 | function hasRoleWildcard(selector) {
|
37100 | var dataItems = selector.data;
|
37101 | if (_.isEmpty(dataItems)) return !1;
|
37102 | for (var _i = 0, dataItems_2 = dataItems; _i < dataItems_2.length; _i++) {
|
37103 | var dataItem = dataItems_2[_i];
|
37104 | if (isRoleWildcard(dataItem)) return !0;
|
37105 | }
|
37106 | return !1;
|
37107 | }
|
37108 | function isRoleWildcard(dataItem) {
|
37109 | return !_.isEmpty(dataItem.roles);
|
37110 | }
|
37111 | Selector.filterFromSelector = filterFromSelector, Selector.matchesData = matchesData,
|
37112 | Selector.matchesKeys = matchesKeys, Selector.equals = equals, Selector.getKey = getKey,
|
37113 | Selector.containsWildcard = containsWildcard, Selector.hasRoleWildcard = hasRoleWildcard,
|
37114 | Selector.isRoleWildcard = isRoleWildcard;
|
37115 | }(Selector = data_1.Selector || (data_1.Selector = {}));
|
37116 | }(data = powerbi.data || (powerbi.data = {}));
|
37117 | }(powerbi || (powerbi = {}));
|
37118 | }, function(module, exports) {
|
37119 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
37120 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
37121 | !function(powerbi) {
|
37122 | var data;
|
37123 | !function(data) {
|
37124 | function getArithmeticOperatorName(arithmeticOperatorKind) {
|
37125 | switch (arithmeticOperatorKind) {
|
37126 | case 0:
|
37127 | return "Add";
|
37128 |
|
37129 | case 1:
|
37130 | return "Subtract";
|
37131 |
|
37132 | case 2:
|
37133 | return "Multiply";
|
37134 |
|
37135 | case 3:
|
37136 | return "Divide";
|
37137 | }
|
37138 | throw new Error("Unexpected ArithmeticOperatorKind: " + arithmeticOperatorKind);
|
37139 | }
|
37140 | !function(EntitySourceType) {
|
37141 | EntitySourceType[EntitySourceType.Table = 0] = "Table", EntitySourceType[EntitySourceType.Pod = 1] = "Pod",
|
37142 | EntitySourceType[EntitySourceType.Expression = 2] = "Expression";
|
37143 | }(data.EntitySourceType || (data.EntitySourceType = {}));
|
37144 | data.EntitySourceType;
|
37145 | data.getArithmeticOperatorName = getArithmeticOperatorName, function(TimeUnit) {
|
37146 | TimeUnit[TimeUnit.Day = 0] = "Day", TimeUnit[TimeUnit.Week = 1] = "Week", TimeUnit[TimeUnit.Month = 2] = "Month",
|
37147 | TimeUnit[TimeUnit.Year = 3] = "Year", TimeUnit[TimeUnit.Decade = 4] = "Decade",
|
37148 | TimeUnit[TimeUnit.Second = 5] = "Second", TimeUnit[TimeUnit.Minute = 6] = "Minute",
|
37149 | TimeUnit[TimeUnit.Hour = 7] = "Hour";
|
37150 | }(data.TimeUnit || (data.TimeUnit = {}));
|
37151 | data.TimeUnit;
|
37152 | !function(QueryAggregateFunction) {
|
37153 | QueryAggregateFunction[QueryAggregateFunction.Sum = 0] = "Sum", QueryAggregateFunction[QueryAggregateFunction.Avg = 1] = "Avg",
|
37154 | QueryAggregateFunction[QueryAggregateFunction.Count = 2] = "Count", QueryAggregateFunction[QueryAggregateFunction.Min = 3] = "Min",
|
37155 | QueryAggregateFunction[QueryAggregateFunction.Max = 4] = "Max", QueryAggregateFunction[QueryAggregateFunction.CountNonNull = 5] = "CountNonNull",
|
37156 | QueryAggregateFunction[QueryAggregateFunction.Median = 6] = "Median", QueryAggregateFunction[QueryAggregateFunction.StandardDeviation = 7] = "StandardDeviation",
|
37157 | QueryAggregateFunction[QueryAggregateFunction.Variance = 8] = "Variance";
|
37158 | }(data.QueryAggregateFunction || (data.QueryAggregateFunction = {}));
|
37159 | data.QueryAggregateFunction;
|
37160 | !function(QueryComparisonKind) {
|
37161 | QueryComparisonKind[QueryComparisonKind.Equal = 0] = "Equal", QueryComparisonKind[QueryComparisonKind.GreaterThan = 1] = "GreaterThan",
|
37162 | QueryComparisonKind[QueryComparisonKind.GreaterThanOrEqual = 2] = "GreaterThanOrEqual",
|
37163 | QueryComparisonKind[QueryComparisonKind.LessThan = 3] = "LessThan", QueryComparisonKind[QueryComparisonKind.LessThanOrEqual = 4] = "LessThanOrEqual";
|
37164 | }(data.QueryComparisonKind || (data.QueryComparisonKind = {}));
|
37165 | data.QueryComparisonKind;
|
37166 | !function(SemanticType) {
|
37167 | SemanticType[SemanticType.None = 0] = "None", SemanticType[SemanticType.Number = 1] = "Number",
|
37168 | SemanticType[SemanticType.Integer = 3] = "Integer", SemanticType[SemanticType.DateTime = 4] = "DateTime",
|
37169 | SemanticType[SemanticType.Time = 8] = "Time", SemanticType[SemanticType.Date = 20] = "Date",
|
37170 | SemanticType[SemanticType.Month = 35] = "Month", SemanticType[SemanticType.Year = 67] = "Year",
|
37171 | SemanticType[SemanticType.YearAndMonth = 128] = "YearAndMonth", SemanticType[SemanticType.MonthAndDay = 256] = "MonthAndDay",
|
37172 | SemanticType[SemanticType.Decade = 515] = "Decade", SemanticType[SemanticType.YearAndWeek = 1024] = "YearAndWeek",
|
37173 | SemanticType[SemanticType.String = 2048] = "String", SemanticType[SemanticType.Boolean = 4096] = "Boolean",
|
37174 | SemanticType[SemanticType.Table = 8192] = "Table", SemanticType[SemanticType.Range = 16384] = "Range";
|
37175 | }(data.SemanticType || (data.SemanticType = {}));
|
37176 | data.SemanticType;
|
37177 | !function(FilterKind) {
|
37178 | FilterKind[FilterKind.Default = 0] = "Default", FilterKind[FilterKind.Period = 1] = "Period";
|
37179 | }(data.FilterKind || (data.FilterKind = {}));
|
37180 | data.FilterKind;
|
37181 | }(data = powerbi.data || (powerbi.data = {}));
|
37182 | }(powerbi || (powerbi = {}));
|
37183 | }, function(module, exports) {
|
37184 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
37185 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
37186 | !function(powerbi) {
|
37187 | var data;
|
37188 | !function(data) {
|
37189 | var QueryProjectionCollection = function() {
|
37190 | function QueryProjectionCollection(items, activeProjectionRefs, showAll) {
|
37191 | this.items = items, this._activeProjectionRefs = activeProjectionRefs, this._showAll = showAll;
|
37192 | }
|
37193 | return QueryProjectionCollection.prototype.all = function() {
|
37194 | return this.items;
|
37195 | }, Object.defineProperty(QueryProjectionCollection.prototype, "activeProjectionRefs", {
|
37196 | get: function() {
|
37197 | return this._activeProjectionRefs;
|
37198 | },
|
37199 | set: function(queryReferences) {
|
37200 | if (!_.isEmpty(queryReferences)) {
|
37201 | for (var queryRefs = this.items.map(function(val) {
|
37202 | return val.queryRef;
|
37203 | }), _i = 0, queryReferences_1 = queryReferences; _i < queryReferences_1.length; _i++) {
|
37204 | var queryReference = queryReferences_1[_i];
|
37205 | if (!_.contains(queryRefs, queryReference)) return;
|
37206 | }
|
37207 | this._activeProjectionRefs = queryReferences;
|
37208 | }
|
37209 | },
|
37210 | enumerable: !0,
|
37211 | configurable: !0
|
37212 | }), Object.defineProperty(QueryProjectionCollection.prototype, "showAll", {
|
37213 | get: function() {
|
37214 | return this._showAll;
|
37215 | },
|
37216 | set: function(value) {
|
37217 | this._showAll = value;
|
37218 | },
|
37219 | enumerable: !0,
|
37220 | configurable: !0
|
37221 | }), QueryProjectionCollection.prototype.addActiveQueryReference = function(queryRef) {
|
37222 | this._activeProjectionRefs ? this._activeProjectionRefs.push(queryRef) : this._activeProjectionRefs = [ queryRef ];
|
37223 | }, QueryProjectionCollection.prototype.getLastActiveQueryReference = function() {
|
37224 | return _.isEmpty(this._activeProjectionRefs) ? void 0 : this._activeProjectionRefs[this._activeProjectionRefs.length - 1];
|
37225 | }, QueryProjectionCollection.prototype.replaceQueryRef = function(oldQueryRef, newQueryRef) {
|
37226 | for (var _i = 0, _a = this.items; _i < _a.length; _i++) {
|
37227 | var item = _a[_i];
|
37228 | item.queryRef === oldQueryRef && (item.queryRef = newQueryRef);
|
37229 | }
|
37230 | }, QueryProjectionCollection.prototype.clone = function() {
|
37231 | return new QueryProjectionCollection(_.cloneDeep(this.items), _.clone(this._activeProjectionRefs), this._showAll);
|
37232 | }, QueryProjectionCollection;
|
37233 | }();
|
37234 | data.QueryProjectionCollection = QueryProjectionCollection;
|
37235 | var QueryProjectionsByRole;
|
37236 | !function(QueryProjectionsByRole) {
|
37237 | function clone(roles) {
|
37238 | if (!roles) return roles;
|
37239 | var clonedRoles = {};
|
37240 | for (var roleName in roles) clonedRoles[roleName] = roles[roleName].clone();
|
37241 | return clonedRoles;
|
37242 | }
|
37243 | function getRole(roles, name) {
|
37244 | return roles ? roles[name] : void 0;
|
37245 | }
|
37246 | QueryProjectionsByRole.clone = clone, QueryProjectionsByRole.getRole = getRole;
|
37247 | }(QueryProjectionsByRole = data.QueryProjectionsByRole || (data.QueryProjectionsByRole = {}));
|
37248 | }(data = powerbi.data || (powerbi.data = {}));
|
37249 | }(powerbi || (powerbi = {}));
|
37250 | }, function(module, exports) {
|
37251 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
37252 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
37253 | !function(powerbi) {
|
37254 | !function(DisplayUnitSystemType) {
|
37255 | DisplayUnitSystemType[DisplayUnitSystemType.Default = 0] = "Default", DisplayUnitSystemType[DisplayUnitSystemType.Verbose = 1] = "Verbose",
|
37256 | DisplayUnitSystemType[DisplayUnitSystemType.WholeUnits = 2] = "WholeUnits", DisplayUnitSystemType[DisplayUnitSystemType.DataLabels = 3] = "DataLabels";
|
37257 | }(powerbi.DisplayUnitSystemType || (powerbi.DisplayUnitSystemType = {}));
|
37258 | powerbi.DisplayUnitSystemType;
|
37259 | }(powerbi || (powerbi = {}));
|
37260 | }, function(module, exports) {
|
37261 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
37262 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
37263 | !function(powerbi) {
|
37264 | var DateTimeSequence = function() {
|
37265 | function DateTimeSequence(unit) {
|
37266 | this.unit = unit, this.sequence = [], this.min = new Date("9999-12-31T23:59:59.999"),
|
37267 | this.max = new Date("0001-01-01T00:00:00.000");
|
37268 | }
|
37269 | return DateTimeSequence.prototype.add = function(date) {
|
37270 | date < this.min && (this.min = date), date > this.max && (this.max = date), this.sequence.push(date);
|
37271 | }, DateTimeSequence.prototype.extendToCover = function(min, max) {
|
37272 | for (var x = this.min; x > min; ) x = DateTimeSequence.addInterval(x, -this.interval, this.unit),
|
37273 | this.sequence.splice(0, 0, x);
|
37274 | for (this.min = x, x = this.max; max > x; ) x = DateTimeSequence.addInterval(x, this.interval, this.unit),
|
37275 | this.sequence.push(x);
|
37276 | this.max = x;
|
37277 | }, DateTimeSequence.prototype.moveToCover = function(min, max) {
|
37278 | var delta = DateTimeSequence.getDelta(min, max, this.unit), count = Math.floor(delta / this.interval);
|
37279 | for (this.min = DateTimeSequence.addInterval(this.min, count * this.interval, this.unit),
|
37280 | this.sequence = [], this.sequence.push(this.min), this.max = this.min; this.max < max; ) this.max = DateTimeSequence.addInterval(this.max, this.interval, this.unit),
|
37281 | this.sequence.push(this.max);
|
37282 | }, DateTimeSequence.calculate = function(dataMin, dataMax, expectedCount, unit) {
|
37283 | switch (unit || (unit = DateTimeSequence.getIntervalUnit(dataMin, dataMax, expectedCount)),
|
37284 | unit) {
|
37285 | case powerbi.DateTimeUnit.Year:
|
37286 | return DateTimeSequence.calculateYears(dataMin, dataMax, expectedCount);
|
37287 |
|
37288 | case powerbi.DateTimeUnit.Month:
|
37289 | return DateTimeSequence.calculateMonths(dataMin, dataMax, expectedCount);
|
37290 |
|
37291 | case powerbi.DateTimeUnit.Week:
|
37292 | return DateTimeSequence.calculateWeeks(dataMin, dataMax, expectedCount);
|
37293 |
|
37294 | case powerbi.DateTimeUnit.Day:
|
37295 | return DateTimeSequence.calculateDays(dataMin, dataMax, expectedCount);
|
37296 |
|
37297 | case powerbi.DateTimeUnit.Hour:
|
37298 | return DateTimeSequence.calculateHours(dataMin, dataMax, expectedCount);
|
37299 |
|
37300 | case powerbi.DateTimeUnit.Minute:
|
37301 | return DateTimeSequence.calculateMinutes(dataMin, dataMax, expectedCount);
|
37302 |
|
37303 | case powerbi.DateTimeUnit.Second:
|
37304 | return DateTimeSequence.calculateSeconds(dataMin, dataMax, expectedCount);
|
37305 |
|
37306 | case powerbi.DateTimeUnit.Millisecond:
|
37307 | return DateTimeSequence.calculateMilliseconds(dataMin, dataMax, expectedCount);
|
37308 | }
|
37309 | }, DateTimeSequence.calculateYears = function(dataMin, dataMax, expectedCount) {
|
37310 | var yearsRange = powerbi.NumericSequenceRange.calculateDataRange(dataMin.getFullYear(), dataMax.getFullYear(), !1), sequence = powerbi.NumericSequence.calculate(powerbi.NumericSequenceRange.calculate(0, yearsRange.max - yearsRange.min), expectedCount, 0, null, null, [ 1, 2, 5 ]), newMinYear = Math.floor(yearsRange.min / sequence.interval) * sequence.interval, date = new Date(newMinYear, 0, 1), result = DateTimeSequence.fromNumericSequence(date, sequence, powerbi.DateTimeUnit.Year);
|
37311 | return result;
|
37312 | }, DateTimeSequence.calculateMonths = function(dataMin, dataMax, expectedCount) {
|
37313 | var minYear = dataMin.getFullYear(), maxYear = dataMax.getFullYear(), minMonth = dataMin.getMonth(), maxMonth = 12 * (maxYear - minYear) + dataMax.getMonth(), date = new Date(minYear, 0, 1), sequence = powerbi.NumericSequence.calculateUnits(minMonth, maxMonth, expectedCount, [ 1, 2, 3, 6, 12 ]), result = DateTimeSequence.fromNumericSequence(date, sequence, powerbi.DateTimeUnit.Month);
|
37314 | return result;
|
37315 | }, DateTimeSequence.calculateWeeks = function(dataMin, dataMax, expectedCount) {
|
37316 | var firstDayOfWeek = 0, minDayOfWeek = dataMin.getDay(), dayOffset = (minDayOfWeek - firstDayOfWeek + 7) % 7, minDay = dataMin.getDate() - dayOffset, date = new Date(dataMin.getFullYear(), dataMin.getMonth(), minDay), min = 0, max = powerbi.Double.ceilWithPrecision(DateTimeSequence.getDelta(date, dataMax, powerbi.DateTimeUnit.Week)), sequence = powerbi.NumericSequence.calculateUnits(min, max, expectedCount, [ 1, 2, 4, 8 ]), result = DateTimeSequence.fromNumericSequence(date, sequence, powerbi.DateTimeUnit.Week);
|
37317 | return result;
|
37318 | }, DateTimeSequence.calculateDays = function(dataMin, dataMax, expectedCount) {
|
37319 | var date = new Date(dataMin.getFullYear(), dataMin.getMonth(), dataMin.getDate()), min = 0, max = powerbi.Double.ceilWithPrecision(DateTimeSequence.getDelta(dataMin, dataMax, powerbi.DateTimeUnit.Day)), sequence = powerbi.NumericSequence.calculateUnits(min, max, expectedCount, [ 1, 2, 7, 14 ]), result = DateTimeSequence.fromNumericSequence(date, sequence, powerbi.DateTimeUnit.Day);
|
37320 | return result;
|
37321 | }, DateTimeSequence.calculateHours = function(dataMin, dataMax, expectedCount) {
|
37322 | var date = new Date(dataMin.getFullYear(), dataMin.getMonth(), dataMin.getDate()), min = powerbi.Double.floorWithPrecision(DateTimeSequence.getDelta(date, dataMin, powerbi.DateTimeUnit.Hour)), max = powerbi.Double.ceilWithPrecision(DateTimeSequence.getDelta(date, dataMax, powerbi.DateTimeUnit.Hour)), sequence = powerbi.NumericSequence.calculateUnits(min, max, expectedCount, [ 1, 2, 3, 6, 12, 24 ]), result = DateTimeSequence.fromNumericSequence(date, sequence, powerbi.DateTimeUnit.Hour);
|
37323 | return result;
|
37324 | }, DateTimeSequence.calculateMinutes = function(dataMin, dataMax, expectedCount) {
|
37325 | var date = new Date(dataMin.getFullYear(), dataMin.getMonth(), dataMin.getDate(), dataMin.getHours()), min = powerbi.Double.floorWithPrecision(DateTimeSequence.getDelta(date, dataMin, powerbi.DateTimeUnit.Minute)), max = powerbi.Double.ceilWithPrecision(DateTimeSequence.getDelta(date, dataMax, powerbi.DateTimeUnit.Minute)), sequence = powerbi.NumericSequence.calculateUnits(min, max, expectedCount, [ 1, 2, 5, 10, 15, 30, 60, 120, 180, 360, 720, 1440 ]), result = DateTimeSequence.fromNumericSequence(date, sequence, powerbi.DateTimeUnit.Minute);
|
37326 | return result;
|
37327 | }, DateTimeSequence.calculateSeconds = function(dataMin, dataMax, expectedCount) {
|
37328 | var date = new Date(dataMin.getFullYear(), dataMin.getMonth(), dataMin.getDate(), dataMin.getHours(), dataMin.getMinutes()), min = powerbi.Double.floorWithPrecision(DateTimeSequence.getDelta(date, dataMin, powerbi.DateTimeUnit.Second)), max = powerbi.Double.ceilWithPrecision(DateTimeSequence.getDelta(date, dataMax, powerbi.DateTimeUnit.Second)), sequence = powerbi.NumericSequence.calculateUnits(min, max, expectedCount, [ 1, 2, 5, 10, 15, 30, 60, 120, 300, 600, 900, 1800, 3600 ]), result = DateTimeSequence.fromNumericSequence(date, sequence, powerbi.DateTimeUnit.Second);
|
37329 | return result;
|
37330 | }, DateTimeSequence.calculateMilliseconds = function(dataMin, dataMax, expectedCount) {
|
37331 | var date = new Date(dataMin.getFullYear(), dataMin.getMonth(), dataMin.getDate(), dataMin.getHours(), dataMin.getMinutes(), dataMin.getSeconds()), min = DateTimeSequence.getDelta(date, dataMin, powerbi.DateTimeUnit.Millisecond), max = DateTimeSequence.getDelta(date, dataMax, powerbi.DateTimeUnit.Millisecond), sequence = powerbi.NumericSequence.calculate(powerbi.NumericSequenceRange.calculate(min, max), expectedCount, 0), result = DateTimeSequence.fromNumericSequence(date, sequence, powerbi.DateTimeUnit.Millisecond);
|
37332 | return result;
|
37333 | }, DateTimeSequence.addInterval = function(value, interval, unit) {
|
37334 | switch (interval = Math.round(interval), unit) {
|
37335 | case powerbi.DateTimeUnit.Year:
|
37336 | return DateUtils.addYears(value, interval);
|
37337 |
|
37338 | case powerbi.DateTimeUnit.Month:
|
37339 | return DateUtils.addMonths(value, interval);
|
37340 |
|
37341 | case powerbi.DateTimeUnit.Week:
|
37342 | return DateUtils.addWeeks(value, interval);
|
37343 |
|
37344 | case powerbi.DateTimeUnit.Day:
|
37345 | return DateUtils.addDays(value, interval);
|
37346 |
|
37347 | case powerbi.DateTimeUnit.Hour:
|
37348 | return DateUtils.addHours(value, interval);
|
37349 |
|
37350 | case powerbi.DateTimeUnit.Minute:
|
37351 | return DateUtils.addMinutes(value, interval);
|
37352 |
|
37353 | case powerbi.DateTimeUnit.Second:
|
37354 | return DateUtils.addSeconds(value, interval);
|
37355 |
|
37356 | case powerbi.DateTimeUnit.Millisecond:
|
37357 | return DateUtils.addMilliseconds(value, interval);
|
37358 | }
|
37359 | }, DateTimeSequence.fromNumericSequence = function(date, sequence, unit) {
|
37360 | for (var result = new DateTimeSequence(unit), i = 0; i < sequence.sequence.length; i++) {
|
37361 | var x = sequence.sequence[i], d = DateTimeSequence.addInterval(date, x, unit);
|
37362 | result.add(d);
|
37363 | }
|
37364 | return result.interval = sequence.interval, result.intervalOffset = sequence.intervalOffset,
|
37365 | result;
|
37366 | }, DateTimeSequence.getDelta = function(min, max, unit) {
|
37367 | var delta = 0;
|
37368 | switch (unit) {
|
37369 | case powerbi.DateTimeUnit.Year:
|
37370 | delta = max.getFullYear() - min.getFullYear();
|
37371 | break;
|
37372 |
|
37373 | case powerbi.DateTimeUnit.Month:
|
37374 | delta = 12 * (max.getFullYear() - min.getFullYear()) + max.getMonth() - min.getMonth();
|
37375 | break;
|
37376 |
|
37377 | case powerbi.DateTimeUnit.Week:
|
37378 | delta = (max.getTime() - min.getTime()) / 6048e5;
|
37379 | break;
|
37380 |
|
37381 | case powerbi.DateTimeUnit.Day:
|
37382 | delta = (max.getTime() - min.getTime()) / 864e5;
|
37383 | break;
|
37384 |
|
37385 | case powerbi.DateTimeUnit.Hour:
|
37386 | delta = (max.getTime() - min.getTime()) / 36e5;
|
37387 | break;
|
37388 |
|
37389 | case powerbi.DateTimeUnit.Minute:
|
37390 | delta = (max.getTime() - min.getTime()) / 6e4;
|
37391 | break;
|
37392 |
|
37393 | case powerbi.DateTimeUnit.Second:
|
37394 | delta = (max.getTime() - min.getTime()) / 1e3;
|
37395 | break;
|
37396 |
|
37397 | case powerbi.DateTimeUnit.Millisecond:
|
37398 | delta = max.getTime() - min.getTime();
|
37399 | }
|
37400 | return delta;
|
37401 | }, DateTimeSequence.getIntervalUnit = function(min, max, maxCount) {
|
37402 | maxCount = Math.max(maxCount, 2);
|
37403 | var totalDays = DateTimeSequence.getDelta(min, max, powerbi.DateTimeUnit.Day);
|
37404 | if (totalDays > 356 && totalDays >= 180 * maxCount) return powerbi.DateTimeUnit.Year;
|
37405 | if (totalDays > 60 && totalDays > 7 * maxCount) return powerbi.DateTimeUnit.Month;
|
37406 | if (totalDays > 14 && totalDays > 2 * maxCount) return powerbi.DateTimeUnit.Week;
|
37407 | var totalHours = DateTimeSequence.getDelta(min, max, powerbi.DateTimeUnit.Hour);
|
37408 | if (totalDays > 2 && totalHours > 12 * maxCount) return powerbi.DateTimeUnit.Day;
|
37409 | if (totalHours >= 24 && totalHours >= maxCount) return powerbi.DateTimeUnit.Hour;
|
37410 | var totalMinutes = DateTimeSequence.getDelta(min, max, powerbi.DateTimeUnit.Minute);
|
37411 | if (totalMinutes > 2 && totalMinutes >= maxCount) return powerbi.DateTimeUnit.Minute;
|
37412 | var totalSeconds = DateTimeSequence.getDelta(min, max, powerbi.DateTimeUnit.Second);
|
37413 | if (totalSeconds > 2 && totalSeconds >= .8 * maxCount) return powerbi.DateTimeUnit.Second;
|
37414 | var totalMilliseconds = DateTimeSequence.getDelta(min, max, powerbi.DateTimeUnit.Millisecond);
|
37415 | if (totalMilliseconds > 0) return powerbi.DateTimeUnit.Millisecond;
|
37416 | var date = min;
|
37417 | return 0 !== date.getMilliseconds() ? powerbi.DateTimeUnit.Millisecond : 0 !== date.getSeconds() ? powerbi.DateTimeUnit.Second : 0 !== date.getMinutes() ? powerbi.DateTimeUnit.Minute : 0 !== date.getHours() ? powerbi.DateTimeUnit.Hour : 1 !== date.getDate() ? powerbi.DateTimeUnit.Day : 0 !== date.getMonth() ? powerbi.DateTimeUnit.Month : powerbi.DateTimeUnit.Year;
|
37418 | }, DateTimeSequence.MIN_COUNT = 1, DateTimeSequence.MAX_COUNT = 1e3, DateTimeSequence;
|
37419 | }();
|
37420 | powerbi.DateTimeSequence = DateTimeSequence;
|
37421 | var DateUtils;
|
37422 | !function(DateUtils) {
|
37423 | function isLeap(year) {
|
37424 | return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
37425 | }
|
37426 | function getMonthDays(year, month) {
|
37427 | return isLeap(year) ? MonthDaysLeap[month] : MonthDays[month];
|
37428 | }
|
37429 | function addYears(date, yearDelta) {
|
37430 | var year = date.getFullYear(), month = date.getMonth(), day = date.getDate(), isLeapDay = 2 === month && 29 === day, result = new Date(date.getTime());
|
37431 | return year += yearDelta, isLeapDay && !isLeap(year) && (day = 28), result.setFullYear(year, month, day),
|
37432 | result;
|
37433 | }
|
37434 | function addMonths(date, monthDelta) {
|
37435 | var year = date.getFullYear(), month = date.getMonth(), day = date.getDate(), result = new Date(date.getTime());
|
37436 | return year += (monthDelta - monthDelta % 12) / 12, month += monthDelta % 12, month > 11 && (month %= 12,
|
37437 | year++), day = Math.min(day, getMonthDays(year, month)), result.setFullYear(year, month, day),
|
37438 | result;
|
37439 | }
|
37440 | function addWeeks(date, weeks) {
|
37441 | return addDays(date, 7 * weeks);
|
37442 | }
|
37443 | function addDays(date, days) {
|
37444 | var year = date.getFullYear(), month = date.getMonth(), day = date.getDate(), result = new Date(date.getTime());
|
37445 | return result.setFullYear(year, month, day + days), result;
|
37446 | }
|
37447 | function addHours(date, hours) {
|
37448 | return new Date(date.getTime() + 36e5 * hours);
|
37449 | }
|
37450 | function addMinutes(date, minutes) {
|
37451 | return new Date(date.getTime() + 6e4 * minutes);
|
37452 | }
|
37453 | function addSeconds(date, seconds) {
|
37454 | return new Date(date.getTime() + 1e3 * seconds);
|
37455 | }
|
37456 | function addMilliseconds(date, milliseconds) {
|
37457 | return new Date(date.getTime() + milliseconds);
|
37458 | }
|
37459 | var MonthDays = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ], MonthDaysLeap = [ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
|
37460 | DateUtils.addYears = addYears, DateUtils.addMonths = addMonths, DateUtils.addWeeks = addWeeks,
|
37461 | DateUtils.addDays = addDays, DateUtils.addHours = addHours, DateUtils.addMinutes = addMinutes,
|
37462 | DateUtils.addSeconds = addSeconds, DateUtils.addMilliseconds = addMilliseconds;
|
37463 | }(DateUtils = powerbi.DateUtils || (powerbi.DateUtils = {}));
|
37464 | }(powerbi || (powerbi = {}));
|
37465 | }, function(module, exports) {
|
37466 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
37467 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
37468 | function __() {
|
37469 | this.constructor = d;
|
37470 | }
|
37471 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
37472 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
37473 | });
|
37474 | !function(powerbi) {
|
37475 | function createDisplayUnits(unitLookup, adjustMinBasedOnPreviousUnit) {
|
37476 | for (var units = [], i = 3; maxExponent > i; i++) {
|
37477 | var names = unitLookup(i);
|
37478 | names && addUnitIfNonEmpty(units, powerbi.Double.pow10(i), names.title, names.format, adjustMinBasedOnPreviousUnit);
|
37479 | }
|
37480 | return units;
|
37481 | }
|
37482 | function addUnitIfNonEmpty(units, value, title, labelFormat, adjustMinBasedOnPreviousUnit) {
|
37483 | if (title || labelFormat) {
|
37484 | var min = value;
|
37485 | if (units.length > 0) {
|
37486 | var previousUnit = units[units.length - 1];
|
37487 | adjustMinBasedOnPreviousUnit && (min = adjustMinBasedOnPreviousUnit(value, previousUnit.value, min)),
|
37488 | previousUnit.applicableRangeMax = min;
|
37489 | }
|
37490 | var unit = new DisplayUnit();
|
37491 | unit.value = value, unit.applicableRangeMin = min, unit.applicableRangeMax = 1e3 * min,
|
37492 | unit.title = title, unit.labelFormat = labelFormat, units.push(unit);
|
37493 | }
|
37494 | }
|
37495 | var maxExponent = 24, defaultScientificBigNumbersBoundary = 1e15, scientificSmallNumbersBoundary = 1e-4, PERCENTAGE_FORMAT = "%", SCIENTIFIC_FORMAT = "E+0", DEFAULT_SCIENTIFIC_FORMAT = "0.##" + SCIENTIFIC_FORMAT, SUPPORTED_SCIENTIFIC_FORMATS = /^([0\#,]*\.[0\#]+|[0\#,]+|g)$/i, DisplayUnit = function() {
|
37496 | function DisplayUnit() {}
|
37497 | return DisplayUnit.prototype.project = function(value) {
|
37498 | return this.value ? powerbi.Double.removeDecimalNoise(value / this.value) : value;
|
37499 | }, DisplayUnit.prototype.reverseProject = function(value) {
|
37500 | return this.value ? value * this.value : value;
|
37501 | }, DisplayUnit.prototype.isApplicableTo = function(value) {
|
37502 | value = Math.abs(value);
|
37503 | var precision = powerbi.Double.getPrecision(value, 3);
|
37504 | return powerbi.Double.greaterOrEqualWithPrecision(value, this.applicableRangeMin, precision) && powerbi.Double.lessWithPrecision(value, this.applicableRangeMax, precision);
|
37505 | }, DisplayUnit.prototype.isScaling = function() {
|
37506 | return this.value > 1;
|
37507 | }, DisplayUnit;
|
37508 | }();
|
37509 | powerbi.DisplayUnit = DisplayUnit;
|
37510 | var DisplayUnitSystem = function() {
|
37511 | function DisplayUnitSystem(units) {
|
37512 | this.units = units ? units : [];
|
37513 | }
|
37514 | return Object.defineProperty(DisplayUnitSystem.prototype, "title", {
|
37515 | get: function() {
|
37516 | return this.displayUnit ? this.displayUnit.title : void 0;
|
37517 | },
|
37518 | enumerable: !0,
|
37519 | configurable: !0
|
37520 | }), DisplayUnitSystem.prototype.update = function(value) {
|
37521 | void 0 !== value && (this.unitBaseValue = value, this.displayUnit = this.findApplicableDisplayUnit(value));
|
37522 | }, DisplayUnitSystem.prototype.findApplicableDisplayUnit = function(value) {
|
37523 | for (var _i = 0, _a = this.units; _i < _a.length; _i++) {
|
37524 | var unit = _a[_i];
|
37525 | if (unit.isApplicableTo(value)) return unit;
|
37526 | }
|
37527 | }, DisplayUnitSystem.prototype.format = function(value, format, decimals, trailingZeros) {
|
37528 | decimals = this.getNumberOfDecimalsForFormatting(format, decimals);
|
37529 | var nonScientificFormat = "";
|
37530 | return this.isFormatSupported(format) && !this.hasScientitifcFormat(format) && this.isScalingUnit() && this.shouldRespectScalingUnit(format) && (value = this.displayUnit.project(value),
|
37531 | nonScientificFormat = this.displayUnit.labelFormat), this.formatHelper(value, nonScientificFormat, format, decimals, trailingZeros);
|
37532 | }, DisplayUnitSystem.prototype.isFormatSupported = function(format) {
|
37533 | return !DisplayUnitSystem.UNSUPPORTED_FORMATS.test(format);
|
37534 | }, DisplayUnitSystem.prototype.isPercentageFormat = function(format) {
|
37535 | return format && format.indexOf(PERCENTAGE_FORMAT) >= 0;
|
37536 | }, DisplayUnitSystem.prototype.shouldRespectScalingUnit = function(format) {
|
37537 | return !this.isPercentageFormat(format);
|
37538 | }, DisplayUnitSystem.prototype.getNumberOfDecimalsForFormatting = function(format, decimals) {
|
37539 | return decimals;
|
37540 | }, DisplayUnitSystem.prototype.isScalingUnit = function() {
|
37541 | return this.displayUnit && this.displayUnit.isScaling();
|
37542 | }, DisplayUnitSystem.prototype.formatHelper = function(value, nonScientificFormat, format, decimals, trailingZeros) {
|
37543 | if ("g" !== format && "G" !== format || null == decimals || (format = powerbi.visuals.valueFormatter.DefaultNumericFormat),
|
37544 | format = powerbi.NumberFormat.addDecimalsToFormat(format, decimals, trailingZeros),
|
37545 | format && !powerbi.formattingService.isStandardNumberFormat(format)) return powerbi.formattingService.formatNumberWithCustomOverride(value, format, nonScientificFormat);
|
37546 | format || (format = "G"), nonScientificFormat || (nonScientificFormat = "{0}");
|
37547 | var text = powerbi.formattingService.formatValue(value, format);
|
37548 | return powerbi.formattingService.format(nonScientificFormat, [ text ]);
|
37549 | }, DisplayUnitSystem.prototype.formatSingleValue = function(value, format, decimals, trailingZeros) {
|
37550 | return this.update(this.shouldUseValuePrecision(value) ? powerbi.Double.getPrecision(value, 8) : value),
|
37551 | this.format(value, format, decimals, trailingZeros);
|
37552 | }, DisplayUnitSystem.prototype.shouldUseValuePrecision = function(value) {
|
37553 | if (0 === this.units.length) return !0;
|
37554 | for (var applicableRangeMin = 0, i = 0; i < this.units.length; i++) if (this.units[i].isScaling()) {
|
37555 | applicableRangeMin = this.units[i].applicableRangeMin;
|
37556 | break;
|
37557 | }
|
37558 | return Math.abs(value) < applicableRangeMin;
|
37559 | }, DisplayUnitSystem.prototype.isScientific = function(value) {
|
37560 | return -defaultScientificBigNumbersBoundary > value || value > defaultScientificBigNumbersBoundary || value > -scientificSmallNumbersBoundary && scientificSmallNumbersBoundary > value && 0 !== value;
|
37561 | }, DisplayUnitSystem.prototype.hasScientitifcFormat = function(format) {
|
37562 | return format && -1 !== format.toUpperCase().indexOf("E");
|
37563 | }, DisplayUnitSystem.prototype.supportsScientificFormat = function(format) {
|
37564 | return format ? SUPPORTED_SCIENTIFIC_FORMATS.test(format) : !0;
|
37565 | }, DisplayUnitSystem.prototype.shouldFallbackToScientific = function(value, format) {
|
37566 | return !this.hasScientitifcFormat(format) && this.supportsScientificFormat(format) && this.isScientific(value);
|
37567 | }, DisplayUnitSystem.prototype.getScientificFormat = function(data, format, decimals, trailingZeros) {
|
37568 | if (this.isFormatSupported(format) && this.shouldFallbackToScientific(data, format)) {
|
37569 | var numericFormat = powerbi.NumberFormat.getNumericFormat(data, format);
|
37570 | return decimals && (numericFormat = powerbi.NumberFormat.addDecimalsToFormat(numericFormat ? numericFormat : "0", Math.abs(decimals), trailingZeros)),
|
37571 | numericFormat ? numericFormat + SCIENTIFIC_FORMAT : DEFAULT_SCIENTIFIC_FORMAT;
|
37572 | }
|
37573 | return format;
|
37574 | }, DisplayUnitSystem.UNSUPPORTED_FORMATS = /^(p\d*)|(.*\%)|(e\d*)$/i, DisplayUnitSystem;
|
37575 | }();
|
37576 | powerbi.DisplayUnitSystem = DisplayUnitSystem;
|
37577 | var NoDisplayUnitSystem = function(_super) {
|
37578 | function NoDisplayUnitSystem() {
|
37579 | _super.call(this, []);
|
37580 | }
|
37581 | return __extends(NoDisplayUnitSystem, _super), NoDisplayUnitSystem;
|
37582 | }(DisplayUnitSystem);
|
37583 | powerbi.NoDisplayUnitSystem = NoDisplayUnitSystem;
|
37584 | var DefaultDisplayUnitSystem = function(_super) {
|
37585 | function DefaultDisplayUnitSystem(unitLookup) {
|
37586 | _super.call(this, DefaultDisplayUnitSystem.getUnits(unitLookup));
|
37587 | }
|
37588 | return __extends(DefaultDisplayUnitSystem, _super), DefaultDisplayUnitSystem.prototype.format = function(data, format, decimals, trailingZeros) {
|
37589 | return format = this.getScientificFormat(data, format, decimals, trailingZeros),
|
37590 | _super.prototype.format.call(this, data, format, decimals, trailingZeros);
|
37591 | }, DefaultDisplayUnitSystem.reset = function() {
|
37592 | DefaultDisplayUnitSystem.units = null;
|
37593 | }, DefaultDisplayUnitSystem.getUnits = function(unitLookup) {
|
37594 | return DefaultDisplayUnitSystem.units || (DefaultDisplayUnitSystem.units = createDisplayUnits(unitLookup, function(value, previousUnitValue, min) {
|
37595 | return value - previousUnitValue >= 1e3 ? value / 10 : min;
|
37596 | }), DefaultDisplayUnitSystem.units[DefaultDisplayUnitSystem.units.length - 1].applicableRangeMax = 1 / 0),
|
37597 | DefaultDisplayUnitSystem.units;
|
37598 | }, DefaultDisplayUnitSystem;
|
37599 | }(DisplayUnitSystem);
|
37600 | powerbi.DefaultDisplayUnitSystem = DefaultDisplayUnitSystem;
|
37601 | var WholeUnitsDisplayUnitSystem = function(_super) {
|
37602 | function WholeUnitsDisplayUnitSystem(unitLookup) {
|
37603 | _super.call(this, WholeUnitsDisplayUnitSystem.getUnits(unitLookup));
|
37604 | }
|
37605 | return __extends(WholeUnitsDisplayUnitSystem, _super), WholeUnitsDisplayUnitSystem.reset = function() {
|
37606 | WholeUnitsDisplayUnitSystem.units = null;
|
37607 | }, WholeUnitsDisplayUnitSystem.getUnits = function(unitLookup) {
|
37608 | return WholeUnitsDisplayUnitSystem.units || (WholeUnitsDisplayUnitSystem.units = createDisplayUnits(unitLookup),
|
37609 | WholeUnitsDisplayUnitSystem.units[WholeUnitsDisplayUnitSystem.units.length - 1].applicableRangeMax = 1 / 0),
|
37610 | WholeUnitsDisplayUnitSystem.units;
|
37611 | }, WholeUnitsDisplayUnitSystem.prototype.format = function(data, format, decimals, trailingZeros) {
|
37612 | return format = this.getScientificFormat(data, format, decimals, trailingZeros),
|
37613 | _super.prototype.format.call(this, data, format, decimals, trailingZeros);
|
37614 | }, WholeUnitsDisplayUnitSystem;
|
37615 | }(DisplayUnitSystem);
|
37616 | powerbi.WholeUnitsDisplayUnitSystem = WholeUnitsDisplayUnitSystem;
|
37617 | var DataLabelsDisplayUnitSystem = function(_super) {
|
37618 | function DataLabelsDisplayUnitSystem(unitLookup) {
|
37619 | _super.call(this, DataLabelsDisplayUnitSystem.getUnits(unitLookup));
|
37620 | }
|
37621 | return __extends(DataLabelsDisplayUnitSystem, _super), DataLabelsDisplayUnitSystem.prototype.isFormatSupported = function(format) {
|
37622 | return !DataLabelsDisplayUnitSystem.UNSUPPORTED_FORMATS.test(format);
|
37623 | }, DataLabelsDisplayUnitSystem.getUnits = function(unitLookup) {
|
37624 | if (!DataLabelsDisplayUnitSystem.units) {
|
37625 | var units = [], adjustMinBasedOnPreviousUnit = function(value, previousUnitValue, min) {
|
37626 | return -1 === value && value - previousUnitValue >= 1e3 ? value / 10 : min;
|
37627 | }, names = unitLookup(-1);
|
37628 | addUnitIfNonEmpty(units, DataLabelsDisplayUnitSystem.AUTO_DISPLAYUNIT_VALUE, names.title, names.format, adjustMinBasedOnPreviousUnit),
|
37629 | names = unitLookup(0), addUnitIfNonEmpty(units, DataLabelsDisplayUnitSystem.NONE_DISPLAYUNIT_VALUE, names.title, names.format, adjustMinBasedOnPreviousUnit),
|
37630 | DataLabelsDisplayUnitSystem.units = units.concat(createDisplayUnits(unitLookup, adjustMinBasedOnPreviousUnit)),
|
37631 | DataLabelsDisplayUnitSystem.units[DataLabelsDisplayUnitSystem.units.length - 1].applicableRangeMax = 1 / 0;
|
37632 | }
|
37633 | return DataLabelsDisplayUnitSystem.units;
|
37634 | }, DataLabelsDisplayUnitSystem.prototype.format = function(data, format, decimals, trailingZeros) {
|
37635 | return format = this.getScientificFormat(data, format, decimals, trailingZeros),
|
37636 | _super.prototype.format.call(this, data, format, decimals, trailingZeros);
|
37637 | }, DataLabelsDisplayUnitSystem.AUTO_DISPLAYUNIT_VALUE = 0, DataLabelsDisplayUnitSystem.NONE_DISPLAYUNIT_VALUE = 1,
|
37638 | DataLabelsDisplayUnitSystem.UNSUPPORTED_FORMATS = /^(e\d*)$/i, DataLabelsDisplayUnitSystem;
|
37639 | }(DisplayUnitSystem);
|
37640 | powerbi.DataLabelsDisplayUnitSystem = DataLabelsDisplayUnitSystem;
|
37641 | }(powerbi || (powerbi = {}));
|
37642 | }, function(module, exports) {
|
37643 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
37644 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
37645 | !function(powerbi) {
|
37646 | var NumericSequence = function() {
|
37647 | function NumericSequence() {}
|
37648 | return NumericSequence.calculate = function(range, expectedCount, maxAllowedMargin, minPower, useZeroRefPoint, steps) {
|
37649 | var result = new NumericSequence();
|
37650 | if (expectedCount = void 0 === expectedCount ? 10 : powerbi.Double.ensureInRange(expectedCount, NumericSequence.MIN_COUNT, NumericSequence.MAX_COUNT),
|
37651 | void 0 === minPower && (minPower = powerbi.Double.MIN_EXP), void 0 === useZeroRefPoint && (useZeroRefPoint = !1),
|
37652 | void 0 === maxAllowedMargin && (maxAllowedMargin = 1), void 0 === steps && (steps = [ 1, 2, 5 ]),
|
37653 | range.forcedSingleStop) return result.interval = range.getSize(), result.intervalOffset = result.interval - (range.forcedSingleStop - range.min),
|
37654 | result.min = range.min, result.max = range.max, result.sequence = [ range.forcedSingleStop ],
|
37655 | result;
|
37656 | var interval = 0, min = 0, max = 9, canExtendMin = maxAllowedMargin > 0 && !range.hasFixedMin, canExtendMax = maxAllowedMargin > 0 && !range.hasFixedMax, size = range.getSize(), exp = powerbi.Double.log10(size), stepExp = powerbi.Double.log10(steps[0]);
|
37657 | exp -= stepExp;
|
37658 | var expectedCountExp = powerbi.Double.log10(expectedCount);
|
37659 | exp -= expectedCountExp, exp = Math.max(exp, minPower - stepExp + 1);
|
37660 | var count = void 0;
|
37661 | if (0 !== interval) {
|
37662 | var power = powerbi.Double.pow10(exp), roundMin = powerbi.Double.floorToPrecision(range.min, power), roundMax = powerbi.Double.ceilToPrecision(range.max, power), roundRange = powerbi.NumericSequenceRange.calculateFixedRange(roundMin, roundMax);
|
37663 | roundRange.shrinkByStep(range, interval), min = roundRange.min, max = roundRange.max,
|
37664 | count = Math.floor(roundRange.getSize() / interval);
|
37665 | } else {
|
37666 | var dexp = void 0;
|
37667 | for (dexp = 0; 3 > dexp; dexp++) {
|
37668 | for (var e = exp + dexp, power = powerbi.Double.pow10(e), roundMin = powerbi.Double.floorToPrecision(range.min, power), roundMax = powerbi.Double.ceilToPrecision(range.max, power), stepsCount = steps.length, stepPower = powerbi.Double.pow10(e - 1), i = 0; stepsCount > i; i++) {
|
37669 | var step = steps[i] * stepPower, roundRange = powerbi.NumericSequenceRange.calculateFixedRange(roundMin, roundMax, useZeroRefPoint);
|
37670 | if (roundRange.shrinkByStep(range, step), canExtendMin && range.min === roundRange.min && maxAllowedMargin >= 1 && (roundRange.min -= step),
|
37671 | canExtendMax && range.max === roundRange.max && maxAllowedMargin >= 1 && (roundRange.max += step),
|
37672 | count = powerbi.Double.ceilWithPrecision(roundRange.getSize() / step), expectedCount >= count || 2 === dexp && i === stepsCount - 1 || 1 === expectedCount && 2 === count && (step > range.getSize() || range.min < 0 && range.max > 0 && 2 * step >= range.getSize())) {
|
37673 | interval = step, min = roundRange.min, max = roundRange.max;
|
37674 | break;
|
37675 | }
|
37676 | }
|
37677 | if (0 !== interval) break;
|
37678 | }
|
37679 | }
|
37680 | (count > 32 * expectedCount || count > NumericSequence.MAX_COUNT) && (count = Math.min(32 * expectedCount, NumericSequence.MAX_COUNT),
|
37681 | interval = (max - min) / count), result.min = min, result.max = max, result.interval = interval,
|
37682 | result.intervalOffset = min - range.min, result.maxAllowedMargin = maxAllowedMargin,
|
37683 | result.canExtendMin = canExtendMin, result.canExtendMax = canExtendMax;
|
37684 | var precision = powerbi.Double.getPrecision(interval, 0);
|
37685 | result.precision = precision;
|
37686 | var sequence = [], x = powerbi.Double.roundToPrecision(min, precision);
|
37687 | sequence.push(x);
|
37688 | for (var i = 0; count > i; i++) x = powerbi.Double.roundToPrecision(x + interval, precision),
|
37689 | sequence.push(x);
|
37690 | return result.sequence = sequence, result.trimMinMax(range.min, range.max), result;
|
37691 | }, NumericSequence.calculateUnits = function(min, max, maxCount, steps) {
|
37692 | maxCount = powerbi.Double.ensureInRange(maxCount, NumericSequence.MIN_COUNT, NumericSequence.MAX_COUNT),
|
37693 | min === max && (max = min + 1);
|
37694 | for (var stepCount = 0, step = 0, i = 0; i < steps.length; i++) {
|
37695 | step = steps[i];
|
37696 | var maxStepCount = powerbi.Double.ceilWithPrecision(max / step), minStepCount = powerbi.Double.floorWithPrecision(min / step);
|
37697 | if (stepCount = maxStepCount - minStepCount, maxCount >= stepCount) break;
|
37698 | }
|
37699 | var offset = -min;
|
37700 | offset %= step;
|
37701 | var result = new NumericSequence();
|
37702 | result.sequence = [];
|
37703 | for (var x = min + offset; result.sequence.push(x), !(x >= max); x += step) ;
|
37704 | return result.interval = step, result.intervalOffset = offset, result.min = result.sequence[0],
|
37705 | result.max = result.sequence[result.sequence.length - 1], result;
|
37706 | }, NumericSequence.prototype.trimMinMax = function(min, max) {
|
37707 | var minMargin = (min - this.min) / this.interval, maxMargin = (this.max - max) / this.interval, marginPrecision = .001;
|
37708 | (!this.canExtendMin || minMargin > this.maxAllowedMargin && minMargin > marginPrecision) && (this.min = min),
|
37709 | (!this.canExtendMax || maxMargin > this.maxAllowedMargin && maxMargin > marginPrecision) && (this.max = max);
|
37710 | }, NumericSequence.MIN_COUNT = 1, NumericSequence.MAX_COUNT = 1e3, NumericSequence;
|
37711 | }();
|
37712 | powerbi.NumericSequence = NumericSequence;
|
37713 | }(powerbi || (powerbi = {}));
|
37714 | }, function(module, exports) {
|
37715 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
37716 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
37717 | !function(powerbi) {
|
37718 | var NumericSequenceRange = function() {
|
37719 | function NumericSequenceRange() {}
|
37720 | return NumericSequenceRange.prototype._ensureIncludeZero = function() {
|
37721 | this.includeZero && (this.min > 0 && !this.hasFixedMin && (this.min = 0), this.max < 0 && !this.hasFixedMax && (this.max = 0));
|
37722 | }, NumericSequenceRange.prototype._ensureNotEmpty = function() {
|
37723 | if (this.min === this.max) if (this.min) {
|
37724 | var value = this.min, exp = powerbi.Double.log10(Math.abs(value)), step = void 0;
|
37725 | exp >= 0 && 4 > exp ? (step = .5, this.forcedSingleStop = value) : (step = powerbi.Double.pow10(exp) / 2,
|
37726 | this.forcedSingleStop = null), this.min = value - step, this.max = value + step;
|
37727 | } else this.min = 0, this.max = NumericSequenceRange.DEFAULT_MAX, this.hasFixedMin = !0,
|
37728 | this.hasFixedMax = !0;
|
37729 | }, NumericSequenceRange.prototype._ensureDirection = function() {
|
37730 | if (this.min > this.max) {
|
37731 | var temp = this.min;
|
37732 | this.min = this.max, this.max = temp;
|
37733 | }
|
37734 | }, NumericSequenceRange.prototype.getSize = function() {
|
37735 | return this.max - this.min;
|
37736 | }, NumericSequenceRange.prototype.shrinkByStep = function(range, step) {
|
37737 | var oldCount = this.min / step, newCount = range.min / step, deltaCount = Math.floor(newCount - oldCount);
|
37738 | this.min += deltaCount * step, oldCount = this.max / step, newCount = range.max / step,
|
37739 | deltaCount = Math.ceil(newCount - oldCount), this.max += deltaCount * step;
|
37740 | }, NumericSequenceRange.calculate = function(dataMin, dataMax, fixedMin, fixedMax, includeZero) {
|
37741 | var result = new NumericSequenceRange();
|
37742 | return result.includeZero = !!includeZero, result.hasDataRange = ValueUtil.hasValue(dataMin) && ValueUtil.hasValue(dataMax),
|
37743 | result.hasFixedMin = ValueUtil.hasValue(fixedMin), result.hasFixedMax = ValueUtil.hasValue(fixedMax),
|
37744 | dataMin = powerbi.Double.ensureInRange(dataMin, NumericSequenceRange.MIN_SUPPORTED_DOUBLE, NumericSequenceRange.MAX_SUPPORTED_DOUBLE),
|
37745 | dataMax = powerbi.Double.ensureInRange(dataMax, NumericSequenceRange.MIN_SUPPORTED_DOUBLE, NumericSequenceRange.MAX_SUPPORTED_DOUBLE),
|
37746 | result.hasFixedMin && result.hasFixedMax ? (result.min = fixedMin, result.max = fixedMax) : result.hasFixedMin ? (result.min = fixedMin,
|
37747 | result.max = dataMax > fixedMin ? dataMax : fixedMin) : result.hasFixedMax ? (result.min = fixedMax > dataMin ? dataMin : fixedMax,
|
37748 | result.max = fixedMax) : result.hasDataRange ? (result.min = dataMin, result.max = dataMax) : (result.min = 0,
|
37749 | result.max = 0), result._ensureIncludeZero(), result._ensureNotEmpty(), result._ensureDirection(),
|
37750 | 0 === result.min ? result.hasFixedMin = !0 : 0 === result.max && (result.hasFixedMax = !0),
|
37751 | result;
|
37752 | }, NumericSequenceRange.calculateDataRange = function(dataMin, dataMax, includeZero) {
|
37753 | return ValueUtil.hasValue(dataMin) && ValueUtil.hasValue(dataMax) ? NumericSequenceRange.calculate(dataMin, dataMax, null, null, includeZero) : NumericSequenceRange.calculateFixedRange(0, NumericSequenceRange.DEFAULT_MAX);
|
37754 | }, NumericSequenceRange.calculateFixedRange = function(fixedMin, fixedMax, includeZero) {
|
37755 | var result = new NumericSequenceRange();
|
37756 | return result.hasDataRange = !1, result.includeZero = includeZero, result.min = fixedMin,
|
37757 | result.max = fixedMax, result._ensureIncludeZero(), result._ensureNotEmpty(), result._ensureDirection(),
|
37758 | result.hasFixedMin = !0, result.hasFixedMax = !0, result;
|
37759 | }, NumericSequenceRange.DEFAULT_MAX = 10, NumericSequenceRange.MIN_SUPPORTED_DOUBLE = -1e307,
|
37760 | NumericSequenceRange.MAX_SUPPORTED_DOUBLE = 1e307, NumericSequenceRange;
|
37761 | }();
|
37762 | powerbi.NumericSequenceRange = NumericSequenceRange;
|
37763 | var ValueUtil;
|
37764 | !function(ValueUtil) {
|
37765 | function hasValue(value) {
|
37766 | return void 0 !== value && null !== value;
|
37767 | }
|
37768 | ValueUtil.hasValue = hasValue;
|
37769 | }(ValueUtil = powerbi.ValueUtil || (powerbi.ValueUtil = {}));
|
37770 | }(powerbi || (powerbi = {}));
|
37771 | }, function(module, exports) {
|
37772 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
37773 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
37774 | !function(powerbi) {
|
37775 | var visuals;
|
37776 | !function(visuals) {
|
37777 | var valueFormatter;
|
37778 | !function(valueFormatter) {
|
37779 | function beautify(format) {
|
37780 | var key = BeautifiedFormat[format];
|
37781 | return key ? defaultLocalizedStrings[key] || format : format;
|
37782 | }
|
37783 | function describeUnit(exponent) {
|
37784 | var exponentLookup = -1 === exponent ? "Auto" : exponent.toString(), title = defaultLocalizedStrings["DisplayUnitSystem_E" + exponentLookup + "_Title"], format = 0 >= exponent ? "{0}" : defaultLocalizedStrings["DisplayUnitSystem_E" + exponentLookup + "_LabelFormat"];
|
37785 | return title || format ? {
|
37786 | title: title,
|
37787 | format: format
|
37788 | } : void 0;
|
37789 | }
|
37790 | function getLocalizedString(stringId) {
|
37791 | return defaultLocalizedStrings[stringId];
|
37792 | }
|
37793 | function getFormatMetadata(format) {
|
37794 | return powerbi.NumberFormat.getCustomFormatMetadata(format);
|
37795 | }
|
37796 | function setLocaleOptions(options) {
|
37797 | locale = options, powerbi.DefaultDisplayUnitSystem.reset(), powerbi.WholeUnitsDisplayUnitSystem.reset();
|
37798 | }
|
37799 | function createDefaultFormatter(formatString, allowFormatBeautification) {
|
37800 | void 0 === allowFormatBeautification && (allowFormatBeautification = !1);
|
37801 | var formatBeaut = allowFormatBeautification ? locale.beautify(formatString) : formatString;
|
37802 | return {
|
37803 | format: function(value) {
|
37804 | return null == value ? locale["null"] : formatCore(value, formatBeaut);
|
37805 | }
|
37806 | };
|
37807 | }
|
37808 | function create(options) {
|
37809 | var format = options.allowFormatBeautification ? locale.beautify(options.format) : options.format;
|
37810 | if (shouldUseNumericDisplayUnits(options)) {
|
37811 | var displayUnitSystem_1 = createDisplayUnitSystem(options.displayUnitSystemType), singleValueFormattingMode_1 = !!options.formatSingleValues;
|
37812 | displayUnitSystem_1.update(Math.max(Math.abs(options.value || 0), Math.abs(options.value2 || 0)));
|
37813 | var decimals_1, forcePrecision_1 = null != options.precision;
|
37814 | if (forcePrecision_1 ? decimals_1 = -options.precision : displayUnitSystem_1.displayUnit && displayUnitSystem_1.displayUnit.value > 1 && (decimals_1 = -MaxScaledDecimalPlaces),
|
37815 | options.detectAxisPrecision) {
|
37816 | forcePrecision_1 = !0;
|
37817 | var axisValue = options.value;
|
37818 | displayUnitSystem_1.displayUnit && displayUnitSystem_1.displayUnit.value > 0 && (axisValue /= displayUnitSystem_1.displayUnit.value),
|
37819 | powerbi.Double.isInteger(axisValue) ? decimals_1 = 0 : (decimals_1 = powerbi.Double.log10(axisValue),
|
37820 | format && valueFormatter.getFormatMetadata(format).hasPercent && (decimals_1 = 0 > decimals_1 ? Math.min(0, decimals_1 + 2) : 0));
|
37821 | }
|
37822 | return {
|
37823 | format: function(value) {
|
37824 | var formattedValue = getStringFormat(value, !0);
|
37825 | return StringExtensions.isNullOrUndefinedOrWhiteSpaceString(formattedValue) ? (value && !displayUnitSystem_1.isScalingUnit() && Math.abs(value) < MaxValueForDisplayUnitRounding && !forcePrecision_1 && (value = powerbi.Double.roundToPrecision(value)),
|
37826 | singleValueFormattingMode_1 ? displayUnitSystem_1.formatSingleValue(value, format, decimals_1, forcePrecision_1) : displayUnitSystem_1.format(value, format, decimals_1, forcePrecision_1)) : formattedValue;
|
37827 | },
|
37828 | displayUnit: displayUnitSystem_1.displayUnit,
|
37829 | options: options
|
37830 | };
|
37831 | }
|
37832 | if (shouldUseDateUnits(options.value, options.value2, options.tickCount)) {
|
37833 | var unit_1 = powerbi.DateTimeSequence.getIntervalUnit(options.value, options.value2, options.tickCount);
|
37834 | return {
|
37835 | format: function(value) {
|
37836 | if (null == value) return locale["null"];
|
37837 | var formatString = powerbi.formattingService.dateFormatString(unit_1);
|
37838 | return formatCore(value, formatString);
|
37839 | },
|
37840 | options: options
|
37841 | };
|
37842 | }
|
37843 | return createDefaultFormatter(format);
|
37844 | }
|
37845 | function format(value, format, allowFormatBeautification) {
|
37846 | return null == value ? locale["null"] : formatCore(value, allowFormatBeautification ? locale.beautify(format) : format);
|
37847 | }
|
37848 | function formatVariantMeasureValue(value, column, formatStringProp, nullsAreBlank) {
|
37849 | if (!(column && column.type && column.type.dateTime) && value instanceof Date) {
|
37850 | var valueFormat = getFormatString(DateTimeMetadataColumn, null, !1);
|
37851 | return formatCore(value, valueFormat, nullsAreBlank);
|
37852 | }
|
37853 | return formatCore(value, getFormatString(column, formatStringProp), nullsAreBlank);
|
37854 | }
|
37855 | function createDisplayUnitSystem(displayUnitSystemType) {
|
37856 | if (null == displayUnitSystemType) return new powerbi.DefaultDisplayUnitSystem(locale.describe);
|
37857 | switch (displayUnitSystemType) {
|
37858 | case powerbi.DisplayUnitSystemType.Default:
|
37859 | return new powerbi.DefaultDisplayUnitSystem(locale.describe);
|
37860 |
|
37861 | case powerbi.DisplayUnitSystemType.WholeUnits:
|
37862 | return new powerbi.WholeUnitsDisplayUnitSystem(locale.describe);
|
37863 |
|
37864 | case powerbi.DisplayUnitSystemType.Verbose:
|
37865 | return new powerbi.NoDisplayUnitSystem();
|
37866 |
|
37867 | case powerbi.DisplayUnitSystemType.DataLabels:
|
37868 | return new powerbi.DataLabelsDisplayUnitSystem(locale.describe);
|
37869 |
|
37870 | default:
|
37871 | return new powerbi.DefaultDisplayUnitSystem(locale.describe);
|
37872 | }
|
37873 | }
|
37874 | function shouldUseNumericDisplayUnits(options) {
|
37875 | var value = options.value, value2 = options.value2, format = options.format;
|
37876 | if (options.formatSingleValues && format && Math.abs(value) < MinIntegerValueForDisplayUnits) {
|
37877 | var isCustomFormat = !powerbi.NumberFormat.isStandardFormat(format);
|
37878 | if (isCustomFormat) {
|
37879 | var precision = powerbi.NumberFormat.getCustomFormatMetadata(format, !0).precision;
|
37880 | if (MinPrecisionForDisplayUnits > precision) return !1;
|
37881 | } else if (powerbi.Double.isInteger(value)) return !1;
|
37882 | }
|
37883 | return "number" == typeof value || "number" == typeof value2 ? !0 : void 0;
|
37884 | }
|
37885 | function shouldUseDateUnits(value, value2, tickCount) {
|
37886 | return value instanceof Date && value2 instanceof Date && void 0 !== tickCount && null !== tickCount;
|
37887 | }
|
37888 | function getFormatString(column, formatStringProperty, suppressTypeFallback) {
|
37889 | if (column) {
|
37890 | if (formatStringProperty) {
|
37891 | var propertyValue = powerbi.DataViewObjects.getValue(column.objects, formatStringProperty);
|
37892 | if (propertyValue) return propertyValue;
|
37893 | }
|
37894 | if (!suppressTypeFallback) {
|
37895 | var columnType = column.type;
|
37896 | if (columnType) {
|
37897 | if (columnType.dateTime) return valueFormatter.DefaultDateFormat;
|
37898 | if (columnType.integer) return valueFormatter.DefaultIntegerFormat;
|
37899 | if (columnType.numeric) return valueFormatter.DefaultNumericFormat;
|
37900 | }
|
37901 | }
|
37902 | }
|
37903 | }
|
37904 | function formatListCompound(strings, conjunction) {
|
37905 | var result;
|
37906 | if (!strings) return null;
|
37907 | var length = strings.length;
|
37908 | if (length > 0) {
|
37909 | result = strings[0];
|
37910 | for (var lastIndex = length - 1, i = 1, len = lastIndex; len > i; i++) {
|
37911 | var value = strings[i];
|
37912 | result = StringExtensions.format(locale.restatementComma, result, value);
|
37913 | }
|
37914 | if (length > 1) {
|
37915 | var value = strings[lastIndex];
|
37916 | result = StringExtensions.format(conjunction, result, value);
|
37917 | }
|
37918 | } else result = null;
|
37919 | return result;
|
37920 | }
|
37921 | function formatListAnd(strings) {
|
37922 | return formatListCompound(strings, locale.restatementCompoundAnd);
|
37923 | }
|
37924 | function formatListOr(strings) {
|
37925 | return formatListCompound(strings, locale.restatementCompoundOr);
|
37926 | }
|
37927 | function formatCore(value, format, nullsAreBlank) {
|
37928 | var formattedValue = getStringFormat(value, nullsAreBlank ? nullsAreBlank : !1);
|
37929 | return StringExtensions.isNullOrUndefinedOrWhiteSpaceString(formattedValue) ? powerbi.formattingService.formatValue(value, format) : formattedValue;
|
37930 | }
|
37931 | function getStringFormat(value, nullsAreBlank) {
|
37932 | return null == value && nullsAreBlank ? locale["null"] : value === !0 ? locale["true"] : value === !1 ? locale["false"] : "number" == typeof value && isNaN(value) ? locale.NaN : value === Number.NEGATIVE_INFINITY ? locale.negativeInfinity : value === Number.POSITIVE_INFINITY ? locale.infinity : "";
|
37933 | }
|
37934 | function getDisplayUnits(displayUnitSystemType) {
|
37935 | var displayUnitSystem = createDisplayUnitSystem(displayUnitSystemType);
|
37936 | return displayUnitSystem.units;
|
37937 | }
|
37938 | var StringExtensions = jsCommon.StringExtensions, BeautifiedFormat = {
|
37939 | "0.00 %;-0.00 %;0.00 %": "Percentage",
|
37940 | "0.0 %;-0.0 %;0.0 %": "Percentage1"
|
37941 | };
|
37942 | valueFormatter.DefaultIntegerFormat = "g", valueFormatter.DefaultNumericFormat = "#,0.00",
|
37943 | valueFormatter.DefaultDateFormat = "d";
|
37944 | var defaultLocalizedStrings = {
|
37945 | NullValue: "(Blank)",
|
37946 | BooleanTrue: "True",
|
37947 | BooleanFalse: "False",
|
37948 | NaNValue: "NaN",
|
37949 | InfinityValue: "+Infinity",
|
37950 | NegativeInfinityValue: "-Infinity",
|
37951 | RestatementComma: "{0}, {1}",
|
37952 | RestatementCompoundAnd: "{0} and {1}",
|
37953 | RestatementCompoundOr: "{0} or {1}",
|
37954 | DisplayUnitSystem_EAuto_Title: "Auto",
|
37955 | DisplayUnitSystem_E0_Title: "None",
|
37956 | DisplayUnitSystem_E3_LabelFormat: "{0}K",
|
37957 | DisplayUnitSystem_E3_Title: "Thousands",
|
37958 | DisplayUnitSystem_E6_LabelFormat: "{0}M",
|
37959 | DisplayUnitSystem_E6_Title: "Millions",
|
37960 | DisplayUnitSystem_E9_LabelFormat: "{0}bn",
|
37961 | DisplayUnitSystem_E9_Title: "Billions",
|
37962 | DisplayUnitSystem_E12_LabelFormat: "{0}T",
|
37963 | DisplayUnitSystem_E12_Title: "Trillions",
|
37964 | Percentage: "#,0.##%",
|
37965 | Percentage1: "#,0.#%",
|
37966 | TableTotalLabel: "Total",
|
37967 | Tooltip_HighlightedValueDisplayName: "Highlighted",
|
37968 | Funnel_PercentOfFirst: "Percent of first",
|
37969 | Funnel_PercentOfPrevious: "Percent of previous",
|
37970 | Funnel_PercentOfFirst_Highlight: "Percent of first (highlighted)",
|
37971 | Funnel_PercentOfPrevious_Highlight: "Percent of previous (highlighted)",
|
37972 | GeotaggingString_Continent: "continent",
|
37973 | GeotaggingString_Continents: "continents",
|
37974 | GeotaggingString_Country: "country",
|
37975 | GeotaggingString_Countries: "countries",
|
37976 | GeotaggingString_State: "state",
|
37977 | GeotaggingString_States: "states",
|
37978 | GeotaggingString_City: "city",
|
37979 | GeotaggingString_Cities: "cities",
|
37980 | GeotaggingString_Town: "town",
|
37981 | GeotaggingString_Towns: "towns",
|
37982 | GeotaggingString_Province: "province",
|
37983 | GeotaggingString_Provinces: "provinces",
|
37984 | GeotaggingString_County: "county",
|
37985 | GeotaggingString_Counties: "counties",
|
37986 | GeotaggingString_Village: "village",
|
37987 | GeotaggingString_Villages: "villages",
|
37988 | GeotaggingString_Post: "post",
|
37989 | GeotaggingString_Zip: "zip",
|
37990 | GeotaggingString_Code: "code",
|
37991 | GeotaggingString_Place: "place",
|
37992 | GeotaggingString_Places: "places",
|
37993 | GeotaggingString_Address: "address",
|
37994 | GeotaggingString_Addresses: "addresses",
|
37995 | GeotaggingString_Street: "street",
|
37996 | GeotaggingString_Streets: "streets",
|
37997 | GeotaggingString_Longitude: "longitude",
|
37998 | GeotaggingString_Longitude_Short: "lon",
|
37999 | GeotaggingString_Longitude_Short2: "long",
|
38000 | GeotaggingString_Latitude: "latitude",
|
38001 | GeotaggingString_Latitude_Short: "lat",
|
38002 | GeotaggingString_PostalCode: "postal code",
|
38003 | GeotaggingString_PostalCodes: "postal codes",
|
38004 | GeotaggingString_ZipCode: "zip code",
|
38005 | GeotaggingString_ZipCodes: "zip codes",
|
38006 | GeotaggingString_Territory: "territory",
|
38007 | GeotaggingString_Territories: "territories"
|
38008 | };
|
38009 | valueFormatter.getLocalizedString = getLocalizedString;
|
38010 | var locale = {
|
38011 | "null": defaultLocalizedStrings.NullValue,
|
38012 | "true": defaultLocalizedStrings.BooleanTrue,
|
38013 | "false": defaultLocalizedStrings.BooleanFalse,
|
38014 | NaN: defaultLocalizedStrings.NaNValue,
|
38015 | infinity: defaultLocalizedStrings.InfinityValue,
|
38016 | negativeInfinity: defaultLocalizedStrings.NegativeInfinityValue,
|
38017 | beautify: function(format) {
|
38018 | return beautify(format);
|
38019 | },
|
38020 | describe: function(exponent) {
|
38021 | return describeUnit(exponent);
|
38022 | },
|
38023 | restatementComma: defaultLocalizedStrings.RestatementComma,
|
38024 | restatementCompoundAnd: defaultLocalizedStrings.RestatementCompoundAnd,
|
38025 | restatementCompoundOr: defaultLocalizedStrings.RestatementCompoundOr
|
38026 | }, MaxScaledDecimalPlaces = 2, MaxValueForDisplayUnitRounding = 1e3, MinIntegerValueForDisplayUnits = 1e4, MinPrecisionForDisplayUnits = 2, DateTimeMetadataColumn = {
|
38027 | displayName: "",
|
38028 | type: powerbi.ValueType.fromPrimitiveTypeAndCategory(powerbi.PrimitiveType.DateTime)
|
38029 | };
|
38030 | valueFormatter.getFormatMetadata = getFormatMetadata, valueFormatter.setLocaleOptions = setLocaleOptions,
|
38031 | valueFormatter.createDefaultFormatter = createDefaultFormatter, valueFormatter.create = create,
|
38032 | valueFormatter.format = format, valueFormatter.formatVariantMeasureValue = formatVariantMeasureValue,
|
38033 | valueFormatter.getFormatString = getFormatString, valueFormatter.formatListAnd = formatListAnd,
|
38034 | valueFormatter.formatListOr = formatListOr, valueFormatter.getDisplayUnits = getDisplayUnits;
|
38035 | }(valueFormatter = visuals.valueFormatter || (visuals.valueFormatter = {}));
|
38036 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
38037 | }(powerbi || (powerbi = {}));
|
38038 | }, function(module, exports) {
|
38039 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
38040 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
38041 | !function(powerbi) {
|
38042 | var data;
|
38043 | !function(data) {
|
38044 | var DataViewMatrixUtils, inherit = powerbi.Prototype.inherit, inheritSingle = powerbi.Prototype.inheritSingle, ArrayExtensions = jsCommon.ArrayExtensions;
|
38045 | !function(DataViewMatrixUtils) {
|
38046 | function isLeafNode(node) {
|
38047 | return _.isEmpty(node.children);
|
38048 | }
|
38049 | function forEachNodeDepthFirst(rootNodes, callback) {
|
38050 | if (rootNodes) if (isNodeArray(rootNodes)) for (var _i = 0, rootNodes_1 = rootNodes; _i < rootNodes_1.length; _i++) {
|
38051 | var rootNode = rootNodes_1[_i];
|
38052 | rootNode && forEachNodeDepthFirstRecursive(rootNode, [], callback);
|
38053 | } else forEachNodeDepthFirstRecursive(rootNodes, [], callback);
|
38054 | }
|
38055 | function forEachNodeDepthFirstRecursive(matrixNode, traversalPath, callback) {
|
38056 | traversalPath.push(matrixNode);
|
38057 | var traversalResult = callback(matrixNode, traversalPath), shouldContinue = !!traversalResult && 0 !== traversalResult;
|
38058 | if (1 === traversalResult) {
|
38059 | var childNodes = matrixNode.children;
|
38060 | if (!_.isEmpty(childNodes)) for (var _i = 0, childNodes_1 = childNodes; _i < childNodes_1.length; _i++) {
|
38061 | var nextChild = childNodes_1[_i];
|
38062 | if (nextChild && (shouldContinue = forEachNodeDepthFirstRecursive(nextChild, traversalPath, callback),
|
38063 | !shouldContinue)) break;
|
38064 | }
|
38065 | }
|
38066 | return traversalPath.pop(), shouldContinue;
|
38067 | }
|
38068 | function forEachLeafNode(rootNodes, callback) {
|
38069 | var nextLeafNodeIndex = 0;
|
38070 | forEachNodeDepthFirst(rootNodes, function(node, traversalPath) {
|
38071 | return isLeafNode(node) && (callback(node, nextLeafNodeIndex, traversalPath), nextLeafNodeIndex++),
|
38072 | 1;
|
38073 | });
|
38074 | }
|
38075 | function isNodeArray(nodeOrNodeArray) {
|
38076 | return ArrayExtensions.isArrayOrInheritedArray(nodeOrNodeArray);
|
38077 | }
|
38078 | function forEachNodeAtLevel(node, targetLevel, callback) {
|
38079 | if (node.level === targetLevel) return void callback(node);
|
38080 | var children = node.children;
|
38081 | if (children && children.length > 0) for (var i = 0, ilen = children.length; ilen > i; i++) forEachNodeAtLevel(children[i], targetLevel, callback);
|
38082 | }
|
38083 | function inheritMatrixNodeHierarchy(node, deepestLevelToInherit, useInheritSingle) {
|
38084 | var returnNode = node, isRootNode = void 0 === node.level, shouldInheritCurrentNode = isRootNode || node.level <= deepestLevelToInherit;
|
38085 | if (shouldInheritCurrentNode) {
|
38086 | var inheritFunc = useInheritSingle ? inheritSingle : inherit, inheritedNode = inheritFunc(node), shouldInheritChildNodes = isRootNode || node.level < deepestLevelToInherit;
|
38087 | if (shouldInheritChildNodes && !_.isEmpty(node.children)) {
|
38088 | inheritedNode.children = inheritFunc(node.children);
|
38089 | for (var i = 0, ilen = inheritedNode.children.length; ilen > i; i++) inheritedNode.children[i] = inheritMatrixNodeHierarchy(inheritedNode.children[i], deepestLevelToInherit, useInheritSingle);
|
38090 | }
|
38091 | returnNode = inheritedNode;
|
38092 | }
|
38093 | return returnNode;
|
38094 | }
|
38095 | function containsCompositeGroup(matrixOrHierarchy) {
|
38096 | var hasCompositeGroup = !1;
|
38097 | if (matrixOrHierarchy) if (isMatrix(matrixOrHierarchy)) hasCompositeGroup = containsCompositeGroup(matrixOrHierarchy.rows) || containsCompositeGroup(matrixOrHierarchy.columns); else {
|
38098 | var hierarchyLevels = matrixOrHierarchy.levels;
|
38099 | if (!_.isEmpty(hierarchyLevels)) for (var _i = 0, hierarchyLevels_1 = hierarchyLevels; _i < hierarchyLevels_1.length; _i++) {
|
38100 | var level = hierarchyLevels_1[_i];
|
38101 | if (level.sources && level.sources.length >= 2) {
|
38102 | var isMeasureHeadersLevel = level.sources[0].isMeasure;
|
38103 | if (!isMeasureHeadersLevel) {
|
38104 | hasCompositeGroup = !0;
|
38105 | break;
|
38106 | }
|
38107 | }
|
38108 | }
|
38109 | }
|
38110 | return hasCompositeGroup;
|
38111 | }
|
38112 | function isMatrix(matrixOrHierarchy) {
|
38113 | return "rows" in matrixOrHierarchy && "columns" in matrixOrHierarchy && "valueSources" in matrixOrHierarchy;
|
38114 | }
|
38115 | DataViewMatrixUtils.isLeafNode = isLeafNode, DataViewMatrixUtils.forEachNodeDepthFirst = forEachNodeDepthFirst,
|
38116 | DataViewMatrixUtils.forEachLeafNode = forEachLeafNode, DataViewMatrixUtils.forEachNodeAtLevel = forEachNodeAtLevel,
|
38117 | DataViewMatrixUtils.inheritMatrixNodeHierarchy = inheritMatrixNodeHierarchy, DataViewMatrixUtils.containsCompositeGroup = containsCompositeGroup;
|
38118 | }(DataViewMatrixUtils = data.DataViewMatrixUtils || (data.DataViewMatrixUtils = {}));
|
38119 | }(data = powerbi.data || (powerbi.data = {}));
|
38120 | }(powerbi || (powerbi = {}));
|
38121 | }, function(module, exports) {
|
38122 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
38123 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
38124 | !function(powerbi) {
|
38125 | var data;
|
38126 | !function(data) {
|
38127 | var DataViewMetadataColumnUtils;
|
38128 | !function(DataViewMetadataColumnUtils) {
|
38129 | function isForRole(metadataColumn, targetRole) {
|
38130 | var roles = metadataColumn.roles;
|
38131 | return !!roles && !!roles[targetRole];
|
38132 | }
|
38133 | function isForAnyRole(metadataColumn, targetRoles) {
|
38134 | var roles = metadataColumn.roles;
|
38135 | return !!roles && _.any(targetRoles, function(targetRole) {
|
38136 | return roles[targetRole];
|
38137 | });
|
38138 | }
|
38139 | function leftJoinMetadataColumnsAndProjectionOrder(columnSources, projectionOrdering, roles) {
|
38140 | var jointResult = [];
|
38141 | if (!_.isEmpty(columnSources)) for (var selectIndexToProjectionIndicesMap = createSelectIndexToProjectionOrderIndicesMapping(projectionOrdering), j = 0, jlen = columnSources.length; jlen > j; j++) {
|
38142 | var column = columnSources[j];
|
38143 | if (isForAnyRole(column, roles)) {
|
38144 | var projectionIndices = selectIndexToProjectionIndicesMap[column.index];
|
38145 | if (_.isEmpty(projectionIndices)) {
|
38146 | var jointColumnInfo = {
|
38147 | metadataColumn: column,
|
38148 | sourceIndex: j,
|
38149 | projectionOrderIndex: void 0
|
38150 | };
|
38151 | jointResult.push(jointColumnInfo);
|
38152 | } else for (var _i = 0, projectionIndices_1 = projectionIndices; _i < projectionIndices_1.length; _i++) {
|
38153 | var projectionIndex = projectionIndices_1[_i], jointColumnInfo = {
|
38154 | metadataColumn: column,
|
38155 | sourceIndex: j,
|
38156 | projectionOrderIndex: projectionIndex
|
38157 | };
|
38158 | jointResult.push(jointColumnInfo);
|
38159 | }
|
38160 | }
|
38161 | }
|
38162 | return jointResult;
|
38163 | }
|
38164 | function createSelectIndexToProjectionOrderIndicesMapping(selectIndicesByProjectionOrder) {
|
38165 | for (var selectIndexToProjectionIndicesMap = {}, i = 0, ilen = selectIndicesByProjectionOrder.length; ilen > i; i++) {
|
38166 | var selectIndex = selectIndicesByProjectionOrder[i], projectionOrders = selectIndexToProjectionIndicesMap[selectIndex];
|
38167 | projectionOrders || (projectionOrders = selectIndexToProjectionIndicesMap[selectIndex] = []),
|
38168 | projectionOrders.push(i);
|
38169 | }
|
38170 | return selectIndexToProjectionIndicesMap;
|
38171 | }
|
38172 | DataViewMetadataColumnUtils.isForRole = isForRole, DataViewMetadataColumnUtils.isForAnyRole = isForAnyRole,
|
38173 | DataViewMetadataColumnUtils.leftJoinMetadataColumnsAndProjectionOrder = leftJoinMetadataColumnsAndProjectionOrder;
|
38174 | }(DataViewMetadataColumnUtils = data.DataViewMetadataColumnUtils || (data.DataViewMetadataColumnUtils = {}));
|
38175 | }(data = powerbi.data || (powerbi.data = {}));
|
38176 | }(powerbi || (powerbi = {}));
|
38177 | }, function(module, exports) {
|
38178 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
38179 | window.jasmine, window.Microsoft;
|
38180 | }, function(module, exports) {
|
38181 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
38182 | window.jasmine, window.Microsoft;
|
38183 | }, function(module, exports) {
|
38184 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
38185 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
38186 | !function(powerbi) {
|
38187 | var data;
|
38188 | !function(data) {
|
38189 | var DataRoleHelper;
|
38190 | !function(DataRoleHelper) {
|
38191 | function getMeasureIndexOfRole(grouped, roleName) {
|
38192 | if (!_.isEmpty(grouped)) {
|
38193 | var firstGroup = grouped[0];
|
38194 | if (firstGroup.values && firstGroup.values.length > 0) for (var i = 0, len = firstGroup.values.length; len > i; ++i) {
|
38195 | var value = firstGroup.values[i];
|
38196 | if (value && value.source && hasRole(value.source, roleName)) return i;
|
38197 | }
|
38198 | }
|
38199 | return -1;
|
38200 | }
|
38201 | function getCategoryIndexOfRole(categories, roleName) {
|
38202 | if (!_.isEmpty(categories)) for (var i = 0, ilen = categories.length; ilen > i; i++) if (hasRole(categories[i].source, roleName)) return i;
|
38203 | return -1;
|
38204 | }
|
38205 | function hasRole(column, name) {
|
38206 | var roles = column.roles;
|
38207 | return roles && roles[name];
|
38208 | }
|
38209 | function hasRoleInDataView(dataView, name) {
|
38210 | return null != dataView && null != dataView.metadata && dataView.metadata.columns && _.any(dataView.metadata.columns, function(c) {
|
38211 | return c.roles && void 0 !== c.roles[name];
|
38212 | });
|
38213 | }
|
38214 | function hasRoleInValueColumn(valueColumn, name) {
|
38215 | return valueColumn && valueColumn.source && valueColumn.source.roles && valueColumn.source.roles[name] === !0;
|
38216 | }
|
38217 | DataRoleHelper.getMeasureIndexOfRole = getMeasureIndexOfRole, DataRoleHelper.getCategoryIndexOfRole = getCategoryIndexOfRole,
|
38218 | DataRoleHelper.hasRole = hasRole, DataRoleHelper.hasRoleInDataView = hasRoleInDataView,
|
38219 | DataRoleHelper.hasRoleInValueColumn = hasRoleInValueColumn;
|
38220 | }(DataRoleHelper = data.DataRoleHelper || (data.DataRoleHelper = {}));
|
38221 | }(data = powerbi.data || (powerbi.data = {}));
|
38222 | }(powerbi || (powerbi = {}));
|
38223 | }, function(module, exports) {
|
38224 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
38225 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
38226 | !function(powerbi) {
|
38227 | var data;
|
38228 | !function(data) {
|
38229 | function createIDataViewCategoricalReader(dataView) {
|
38230 | return new DataViewCategoricalReader(dataView);
|
38231 | }
|
38232 | var DataRoleHelper = powerbi.data.DataRoleHelper;
|
38233 | data.createIDataViewCategoricalReader = createIDataViewCategoricalReader;
|
38234 | var DataViewCategoricalReader = function() {
|
38235 | function DataViewCategoricalReader(dataView) {
|
38236 | this.dataView = dataView;
|
38237 | var categorical;
|
38238 | dataView && (categorical = dataView.categorical);
|
38239 | var categories;
|
38240 | categorical && (categories = this.categories = categorical.categories), this.hasValidCategories = !_.isEmpty(categories);
|
38241 | var values;
|
38242 | if (categorical && (values = categorical.values), this.hasAnyValidValues = !1, null != values) {
|
38243 | var grouped = dataView.categorical.values.grouped();
|
38244 | if (grouped.length > 0) {
|
38245 | this.hasAnyValidValues = !0, this.grouped = grouped;
|
38246 | for (var valueRoleIndexMapping = {}, firstGroupValues = grouped[0].values, valueIndex = 0, valueCount = firstGroupValues.length; valueCount > valueIndex; valueIndex++) {
|
38247 | var valueRoles = firstGroupValues[valueIndex].source.roles;
|
38248 | for (var role in valueRoles) valueRoles[role] && (valueRoleIndexMapping[role] || (valueRoleIndexMapping[role] = []),
|
38249 | valueRoleIndexMapping[role].push(valueIndex));
|
38250 | }
|
38251 | this.valueRoleIndexMapping = valueRoleIndexMapping;
|
38252 | }
|
38253 | }
|
38254 | this.hasAnyValidValues && (this.dataHasDynamicSeries = !!this.dataView.categorical.values.source);
|
38255 | }
|
38256 | return DataViewCategoricalReader.prototype.hasCategories = function() {
|
38257 | return this.hasValidCategories;
|
38258 | }, DataViewCategoricalReader.prototype.getCategoryCount = function() {
|
38259 | return this.hasValidCategories ? this.categories[0].values.length : 0;
|
38260 | }, DataViewCategoricalReader.prototype.getCategoryValues = function(roleName) {
|
38261 | if (this.hasValidCategories) {
|
38262 | var categories = this.getCategoryFromRole(roleName);
|
38263 | return categories ? categories.values : void 0;
|
38264 | }
|
38265 | }, DataViewCategoricalReader.prototype.getCategoryValue = function(roleName, categoryIndex) {
|
38266 | if (this.hasValidCategories) {
|
38267 | var categories = this.getCategoryFromRole(roleName);
|
38268 | return categories ? categories.values[categoryIndex] : void 0;
|
38269 | }
|
38270 | }, DataViewCategoricalReader.prototype.getCategoryColumn = function(roleName) {
|
38271 | return this.hasValidCategories ? this.getCategoryFromRole(roleName) : void 0;
|
38272 | }, DataViewCategoricalReader.prototype.getCategoryMetadataColumn = function(roleName) {
|
38273 | if (this.hasValidCategories) {
|
38274 | var categories = this.getCategoryFromRole(roleName);
|
38275 | return categories ? categories.source : void 0;
|
38276 | }
|
38277 | }, DataViewCategoricalReader.prototype.getCategoryColumnIdentityFields = function(roleName) {
|
38278 | if (this.hasValidCategories) {
|
38279 | var categories = this.getCategoryFromRole(roleName);
|
38280 | return categories ? categories.identityFields : void 0;
|
38281 | }
|
38282 | }, DataViewCategoricalReader.prototype.getCategoryDisplayName = function(roleName) {
|
38283 | if (this.hasValidCategories) {
|
38284 | var targetColumn = this.getCategoryColumn(roleName);
|
38285 | if (targetColumn && targetColumn.source) return targetColumn.source.displayName;
|
38286 | }
|
38287 | }, DataViewCategoricalReader.prototype.hasCompositeCategories = function() {
|
38288 | return this.hasValidCategories ? this.categories.length > 1 : void 0;
|
38289 | }, DataViewCategoricalReader.prototype.hasCategoryWithRole = function(roleName) {
|
38290 | return -1 !== DataRoleHelper.getCategoryIndexOfRole(this.categories, roleName);
|
38291 | }, DataViewCategoricalReader.prototype.getCategoryObjects = function(roleName, categoryIndex) {
|
38292 | if (this.hasValidCategories) {
|
38293 | var category = this.getCategoryFromRole(roleName);
|
38294 | if (category && category.objects) return category.objects[categoryIndex];
|
38295 | }
|
38296 | }, DataViewCategoricalReader.prototype.getCategoryFromRole = function(roleName) {
|
38297 | var categories = this.categories;
|
38298 | return categories[DataRoleHelper.getCategoryIndexOfRole(categories, roleName)];
|
38299 | }, DataViewCategoricalReader.prototype.hasValues = function(roleName) {
|
38300 | return this.valueRoleIndexMapping && !_.isEmpty(this.valueRoleIndexMapping[roleName]);
|
38301 | }, DataViewCategoricalReader.prototype.hasHighlights = function(roleName) {
|
38302 | return this.hasValues(roleName) ? !_.isEmpty(this.grouped[0].values[this.valueRoleIndexMapping[roleName][0]].highlights) : !1;
|
38303 | }, DataViewCategoricalReader.prototype.getValue = function(roleName, categoryIndex, seriesIndex) {
|
38304 | return void 0 === seriesIndex && (seriesIndex = 0), this.hasValues(roleName) ? this.dataHasDynamicSeries ? this.getValueInternal(roleName, categoryIndex, seriesIndex, 0, !1) : this.getValueInternal(roleName, categoryIndex, 0, seriesIndex, !1) : void 0;
|
38305 | }, DataViewCategoricalReader.prototype.getHighlight = function(roleName, categoryIndex, seriesIndex) {
|
38306 | return void 0 === seriesIndex && (seriesIndex = 0), this.hasValues(roleName) ? this.dataHasDynamicSeries ? this.getValueInternal(roleName, categoryIndex, seriesIndex, 0, !0) : this.getValueInternal(roleName, categoryIndex, 0, seriesIndex, !0) : void 0;
|
38307 | }, DataViewCategoricalReader.prototype.getAllValuesForRole = function(roleName, categoryIndex, seriesIndex) {
|
38308 | if (void 0 === seriesIndex && (seriesIndex = 0), this.hasValues(roleName)) {
|
38309 | for (var valuesInRole = [], roleValueIndex = 0, roleValueCount = this.valueRoleIndexMapping[roleName].length; roleValueCount > roleValueIndex; roleValueIndex++) valuesInRole.push(this.getValueInternal(roleName, categoryIndex, seriesIndex, roleValueIndex, !1));
|
38310 | return valuesInRole;
|
38311 | }
|
38312 | }, DataViewCategoricalReader.prototype.getAllHighlightsForRole = function(roleName, categoryIndex, seriesIndex) {
|
38313 | if (void 0 === seriesIndex && (seriesIndex = 0), this.hasValues(roleName)) {
|
38314 | for (var valuesInRole = [], roleValueIndex = 0, roleValueCount = this.valueRoleIndexMapping[roleName].length; roleValueCount > roleValueIndex; roleValueIndex++) valuesInRole.push(this.getValueInternal(roleName, categoryIndex, seriesIndex, roleValueIndex, !0));
|
38315 | return valuesInRole;
|
38316 | }
|
38317 | }, DataViewCategoricalReader.prototype.getValueInternal = function(roleName, categoryIndex, groupIndex, valueColumnIndexInRole, getHighlight) {
|
38318 | if (this.hasValues(roleName)) {
|
38319 | var valueColumnIndex = this.valueRoleIndexMapping[roleName][valueColumnIndexInRole], groupedValues = this.grouped[groupIndex].values[valueColumnIndex];
|
38320 | return getHighlight ? groupedValues.highlights[categoryIndex] : groupedValues.values[categoryIndex];
|
38321 | }
|
38322 | }, DataViewCategoricalReader.prototype.getFirstNonNullValueForCategory = function(roleName, categoryIndex) {
|
38323 | if (this.hasValues(roleName)) {
|
38324 | if (!this.dataHasDynamicSeries) return this.getValue(roleName, categoryIndex);
|
38325 | for (var seriesIndex = 0, seriesCount = this.grouped.length; seriesCount > seriesIndex; seriesIndex++) {
|
38326 | var value = this.getValue(roleName, categoryIndex, seriesIndex);
|
38327 | if (null != value) return value;
|
38328 | }
|
38329 | }
|
38330 | }, DataViewCategoricalReader.prototype.getMeasureQueryName = function(roleName) {
|
38331 | return this.hasValues(roleName) ? this.grouped[0].values[this.valueRoleIndexMapping[roleName][0]].source.queryName : void 0;
|
38332 | }, DataViewCategoricalReader.prototype.getValueColumn = function(roleName, seriesIndex) {
|
38333 | return void 0 === seriesIndex && (seriesIndex = 0), this.hasValues(roleName) ? this.dataHasDynamicSeries ? this.grouped[seriesIndex].values[this.valueRoleIndexMapping[roleName][0]] : this.grouped[0].values[this.valueRoleIndexMapping[roleName][seriesIndex]] : void 0;
|
38334 | }, DataViewCategoricalReader.prototype.getValueMetadataColumn = function(roleName, seriesIndex) {
|
38335 | void 0 === seriesIndex && (seriesIndex = 0);
|
38336 | var valueColumn = this.getValueColumn(roleName, seriesIndex);
|
38337 | return valueColumn ? valueColumn.source : void 0;
|
38338 | }, DataViewCategoricalReader.prototype.getAllValueMetadataColumnsForRole = function(roleName, seriesIndex) {
|
38339 | if (void 0 === seriesIndex && (seriesIndex = 0), this.hasValues(roleName)) {
|
38340 | for (var metadata = [], roleValueIndex = 0, roleValueCount = this.valueRoleIndexMapping[roleName].length; roleValueCount > roleValueIndex; roleValueIndex++) {
|
38341 | var column = this.grouped[seriesIndex].values[this.valueRoleIndexMapping[roleName][roleValueIndex]].source;
|
38342 | metadata.push(column);
|
38343 | }
|
38344 | return metadata;
|
38345 | }
|
38346 | }, DataViewCategoricalReader.prototype.getValueDisplayName = function(roleName, seriesIndex) {
|
38347 | if (this.hasValues(roleName)) {
|
38348 | var targetColumn = this.getValueColumn(roleName, seriesIndex);
|
38349 | if (targetColumn && targetColumn.source) return targetColumn.source.displayName;
|
38350 | }
|
38351 | }, DataViewCategoricalReader.prototype.hasDynamicSeries = function() {
|
38352 | return this.dataHasDynamicSeries;
|
38353 | }, DataViewCategoricalReader.prototype.getSeriesCount = function(valueRoleName) {
|
38354 | if (this.hasAnyValidValues) {
|
38355 | if (this.dataHasDynamicSeries) return this.grouped.length;
|
38356 | var roleIndexMap = valueRoleName && this.valueRoleIndexMapping[valueRoleName];
|
38357 | return roleIndexMap ? roleIndexMap.length : 1;
|
38358 | }
|
38359 | }, DataViewCategoricalReader.prototype.getSeriesObjects = function(seriesIndex) {
|
38360 | return this.hasAnyValidValues ? this.grouped[seriesIndex].objects : void 0;
|
38361 | }, DataViewCategoricalReader.prototype.getSeriesValueColumns = function() {
|
38362 | return this.hasAnyValidValues ? this.dataView.categorical.values : void 0;
|
38363 | }, DataViewCategoricalReader.prototype.getSeriesValueColumnGroup = function(seriesIndex) {
|
38364 | return this.hasAnyValidValues ? this.grouped[seriesIndex] : void 0;
|
38365 | }, DataViewCategoricalReader.prototype.getSeriesMetadataColumn = function() {
|
38366 | return this.hasAnyValidValues ? this.dataView.categorical.values.source : void 0;
|
38367 | }, DataViewCategoricalReader.prototype.getSeriesColumnIdentityFields = function() {
|
38368 | return this.hasAnyValidValues ? this.dataView.categorical.values.identityFields : void 0;
|
38369 | }, DataViewCategoricalReader.prototype.getSeriesName = function(seriesIndex) {
|
38370 | return this.hasAnyValidValues ? this.grouped[seriesIndex].name : void 0;
|
38371 | }, DataViewCategoricalReader.prototype.getSeriesDisplayName = function() {
|
38372 | return this.hasAnyValidValues && this.dataHasDynamicSeries ? this.dataView.categorical.values.source.displayName : void 0;
|
38373 | }, DataViewCategoricalReader.prototype.getStaticObjects = function() {
|
38374 | var result = null;
|
38375 | return this.dataView.metadata && this.dataView.metadata.objects && (result = this.dataView.metadata.objects),
|
38376 | result;
|
38377 | }, DataViewCategoricalReader;
|
38378 | }();
|
38379 | }(data = powerbi.data || (powerbi.data = {}));
|
38380 | }(powerbi || (powerbi = {}));
|
38381 | }, function(module, exports) {
|
38382 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
38383 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
38384 | !function(powerbi) {
|
38385 | var data;
|
38386 | !function(data) {
|
38387 | var DataViewConcatenateCategoricalColumns, inherit = powerbi.Prototype.inherit, inheritSingle = powerbi.Prototype.inheritSingle, valueFormatter = powerbi.visuals.valueFormatter;
|
38388 | !function(DataViewConcatenateCategoricalColumns) {
|
38389 | function detectAndApply(dataView, objectDescriptors, roleMappings, projectionOrdering, selects, projectionActiveItems) {
|
38390 | var result = dataView, dataViewCategorical = dataView.categorical;
|
38391 | if (dataViewCategorical) {
|
38392 | var concatenationSource = detectCategoricalRoleForHierarchicalGroup(dataViewCategorical, dataView.metadata, roleMappings, selects, projectionActiveItems);
|
38393 | if (concatenationSource) {
|
38394 | var columnsSortedByProjectionOrdering = sortColumnsByProjectionOrdering(projectionOrdering, concatenationSource.roleName, concatenationSource.categories);
|
38395 | if (columnsSortedByProjectionOrdering.length >= 2) {
|
38396 | var activeItemsToIgnoreInConcatenation = _.chain(projectionActiveItems[concatenationSource.roleName]).filter(function(activeItemInfo) {
|
38397 | return activeItemInfo.suppressConcat;
|
38398 | }).map(function(activeItemInfo) {
|
38399 | return activeItemInfo.queryRef;
|
38400 | }).value();
|
38401 | result = applyConcatenation(dataView, objectDescriptors, concatenationSource.roleName, columnsSortedByProjectionOrdering, activeItemsToIgnoreInConcatenation);
|
38402 | }
|
38403 | }
|
38404 | }
|
38405 | return result;
|
38406 | }
|
38407 | function applyToPlayChartCategorical(metadata, objectDescriptors, categoryRoleName, categorical) {
|
38408 | var result;
|
38409 | if (!_.isEmpty(categorical.categories) && categorical.categories.length >= 2) {
|
38410 | var transformingColumns_1 = inherit(metadata.columns), transformingMetadata = inherit(metadata, function(m) {
|
38411 | m.columns = transformingColumns_1;
|
38412 | }), transformingDataView = {
|
38413 | metadata: transformingMetadata,
|
38414 | categorical: categorical
|
38415 | };
|
38416 | result = applyConcatenation(transformingDataView, objectDescriptors, categoryRoleName, categorical.categories, []);
|
38417 | } else result = {
|
38418 | metadata: metadata,
|
38419 | categorical: categorical
|
38420 | };
|
38421 | return result;
|
38422 | }
|
38423 | function detectCategoricalRoleForHierarchicalGroup(dataViewCategorical, metadata, dataViewMappings, selects, projectionActiveItems) {
|
38424 | var result, roleKinds = data.DataViewSelectTransform.createRoleKindFromMetadata(selects, metadata), projections = data.DataViewSelectTransform.projectionsFromSelects(selects, projectionActiveItems), supportedRoleMappings = powerbi.DataViewAnalysis.chooseDataViewMappings(projections, dataViewMappings, roleKinds).supportedMappings, isEveryRoleMappingForCategorical = !_.isEmpty(supportedRoleMappings) && _.every(supportedRoleMappings, function(roleMapping) {
|
38425 | return !!roleMapping.categorical;
|
38426 | });
|
38427 | if (isEveryRoleMappingForCategorical) {
|
38428 | var targetRoleName_1 = getSingleCategoryRoleNameInEveryRoleMapping(supportedRoleMappings);
|
38429 | if (targetRoleName_1 && isVisualExpectingMaxOneCategoryColumn(targetRoleName_1, supportedRoleMappings)) {
|
38430 | var categoryColumnsForTargetRole_1 = _.filter(dataViewCategorical.categories, function(categoryColumn) {
|
38431 | return categoryColumn.source.roles && !!categoryColumn.source.roles[targetRoleName_1];
|
38432 | });
|
38433 | if (categoryColumnsForTargetRole_1.length >= 2) {
|
38434 | var areValuesCountsEqual = _.every(categoryColumnsForTargetRole_1, function(categoryColumn) {
|
38435 | return categoryColumn.values.length === categoryColumnsForTargetRole_1[0].values.length;
|
38436 | });
|
38437 | areValuesCountsEqual && (result = {
|
38438 | roleName: targetRoleName_1,
|
38439 | categories: categoryColumnsForTargetRole_1
|
38440 | });
|
38441 | }
|
38442 | }
|
38443 | }
|
38444 | return result;
|
38445 | }
|
38446 | function getSingleCategoryRoleNameInEveryRoleMapping(categoricalRoleMappings) {
|
38447 | var result, uniqueCategoryRoles = _.chain(categoricalRoleMappings).map(function(roleMapping) {
|
38448 | var categoryRoles = getAllRolesInCategories(roleMapping.categorical);
|
38449 | return 1 === categoryRoles.length ? categoryRoles[0] : void 0;
|
38450 | }).uniq().value(), isSameCategoryRoleNameInAllRoleMappings = 1 === uniqueCategoryRoles.length && void 0 !== uniqueCategoryRoles[0];
|
38451 | return isSameCategoryRoleNameInAllRoleMappings && (result = uniqueCategoryRoles[0]),
|
38452 | result;
|
38453 | }
|
38454 | function isVisualExpectingMaxOneCategoryColumn(categoricalRoleName, roleMappings) {
|
38455 | var isVisualExpectingMaxOneCategoryColumn = _.every(roleMappings, function(roleMapping) {
|
38456 | return !_.isEmpty(roleMapping.conditions) && _.every(roleMapping.conditions, function(condition) {
|
38457 | return condition[categoricalRoleName] && 1 === condition[categoricalRoleName].max;
|
38458 | });
|
38459 | });
|
38460 | return isVisualExpectingMaxOneCategoryColumn;
|
38461 | }
|
38462 | function getAllRolesInCategories(categoricalRoleMapping) {
|
38463 | var roleNames = [];
|
38464 | return powerbi.DataViewMapping.visitCategoricalCategories(categoricalRoleMapping.categories, {
|
38465 | visitRole: function(roleName) {
|
38466 | roleNames.push(roleName);
|
38467 | }
|
38468 | }), roleNames;
|
38469 | }
|
38470 | function applyConcatenation(dataView, objectDescriptors, roleName, columnsSortedByProjectionOrdering, queryRefsToIgnore) {
|
38471 | var formatStringPropId = data.DataViewObjectDescriptors.findFormatString(objectDescriptors), concatenatedValues = concatenateValues(columnsSortedByProjectionOrdering, queryRefsToIgnore, formatStringPropId), columnsSourceSortedByProjectionOrdering = _.map(columnsSortedByProjectionOrdering, function(categoryColumn) {
|
38472 | return categoryColumn.source;
|
38473 | }), concatenatedColumnMetadata = createConcatenatedColumnMetadata(roleName, columnsSourceSortedByProjectionOrdering, queryRefsToIgnore), transformedDataView = inheritSingle(dataView);
|
38474 | addToMetadata(transformedDataView, concatenatedColumnMetadata);
|
38475 | var dataViewCategorical = dataView.categorical, dataViewObjects = dataViewCategorical.categories[0].objects, concatenatedCategoryColumn = createConcatenatedCategoryColumn(columnsSortedByProjectionOrdering, concatenatedColumnMetadata, concatenatedValues, dataViewObjects), transformedCategoricalCategories = _.difference(dataViewCategorical.categories, columnsSortedByProjectionOrdering);
|
38476 | transformedCategoricalCategories.push(concatenatedCategoryColumn);
|
38477 | var transformedCategorical = inheritSingle(dataViewCategorical);
|
38478 | return transformedCategorical.categories = transformedCategoricalCategories, transformedDataView.categorical = transformedCategorical,
|
38479 | transformedDataView;
|
38480 | }
|
38481 | function concatenateValues(columnsSortedByProjectionOrdering, queryRefsToIgnore, formatStringPropId) {
|
38482 | for (var concatenatedValues = [], _i = 0, columnsSortedByProjectionOrdering_1 = columnsSortedByProjectionOrdering; _i < columnsSortedByProjectionOrdering_1.length; _i++) for (var categoryColumn = columnsSortedByProjectionOrdering_1[_i], formatString = valueFormatter.getFormatString(categoryColumn.source, formatStringPropId), i = 0, len = categoryColumn.values.length; len > i; i++) if (!_.contains(queryRefsToIgnore, categoryColumn.source.queryName)) {
|
38483 | var value = categoryColumn.values && categoryColumn.values[i], formattedValue = valueFormatter.format(value, formatString);
|
38484 | concatenatedValues[i] = void 0 === concatenatedValues[i] ? formattedValue : formattedValue + " " + concatenatedValues[i];
|
38485 | }
|
38486 | return concatenatedValues;
|
38487 | }
|
38488 | function sortColumnsByProjectionOrdering(projectionOrdering, roleName, columns) {
|
38489 | var columnsInProjectionOrdering;
|
38490 | if (projectionOrdering) {
|
38491 | for (var columnsByIndex_1 = {}, _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
|
38492 | var column = columns_1[_i];
|
38493 | column.source.roles[roleName] && (columnsByIndex_1[column.source.index] = column);
|
38494 | }
|
38495 | var columnIndicesInProjectionOrdering = projectionOrdering[roleName];
|
38496 | columnsInProjectionOrdering = _.chain(columnIndicesInProjectionOrdering).map(function(columnIndex) {
|
38497 | return columnsByIndex_1[columnIndex];
|
38498 | }).filter(function(column) {
|
38499 | return !!column;
|
38500 | }).value();
|
38501 | } else columnsInProjectionOrdering = _.filter(columns, function(column) {
|
38502 | return column.source.roles[roleName];
|
38503 | });
|
38504 | return columnsInProjectionOrdering;
|
38505 | }
|
38506 | function createConcatenatedColumnMetadata(roleName, sourceColumnsSortedByProjectionOrdering, queryRefsToIgnore) {
|
38507 | for (var concatenatedDisplayName, _i = 0, sourceColumnsSortedByProjectionOrdering_1 = sourceColumnsSortedByProjectionOrdering; _i < sourceColumnsSortedByProjectionOrdering_1.length; _i++) {
|
38508 | var columnSource = sourceColumnsSortedByProjectionOrdering_1[_i];
|
38509 | _.contains(queryRefsToIgnore, columnSource.queryName) || (concatenatedDisplayName = null == concatenatedDisplayName ? columnSource.displayName : columnSource.displayName + " " + concatenatedDisplayName);
|
38510 | }
|
38511 | var newRoles = {};
|
38512 | newRoles[roleName] = !0;
|
38513 | var newColumnMetadata = {
|
38514 | displayName: concatenatedDisplayName,
|
38515 | roles: newRoles,
|
38516 | type: powerbi.ValueType.fromPrimitiveTypeAndCategory(powerbi.PrimitiveType.Text)
|
38517 | }, columnSourceForCurrentDrillLevel = _.last(sourceColumnsSortedByProjectionOrdering);
|
38518 | return void 0 !== columnSourceForCurrentDrillLevel.isMeasure && (newColumnMetadata.isMeasure = columnSourceForCurrentDrillLevel.isMeasure),
|
38519 | newColumnMetadata.queryName = columnSourceForCurrentDrillLevel.queryName, newColumnMetadata;
|
38520 | }
|
38521 | function addToMetadata(transformedDataView, newColumn) {
|
38522 | var transformedColumns = inheritSingle(transformedDataView.metadata.columns);
|
38523 | transformedColumns.push(newColumn);
|
38524 | var transformedMetadata = inheritSingle(transformedDataView.metadata);
|
38525 | transformedMetadata.columns = transformedColumns, transformedDataView.metadata = transformedMetadata;
|
38526 | }
|
38527 | function createConcatenatedCategoryColumn(sourceColumnsSortedByProjectionOrdering, columnMetadata, concatenatedValues, dataViewObjects) {
|
38528 | var newCategoryColumn = {
|
38529 | source: columnMetadata,
|
38530 | values: concatenatedValues
|
38531 | }, firstColumn = sourceColumnsSortedByProjectionOrdering[0];
|
38532 | return firstColumn.identity && (newCategoryColumn.identity = firstColumn.identity),
|
38533 | firstColumn.identityFields && (newCategoryColumn.identityFields = firstColumn.identityFields),
|
38534 | dataViewObjects && (newCategoryColumn.objects = dataViewObjects), newCategoryColumn;
|
38535 | }
|
38536 | DataViewConcatenateCategoricalColumns.detectAndApply = detectAndApply, DataViewConcatenateCategoricalColumns.applyToPlayChartCategorical = applyToPlayChartCategorical;
|
38537 | }(DataViewConcatenateCategoricalColumns = data.DataViewConcatenateCategoricalColumns || (data.DataViewConcatenateCategoricalColumns = {}));
|
38538 | }(data = powerbi.data || (powerbi.data = {}));
|
38539 | }(powerbi || (powerbi = {}));
|
38540 | }, function(module, exports) {
|
38541 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
38542 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
38543 | !function(powerbi) {
|
38544 | var DataViewMapping;
|
38545 | !function(DataViewMapping) {
|
38546 | function visitMapping(mapping, visitor) {
|
38547 | var categorical = mapping.categorical;
|
38548 | categorical && visitCategorical(categorical, visitor);
|
38549 | var table = mapping.table;
|
38550 | table && visitTable(table, visitor);
|
38551 | var matrix = mapping.matrix;
|
38552 | matrix && visitMatrix(matrix, visitor);
|
38553 | var tree = mapping.tree;
|
38554 | tree && visitTree(tree, visitor);
|
38555 | var single = mapping.single;
|
38556 | single && visitSingle(single, visitor);
|
38557 | }
|
38558 | function visitCategorical(mapping, visitor) {
|
38559 | visitCategoricalCategories(mapping.categories, visitor);
|
38560 | var values = mapping.values;
|
38561 | visitCategoricalValues(values, visitor), visitGrouped(values, visitor);
|
38562 | }
|
38563 | function visitCategoricalCategories(mapping, visitor) {
|
38564 | mapping && (visitBind(mapping, visitor), visitFor(mapping, visitor), visitList(mapping, visitor),
|
38565 | visitReduction(mapping, visitor));
|
38566 | }
|
38567 | function visitCategoricalValues(mapping, visitor) {
|
38568 | if (mapping) {
|
38569 | visitBind(mapping, visitor, 0), visitFor(mapping, visitor, 0), visitList(mapping, visitor, 0);
|
38570 | var group = mapping.group;
|
38571 | if (group) for (var _i = 0, _a = group.select; _i < _a.length; _i++) {
|
38572 | var item = _a[_i];
|
38573 | visitBind(item, visitor, 1), visitFor(item, visitor, 1);
|
38574 | }
|
38575 | }
|
38576 | }
|
38577 | function visitTable(mapping, visitor) {
|
38578 | var rows = mapping.rows;
|
38579 | visitBind(rows, visitor), visitFor(rows, visitor), visitList(rows, visitor), visitReduction(rows, visitor);
|
38580 | }
|
38581 | function visitMatrix(mapping, visitor) {
|
38582 | visitMatrixItems(mapping.rows, visitor), visitMatrixItems(mapping.columns, visitor),
|
38583 | visitMatrixItems(mapping.values, visitor);
|
38584 | }
|
38585 | function visitMatrixItems(mapping, visitor) {
|
38586 | mapping && (visitFor(mapping, visitor), visitList(mapping, visitor), visitReduction(mapping, visitor));
|
38587 | }
|
38588 | function visitTree(mapping, visitor) {
|
38589 | visitTreeNodes(mapping.nodes, visitor), visitTreeValues(mapping.values, visitor);
|
38590 | }
|
38591 | function visitTreeNodes(mapping, visitor) {
|
38592 | mapping && (visitFor(mapping, visitor), visitReduction(mapping, visitor));
|
38593 | }
|
38594 | function visitTreeValues(mapping, visitor) {
|
38595 | mapping && visitFor(mapping, visitor);
|
38596 | }
|
38597 | function visitBind(mapping, visitor, context) {
|
38598 | var bind = mapping.bind;
|
38599 | bind && (null != context ? visitor.visitRole(bind.to, context) : visitor.visitRole(bind.to));
|
38600 | }
|
38601 | function visitFor(mapping, visitor, context) {
|
38602 | var forValue = mapping["for"];
|
38603 | forValue && (null != context ? visitor.visitRole(forValue["in"], context) : visitor.visitRole(forValue["in"]));
|
38604 | }
|
38605 | function visitList(mapping, visitor, context) {
|
38606 | var select = mapping.select;
|
38607 | if (select) for (var _i = 0, select_1 = select; _i < select_1.length; _i++) {
|
38608 | var item = select_1[_i];
|
38609 | visitBind(item, visitor, context), visitFor(item, visitor, context);
|
38610 | }
|
38611 | }
|
38612 | function visitGrouped(mapping, visitor) {
|
38613 | if (mapping) {
|
38614 | var group = mapping.group;
|
38615 | group && (visitor.visitRole(group.by), visitReduction(group, visitor));
|
38616 | }
|
38617 | }
|
38618 | function visitReduction(mapping, visitor) {
|
38619 | if (visitor.visitReduction) {
|
38620 | var reductionAlgorithm = mapping.dataReductionAlgorithm;
|
38621 | reductionAlgorithm && visitor.visitReduction(reductionAlgorithm);
|
38622 | }
|
38623 | }
|
38624 | function visitSingle(mapping, visitor) {
|
38625 | visitor.visitRole(mapping.role);
|
38626 | }
|
38627 | DataViewMapping.visitMapping = visitMapping, DataViewMapping.visitCategorical = visitCategorical,
|
38628 | DataViewMapping.visitCategoricalCategories = visitCategoricalCategories, DataViewMapping.visitCategoricalValues = visitCategoricalValues,
|
38629 | DataViewMapping.visitTable = visitTable, DataViewMapping.visitMatrixItems = visitMatrixItems,
|
38630 | DataViewMapping.visitTreeNodes = visitTreeNodes, DataViewMapping.visitTreeValues = visitTreeValues,
|
38631 | DataViewMapping.visitGrouped = visitGrouped;
|
38632 | }(DataViewMapping = powerbi.DataViewMapping || (powerbi.DataViewMapping = {}));
|
38633 | }(powerbi || (powerbi = {}));
|
38634 | }, function(module, exports) {
|
38635 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
38636 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
38637 | !function(powerbi) {
|
38638 | var data;
|
38639 | !function(data) {
|
38640 | var DataViewNormalizeValues, inheritSingle = powerbi.Prototype.inheritSingle;
|
38641 | !function(DataViewNormalizeValues) {
|
38642 | function apply(options) {
|
38643 | var rolesToNormalize = _.filter(options.dataRoles, function(role) {
|
38644 | return !_.isEmpty(role.requiredTypes);
|
38645 | });
|
38646 | filterVariantMeasures(options.dataview, options.dataViewMappings, rolesToNormalize);
|
38647 | }
|
38648 | function filterVariantMeasures(dataview, dataViewMappings, rolesToNormalize) {
|
38649 | if (!_.isEmpty(dataViewMappings) && !_.isEmpty(rolesToNormalize)) {
|
38650 | for (var columnFilter = generateMetadataColumnFilter(dataview.metadata.columns, rolesToNormalize), valueFilter = generateValueFilter(dataview.metadata.columns, rolesToNormalize), usedMappings = {}, _i = 0, dataViewMappings_1 = dataViewMappings; _i < dataViewMappings_1.length; _i++) {
|
38651 | var dataViewMapping = dataViewMappings_1[_i];
|
38652 | for (var dataViewMappingProp in dataViewMapping) null != dataview[dataViewMappingProp] && (usedMappings[dataViewMappingProp] = !0);
|
38653 | }
|
38654 | usedMappings.categorical && filterVariantMeasuresCategorical(dataview.categorical, columnFilter, valueFilter),
|
38655 | usedMappings.table && filterVariantMeasuresTable(dataview.table, columnFilter, valueFilter),
|
38656 | usedMappings.tree && filterVariantMeasuresTreeNode(dataview.tree.root, columnFilter, valueFilter),
|
38657 | usedMappings.matrix && filterVariantMeasuresMatrix(dataview.matrix, columnFilter, valueFilter),
|
38658 | usedMappings.single && filterVariantMeasuresSingle(dataview, dataViewMappings, rolesToNormalize, valueFilter);
|
38659 | }
|
38660 | }
|
38661 | function generateMetadataColumnFilter(columns, rolesToNormalize) {
|
38662 | if (!columns || !rolesToNormalize) return function() {
|
38663 | return !1;
|
38664 | };
|
38665 | for (var columnsToNormalize = {}, _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
|
38666 | var column = columns_1[_i], roles = column.roles;
|
38667 | if (roles) for (var _a = 0, rolesToNormalize_1 = rolesToNormalize; _a < rolesToNormalize_1.length; _a++) {
|
38668 | var role = rolesToNormalize_1[_a];
|
38669 | if (roles[role.name]) {
|
38670 | columnsToNormalize[column.index] = !0;
|
38671 | break;
|
38672 | }
|
38673 | }
|
38674 | }
|
38675 | return function(columnIndex) {
|
38676 | return isNaN(columnIndex) ? !1 : !!columnsToNormalize[columnIndex];
|
38677 | };
|
38678 | }
|
38679 | function generateValueFilter(columns, rolesToNormalize) {
|
38680 | if (!columns || !rolesToNormalize) return function() {
|
38681 | return !0;
|
38682 | };
|
38683 | for (var columnValueFilters = [], _i = 0, columns_2 = columns; _i < columns_2.length; _i++) {
|
38684 | var column = columns_2[_i], columnValueFilter = generateColumnValueFilter(column, rolesToNormalize);
|
38685 | columnValueFilter && (columnValueFilters[column.index] = columnValueFilter);
|
38686 | }
|
38687 | return function(columnIndex, value) {
|
38688 | return columnValueFilters[columnIndex] ? columnValueFilters[columnIndex](value) : !0;
|
38689 | };
|
38690 | }
|
38691 | function generateColumnValueFilter(column, rolesToNormalize) {
|
38692 | var requiredTypes = getColumnRequiredTypes(column, rolesToNormalize);
|
38693 | if (!_.isEmpty(requiredTypes)) return function(value) {
|
38694 | return doesValueMatchTypes(value, requiredTypes);
|
38695 | };
|
38696 | }
|
38697 | function getColumnRequiredTypes(column, rolesToNormalize) {
|
38698 | var requiredTypes = [], columnRoles = column && column.roles;
|
38699 | if (!columnRoles) return requiredTypes;
|
38700 | for (var _i = 0, rolesToNormalize_2 = rolesToNormalize; _i < rolesToNormalize_2.length; _i++) {
|
38701 | var role = rolesToNormalize_2[_i];
|
38702 | if (columnRoles[role.name]) for (var _a = 0, _b = role.requiredTypes; _a < _b.length; _a++) {
|
38703 | var typeDescriptor = _b[_a], type = powerbi.ValueType.fromDescriptor(typeDescriptor);
|
38704 | requiredTypes.push(type);
|
38705 | }
|
38706 | }
|
38707 | return requiredTypes;
|
38708 | }
|
38709 | function filterVariantMeasuresCategorical(dataview, columnFilter, valueFilter) {
|
38710 | var values = dataview && dataview.values;
|
38711 | if (values) {
|
38712 | var valuesGrouped = values.grouped();
|
38713 | if (valuesGrouped) for (var _i = 0, valuesGrouped_1 = valuesGrouped; _i < valuesGrouped_1.length; _i++) for (var valueGroup = valuesGrouped_1[_i], valuesInGroup = valueGroup.values, _a = 0, valuesInGroup_1 = valuesInGroup; _a < valuesInGroup_1.length; _a++) {
|
38714 | var valueColumn = valuesInGroup_1[_a], columnIndex = valueColumn.source.index;
|
38715 | if (columnFilter(columnIndex)) for (var i = 0, ilen = valueColumn.values.length; ilen > i; i++) valueColumn.values = normalizeVariant(valueColumn.values, i, columnIndex, valueFilter);
|
38716 | }
|
38717 | }
|
38718 | }
|
38719 | function filterVariantMeasuresTable(dataview, columnFilter, valueFilter) {
|
38720 | var columns = dataview && dataview.columns;
|
38721 | if (columns) {
|
38722 | for (var filteredColumns = [], _i = 0, columns_3 = columns; _i < columns_3.length; _i++) {
|
38723 | var column = columns_3[_i];
|
38724 | columnFilter(column.index) && filteredColumns.push(column.index);
|
38725 | }
|
38726 | for (var rows = dataview.rows, i = 0, ilen = rows.length; ilen > i; i++) for (var _a = 0, filteredColumns_1 = filteredColumns; _a < filteredColumns_1.length; _a++) {
|
38727 | var index = filteredColumns_1[_a];
|
38728 | rows[i] = normalizeVariant(rows[i], index, index, valueFilter);
|
38729 | }
|
38730 | }
|
38731 | }
|
38732 | function filterVariantMeasuresTreeNode(node, columnFilter, valueFilter) {
|
38733 | if (node.values) for (var columnIndex in node.values) columnFilter(columnIndex) && ("object" == typeof node.values[columnIndex] && "value" in node.values[columnIndex] ? node.values[columnIndex] = normalizeVariant(node.values[columnIndex], "value", columnIndex, valueFilter) : node.values = normalizeVariant(node.values, columnIndex, columnIndex, valueFilter)); else if (node.children) for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
|
38734 | var child = _a[_i];
|
38735 | filterVariantMeasuresTreeNode(child, columnFilter, valueFilter);
|
38736 | }
|
38737 | }
|
38738 | function filterVariantMeasuresMatrix(dataview, columnFilter, valueFilter) {
|
38739 | var root = dataview && dataview.rows && dataview.rows.root;
|
38740 | root && filterVariantMeasuresMatrixRecursive(dataview, root, columnFilter, valueFilter);
|
38741 | }
|
38742 | function filterVariantMeasuresMatrixRecursive(dataviewMatrix, node, columnFilter, valueFilter) {
|
38743 | if (node.values) for (var id in node.values) {
|
38744 | var nodeValue = node.values[id], valueSourceIndex = nodeValue.valueSourceIndex || 0, columnIndex = dataviewMatrix.valueSources[valueSourceIndex].index;
|
38745 | _.isNumber(columnIndex) && columnFilter(columnIndex) && (node.values[id] = normalizeVariant(nodeValue, "value", columnIndex, valueFilter));
|
38746 | } else if (node.children) for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
|
38747 | var child = _a[_i];
|
38748 | filterVariantMeasuresMatrixRecursive(dataviewMatrix, child, columnFilter, valueFilter);
|
38749 | }
|
38750 | }
|
38751 | function filterVariantMeasuresSingle(dataview, dataViewMappings, rolesToNormalize, valueFilter) {
|
38752 | if (dataview.single) {
|
38753 | for (var roleNames = [], _i = 0, rolesToNormalize_3 = rolesToNormalize; _i < rolesToNormalize_3.length; _i++) {
|
38754 | var role = rolesToNormalize_3[_i];
|
38755 | role.name && roleNames.push(role.name);
|
38756 | }
|
38757 | for (var columns = dataview.metadata.columns, _a = 0, dataViewMappings_2 = dataViewMappings; _a < dataViewMappings_2.length; _a++) {
|
38758 | var dataViewMapping = dataViewMappings_2[_a], roleName = dataViewMapping.single.role;
|
38759 | if (-1 !== roleNames.indexOf(roleName)) {
|
38760 | var column = firstColumnByRoleName(columns, roleName);
|
38761 | return void (column && (dataview.single = normalizeVariant(dataview.single, "value", column.index, valueFilter)));
|
38762 | }
|
38763 | }
|
38764 | }
|
38765 | }
|
38766 | function normalizeVariant(object, key, columnIndex, valueFilter) {
|
38767 | if (object) {
|
38768 | var value = object[key];
|
38769 | return null === value || valueFilter(columnIndex, value) || (object = inheritSingle(object),
|
38770 | object[key] = null), object;
|
38771 | }
|
38772 | }
|
38773 | function doesValueMatchTypes(value, types) {
|
38774 | for (var _i = 0, types_1 = types; _i < types_1.length; _i++) {
|
38775 | var type = types_1[_i];
|
38776 | if (type.numeric || type.integer) return "number" == typeof value;
|
38777 | }
|
38778 | return !1;
|
38779 | }
|
38780 | function firstColumnByRoleName(columns, roleName) {
|
38781 | for (var _i = 0, columns_4 = columns; _i < columns_4.length; _i++) {
|
38782 | var column = columns_4[_i], columnRoles = column && column.roles;
|
38783 | if (columnRoles && columnRoles[roleName]) return column;
|
38784 | }
|
38785 | }
|
38786 | DataViewNormalizeValues.apply = apply, DataViewNormalizeValues.filterVariantMeasures = filterVariantMeasures,
|
38787 | DataViewNormalizeValues.generateMetadataColumnFilter = generateMetadataColumnFilter,
|
38788 | DataViewNormalizeValues.generateValueFilter = generateValueFilter, DataViewNormalizeValues.getColumnRequiredTypes = getColumnRequiredTypes,
|
38789 | DataViewNormalizeValues.normalizeVariant = normalizeVariant;
|
38790 | }(DataViewNormalizeValues = data.DataViewNormalizeValues || (data.DataViewNormalizeValues = {}));
|
38791 | }(data = powerbi.data || (powerbi.data = {}));
|
38792 | }(powerbi || (powerbi = {}));
|
38793 | }, function(module, exports) {
|
38794 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
38795 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
38796 | !function(powerbi) {
|
38797 | var DataViewObjects;
|
38798 | !function(DataViewObjects) {
|
38799 | function getValue(objects, propertyId, defaultValue) {
|
38800 | if (!objects) return defaultValue;
|
38801 | var objectOrMap = objects[propertyId.objectName], object = objectOrMap;
|
38802 | return DataViewObject.getValue(object, propertyId.propertyName, defaultValue);
|
38803 | }
|
38804 | function getObject(objects, objectName, defaultValue) {
|
38805 | if (objects && objects[objectName]) {
|
38806 | var object = objects[objectName];
|
38807 | return object;
|
38808 | }
|
38809 | return defaultValue;
|
38810 | }
|
38811 | function getUserDefinedObjects(objects, objectName) {
|
38812 | if (objects && objects[objectName]) {
|
38813 | var map = objects[objectName];
|
38814 | return map;
|
38815 | }
|
38816 | }
|
38817 | function getFillColor(objects, propertyId, defaultColor) {
|
38818 | var value = getValue(objects, propertyId);
|
38819 | return value && value.solid ? value.solid.color : defaultColor;
|
38820 | }
|
38821 | function isUserDefined(objectOrMap) {
|
38822 | return _.isArray(objectOrMap);
|
38823 | }
|
38824 | DataViewObjects.getValue = getValue, DataViewObjects.getObject = getObject, DataViewObjects.getUserDefinedObjects = getUserDefinedObjects,
|
38825 | DataViewObjects.getFillColor = getFillColor, DataViewObjects.isUserDefined = isUserDefined;
|
38826 | }(DataViewObjects = powerbi.DataViewObjects || (powerbi.DataViewObjects = {}));
|
38827 | var DataViewObject;
|
38828 | !function(DataViewObject) {
|
38829 | function getValue(object, propertyName, defaultValue) {
|
38830 | if (!object) return defaultValue;
|
38831 | var propertyValue = object[propertyName];
|
38832 | return void 0 === propertyValue ? defaultValue : propertyValue;
|
38833 | }
|
38834 | function getFillColorByPropertyName(objects, propertyName, defaultColor) {
|
38835 | var value = DataViewObject.getValue(objects, propertyName);
|
38836 | return value && value.solid ? value.solid.color : defaultColor;
|
38837 | }
|
38838 | DataViewObject.getValue = getValue, DataViewObject.getFillColorByPropertyName = getFillColorByPropertyName;
|
38839 | }(DataViewObject = powerbi.DataViewObject || (powerbi.DataViewObject = {}));
|
38840 | }(powerbi || (powerbi = {}));
|
38841 | }, function(module, exports) {
|
38842 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
38843 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
38844 | !function(powerbi) {
|
38845 | var data;
|
38846 | !function(data) {
|
38847 | var DataViewObjectDefinitions, JsonComparer = jsCommon.JsonComparer;
|
38848 | !function(DataViewObjectDefinitions) {
|
38849 | function ensure(defns, objectName, selector) {
|
38850 | var defnsForObject = defns[objectName];
|
38851 | defnsForObject || (defns[objectName] = defnsForObject = []);
|
38852 | for (var i = 0, len = defnsForObject.length; len > i; i++) {
|
38853 | var defn = defnsForObject[i];
|
38854 | if (data.Selector.equals(defn.selector, selector)) return defn;
|
38855 | }
|
38856 | var newDefn = {
|
38857 | selector: selector,
|
38858 | properties: {}
|
38859 | };
|
38860 | return defnsForObject.push(newDefn), newDefn;
|
38861 | }
|
38862 | function deleteProperty(defns, objectName, selector, propertyName) {
|
38863 | var defn = getObjectDefinition(defns, objectName, selector);
|
38864 | defn && DataViewObjectDefinition.deleteSingleProperty(defn, propertyName);
|
38865 | }
|
38866 | function setValue(defns, propertyId, selector, value) {
|
38867 | ensure(defns, propertyId.objectName, selector).properties[propertyId.propertyName] = value;
|
38868 | }
|
38869 | function getValue(defns, propertyId, selector) {
|
38870 | var properties = getPropertyContainer(defns, propertyId, selector);
|
38871 | if (properties) return properties[propertyId.propertyName];
|
38872 | }
|
38873 | function getPropertyContainer(defns, propertyId, selector) {
|
38874 | var defn = getObjectDefinition(defns, propertyId.objectName, selector);
|
38875 | if (defn) return defn.properties;
|
38876 | }
|
38877 | function getObjectDefinition(defns, objectName, selector) {
|
38878 | if (defns) {
|
38879 | var defnsForObject = defns[objectName];
|
38880 | if (defnsForObject) for (var i = 0, len = defnsForObject.length; len > i; i++) {
|
38881 | var defn = defnsForObject[i];
|
38882 | if (data.Selector.equals(defn.selector, selector)) return defn;
|
38883 | }
|
38884 | }
|
38885 | }
|
38886 | function propertiesAreEqual(a, b) {
|
38887 | return a instanceof data.SemanticFilter && b instanceof data.SemanticFilter ? data.SemanticFilter.isSameFilter(a, b) : JsonComparer.equals(a, b);
|
38888 | }
|
38889 | function allPropertiesAreEqual(a, b) {
|
38890 | if (Object.keys(a).length !== Object.keys(b).length) return !1;
|
38891 | for (var property in a) if (!propertiesAreEqual(a[property], b[property])) return !1;
|
38892 | return !0;
|
38893 | }
|
38894 | function encodePropertyValue(value, valueTypeDescriptor) {
|
38895 | if (valueTypeDescriptor.bool) return "boolean" != typeof value && (value = !1),
|
38896 | data.SQExprBuilder["boolean"](value);
|
38897 | if (valueTypeDescriptor.text || valueTypeDescriptor.scripting && valueTypeDescriptor.scripting.source) return data.SQExprBuilder.text(value);
|
38898 | if (valueTypeDescriptor.numeric) {
|
38899 | if ($.isNumeric(value)) return data.SQExprBuilder["double"](+value);
|
38900 | } else if (valueTypeDescriptor.fill) {
|
38901 | if (value) return {
|
38902 | solid: {
|
38903 | color: data.SQExprBuilder.text(value)
|
38904 | }
|
38905 | };
|
38906 | } else {
|
38907 | if (valueTypeDescriptor.formatting) return valueTypeDescriptor.formatting.labelDisplayUnits ? data.SQExprBuilder["double"](+value) : data.SQExprBuilder.text(value);
|
38908 | if (valueTypeDescriptor.enumeration) return $.isNumeric(value) ? data.SQExprBuilder["double"](+value) : data.SQExprBuilder.text(value);
|
38909 | if (valueTypeDescriptor.misc) value = value ? data.SQExprBuilder.text(value) : null; else if (valueTypeDescriptor.dateTime) value = value ? data.SQExprBuilder.dateTime(value) : null; else if (valueTypeDescriptor.image && value) {
|
38910 | var imageValue = value, imageDefinition = {
|
38911 | name: data.SQExprBuilder.text(imageValue.name),
|
38912 | url: data.SQExprBuilder.text(imageValue.url)
|
38913 | };
|
38914 | return imageValue.scaling && (imageDefinition.scaling = data.SQExprBuilder.text(imageValue.scaling)),
|
38915 | imageDefinition;
|
38916 | }
|
38917 | }
|
38918 | return value;
|
38919 | }
|
38920 | function clone(original) {
|
38921 | var cloned = {};
|
38922 | for (var objectName in original) {
|
38923 | var originalDefns = original[objectName];
|
38924 | if (!_.isEmpty(originalDefns)) {
|
38925 | for (var clonedDefns = [], _i = 0, originalDefns_1 = originalDefns; _i < originalDefns_1.length; _i++) {
|
38926 | var originalDefn = originalDefns_1[_i];
|
38927 | clonedDefns.push({
|
38928 | properties: cloneProperties(originalDefn.properties),
|
38929 | selector: originalDefn.selector
|
38930 | });
|
38931 | }
|
38932 | cloned[objectName] = clonedDefns;
|
38933 | }
|
38934 | }
|
38935 | return cloned;
|
38936 | }
|
38937 | function cloneProperties(original) {
|
38938 | return _.clone(original);
|
38939 | }
|
38940 | DataViewObjectDefinitions.ensure = ensure, DataViewObjectDefinitions.deleteProperty = deleteProperty,
|
38941 | DataViewObjectDefinitions.setValue = setValue, DataViewObjectDefinitions.getValue = getValue,
|
38942 | DataViewObjectDefinitions.getPropertyContainer = getPropertyContainer, DataViewObjectDefinitions.getObjectDefinition = getObjectDefinition,
|
38943 | DataViewObjectDefinitions.propertiesAreEqual = propertiesAreEqual, DataViewObjectDefinitions.allPropertiesAreEqual = allPropertiesAreEqual,
|
38944 | DataViewObjectDefinitions.encodePropertyValue = encodePropertyValue, DataViewObjectDefinitions.clone = clone;
|
38945 | }(DataViewObjectDefinitions = data.DataViewObjectDefinitions || (data.DataViewObjectDefinitions = {}));
|
38946 | var DataViewObjectDefinition;
|
38947 | !function(DataViewObjectDefinition) {
|
38948 | function deleteSingleProperty(defn, propertyName) {
|
38949 | delete defn.properties[propertyName];
|
38950 | }
|
38951 | DataViewObjectDefinition.deleteSingleProperty = deleteSingleProperty;
|
38952 | }(DataViewObjectDefinition = data.DataViewObjectDefinition || (data.DataViewObjectDefinition = {}));
|
38953 | }(data = powerbi.data || (powerbi.data = {}));
|
38954 | }(powerbi || (powerbi = {}));
|
38955 | }, function(module, exports) {
|
38956 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
38957 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
38958 | !function(powerbi) {
|
38959 | var data;
|
38960 | !function(data) {
|
38961 | var DataViewObjectDescriptors;
|
38962 | !function(DataViewObjectDescriptors) {
|
38963 | function findFormatString(descriptors) {
|
38964 | return findProperty(descriptors, function(propDesc) {
|
38965 | var formattingTypeDesc = powerbi.ValueType.fromDescriptor(propDesc.type).formatting;
|
38966 | return formattingTypeDesc && formattingTypeDesc.formatString;
|
38967 | });
|
38968 | }
|
38969 | function findFilterOutput(descriptors) {
|
38970 | return findProperty(descriptors, function(propDesc) {
|
38971 | var propType = propDesc.type;
|
38972 | return propType && propType.filter && !propType.filter.selfFilter;
|
38973 | });
|
38974 | }
|
38975 | function findSelfFilter(descriptors) {
|
38976 | return findProperty(descriptors, isSelfFilter);
|
38977 | }
|
38978 | function isSelfFilter(descriptor) {
|
38979 | var propType = descriptor && descriptor.type;
|
38980 | return propType && propType.filter && propType.filter.selfFilter;
|
38981 | }
|
38982 | function findSelfFilterEnabled(descriptors) {
|
38983 | return findProperty(descriptors, function(propDesc) {
|
38984 | var propType = propDesc.type;
|
38985 | return propType && propType.operations && propType.operations.searchEnabled;
|
38986 | });
|
38987 | }
|
38988 | function findDefaultValue(descriptors) {
|
38989 | return findProperty(descriptors, function(propDesc) {
|
38990 | var propType = propDesc.type;
|
38991 | return propType && !!propType.expression && propType.expression.defaultValue;
|
38992 | });
|
38993 | }
|
38994 | function findProperty(descriptors, propPredicate) {
|
38995 | if (descriptors) for (var objectName in descriptors) {
|
38996 | var objPropDescs = descriptors[objectName].properties;
|
38997 | for (var propertyName in objPropDescs) if (propPredicate(objPropDescs[propertyName])) return {
|
38998 | objectName: objectName,
|
38999 | propertyName: propertyName
|
39000 | };
|
39001 | }
|
39002 | }
|
39003 | DataViewObjectDescriptors.findFormatString = findFormatString, DataViewObjectDescriptors.findFilterOutput = findFilterOutput,
|
39004 | DataViewObjectDescriptors.findSelfFilter = findSelfFilter, DataViewObjectDescriptors.isSelfFilter = isSelfFilter,
|
39005 | DataViewObjectDescriptors.findSelfFilterEnabled = findSelfFilterEnabled, DataViewObjectDescriptors.findDefaultValue = findDefaultValue;
|
39006 | }(DataViewObjectDescriptors = data.DataViewObjectDescriptors || (data.DataViewObjectDescriptors = {}));
|
39007 | }(data = powerbi.data || (powerbi.data = {}));
|
39008 | }(powerbi || (powerbi = {}));
|
39009 | }, function(module, exports) {
|
39010 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
39011 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
39012 | !function(powerbi) {
|
39013 | var data;
|
39014 | !function(data) {
|
39015 | var DataViewObjectEvaluationUtils;
|
39016 | !function(DataViewObjectEvaluationUtils) {
|
39017 | function evaluateDataViewObjects(evalContext, objectDescriptors, objectDefns) {
|
39018 | for (var objects, j = 0, jlen = objectDefns.length; jlen > j; j++) {
|
39019 | var objectDefinition = objectDefns[j], objectName = objectDefinition.name, evaluatedObject = data.DataViewObjectEvaluator.run(evalContext, objectDescriptors[objectName], objectDefinition.properties);
|
39020 | evaluatedObject && (objects || (objects = {}), objects[objectName] = evaluatedObject);
|
39021 | }
|
39022 | return objects;
|
39023 | }
|
39024 | function groupObjectsBySelector(objectDefinitions) {
|
39025 | var grouped = {
|
39026 | data: []
|
39027 | };
|
39028 | if (objectDefinitions) for (var objectName in objectDefinitions) for (var objectDefnList = objectDefinitions[objectName], i = 0, len = objectDefnList.length; len > i; i++) {
|
39029 | var objectDefn = objectDefnList[i];
|
39030 | ensureDefinitionListForSelector(grouped, objectDefn.selector).objects.push({
|
39031 | name: objectName,
|
39032 | properties: objectDefn.properties
|
39033 | });
|
39034 | }
|
39035 | return grouped;
|
39036 | }
|
39037 | function ensureDefinitionListForSelector(grouped, selector) {
|
39038 | if (!selector) return grouped.metadataOnce || (grouped.metadataOnce = {
|
39039 | objects: []
|
39040 | }), grouped.metadataOnce;
|
39041 | var groupedObjects;
|
39042 | selector.data ? groupedObjects = grouped.data : selector.metadata ? (grouped.metadata || (grouped.metadata = []),
|
39043 | groupedObjects = grouped.metadata) : selector.id && (grouped.userDefined || (grouped.userDefined = []),
|
39044 | groupedObjects = grouped.userDefined);
|
39045 | for (var _i = 0, groupedObjects_1 = groupedObjects; _i < groupedObjects_1.length; _i++) {
|
39046 | var item_1 = groupedObjects_1[_i];
|
39047 | if (data.Selector.equals(selector, item_1.selector)) return item_1;
|
39048 | }
|
39049 | var item = {
|
39050 | selector: selector,
|
39051 | objects: []
|
39052 | };
|
39053 | return groupedObjects.push(item), item;
|
39054 | }
|
39055 | function addImplicitObjects(objectsForAllSelectors, objectDescriptors, columns, selectTransforms) {
|
39056 | selectTransforms && (addDefaultFormatString(objectsForAllSelectors, objectDescriptors, columns, selectTransforms),
|
39057 | addDefaultValue(objectsForAllSelectors, objectDescriptors, columns, selectTransforms));
|
39058 | }
|
39059 | function addDefaultFormatString(objectsForAllSelectors, objectDescriptors, columns, selectTransforms) {
|
39060 | var formatStringProp = data.DataViewObjectDescriptors.findFormatString(objectDescriptors);
|
39061 | if (formatStringProp) for (var selectIdx = 0, selectLen = selectTransforms.length; selectLen > selectIdx; selectIdx++) {
|
39062 | var selectTransform = selectTransforms[selectIdx];
|
39063 | selectTransform && applyFormatString(objectsForAllSelectors, formatStringProp, selectTransform.queryName, selectTransform.format || getColumnFormatForIndex(columns, selectIdx));
|
39064 | }
|
39065 | }
|
39066 | function addDefaultValue(objectsForAllSelectors, objectDescriptors, columns, selectTransforms) {
|
39067 | var defaultValueProp = data.DataViewObjectDescriptors.findDefaultValue(objectDescriptors);
|
39068 | if (defaultValueProp) for (var _i = 0, selectTransforms_1 = selectTransforms; _i < selectTransforms_1.length; _i++) {
|
39069 | var selectTransform = selectTransforms_1[_i];
|
39070 | selectTransform && applyDefaultValue(objectsForAllSelectors, defaultValueProp, selectTransform.queryName, selectTransform.defaultValue);
|
39071 | }
|
39072 | }
|
39073 | function getColumnFormatForIndex(columns, selectIdx) {
|
39074 | for (var columnIdx = 0, columnLen = columns.length; columnLen > columnIdx; columnIdx++) {
|
39075 | var column = columns[columnIdx];
|
39076 | if (column && column.index === selectIdx) return column.format;
|
39077 | }
|
39078 | }
|
39079 | function applyFormatString(objectsForAllSelectors, formatStringProp, queryName, formatStringValue) {
|
39080 | formatStringValue && applyMetadataProperty(objectsForAllSelectors, formatStringProp, {
|
39081 | metadata: queryName
|
39082 | }, data.SQExprBuilder.text(formatStringValue));
|
39083 | }
|
39084 | function applyDefaultValue(objectsForAllSelectors, defaultValueProp, queryName, defaultValue) {
|
39085 | defaultValue && applyMetadataProperty(objectsForAllSelectors, defaultValueProp, {
|
39086 | metadata: queryName
|
39087 | }, defaultValue);
|
39088 | }
|
39089 | function applyMetadataProperty(objectsForAllSelectors, propertyId, selector, value) {
|
39090 | var objectDefns;
|
39091 | if (selector) {
|
39092 | var metadataObjects = objectsForAllSelectors.metadata;
|
39093 | metadataObjects || (metadataObjects = objectsForAllSelectors.metadata = []), objectDefns = metadataObjects;
|
39094 | } else {
|
39095 | var metadataOnce = objectsForAllSelectors.metadataOnce;
|
39096 | metadataOnce || (metadataOnce = objectsForAllSelectors.metadataOnce = {
|
39097 | selector: selector,
|
39098 | objects: []
|
39099 | }), objectDefns = [ metadataOnce ];
|
39100 | }
|
39101 | var targetObjectDefn, targetMetadataObject = findWithMatchingSelector(objectDefns, selector);
|
39102 | if (targetMetadataObject) {
|
39103 | var targetObjectDefns = targetMetadataObject.objects;
|
39104 | if (targetObjectDefn = findExistingObject(targetObjectDefns, propertyId.objectName)) {
|
39105 | if (targetObjectDefn.properties[propertyId.propertyName]) return;
|
39106 | } else targetObjectDefn = {
|
39107 | name: propertyId.objectName,
|
39108 | properties: {}
|
39109 | }, targetObjectDefns.push(targetObjectDefn);
|
39110 | } else targetObjectDefn = {
|
39111 | name: propertyId.objectName,
|
39112 | properties: {}
|
39113 | }, objectDefns.push({
|
39114 | selector: selector,
|
39115 | objects: [ targetObjectDefn ]
|
39116 | });
|
39117 | targetObjectDefn.properties[propertyId.propertyName] = value;
|
39118 | }
|
39119 | function findWithMatchingSelector(objects, selector) {
|
39120 | for (var i = 0, len = objects.length; len > i; i++) {
|
39121 | var object = objects[i];
|
39122 | if (data.Selector.equals(object.selector, selector)) return object;
|
39123 | }
|
39124 | }
|
39125 | function findExistingObject(objectDefns, objectName) {
|
39126 | for (var i = 0, len = objectDefns.length; len > i; i++) {
|
39127 | var objectDefn = objectDefns[i];
|
39128 | if (objectDefn.name === objectName) return objectDefn;
|
39129 | }
|
39130 | }
|
39131 | DataViewObjectEvaluationUtils.evaluateDataViewObjects = evaluateDataViewObjects,
|
39132 | DataViewObjectEvaluationUtils.groupObjectsBySelector = groupObjectsBySelector, DataViewObjectEvaluationUtils.addImplicitObjects = addImplicitObjects;
|
39133 | }(DataViewObjectEvaluationUtils = data.DataViewObjectEvaluationUtils || (data.DataViewObjectEvaluationUtils = {}));
|
39134 | }(data = powerbi.data || (powerbi.data = {}));
|
39135 | }(powerbi || (powerbi = {}));
|
39136 | }, function(module, exports) {
|
39137 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
39138 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
39139 | function __() {
|
39140 | this.constructor = d;
|
39141 | }
|
39142 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
39143 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
39144 | });
|
39145 | !function(powerbi) {
|
39146 | var data;
|
39147 | !function(data) {
|
39148 | var DataViewObjectEvaluator;
|
39149 | !function(DataViewObjectEvaluator) {
|
39150 | function run(evalContext, objectDescriptor, propertyDefinitions) {
|
39151 | if (objectDescriptor) {
|
39152 | var object, propertyDescriptors = objectDescriptor.properties;
|
39153 | for (var propertyName in propertyDefinitions) {
|
39154 | var propertyDefinition = propertyDefinitions[propertyName], propertyDescriptor = propertyDescriptors[propertyName];
|
39155 | if (propertyDescriptor) {
|
39156 | var propertyValue = evaluateProperty(evalContext, propertyDescriptor, propertyDefinition);
|
39157 | void 0 !== propertyValue && (object || (object = {}), object[propertyName] = propertyValue);
|
39158 | }
|
39159 | }
|
39160 | return object;
|
39161 | }
|
39162 | }
|
39163 | function evaluateProperty(evalContext, propertyDescriptor, propertyDefinition) {
|
39164 | var structuralType = propertyDescriptor.type;
|
39165 | if (structuralType && structuralType.expression) return propertyDefinition;
|
39166 | var value = evaluateValue(evalContext, propertyDefinition, powerbi.ValueType.fromDescriptor(propertyDescriptor.type));
|
39167 | return void 0 !== value || propertyDefinition instanceof data.RuleEvaluation ? value : evaluateFill(evalContext, propertyDefinition, structuralType) || evaluateFillRule(evalContext, propertyDefinition, structuralType) || evaluateImage(evalContext, propertyDefinition, structuralType) || evaluateParagraphs(evalContext, propertyDefinition, structuralType) || propertyDefinition;
|
39168 | }
|
39169 | function evaluateFill(evalContext, fillDefn, type) {
|
39170 | var fillType = type.fill;
|
39171 | if (fillType) return fillType && fillType.solid && fillType.solid.color && fillDefn.solid ? {
|
39172 | solid: {
|
39173 | color: evaluateValue(evalContext, fillDefn.solid.color, powerbi.ValueType.fromExtendedType(powerbi.ExtendedType.Color))
|
39174 | }
|
39175 | } : void 0;
|
39176 | }
|
39177 | function evaluateFillRule(evalContext, fillRuleDefn, type) {
|
39178 | if (type.fillRule) {
|
39179 | if (fillRuleDefn.linearGradient2) {
|
39180 | var linearGradient2 = fillRuleDefn.linearGradient2;
|
39181 | return {
|
39182 | linearGradient2: {
|
39183 | min: evaluateColorStop(evalContext, linearGradient2.min),
|
39184 | max: evaluateColorStop(evalContext, linearGradient2.max)
|
39185 | }
|
39186 | };
|
39187 | }
|
39188 | if (fillRuleDefn.linearGradient3) {
|
39189 | var linearGradient3 = fillRuleDefn.linearGradient3;
|
39190 | return {
|
39191 | linearGradient3: {
|
39192 | min: evaluateColorStop(evalContext, linearGradient3.min),
|
39193 | mid: evaluateColorStop(evalContext, linearGradient3.mid),
|
39194 | max: evaluateColorStop(evalContext, linearGradient3.max)
|
39195 | }
|
39196 | };
|
39197 | }
|
39198 | }
|
39199 | }
|
39200 | function evaluateColorStop(evalContext, colorStop) {
|
39201 | var step = {
|
39202 | color: evaluateValue(evalContext, colorStop.color, colorValueType)
|
39203 | }, value = evaluateValue(evalContext, colorStop.value, numericType);
|
39204 | return null != value && (step.value = value), step;
|
39205 | }
|
39206 | function evaluateImage(evalContext, definition, type) {
|
39207 | if (type.image && definition) {
|
39208 | var value = {
|
39209 | name: evaluateValue(evalContext, definition.name, textType),
|
39210 | url: evaluateValue(evalContext, definition.url, powerbi.ValueType.fromDescriptor(powerbi.ImageDefinition.urlType))
|
39211 | };
|
39212 | return definition.scaling && (value.scaling = evaluateValue(evalContext, definition.scaling, textType)),
|
39213 | value;
|
39214 | }
|
39215 | }
|
39216 | function evaluateParagraphs(evalContext, definition, type) {
|
39217 | return type.paragraphs && definition ? evaluateArrayCopyOnChange(evalContext, definition, evaluateParagraph) : void 0;
|
39218 | }
|
39219 | function evaluateParagraph(evalContext, definition) {
|
39220 | var evaluated, definitionTextRuns = definition.textRuns, evaluatedTextRuns = evaluateArrayCopyOnChange(evalContext, definitionTextRuns, evaluateTextRun);
|
39221 | return definitionTextRuns !== evaluatedTextRuns && (evaluated = _.clone(definition),
|
39222 | evaluated.textRuns = evaluatedTextRuns), evaluated || definition;
|
39223 | }
|
39224 | function evaluateTextRun(evalContext, definition) {
|
39225 | var evaluated, definitionValue = definition.value, evaluatedValue = evaluateValue(evalContext, definitionValue, textType);
|
39226 | return void 0 !== evaluatedValue && (evaluated = _.clone(definition), evaluated.value = evaluatedValue),
|
39227 | evaluated || definition;
|
39228 | }
|
39229 | function evaluateArrayCopyOnChange(evalContext, definitions, evaluator) {
|
39230 | for (var evaluatedValues, i = 0, len = definitions.length; len > i; i++) {
|
39231 | var definition = definitions[i], evaluated = evaluator(evalContext, definition);
|
39232 | evaluatedValues || definition === evaluated || (evaluatedValues = _.take(definitions, i)),
|
39233 | evaluatedValues && evaluatedValues.push(evaluated);
|
39234 | }
|
39235 | return evaluatedValues || definitions;
|
39236 | }
|
39237 | function evaluateValue(evalContext, definition, valueType) {
|
39238 | return definition instanceof data.SQExpr ? ExpressionEvaluator.evaluate(definition, evalContext) : definition instanceof data.RuleEvaluation ? definition.evaluate(evalContext) : void 0;
|
39239 | }
|
39240 | var colorValueType = powerbi.ValueType.fromDescriptor({
|
39241 | formatting: {
|
39242 | color: !0
|
39243 | }
|
39244 | }), numericType = powerbi.ValueType.fromDescriptor({
|
39245 | numeric: !0
|
39246 | }), textType = powerbi.ValueType.fromDescriptor({
|
39247 | text: !0
|
39248 | });
|
39249 | DataViewObjectEvaluator.run = run, DataViewObjectEvaluator.evaluateProperty = evaluateProperty,
|
39250 | DataViewObjectEvaluator.evaluateValue = evaluateValue;
|
39251 | var ExpressionEvaluator = function(_super) {
|
39252 | function ExpressionEvaluator() {
|
39253 | _super.apply(this, arguments);
|
39254 | }
|
39255 | return __extends(ExpressionEvaluator, _super), ExpressionEvaluator.evaluate = function(expr, evalContext) {
|
39256 | return null != expr ? expr.accept(ExpressionEvaluator.instance, evalContext) : void 0;
|
39257 | }, ExpressionEvaluator.prototype.visitColumnRef = function(expr, evalContext) {
|
39258 | return evalContext.getExprValue(expr);
|
39259 | }, ExpressionEvaluator.prototype.visitConstant = function(expr, evalContext) {
|
39260 | return expr.value;
|
39261 | }, ExpressionEvaluator.prototype.visitMeasureRef = function(expr, evalContext) {
|
39262 | return evalContext.getExprValue(expr);
|
39263 | }, ExpressionEvaluator.prototype.visitAggr = function(expr, evalContext) {
|
39264 | return evalContext.getExprValue(expr);
|
39265 | }, ExpressionEvaluator.prototype.visitFillRule = function(expr, evalContext) {
|
39266 | var inputValue = expr.input.accept(this, evalContext);
|
39267 | if (void 0 !== inputValue) {
|
39268 | var colorAllocator = evalContext.getColorAllocator(expr);
|
39269 | if (colorAllocator) return colorAllocator.color(inputValue);
|
39270 | }
|
39271 | }, ExpressionEvaluator.prototype.visitPercentile = function(expr, evalContext) {
|
39272 | return evalContext.getExprValue(expr);
|
39273 | }, ExpressionEvaluator.prototype.visitSelectRef = function(expr, evalContext) {
|
39274 | return evalContext.getExprValue(expr);
|
39275 | }, ExpressionEvaluator.instance = new ExpressionEvaluator(), ExpressionEvaluator;
|
39276 | }(data.DefaultSQExprVisitorWithArg);
|
39277 | }(DataViewObjectEvaluator = data.DataViewObjectEvaluator || (data.DataViewObjectEvaluator = {}));
|
39278 | }(data = powerbi.data || (powerbi.data = {}));
|
39279 | }(powerbi || (powerbi = {}));
|
39280 | }, function(module, exports) {
|
39281 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
39282 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
39283 | !function(powerbi) {
|
39284 | var data;
|
39285 | !function(data) {
|
39286 | var DataViewCategoricalEvalGrouped, inheritSingle = powerbi.Prototype.inheritSingle;
|
39287 | !function(DataViewCategoricalEvalGrouped) {
|
39288 | function apply(categorical) {
|
39289 | var valueColumns = categorical.values;
|
39290 | if (valueColumns) {
|
39291 | var seriesGroups, isDynamicSeries = !!valueColumns.source;
|
39292 | if (isDynamicSeries) {
|
39293 | seriesGroups = inheritSingle(valueColumns.grouped());
|
39294 | for (var nextSeriesGroupIndex = 0, currentSeriesGroup = void 0, i = 0, ilen = valueColumns.length; ilen > i; i++) {
|
39295 | var currentValueColumn = valueColumns[i];
|
39296 | if (!currentSeriesGroup || currentValueColumn.identity !== currentSeriesGroup.identity) {
|
39297 | var existingSeriesGroup = seriesGroups[nextSeriesGroupIndex];
|
39298 | currentSeriesGroup = existingSeriesGroup ? inheritSingle(existingSeriesGroup) : existingSeriesGroup = seriesGroups[nextSeriesGroupIndex] = {
|
39299 | values: null
|
39300 | }, seriesGroups[nextSeriesGroupIndex] = currentSeriesGroup, currentSeriesGroup.values = [],
|
39301 | nextSeriesGroupIndex++;
|
39302 | }
|
39303 | currentSeriesGroup.values.push(currentValueColumn);
|
39304 | }
|
39305 | } else seriesGroups = [ {
|
39306 | values: valueColumns
|
39307 | } ];
|
39308 | valueColumns.grouped = function() {
|
39309 | return seriesGroups;
|
39310 | }, categorical.values = valueColumns;
|
39311 | }
|
39312 | }
|
39313 | DataViewCategoricalEvalGrouped.apply = apply;
|
39314 | }(DataViewCategoricalEvalGrouped = data.DataViewCategoricalEvalGrouped || (data.DataViewCategoricalEvalGrouped = {}));
|
39315 | }(data = powerbi.data || (powerbi.data = {}));
|
39316 | }(powerbi || (powerbi = {}));
|
39317 | }, function(module, exports) {
|
39318 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
39319 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
39320 | !function(powerbi) {
|
39321 | var data;
|
39322 | !function(data) {
|
39323 | var DataViewMatrixProjectionOrder, ArrayExtensions = jsCommon.ArrayExtensions, inheritSingle = powerbi.Prototype.inheritSingle;
|
39324 | !function(DataViewMatrixProjectionOrder) {
|
39325 | function apply(prototype, matrixMapping, projectionOrdering, context) {
|
39326 | var transformingMatrix = prototype;
|
39327 | return projectionOrdering && (transformingMatrix = projectMeasures(transformingMatrix, matrixMapping, projectionOrdering, context),
|
39328 | transformingMatrix = reorderCompositeGroups(transformingMatrix, matrixMapping, projectionOrdering)),
|
39329 | transformingMatrix;
|
39330 | }
|
39331 | function projectMeasures(prototype, matrixRoleMapping, projectionOrdering, context) {
|
39332 | if (!projectionOrdering) return prototype;
|
39333 | var valuesRoleNames = getMatrixValuesRoleNames(matrixRoleMapping);
|
39334 | if (_.isEmpty(valuesRoleNames)) return prototype;
|
39335 | var valueSources = prototype.valueSources, projectionOrderingForValuesRoles = getCombinedProjectionOrdering(projectionOrdering, valuesRoleNames);
|
39336 | if (_.isEmpty(valueSources) || isEqualProjectionOrdering(prototype.valueSources, projectionOrderingForValuesRoles)) return prototype;
|
39337 | var jointMetadataColumns = data.DataViewMetadataColumnUtils.leftJoinMetadataColumnsAndProjectionOrder(valueSources, projectionOrderingForValuesRoles, valuesRoleNames), jointMetadataColumnsOrderedByProjection = _.chain(jointMetadataColumns).filter(function(column) {
|
39338 | return void 0 !== column.projectionOrderIndex;
|
39339 | }).sortBy(function(column) {
|
39340 | return column.projectionOrderIndex;
|
39341 | }).value(), matrix = inheritSingle(prototype);
|
39342 | matrix.rows = projectIntersectionValues(matrix.rows, matrix.valueSources, jointMetadataColumnsOrderedByProjection);
|
39343 | var projectedValueSources = _.map(jointMetadataColumnsOrderedByProjection, function(jointMetadataColumn) {
|
39344 | return jointMetadataColumn.metadataColumn;
|
39345 | });
|
39346 | return matrix.valueSources = projectedValueSources, matrix.columns = DataViewMatrixMeasureHeaders.update(matrix.columns, projectedValueSources.slice()),
|
39347 | context.hierarchyTreesRewritten = !0, matrix;
|
39348 | }
|
39349 | function getMatrixValuesRoleNames(matrixRoleMapping) {
|
39350 | var valuesRoles = [];
|
39351 | return powerbi.DataViewMapping.visitMatrixItems(matrixRoleMapping.values, {
|
39352 | visitRole: function(role) {
|
39353 | valuesRoles.push(role);
|
39354 | }
|
39355 | }), valuesRoles;
|
39356 | }
|
39357 | function getCombinedProjectionOrdering(projectionOrdering, roles) {
|
39358 | for (var combinedOrdering = [], _i = 0, roles_1 = roles; _i < roles_1.length; _i++) {
|
39359 | var role = roles_1[_i], roleProjectionOrdering = projectionOrdering[role];
|
39360 | _.isEmpty(roleProjectionOrdering) || combinedOrdering.push.apply(combinedOrdering, roleProjectionOrdering);
|
39361 | }
|
39362 | return combinedOrdering;
|
39363 | }
|
39364 | function isEqualProjectionOrdering(valueSources, valueProjectionOrdering) {
|
39365 | var currentSelectIndices = _.map(valueSources, function(valueSource) {
|
39366 | return valueSource.index;
|
39367 | });
|
39368 | return ArrayExtensions.sequenceEqual(currentSelectIndices, valueProjectionOrdering, function(a, b) {
|
39369 | return a === b;
|
39370 | });
|
39371 | }
|
39372 | function projectIntersectionValues(prototypeRowHierarchy, originalValueSources, projectedValueSourceEntries) {
|
39373 | var columnGroupInstanceCount, originalValueSourcesLength = originalValueSources.length, projectingValueSourcesLength = projectedValueSourceEntries.length, rowHierarchy = inheritSingle(prototypeRowHierarchy);
|
39374 | return rowHierarchy.root = data.DataViewPivotMatrix.cloneTreeExecuteOnLeaf(rowHierarchy.root, function(node) {
|
39375 | var originalValues = node.values;
|
39376 | if (originalValues) if (void 0 === columnGroupInstanceCount && (columnGroupInstanceCount = Object.keys(node.values).length / originalValueSourcesLength),
|
39377 | projectingValueSourcesLength > 0) {
|
39378 | for (var projectedValues = {}, columnGroupInstanceIndex = 0; columnGroupInstanceCount > columnGroupInstanceIndex; columnGroupInstanceIndex++) for (var offsetInOriginalValues = columnGroupInstanceIndex * originalValueSourcesLength, offsetInProjectedValues = columnGroupInstanceIndex * projectingValueSourcesLength, projectingValueSourceIndex = 0; projectingValueSourcesLength > projectingValueSourceIndex; projectingValueSourceIndex++) {
|
39379 | var originalValueSourceIndex = projectedValueSourceEntries[projectingValueSourceIndex].sourceIndex, nodeValue = originalValues[offsetInOriginalValues + originalValueSourceIndex];
|
39380 | projectingValueSourceIndex !== (nodeValue.valueSourceIndex || 0) && (nodeValue = inheritSingle(nodeValue),
|
39381 | nodeValue.valueSourceIndex = projectingValueSourceIndex || void 0), projectedValues[offsetInProjectedValues + projectingValueSourceIndex] = nodeValue;
|
39382 | }
|
39383 | node.values = projectedValues;
|
39384 | } else node.values = void 0;
|
39385 | }), rowHierarchy;
|
39386 | }
|
39387 | function reorderCompositeGroups(prototype, supportedDataViewMapping, projectionOrdering) {
|
39388 | var transformedRowsHierarchy;
|
39389 | powerbi.DataViewMapping.visitMatrixItems(supportedDataViewMapping.rows, {
|
39390 | visitRole: function(role, context) {
|
39391 | transformedRowsHierarchy = reorderMatrixHierarchyCompositeGroups(transformedRowsHierarchy || prototype.rows, role, projectionOrdering);
|
39392 | }
|
39393 | });
|
39394 | var transformedColumnsHierarchy;
|
39395 | powerbi.DataViewMapping.visitMatrixItems(supportedDataViewMapping.columns, {
|
39396 | visitRole: function(role, context) {
|
39397 | transformedColumnsHierarchy = reorderMatrixHierarchyCompositeGroups(transformedColumnsHierarchy || prototype.columns, role, projectionOrdering);
|
39398 | }
|
39399 | });
|
39400 | var transformedDataView;
|
39401 | return (transformedRowsHierarchy || transformedColumnsHierarchy) && (transformedDataView = inheritSingle(prototype),
|
39402 | transformedDataView.rows = transformedRowsHierarchy || transformedDataView.rows,
|
39403 | transformedDataView.columns = transformedColumnsHierarchy || transformedDataView.columns),
|
39404 | transformedDataView || prototype;
|
39405 | }
|
39406 | function reorderMatrixHierarchyCompositeGroups(matrixHierarchy, hierarchyRole, projectionOrdering) {
|
39407 | var transformedHierarchy, selectIndicesInProjectionOrder = projectionOrdering[hierarchyRole], hasMultipleColumnsInProjection = selectIndicesInProjectionOrder && selectIndicesInProjectionOrder.length >= 2;
|
39408 | if (hasMultipleColumnsInProjection && !_.isEmpty(matrixHierarchy.levels)) for (var i = matrixHierarchy.levels.length - 1; i >= 0; i--) {
|
39409 | var hierarchyLevel = matrixHierarchy.levels[i], levelSourceIndexMappings = createMatrixHierarchyLevelSourcesPositionMapping(hierarchyLevel, hierarchyRole, projectionOrdering);
|
39410 | if (!_.isEmpty(levelSourceIndexMappings)) {
|
39411 | void 0 === transformedHierarchy && (transformedHierarchy = inheritSingle(matrixHierarchy),
|
39412 | transformedHierarchy.levels = inheritSingle(matrixHierarchy.levels), transformedHierarchy.root = data.DataViewMatrixUtils.inheritMatrixNodeHierarchy(matrixHierarchy.root, i, !0));
|
39413 | var transformingHierarchyLevel = inheritSingle(matrixHierarchy.levels[i]);
|
39414 | transformedHierarchy.levels[i] = reorderMatrixHierarchyLevelColumnSources(transformingHierarchyLevel, levelSourceIndexMappings),
|
39415 | reorderMatrixHierarchyLevelValues(transformedHierarchy.root, i, levelSourceIndexMappings);
|
39416 | }
|
39417 | }
|
39418 | return transformedHierarchy;
|
39419 | }
|
39420 | function createMatrixHierarchyLevelSourcesPositionMapping(hierarchyLevel, hierarchyRole, projectionOrdering) {
|
39421 | var levelSourceIndexMappings, levelSourceColumns = hierarchyLevel.sources;
|
39422 | if (levelSourceColumns && levelSourceColumns.length >= 2) {
|
39423 | var uniqueProjectionOrdering = _.uniq(projectionOrdering[hierarchyRole]), columnsForHierarchyRoleOrderedByLevelSourceIndex = data.DataViewMetadataColumnUtils.leftJoinMetadataColumnsAndProjectionOrder(levelSourceColumns, uniqueProjectionOrdering, [ hierarchyRole ]);
|
39424 | if (columnsForHierarchyRoleOrderedByLevelSourceIndex && columnsForHierarchyRoleOrderedByLevelSourceIndex.length >= 2) {
|
39425 | var columnsForHierarchyRoleOrderedByProjection = _.sortBy(columnsForHierarchyRoleOrderedByLevelSourceIndex, function(columnInfo) {
|
39426 | return columnInfo.projectionOrderIndex;
|
39427 | });
|
39428 | levelSourceIndexMappings = _.map(columnsForHierarchyRoleOrderedByProjection, function(value, i) {
|
39429 | var entry = {
|
39430 | originalSourceIndex: value.sourceIndex,
|
39431 | newSourceIndex: i
|
39432 | };
|
39433 | return entry;
|
39434 | });
|
39435 | }
|
39436 | }
|
39437 | return levelSourceIndexMappings;
|
39438 | }
|
39439 | function reorderMatrixHierarchyLevelColumnSources(transformingHierarchyLevel, levelSourceIndexMappings) {
|
39440 | var originalLevelSources = transformingHierarchyLevel.sources;
|
39441 | transformingHierarchyLevel.sources = originalLevelSources.slice(0);
|
39442 | for (var _i = 0, levelSourceIndexMappings_1 = levelSourceIndexMappings; _i < levelSourceIndexMappings_1.length; _i++) {
|
39443 | var mapping = levelSourceIndexMappings_1[_i];
|
39444 | transformingHierarchyLevel.sources[mapping.newSourceIndex] = originalLevelSources[mapping.originalSourceIndex];
|
39445 | }
|
39446 | return transformingHierarchyLevel;
|
39447 | }
|
39448 | function reorderMatrixHierarchyLevelValues(transformingHierarchyRootNode, transformingHierarchyLevelIndex, levelSourceIndexMappings) {
|
39449 | var mappingsByOriginalLevelSourceIndex = _.reduce(levelSourceIndexMappings, function(mappingsByOriginalLevelSourceIndex, value) {
|
39450 | return mappingsByOriginalLevelSourceIndex[value.originalSourceIndex] = value, mappingsByOriginalLevelSourceIndex;
|
39451 | }, {});
|
39452 | return data.DataViewMatrixUtils.forEachNodeAtLevel(transformingHierarchyRootNode, transformingHierarchyLevelIndex, function(transformingMatrixNode) {
|
39453 | var originalLevelValues = transformingMatrixNode.levelValues;
|
39454 | if (!_.isEmpty(originalLevelValues)) {
|
39455 | for (var newlyOrderedLevelValues = _.sortBy(originalLevelValues, function(levelValue) {
|
39456 | var mapping = mappingsByOriginalLevelSourceIndex[levelValue.levelSourceIndex];
|
39457 | return mapping && mapping.newSourceIndex;
|
39458 | }), i = 0, ilen = newlyOrderedLevelValues.length; ilen > i; i++) {
|
39459 | var transformingLevelValue = inheritSingle(newlyOrderedLevelValues[i]), mapping = mappingsByOriginalLevelSourceIndex[transformingLevelValue.levelSourceIndex];
|
39460 | transformingLevelValue.levelSourceIndex = mapping && mapping.newSourceIndex, newlyOrderedLevelValues[i] = transformingLevelValue;
|
39461 | }
|
39462 | transformingMatrixNode.levelValues = newlyOrderedLevelValues;
|
39463 | var newlyOrderedLastLevelValue = _.last(newlyOrderedLevelValues);
|
39464 | transformingMatrixNode.value !== newlyOrderedLastLevelValue.value && (transformingMatrixNode.value = newlyOrderedLastLevelValue.value),
|
39465 | (transformingMatrixNode.levelSourceIndex || 0) !== newlyOrderedLastLevelValue.levelSourceIndex && (transformingMatrixNode.levelSourceIndex = newlyOrderedLastLevelValue.levelSourceIndex);
|
39466 | }
|
39467 | }), transformingHierarchyRootNode;
|
39468 | }
|
39469 | DataViewMatrixProjectionOrder.apply = apply;
|
39470 | }(DataViewMatrixProjectionOrder = data.DataViewMatrixProjectionOrder || (data.DataViewMatrixProjectionOrder = {}));
|
39471 | var DataViewMatrixMeasureHeaders;
|
39472 | !function(DataViewMatrixMeasureHeaders) {
|
39473 | function update(prototypeColumnHierarchy, newValueSources) {
|
39474 | var columnHierarchy, prototypeColumnHierarchyLevels = prototypeColumnHierarchy.levels, hasExistingMeasureHeaders = hasMeasureHeadersLevel(prototypeColumnHierarchyLevels), hasDynamicColumnGroupLevel = hasExistingMeasureHeaders ? _.size(prototypeColumnHierarchyLevels) >= 2 : _.size(prototypeColumnHierarchyLevels) >= 1, isMeasureHeadersLevelNeeded = hasDynamicColumnGroupLevel ? newValueSources.length >= 2 : newValueSources.length >= 1;
|
39475 | return columnHierarchy = hasExistingMeasureHeaders ? isMeasureHeadersLevelNeeded ? updateExistingMeasureHeaders(prototypeColumnHierarchy, newValueSources) : removeMeasureHeaders(prototypeColumnHierarchy) : isMeasureHeadersLevelNeeded ? addMeasureHeaders(prototypeColumnHierarchy, newValueSources) : prototypeColumnHierarchy;
|
39476 | }
|
39477 | function hasMeasureHeadersLevel(columnHierarchyLevels) {
|
39478 | return !_.isEmpty(columnHierarchyLevels) && _.every(_.last(columnHierarchyLevels).sources, function(leafLevelSource) {
|
39479 | return leafLevelSource.isMeasure;
|
39480 | });
|
39481 | }
|
39482 | function updateExistingMeasureHeaders(prototypeColumnHierarchy, newValueSources) {
|
39483 | var columnHierarchy = inheritSingle(prototypeColumnHierarchy), columnHierarchyLevels = columnHierarchy.levels = inheritSingle(columnHierarchy.levels), measureHeaderLevelIndex = columnHierarchyLevels.length - 1, measureHeadersLevel = columnHierarchyLevels[measureHeaderLevelIndex] = inheritSingle(columnHierarchyLevels[measureHeaderLevelIndex]);
|
39484 | return measureHeadersLevel.sources = newValueSources, columnHierarchy.root = data.DataViewMatrixUtils.inheritMatrixNodeHierarchy(columnHierarchy.root, measureHeaderLevelIndex, !0),
|
39485 | data.DataViewMatrixUtils.forEachNodeDepthFirst(columnHierarchy.root, function(node) {
|
39486 | return isParentOfMeasureHeaders(node, measureHeaderLevelIndex) ? (node.children = createMeasureHeaderNodes(measureHeaderLevelIndex, newValueSources.length, node.isSubtotal),
|
39487 | 2) : 1;
|
39488 | }), columnHierarchy;
|
39489 | }
|
39490 | function removeMeasureHeaders(prototypeColumnHierarchy) {
|
39491 | var columnHierarchy = inheritSingle(prototypeColumnHierarchy), columnHierarchyLevels = columnHierarchy.levels = inheritSingle(columnHierarchy.levels), measureHeaderLevelIndex = columnHierarchyLevels.length - 1;
|
39492 | return columnHierarchyLevels.splice(measureHeaderLevelIndex, 1), columnHierarchy.root = data.DataViewMatrixUtils.inheritMatrixNodeHierarchy(columnHierarchy.root, measureHeaderLevelIndex, !0),
|
39493 | data.DataViewMatrixUtils.forEachNodeDepthFirst(columnHierarchy.root, function(node) {
|
39494 | return isParentOfMeasureHeaders(node, measureHeaderLevelIndex) ? (node.children = void 0,
|
39495 | 2) : 1;
|
39496 | }), columnHierarchy;
|
39497 | }
|
39498 | function addMeasureHeaders(prototypeColumnHierarchy, newValueSources) {
|
39499 | var columnHierarchy = inheritSingle(prototypeColumnHierarchy), columnHierarchyLevels = columnHierarchy.levels = inheritSingle(columnHierarchy.levels), measureHeaderLevel = {
|
39500 | sources: newValueSources
|
39501 | };
|
39502 | columnHierarchyLevels.push(measureHeaderLevel);
|
39503 | var measureHeaderLevelIndex = columnHierarchyLevels.length - 1;
|
39504 | return columnHierarchy.root = data.DataViewMatrixUtils.inheritMatrixNodeHierarchy(columnHierarchy.root, measureHeaderLevelIndex, !0),
|
39505 | data.DataViewMatrixUtils.forEachNodeDepthFirst(columnHierarchy.root, function(node) {
|
39506 | return data.DataViewMatrixUtils.isLeafNode(node) ? (node.children = createMeasureHeaderNodes(measureHeaderLevelIndex, newValueSources.length, node.isSubtotal),
|
39507 | 2) : 1;
|
39508 | }), columnHierarchy;
|
39509 | }
|
39510 | function isParentOfMeasureHeaders(node, measureHeadersLevelIndex) {
|
39511 | var childNodes = node.children;
|
39512 | return !_.isEmpty(childNodes) && childNodes[0].level === measureHeadersLevelIndex;
|
39513 | }
|
39514 | function createMeasureHeaderNodes(level, measureFieldCount, isSubtotal) {
|
39515 | for (var measureHeaderNodes = [], i = 0, ilen = measureFieldCount; ilen > i; i++) {
|
39516 | var measureHeaderNode = {
|
39517 | level: level
|
39518 | };
|
39519 | i > 0 && (measureHeaderNode.levelSourceIndex = i), isSubtotal && (measureHeaderNode.isSubtotal = !0),
|
39520 | measureHeaderNodes.push(measureHeaderNode);
|
39521 | }
|
39522 | return measureHeaderNodes;
|
39523 | }
|
39524 | DataViewMatrixMeasureHeaders.update = update;
|
39525 | }(DataViewMatrixMeasureHeaders || (DataViewMatrixMeasureHeaders = {}));
|
39526 | }(data = powerbi.data || (powerbi.data = {}));
|
39527 | }(powerbi || (powerbi = {}));
|
39528 | }, function(module, exports) {
|
39529 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
39530 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
39531 | !function(powerbi) {
|
39532 | var data;
|
39533 | !function(data) {
|
39534 | var DataViewPivotCategorical, inherit = powerbi.Prototype.inherit;
|
39535 | !function(DataViewPivotCategorical) {
|
39536 | function apply(dataView) {
|
39537 | var categorical = dataView.categorical;
|
39538 | if (!categorical) return null;
|
39539 | var categories = categorical.categories;
|
39540 | if (!categories || 1 !== categories.length) return null;
|
39541 | var values = categorical.values;
|
39542 | if (_.isEmpty(values) || values.source) return null;
|
39543 | for (var category = categories[0], categoryIdentities = category.identity, categoryValues = category.values, pivotedColumns = [], pivotedValues = [], rowIdx = 0, rowCount = categoryValues.length; rowCount > rowIdx; rowIdx++) for (var categoryValue = categoryValues[rowIdx], categoryIdentity = categoryIdentities[rowIdx], colIdx = 0, colCount = values.length; colCount > colIdx; colIdx++) {
|
39544 | var value = values[colIdx], pivotedColumn = inherit(value.source);
|
39545 | if (value.identity) return null;
|
39546 | pivotedColumn.groupName = categoryValue;
|
39547 | var pivotedValue = {
|
39548 | source: pivotedColumn,
|
39549 | values: [ value.values[rowIdx] ],
|
39550 | identity: categoryIdentity,
|
39551 | min: value.min,
|
39552 | max: value.max,
|
39553 | subtotal: value.subtotal
|
39554 | }, highlights = value.highlights;
|
39555 | highlights && (pivotedValue.highlights = [ highlights[rowIdx] ]), pivotedColumns.push(pivotedColumn),
|
39556 | pivotedValues.push(pivotedValue);
|
39557 | }
|
39558 | var pivotedMetadata = inherit(dataView.metadata);
|
39559 | return pivotedMetadata.columns = pivotedColumns, values = data.DataViewTransform.createValueColumns(pivotedValues, category.identityFields, category.source),
|
39560 | {
|
39561 | metadata: pivotedMetadata,
|
39562 | categorical: {
|
39563 | values: values
|
39564 | },
|
39565 | matrix: dataView.matrix
|
39566 | };
|
39567 | }
|
39568 | DataViewPivotCategorical.apply = apply;
|
39569 | }(DataViewPivotCategorical = data.DataViewPivotCategorical || (data.DataViewPivotCategorical = {}));
|
39570 | }(data = powerbi.data || (powerbi.data = {}));
|
39571 | }(powerbi || (powerbi = {}));
|
39572 | }, function(module, exports) {
|
39573 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
39574 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
39575 | !function(powerbi) {
|
39576 | var data;
|
39577 | !function(data) {
|
39578 | var DataViewPivotMatrix;
|
39579 | !function(DataViewPivotMatrix) {
|
39580 | function apply(dataViewMatrix, context) {
|
39581 | context.columnHierarchyRewritten || (dataViewMatrix.columns = powerbi.Prototype.inherit(dataViewMatrix.columns));
|
39582 | var columns = dataViewMatrix.columns;
|
39583 | context.rowHierarchyRewritten || (dataViewMatrix.rows = powerbi.Prototype.inherit(dataViewMatrix.rows));
|
39584 | var rows = dataViewMatrix.rows;
|
39585 | if (!(columns.levels.length > 1)) {
|
39586 | var pivotedRowNode = {
|
39587 | level: 0
|
39588 | }, columnLeafNodes = columns.root.children, measureCount = columnLeafNodes.length, pivotResultMeasureHeaderLevel = rows.levels.length;
|
39589 | if (measureCount > 0) {
|
39590 | var index_1 = 0, callback = function(node) {
|
39591 | if (node.values) {
|
39592 | pivotedRowNode.values || (pivotedRowNode.values = {});
|
39593 | for (var i = 0; measureCount > i; i++) pivotedRowNode.values[index_1++] = node.values[i];
|
39594 | node.values = void 0;
|
39595 | }
|
39596 | if (measureCount > 1) {
|
39597 | node.children || (node.children = []);
|
39598 | for (var j = 0; measureCount > j; j++) {
|
39599 | var measureHeaderLeaf = {
|
39600 | level: pivotResultMeasureHeaderLevel
|
39601 | }, columnLeafNode = columnLeafNodes[j];
|
39602 | measureHeaderLeaf.levelSourceIndex = columnLeafNode.levelSourceIndex, node.isSubtotal && (measureHeaderLeaf.isSubtotal = !0),
|
39603 | node.children.push(measureHeaderLeaf);
|
39604 | }
|
39605 | }
|
39606 | };
|
39607 | context.hierarchyTreesRewritten ? forEachLeaf(rows.root, callback) : dataViewMatrix.columns.root = cloneTreeExecuteOnLeaf(rows.root, callback);
|
39608 | } else context.hierarchyTreesRewritten || (dataViewMatrix.columns.root = cloneTree(rows.root));
|
39609 | if (measureCount > 1) {
|
39610 | var level = {
|
39611 | sources: columns.levels[0].sources
|
39612 | };
|
39613 | rows.levels.push(level), columns.levels.length = 0;
|
39614 | }
|
39615 | if (context.hierarchyTreesRewritten) dataViewMatrix.columns.root = rows.root, dataViewMatrix.rows.root = {
|
39616 | children: [ pivotedRowNode ]
|
39617 | }; else {
|
39618 | var updatedRowRoot = powerbi.Prototype.inherit(dataViewMatrix.rows.root);
|
39619 | updatedRowRoot.children = [ pivotedRowNode ], dataViewMatrix.rows.root = updatedRowRoot;
|
39620 | }
|
39621 | dataViewMatrix.columns.levels = rows.levels, dataViewMatrix.rows.levels = [];
|
39622 | }
|
39623 | }
|
39624 | function forEachLeaf(root, callback) {
|
39625 | var children = root.children;
|
39626 | if (children && children.length > 0) for (var i = 0, ilen = children.length; ilen > i; i++) forEachLeaf(children[i], callback); else callback(root);
|
39627 | }
|
39628 | function cloneTree(node) {
|
39629 | return cloneTreeExecuteOnLeaf(node);
|
39630 | }
|
39631 | function cloneTreeExecuteOnLeaf(node, callback) {
|
39632 | var updatedNode = powerbi.Prototype.inherit(node), children = node.children;
|
39633 | if (children && children.length > 0) {
|
39634 | for (var newChildren = [], i = 0, ilen = children.length; ilen > i; i++) {
|
39635 | var updatedChild = cloneTreeExecuteOnLeaf(children[i], callback);
|
39636 | newChildren.push(updatedChild);
|
39637 | }
|
39638 | updatedNode.children = newChildren;
|
39639 | } else callback && callback(updatedNode);
|
39640 | return updatedNode;
|
39641 | }
|
39642 | DataViewPivotMatrix.apply = apply, DataViewPivotMatrix.cloneTree = cloneTree, DataViewPivotMatrix.cloneTreeExecuteOnLeaf = cloneTreeExecuteOnLeaf;
|
39643 | }(DataViewPivotMatrix = data.DataViewPivotMatrix || (data.DataViewPivotMatrix = {}));
|
39644 | }(data = powerbi.data || (powerbi.data = {}));
|
39645 | }(powerbi || (powerbi = {}));
|
39646 | }, function(module, exports) {
|
39647 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
39648 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
39649 | !function(powerbi) {
|
39650 | var data;
|
39651 | !function(data) {
|
39652 | function createNullValues(length) {
|
39653 | for (var array = new Array(length), i = 0; length > i; i++) array[i] = null;
|
39654 | return array;
|
39655 | }
|
39656 | function inheritArrayWithValue(nullValues, original, index) {
|
39657 | var inherited = powerbi.Prototype.inherit(nullValues);
|
39658 | return inherited[index] = original[index], inherited;
|
39659 | }
|
39660 | var DataViewSelfCrossJoin;
|
39661 | !function(DataViewSelfCrossJoin) {
|
39662 | function apply(dataView) {
|
39663 | if (dataView.categorical) {
|
39664 | var dataViewCategorical = dataView.categorical;
|
39665 | if (dataViewCategorical.categories && 1 === dataViewCategorical.categories.length && (!dataViewCategorical.values || !dataViewCategorical.values.source)) return applyCategorical(dataView.metadata, dataViewCategorical);
|
39666 | }
|
39667 | }
|
39668 | function applyCategorical(dataViewMetadata, dataViewCategorical) {
|
39669 | var category = dataViewCategorical.categories[0], categoryValues = category.values, categoryLength = categoryValues.length;
|
39670 | if (0 !== categoryLength) {
|
39671 | var valuesArray = dataViewCategorical.values ? dataViewCategorical.values.grouped()[0].values : [], transformedDataView = data.createCategoricalDataViewBuilder().withCategories(dataViewCategorical.categories).withGroupedValues(createGroupedValues(category, categoryValues, categoryLength, valuesArray)).build();
|
39672 | return dataViewMetadata = powerbi.Prototype.inherit(dataViewMetadata), dataViewMetadata.columns = transformedDataView.metadata.columns,
|
39673 | {
|
39674 | metadata: dataViewMetadata,
|
39675 | categorical: transformedDataView.categorical
|
39676 | };
|
39677 | }
|
39678 | }
|
39679 | function createGroupedValues(category, categoryValues, categoryLength, valuesArray) {
|
39680 | for (var nullValuesArray = createNullValues(categoryLength), valuesArrayLen = valuesArray.length, seriesData = [], i = 0; categoryLength > i; i++) {
|
39681 | for (var seriesDataItem = [], j = 0; valuesArrayLen > j; j++) {
|
39682 | var originalValueColumn = valuesArray[j], originalHighlightValues = originalValueColumn.highlights, seriesDataItemCategory = {
|
39683 | values: inheritArrayWithValue(nullValuesArray, originalValueColumn.values, i)
|
39684 | };
|
39685 | originalHighlightValues && (seriesDataItemCategory.highlights = inheritArrayWithValue(nullValuesArray, originalHighlightValues, i)),
|
39686 | seriesDataItem.push(seriesDataItemCategory);
|
39687 | }
|
39688 | seriesData.push(seriesDataItem);
|
39689 | }
|
39690 | return {
|
39691 | groupColumn: {
|
39692 | source: category.source,
|
39693 | identityFrom: {
|
39694 | fields: category.identityFields,
|
39695 | identities: category.identity
|
39696 | },
|
39697 | values: category.values
|
39698 | },
|
39699 | valueColumns: _.map(valuesArray, function(v) {
|
39700 | return {
|
39701 | source: v.source
|
39702 | };
|
39703 | }),
|
39704 | data: seriesData
|
39705 | };
|
39706 | }
|
39707 | DataViewSelfCrossJoin.apply = apply;
|
39708 | }(DataViewSelfCrossJoin = data.DataViewSelfCrossJoin || (data.DataViewSelfCrossJoin = {}));
|
39709 | }(data = powerbi.data || (powerbi.data = {}));
|
39710 | }(powerbi || (powerbi = {}));
|
39711 | }, function(module, exports) {
|
39712 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
39713 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
39714 | !function(powerbi) {
|
39715 | var data;
|
39716 | !function(data) {
|
39717 | var DataViewPivotCategoricalToPrimaryGroups, ArrayExtensions = jsCommon.ArrayExtensions, DataShapeBindingDataReduction = powerbi.data.DataShapeBindingDataReduction, inheritSingle = powerbi.Prototype.inheritSingle;
|
39718 | !function(DataViewPivotCategoricalToPrimaryGroups) {
|
39719 | function pivotBinding(binding, allMappings, finalMapping, defaultDataVolume) {
|
39720 | allMappings && 1 === allMappings.length && finalMapping.categorical && finalMapping.categorical.dataReductionAlgorithm && binding && canPivotCategorical(binding, finalMapping) && (binding.Primary.Groupings = [ binding.Secondary.Groupings[0], binding.Primary.Groupings[0] ],
|
39721 | binding.Secondary = void 0, binding.DataReduction = {
|
39722 | Primary: DataShapeBindingDataReduction.createFrom(finalMapping.categorical.dataReductionAlgorithm),
|
39723 | DataVolume: finalMapping.categorical.dataVolume || defaultDataVolume
|
39724 | });
|
39725 | }
|
39726 | function isPivotableAxis(axis) {
|
39727 | return axis && axis.Groupings && 1 === axis.Groupings.length && !_.isEmpty(axis.Groupings[0].Projections) && !axis.Groupings[0].Subtotal && _.isEmpty(axis.Groupings[0].SuppressedProjections);
|
39728 | }
|
39729 | function canPivotCategorical(binding, mapping) {
|
39730 | return isPivotableAxis(binding.Primary) && isPivotableAxis(binding.Secondary) && 1 === binding.Secondary.Groupings[0].Projections.length ? !binding.DataReduction || !binding.DataReduction.Primary && !binding.DataReduction.Secondary : !1;
|
39731 | }
|
39732 | function unpivotResult(oldDataView, selects, dataViewMappings, projectionActiveItems) {
|
39733 | if (!inferUnpivotTransform(selects, dataViewMappings, oldDataView, projectionActiveItems)) return oldDataView;
|
39734 | var newDataView = {
|
39735 | metadata: {
|
39736 | columns: ArrayExtensions.copy(oldDataView.metadata.columns)
|
39737 | }
|
39738 | };
|
39739 | if (oldDataView.single && (newDataView.single = oldDataView.single), oldDataView.table && (newDataView.table = oldDataView.table),
|
39740 | oldDataView.matrix) {
|
39741 | var newDataViewMatrix = unpivotMatrix(oldDataView.matrix);
|
39742 | if (!_.isEmpty(newDataViewMatrix.valueSources)) {
|
39743 | var hasCompositeGroupInSeries = data.DataViewMatrixUtils.containsCompositeGroup(newDataViewMatrix.columns);
|
39744 | hasCompositeGroupInSeries || (newDataView.categorical = categoricalFromUnpivotedMatrix(newDataViewMatrix, newDataView.metadata.columns));
|
39745 | }
|
39746 | }
|
39747 | return newDataView;
|
39748 | }
|
39749 | function inferUnpivotTransform(selects, dataViewMappings, dataView, projectionActiveItems) {
|
39750 | if (_.isEmpty(selects) || _.isEmpty(dataViewMappings) || !dataView) return !1;
|
39751 | var roleKinds = data.DataViewSelectTransform.createRoleKindFromMetadata(selects, dataView.metadata), projections = data.DataViewSelectTransform.projectionsFromSelects(selects, projectionActiveItems), supportedDataViewMappings = powerbi.DataViewAnalysis.chooseDataViewMappings(projections, dataViewMappings, roleKinds).supportedMappings;
|
39752 | if (!supportedDataViewMappings || 1 !== supportedDataViewMappings.length) return !1;
|
39753 | var categoricalMapping = supportedDataViewMappings[0].categorical;
|
39754 | if (!categoricalMapping) return !1;
|
39755 | var matrixDataview = dataView.matrix;
|
39756 | if (!matrixDataview) return !1;
|
39757 | if (!matrixDataview.rows || !matrixDataview.rows.levels || 2 !== matrixDataview.rows.levels.length) return !1;
|
39758 | var categoryGroups = [], valueGroups = [], addGroupingRole = function(roleName, groups) {
|
39759 | var roleProjections = projections[roleName];
|
39760 | if (roleProjections) for (var _i = 0, _a = roleProjections.all(); _i < _a.length; _i++) {
|
39761 | var roleProjection = _a[_i];
|
39762 | roleKinds[roleProjection.queryRef] === powerbi.VisualDataRoleKind.Grouping && groups.push(roleProjection.queryRef);
|
39763 | }
|
39764 | };
|
39765 | if (powerbi.DataViewMapping.visitCategoricalCategories(categoricalMapping.categories, {
|
39766 | visitRole: function(roleName) {
|
39767 | addGroupingRole(roleName, categoryGroups);
|
39768 | }
|
39769 | }), powerbi.DataViewMapping.visitGrouped(categoricalMapping.values, {
|
39770 | visitRole: function(roleName) {
|
39771 | addGroupingRole(roleName, valueGroups);
|
39772 | }
|
39773 | }), powerbi.DataViewMapping.visitCategoricalValues(categoricalMapping.values, {
|
39774 | visitRole: function(roleName) {
|
39775 | addGroupingRole(roleName, valueGroups);
|
39776 | }
|
39777 | }), _.isEmpty(categoryGroups) || _.isEmpty(valueGroups)) return !1;
|
39778 | for (var _i = 0, _a = matrixDataview.columns.levels; _i < _a.length; _i++) for (var level = _a[_i], _b = 0, _c = level.sources; _b < _c.length; _b++) {
|
39779 | var source = _c[_b];
|
39780 | if (!source.isMeasure) return !1;
|
39781 | }
|
39782 | return !0;
|
39783 | }
|
39784 | function unpivotMatrix(oldMatrix) {
|
39785 | var oldRows = oldMatrix.rows, oldRoot = oldRows.root, oldChildren = oldRoot.children, series = [], seriesIdLevel = oldRows.levels[0], seriesIdFields = oldRoot.childIdentityFields, categoryIndex = {}, categories = [], categoryIdLevel = oldRows.levels[1], categoryIdFields = _.isEmpty(oldChildren) ? void 0 : oldChildren[0].childIdentityFields, measureCount = oldMatrix.valueSources.length, findCategory = function(identity) {
|
39786 | var index = categoryIndex[identity.key];
|
39787 | return index;
|
39788 | };
|
39789 | if (oldChildren) for (var addCategory = function(categoryNode) {
|
39790 | var key = categoryNode.identity.key, index = categoryIndex[key];
|
39791 | void 0 === index && (index = categories.length, categoryIndex[key] = index, categories.push(categoryNode));
|
39792 | }, _i = 0, oldChildren_1 = oldChildren; _i < oldChildren_1.length; _i++) {
|
39793 | var seriesNode = oldChildren_1[_i];
|
39794 | series.push(seriesNode);
|
39795 | for (var _a = 0, _b = seriesNode.children; _a < _b.length; _a++) {
|
39796 | var categoryNode = _b[_a];
|
39797 | addCategory(categoryNode);
|
39798 | }
|
39799 | }
|
39800 | for (var matrixValues = new Array(categories.length), j = 0; j < series.length; ++j) for (var seriesNode = oldChildren[j], _c = 0, _d = seriesNode.children; _c < _d.length; _c++) {
|
39801 | var categoryNode = _d[_c], i = findCategory(categoryNode.identity);
|
39802 | matrixValues[i] || (matrixValues[i] = new Array(series.length)), matrixValues[i][j] = categoryNode.values;
|
39803 | }
|
39804 | var newColumns = {
|
39805 | root: {
|
39806 | children: _.map(series, function(s) {
|
39807 | var inheritedNode = inheritSingle(s);
|
39808 | return inheritedNode.level = 0, inheritedNode.children = void 0, inheritedNode.childIdentityFields = void 0,
|
39809 | inheritedNode;
|
39810 | }),
|
39811 | childIdentityFields: seriesIdFields
|
39812 | },
|
39813 | levels: [ seriesIdLevel ]
|
39814 | };
|
39815 | if (measureCount > 0) {
|
39816 | for (var newColChildren = _.map(oldMatrix.columns.root.children, function(srcnode) {
|
39817 | var dstnode = {
|
39818 | level: 1
|
39819 | };
|
39820 | return srcnode.levelSourceIndex && (dstnode.levelSourceIndex = srcnode.levelSourceIndex),
|
39821 | dstnode;
|
39822 | }), i = 0; i < newColumns.root.children.length; ++i) newColumns.root.children[i].children = newColChildren;
|
39823 | newColumns.levels.push(oldMatrix.columns.levels[0]);
|
39824 | }
|
39825 | var newRows = {
|
39826 | root: {
|
39827 | children: _.map(categories, function(c) {
|
39828 | var inheritedNode = inheritSingle(c);
|
39829 | return inheritedNode.level = 0, inheritedNode.children = void 0, inheritedNode.childIdentityFields = void 0,
|
39830 | inheritedNode;
|
39831 | }),
|
39832 | childIdentityFields: categoryIdFields
|
39833 | },
|
39834 | levels: [ categoryIdLevel ]
|
39835 | };
|
39836 | if (measureCount > 0) for (var i = 0; i < categories.length; ++i) {
|
39837 | for (var row = newRows.root.children[i], rowValues = {}, j = 0; j < series.length; ++j) for (var mvalues = matrixValues[i] && matrixValues[i][j], k = 0; measureCount > k; ++k) {
|
39838 | var l = j * measureCount + k;
|
39839 | rowValues[l] = mvalues ? mvalues[k] : 0 === k ? {
|
39840 | value: null
|
39841 | } : {
|
39842 | value: null,
|
39843 | valueSourceIndex: k
|
39844 | };
|
39845 | }
|
39846 | row.values = rowValues;
|
39847 | }
|
39848 | var newMatrix = {
|
39849 | rows: newRows,
|
39850 | columns: newColumns,
|
39851 | valueSources: oldMatrix.valueSources
|
39852 | };
|
39853 | return newMatrix;
|
39854 | }
|
39855 | function categoricalFromUnpivotedMatrix(matrix, columnMetadata) {
|
39856 | for (var seriesCount = matrix.columns.root.children.length, measureMetadata = matrix.valueSources, measureCount = measureMetadata.length, categories = createCategoryColumnsFromUnpivotedMatrix(matrix), groups = [], j = 0; seriesCount > j; ++j) {
|
39857 | var seriesColumn = matrix.columns.root.children[j], group = {
|
39858 | values: [],
|
39859 | identity: seriesColumn.identity,
|
39860 | name: seriesColumn.value || null
|
39861 | };
|
39862 | groups.push(group);
|
39863 | for (var k = 0; measureCount > k; ++k) {
|
39864 | var valueColumnMetadataSrc = measureMetadata[k], valueColumnMetadataDst = {};
|
39865 | for (var key in valueColumnMetadataSrc) valueColumnMetadataDst[key] = valueColumnMetadataSrc[key];
|
39866 | valueColumnMetadataDst.groupName = group.name, columnMetadata.push(valueColumnMetadataDst);
|
39867 | var valueColumn = {
|
39868 | source: valueColumnMetadataDst,
|
39869 | values: [],
|
39870 | identity: group.identity
|
39871 | };
|
39872 | group.values.push(valueColumn);
|
39873 | for (var index = k + j * measureCount, _i = 0, _a = matrix.rows.root.children; _i < _a.length; _i++) {
|
39874 | var categoryNode = _a[_i], value = categoryNode.values[index].value;
|
39875 | valueColumn.values.push(value);
|
39876 | }
|
39877 | }
|
39878 | }
|
39879 | for (var values = [], _b = 0, groups_1 = groups; _b < groups_1.length; _b++) for (var group = groups_1[_b], k = 0; measureCount > k; ++k) values.push(group.values[k]);
|
39880 | values.grouped = function() {
|
39881 | return groups;
|
39882 | }, values.identityFields = matrix.columns.root.childIdentityFields, values.source = matrix.columns.levels[0].sources[0];
|
39883 | var categorical = {
|
39884 | categories: categories,
|
39885 | values: values
|
39886 | };
|
39887 | return categorical;
|
39888 | }
|
39889 | function createCategoryColumnsFromUnpivotedMatrix(unpivotedMatrix) {
|
39890 | for (var categoryIdentity = _.map(unpivotedMatrix.rows.root.children, function(x) {
|
39891 | return x.identity;
|
39892 | }), categoryIdentityFields = unpivotedMatrix.rows.root.childIdentityFields, categorySourceColumns = unpivotedMatrix.rows.levels[0].sources, categories = [], i = 0, ilen = categorySourceColumns.length; ilen > i; i++) {
|
39893 | var groupLevelValues = _.map(unpivotedMatrix.rows.root.children, function(categoryNode) {
|
39894 | var levelValues = categoryNode.levelValues;
|
39895 | return void 0 !== levelValues ? levelValues[i].value : void 0;
|
39896 | });
|
39897 | categories.push({
|
39898 | source: categorySourceColumns[i],
|
39899 | values: groupLevelValues,
|
39900 | identity: categoryIdentity,
|
39901 | identityFields: categoryIdentityFields
|
39902 | });
|
39903 | }
|
39904 | return categories;
|
39905 | }
|
39906 | DataViewPivotCategoricalToPrimaryGroups.pivotBinding = pivotBinding, DataViewPivotCategoricalToPrimaryGroups.unpivotResult = unpivotResult;
|
39907 | }(DataViewPivotCategoricalToPrimaryGroups = data.DataViewPivotCategoricalToPrimaryGroups || (data.DataViewPivotCategoricalToPrimaryGroups = {}));
|
39908 | }(data = powerbi.data || (powerbi.data = {}));
|
39909 | }(powerbi || (powerbi = {}));
|
39910 | }, function(module, exports) {
|
39911 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
39912 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
39913 | !function(powerbi) {
|
39914 | var data;
|
39915 | !function(data) {
|
39916 | var DataViewRemoveSelects, EnumExtensions = jsCommon.EnumExtensions;
|
39917 | !function(DataViewRemoveSelects) {
|
39918 | function apply(dataView, targetDataViewKinds, selectsToInclude) {
|
39919 | selectsToInclude && dataView.categorical && EnumExtensions.hasFlag(targetDataViewKinds, 1) && applyToCategorical(dataView.categorical, selectsToInclude);
|
39920 | }
|
39921 | function applyToCategorical(categorical, selectsToInclude) {
|
39922 | var valueColumns = categorical.values;
|
39923 | if (valueColumns) {
|
39924 | var updatedColumns = void 0;
|
39925 | valueColumns.source && (selectsToInclude[valueColumns.source.index] || (valueColumns.source = void 0,
|
39926 | updatedColumns = !0));
|
39927 | for (var i = valueColumns.length - 1; i >= 0; i--) selectsToInclude[valueColumns[i].source.index] || (valueColumns.splice(i, 1),
|
39928 | updatedColumns = !0);
|
39929 | if (updatedColumns) {
|
39930 | var hasRemainingDynamicSeries = !!valueColumns.source, hasRemainingMeasures = valueColumns.length > 0;
|
39931 | hasRemainingDynamicSeries || hasRemainingMeasures ? data.DataViewCategoricalEvalGrouped.apply(categorical) : categorical.values = void 0;
|
39932 | }
|
39933 | }
|
39934 | }
|
39935 | DataViewRemoveSelects.apply = apply;
|
39936 | }(DataViewRemoveSelects = data.DataViewRemoveSelects || (data.DataViewRemoveSelects = {}));
|
39937 | }(data = powerbi.data || (powerbi.data = {}));
|
39938 | }(powerbi || (powerbi = {}));
|
39939 | }, function(module, exports) {
|
39940 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
39941 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
39942 | !function(powerbi) {
|
39943 | var data;
|
39944 | !function(data) {
|
39945 | var DataViewTransform, inherit = powerbi.Prototype.inherit, inheritSingle = powerbi.Prototype.inheritSingle, ArrayExtensions = jsCommon.ArrayExtensions, EnumExtensions = jsCommon.EnumExtensions;
|
39946 | !function(DataViewTransform) {
|
39947 | function apply(options) {
|
39948 | var prototype = options.prototype, objectDescriptors = options.objectDescriptors, dataViewMappings = options.dataViewMappings, transforms = options.transforms, projectionActiveItems = transforms && transforms.roles && transforms.roles.activeItems, colorAllocatorFactory = options.colorAllocatorFactory, dataRoles = options.dataRoles;
|
39949 | if (!prototype) return transformEmptyDataView(objectDescriptors, transforms, colorAllocatorFactory);
|
39950 | if (!transforms) return [ prototype ];
|
39951 | prototype = data.DataViewPivotCategoricalToPrimaryGroups.unpivotResult(prototype, transforms.selects, dataViewMappings, projectionActiveItems);
|
39952 | var visualDataViews = transformQueryToVisualDataView(prototype, transforms, objectDescriptors, dataViewMappings, colorAllocatorFactory, dataRoles);
|
39953 | return visualDataViews = data.DataViewRegression.run({
|
39954 | dataViewMappings: dataViewMappings,
|
39955 | visualDataViews: visualDataViews,
|
39956 | dataRoles: dataRoles,
|
39957 | objectDescriptors: objectDescriptors,
|
39958 | objectDefinitions: transforms.objects,
|
39959 | colorAllocatorFactory: colorAllocatorFactory,
|
39960 | transformSelects: transforms.selects,
|
39961 | metadata: prototype.metadata,
|
39962 | projectionActiveItems: projectionActiveItems
|
39963 | });
|
39964 | }
|
39965 | function transformQueryToVisualDataView(prototype, transforms, objectDescriptors, dataViewMappings, colorAllocatorFactory, dataRoles) {
|
39966 | var transformedDataViews = [], splits = transforms.splits;
|
39967 | if (_.isEmpty(splits)) transformedDataViews.push(transformDataView(prototype, objectDescriptors, dataViewMappings, transforms, colorAllocatorFactory, dataRoles)); else for (var _i = 0, splits_1 = splits; _i < splits_1.length; _i++) {
|
39968 | var split = splits_1[_i], transformed = transformDataView(prototype, objectDescriptors, dataViewMappings, transforms, colorAllocatorFactory, dataRoles, split.selects);
|
39969 | transformedDataViews.push(transformed);
|
39970 | }
|
39971 | return transformedDataViews;
|
39972 | }
|
39973 | function transformEmptyDataView(objectDescriptors, transforms, colorAllocatorFactory) {
|
39974 | if (transforms && transforms.objects) {
|
39975 | var emptyDataView = {
|
39976 | metadata: {
|
39977 | columns: []
|
39978 | }
|
39979 | };
|
39980 | return transformObjects(emptyDataView, 0, objectDescriptors, transforms.objects, transforms.selects, colorAllocatorFactory),
|
39981 | [ emptyDataView ];
|
39982 | }
|
39983 | return [];
|
39984 | }
|
39985 | function transformDataView(prototype, objectDescriptors, roleMappings, transforms, colorAllocatorFactory, dataRoles, selectsToInclude) {
|
39986 | var targetKinds = getTargetKinds(roleMappings), transformed = inherit(prototype);
|
39987 | transformed.metadata = inherit(prototype.metadata);
|
39988 | var projectionOrdering = transforms.roles && transforms.roles.ordering, projectionActiveItems = transforms.roles && transforms.roles.activeItems;
|
39989 | return transformed = transformSelects(transformed, targetKinds, roleMappings, transforms.selects, projectionOrdering),
|
39990 | transformObjects(transformed, targetKinds, objectDescriptors, transforms.objects, transforms.selects, colorAllocatorFactory),
|
39991 | data.DataViewRemoveSelects.apply(transformed, targetKinds, selectsToInclude), transformed = data.DataViewConcatenateCategoricalColumns.detectAndApply(transformed, objectDescriptors, roleMappings, projectionOrdering, transforms.selects, projectionActiveItems),
|
39992 | data.DataViewNormalizeValues.apply({
|
39993 | dataview: transformed,
|
39994 | dataViewMappings: roleMappings,
|
39995 | dataRoles: dataRoles
|
39996 | }), transformed;
|
39997 | }
|
39998 | function getTargetKinds(roleMappings) {
|
39999 | if (!roleMappings) return 0;
|
40000 | for (var result = 0, _i = 0, roleMappings_1 = roleMappings; _i < roleMappings_1.length; _i++) {
|
40001 | var roleMapping = roleMappings_1[_i];
|
40002 | roleMapping.categorical && (result |= 1), roleMapping.matrix && (result |= 2), roleMapping.single && (result |= 4),
|
40003 | roleMapping.table && (result |= 8), roleMapping.tree && (result |= 16);
|
40004 | }
|
40005 | return result;
|
40006 | }
|
40007 | function transformSelects(dataView, targetDataViewKinds, roleMappings, selectTransforms, projectionOrdering) {
|
40008 | var columnRewrites = [];
|
40009 | if (selectTransforms && (dataView.metadata.columns = applyTransformsToColumns(dataView.metadata.columns, selectTransforms, columnRewrites),
|
40010 | evaluateAggregateSources(dataView, selectTransforms)), dataView.categorical && EnumExtensions.hasFlag(targetDataViewKinds, 1) && (dataView.categorical = applyRewritesToCategorical(dataView.categorical, columnRewrites),
|
40011 | dataView = pivotIfNecessary(dataView, roleMappings)), dataView.matrix && EnumExtensions.hasFlag(targetDataViewKinds, 2)) {
|
40012 | var matrixTransformationContext = {
|
40013 | rowHierarchyRewritten: !1,
|
40014 | columnHierarchyRewritten: !1,
|
40015 | hierarchyTreesRewritten: !1
|
40016 | };
|
40017 | dataView.matrix = applyRewritesToMatrix(dataView.matrix, columnRewrites, roleMappings, projectionOrdering, matrixTransformationContext),
|
40018 | shouldPivotMatrix(dataView.matrix, roleMappings) && data.DataViewPivotMatrix.apply(dataView.matrix, matrixTransformationContext);
|
40019 | }
|
40020 | return dataView.table && EnumExtensions.hasFlag(targetDataViewKinds, 8) && (dataView.table = applyRewritesToTable(dataView.table, columnRewrites, projectionOrdering)),
|
40021 | dataView;
|
40022 | }
|
40023 | function applyTransformsToColumns(prototypeColumns, selects, rewrites) {
|
40024 | if (!selects) return prototypeColumns;
|
40025 | for (var columns = inherit(prototypeColumns), i = 0, len = prototypeColumns.length; len > i; i++) {
|
40026 | var prototypeColumn = prototypeColumns[i], select = selects[prototypeColumn.index];
|
40027 | if (select) {
|
40028 | var column = columns[i] = inheritColumnProperties(prototypeColumn, select);
|
40029 | rewrites.push({
|
40030 | from: prototypeColumn,
|
40031 | to: column
|
40032 | });
|
40033 | }
|
40034 | }
|
40035 | return columns;
|
40036 | }
|
40037 | function inheritColumnProperties(prototypeColumn, select) {
|
40038 | var column = inherit(prototypeColumn);
|
40039 | return select.roles && (column.roles = select.roles), select.type && (column.type = select.type),
|
40040 | column.format = getFormatForColumn(select, column), select.displayName && (column.displayName = select.displayName),
|
40041 | select.queryName && (column.queryName = select.queryName), select.expr && (column.expr = select.expr),
|
40042 | select.kpi && (column.kpi = select.kpi), select.sort && (column.sort = select.sort),
|
40043 | select.discourageAggregationAcrossGroups && (column.discourageAggregationAcrossGroups = select.discourageAggregationAcrossGroups),
|
40044 | column;
|
40045 | }
|
40046 | function evaluateAggregateSources(dataView, selects) {
|
40047 | if (selects) for (var evalContext, columns = dataView.metadata.columns, selectIdx = 0, len = selects.length; len > selectIdx; selectIdx++) {
|
40048 | var select = selects[selectIdx], aggregateSources = select && select.aggregateSources;
|
40049 | if (aggregateSources) {
|
40050 | evalContext || (evalContext = data.createStaticEvalContext(data.createColorAllocatorCache(), dataView, selects));
|
40051 | var column = findOrCreateColumn(columns, selectIdx, select), columnAggregates = column.aggregates = {}, type = powerbi.ValueType.fromDescriptor(column.type), value = evaluateAggregate(evalContext, selects, type, aggregateSources.min);
|
40052 | void 0 !== value && (columnAggregates.min = value), value = evaluateAggregate(evalContext, selects, type, aggregateSources.max),
|
40053 | void 0 !== value && (columnAggregates.max = value);
|
40054 | }
|
40055 | }
|
40056 | }
|
40057 | function findOrCreateColumn(columns, selectIdx, select) {
|
40058 | for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
|
40059 | var column = columns_1[_i];
|
40060 | if (column.index === selectIdx && void 0 === column.groupName) return column;
|
40061 | }
|
40062 | var newColumn = inheritColumnProperties({
|
40063 | displayName: select.displayName
|
40064 | }, select);
|
40065 | return columns.push(newColumn), newColumn;
|
40066 | }
|
40067 | function evaluateAggregate(evalContext, selects, type, source) {
|
40068 | var select = selects[source.index];
|
40069 | return select ? data.DataViewObjectEvaluator.evaluateValue(evalContext, select.expr, type) : void 0;
|
40070 | }
|
40071 | function getFormatForColumn(select, column) {
|
40072 | return select.format || column.format;
|
40073 | }
|
40074 | function applyRewritesToCategorical(prototype, columnRewrites) {
|
40075 | function override(value) {
|
40076 | var rewrittenSource = findOverride(value.source, columnRewrites);
|
40077 | if (rewrittenSource) {
|
40078 | var rewritten = inherit(value);
|
40079 | return rewritten.source = rewrittenSource, rewritten;
|
40080 | }
|
40081 | }
|
40082 | var categorical = inherit(prototype), categories = powerbi.Prototype.overrideArray(prototype.categories, override);
|
40083 | if (categories && (categorical.categories = categories), prototype.values) {
|
40084 | var valueColumns = powerbi.Prototype.overrideArray(prototype.values, override) || inheritSingle(prototype.values);
|
40085 | if (categorical.values = valueColumns, valueColumns.source) {
|
40086 | var rewrittenValuesSource = findOverride(valueColumns.source, columnRewrites);
|
40087 | rewrittenValuesSource && (valueColumns.source = rewrittenValuesSource);
|
40088 | }
|
40089 | }
|
40090 | return data.DataViewCategoricalEvalGrouped.apply(categorical), categorical;
|
40091 | }
|
40092 | function applyRewritesToTable(prototype, columnRewrites, projectionOrdering) {
|
40093 | var table = inherit(prototype), override = function(metadata) {
|
40094 | return findOverride(metadata, columnRewrites);
|
40095 | }, columns = powerbi.Prototype.overrideArray(prototype.columns, override);
|
40096 | if (columns && (table.columns = columns), !projectionOrdering) return table;
|
40097 | var newToOldPositions = createTableColumnPositionMapping(projectionOrdering, columnRewrites);
|
40098 | if (!newToOldPositions) return table;
|
40099 | for (var columnsClone = columns.slice(0), keys = Object.keys(newToOldPositions), i = 0, len = keys.length; len > i; i++) {
|
40100 | var sourceColumn = columnsClone[newToOldPositions[keys[i]]];
|
40101 | i === columns.length ? columns.push(sourceColumn) : columns[i] = sourceColumn;
|
40102 | }
|
40103 | var rows = powerbi.Prototype.overrideArray(table.rows, function(row) {
|
40104 | for (var newRow = [], i = 0, len = keys.length; len > i; ++i) newRow[i] = row[newToOldPositions[keys[i]]];
|
40105 | return newRow;
|
40106 | });
|
40107 | return rows && (table.rows = rows), table;
|
40108 | }
|
40109 | function createTableColumnPositionMapping(projectionOrdering, columnRewrites) {
|
40110 | var roles = Object.keys(projectionOrdering);
|
40111 | if (1 === roles.length) {
|
40112 | var role = roles[0], originalOrder = _.map(columnRewrites, function(rewrite) {
|
40113 | return rewrite.from.index;
|
40114 | }), newOrder = projectionOrdering[role];
|
40115 | return createOrderMapping(originalOrder, newOrder);
|
40116 | }
|
40117 | }
|
40118 | function applyRewritesToMatrix(prototype, columnRewrites, roleMappings, projectionOrdering, context) {
|
40119 | function override(metadata) {
|
40120 | return findOverride(metadata, columnRewrites);
|
40121 | }
|
40122 | function overrideHierarchy(hierarchy) {
|
40123 | var rewrittenHierarchy = null, newLevels = powerbi.Prototype.overrideArray(hierarchy.levels, function(level) {
|
40124 | var newLevel = null, levelSources = powerbi.Prototype.overrideArray(level.sources, override);
|
40125 | return levelSources && (newLevel = ensureRewritten(newLevel, level, function(h) {
|
40126 | return h.sources = levelSources;
|
40127 | })), newLevel;
|
40128 | });
|
40129 | return newLevels && (rewrittenHierarchy = ensureRewritten(rewrittenHierarchy, hierarchy, function(r) {
|
40130 | return r.levels = newLevels;
|
40131 | })), rewrittenHierarchy;
|
40132 | }
|
40133 | var firstRoleMappingWithMatrix = _.find(roleMappings, function(roleMapping) {
|
40134 | return !!roleMapping.matrix;
|
40135 | }), matrixMapping = firstRoleMappingWithMatrix.matrix, matrix = inherit(prototype), rows = overrideHierarchy(matrix.rows);
|
40136 | rows && (matrix.rows = rows, context.rowHierarchyRewritten = !0);
|
40137 | var columns = overrideHierarchy(matrix.columns);
|
40138 | columns && (matrix.columns = columns, context.columnHierarchyRewritten = !0);
|
40139 | var valueSources = powerbi.Prototype.overrideArray(matrix.valueSources, override);
|
40140 | return valueSources && (matrix.valueSources = valueSources), data.DataViewMatrixProjectionOrder.apply(matrix, matrixMapping, projectionOrdering, context),
|
40141 | matrix;
|
40142 | }
|
40143 | function createOrderMapping(originalOrder, newOrder) {
|
40144 | if (!ArrayExtensions.sequenceEqual(originalOrder, newOrder, function(x, y) {
|
40145 | return x === y;
|
40146 | })) {
|
40147 | for (var mapping = {}, i = 0, len = newOrder.length; len > i; ++i) {
|
40148 | var newPosition = newOrder[i];
|
40149 | mapping[i] = originalOrder.indexOf(newPosition);
|
40150 | }
|
40151 | return mapping;
|
40152 | }
|
40153 | }
|
40154 | function findOverride(source, columnRewrites) {
|
40155 | for (var i = 0, len = columnRewrites.length; len > i; i++) {
|
40156 | var columnRewrite = columnRewrites[i];
|
40157 | if (columnRewrite.from === source) return columnRewrite.to;
|
40158 | }
|
40159 | }
|
40160 | function ensureRewritten(rewritten, prototype, callback) {
|
40161 | return rewritten || (rewritten = inherit(prototype)), callback && callback(rewritten),
|
40162 | rewritten;
|
40163 | }
|
40164 | function transformObjects(dataView, targetDataViewKinds, objectDescriptors, objectDefinitions, selectTransforms, colorAllocatorFactory) {
|
40165 | if (objectDescriptors) {
|
40166 | var objectsForAllSelectors = data.DataViewObjectEvaluationUtils.groupObjectsBySelector(objectDefinitions);
|
40167 | data.DataViewObjectEvaluationUtils.addImplicitObjects(objectsForAllSelectors, objectDescriptors, dataView.metadata.columns, selectTransforms);
|
40168 | var metadataOnce = objectsForAllSelectors.metadataOnce, dataObjects = objectsForAllSelectors.data;
|
40169 | metadataOnce && evaluateMetadataObjects(dataView, selectTransforms, objectDescriptors, metadataOnce.objects, dataObjects, colorAllocatorFactory);
|
40170 | var metadataObjects = objectsForAllSelectors.metadata;
|
40171 | if (metadataObjects) for (var i = 0, len = metadataObjects.length; len > i; i++) {
|
40172 | var metadataObject = metadataObjects[i], objectDefns = metadataObject.objects, colorAllocatorCache = populateColorAllocatorCache(dataView, selectTransforms, objectDefns, colorAllocatorFactory);
|
40173 | evaluateMetadataRepetition(dataView, selectTransforms, objectDescriptors, metadataObject.selector, objectDefns, colorAllocatorCache);
|
40174 | }
|
40175 | for (var i = 0, len = dataObjects.length; len > i; i++) {
|
40176 | var dataObject = dataObjects[i], objectDefns = dataObject.objects, colorAllocatorCache = populateColorAllocatorCache(dataView, selectTransforms, objectDefns, colorAllocatorFactory);
|
40177 | evaluateDataRepetition(dataView, targetDataViewKinds, selectTransforms, objectDescriptors, dataObject.selector, dataObject.rules, objectDefns, colorAllocatorCache);
|
40178 | }
|
40179 | var userDefined = objectsForAllSelectors.userDefined;
|
40180 | userDefined && evaluateUserDefinedObjects(dataView, selectTransforms, objectDescriptors, userDefined, colorAllocatorFactory);
|
40181 | }
|
40182 | }
|
40183 | function evaluateUserDefinedObjects(dataView, selectTransforms, objectDescriptors, objectDefns, colorAllocatorFactory) {
|
40184 | var dataViewObjects = dataView.metadata.objects;
|
40185 | dataViewObjects || (dataViewObjects = dataView.metadata.objects = {});
|
40186 | for (var _i = 0, objectDefns_1 = objectDefns; _i < objectDefns_1.length; _i++) {
|
40187 | var objectDefn = objectDefns_1[_i], id = objectDefn.selector.id, colorAllocatorCache = populateColorAllocatorCache(dataView, selectTransforms, objectDefn.objects, colorAllocatorFactory), evalContext = data.createStaticEvalContext(colorAllocatorCache, dataView, selectTransforms), objects = data.DataViewObjectEvaluationUtils.evaluateDataViewObjects(evalContext, objectDescriptors, objectDefn.objects);
|
40188 | for (var objectName in objects) {
|
40189 | var object = objects[objectName], map = dataViewObjects[objectName];
|
40190 | map || (map = dataViewObjects[objectName] = []), map.push({
|
40191 | id: id,
|
40192 | object: object
|
40193 | });
|
40194 | }
|
40195 | }
|
40196 | }
|
40197 | function evaluateMetadataObjects(dataView, selectTransforms, objectDescriptors, objectDefns, dataObjects, colorAllocatorFactory) {
|
40198 | var colorAllocatorCache = populateColorAllocatorCache(dataView, selectTransforms, objectDefns, colorAllocatorFactory), evalContext = data.createStaticEvalContext(colorAllocatorCache, dataView, selectTransforms), objects = data.DataViewObjectEvaluationUtils.evaluateDataViewObjects(evalContext, objectDescriptors, objectDefns);
|
40199 | if (objects) {
|
40200 | dataView.metadata.objects = objects;
|
40201 | for (var objectName in objects) {
|
40202 | var object = objects[objectName], objectDesc = objectDescriptors[objectName];
|
40203 | for (var propertyName in object) {
|
40204 | var propertyDesc = objectDesc.properties[propertyName], ruleDesc = propertyDesc.rule;
|
40205 | if (ruleDesc) {
|
40206 | var definitions = createRuleEvaluationInstance(dataView, colorAllocatorFactory, ruleDesc, objectName, object[propertyName], propertyDesc.type);
|
40207 | _.isEmpty(definitions) || dataObjects.push.apply(dataObjects, definitions);
|
40208 | }
|
40209 | }
|
40210 | }
|
40211 | }
|
40212 | }
|
40213 | function createRuleEvaluationInstance(dataView, colorAllocatorFactory, ruleDesc, objectName, propertyValue, ruleType) {
|
40214 | var ruleOutput = ruleDesc.output;
|
40215 | if (ruleOutput) {
|
40216 | var selectorsToCreate = findSelectorsForRuleInput(dataView, ruleOutput.selector);
|
40217 | if (!_.isEmpty(selectorsToCreate)) return ruleType.fillRule ? createRuleEvaluationInstanceFillRule(dataView, colorAllocatorFactory, ruleDesc, selectorsToCreate, objectName, propertyValue) : void 0;
|
40218 | }
|
40219 | }
|
40220 | function createRuleEvaluationInstanceFillRule(dataView, colorAllocatorFactory, ruleDesc, selectorsToCreate, objectName, propertyValue) {
|
40221 | var colorAllocator = tryCreateColorAllocatorForFillRule(dataView, colorAllocatorFactory, ruleDesc.inputRole, 1, propertyValue);
|
40222 | if (colorAllocator) {
|
40223 | var rule = new data.ColorRuleEvaluation(ruleDesc.inputRole, colorAllocator), fillRuleProperties = {};
|
40224 | fillRuleProperties[ruleDesc.output.property] = {
|
40225 | solid: {
|
40226 | color: rule
|
40227 | }
|
40228 | };
|
40229 | for (var objectDefinitions = [], selectorIndex = 0, selectorCount = selectorsToCreate.length; selectorCount > selectorIndex; selectorIndex++) objectDefinitions.push({
|
40230 | selector: selectorsToCreate[selectorIndex],
|
40231 | rules: [ rule ],
|
40232 | objects: [ {
|
40233 | name: objectName,
|
40234 | properties: fillRuleProperties
|
40235 | } ]
|
40236 | });
|
40237 | return objectDefinitions;
|
40238 | }
|
40239 | }
|
40240 | function tryCreateColorAllocatorForFillRule(dataView, colorAllocatorFactory, identifier, identifierKind, propertyValue) {
|
40241 | return propertyValue.linearGradient2 ? createColorAllocatorLinearGradient2(dataView, colorAllocatorFactory, identifier, identifierKind, propertyValue, propertyValue.linearGradient2) : propertyValue.linearGradient3 ? createColorAllocatorLinearGradient3(dataView, colorAllocatorFactory, identifier, identifierKind, propertyValue, propertyValue.linearGradient3) : void 0;
|
40242 | }
|
40243 | function createColorAllocatorLinearGradient2(dataView, colorAllocatorFactory, identifier, identifierKind, propertyValueFillRule, linearGradient2) {
|
40244 | if (linearGradient2 = propertyValueFillRule.linearGradient2, void 0 === linearGradient2.min.value || void 0 === linearGradient2.max.value) {
|
40245 | var inputRange = findRuleInputColumnNumberRange(dataView, identifier, identifierKind);
|
40246 | if (!inputRange) return;
|
40247 | void 0 === linearGradient2.min.value && (linearGradient2.min.value = inputRange.min),
|
40248 | void 0 === linearGradient2.max.value && (linearGradient2.max.value = inputRange.max);
|
40249 | }
|
40250 | return colorAllocatorFactory.linearGradient2(propertyValueFillRule.linearGradient2);
|
40251 | }
|
40252 | function createColorAllocatorLinearGradient3(dataView, colorAllocatorFactory, identifier, identifierKind, propertyValueFillRule, linearGradient3) {
|
40253 | var splitScales;
|
40254 | if (linearGradient3 = propertyValueFillRule.linearGradient3, void 0 === linearGradient3.min.value || void 0 === linearGradient3.mid.value || void 0 === linearGradient3.max.value) {
|
40255 | var inputRange = findRuleInputColumnNumberRange(dataView, identifier, identifierKind);
|
40256 | if (!inputRange) return;
|
40257 | if (splitScales = void 0 === linearGradient3.min.value && void 0 === linearGradient3.max.value && void 0 !== linearGradient3.mid.value,
|
40258 | void 0 === linearGradient3.min.value && (linearGradient3.min.value = inputRange.min),
|
40259 | void 0 === linearGradient3.max.value && (linearGradient3.max.value = inputRange.max),
|
40260 | void 0 === linearGradient3.mid.value) {
|
40261 | var midValue = (linearGradient3.max.value + linearGradient3.min.value) / 2;
|
40262 | linearGradient3.mid.value = midValue;
|
40263 | }
|
40264 | }
|
40265 | return colorAllocatorFactory.linearGradient3(propertyValueFillRule.linearGradient3, splitScales);
|
40266 | }
|
40267 | function populateColorAllocatorCache(dataView, selectTransforms, objectDefns, colorAllocatorFactory) {
|
40268 | for (var cache = data.createColorAllocatorCache(), staticEvalContext = data.createStaticEvalContext(), i = 0, len = objectDefns.length; len > i; i++) {
|
40269 | var objectDefnProperties = objectDefns[i].properties;
|
40270 | for (var propertyName in objectDefnProperties) {
|
40271 | var fillProperty = objectDefnProperties[propertyName];
|
40272 | if (fillProperty && fillProperty.solid && fillProperty.solid.color && 23 === fillProperty.solid.color.kind) {
|
40273 | var fillRuleExpr = fillProperty.solid.color, inputExprQueryName = findFirstQueryNameForExpr(selectTransforms, fillRuleExpr.input);
|
40274 | if (!inputExprQueryName) continue;
|
40275 | var fillRule = data.DataViewObjectEvaluator.evaluateProperty(staticEvalContext, fillRulePropertyDescriptor, fillRuleExpr.rule), colorAllocator = tryCreateColorAllocatorForFillRule(dataView, colorAllocatorFactory, inputExprQueryName, 0, fillRule);
|
40276 | colorAllocator && cache.register(fillRuleExpr, colorAllocator);
|
40277 | }
|
40278 | }
|
40279 | }
|
40280 | return cache;
|
40281 | }
|
40282 | function evaluateDataRepetition(dataView, targetDataViewKinds, selectTransforms, objectDescriptors, selector, rules, objectDefns, colorAllocatorCache) {
|
40283 | var containsWildcard = data.Selector.containsWildcard(selector), dataViewCategorical = dataView.categorical;
|
40284 | if (dataViewCategorical && EnumExtensions.hasFlag(targetDataViewKinds, 1)) {
|
40285 | var rewrittenSelector = rewriteCategoricalRoleSelector(dataViewCategorical, selector);
|
40286 | evaluateDataRepetitionCategoricalCategory(dataViewCategorical, selectTransforms, objectDescriptors, rewrittenSelector, rules, containsWildcard, objectDefns, colorAllocatorCache),
|
40287 | evaluateDataRepetitionCategoricalValueGrouping(dataViewCategorical, selectTransforms, objectDescriptors, rewrittenSelector, rules, containsWildcard, objectDefns, colorAllocatorCache);
|
40288 | }
|
40289 | var dataViewMatrix = dataView.matrix;
|
40290 | if (dataViewMatrix && EnumExtensions.hasFlag(targetDataViewKinds, 2)) {
|
40291 | var rewrittenMatrix = evaluateDataRepetitionMatrix(dataViewMatrix, objectDescriptors, selector, rules, containsWildcard, objectDefns, colorAllocatorCache);
|
40292 | rewrittenMatrix && (dataView.matrix = rewrittenMatrix);
|
40293 | }
|
40294 | var dataViewTable = dataView.table;
|
40295 | if (dataViewTable && EnumExtensions.hasFlag(targetDataViewKinds, 8)) {
|
40296 | var rewrittenSelector = rewriteTableRoleSelector(dataViewTable, selector), rewrittenTable = evaluateDataRepetitionTable(dataViewTable, selectTransforms, objectDescriptors, rewrittenSelector, rules, containsWildcard, objectDefns, colorAllocatorCache);
|
40297 | rewrittenTable && (dataView.table = rewrittenTable);
|
40298 | }
|
40299 | }
|
40300 | function rewriteTableRoleSelector(dataViewTable, selector) {
|
40301 | return data.Selector.hasRoleWildcard(selector) && (selector = findSelectorForRoleWildcard(selector, function(r) {
|
40302 | return getIdentityExprsForRolesOnTable(r, dataViewTable);
|
40303 | })), selector;
|
40304 | }
|
40305 | function rewriteCategoricalRoleSelector(dataViewCategorical, selector) {
|
40306 | return data.Selector.hasRoleWildcard(selector) && (selector = findSelectorForRoleWildcard(selector, function(r) {
|
40307 | return getIdentityExprsForRolesOnCategorical(r, dataViewCategorical);
|
40308 | })), selector;
|
40309 | }
|
40310 | function findSelectorForRoleWildcard(selector, getIdentityExprsForRoles) {
|
40311 | for (var resultingSelector = {
|
40312 | data: [],
|
40313 | id: selector.id,
|
40314 | metadata: selector.metadata
|
40315 | }, _i = 0, _a = selector.data; _i < _a.length; _i++) {
|
40316 | var dataSelector = _a[_i];
|
40317 | if (data.Selector.isRoleWildcard(dataSelector)) {
|
40318 | var exprs = getIdentityExprsForRoles(dataSelector.roles);
|
40319 | if (!_.isEmpty(exprs)) {
|
40320 | resultingSelector.data.push(data.DataViewScopeWildcard.fromExprs(exprs));
|
40321 | continue;
|
40322 | }
|
40323 | }
|
40324 | isUniqueDataSelector(resultingSelector.data, dataSelector) && resultingSelector.data.push(dataSelector);
|
40325 | }
|
40326 | return resultingSelector;
|
40327 | }
|
40328 | function getIdentityExprsForRolesOnTable(roles, dataViewTable) {
|
40329 | var allColumnsBelongToSelectorRole = allColumnsBelongToRole(dataViewTable.columns, roles), exprs = dataViewTable.identityFields;
|
40330 | return allColumnsBelongToSelectorRole && exprs ? exprs : void 0;
|
40331 | }
|
40332 | function getIdentityExprsForRolesOnCategorical(roles, dataViewCategorical) {
|
40333 | if (dataViewCategorical.categories) for (var _i = 0, _a = dataViewCategorical.categories; _i < _a.length; _i++) {
|
40334 | var category = _a[_i];
|
40335 | if (category.source && allColumnsBelongToRole([ category.source ], roles)) return category.identityFields;
|
40336 | }
|
40337 | }
|
40338 | function isUniqueDataSelector(dataSelectors, newSelector) {
|
40339 | return _.isEmpty(dataSelectors) ? !0 : !_.any(dataSelectors, function(dataSelector) {
|
40340 | return dataSelector.key === newSelector.key;
|
40341 | });
|
40342 | }
|
40343 | function allColumnsBelongToRole(columns, selectorRoles) {
|
40344 | for (var _i = 0, columns_2 = columns; _i < columns_2.length; _i++) {
|
40345 | var column = columns_2[_i], roles = column.roles;
|
40346 | if (!roles || !_.any(selectorRoles, function(selectorRole) {
|
40347 | return roles[selectorRole];
|
40348 | })) return !1;
|
40349 | }
|
40350 | return !0;
|
40351 | }
|
40352 | function evaluateDataRepetitionCategoricalCategory(dataViewCategorical, selectTransforms, objectDescriptors, selector, rules, containsWildcard, objectDefns, colorAllocatorCache) {
|
40353 | if (dataViewCategorical.categories && 0 !== dataViewCategorical.categories.length) {
|
40354 | var targetColumn = findSelectedCategoricalColumn(dataViewCategorical, selector);
|
40355 | if (targetColumn) {
|
40356 | var foundMatch, identities = targetColumn.identities, evalContext = data.createCategoricalEvalContext(colorAllocatorCache, dataViewCategorical, selectTransforms);
|
40357 | if (identities) {
|
40358 | for (var i = 0, len = identities.length; len > i; i++) {
|
40359 | var identity = identities[i];
|
40360 | if (containsWildcard || data.Selector.matchesData(selector, [ identity ])) {
|
40361 | evalContext.setCurrentRowIndex(i);
|
40362 | var objects = data.DataViewObjectEvaluationUtils.evaluateDataViewObjects(evalContext, objectDescriptors, objectDefns);
|
40363 | if (objects && (targetColumn.column.objects || (targetColumn.column.objects = [],
|
40364 | targetColumn.column.objects.length = len), targetColumn.column.objects[i] = objects),
|
40365 | !containsWildcard) return !0;
|
40366 | foundMatch = !0;
|
40367 | }
|
40368 | }
|
40369 | return foundMatch;
|
40370 | }
|
40371 | }
|
40372 | }
|
40373 | }
|
40374 | function evaluateDataRepetitionCategoricalValueGrouping(dataViewCategorical, selectTransforms, objectDescriptors, selector, rules, containsWildcard, objectDefns, colorAllocatorCache) {
|
40375 | var dataViewCategoricalValues = dataViewCategorical.values;
|
40376 | if (dataViewCategoricalValues && dataViewCategoricalValues.identityFields && data.Selector.matchesKeys(selector, [ dataViewCategoricalValues.identityFields ])) {
|
40377 | var valuesGrouped = dataViewCategoricalValues.grouped();
|
40378 | if (valuesGrouped) {
|
40379 | for (var foundMatch, evalContext = data.createCategoricalEvalContext(colorAllocatorCache, dataViewCategorical, selectTransforms), i = 0, len = valuesGrouped.length; len > i; i++) {
|
40380 | var valueGroup = valuesGrouped[i], selectorMetadata = selector.metadata, valuesInGroup = valueGroup.values;
|
40381 | if (containsWildcard || data.Selector.matchesData(selector, [ valueGroup.identity ])) {
|
40382 | var objects = data.DataViewObjectEvaluationUtils.evaluateDataViewObjects(evalContext, objectDescriptors, objectDefns);
|
40383 | if (objects) if (selectorMetadata) for (var j = 0, jlen = valuesInGroup.length; jlen > j; j++) {
|
40384 | var valueColumn = valuesInGroup[j], valueSource = valueColumn.source;
|
40385 | if (valueSource.queryName === selectorMetadata) {
|
40386 | var valueSourceOverwrite = powerbi.Prototype.inherit(valueSource);
|
40387 | valueSourceOverwrite.objects = objects, valueColumn.source = valueSourceOverwrite,
|
40388 | foundMatch = !0;
|
40389 | break;
|
40390 | }
|
40391 | } else valueGroup.objects = objects, setGrouped(dataViewCategoricalValues, valuesGrouped),
|
40392 | foundMatch = !0;
|
40393 | if (!containsWildcard) return !0;
|
40394 | }
|
40395 | }
|
40396 | return foundMatch;
|
40397 | }
|
40398 | }
|
40399 | }
|
40400 | function evaluateDataRepetitionMatrix(dataViewMatrix, objectDescriptors, selector, rules, containsWildcard, objectDefns, colorAllocatorCache) {
|
40401 | var evalContext = data.createMatrixEvalContext(colorAllocatorCache, dataViewMatrix), rewrittenRows = evaluateDataRepetitionMatrixHierarchy(evalContext, dataViewMatrix.rows, objectDescriptors, selector, rules, containsWildcard, objectDefns), rewrittenCols = evaluateDataRepetitionMatrixHierarchy(evalContext, dataViewMatrix.columns, objectDescriptors, selector, rules, containsWildcard, objectDefns);
|
40402 | if (rewrittenRows || rewrittenCols) {
|
40403 | var rewrittenMatrix = inheritSingle(dataViewMatrix);
|
40404 | return rewrittenRows && (rewrittenMatrix.rows = rewrittenRows), rewrittenCols && (rewrittenMatrix.columns = rewrittenCols),
|
40405 | rewrittenMatrix;
|
40406 | }
|
40407 | }
|
40408 | function evaluateDataRepetitionMatrixHierarchy(evalContext, dataViewMatrixHierarchy, objectDescriptors, selector, rules, containsWildcard, objectDefns) {
|
40409 | if (dataViewMatrixHierarchy) {
|
40410 | var root = dataViewMatrixHierarchy.root;
|
40411 | if (root) {
|
40412 | var rewrittenRoot = evaluateDataRepetitionMatrixNode(evalContext, root, objectDescriptors, selector, rules, containsWildcard, objectDefns);
|
40413 | if (rewrittenRoot) {
|
40414 | var rewrittenHierarchy = inheritSingle(dataViewMatrixHierarchy);
|
40415 | return rewrittenHierarchy.root = rewrittenRoot, rewrittenHierarchy;
|
40416 | }
|
40417 | }
|
40418 | }
|
40419 | }
|
40420 | function evaluateDataRepetitionMatrixNode(evalContext, dataViewNode, objectDescriptors, selector, rules, containsWildcard, objectDefns) {
|
40421 | var childNodes = dataViewNode.children;
|
40422 | if (childNodes) {
|
40423 | var rewrittenNode, shouldSearchChildren, childIdentityFields = dataViewNode.childIdentityFields;
|
40424 | childIdentityFields && (shouldSearchChildren = data.Selector.matchesKeys(selector, [ childIdentityFields ]));
|
40425 | for (var i = 0, len = childNodes.length; len > i; i++) {
|
40426 | var childNode = childNodes[i], identity = childNode.identity, rewrittenChildNode = null;
|
40427 | if (shouldSearchChildren) {
|
40428 | if (containsWildcard || data.Selector.matchesData(selector, [ identity ])) {
|
40429 | var objects = data.DataViewObjectEvaluationUtils.evaluateDataViewObjects(evalContext, objectDescriptors, objectDefns);
|
40430 | objects && (rewrittenChildNode = inheritSingle(childNode), rewrittenChildNode.objects = objects);
|
40431 | }
|
40432 | } else rewrittenChildNode = evaluateDataRepetitionMatrixNode(evalContext, childNode, objectDescriptors, selector, rules, containsWildcard, objectDefns);
|
40433 | if (rewrittenChildNode && (rewrittenNode || (rewrittenNode = inheritNodeAndChildren(dataViewNode)),
|
40434 | rewrittenNode.children[i] = rewrittenChildNode, !containsWildcard)) break;
|
40435 | }
|
40436 | return rewrittenNode;
|
40437 | }
|
40438 | }
|
40439 | function inheritNodeAndChildren(node) {
|
40440 | if (Object.getPrototypeOf(node) !== Object.prototype) return node;
|
40441 | var inherited = inheritSingle(node);
|
40442 | return inherited.children = inherit(node.children), inherited;
|
40443 | }
|
40444 | function evaluateDataRepetitionTable(dataViewTable, selectTransforms, objectDescriptors, selector, rules, containsWildcard, objectDefns, colorAllocatorCache) {
|
40445 | var evalContext = data.createTableEvalContext(colorAllocatorCache, dataViewTable, selectTransforms), rewrittenRows = evaluateDataRepetitionTableRows(evalContext, dataViewTable.columns, dataViewTable.rows, dataViewTable.identity, dataViewTable.identityFields, objectDescriptors, selector, rules, containsWildcard, objectDefns);
|
40446 | if (rewrittenRows) {
|
40447 | var rewrittenTable = inheritSingle(dataViewTable);
|
40448 | return rewrittenTable.rows = rewrittenRows, rewrittenTable;
|
40449 | }
|
40450 | }
|
40451 | function evaluateDataRepetitionTableRows(evalContext, columns, rows, identities, identityFields, objectDescriptors, selector, rules, containsWildcard, objectDefns) {
|
40452 | if (!_.isEmpty(identities) && !_.isEmpty(identityFields) && selector.metadata && data.Selector.matchesKeys(selector, [ identityFields ])) {
|
40453 | var colIdx = _.findIndex(columns, function(col) {
|
40454 | return col.queryName === selector.metadata;
|
40455 | });
|
40456 | if (!(0 > colIdx)) {
|
40457 | for (var inheritedRows, colLen = columns.length, rowIdx = 0, rowLen = identities.length; rowLen > rowIdx; rowIdx++) {
|
40458 | var identity = identities[rowIdx];
|
40459 | if (containsWildcard || data.Selector.matchesData(selector, [ identity ])) {
|
40460 | evalContext.setCurrentRowIndex(rowIdx);
|
40461 | var objects = data.DataViewObjectEvaluationUtils.evaluateDataViewObjects(evalContext, objectDescriptors, objectDefns);
|
40462 | if (objects) {
|
40463 | inheritedRows || (inheritedRows = inheritSingle(rows));
|
40464 | var inheritedRow = inheritedRows[rowIdx] = inheritSingle(inheritedRows[rowIdx]), objectsForColumns = inheritedRow.objects;
|
40465 | objectsForColumns || (inheritedRow.objects = objectsForColumns = new Array(colLen)),
|
40466 | objectsForColumns[colIdx] = objects;
|
40467 | }
|
40468 | if (!containsWildcard) break;
|
40469 | }
|
40470 | }
|
40471 | return inheritedRows;
|
40472 | }
|
40473 | }
|
40474 | }
|
40475 | function evaluateMetadataRepetition(dataView, selectTransforms, objectDescriptors, selector, objectDefns, colorAllocatorCache) {
|
40476 | for (var columns = dataView.metadata.columns, metadataId = selector.metadata, evalContext = data.createStaticEvalContext(colorAllocatorCache, dataView, selectTransforms), i = 0, len = columns.length; len > i; i++) {
|
40477 | var column = columns[i];
|
40478 | if (column.queryName === metadataId) {
|
40479 | var objects = data.DataViewObjectEvaluationUtils.evaluateDataViewObjects(evalContext, objectDescriptors, objectDefns);
|
40480 | objects && (column.objects = objects);
|
40481 | }
|
40482 | }
|
40483 | }
|
40484 | function findSelectedCategoricalColumn(dataViewCategorical, selector) {
|
40485 | var categoricalColumn = dataViewCategorical.categories[0];
|
40486 | if (categoricalColumn.identityFields && data.Selector.matchesKeys(selector, [ categoricalColumn.identityFields ])) {
|
40487 | var identities = categoricalColumn.identity, targetColumn = categoricalColumn, selectedMetadataId = selector.metadata;
|
40488 | if (selectedMetadataId) {
|
40489 | var valueColumns = dataViewCategorical.values;
|
40490 | if (valueColumns) for (var i = 0, len = valueColumns.length; len > i; i++) {
|
40491 | var valueColumn = valueColumns[i];
|
40492 | if (valueColumn.source.queryName === selectedMetadataId) {
|
40493 | targetColumn = valueColumn;
|
40494 | break;
|
40495 | }
|
40496 | }
|
40497 | }
|
40498 | return {
|
40499 | column: targetColumn,
|
40500 | identities: identities
|
40501 | };
|
40502 | }
|
40503 | }
|
40504 | function findSelectorsForRuleInput(dataView, selectorRoles) {
|
40505 | var dataViewCategorical = dataView.categorical;
|
40506 | if (dataViewCategorical) {
|
40507 | for (var categoryRoles, categories = dataViewCategorical.categories, selectorsForRuleInput = [], categoryIndex = 0, categoryCount = categories.length; categoryCount > categoryIndex; categoryIndex++) {
|
40508 | var categoryColumn = categories[categoryIndex], categoryIdentityFields = categoryColumn.identityFields;
|
40509 | categoryRoles = categoryColumn.source.roles;
|
40510 | var columnHasSelectorRole = _.any(selectorRoles, function(role) {
|
40511 | return categoryRoles[role];
|
40512 | });
|
40513 | categoryRoles && categoryIdentityFields && columnHasSelectorRole && selectorsForRuleInput.push({
|
40514 | data: [ data.DataViewScopeWildcard.fromExprs(categoryIdentityFields) ]
|
40515 | });
|
40516 | }
|
40517 | return selectorsForRuleInput;
|
40518 | }
|
40519 | }
|
40520 | function findFirstQueryNameForExpr(selectTransforms, expr) {
|
40521 | if (data.SQExpr.isSelectRef(expr)) return expr.expressionName;
|
40522 | if (selectTransforms) for (var i = 0, len = selectTransforms.length; len > i; i++) {
|
40523 | var select = selectTransforms[i], columnExpr = select.expr;
|
40524 | if (columnExpr && data.SQExpr.equals(expr, select.expr)) return select.queryName;
|
40525 | }
|
40526 | }
|
40527 | function findRuleInputColumnNumberRange(dataView, identifier, identifierKind) {
|
40528 | for (var columns = dataView.metadata.columns, i = 0, len = columns.length; len > i; i++) {
|
40529 | var column = columns[i];
|
40530 | if (1 === identifierKind) {
|
40531 | var valueColRoles = column.roles;
|
40532 | if (!valueColRoles || !valueColRoles[identifier]) continue;
|
40533 | } else if (column.queryName !== identifier) continue;
|
40534 | var aggregates = column.aggregates;
|
40535 | if (aggregates) {
|
40536 | var min = aggregates.min;
|
40537 | if (void 0 === min && (min = aggregates.minLocal), void 0 !== min) {
|
40538 | var max = aggregates.max;
|
40539 | if (void 0 === max && (max = aggregates.maxLocal), void 0 !== max) return {
|
40540 | min: min,
|
40541 | max: max
|
40542 | };
|
40543 | }
|
40544 | }
|
40545 | }
|
40546 | }
|
40547 | function createValueColumns(values, valueIdentityFields, source) {
|
40548 | void 0 === values && (values = []);
|
40549 | var result = values;
|
40550 | return setGrouped(values), valueIdentityFields && (result.identityFields = valueIdentityFields),
|
40551 | source && (result.source = source), result;
|
40552 | }
|
40553 | function setGrouped(values, groupedResult) {
|
40554 | values.grouped = groupedResult ? function() {
|
40555 | return groupedResult;
|
40556 | } : function() {
|
40557 | return groupValues(values);
|
40558 | };
|
40559 | }
|
40560 | function groupValues(values) {
|
40561 | for (var currentGroup, groups = [], i = 0, len = values.length; len > i; i++) {
|
40562 | var value = values[i];
|
40563 | if (!currentGroup || currentGroup.identity !== value.identity) {
|
40564 | if (currentGroup = {
|
40565 | values: []
|
40566 | }, value.identity) {
|
40567 | currentGroup.identity = value.identity;
|
40568 | var source = value.source;
|
40569 | void 0 !== source.groupName ? currentGroup.name = source.groupName : source.displayName && (currentGroup.name = source.displayName);
|
40570 | }
|
40571 | groups.push(currentGroup);
|
40572 | }
|
40573 | currentGroup.values.push(value);
|
40574 | }
|
40575 | return groups;
|
40576 | }
|
40577 | function pivotIfNecessary(dataView, dataViewMappings) {
|
40578 | var transformedDataView;
|
40579 | switch (determineCategoricalTransformation(dataView.categorical, dataViewMappings)) {
|
40580 | case 1:
|
40581 | transformedDataView = data.DataViewPivotCategorical.apply(dataView);
|
40582 | break;
|
40583 |
|
40584 | case 2:
|
40585 | transformedDataView = data.DataViewSelfCrossJoin.apply(dataView);
|
40586 | }
|
40587 | return transformedDataView || dataView;
|
40588 | }
|
40589 | function determineCategoricalTransformation(categorical, dataViewMappings) {
|
40590 | if (categorical && !_.isEmpty(dataViewMappings)) {
|
40591 | var categories = categorical.categories;
|
40592 | if (categories && 1 === categories.length) {
|
40593 | var values = categorical.values;
|
40594 | if (!_.isEmpty(values) && !values.grouped().some(function(vg) {
|
40595 | return !!vg.identity;
|
40596 | })) for (var categoryRoles = categories[0].source.roles, i = 0, len = dataViewMappings.length; len > i; i++) {
|
40597 | var roleMappingCategorical = dataViewMappings[i].categorical;
|
40598 | if (roleMappingCategorical && hasRolesGrouped(categoryRoles, roleMappingCategorical.values)) {
|
40599 | var categoriesMapping = roleMappingCategorical.categories, hasCategoryRole = hasRolesBind(categoryRoles, categoriesMapping) || hasRolesFor(categoryRoles, categoriesMapping);
|
40600 | return hasCategoryRole ? 2 : 1;
|
40601 | }
|
40602 | }
|
40603 | }
|
40604 | }
|
40605 | }
|
40606 | function shouldPivotMatrix(matrix, dataViewMappings) {
|
40607 | if (matrix && !_.isEmpty(dataViewMappings)) {
|
40608 | var rowLevels = matrix.rows.levels;
|
40609 | if (!(rowLevels.length < 1)) {
|
40610 | var rows = matrix.rows.root.children;
|
40611 | if (rows && 0 !== rows.length) for (var rowRoles = rowLevels[0].sources[0].roles, i = 0, len = dataViewMappings.length; len > i; i++) {
|
40612 | var roleMappingMatrix = dataViewMappings[i].matrix;
|
40613 | if (roleMappingMatrix && !hasRolesFor(rowRoles, roleMappingMatrix.rows) && hasRolesFor(rowRoles, roleMappingMatrix.columns)) return !0;
|
40614 | }
|
40615 | }
|
40616 | }
|
40617 | }
|
40618 | function hasRolesBind(roles, roleMapping) {
|
40619 | return roles && roleMapping && roleMapping.bind ? roles[roleMapping.bind.to] : void 0;
|
40620 | }
|
40621 | function hasRolesFor(roles, roleMapping) {
|
40622 | return roles && roleMapping && roleMapping["for"] ? roles[roleMapping["for"]["in"]] : void 0;
|
40623 | }
|
40624 | function hasRolesGrouped(roles, roleMapping) {
|
40625 | return roles && roleMapping && roleMapping.group ? roles[roleMapping.group.by] : void 0;
|
40626 | }
|
40627 | var fillRulePropertyDescriptor = {
|
40628 | type: {
|
40629 | fillRule: {}
|
40630 | }
|
40631 | };
|
40632 | DataViewTransform.apply = apply, DataViewTransform.transformObjects = transformObjects,
|
40633 | DataViewTransform.createValueColumns = createValueColumns, DataViewTransform.setGrouped = setGrouped;
|
40634 | }(DataViewTransform = data.DataViewTransform || (data.DataViewTransform = {}));
|
40635 | }(data = powerbi.data || (powerbi.data = {}));
|
40636 | }(powerbi || (powerbi = {}));
|
40637 | }, function(module, exports) {
|
40638 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
40639 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
40640 | !function(powerbi) {
|
40641 | var data;
|
40642 | !function(data) {
|
40643 | function createDisplayNameGetter(displayNameKey) {
|
40644 | return function(resourceProvider) {
|
40645 | return resourceProvider.get(displayNameKey);
|
40646 | };
|
40647 | }
|
40648 | function getDisplayName(displayNameGetter, resourceProvider) {
|
40649 | return "function" == typeof displayNameGetter ? displayNameGetter(resourceProvider) : "string" == typeof displayNameGetter ? displayNameGetter : void 0;
|
40650 | }
|
40651 | data.createDisplayNameGetter = createDisplayNameGetter, data.getDisplayName = getDisplayName;
|
40652 | }(data = powerbi.data || (powerbi.data = {}));
|
40653 | }(powerbi || (powerbi = {}));
|
40654 | }, function(module, exports) {
|
40655 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
40656 | window.jasmine, window.Microsoft;
|
40657 | }, function(module, exports) {
|
40658 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
40659 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
40660 | !function(powerbi) {
|
40661 | !function(DateTimeUnit) {
|
40662 | DateTimeUnit[DateTimeUnit.Year = 0] = "Year", DateTimeUnit[DateTimeUnit.Month = 1] = "Month",
|
40663 | DateTimeUnit[DateTimeUnit.Week = 2] = "Week", DateTimeUnit[DateTimeUnit.Day = 3] = "Day",
|
40664 | DateTimeUnit[DateTimeUnit.Hour = 4] = "Hour", DateTimeUnit[DateTimeUnit.Minute = 5] = "Minute",
|
40665 | DateTimeUnit[DateTimeUnit.Second = 6] = "Second", DateTimeUnit[DateTimeUnit.Millisecond = 7] = "Millisecond";
|
40666 | }(powerbi.DateTimeUnit || (powerbi.DateTimeUnit = {}));
|
40667 | powerbi.DateTimeUnit;
|
40668 | }(powerbi || (powerbi = {}));
|
40669 | }, function(module, exports) {
|
40670 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
40671 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
40672 | function __() {
|
40673 | this.constructor = d;
|
40674 | }
|
40675 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
40676 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
40677 | });
|
40678 | !function(powerbi) {
|
40679 | var data;
|
40680 | !function(data) {
|
40681 | var SQExprBuilder;
|
40682 | !function(SQExprBuilder) {
|
40683 | function fieldExpr(fieldExpr) {
|
40684 | var sqExpr = FieldExprPattern.visit(fieldExpr, FieldExprToSQExprVisitor.instance);
|
40685 | return sqExpr;
|
40686 | }
|
40687 | function fromColumnAggr(columnAggr) {
|
40688 | return SQExprBuilder.aggregate(fromColumn(columnAggr), columnAggr.aggregate);
|
40689 | }
|
40690 | function fromColumn(column) {
|
40691 | return SQExprBuilder.columnRef(fromEntity(column), column.name);
|
40692 | }
|
40693 | function fromEntity(entityPattern) {
|
40694 | return SQExprBuilder.entity(entityPattern.schema, entityPattern.entity, entityPattern.entityVar);
|
40695 | }
|
40696 | function fromEntityAggr(entityAggr) {
|
40697 | return SQExprBuilder.aggregate(fromEntity(entityAggr), entityAggr.aggregate);
|
40698 | }
|
40699 | function fromHierarchyLevelAggr(hierarchyLevelAggr) {
|
40700 | return SQExprBuilder.aggregate(fromHierarchyLevel(hierarchyLevelAggr), hierarchyLevelAggr.aggregate);
|
40701 | }
|
40702 | function fromHierarchyLevel(hierarchyLevelPattern) {
|
40703 | return SQExprBuilder.hierarchyLevel(fromHierarchy(hierarchyLevelPattern), hierarchyLevelPattern.level);
|
40704 | }
|
40705 | function fromHierarchy(hierarchyPattern) {
|
40706 | return SQExprBuilder.hierarchy(fromEntity(hierarchyPattern), hierarchyPattern.name);
|
40707 | }
|
40708 | SQExprBuilder.fieldExpr = fieldExpr, SQExprBuilder.fromColumnAggr = fromColumnAggr,
|
40709 | SQExprBuilder.fromColumn = fromColumn, SQExprBuilder.fromEntity = fromEntity, SQExprBuilder.fromEntityAggr = fromEntityAggr,
|
40710 | SQExprBuilder.fromHierarchyLevelAggr = fromHierarchyLevelAggr, SQExprBuilder.fromHierarchyLevel = fromHierarchyLevel,
|
40711 | SQExprBuilder.fromHierarchy = fromHierarchy;
|
40712 | var FieldExprToSQExprVisitor = function() {
|
40713 | function FieldExprToSQExprVisitor() {}
|
40714 | return FieldExprToSQExprVisitor.prototype.visitColumn = function(column) {
|
40715 | return fromColumn(column);
|
40716 | }, FieldExprToSQExprVisitor.prototype.visitColumnAggr = function(columnAggr) {
|
40717 | return fromColumnAggr(columnAggr);
|
40718 | }, FieldExprToSQExprVisitor.prototype.visitColumnHierarchyLevelVariation = function(columnHierarchyLevelVariationPattern) {
|
40719 | return SQExprBuilder.propertyVariationSource(this.visitEntity(columnHierarchyLevelVariationPattern.source), columnHierarchyLevelVariationPattern.source.name, columnHierarchyLevelVariationPattern.level.name);
|
40720 | }, FieldExprToSQExprVisitor.prototype.visitEntity = function(entityPattern) {
|
40721 | return fromEntity(entityPattern);
|
40722 | }, FieldExprToSQExprVisitor.prototype.visitEntityAggr = function(entityAggr) {
|
40723 | return fromEntityAggr(entityAggr);
|
40724 | }, FieldExprToSQExprVisitor.prototype.visitHierarchy = function(hierarchyPattern) {
|
40725 | return fromHierarchy(hierarchyPattern);
|
40726 | }, FieldExprToSQExprVisitor.prototype.visitHierarchyLevel = function(level) {
|
40727 | return fromHierarchyLevel(level);
|
40728 | }, FieldExprToSQExprVisitor.prototype.visitHierarchyLevelAggr = function(hierarchyLevelAggr) {
|
40729 | return fromHierarchyLevelAggr(hierarchyLevelAggr);
|
40730 | }, FieldExprToSQExprVisitor.prototype.visitMeasure = function(measure) {
|
40731 | return SQExprBuilder.measureRef(this.visitEntity(measure), measure.name);
|
40732 | }, FieldExprToSQExprVisitor.prototype.visitPercentile = function(percentile) {
|
40733 | var arg = SQExprBuilder.fieldExpr(percentile.arg);
|
40734 | return SQExprBuilder.percentile(arg, percentile.k, percentile.exclusive);
|
40735 | }, FieldExprToSQExprVisitor.prototype.visitPercentOfGrandTotal = function(percentOfGrandTotal) {
|
40736 | var baseSQExpr = SQExprBuilder.fieldExpr(percentOfGrandTotal.baseExpr);
|
40737 | return SQExprBuilder.arithmetic(baseSQExpr, SQExprBuilder.scopedEval(baseSQExpr, []), 3);
|
40738 | }, FieldExprToSQExprVisitor.prototype.visitSelectRef = function(selectRef) {
|
40739 | return SQExprBuilder.selectRef(selectRef.expressionName);
|
40740 | }, FieldExprToSQExprVisitor.instance = new FieldExprToSQExprVisitor(), FieldExprToSQExprVisitor;
|
40741 | }();
|
40742 | }(SQExprBuilder = data.SQExprBuilder || (data.SQExprBuilder = {}));
|
40743 | var SQExprConverter;
|
40744 | !function(SQExprConverter) {
|
40745 | function asFieldPattern(sqExpr, schema) {
|
40746 | return sqExpr.accept(new FieldExprPatternBuilder(schema));
|
40747 | }
|
40748 | SQExprConverter.asFieldPattern = asFieldPattern;
|
40749 | }(SQExprConverter = data.SQExprConverter || (data.SQExprConverter = {}));
|
40750 | var FieldExprPattern, FieldExprPatternBuilder = function(_super) {
|
40751 | function FieldExprPatternBuilder(schema) {
|
40752 | _super.call(this), this.schema = schema;
|
40753 | }
|
40754 | return __extends(FieldExprPatternBuilder, _super), FieldExprPatternBuilder.prototype.visitColumnRef = function(expr) {
|
40755 | var sourceRef = expr.source.accept(SourceExprPatternBuilder.instance);
|
40756 | if (sourceRef && sourceRef.entity) {
|
40757 | var columnRef = sourceRef.entity;
|
40758 | return columnRef.name = expr.ref, {
|
40759 | column: columnRef
|
40760 | };
|
40761 | }
|
40762 | }, FieldExprPatternBuilder.prototype.visitMeasureRef = function(expr) {
|
40763 | var sourceRef = expr.source.accept(SourceExprPatternBuilder.instance);
|
40764 | if (sourceRef && sourceRef.entity) {
|
40765 | var measureRef = sourceRef.entity;
|
40766 | return measureRef.name = expr.ref, {
|
40767 | measure: measureRef
|
40768 | };
|
40769 | }
|
40770 | }, FieldExprPatternBuilder.prototype.visitEntity = function(expr) {
|
40771 | var entityRef = {
|
40772 | schema: expr.schema,
|
40773 | entity: expr.entity
|
40774 | };
|
40775 | return expr.variable && (entityRef.entityVar = expr.variable), {
|
40776 | entity: entityRef
|
40777 | };
|
40778 | }, FieldExprPatternBuilder.prototype.visitAggr = function(expr) {
|
40779 | var fieldPattern = expr.arg.accept(this);
|
40780 | if (fieldPattern && fieldPattern.column) {
|
40781 | var argAggr = fieldPattern.column;
|
40782 | return argAggr.aggregate = expr.func, {
|
40783 | columnAggr: argAggr
|
40784 | };
|
40785 | }
|
40786 | if (fieldPattern && fieldPattern.columnAggr) {
|
40787 | var argAggr = fieldPattern.columnAggr;
|
40788 | return argAggr.aggregate = expr.func, {
|
40789 | columnAggr: argAggr
|
40790 | };
|
40791 | }
|
40792 | if (fieldPattern && fieldPattern.hierarchyLevel) {
|
40793 | var argAggr = fieldPattern.hierarchyLevel;
|
40794 | return argAggr.aggregate = expr.func, {
|
40795 | hierarchyLevelAggr: argAggr
|
40796 | };
|
40797 | }
|
40798 | var sourcePattern = expr.arg.accept(SourceExprPatternBuilder.instance);
|
40799 | if (sourcePattern && sourcePattern.entity) {
|
40800 | var argAggr = sourcePattern.entity;
|
40801 | return argAggr.aggregate = expr.func, {
|
40802 | entityAggr: argAggr
|
40803 | };
|
40804 | }
|
40805 | }, FieldExprPatternBuilder.prototype.visitPercentile = function(expr) {
|
40806 | return {
|
40807 | percentile: {
|
40808 | arg: expr.arg.accept(this),
|
40809 | k: expr.k,
|
40810 | exclusive: expr.exclusive
|
40811 | }
|
40812 | };
|
40813 | }, FieldExprPatternBuilder.prototype.visitHierarchy = function(expr) {
|
40814 | var sourcePattern = expr.arg.accept(SourceExprPatternBuilder.instance);
|
40815 | if (sourcePattern && sourcePattern.entity) {
|
40816 | var hierarchyRef = sourcePattern.entity;
|
40817 | return hierarchyRef.name = expr.hierarchy, {
|
40818 | hierarchy: hierarchyRef
|
40819 | };
|
40820 | }
|
40821 | }, FieldExprPatternBuilder.prototype.visitHierarchyLevel = function(expr) {
|
40822 | var hierarchySourceExprPattern = expr.arg.accept(HierarchyExprPatternBuiler.instance);
|
40823 | if (hierarchySourceExprPattern) {
|
40824 | var hierarchyLevel;
|
40825 | if (hierarchySourceExprPattern.hierarchy && (hierarchyLevel = {
|
40826 | entity: hierarchySourceExprPattern.hierarchy.entity,
|
40827 | schema: hierarchySourceExprPattern.hierarchy.schema,
|
40828 | name: hierarchySourceExprPattern.hierarchy.name,
|
40829 | level: expr.level
|
40830 | }), hierarchySourceExprPattern.variation) {
|
40831 | if (this.schema) {
|
40832 | var variation = hierarchySourceExprPattern.variation, conceptualEntity = this.schema.schema(hierarchySourceExprPattern.variation.column.schema).findTargetEntityOfVariation(hierarchyLevel.entity, variation.column.name, variation.variationName);
|
40833 | conceptualEntity && (hierarchyLevel.entity = conceptualEntity.name);
|
40834 | }
|
40835 | return {
|
40836 | columnHierarchyLevelVariation: {
|
40837 | source: {
|
40838 | entity: hierarchySourceExprPattern.variation.column.entity,
|
40839 | schema: hierarchySourceExprPattern.variation.column.schema,
|
40840 | name: hierarchySourceExprPattern.variation.column.name
|
40841 | },
|
40842 | level: hierarchyLevel,
|
40843 | variationName: hierarchySourceExprPattern.variation.variationName
|
40844 | }
|
40845 | };
|
40846 | }
|
40847 | return {
|
40848 | hierarchyLevel: hierarchyLevel
|
40849 | };
|
40850 | }
|
40851 | }, FieldExprPatternBuilder.prototype.visitArithmetic = function(expr) {
|
40852 | var percentOfGrandTotalPattern = {
|
40853 | percentOfGrandTotal: {
|
40854 | baseExpr: expr.left.accept(this)
|
40855 | }
|
40856 | };
|
40857 | return data.SQExpr.equals(expr, SQExprBuilder.fieldExpr(percentOfGrandTotalPattern)) ? percentOfGrandTotalPattern : void 0;
|
40858 | }, FieldExprPatternBuilder.prototype.visitSelectRef = function(expr) {
|
40859 | return {
|
40860 | selectRef: {
|
40861 | expressionName: expr.expressionName
|
40862 | }
|
40863 | };
|
40864 | }, FieldExprPatternBuilder;
|
40865 | }(data.DefaultSQExprVisitor), SourceExprPatternBuilder = function(_super) {
|
40866 | function SourceExprPatternBuilder() {
|
40867 | _super.apply(this, arguments);
|
40868 | }
|
40869 | return __extends(SourceExprPatternBuilder, _super), SourceExprPatternBuilder.prototype.visitEntity = function(expr) {
|
40870 | var entityRef = {
|
40871 | schema: expr.schema,
|
40872 | entity: expr.entity
|
40873 | };
|
40874 | return expr.variable && (entityRef.entityVar = expr.variable), {
|
40875 | entity: entityRef
|
40876 | };
|
40877 | }, SourceExprPatternBuilder.prototype.visitPropertyVariationSource = function(expr) {
|
40878 | var entityExpr = expr.arg;
|
40879 | if (entityExpr instanceof data.SQEntityExpr) {
|
40880 | var propertyVariationSource = {
|
40881 | schema: entityExpr.schema,
|
40882 | entity: entityExpr.entity,
|
40883 | name: expr.property
|
40884 | };
|
40885 | return entityExpr.variable && (propertyVariationSource.entityVar = entityExpr.variable),
|
40886 | {
|
40887 | variation: {
|
40888 | column: propertyVariationSource,
|
40889 | variationName: expr.name
|
40890 | }
|
40891 | };
|
40892 | }
|
40893 | }, SourceExprPatternBuilder.instance = new SourceExprPatternBuilder(), SourceExprPatternBuilder;
|
40894 | }(data.DefaultSQExprVisitor), HierarchyExprPatternBuiler = function(_super) {
|
40895 | function HierarchyExprPatternBuiler() {
|
40896 | _super.apply(this, arguments);
|
40897 | }
|
40898 | return __extends(HierarchyExprPatternBuiler, _super), HierarchyExprPatternBuiler.prototype.visitHierarchy = function(expr) {
|
40899 | var hierarchyRef, variationRef, exprPattern = expr.arg.accept(SourceExprPatternBuilder.instance);
|
40900 | return exprPattern.variation ? (hierarchyRef = {
|
40901 | name: expr.hierarchy,
|
40902 | schema: exprPattern.variation.column.schema,
|
40903 | entity: exprPattern.variation.column.entity
|
40904 | }, variationRef = exprPattern.variation) : hierarchyRef = {
|
40905 | name: expr.hierarchy,
|
40906 | schema: exprPattern.entity.schema,
|
40907 | entity: exprPattern.entity.entity
|
40908 | }, {
|
40909 | hierarchy: hierarchyRef,
|
40910 | variation: variationRef
|
40911 | };
|
40912 | }, HierarchyExprPatternBuiler.instance = new HierarchyExprPatternBuiler(), HierarchyExprPatternBuiler;
|
40913 | }(data.DefaultSQExprVisitor);
|
40914 | !function(FieldExprPattern) {
|
40915 | function visit(expr, visitor) {
|
40916 | var fieldExprPattern = expr instanceof data.SQExpr ? SQExprConverter.asFieldPattern(expr) : expr;
|
40917 | return fieldExprPattern.column ? visitColumn(fieldExprPattern.column, visitor) : fieldExprPattern.columnAggr ? visitColumnAggr(fieldExprPattern.columnAggr, visitor) : fieldExprPattern.columnHierarchyLevelVariation ? visitColumnHierarchyLevelVariation(fieldExprPattern.columnHierarchyLevelVariation, visitor) : fieldExprPattern.entity ? visitEntity(fieldExprPattern.entity, visitor) : fieldExprPattern.entityAggr ? visitEntityAggr(fieldExprPattern.entityAggr, visitor) : fieldExprPattern.hierarchy ? visitHierarchy(fieldExprPattern.hierarchy, visitor) : fieldExprPattern.hierarchyLevel ? visitHierarchyLevel(fieldExprPattern.hierarchyLevel, visitor) : fieldExprPattern.hierarchyLevelAggr ? visitHierarchyLevelAggr(fieldExprPattern.hierarchyLevelAggr, visitor) : fieldExprPattern.measure ? visitMeasure(fieldExprPattern.measure, visitor) : fieldExprPattern.percentile ? visitPercentile(fieldExprPattern.percentile, visitor) : fieldExprPattern.percentOfGrandTotal ? visitPercentOfGrandTotal(fieldExprPattern.percentOfGrandTotal, visitor) : fieldExprPattern.selectRef ? visitSelectRef(fieldExprPattern.selectRef, visitor) : void 0;
|
40918 | }
|
40919 | function visitColumn(column, visitor) {
|
40920 | return visitor.visitColumn(column);
|
40921 | }
|
40922 | function visitColumnAggr(columnAggr, visitor) {
|
40923 | return visitor.visitColumnAggr(columnAggr);
|
40924 | }
|
40925 | function visitColumnHierarchyLevelVariation(columnHierarchyLevelVariation, visitor) {
|
40926 | return visitor.visitColumnHierarchyLevelVariation(columnHierarchyLevelVariation);
|
40927 | }
|
40928 | function visitEntity(entity, visitor) {
|
40929 | return visitor.visitEntity(entity);
|
40930 | }
|
40931 | function visitEntityAggr(entityAggr, visitor) {
|
40932 | return visitor.visitEntityAggr(entityAggr);
|
40933 | }
|
40934 | function visitHierarchy(hierarchy, visitor) {
|
40935 | return visitor.visitHierarchy(hierarchy);
|
40936 | }
|
40937 | function visitHierarchyLevel(hierarchyLevel, visitor) {
|
40938 | return visitor.visitHierarchyLevel(hierarchyLevel);
|
40939 | }
|
40940 | function visitHierarchyLevelAggr(hierarchyLevelAggr, visitor) {
|
40941 | return visitor.visitHierarchyLevelAggr(hierarchyLevelAggr);
|
40942 | }
|
40943 | function visitMeasure(measure, visitor) {
|
40944 | return visitor.visitMeasure(measure);
|
40945 | }
|
40946 | function visitSelectRef(selectRef, visitor) {
|
40947 | return visitor.visitSelectRef(selectRef);
|
40948 | }
|
40949 | function visitPercentile(percentile, visitor) {
|
40950 | return visitor.visitPercentile(percentile);
|
40951 | }
|
40952 | function visitPercentOfGrandTotal(percentOfGrandTotal, visitor) {
|
40953 | return visitor.visitPercentOfGrandTotal(percentOfGrandTotal);
|
40954 | }
|
40955 | function toColumnRefSQExpr(columnPattern) {
|
40956 | return SQExprBuilder.columnRef(SQExprBuilder.entity(columnPattern.schema, columnPattern.entity, columnPattern.entityVar), columnPattern.name);
|
40957 | }
|
40958 | function getAggregate(fieldExpr) {
|
40959 | return visit(fieldExpr, FieldExprPatternAggregateVisitor.instance);
|
40960 | }
|
40961 | function isAggregation(fieldExpr) {
|
40962 | return visit(fieldExpr, FieldExprPatternIsAggregationVisitor.instance);
|
40963 | }
|
40964 | function hasFieldExprName(fieldExpr) {
|
40965 | return void 0 !== (fieldExpr.column || fieldExpr.columnAggr || fieldExpr.measure);
|
40966 | }
|
40967 | function getPropertyName(fieldExpr) {
|
40968 | return FieldExprPattern.visit(fieldExpr, FieldExprPropertyNameVisitor.instance);
|
40969 | }
|
40970 | function getHierarchyName(fieldExpr) {
|
40971 | var hierarchy = fieldExpr.hierarchy;
|
40972 | return hierarchy ? hierarchy.name : void 0;
|
40973 | }
|
40974 | function getColumnRef(fieldExpr) {
|
40975 | return fieldExpr.columnHierarchyLevelVariation ? fieldExpr.columnHierarchyLevelVariation.source : fieldExpr.column || fieldExpr.measure || fieldExpr.columnAggr;
|
40976 | }
|
40977 | function getFieldExprName(fieldExpr) {
|
40978 | var name = getPropertyName(fieldExpr);
|
40979 | return name ? name : toFieldExprEntityPattern(fieldExpr).entity;
|
40980 | }
|
40981 | function getSchema(fieldExpr) {
|
40982 | var item = FieldExprPattern.toFieldExprEntityItemPattern(fieldExpr);
|
40983 | return item.schema;
|
40984 | }
|
40985 | function toFieldExprEntityPattern(fieldExpr) {
|
40986 | return FieldExprPattern.visit(fieldExpr, FieldExprToEntityExprPatternBuilder.instance);
|
40987 | }
|
40988 | function toFieldExprEntityItemPattern(fieldExpr) {
|
40989 | return FieldExprPattern.visit(fieldExpr, FieldExprToEntityExprPatternBuilder.instance);
|
40990 | }
|
40991 | FieldExprPattern.visit = visit, FieldExprPattern.toColumnRefSQExpr = toColumnRefSQExpr,
|
40992 | FieldExprPattern.getAggregate = getAggregate, FieldExprPattern.isAggregation = isAggregation,
|
40993 | FieldExprPattern.hasFieldExprName = hasFieldExprName, FieldExprPattern.getPropertyName = getPropertyName,
|
40994 | FieldExprPattern.getHierarchyName = getHierarchyName, FieldExprPattern.getColumnRef = getColumnRef,
|
40995 | FieldExprPattern.getFieldExprName = getFieldExprName, FieldExprPattern.getSchema = getSchema,
|
40996 | FieldExprPattern.toFieldExprEntityPattern = toFieldExprEntityPattern, FieldExprPattern.toFieldExprEntityItemPattern = toFieldExprEntityItemPattern;
|
40997 | var FieldExprPatternAggregateVisitor = function() {
|
40998 | function FieldExprPatternAggregateVisitor() {}
|
40999 | return FieldExprPatternAggregateVisitor.prototype.visitColumn = function(column) {},
|
41000 | FieldExprPatternAggregateVisitor.prototype.visitColumnAggr = function(columnAggr) {
|
41001 | return columnAggr.aggregate;
|
41002 | }, FieldExprPatternAggregateVisitor.prototype.visitColumnHierarchyLevelVariation = function(columnHierarchyLevelVariation) {},
|
41003 | FieldExprPatternAggregateVisitor.prototype.visitEntity = function(entity) {}, FieldExprPatternAggregateVisitor.prototype.visitEntityAggr = function(entityAggr) {
|
41004 | return entityAggr.aggregate;
|
41005 | }, FieldExprPatternAggregateVisitor.prototype.visitHierarchy = function(hierarchy) {},
|
41006 | FieldExprPatternAggregateVisitor.prototype.visitHierarchyLevel = function(hierarchyLevel) {},
|
41007 | FieldExprPatternAggregateVisitor.prototype.visitHierarchyLevelAggr = function(hierarchyLevelAggr) {
|
41008 | return hierarchyLevelAggr.aggregate;
|
41009 | }, FieldExprPatternAggregateVisitor.prototype.visitMeasure = function(measure) {},
|
41010 | FieldExprPatternAggregateVisitor.prototype.visitSelectRef = function(selectRef) {},
|
41011 | FieldExprPatternAggregateVisitor.prototype.visitPercentile = function(percentile) {},
|
41012 | FieldExprPatternAggregateVisitor.prototype.visitPercentOfGrandTotal = function(percentOfGrandTotal) {
|
41013 | return data.SQExprInfo.getAggregate(SQExprBuilder.fieldExpr(percentOfGrandTotal.baseExpr));
|
41014 | }, FieldExprPatternAggregateVisitor.instance = new FieldExprPatternAggregateVisitor(),
|
41015 | FieldExprPatternAggregateVisitor;
|
41016 | }(), FieldExprPatternIsAggregationVisitor = function() {
|
41017 | function FieldExprPatternIsAggregationVisitor() {}
|
41018 | return FieldExprPatternIsAggregationVisitor.prototype.visitColumn = function(column) {
|
41019 | return !1;
|
41020 | }, FieldExprPatternIsAggregationVisitor.prototype.visitColumnAggr = function(columnAggr) {
|
41021 | return !0;
|
41022 | }, FieldExprPatternIsAggregationVisitor.prototype.visitColumnHierarchyLevelVariation = function(columnHierarchyLevelVariation) {
|
41023 | return !1;
|
41024 | }, FieldExprPatternIsAggregationVisitor.prototype.visitEntity = function(entity) {
|
41025 | return !1;
|
41026 | }, FieldExprPatternIsAggregationVisitor.prototype.visitEntityAggr = function(entityAggr) {
|
41027 | return !0;
|
41028 | }, FieldExprPatternIsAggregationVisitor.prototype.visitHierarchy = function(hierarchy) {
|
41029 | return !1;
|
41030 | }, FieldExprPatternIsAggregationVisitor.prototype.visitHierarchyLevel = function(hierarchyLevel) {
|
41031 | return !1;
|
41032 | }, FieldExprPatternIsAggregationVisitor.prototype.visitHierarchyLevelAggr = function(hierarchyLevelAggr) {
|
41033 | return !0;
|
41034 | }, FieldExprPatternIsAggregationVisitor.prototype.visitMeasure = function(measure) {
|
41035 | return !0;
|
41036 | }, FieldExprPatternIsAggregationVisitor.prototype.visitSelectRef = function(selectRef) {
|
41037 | return !1;
|
41038 | }, FieldExprPatternIsAggregationVisitor.prototype.visitPercentile = function(percentile) {
|
41039 | return !0;
|
41040 | }, FieldExprPatternIsAggregationVisitor.prototype.visitPercentOfGrandTotal = function(percentOfGrandTotal) {
|
41041 | return !0;
|
41042 | }, FieldExprPatternIsAggregationVisitor.instance = new FieldExprPatternIsAggregationVisitor(),
|
41043 | FieldExprPatternIsAggregationVisitor;
|
41044 | }(), FieldExprToEntityExprPatternBuilder = function() {
|
41045 | function FieldExprToEntityExprPatternBuilder() {}
|
41046 | return FieldExprToEntityExprPatternBuilder.prototype.visitColumn = function(column) {
|
41047 | return FieldExprToEntityExprPatternBuilder.toEntityItemExprPattern(column);
|
41048 | }, FieldExprToEntityExprPatternBuilder.prototype.visitColumnAggr = function(columnAggr) {
|
41049 | return FieldExprToEntityExprPatternBuilder.toEntityItemExprPattern(columnAggr);
|
41050 | }, FieldExprToEntityExprPatternBuilder.prototype.visitColumnHierarchyLevelVariation = function(columnHierarchyLevelVariation) {
|
41051 | return FieldExprToEntityExprPatternBuilder.toEntityItemExprPattern(columnHierarchyLevelVariation.source);
|
41052 | }, FieldExprToEntityExprPatternBuilder.prototype.visitEntity = function(entity) {
|
41053 | return FieldExprToEntityExprPatternBuilder.toEntityItemExprPattern(entity);
|
41054 | }, FieldExprToEntityExprPatternBuilder.prototype.visitEntityAggr = function(entityAggr) {
|
41055 | return FieldExprToEntityExprPatternBuilder.toEntityItemExprPattern(entityAggr);
|
41056 | }, FieldExprToEntityExprPatternBuilder.prototype.visitHierarchy = function(hierarchy) {
|
41057 | return FieldExprToEntityExprPatternBuilder.toEntityItemExprPattern(hierarchy);
|
41058 | }, FieldExprToEntityExprPatternBuilder.prototype.visitHierarchyLevel = function(hierarchyLevel) {
|
41059 | return FieldExprToEntityExprPatternBuilder.toEntityItemExprPattern(hierarchyLevel);
|
41060 | }, FieldExprToEntityExprPatternBuilder.prototype.visitHierarchyLevelAggr = function(hierarchyLevelAggr) {
|
41061 | return FieldExprToEntityExprPatternBuilder.toEntityItemExprPattern(hierarchyLevelAggr);
|
41062 | }, FieldExprToEntityExprPatternBuilder.prototype.visitMeasure = function(measure) {
|
41063 | return FieldExprToEntityExprPatternBuilder.toEntityItemExprPattern(measure);
|
41064 | }, FieldExprToEntityExprPatternBuilder.prototype.visitSelectRef = function(selectRef) {},
|
41065 | FieldExprToEntityExprPatternBuilder.prototype.visitPercentile = function(percentile) {
|
41066 | return FieldExprPattern.visit(percentile.arg, this);
|
41067 | }, FieldExprToEntityExprPatternBuilder.prototype.visitPercentOfGrandTotal = function(percentOfGrandTotal) {
|
41068 | return FieldExprPattern.visit(percentOfGrandTotal.baseExpr, this);
|
41069 | }, FieldExprToEntityExprPatternBuilder.toEntityItemExprPattern = function(exprPattern) {
|
41070 | var pattern = {
|
41071 | schema: exprPattern.schema,
|
41072 | entity: exprPattern.entity
|
41073 | };
|
41074 | return exprPattern.entityVar && (pattern.entityVar = exprPattern.entityVar), pattern;
|
41075 | }, FieldExprToEntityExprPatternBuilder.instance = new FieldExprToEntityExprPatternBuilder(),
|
41076 | FieldExprToEntityExprPatternBuilder;
|
41077 | }(), FieldExprPropertyNameVisitor = function() {
|
41078 | function FieldExprPropertyNameVisitor() {}
|
41079 | return FieldExprPropertyNameVisitor.prototype.visitColumn = function(column) {
|
41080 | return column.name;
|
41081 | }, FieldExprPropertyNameVisitor.prototype.visitColumnAggr = function(columnAggr) {
|
41082 | return columnAggr.name;
|
41083 | }, FieldExprPropertyNameVisitor.prototype.visitColumnHierarchyLevelVariation = function(columnHierarchyLevelVariation) {},
|
41084 | FieldExprPropertyNameVisitor.prototype.visitEntity = function(entity) {}, FieldExprPropertyNameVisitor.prototype.visitEntityAggr = function(entityAggr) {},
|
41085 | FieldExprPropertyNameVisitor.prototype.visitHierarchy = function(hierarchy) {},
|
41086 | FieldExprPropertyNameVisitor.prototype.visitHierarchyLevel = function(hierarchyLevel) {},
|
41087 | FieldExprPropertyNameVisitor.prototype.visitHierarchyLevelAggr = function(hierarchyLevelAggr) {},
|
41088 | FieldExprPropertyNameVisitor.prototype.visitMeasure = function(measure) {
|
41089 | return measure.name;
|
41090 | }, FieldExprPropertyNameVisitor.prototype.visitSelectRef = function(selectRef) {},
|
41091 | FieldExprPropertyNameVisitor.prototype.visitPercentile = function(percentile) {
|
41092 | return FieldExprPattern.visit(percentile.arg, this);
|
41093 | }, FieldExprPropertyNameVisitor.prototype.visitPercentOfGrandTotal = function(percentOfGrandTotal) {
|
41094 | return FieldExprPattern.visit(percentOfGrandTotal.baseExpr, this);
|
41095 | }, FieldExprPropertyNameVisitor.instance = new FieldExprPropertyNameVisitor(), FieldExprPropertyNameVisitor;
|
41096 | }();
|
41097 | }(FieldExprPattern = data.FieldExprPattern || (data.FieldExprPattern = {}));
|
41098 | }(data = powerbi.data || (powerbi.data = {}));
|
41099 | }(powerbi || (powerbi = {}));
|
41100 | }, function(module, exports) {
|
41101 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
41102 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
41103 | !function(powerbi) {
|
41104 | var DataViewAnalysis;
|
41105 | !function(DataViewAnalysis) {
|
41106 | function validateAndReshape(dataView, dataViewMappings) {
|
41107 | if (!dataViewMappings || 0 === dataViewMappings.length) return {
|
41108 | dataView: dataView,
|
41109 | isValid: !0
|
41110 | };
|
41111 | if (dataView) for (var _i = 0, dataViewMappings_1 = dataViewMappings; _i < dataViewMappings_1.length; _i++) {
|
41112 | var dataViewMapping = dataViewMappings_1[_i];
|
41113 | if (supports(dataView, dataViewMapping)) return {
|
41114 | dataView: dataView,
|
41115 | isValid: !0
|
41116 | };
|
41117 | if (dataViewMapping.categorical && dataView.categorical) return reshapeCategorical(dataView, dataViewMapping);
|
41118 | if (dataViewMapping.tree && dataView.tree) return reshapeTree(dataView, dataViewMapping.tree);
|
41119 | if (dataViewMapping.single && dataView.single) return reshapeSingle(dataView, dataViewMapping.single);
|
41120 | if (dataViewMapping.table && dataView.table) return reshapeTable(dataView, dataViewMapping.table);
|
41121 | } else if (powerbi.ScriptResultUtil.findScriptResult(dataViewMappings)) return {
|
41122 | dataView: dataView,
|
41123 | isValid: !0
|
41124 | };
|
41125 | return {
|
41126 | isValid: !1
|
41127 | };
|
41128 | }
|
41129 | function reshapeCategorical(dataView, dataViewMapping) {
|
41130 | var categoryRoleMapping = dataViewMapping.categorical, categorical = dataView.categorical;
|
41131 | if (!categorical) return {
|
41132 | isValid: !1
|
41133 | };
|
41134 | var rowCount;
|
41135 | if (categoryRoleMapping.rowCount && (rowCount = categoryRoleMapping.rowCount.supported,
|
41136 | rowCount && rowCount.max)) {
|
41137 | var updated = void 0, categories = categorical.categories, maxRowCount = rowCount.max, originalLength = void 0;
|
41138 | if (categories) for (var i = 0, len = categories.length; len > i; i++) {
|
41139 | var category = categories[i];
|
41140 | if (originalLength = category.values.length, void 0 !== maxRowCount && originalLength > maxRowCount) {
|
41141 | var updatedCategories = ArrayExtensions.range(category.values, 0, maxRowCount - 1);
|
41142 | updated = updated || {
|
41143 | categories: []
|
41144 | }, updated.categories.push({
|
41145 | source: category.source,
|
41146 | values: updatedCategories
|
41147 | });
|
41148 | }
|
41149 | }
|
41150 | if (categorical.values && categorical.values.length > 0 && maxRowCount && (originalLength || (originalLength = categorical.values[0].values.length),
|
41151 | void 0 !== maxRowCount && originalLength > maxRowCount)) {
|
41152 | updated = updated || {}, updated.values = powerbi.data.DataViewTransform.createValueColumns();
|
41153 | for (var i = 0, len = categorical.values.length; len > i; i++) {
|
41154 | var column = categorical.values[i], updatedColumn = {
|
41155 | source: column.source,
|
41156 | values: ArrayExtensions.range(column.values, 0, maxRowCount - 1)
|
41157 | };
|
41158 | void 0 !== column.min && (updatedColumn.min = column.min), void 0 !== column.max && (updatedColumn.max = column.max),
|
41159 | void 0 !== column.subtotal && (updatedColumn.subtotal = column.subtotal), updated.values.push(updatedColumn);
|
41160 | }
|
41161 | }
|
41162 | updated && (dataView = {
|
41163 | metadata: dataView.metadata,
|
41164 | categorical: updated
|
41165 | });
|
41166 | }
|
41167 | return supportsCategorical(dataView, dataViewMapping) ? {
|
41168 | dataView: dataView,
|
41169 | isValid: !0
|
41170 | } : null;
|
41171 | }
|
41172 | function reshapeSingle(dataView, singleRoleMapping) {
|
41173 | return dataView.single ? {
|
41174 | dataView: dataView,
|
41175 | isValid: !0
|
41176 | } : {
|
41177 | isValid: !1
|
41178 | };
|
41179 | }
|
41180 | function reshapeTree(dataView, treeRoleMapping) {
|
41181 | var metadata = dataView.metadata;
|
41182 | return null == validateRange(countGroups(metadata.columns), treeRoleMapping.depth) ? {
|
41183 | dataView: dataView,
|
41184 | isValid: !0
|
41185 | } : {
|
41186 | isValid: !1
|
41187 | };
|
41188 | }
|
41189 | function reshapeTable(dataView, tableRoleMapping) {
|
41190 | return dataView.table ? {
|
41191 | dataView: dataView,
|
41192 | isValid: !0
|
41193 | } : {
|
41194 | isValid: !1
|
41195 | };
|
41196 | }
|
41197 | function countGroups(columns) {
|
41198 | for (var count = 0, i = 0, len = columns.length; len > i; i++) columns[i].isMeasure || ++count;
|
41199 | return count;
|
41200 | }
|
41201 | function countMeasures(columns) {
|
41202 | for (var count = 0, i = 0, len = columns.length; len > i; i++) columns[i].isMeasure && ++count;
|
41203 | return count;
|
41204 | }
|
41205 | function supports(dataView, roleMapping, usePreferredDataViewSchema) {
|
41206 | return roleMapping && dataView ? roleMapping.scriptResult && !supportsScriptResult(dataView.scriptResult, roleMapping.scriptResult) ? !1 : roleMapping.categorical && !supportsCategorical(dataView, roleMapping.categorical, usePreferredDataViewSchema) ? !1 : roleMapping.tree && !supportsTree(dataView, roleMapping.tree) ? !1 : roleMapping.single && !supportsSingle(dataView.single, roleMapping.single) ? !1 : !roleMapping.table || supportsTable(dataView.table, roleMapping.table, usePreferredDataViewSchema) : !1;
|
41207 | }
|
41208 | function supportsCategorical(dataView, categoryRoleMapping, usePreferredDataViewSchema) {
|
41209 | var dataViewCategorical = dataView.categorical;
|
41210 | if (!dataViewCategorical) return !1;
|
41211 | if (categoryRoleMapping.rowCount) {
|
41212 | var rowCount = categoryRoleMapping.rowCount.supported;
|
41213 | if (usePreferredDataViewSchema && categoryRoleMapping.rowCount.preferred && (rowCount = categoryRoleMapping.rowCount.preferred),
|
41214 | rowCount) {
|
41215 | var len = 0;
|
41216 | if (dataViewCategorical.values && dataViewCategorical.values.length ? len = dataViewCategorical.values[0].values.length : dataViewCategorical.categories && dataViewCategorical.categories.length && (len = dataViewCategorical.categories[0].values.length),
|
41217 | null != validateRange(len, rowCount)) return !1;
|
41218 | }
|
41219 | }
|
41220 | return !0;
|
41221 | }
|
41222 | function supportsSingle(dataViewSingle, singleRoleMapping) {
|
41223 | return !!dataViewSingle;
|
41224 | }
|
41225 | function supportsTree(dataView, treeRoleMapping) {
|
41226 | var metadata = dataView.metadata;
|
41227 | return null == validateRange(countGroups(metadata.columns), treeRoleMapping.depth);
|
41228 | }
|
41229 | function supportsTable(dataViewTable, tableRoleMapping, usePreferredDataViewSchema) {
|
41230 | if (!dataViewTable) return !1;
|
41231 | if (tableRoleMapping.rowCount) {
|
41232 | var rowCount = tableRoleMapping.rowCount.supported;
|
41233 | if (usePreferredDataViewSchema && tableRoleMapping.rowCount.preferred && (rowCount = tableRoleMapping.rowCount.preferred),
|
41234 | rowCount) {
|
41235 | var len = 0;
|
41236 | if (dataViewTable.rows && dataViewTable.rows.length && (len = dataViewTable.rows.length),
|
41237 | null != validateRange(len, rowCount)) return !1;
|
41238 | }
|
41239 | }
|
41240 | return !0;
|
41241 | }
|
41242 | function supportsScriptResult(dataView, scriptResultRoleMapping) {
|
41243 | return dataView ? !!dataView.imageBase64 : !1;
|
41244 | }
|
41245 | function validateRange(value, roleCondition, ignoreMin) {
|
41246 | return roleCondition ? !ignoreMin && void 0 !== roleCondition.min && roleCondition.min > value ? DataViewMappingMatchErrorCode.conditionRangeTooSmall : void 0 !== roleCondition.max && roleCondition.max < value ? DataViewMappingMatchErrorCode.conditionRangeTooLarge : void 0 : void 0;
|
41247 | }
|
41248 | function validateKind(roleCondition, roleName, projections, roleKindByQueryRef) {
|
41249 | if (roleCondition && void 0 !== roleCondition.kind) {
|
41250 | var expectedKind = roleCondition.kind, roleCollection = projections[roleName];
|
41251 | if (roleCollection) for (var roleProjections = roleCollection.all(), _i = 0, roleProjections_1 = roleProjections; _i < roleProjections_1.length; _i++) {
|
41252 | var roleProjection = roleProjections_1[_i];
|
41253 | if (roleKindByQueryRef[roleProjection.queryRef] !== expectedKind) switch (expectedKind) {
|
41254 | case powerbi.VisualDataRoleKind.Measure:
|
41255 | return DataViewMappingMatchErrorCode.conditionKindExpectedMeasure;
|
41256 |
|
41257 | case powerbi.VisualDataRoleKind.Grouping:
|
41258 | return DataViewMappingMatchErrorCode.conditionKindExpectedGrouping;
|
41259 |
|
41260 | case powerbi.VisualDataRoleKind.GroupingOrMeasure:
|
41261 | return DataViewMappingMatchErrorCode.conditionKindExpectedGroupingOrMeasure;
|
41262 | }
|
41263 | }
|
41264 | }
|
41265 | }
|
41266 | function chooseDataViewMappings(projections, mappings, roleKindByQueryRef, objectDescriptors, objectDefinitions) {
|
41267 | var supportedMappings = [], errors = [];
|
41268 | if (!_.isEmpty(mappings)) for (var mappingIndex = 0, mappingCount = mappings.length; mappingCount > mappingIndex; mappingIndex++) {
|
41269 | var mapping = mappings[mappingIndex], mappingConditions = mapping.conditions, requiredProperties = mapping.requiredProperties, allPropertiesValid = areAllPropertiesValid(requiredProperties, objectDescriptors, objectDefinitions), conditionsMet = [];
|
41270 | if (_.isEmpty(mappingConditions)) conditionsMet.push({}); else for (var conditionIndex = 0, conditionCount = mappingConditions.length; conditionCount > conditionIndex; conditionIndex++) {
|
41271 | var condition = mappingConditions[conditionIndex], currentConditionErrors = checkForConditionErrors(projections, condition, roleKindByQueryRef);
|
41272 | if (_.isEmpty(currentConditionErrors)) conditionsMet.push(condition); else for (var _i = 0, currentConditionErrors_1 = currentConditionErrors; _i < currentConditionErrors_1.length; _i++) {
|
41273 | var error = currentConditionErrors_1[_i];
|
41274 | error.mappingIndex = mappingIndex, error.conditionIndex = conditionIndex, errors.push(error);
|
41275 | }
|
41276 | }
|
41277 | if (!_.isEmpty(conditionsMet) && allPropertiesValid) {
|
41278 | var supportedMapping = _.cloneDeep(mapping), updatedConditions = _.filter(conditionsMet, function(condition) {
|
41279 | return Object.keys(condition).length > 0;
|
41280 | });
|
41281 | _.isEmpty(updatedConditions) || (supportedMapping.conditions = updatedConditions),
|
41282 | supportedMappings.push(supportedMapping);
|
41283 | }
|
41284 | }
|
41285 | return {
|
41286 | supportedMappings: ArrayExtensions.emptyToNull(supportedMappings),
|
41287 | mappingErrors: ArrayExtensions.emptyToNull(errors)
|
41288 | };
|
41289 | }
|
41290 | function checkForConditionErrors(projections, condition, roleKindByQueryRef) {
|
41291 | for (var conditionRoles = Object.keys(condition), errors = [], i = 0, len = conditionRoles.length; len > i; i++) {
|
41292 | var roleName = conditionRoles[i], isDrillable = projections[roleName] && !_.isEmpty(projections[roleName].activeProjectionRefs), roleCondition = condition[roleName], roleCount = getPropertyCount(roleName, projections, isDrillable), rangeError = validateRange(roleCount, roleCondition);
|
41293 | null != rangeError && errors.push({
|
41294 | code: rangeError,
|
41295 | roleName: roleName
|
41296 | });
|
41297 | var kindError = validateKind(roleCondition, roleName, projections, roleKindByQueryRef);
|
41298 | null != kindError && errors.push({
|
41299 | code: kindError,
|
41300 | roleName: roleName
|
41301 | });
|
41302 | }
|
41303 | return errors;
|
41304 | }
|
41305 | function areAllPropertiesValid(requiredProperties, objectDescriptors, objectDefinitions) {
|
41306 | if (_.isEmpty(requiredProperties)) return !0;
|
41307 | if (!objectDescriptors || !objectDefinitions) return !1;
|
41308 | var staticEvalContext = powerbi.data.createStaticEvalContext();
|
41309 | return _.every(requiredProperties, function(requiredProperty) {
|
41310 | var objectDescriptorValue = null, objectDescriptorProperty = objectDescriptors[requiredProperty.objectName];
|
41311 | objectDescriptorProperty && (objectDescriptorValue = objectDescriptorProperty.properties[requiredProperty.propertyName]);
|
41312 | var objectDefinitionValue = DataViewObjectDefinitions.getValue(objectDefinitions, requiredProperty, null);
|
41313 | return objectDescriptorValue && objectDefinitionValue ? powerbi.data.DataViewObjectEvaluator.evaluateProperty(staticEvalContext, objectDescriptorValue, objectDefinitionValue) : !1;
|
41314 | });
|
41315 | }
|
41316 | function getPropertyCount(roleName, projections, useActiveIfAvailable) {
|
41317 | var projectionsForRole = projections[roleName];
|
41318 | return projectionsForRole ? useActiveIfAvailable ? 1 : projectionsForRole.all().length : 0;
|
41319 | }
|
41320 | function hasSameCategoryIdentity(dataView1, dataView2) {
|
41321 | if (dataView1 && dataView2 && dataView1.categorical && dataView2.categorical) {
|
41322 | var dv1Categories = dataView1.categorical.categories, dv2Categories = dataView2.categorical.categories;
|
41323 | if (dv1Categories && dv2Categories && dv1Categories.length === dv2Categories.length) {
|
41324 | for (var i = 0, len = dv1Categories.length; len > i; i++) {
|
41325 | var dv1Identity = dv1Categories[i].identity, dv2Identity = dv2Categories[i].identity, dv1Length = getLengthOptional(dv1Identity);
|
41326 | if (dv1Length !== getLengthOptional(dv2Identity)) return !1;
|
41327 | for (var j = 0; dv1Length > j; j++) if (!powerbi.DataViewScopeIdentity.equals(dv1Identity[j], dv2Identity[j])) return !1;
|
41328 | }
|
41329 | return !0;
|
41330 | }
|
41331 | }
|
41332 | return !1;
|
41333 | }
|
41334 | function getLengthOptional(identity) {
|
41335 | return identity ? identity.length : 0;
|
41336 | }
|
41337 | function areMetadataColumnsEquivalent(column1, column2) {
|
41338 | return column1 || column2 ? column1 && column2 ? column1.displayName !== column2.displayName ? !1 : column1.queryName !== column2.queryName ? !1 : column1.isMeasure !== column2.isMeasure ? !1 : column1.type !== column2.type ? !1 : column1.sort === column2.sort : !1 : !0;
|
41339 | }
|
41340 | function isMetadataEquivalent(metadata1, metadata2) {
|
41341 | if (!metadata1 && !metadata2) return !0;
|
41342 | if (!metadata1 || !metadata2) return !1;
|
41343 | var previousColumnsLength = metadata1.columns.length, newColumnsLength = metadata2.columns.length;
|
41344 | if (previousColumnsLength !== newColumnsLength) return !1;
|
41345 | for (var i = 0; newColumnsLength > i; i++) if (!DataViewAnalysis.areMetadataColumnsEquivalent(metadata1.columns[i], metadata2.columns[i])) return !1;
|
41346 | return !0;
|
41347 | }
|
41348 | var ArrayExtensions = jsCommon.ArrayExtensions, DataViewObjectDefinitions = powerbi.data.DataViewObjectDefinitions;
|
41349 | !function(DataViewMappingMatchErrorCode) {
|
41350 | DataViewMappingMatchErrorCode[DataViewMappingMatchErrorCode.conditionRangeTooLarge = 0] = "conditionRangeTooLarge",
|
41351 | DataViewMappingMatchErrorCode[DataViewMappingMatchErrorCode.conditionRangeTooSmall = 1] = "conditionRangeTooSmall",
|
41352 | DataViewMappingMatchErrorCode[DataViewMappingMatchErrorCode.conditionKindExpectedMeasure = 2] = "conditionKindExpectedMeasure",
|
41353 | DataViewMappingMatchErrorCode[DataViewMappingMatchErrorCode.conditionKindExpectedGrouping = 3] = "conditionKindExpectedGrouping",
|
41354 | DataViewMappingMatchErrorCode[DataViewMappingMatchErrorCode.conditionKindExpectedGroupingOrMeasure = 4] = "conditionKindExpectedGroupingOrMeasure";
|
41355 | }(DataViewAnalysis.DataViewMappingMatchErrorCode || (DataViewAnalysis.DataViewMappingMatchErrorCode = {}));
|
41356 | var DataViewMappingMatchErrorCode = DataViewAnalysis.DataViewMappingMatchErrorCode;
|
41357 | DataViewAnalysis.validateAndReshape = validateAndReshape, DataViewAnalysis.countGroups = countGroups,
|
41358 | DataViewAnalysis.countMeasures = countMeasures, DataViewAnalysis.supports = supports,
|
41359 | DataViewAnalysis.validateRange = validateRange, DataViewAnalysis.chooseDataViewMappings = chooseDataViewMappings,
|
41360 | DataViewAnalysis.getPropertyCount = getPropertyCount, DataViewAnalysis.hasSameCategoryIdentity = hasSameCategoryIdentity,
|
41361 | DataViewAnalysis.areMetadataColumnsEquivalent = areMetadataColumnsEquivalent, DataViewAnalysis.isMetadataEquivalent = isMetadataEquivalent;
|
41362 | }(DataViewAnalysis = powerbi.DataViewAnalysis || (powerbi.DataViewAnalysis = {}));
|
41363 | }(powerbi || (powerbi = {}));
|
41364 | }, function(module, exports) {
|
41365 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
41366 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
41367 | !function(powerbi) {
|
41368 | var data;
|
41369 | !function(data) {
|
41370 | var DataViewRoleWildcard, ArrayExtensions = jsCommon.ArrayExtensions, Lazy = jsCommon.Lazy;
|
41371 | !function(DataViewRoleWildcard) {
|
41372 | function fromRoles(roles) {
|
41373 | return new DataViewRoleWildcardImpl(roles);
|
41374 | }
|
41375 | function equals(firstRoleWildcard, secondRoleWildcard) {
|
41376 | return firstRoleWildcard.key && secondRoleWildcard.key && firstRoleWildcard.key === secondRoleWildcard.key && ArrayExtensions.sequenceEqual(firstRoleWildcard.roles, secondRoleWildcard.roles, function(role1, role2) {
|
41377 | return role1 === role2;
|
41378 | });
|
41379 | }
|
41380 | DataViewRoleWildcard.fromRoles = fromRoles, DataViewRoleWildcard.equals = equals;
|
41381 | var DataViewRoleWildcardImpl = function() {
|
41382 | function DataViewRoleWildcardImpl(roles) {
|
41383 | var _this = this;
|
41384 | this._roles = roles, this._key = new Lazy(function() {
|
41385 | return JSON.stringify(_this.roles);
|
41386 | });
|
41387 | }
|
41388 | return Object.defineProperty(DataViewRoleWildcardImpl.prototype, "roles", {
|
41389 | get: function() {
|
41390 | return this._roles;
|
41391 | },
|
41392 | enumerable: !0,
|
41393 | configurable: !0
|
41394 | }), Object.defineProperty(DataViewRoleWildcardImpl.prototype, "key", {
|
41395 | get: function() {
|
41396 | return this._key.getValue();
|
41397 | },
|
41398 | enumerable: !0,
|
41399 | configurable: !0
|
41400 | }), DataViewRoleWildcardImpl;
|
41401 | }();
|
41402 | }(DataViewRoleWildcard = data.DataViewRoleWildcard || (data.DataViewRoleWildcard = {}));
|
41403 | }(data = powerbi.data || (powerbi.data = {}));
|
41404 | }(powerbi || (powerbi = {}));
|
41405 | }, function(module, exports) {
|
41406 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
41407 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
41408 | !function(powerbi) {
|
41409 | var DataViewScopeIdentity;
|
41410 | !function(DataViewScopeIdentity) {
|
41411 | function equals(x, y, ignoreCase) {
|
41412 | return x = x || null, y = y || null, x === y ? !0 : !x != !y ? !1 : data.SQExpr.equals(x.expr, y.expr, ignoreCase);
|
41413 | }
|
41414 | function filterFromIdentity(identities, isNot) {
|
41415 | if (!_.isEmpty(identities)) {
|
41416 | for (var exprs = [], _i = 0, identities_1 = identities; _i < identities_1.length; _i++) {
|
41417 | var identity = identities_1[_i];
|
41418 | exprs.push(identity.expr);
|
41419 | }
|
41420 | return filterFromExprs(exprs, isNot);
|
41421 | }
|
41422 | }
|
41423 | function filterFromExprs(orExprs, isNot) {
|
41424 | if (!_.isEmpty(orExprs)) {
|
41425 | for (var resultExpr, _i = 0, orExprs_1 = orExprs; _i < orExprs_1.length; _i++) {
|
41426 | var orExpr = orExprs_1[_i], inExpr = data.ScopeIdentityExtractor.getInExpr(orExpr);
|
41427 | resultExpr = resultExpr ? data.SQExprBuilder.or(resultExpr, inExpr) : inExpr || orExpr;
|
41428 | }
|
41429 | return resultExpr && isNot && (resultExpr = powerbi.data.SQExprBuilder.not(resultExpr)),
|
41430 | powerbi.data.SemanticFilter.fromSQExpr(resultExpr);
|
41431 | }
|
41432 | }
|
41433 | DataViewScopeIdentity.equals = equals, DataViewScopeIdentity.filterFromIdentity = filterFromIdentity,
|
41434 | DataViewScopeIdentity.filterFromExprs = filterFromExprs;
|
41435 | }(DataViewScopeIdentity = powerbi.DataViewScopeIdentity || (powerbi.DataViewScopeIdentity = {}));
|
41436 | var data;
|
41437 | !function(data) {
|
41438 | function createDataViewScopeIdentity(expr) {
|
41439 | return new DataViewScopeIdentityImpl(expr);
|
41440 | }
|
41441 | var Lazy = jsCommon.Lazy;
|
41442 | data.createDataViewScopeIdentity = createDataViewScopeIdentity;
|
41443 | var DataViewScopeIdentityImpl = function() {
|
41444 | function DataViewScopeIdentityImpl(expr) {
|
41445 | this._expr = expr, this._key = new Lazy(function() {
|
41446 | return data.SQExprShortSerializer.serialize(expr);
|
41447 | });
|
41448 | }
|
41449 | return Object.defineProperty(DataViewScopeIdentityImpl.prototype, "expr", {
|
41450 | get: function() {
|
41451 | return this._expr;
|
41452 | },
|
41453 | enumerable: !0,
|
41454 | configurable: !0
|
41455 | }), Object.defineProperty(DataViewScopeIdentityImpl.prototype, "key", {
|
41456 | get: function() {
|
41457 | return this._key.getValue();
|
41458 | },
|
41459 | enumerable: !0,
|
41460 | configurable: !0
|
41461 | }), DataViewScopeIdentityImpl;
|
41462 | }();
|
41463 | }(data = powerbi.data || (powerbi.data = {}));
|
41464 | }(powerbi || (powerbi = {}));
|
41465 | }, function(module, exports) {
|
41466 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
41467 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
41468 | !function(powerbi) {
|
41469 | var data;
|
41470 | !function(data) {
|
41471 | var DataViewScopeWildcard, Lazy = jsCommon.Lazy;
|
41472 | !function(DataViewScopeWildcard) {
|
41473 | function matches(wildcard, instance) {
|
41474 | var instanceExprs = data.ScopeIdentityExtractor.getKeys(instance.expr);
|
41475 | return instanceExprs ? data.SQExprUtils.sequenceEqual(wildcard.exprs, instanceExprs) : !1;
|
41476 | }
|
41477 | function equals(firstScopeWildcard, secondScopeWildcard) {
|
41478 | return firstScopeWildcard.key === secondScopeWildcard.key && data.SQExprUtils.sequenceEqual(firstScopeWildcard.exprs, secondScopeWildcard.exprs);
|
41479 | }
|
41480 | function fromExprs(exprs) {
|
41481 | return new DataViewScopeWildcardImpl(exprs);
|
41482 | }
|
41483 | DataViewScopeWildcard.matches = matches, DataViewScopeWildcard.equals = equals,
|
41484 | DataViewScopeWildcard.fromExprs = fromExprs;
|
41485 | var DataViewScopeWildcardImpl = function() {
|
41486 | function DataViewScopeWildcardImpl(exprs) {
|
41487 | this._exprs = exprs, this._key = new Lazy(function() {
|
41488 | return data.SQExprShortSerializer.serializeArray(exprs);
|
41489 | });
|
41490 | }
|
41491 | return Object.defineProperty(DataViewScopeWildcardImpl.prototype, "exprs", {
|
41492 | get: function() {
|
41493 | return this._exprs;
|
41494 | },
|
41495 | enumerable: !0,
|
41496 | configurable: !0
|
41497 | }), Object.defineProperty(DataViewScopeWildcardImpl.prototype, "key", {
|
41498 | get: function() {
|
41499 | return this._key.getValue();
|
41500 | },
|
41501 | enumerable: !0,
|
41502 | configurable: !0
|
41503 | }), DataViewScopeWildcardImpl;
|
41504 | }();
|
41505 | }(DataViewScopeWildcard = data.DataViewScopeWildcard || (data.DataViewScopeWildcard = {}));
|
41506 | }(data = powerbi.data || (powerbi.data = {}));
|
41507 | }(powerbi || (powerbi = {}));
|
41508 | }, function(module, exports) {
|
41509 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
41510 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
41511 | !function(powerbi) {
|
41512 | var data;
|
41513 | !function(data) {
|
41514 | function createColorAllocatorCache() {
|
41515 | return new ColorAllocatorProvider();
|
41516 | }
|
41517 | data.createColorAllocatorCache = createColorAllocatorCache;
|
41518 | var ColorAllocatorProvider = function() {
|
41519 | function ColorAllocatorProvider() {
|
41520 | this.cache = [];
|
41521 | }
|
41522 | return ColorAllocatorProvider.prototype.get = function(key) {
|
41523 | for (var _i = 0, _a = this.cache; _i < _a.length; _i++) {
|
41524 | var entry = _a[_i];
|
41525 | if (entry.key === key) return entry.allocator;
|
41526 | }
|
41527 | }, ColorAllocatorProvider.prototype.register = function(key, colorAllocator) {
|
41528 | return this.cache.push({
|
41529 | key: key,
|
41530 | allocator: colorAllocator
|
41531 | }), this;
|
41532 | }, ColorAllocatorProvider;
|
41533 | }();
|
41534 | }(data = powerbi.data || (powerbi.data = {}));
|
41535 | }(powerbi || (powerbi = {}));
|
41536 | }, function(module, exports) {
|
41537 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
41538 | window.jasmine, window.Microsoft;
|
41539 | }, function(module, exports) {
|
41540 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
41541 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
41542 | !function(powerbi) {
|
41543 | var data;
|
41544 | !function(data) {
|
41545 | var DataViewRegression;
|
41546 | !function(DataViewRegression) {
|
41547 | function run(options) {
|
41548 | var dataViewMappings = options.dataViewMappings, visualDataViews = options.visualDataViews, dataRoles = options.dataRoles, objectDescriptors = options.objectDescriptors, objectDefinitions = options.objectDefinitions, colorAllocatorFactory = options.colorAllocatorFactory, transformSelects = options.transformSelects, projectionActiveItems = options.projectionActiveItems, metadata = options.metadata;
|
41549 | if (!_.isEmpty(visualDataViews) && transformSelects && metadata) {
|
41550 | var roleKindByQueryRef = data.DataViewSelectTransform.createRoleKindFromMetadata(transformSelects, metadata), projections = data.DataViewSelectTransform.projectionsFromSelects(transformSelects, projectionActiveItems);
|
41551 | if (!roleKindByQueryRef || !projections || _.isEmpty(dataViewMappings) || !objectDescriptors || !objectDefinitions) return visualDataViews;
|
41552 | var applicableDataViewMappings = powerbi.DataViewAnalysis.chooseDataViewMappings(projections, dataViewMappings, roleKindByQueryRef, objectDescriptors, objectDefinitions).supportedMappings;
|
41553 | if (applicableDataViewMappings) {
|
41554 | var regressionDataViewMapping = _.find(applicableDataViewMappings, function(dataViewMapping) {
|
41555 | return dataViewMapping.usage && dataViewMapping.usage.regression;
|
41556 | });
|
41557 | if (regressionDataViewMapping) {
|
41558 | for (var regressionDataViews = [], _i = 0, visualDataViews_1 = visualDataViews; _i < visualDataViews_1.length; _i++) {
|
41559 | var visualDataView = visualDataViews_1[_i], regressionDataView = this.linearRegressionTransform(visualDataView, dataRoles, regressionDataViewMapping, objectDescriptors, objectDefinitions, colorAllocatorFactory);
|
41560 | regressionDataView && regressionDataViews.push(regressionDataView);
|
41561 | }
|
41562 | _.isEmpty(regressionDataViews) || visualDataViews.push.apply(visualDataViews, regressionDataViews);
|
41563 | }
|
41564 | }
|
41565 | }
|
41566 | return visualDataViews;
|
41567 | }
|
41568 | function linearRegressionTransform(sourceDataView, dataRoles, regressionDataViewMapping, objectDescriptors, objectDefinitions, colorAllocatorFactory) {
|
41569 | if (sourceDataView.categorical) {
|
41570 | var xColumns = getColumnsForCartesianRoleKind(0, sourceDataView.categorical, dataRoles), yColumns = getColumnsForCartesianRoleKind(1, sourceDataView.categorical, dataRoles);
|
41571 | if (!_.isEmpty(xColumns) && !_.isEmpty(yColumns)) {
|
41572 | var xColumnSource = xColumns[0].source, yColumnSource = yColumns[0].source, combineSeries = !0;
|
41573 | if (regressionDataViewMapping.usage && regressionDataViewMapping.usage.regression && sourceDataView.metadata.objects) {
|
41574 | var regressionUsage = regressionDataViewMapping.usage.regression, combineSeriesPropertyId = regressionUsage.combineSeries;
|
41575 | combineSeriesPropertyId && (combineSeries = powerbi.DataViewObjects.getValue(sourceDataView.metadata.objects, combineSeriesPropertyId, !0));
|
41576 | }
|
41577 | var dataPointsBySeries = getDataPointsBySeries(xColumns, yColumns, combineSeries, !1), lineDefSet = calculateLineDefinitions(dataPointsBySeries);
|
41578 | if (lineDefSet) {
|
41579 | var highlightsLineDefSet, xMin = lineDefSet.xMin, xMax = lineDefSet.xMax, shouldComputeHightlights = hasHighlightValues(yColumns) || hasHighlightValues(xColumns);
|
41580 | if (shouldComputeHightlights) {
|
41581 | var highlightDataPointsBySeries = getDataPointsBySeries(xColumns, yColumns, combineSeries, !0);
|
41582 | highlightsLineDefSet = calculateLineDefinitions(highlightDataPointsBySeries), highlightsLineDefSet ? (xMin = _.min([ xMin, highlightsLineDefSet.xMin ]),
|
41583 | xMax = _.max([ xMax, highlightsLineDefSet.xMax ])) : shouldComputeHightlights = !1;
|
41584 | }
|
41585 | for (var valuesByTrend = [], _i = 0, _a = lineDefSet.lineDefs; _i < _a.length; _i++) {
|
41586 | var trend = _a[_i];
|
41587 | valuesByTrend.push(computeLineYValues(trend, +xMin, +xMax));
|
41588 | }
|
41589 | var highlightsByTrend;
|
41590 | if (shouldComputeHightlights) {
|
41591 | highlightsByTrend = [];
|
41592 | for (var _b = 0, _c = highlightsLineDefSet.lineDefs; _b < _c.length; _b++) {
|
41593 | var trend = _c[_b];
|
41594 | highlightsByTrend.push(computeLineYValues(trend, +xMin, +xMax));
|
41595 | }
|
41596 | }
|
41597 | var groupValues;
|
41598 | if (combineSeries) groupValues = [ "combinedRegressionSeries" ]; else if (sourceDataView.categorical.values.source) {
|
41599 | var groups = sourceDataView.categorical.values.grouped();
|
41600 | groupValues = _.map(groups, function(group) {
|
41601 | return group.name;
|
41602 | });
|
41603 | } else groupValues = _.map(yColumns, function(column) {
|
41604 | return column.source.queryName;
|
41605 | });
|
41606 | var regressionDataView = createRegressionDataView(xColumnSource, yColumnSource, groupValues, [ xMin, xMax ], valuesByTrend, highlightsByTrend, sourceDataView, regressionDataViewMapping, objectDescriptors, objectDefinitions, colorAllocatorFactory);
|
41607 | return regressionDataView;
|
41608 | }
|
41609 | }
|
41610 | }
|
41611 | }
|
41612 | function calculateLineDefinitions(dataPointsBySeries) {
|
41613 | for (var xMin, xMax, lineDefs = [], _i = 0, dataPointsBySeries_1 = dataPointsBySeries; _i < dataPointsBySeries_1.length; _i++) {
|
41614 | var dataPointSet = dataPointsBySeries_1[_i], unsortedXValues = dataPointSet.xValues, unsortedYValues = dataPointSet.yValues;
|
41615 | if (_.isEmpty(unsortedXValues) || _.isEmpty(unsortedYValues)) return;
|
41616 | var xDataType = getDataType(unsortedXValues);
|
41617 | if (!xDataType) return;
|
41618 | var yDataType = getDataType(unsortedYValues);
|
41619 | if (!yDataType) return;
|
41620 | var sortedDataPointSet = sortValues(unsortedXValues, unsortedYValues), minCategoryValue = sortedDataPointSet.xValues[0], maxCategoryValue = sortedDataPointSet.xValues[sortedDataPointSet.xValues.length - 1], lineDef = computeRegressionLine(sortedDataPointSet.xValues, sortedDataPointSet.yValues);
|
41621 | xMin = _.min([ xMin, minCategoryValue ]), xMax = _.max([ xMax, maxCategoryValue ]),
|
41622 | lineDefs.push(lineDef);
|
41623 | }
|
41624 | return {
|
41625 | lineDefs: lineDefs,
|
41626 | xMin: xMin,
|
41627 | xMax: xMax
|
41628 | };
|
41629 | }
|
41630 | function getColumnsForCartesianRoleKind(roleKind, categorical, roles) {
|
41631 | var columns = getColumnsWithRoleKind(roleKind, categorical.values, roles);
|
41632 | if (!_.isEmpty(columns)) return columns;
|
41633 | var categories = categorical.categories;
|
41634 | if (!_.isEmpty(categories)) {
|
41635 | var categoryColumn = categories[0];
|
41636 | return columns = getColumnsWithRoleKind(roleKind, [ categoryColumn ], roles), _.isEmpty(columns) ? void 0 : columns;
|
41637 | }
|
41638 | }
|
41639 | function getColumnsWithRoleKind(roleKind, columns, roles) {
|
41640 | return _.isEmpty(columns) ? void 0 : _.filter(columns, function(column) {
|
41641 | var _loop_1 = function(roleName) {
|
41642 | if (!column.source.roles[roleName]) return "continue";
|
41643 | var role = _.find(roles, function(role) {
|
41644 | return role.name === roleName;
|
41645 | });
|
41646 | return role && role.cartesianKind === roleKind ? {
|
41647 | value: !0
|
41648 | } : void 0;
|
41649 | };
|
41650 | for (var roleName in column.source.roles) {
|
41651 | var state_1 = _loop_1(roleName);
|
41652 | if ("object" == typeof state_1) return state_1.value;
|
41653 | }
|
41654 | return !1;
|
41655 | });
|
41656 | }
|
41657 | function getDataType(values) {
|
41658 | var firstNonNull = _.find(values, function(value) {
|
41659 | return null != value;
|
41660 | });
|
41661 | if (null != firstNonNull) {
|
41662 | var dataType = typeof firstNonNull;
|
41663 | if (!_.some(values, function(value) {
|
41664 | return null != value && typeof value !== dataType;
|
41665 | })) return dataType;
|
41666 | }
|
41667 | }
|
41668 | function sortValues(unsortedXValues, unsortedYValues) {
|
41669 | var zippedValues = _.zip(unsortedXValues, unsortedYValues), _a = _.chain(zippedValues).filter(function(valuePair) {
|
41670 | return null != valuePair[0] && null != valuePair[1];
|
41671 | }).sortBy(function(valuePair) {
|
41672 | return valuePair[0];
|
41673 | }).unzip().value(), xValues = _a[0], yValues = _a[1];
|
41674 | return {
|
41675 | xValues: xValues,
|
41676 | yValues: yValues
|
41677 | };
|
41678 | }
|
41679 | function computeRegressionLine(xValues, yValues) {
|
41680 | var xBar = _.sum(xValues) / xValues.length, yBar = _.sum(yValues) / yValues.length, ssXX = _.chain(xValues).map(function(x) {
|
41681 | return Math.pow(x - xBar, 2);
|
41682 | }).sum(), ssXY = _.chain(xValues).map(function(x, i) {
|
41683 | return (x - xBar) * (yValues[i] - yBar);
|
41684 | }).sum(), slope = ssXY / ssXX, intercept = yBar - xBar * slope;
|
41685 | return {
|
41686 | slope: slope,
|
41687 | intercept: intercept
|
41688 | };
|
41689 | }
|
41690 | function computeLineYValues(lineDef, x1, x2) {
|
41691 | return [ x1 * lineDef.slope + lineDef.intercept, x2 * lineDef.slope + lineDef.intercept ];
|
41692 | }
|
41693 | function getValuesFromColumn(column, preferHighlights) {
|
41694 | if (preferHighlights) {
|
41695 | var valueColumn = column;
|
41696 | if (valueColumn.highlights) return valueColumn.highlights;
|
41697 | }
|
41698 | return column.values;
|
41699 | }
|
41700 | function getDataPointsBySeries(xColumns, yColumns, combineSeries, preferHighlights) {
|
41701 | for (var dataPointsBySeries = [], xValueArray = _.map(xColumns, function(column) {
|
41702 | return getValuesFromColumn(column, preferHighlights);
|
41703 | }), seriesYValues = _.map(yColumns, function(column) {
|
41704 | return getValuesFromColumn(column, preferHighlights);
|
41705 | }), multipleXValueColumns = xColumns.length > 1, i = 0; i < seriesYValues.length; i++) {
|
41706 | var xValues = multipleXValueColumns ? xValueArray[i] : xValueArray[0], yValues = seriesYValues[i];
|
41707 | combineSeries && dataPointsBySeries.length > 0 ? (dataPointsBySeries[0].xValues = dataPointsBySeries[0].xValues.concat(xValues),
|
41708 | dataPointsBySeries[0].yValues = dataPointsBySeries[0].yValues.concat(yValues)) : dataPointsBySeries.push({
|
41709 | xValues: xValues,
|
41710 | yValues: yValues
|
41711 | });
|
41712 | }
|
41713 | return dataPointsBySeries;
|
41714 | }
|
41715 | function createRegressionDataView(xColumnSource, yColumnSource, groupValues, categories, values, highlights, sourceDataView, regressionDataViewMapping, objectDescriptors, objectDefinitions, colorAllocatorFactory) {
|
41716 | var yRole, seriesRole, xRole = regressionDataViewMapping.categorical.categories["for"]["in"], grouped = regressionDataViewMapping.categorical.values.group;
|
41717 | if (grouped && !_.isEmpty(grouped.select) && (yRole = grouped.select[0]["for"] ? grouped.select[0]["for"]["in"] : grouped.select[0].bind.to,
|
41718 | seriesRole = grouped.by), yRole && seriesRole) {
|
41719 | var categoricalRoles = (_a = {}, _a[xRole] = !0, _a), valueRoles = (_b = {}, _b[yRole] = !0,
|
41720 | _b), seriesRoles = (_c = {}, _c[seriesRole] = !0, _c), valuesBySeries = [];
|
41721 | for (var index in values) {
|
41722 | var seriesData = {
|
41723 | values: values[index]
|
41724 | };
|
41725 | highlights && (seriesData.highlights = highlights[index]), valuesBySeries.push([ seriesData ]);
|
41726 | }
|
41727 | var regressionDataView = data.createCategoricalDataViewBuilder().withCategory({
|
41728 | source: {
|
41729 | displayName: xColumnSource.displayName,
|
41730 | queryName: regressionXQueryName,
|
41731 | type: xColumnSource.type,
|
41732 | isMeasure: !1,
|
41733 | roles: categoricalRoles
|
41734 | },
|
41735 | values: categories,
|
41736 | identityFrom: {
|
41737 | fields: [ data.SQExprBuilder.columnRef(data.SQExprBuilder.entity("s", "RegressionEntity"), "RegressionCategories") ]
|
41738 | }
|
41739 | }).withGroupedValues({
|
41740 | groupColumn: {
|
41741 | source: {
|
41742 | displayName: yColumnSource.displayName + "Regression",
|
41743 | queryName: regressionSeriesQueryName,
|
41744 | type: yColumnSource.type,
|
41745 | isMeasure: yColumnSource.isMeasure,
|
41746 | roles: seriesRoles
|
41747 | },
|
41748 | values: groupValues,
|
41749 | identityFrom: {
|
41750 | fields: [ data.SQExprBuilder.columnRef(data.SQExprBuilder.entity("s", "RegressionEntity"), "RegressionSeries") ]
|
41751 | }
|
41752 | },
|
41753 | valueColumns: [ {
|
41754 | source: {
|
41755 | displayName: yColumnSource.displayName,
|
41756 | queryName: DataViewRegression.regressionYQueryName,
|
41757 | type: yColumnSource.type,
|
41758 | isMeasure: yColumnSource.isMeasure,
|
41759 | roles: valueRoles
|
41760 | }
|
41761 | } ],
|
41762 | data: valuesBySeries
|
41763 | }).build();
|
41764 | return data.DataViewTransform.transformObjects(regressionDataView, 1, objectDescriptors, objectDefinitions, [], colorAllocatorFactory),
|
41765 | regressionDataView;
|
41766 | var _a, _b, _c;
|
41767 | }
|
41768 | }
|
41769 | function hasHighlightValues(columns) {
|
41770 | return _.any(columns, function(column) {
|
41771 | var valueColumn = column;
|
41772 | return null != valueColumn.highlights;
|
41773 | });
|
41774 | }
|
41775 | var regressionXQueryName = "RegressionX", regressionSeriesQueryName = "RegressionSeries";
|
41776 | DataViewRegression.regressionYQueryName = "RegressionY", DataViewRegression.run = run,
|
41777 | DataViewRegression.linearRegressionTransform = linearRegressionTransform;
|
41778 | }(DataViewRegression = data.DataViewRegression || (data.DataViewRegression = {}));
|
41779 | }(data = powerbi.data || (powerbi.data = {}));
|
41780 | }(powerbi || (powerbi = {}));
|
41781 | }, function(module, exports) {
|
41782 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
41783 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
41784 | !function(powerbi) {
|
41785 | var data;
|
41786 | !function(data) {
|
41787 | var DataViewSelectTransform;
|
41788 | !function(DataViewSelectTransform) {
|
41789 | function projectionsFromSelects(selects, projectionActiveItems) {
|
41790 | for (var projections = {}, _i = 0, selects_1 = selects; _i < selects_1.length; _i++) {
|
41791 | var select = selects_1[_i];
|
41792 | if (select) {
|
41793 | var roles = select.roles;
|
41794 | if (roles) for (var roleName in roles) if (roles[roleName]) {
|
41795 | var qp = projections[roleName];
|
41796 | qp || (qp = projections[roleName] = new data.QueryProjectionCollection([])), qp.all().push({
|
41797 | queryRef: select.queryName
|
41798 | }), projectionActiveItems && projectionActiveItems[roleName] && (qp.activeProjectionRefs = _.map(projectionActiveItems[roleName], function(activeItem) {
|
41799 | return activeItem.queryRef;
|
41800 | }));
|
41801 | }
|
41802 | }
|
41803 | }
|
41804 | return projections;
|
41805 | }
|
41806 | function createRoleKindFromMetadata(selects, metadata) {
|
41807 | for (var roleKindByQueryRef = {}, _i = 0, _a = metadata.columns; _i < _a.length; _i++) {
|
41808 | var column = _a[_i];
|
41809 | if (!(!column.index && 0 !== column.index || column.index < 0 || column.index >= selects.length)) {
|
41810 | var select = selects[column.index];
|
41811 | if (select) {
|
41812 | var queryRef = select.queryName;
|
41813 | queryRef && void 0 === roleKindByQueryRef[queryRef] && (roleKindByQueryRef[queryRef] = column.isMeasure ? powerbi.VisualDataRoleKind.Measure : powerbi.VisualDataRoleKind.Grouping);
|
41814 | }
|
41815 | }
|
41816 | }
|
41817 | return roleKindByQueryRef;
|
41818 | }
|
41819 | DataViewSelectTransform.projectionsFromSelects = projectionsFromSelects, DataViewSelectTransform.createRoleKindFromMetadata = createRoleKindFromMetadata;
|
41820 | }(DataViewSelectTransform = data.DataViewSelectTransform || (data.DataViewSelectTransform = {}));
|
41821 | }(data = powerbi.data || (powerbi.data = {}));
|
41822 | }(powerbi || (powerbi = {}));
|
41823 | }, function(module, exports) {
|
41824 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
41825 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
41826 | !function(powerbi) {
|
41827 | var data;
|
41828 | !function(data) {
|
41829 | function createCategoricalEvalContext(colorAllocatorProvider, dataViewCategorical, selectTransforms) {
|
41830 | return new CategoricalEvalContext(colorAllocatorProvider, dataViewCategorical, selectTransforms);
|
41831 | }
|
41832 | function findRuleInputColumn(dataViewCategorical, inputRole) {
|
41833 | return findRuleInputInColumns(dataViewCategorical.values, inputRole) || findRuleInputInColumns(dataViewCategorical.categories, inputRole);
|
41834 | }
|
41835 | function findRuleInputInColumns(columns, inputRole) {
|
41836 | if (columns) for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
|
41837 | var column = columns_1[_i], roles = column.source.roles;
|
41838 | if (roles && roles[inputRole]) return column;
|
41839 | }
|
41840 | }
|
41841 | function findValueColumn(columns, selectIdx) {
|
41842 | if (columns) for (var _i = 0, columns_2 = columns; _i < columns_2.length; _i++) {
|
41843 | var column = columns_2[_i];
|
41844 | if (!column.identity && column.source.index === selectIdx) return column;
|
41845 | }
|
41846 | }
|
41847 | data.createCategoricalEvalContext = createCategoricalEvalContext;
|
41848 | var CategoricalEvalContext = function() {
|
41849 | function CategoricalEvalContext(colorAllocatorProvider, dataView, selectTransforms) {
|
41850 | this.colorAllocatorProvider = colorAllocatorProvider, this.dataView = dataView,
|
41851 | this.selectTransforms = selectTransforms, this.columnsByRole = {};
|
41852 | }
|
41853 | return CategoricalEvalContext.prototype.getColorAllocator = function(expr) {
|
41854 | return this.colorAllocatorProvider.get(expr);
|
41855 | }, CategoricalEvalContext.prototype.getExprValue = function(expr) {
|
41856 | var rowIdx = this.index;
|
41857 | if (_.isNumber(rowIdx)) {
|
41858 | var selectTransforms = this.selectTransforms;
|
41859 | if (selectTransforms) {
|
41860 | var selectIdx = data.findSelectIndex(expr, selectTransforms);
|
41861 | if (-1 !== selectIdx) {
|
41862 | var dataView = this.dataView, column = findValueColumn(dataView.values, selectIdx);
|
41863 | if (column) return column.values[rowIdx];
|
41864 | }
|
41865 | }
|
41866 | }
|
41867 | }, CategoricalEvalContext.prototype.getRoleValue = function(roleName) {
|
41868 | var columnsByRole = this.columnsByRole, column = columnsByRole[roleName];
|
41869 | if (column || (column = columnsByRole[roleName] = findRuleInputColumn(this.dataView, roleName)),
|
41870 | column) {
|
41871 | var index = this.index;
|
41872 | return null != index ? column.values[this.index] : void 0;
|
41873 | }
|
41874 | }, CategoricalEvalContext.prototype.setCurrentRowIndex = function(index) {
|
41875 | this.index = index;
|
41876 | }, CategoricalEvalContext;
|
41877 | }();
|
41878 | }(data = powerbi.data || (powerbi.data = {}));
|
41879 | }(powerbi || (powerbi = {}));
|
41880 | }, function(module, exports) {
|
41881 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
41882 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
41883 | !function(powerbi) {
|
41884 | var data;
|
41885 | !function(data) {
|
41886 | function createTableEvalContext(colorAllocatorProvider, dataViewTable, selectTransforms) {
|
41887 | return new TableEvalContext(colorAllocatorProvider, dataViewTable, selectTransforms);
|
41888 | }
|
41889 | data.createTableEvalContext = createTableEvalContext;
|
41890 | var TableEvalContext = function() {
|
41891 | function TableEvalContext(colorAllocatorProvider, dataView, selectTransforms) {
|
41892 | this.colorAllocatorProvider = colorAllocatorProvider, this.dataView = dataView,
|
41893 | this.selectTransforms = selectTransforms;
|
41894 | }
|
41895 | return TableEvalContext.prototype.getColorAllocator = function(expr) {
|
41896 | return this.colorAllocatorProvider.get(expr);
|
41897 | }, TableEvalContext.prototype.getExprValue = function(expr) {
|
41898 | var rowIdx = this.rowIdx;
|
41899 | if (null != rowIdx) return data.getExprValueFromTable(expr, this.selectTransforms, this.dataView, rowIdx);
|
41900 | }, TableEvalContext.prototype.getRoleValue = function(roleName) {}, TableEvalContext.prototype.setCurrentRowIndex = function(index) {
|
41901 | this.rowIdx = index;
|
41902 | }, TableEvalContext;
|
41903 | }();
|
41904 | }(data = powerbi.data || (powerbi.data = {}));
|
41905 | }(powerbi || (powerbi = {}));
|
41906 | }, function(module, exports) {
|
41907 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
41908 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
41909 | !function(powerbi) {
|
41910 | var data;
|
41911 | !function(data) {
|
41912 | var RuleEvaluation = function() {
|
41913 | function RuleEvaluation() {}
|
41914 | return RuleEvaluation.prototype.evaluate = function(evalContext) {}, RuleEvaluation;
|
41915 | }();
|
41916 | data.RuleEvaluation = RuleEvaluation;
|
41917 | }(data = powerbi.data || (powerbi.data = {}));
|
41918 | }(powerbi || (powerbi = {}));
|
41919 | }, function(module, exports) {
|
41920 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
41921 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
41922 | function __() {
|
41923 | this.constructor = d;
|
41924 | }
|
41925 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
41926 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
41927 | });
|
41928 | !function(powerbi) {
|
41929 | var data;
|
41930 | !function(data) {
|
41931 | var ColorRuleEvaluation = function(_super) {
|
41932 | function ColorRuleEvaluation(inputRole, allocator) {
|
41933 | _super.call(this), this.inputRole = inputRole, this.allocator = allocator;
|
41934 | }
|
41935 | return __extends(ColorRuleEvaluation, _super), ColorRuleEvaluation.prototype.evaluate = function(evalContext) {
|
41936 | var value = evalContext.getRoleValue(this.inputRole);
|
41937 | return void 0 !== value ? this.allocator.color(value) : void 0;
|
41938 | }, ColorRuleEvaluation;
|
41939 | }(data.RuleEvaluation);
|
41940 | data.ColorRuleEvaluation = ColorRuleEvaluation;
|
41941 | }(data = powerbi.data || (powerbi.data = {}));
|
41942 | }(powerbi || (powerbi = {}));
|
41943 | }, function(module, exports) {
|
41944 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
41945 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
41946 | !function(powerbi) {
|
41947 | var data;
|
41948 | !function(data) {
|
41949 | var ConceptualSchema = function() {
|
41950 | function ConceptualSchema() {}
|
41951 | return ConceptualSchema.prototype.findProperty = function(entityName, propertyName) {
|
41952 | var entity = this.entities.withName(entityName);
|
41953 | if (entity && !_.isEmpty(entity.properties)) return entity.properties.withName(propertyName);
|
41954 | }, ConceptualSchema.prototype.findHierarchy = function(entityName, name) {
|
41955 | var entity = this.entities.withName(entityName);
|
41956 | if (entity && !_.isEmpty(entity.hierarchies)) return entity.hierarchies.withName(name);
|
41957 | }, ConceptualSchema.prototype.findHierarchyByVariation = function(variationEntityName, variationColumnName, variationName, hierarchyName) {
|
41958 | var targetEntity = this.findTargetEntityOfVariation(variationEntityName, variationColumnName, variationName);
|
41959 | if (targetEntity && !_.isEmpty(targetEntity.hierarchies)) return targetEntity.hierarchies.withName(hierarchyName);
|
41960 | }, ConceptualSchema.prototype.findTargetEntityOfVariation = function(variationEntityName, variationColumnName, variationName) {
|
41961 | var variationEntity = this.entities.withName(variationEntityName);
|
41962 | if (variationEntity && !_.isEmpty(variationEntity.properties)) {
|
41963 | var variationProperty = variationEntity.properties.withName(variationColumnName);
|
41964 | if (variationProperty) {
|
41965 | var variationColumn = variationProperty.column;
|
41966 | if (variationColumn && !_.isEmpty(variationColumn.variations)) {
|
41967 | var variation = variationColumn.variations.withName(variationName);
|
41968 | return variation ? variation.navigationProperty ? variation.navigationProperty.targetEntity : variationEntity : void 0;
|
41969 | }
|
41970 | }
|
41971 | }
|
41972 | }, ConceptualSchema.prototype.findPropertyWithKpi = function(entityName, kpiProperty) {
|
41973 | var entity = this.entities.withName(entityName);
|
41974 | if (entity && !_.isEmpty(entity.properties)) for (var _i = 0, _a = entity.properties; _i < _a.length; _i++) {
|
41975 | var prop = _a[_i];
|
41976 | if (prop && prop.measure && prop.measure.kpi && (prop.measure.kpi.status === kpiProperty || prop.measure.kpi.goal === kpiProperty)) return prop;
|
41977 | }
|
41978 | }, ConceptualSchema;
|
41979 | }();
|
41980 | data.ConceptualSchema = ConceptualSchema, function(ConceptualDataCategory) {
|
41981 | ConceptualDataCategory[ConceptualDataCategory.None = 0] = "None", ConceptualDataCategory[ConceptualDataCategory.Address = 1] = "Address",
|
41982 | ConceptualDataCategory[ConceptualDataCategory.City = 2] = "City", ConceptualDataCategory[ConceptualDataCategory.Company = 3] = "Company",
|
41983 | ConceptualDataCategory[ConceptualDataCategory.Continent = 4] = "Continent", ConceptualDataCategory[ConceptualDataCategory.Country = 5] = "Country",
|
41984 | ConceptualDataCategory[ConceptualDataCategory.County = 6] = "County", ConceptualDataCategory[ConceptualDataCategory.Date = 7] = "Date",
|
41985 | ConceptualDataCategory[ConceptualDataCategory.Image = 8] = "Image", ConceptualDataCategory[ConceptualDataCategory.ImageUrl = 9] = "ImageUrl",
|
41986 | ConceptualDataCategory[ConceptualDataCategory.Latitude = 10] = "Latitude", ConceptualDataCategory[ConceptualDataCategory.Longitude = 11] = "Longitude",
|
41987 | ConceptualDataCategory[ConceptualDataCategory.Organization = 12] = "Organization",
|
41988 | ConceptualDataCategory[ConceptualDataCategory.Place = 13] = "Place", ConceptualDataCategory[ConceptualDataCategory.PostalCode = 14] = "PostalCode",
|
41989 | ConceptualDataCategory[ConceptualDataCategory.Product = 15] = "Product", ConceptualDataCategory[ConceptualDataCategory.StateOrProvince = 16] = "StateOrProvince",
|
41990 | ConceptualDataCategory[ConceptualDataCategory.WebUrl = 17] = "WebUrl";
|
41991 | }(data.ConceptualDataCategory || (data.ConceptualDataCategory = {}));
|
41992 | data.ConceptualDataCategory;
|
41993 | }(data = powerbi.data || (powerbi.data = {}));
|
41994 | }(powerbi || (powerbi = {}));
|
41995 | }, function(module, exports) {
|
41996 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
41997 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
41998 | !function(powerbi) {
|
41999 | var ScriptResultUtil, StringExtensions = jsCommon.StringExtensions, FieldExprPattern = powerbi.data.FieldExprPattern;
|
42000 | !function(ScriptResultUtil) {
|
42001 | function findScriptResult(dataViewMappings) {
|
42002 | return dataViewMappings && 1 === dataViewMappings.length ? dataViewMappings[0].scriptResult : void 0;
|
42003 | }
|
42004 | function extractScriptResult(dataViewMappings) {
|
42005 | var scriptResult = findScriptResult(dataViewMappings);
|
42006 | if (scriptResult) {
|
42007 | var objects = dataViewMappings[0].metadata.objects, source = powerbi.DataViewObjects.getValue(objects, scriptResult.script.source), provider = powerbi.DataViewObjects.getValue(objects, scriptResult.script.provider);
|
42008 | return {
|
42009 | source: source,
|
42010 | provider: provider
|
42011 | };
|
42012 | }
|
42013 | }
|
42014 | function extractScriptResultFromVisualConfig(dataViewMappings, objects) {
|
42015 | var scriptResult = findScriptResult(dataViewMappings);
|
42016 | if (scriptResult && objects) {
|
42017 | var scriptSource = powerbi.data.DataViewObjectDefinitions.getValue(objects, scriptResult.script.source, null), provider = powerbi.data.DataViewObjectDefinitions.getValue(objects, scriptResult.script.provider, null);
|
42018 | return {
|
42019 | source: scriptSource ? scriptSource.value : null,
|
42020 | provider: provider ? provider.value : null
|
42021 | };
|
42022 | }
|
42023 | }
|
42024 | function getScriptInput(projections, selects, schema) {
|
42025 | var scriptInput = {
|
42026 | VariableName: "dataset",
|
42027 | Columns: []
|
42028 | };
|
42029 | if (projections && selects && !_.isEmpty(selects)) {
|
42030 | var scriptInputColumnNames = [], scriptInputColumns = [];
|
42031 | for (var role in projections) for (var _i = 0, _a = projections[role].all(); _i < _a.length; _i++) {
|
42032 | var projection = _a[_i], select = selects.withName(projection.queryRef);
|
42033 | if (select) {
|
42034 | var scriptInputColumn = {
|
42035 | QueryName: select.name,
|
42036 | Name: FieldExprPattern.visit(select.expr, new ScriptInputColumnNameVisitor(schema))
|
42037 | };
|
42038 | scriptInputColumns.push(scriptInputColumn), scriptInputColumnNames.push(scriptInputColumn.Name);
|
42039 | }
|
42040 | }
|
42041 | scriptInputColumnNames = StringExtensions.ensureUniqueNames(scriptInputColumnNames);
|
42042 | for (var i = 0; i < scriptInputColumnNames.length; i++) {
|
42043 | var scriptInputColumn = scriptInputColumns[i];
|
42044 | scriptInputColumn.Name = scriptInputColumnNames[i];
|
42045 | }
|
42046 | scriptInput.Columns = scriptInputColumns;
|
42047 | }
|
42048 | return scriptInput;
|
42049 | }
|
42050 | ScriptResultUtil.findScriptResult = findScriptResult, ScriptResultUtil.extractScriptResult = extractScriptResult,
|
42051 | ScriptResultUtil.extractScriptResultFromVisualConfig = extractScriptResultFromVisualConfig,
|
42052 | ScriptResultUtil.getScriptInput = getScriptInput;
|
42053 | var ScriptInputColumnNameVisitor = function() {
|
42054 | function ScriptInputColumnNameVisitor(federatedSchema) {
|
42055 | this.federatedSchema = federatedSchema;
|
42056 | }
|
42057 | return ScriptInputColumnNameVisitor.prototype.visitColumn = function(column) {
|
42058 | return ScriptInputColumnNameVisitor.getNameForProperty(column, this.federatedSchema);
|
42059 | }, ScriptInputColumnNameVisitor.prototype.visitColumnAggr = function(columnAggr) {
|
42060 | return ScriptInputColumnNameVisitor.getNameForProperty(columnAggr, this.federatedSchema);
|
42061 | }, ScriptInputColumnNameVisitor.prototype.visitColumnHierarchyLevelVariation = function(columnHierarchyLevelVariation) {
|
42062 | return ScriptInputColumnNameVisitor.getVariationLevelName(columnHierarchyLevelVariation, this.federatedSchema);
|
42063 | }, ScriptInputColumnNameVisitor.prototype.visitEntity = function(entity) {
|
42064 | return entity.entity;
|
42065 | }, ScriptInputColumnNameVisitor.prototype.visitEntityAggr = function(entityAggr) {
|
42066 | return entityAggr.entity;
|
42067 | }, ScriptInputColumnNameVisitor.prototype.visitHierarchy = function(hierarchy) {
|
42068 | return ScriptInputColumnNameVisitor.getNameForHierarchy(hierarchy, this.federatedSchema);
|
42069 | }, ScriptInputColumnNameVisitor.prototype.visitHierarchyLevel = function(hierarchyLevel) {},
|
42070 | ScriptInputColumnNameVisitor.prototype.visitHierarchyLevelAggr = function(hierarchyLevelAggr) {
|
42071 | return ScriptInputColumnNameVisitor.getNameForProperty(hierarchyLevelAggr, this.federatedSchema);
|
42072 | }, ScriptInputColumnNameVisitor.prototype.visitMeasure = function(measure) {
|
42073 | return ScriptInputColumnNameVisitor.getNameForProperty(measure, this.federatedSchema);
|
42074 | }, ScriptInputColumnNameVisitor.prototype.visitSelectRef = function(selectRef) {
|
42075 | return FieldExprPattern.visit(selectRef, this);
|
42076 | }, ScriptInputColumnNameVisitor.prototype.visitPercentile = function(percentile) {
|
42077 | return FieldExprPattern.visit(percentile.arg, this);
|
42078 | }, ScriptInputColumnNameVisitor.prototype.visitPercentOfGrandTotal = function(percentOfGrandTotal) {
|
42079 | return FieldExprPattern.visit(percentOfGrandTotal.baseExpr, this);
|
42080 | }, ScriptInputColumnNameVisitor.getNameForHierarchy = function(pattern, federatedScheam) {
|
42081 | var schema = federatedScheam.schema(pattern.schema), hierarchy = schema.findHierarchy(pattern.entity, pattern.name);
|
42082 | return hierarchy ? hierarchy.name : void 0;
|
42083 | }, ScriptInputColumnNameVisitor.getNameForProperty = function(pattern, federatedSchema) {
|
42084 | var schema = federatedSchema.schema(pattern.schema), property = schema.findProperty(pattern.entity, pattern.name);
|
42085 | return property ? property.name : void 0;
|
42086 | }, ScriptInputColumnNameVisitor.getVariationLevelName = function(pattern, federatedSchema) {
|
42087 | var source = pattern.source, prop = federatedSchema.schema(source.schema).findProperty(source.entity, source.name);
|
42088 | if (prop) for (var variations = prop.column.variations, _i = 0, variations_1 = variations; _i < variations_1.length; _i++) {
|
42089 | var variation = variations_1[_i];
|
42090 | if (variation.name === pattern.variationName) for (var _a = 0, _b = variation.defaultHierarchy.levels; _a < _b.length; _a++) {
|
42091 | var level = _b[_a];
|
42092 | if (level.name === pattern.level.level) return level.column.name;
|
42093 | }
|
42094 | }
|
42095 | }, ScriptInputColumnNameVisitor;
|
42096 | }();
|
42097 | }(ScriptResultUtil = powerbi.ScriptResultUtil || (powerbi.ScriptResultUtil = {}));
|
42098 | }(powerbi || (powerbi = {}));
|
42099 | }, function(module, exports) {
|
42100 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
42101 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
42102 | !function(powerbi) {
|
42103 | var data;
|
42104 | !function(data) {
|
42105 | var segmentation;
|
42106 | !function(segmentation) {
|
42107 | var DataViewMerger;
|
42108 | !function(DataViewMerger) {
|
42109 | function mergeDataViews(source, segment) {
|
42110 | !powerbi.DataViewAnalysis.isMetadataEquivalent(source.metadata, segment.metadata),
|
42111 | segment.metadata.segment || delete source.metadata.segment, source.table && segment.table && mergeTables(source.table, segment.table),
|
42112 | source.categorical && segment.categorical && mergeCategorical(source.categorical, segment.categorical),
|
42113 | source.tree && segment.tree && mergeTreeNodes(source.tree.root, segment.tree.root, !0),
|
42114 | source.matrix && segment.matrix && mergeTreeNodes(source.matrix.rows.root, segment.matrix.rows.root, !1);
|
42115 | }
|
42116 | function mergeTables(source, segment) {
|
42117 | if (!_.isEmpty(segment.rows)) {
|
42118 | var mergeIndex = segment.lastMergeIndex + 1;
|
42119 | merge(source.rows, segment.rows, mergeIndex), segment.identity && merge(source.identity, segment.identity, mergeIndex);
|
42120 | }
|
42121 | }
|
42122 | function mergeCategorical(source, segment) {
|
42123 | if (source.categories && segment.categories) for (var segmentCategoriesLength = segment.categories.length, categoryIndex = 0; segmentCategoriesLength > categoryIndex; categoryIndex++) {
|
42124 | var segmentCategory = segment.categories[categoryIndex], sourceCategory = source.categories[categoryIndex], mergeIndex = segment.lastMergeIndex + 1;
|
42125 | segmentCategory.values && merge(sourceCategory.values, segmentCategory.values, mergeIndex),
|
42126 | segmentCategory.identity && merge(sourceCategory.identity, segmentCategory.identity, mergeIndex);
|
42127 | }
|
42128 | if (source.values && segment.values) for (var segmentValuesLength = segment.values.length, valueIndex = 0; segmentValuesLength > valueIndex; valueIndex++) {
|
42129 | var segmentValue = segment.values[valueIndex], sourceValue = source.values[valueIndex];
|
42130 | !sourceValue.values && segmentValue.values && (sourceValue.values = []);
|
42131 | var mergeIndex = segment.lastMergeIndex + 1;
|
42132 | segmentValue.values && merge(sourceValue.values, segmentValue.values, mergeIndex),
|
42133 | segmentValue.highlights && merge(sourceValue.highlights, segmentValue.highlights, mergeIndex);
|
42134 | }
|
42135 | }
|
42136 | function merge(source, segment, index) {
|
42137 | if (index >= segment.length) return segment;
|
42138 | var result = [];
|
42139 | return void 0 !== index && (result = segment.splice(0, index)), Array.prototype.push.apply(source, segment),
|
42140 | result;
|
42141 | }
|
42142 | function mergeTreeNodes(sourceRoot, segmentRoot, allowDifferentStructure) {
|
42143 | if (segmentRoot.children && 0 !== segmentRoot.children.length) {
|
42144 | if (allowDifferentStructure && (!sourceRoot.children || 0 === sourceRoot.children.length)) return void (sourceRoot.children = segmentRoot.children);
|
42145 | var firstAppendIndex = findFirstAppendIndex(segmentRoot.children), lastSourceChild = sourceRoot.children[sourceRoot.children.length - 1], mergedChildren = merge(sourceRoot.children, segmentRoot.children, firstAppendIndex);
|
42146 | mergedChildren.length > 0 && mergeTreeNodes(lastSourceChild, mergedChildren[mergedChildren.length - 1], allowDifferentStructure);
|
42147 | }
|
42148 | }
|
42149 | function findFirstAppendIndex(children) {
|
42150 | if (0 === children.length) return 0;
|
42151 | for (var i = 0; i < children.length; i++) {
|
42152 | var childSegment = children[i];
|
42153 | if (!childSegment.isMerge) break;
|
42154 | }
|
42155 | return i;
|
42156 | }
|
42157 | DataViewMerger.mergeDataViews = mergeDataViews, DataViewMerger.mergeTables = mergeTables,
|
42158 | DataViewMerger.mergeCategorical = mergeCategorical, DataViewMerger.mergeTreeNodes = mergeTreeNodes;
|
42159 | }(DataViewMerger = segmentation.DataViewMerger || (segmentation.DataViewMerger = {}));
|
42160 | }(segmentation = data.segmentation || (data.segmentation = {}));
|
42161 | }(data = powerbi.data || (powerbi.data = {}));
|
42162 | }(powerbi || (powerbi = {}));
|
42163 | }, function(module, exports) {
|
42164 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
42165 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
42166 | !function(powerbi) {
|
42167 | var data;
|
42168 | !function(data) {
|
42169 | var ArrayExtensions = jsCommon.ArrayExtensions, SQExprRewriter = function() {
|
42170 | function SQExprRewriter() {}
|
42171 | return SQExprRewriter.prototype.visitColumnRef = function(expr) {
|
42172 | var origArg = expr.source, rewrittenArg = origArg.accept(this);
|
42173 | return origArg === rewrittenArg ? expr : new data.SQColumnRefExpr(rewrittenArg, expr.ref);
|
42174 | }, SQExprRewriter.prototype.visitMeasureRef = function(expr) {
|
42175 | var origArg = expr.source, rewrittenArg = origArg.accept(this);
|
42176 | return origArg === rewrittenArg ? expr : new data.SQMeasureRefExpr(rewrittenArg, expr.ref);
|
42177 | }, SQExprRewriter.prototype.visitAggr = function(expr) {
|
42178 | var origArg = expr.arg, rewrittenArg = origArg.accept(this);
|
42179 | return origArg === rewrittenArg ? expr : new data.SQAggregationExpr(rewrittenArg, expr.func);
|
42180 | }, SQExprRewriter.prototype.visitSelectRef = function(expr) {
|
42181 | return expr;
|
42182 | }, SQExprRewriter.prototype.visitPercentile = function(expr) {
|
42183 | var origArg = expr.arg, rewrittenArg = origArg.accept(this);
|
42184 | return origArg === rewrittenArg ? expr : new data.SQPercentileExpr(rewrittenArg, expr.k, expr.exclusive);
|
42185 | }, SQExprRewriter.prototype.visitHierarchy = function(expr) {
|
42186 | var origArg = expr.arg, rewrittenArg = origArg.accept(this);
|
42187 | return origArg === rewrittenArg ? expr : new data.SQHierarchyExpr(rewrittenArg, expr.hierarchy);
|
42188 | }, SQExprRewriter.prototype.visitHierarchyLevel = function(expr) {
|
42189 | var origArg = expr.arg, rewrittenArg = origArg.accept(this);
|
42190 | return origArg === rewrittenArg ? expr : new data.SQHierarchyLevelExpr(rewrittenArg, expr.level);
|
42191 | }, SQExprRewriter.prototype.visitPropertyVariationSource = function(expr) {
|
42192 | var origArg = expr.arg, rewrittenArg = origArg.accept(this);
|
42193 | return origArg === rewrittenArg ? expr : new data.SQPropertyVariationSourceExpr(rewrittenArg, expr.name, expr.property);
|
42194 | }, SQExprRewriter.prototype.visitEntity = function(expr) {
|
42195 | return expr;
|
42196 | }, SQExprRewriter.prototype.visitAnd = function(orig) {
|
42197 | var origLeft = orig.left, rewrittenLeft = origLeft.accept(this), origRight = orig.right, rewrittenRight = origRight.accept(this);
|
42198 | return origLeft === rewrittenLeft && origRight === rewrittenRight ? orig : new data.SQAndExpr(rewrittenLeft, rewrittenRight);
|
42199 | }, SQExprRewriter.prototype.visitBetween = function(orig) {
|
42200 | var origArg = orig.arg, rewrittenArg = origArg.accept(this), origLower = orig.lower, rewrittenLower = origLower.accept(this), origUpper = orig.upper, rewrittenUpper = origUpper.accept(this);
|
42201 | return origArg === rewrittenArg && origLower === rewrittenLower && origUpper === rewrittenUpper ? orig : new data.SQBetweenExpr(rewrittenArg, rewrittenLower, rewrittenUpper);
|
42202 | }, SQExprRewriter.prototype.visitIn = function(orig) {
|
42203 | for (var rewrittenValues, origArgs = orig.args, rewrittenArgs = this.rewriteAll(origArgs), origValues = orig.values, i = 0, len = origValues.length; len > i; i++) {
|
42204 | var origValueTuple = origValues[i], rewrittenValueTuple = this.rewriteAll(origValueTuple);
|
42205 | origValueTuple === rewrittenValueTuple || rewrittenValues || (rewrittenValues = ArrayExtensions.take(origValues, i)),
|
42206 | rewrittenValues && rewrittenValues.push(rewrittenValueTuple);
|
42207 | }
|
42208 | return origArgs !== rewrittenArgs || rewrittenValues ? new data.SQInExpr(rewrittenArgs, rewrittenValues || origValues) : orig;
|
42209 | }, SQExprRewriter.prototype.rewriteAll = function(origExprs) {
|
42210 | for (var rewrittenResult, i = 0, len = origExprs.length; len > i; i++) {
|
42211 | var origExpr = origExprs[i], rewrittenExpr = origExpr.accept(this);
|
42212 | origExpr === rewrittenExpr || rewrittenResult || (rewrittenResult = ArrayExtensions.take(origExprs, i)),
|
42213 | rewrittenResult && rewrittenResult.push(rewrittenExpr);
|
42214 | }
|
42215 | return rewrittenResult || origExprs;
|
42216 | }, SQExprRewriter.prototype.visitOr = function(orig) {
|
42217 | var origLeft = orig.left, rewrittenLeft = origLeft.accept(this), origRight = orig.right, rewrittenRight = origRight.accept(this);
|
42218 | return origLeft === rewrittenLeft && origRight === rewrittenRight ? orig : new data.SQOrExpr(rewrittenLeft, rewrittenRight);
|
42219 | }, SQExprRewriter.prototype.visitCompare = function(orig) {
|
42220 | var origLeft = orig.left, rewrittenLeft = origLeft.accept(this), origRight = orig.right, rewrittenRight = origRight.accept(this);
|
42221 | return origLeft === rewrittenLeft && origRight === rewrittenRight ? orig : new data.SQCompareExpr(orig.comparison, rewrittenLeft, rewrittenRight);
|
42222 | }, SQExprRewriter.prototype.visitContains = function(orig) {
|
42223 | var origLeft = orig.left, rewrittenLeft = origLeft.accept(this), origRight = orig.right, rewrittenRight = origRight.accept(this);
|
42224 | return origLeft === rewrittenLeft && origRight === rewrittenRight ? orig : new data.SQContainsExpr(rewrittenLeft, rewrittenRight);
|
42225 | }, SQExprRewriter.prototype.visitExists = function(orig) {
|
42226 | var origArg = orig.arg, rewrittenArg = origArg.accept(this);
|
42227 | return origArg === rewrittenArg ? orig : new data.SQExistsExpr(rewrittenArg);
|
42228 | }, SQExprRewriter.prototype.visitNot = function(orig) {
|
42229 | var origArg = orig.arg, rewrittenArg = origArg.accept(this);
|
42230 | return origArg === rewrittenArg ? orig : new data.SQNotExpr(rewrittenArg);
|
42231 | }, SQExprRewriter.prototype.visitStartsWith = function(orig) {
|
42232 | var origLeft = orig.left, rewrittenLeft = origLeft.accept(this), origRight = orig.right, rewrittenRight = origRight.accept(this);
|
42233 | return origLeft === rewrittenLeft && origRight === rewrittenRight ? orig : new data.SQStartsWithExpr(rewrittenLeft, rewrittenRight);
|
42234 | }, SQExprRewriter.prototype.visitConstant = function(expr) {
|
42235 | return expr;
|
42236 | }, SQExprRewriter.prototype.visitDateSpan = function(orig) {
|
42237 | var origArg = orig.arg, rewrittenArg = origArg.accept(this);
|
42238 | return origArg === rewrittenArg ? orig : new data.SQDateSpanExpr(orig.unit, rewrittenArg);
|
42239 | }, SQExprRewriter.prototype.visitDateAdd = function(orig) {
|
42240 | var origArg = orig.arg, rewrittenArg = origArg.accept(this);
|
42241 | return origArg === rewrittenArg ? orig : new data.SQDateAddExpr(orig.unit, orig.amount, rewrittenArg);
|
42242 | }, SQExprRewriter.prototype.visitNow = function(orig) {
|
42243 | return orig;
|
42244 | }, SQExprRewriter.prototype.visitDefaultValue = function(orig) {
|
42245 | return orig;
|
42246 | }, SQExprRewriter.prototype.visitAnyValue = function(orig) {
|
42247 | return orig;
|
42248 | }, SQExprRewriter.prototype.visitArithmetic = function(orig) {
|
42249 | var origLeft = orig.left, rewrittenLeft = origLeft.accept(this), origRight = orig.right, rewrittenRight = origRight.accept(this);
|
42250 | return origLeft === rewrittenLeft && origRight === rewrittenRight ? orig : new data.SQArithmeticExpr(rewrittenLeft, rewrittenRight, orig.operator);
|
42251 | }, SQExprRewriter.prototype.visitScopedEval = function(orig) {
|
42252 | var origExpression = orig.expression, rewrittenExpression = origExpression.accept(this), origScope = orig.scope, rewrittenScope = this.rewriteAll(origScope);
|
42253 | return origExpression === rewrittenExpression && origScope === rewrittenScope ? orig : new data.SQScopedEvalExpr(rewrittenExpression, rewrittenScope);
|
42254 | }, SQExprRewriter.prototype.visitWithRef = function(orig) {
|
42255 | return orig;
|
42256 | }, SQExprRewriter.prototype.visitTransformTableRef = function(orig) {
|
42257 | return orig;
|
42258 | }, SQExprRewriter.prototype.visitTransformOutputRoleRef = function(orig) {
|
42259 | return orig;
|
42260 | }, SQExprRewriter.prototype.visitFillRule = function(orig) {
|
42261 | var origInput = orig.input, rewrittenInput = origInput.accept(this), origRule = orig.rule, origGradient2 = origRule.linearGradient2, rewrittenGradient2 = origGradient2;
|
42262 | origGradient2 && (rewrittenGradient2 = this.visitLinearGradient2(origGradient2));
|
42263 | var origGradient3 = origRule.linearGradient3, rewrittenGradient3 = origGradient3;
|
42264 | if (origGradient3 && (rewrittenGradient3 = this.visitLinearGradient3(origGradient3)),
|
42265 | origInput !== rewrittenInput || origGradient2 !== rewrittenGradient2 || origGradient3 !== rewrittenGradient3) {
|
42266 | var rewrittenRule = {};
|
42267 | return rewrittenGradient2 && (rewrittenRule.linearGradient2 = rewrittenGradient2),
|
42268 | rewrittenGradient3 && (rewrittenRule.linearGradient3 = rewrittenGradient3), new data.SQFillRuleExpr(rewrittenInput, rewrittenRule);
|
42269 | }
|
42270 | return orig;
|
42271 | }, SQExprRewriter.prototype.visitLinearGradient2 = function(origGradient2) {
|
42272 | var origMin = origGradient2.min, rewrittenMin = this.visitFillRuleStop(origMin), origMax = origGradient2.max, rewrittenMax = this.visitFillRuleStop(origMax);
|
42273 | return origMin !== rewrittenMin || origMax !== rewrittenMax ? {
|
42274 | min: rewrittenMin,
|
42275 | max: rewrittenMax
|
42276 | } : origGradient2;
|
42277 | }, SQExprRewriter.prototype.visitLinearGradient3 = function(origGradient3) {
|
42278 | var origMin = origGradient3.min, rewrittenMin = this.visitFillRuleStop(origMin), origMid = origGradient3.mid, rewrittenMid = this.visitFillRuleStop(origMid), origMax = origGradient3.max, rewrittenMax = this.visitFillRuleStop(origMax);
|
42279 | return origMin !== rewrittenMin || origMid !== rewrittenMid || origMax !== rewrittenMax ? {
|
42280 | min: rewrittenMin,
|
42281 | mid: rewrittenMid,
|
42282 | max: rewrittenMax
|
42283 | } : origGradient3;
|
42284 | }, SQExprRewriter.prototype.visitFillRuleStop = function(stop) {
|
42285 | var origColor = stop.color, rewrittenColor = stop.color.accept(this), origValue = stop.value, rewrittenValue = origValue;
|
42286 | if (origValue && (rewrittenValue = origValue.accept(this)), origColor !== rewrittenColor || origValue !== rewrittenValue) {
|
42287 | var rewrittenStop = {
|
42288 | color: rewrittenColor
|
42289 | };
|
42290 | return rewrittenValue && (rewrittenStop.value = rewrittenValue), rewrittenStop;
|
42291 | }
|
42292 | return stop;
|
42293 | }, SQExprRewriter.prototype.visitResourcePackageItem = function(orig) {
|
42294 | return orig;
|
42295 | }, SQExprRewriter;
|
42296 | }();
|
42297 | data.SQExprRewriter = SQExprRewriter;
|
42298 | }(data = powerbi.data || (powerbi.data = {}));
|
42299 | }(powerbi || (powerbi = {}));
|
42300 | }, function(module, exports) {
|
42301 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
42302 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
42303 | function __() {
|
42304 | this.constructor = d;
|
42305 | }
|
42306 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
42307 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
42308 | });
|
42309 | !function(powerbi) {
|
42310 | var data;
|
42311 | !function(data) {
|
42312 | var EqualsToInRewriter;
|
42313 | !function(EqualsToInRewriter) {
|
42314 | function run(expr) {
|
42315 | return expr.accept(new Rewriter());
|
42316 | }
|
42317 | EqualsToInRewriter.run = run;
|
42318 | var Rewriter = function(_super) {
|
42319 | function Rewriter() {
|
42320 | _super.call(this);
|
42321 | }
|
42322 | return __extends(Rewriter, _super), Rewriter.prototype.visitCompare = function(expr) {
|
42323 | if (expr.comparison !== data.QueryComparisonKind.Equal) return this.visitUnsupported(expr);
|
42324 | if (!this.isSupported(expr.left) || !this.isSupported(expr.right)) return this.visitUnsupported(expr);
|
42325 | var leftIsComparand = this.isComparand(expr.left), rightIsComparand = this.isComparand(expr.right);
|
42326 | if (leftIsComparand === rightIsComparand) return this.visitUnsupported(expr);
|
42327 | var operand = leftIsComparand ? expr.left : expr.right, value = leftIsComparand ? expr.right : expr.left, current = this.current;
|
42328 | return current ? (current.add(operand, value), expr) : data.SQExprBuilder.inExpr([ operand ], [ [ value ] ]);
|
42329 | }, Rewriter.prototype.visitOr = function(expr) {
|
42330 | if (!this.isSupported(expr.left) || !this.isSupported(expr.right)) return this.visitUnsupported(expr);
|
42331 | var current;
|
42332 | return this.current || (current = this.current = new InBuilder()), expr.left.accept(this),
|
42333 | expr.right.accept(this), current ? (this.current = null, current.complete() || expr) : expr;
|
42334 | }, Rewriter.prototype.visitAnd = function(expr) {
|
42335 | if (!this.isSupported(expr.left) || !this.isSupported(expr.right)) return this.visitUnsupported(expr);
|
42336 | var current = this.current;
|
42337 | return current ? (current.cancel(), expr) : _super.prototype.visitAnd.call(this, expr);
|
42338 | }, Rewriter.prototype.visitUnsupported = function(expr) {
|
42339 | var current = this.current;
|
42340 | return current && current.cancel(), expr;
|
42341 | }, Rewriter.prototype.isSupported = function(expr) {
|
42342 | return expr instanceof data.SQCompareExpr || expr instanceof data.SQColumnRefExpr || expr instanceof data.SQConstantExpr || expr instanceof data.SQHierarchyLevelExpr || expr instanceof data.SQOrExpr || expr instanceof data.SQAndExpr;
|
42343 | }, Rewriter.prototype.isComparand = function(expr) {
|
42344 | return expr instanceof data.SQColumnRefExpr || expr instanceof data.SQHierarchyLevelExpr;
|
42345 | }, Rewriter;
|
42346 | }(data.SQExprRewriter), InBuilder = function() {
|
42347 | function InBuilder() {}
|
42348 | return InBuilder.prototype.add = function(operand, value) {
|
42349 | if (!this.cancelled) {
|
42350 | if (this.operand && !data.SQExpr.equals(operand, this.operand)) return void this.cancel();
|
42351 | this.operand = operand;
|
42352 | var values = this.values;
|
42353 | values || (values = this.values = []), values.push(value);
|
42354 | }
|
42355 | }, InBuilder.prototype.cancel = function() {
|
42356 | this.cancelled = !0;
|
42357 | }, InBuilder.prototype.complete = function() {
|
42358 | return !this.cancelled && this.operand ? data.SQExprBuilder.inExpr([ this.operand ], _.map(this.values, function(v) {
|
42359 | return [ v ];
|
42360 | })) : void 0;
|
42361 | }, InBuilder;
|
42362 | }();
|
42363 | }(EqualsToInRewriter = data.EqualsToInRewriter || (data.EqualsToInRewriter = {}));
|
42364 | }(data = powerbi.data || (powerbi.data = {}));
|
42365 | }(powerbi || (powerbi = {}));
|
42366 | }, function(module, exports) {
|
42367 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi, __extends = (window.powerbitests,
|
42368 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
42369 | function __() {
|
42370 | this.constructor = d;
|
42371 | }
|
42372 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
42373 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
42374 | });
|
42375 | !function(powerbi) {
|
42376 | var data;
|
42377 | !function(data) {
|
42378 | var SQExprConverter;
|
42379 | !function(SQExprConverter) {
|
42380 | function asScopeIdsContainer(filter, fieldSQExprs) {
|
42381 | var filterItems = filter.conditions(), filterItem = filterItems[0];
|
42382 | if (filterItem) {
|
42383 | var visitor = new FilterScopeIdsCollectorVisitor(fieldSQExprs);
|
42384 | if (filterItem.accept(visitor)) return visitor.getResult();
|
42385 | }
|
42386 | }
|
42387 | function getFirstComparandValue(identity) {
|
42388 | var comparandExpr = identity.expr.accept(new FindComparandVisitor());
|
42389 | return comparandExpr ? comparandExpr.value : void 0;
|
42390 | }
|
42391 | SQExprConverter.asScopeIdsContainer = asScopeIdsContainer, SQExprConverter.getFirstComparandValue = getFirstComparandValue;
|
42392 | }(SQExprConverter = data.SQExprConverter || (data.SQExprConverter = {}));
|
42393 | var FilterScopeIdsCollectorVisitor = function(_super) {
|
42394 | function FilterScopeIdsCollectorVisitor(fieldSQExprs) {
|
42395 | _super.call(this), this.isRoot = !0, this.isNot = !1, this.keyExprsCount = null,
|
42396 | this.valueExprs = [], this.fieldExprs = [];
|
42397 | for (var _i = 0, fieldSQExprs_1 = fieldSQExprs; _i < fieldSQExprs_1.length; _i++) {
|
42398 | var field = fieldSQExprs_1[_i];
|
42399 | this.fieldExprs.push(data.SQExprBuilder.removeEntityVariables(field));
|
42400 | }
|
42401 | }
|
42402 | return __extends(FilterScopeIdsCollectorVisitor, _super), FilterScopeIdsCollectorVisitor.prototype.getResult = function() {
|
42403 | for (var valueExprs = this.valueExprs, scopeIds = [], valueCount = this.keyExprsCount || 1, startIndex = 0, endIndex = valueCount, len = valueExprs.length; len > startIndex && len >= endIndex; ) {
|
42404 | var values = valueExprs.slice(startIndex, endIndex), scopeId = FilterScopeIdsCollectorVisitor.getScopeIdentity(this.fieldExprs, values);
|
42405 | jsCommon.ArrayExtensions.isInArray(scopeIds, scopeId, powerbi.DataViewScopeIdentity.equals) || scopeIds.push(scopeId),
|
42406 | startIndex += valueCount, endIndex += valueCount;
|
42407 | }
|
42408 | return {
|
42409 | isNot: this.isNot,
|
42410 | scopeIds: scopeIds
|
42411 | };
|
42412 | }, FilterScopeIdsCollectorVisitor.getScopeIdentity = function(fieldExprs, valueExprs) {
|
42413 | for (var compoundSQExpr, i = 0, len = fieldExprs.length; len > i; i++) {
|
42414 | var equalsExpr = data.SQExprBuilder.equal(fieldExprs[i], valueExprs[i]);
|
42415 | compoundSQExpr = compoundSQExpr ? data.SQExprBuilder.and(compoundSQExpr, equalsExpr) : equalsExpr;
|
42416 | }
|
42417 | return data.createDataViewScopeIdentity(compoundSQExpr);
|
42418 | }, FilterScopeIdsCollectorVisitor.prototype.visitOr = function(expr) {
|
42419 | return null !== this.keyExprsCount ? this.unsupportedSQExpr() : (this.isRoot = !1,
|
42420 | expr.left.accept(this) && expr.right.accept(this));
|
42421 | }, FilterScopeIdsCollectorVisitor.prototype.visitNot = function(expr) {
|
42422 | return this.isRoot ? (this.isNot = !0, expr.arg.accept(this)) : this.unsupportedSQExpr();
|
42423 | }, FilterScopeIdsCollectorVisitor.prototype.visitConstant = function(expr) {
|
42424 | return this.isRoot && expr.type.primitiveType === powerbi.PrimitiveType.Null ? this.unsupportedSQExpr() : (this.valueExprs.push(expr),
|
42425 | !0);
|
42426 | }, FilterScopeIdsCollectorVisitor.prototype.visitCompare = function(expr) {
|
42427 | return null !== this.keyExprsCount ? this.unsupportedSQExpr() : (this.isRoot = !1,
|
42428 | expr.comparison !== data.QueryComparisonKind.Equal ? this.unsupportedSQExpr() : expr.left.accept(this) && expr.right.accept(this));
|
42429 | }, FilterScopeIdsCollectorVisitor.prototype.visitIn = function(expr) {
|
42430 | this.keyExprsCount = 0;
|
42431 | var result;
|
42432 | this.isRoot = !1;
|
42433 | for (var _i = 0, _a = expr.args; _i < _a.length; _i++) {
|
42434 | var arg = _a[_i];
|
42435 | if (result = arg.accept(this), !result) return this.unsupportedSQExpr();
|
42436 | this.keyExprsCount++;
|
42437 | }
|
42438 | if (this.keyExprsCount !== this.fieldExprs.length) return this.unsupportedSQExpr();
|
42439 | for (var values = expr.values, _b = 0, values_1 = values; _b < values_1.length; _b++) for (var valueTuple = values_1[_b], _c = (valueTuple.length,
|
42440 | 0), valueTuple_1 = valueTuple; _c < valueTuple_1.length; _c++) {
|
42441 | var value = valueTuple_1[_c];
|
42442 | if (result = value.accept(this), !result) return this.unsupportedSQExpr();
|
42443 | }
|
42444 | return result;
|
42445 | }, FilterScopeIdsCollectorVisitor.prototype.visitColumnRef = function(expr) {
|
42446 | if (this.isRoot) return this.unsupportedSQExpr();
|
42447 | var fixedExpr = data.SQExprBuilder.removeEntityVariables(expr);
|
42448 | return null !== this.keyExprsCount ? data.SQExpr.equals(this.fieldExprs[this.keyExprsCount], fixedExpr) : data.SQExpr.equals(this.fieldExprs[0], fixedExpr);
|
42449 | }, FilterScopeIdsCollectorVisitor.prototype.visitDefaultValue = function(expr) {
|
42450 | return this.isRoot || null !== this.keyExprsCount ? this.unsupportedSQExpr() : (this.valueExprs.push(expr),
|
42451 | !0);
|
42452 | }, FilterScopeIdsCollectorVisitor.prototype.visitAnyValue = function(expr) {
|
42453 | return this.isRoot || null !== this.keyExprsCount ? this.unsupportedSQExpr() : (this.valueExprs.push(expr),
|
42454 | !0);
|
42455 | }, FilterScopeIdsCollectorVisitor.prototype.visitDefault = function(expr) {
|
42456 | return this.unsupportedSQExpr();
|
42457 | }, FilterScopeIdsCollectorVisitor.prototype.unsupportedSQExpr = function() {
|
42458 | return !1;
|
42459 | }, FilterScopeIdsCollectorVisitor;
|
42460 | }(data.DefaultSQExprVisitor), FindComparandVisitor = function(_super) {
|
42461 | function FindComparandVisitor() {
|
42462 | _super.apply(this, arguments);
|
42463 | }
|
42464 | return __extends(FindComparandVisitor, _super), FindComparandVisitor.prototype.visitAnd = function(expr) {
|
42465 | return expr.left.accept(this) || expr.right.accept(this);
|
42466 | }, FindComparandVisitor.prototype.visitCompare = function(expr) {
|
42467 | if (expr.comparison === data.QueryComparisonKind.Equal) {
|
42468 | if (expr.right instanceof data.SQConstantExpr) return expr.right;
|
42469 | if (expr.left instanceof data.SQConstantExpr) return expr.left;
|
42470 | }
|
42471 | }, FindComparandVisitor;
|
42472 | }(data.DefaultSQExprVisitor);
|
42473 | }(data = powerbi.data || (powerbi.data = {}));
|
42474 | }(powerbi || (powerbi = {}));
|
42475 | }, function(module, exports) {
|
42476 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi, __extends = (window.powerbitests,
|
42477 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
42478 | function __() {
|
42479 | this.constructor = d;
|
42480 | }
|
42481 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
42482 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
42483 | });
|
42484 | !function(powerbi) {
|
42485 | var data;
|
42486 | !function(data) {
|
42487 | var ScopeIdentityExtractor, ArrayExtensions = jsCommon.ArrayExtensions;
|
42488 | !function(ScopeIdentityExtractor) {
|
42489 | function getKeys(expr) {
|
42490 | var extractor = new ScopeIdExtractorImpl();
|
42491 | return expr.accept(extractor), extractor.malformed ? null : ArrayExtensions.emptyToNull(extractor.keys);
|
42492 | }
|
42493 | function getValues(expr) {
|
42494 | var extractor = new ScopeIdExtractorImpl();
|
42495 | return expr.accept(extractor), extractor.malformed ? null : ArrayExtensions.emptyToNull(extractor.values);
|
42496 | }
|
42497 | function getInExpr(expr) {
|
42498 | var extractor = new ScopeIdExtractorImpl();
|
42499 | if (expr.accept(extractor), !extractor.malformed) {
|
42500 | var keys = ArrayExtensions.emptyToNull(extractor.keys), keyValues = ArrayExtensions.emptyToNull(extractor.values);
|
42501 | return keys && keyValues ? data.SQExprBuilder.inExpr(keys, [ keyValues ]) : void 0;
|
42502 | }
|
42503 | }
|
42504 | ScopeIdentityExtractor.getKeys = getKeys, ScopeIdentityExtractor.getValues = getValues,
|
42505 | ScopeIdentityExtractor.getInExpr = getInExpr;
|
42506 | var ScopeIdExtractorImpl = function(_super) {
|
42507 | function ScopeIdExtractorImpl() {
|
42508 | _super.apply(this, arguments), this.keys = [], this.values = [];
|
42509 | }
|
42510 | return __extends(ScopeIdExtractorImpl, _super), ScopeIdExtractorImpl.prototype.visitAnd = function(expr) {
|
42511 | expr.left.accept(this), expr.right.accept(this);
|
42512 | }, ScopeIdExtractorImpl.prototype.visitCompare = function(expr) {
|
42513 | return expr.comparison !== data.QueryComparisonKind.Equal ? void this.visitDefault(expr) : (expr.left.accept(this),
|
42514 | void expr.right.accept(this));
|
42515 | }, ScopeIdExtractorImpl.prototype.visitColumnRef = function(expr) {
|
42516 | this.keys.push(expr);
|
42517 | }, ScopeIdExtractorImpl.prototype.visitHierarchyLevel = function(expr) {
|
42518 | this.keys.push(expr);
|
42519 | }, ScopeIdExtractorImpl.prototype.visitConstant = function(expr) {
|
42520 | this.values.push(expr);
|
42521 | }, ScopeIdExtractorImpl.prototype.visitArithmetic = function(expr) {
|
42522 | this.keys.push(expr);
|
42523 | }, ScopeIdExtractorImpl.prototype.visitDefault = function(expr) {
|
42524 | this.malformed = !0;
|
42525 | }, ScopeIdExtractorImpl;
|
42526 | }(data.DefaultSQExprVisitor);
|
42527 | }(ScopeIdentityExtractor = data.ScopeIdentityExtractor || (data.ScopeIdentityExtractor = {}));
|
42528 | }(data = powerbi.data || (powerbi.data = {}));
|
42529 | }(powerbi || (powerbi = {}));
|
42530 | }, function(module, exports) {
|
42531 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
42532 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
42533 | !function(powerbi) {
|
42534 | var data;
|
42535 | !function(data) {
|
42536 | var PrimitiveValueEncoding;
|
42537 | !function(PrimitiveValueEncoding) {
|
42538 | function decimal(value) {
|
42539 | return value + "M";
|
42540 | }
|
42541 | function double(value) {
|
42542 | return value + "D";
|
42543 | }
|
42544 | function integer(value) {
|
42545 | return value + "L";
|
42546 | }
|
42547 | function dateTime(value) {
|
42548 | var date = new Date(value.getTime() - 6e4 * value.getTimezoneOffset()), dateTimeString = date.toISOString();
|
42549 | return jsCommon.StringExtensions.endsWith(dateTimeString, "Z") && (dateTimeString = dateTimeString.substr(0, dateTimeString.length - 1)),
|
42550 | "datetime'" + dateTimeString + "'";
|
42551 | }
|
42552 | function text(value) {
|
42553 | return "'" + value.replace(SingleQuoteRegex, "''") + "'";
|
42554 | }
|
42555 | function nullEncoding() {
|
42556 | return "null";
|
42557 | }
|
42558 | function boolean(value) {
|
42559 | return value ? "true" : "false";
|
42560 | }
|
42561 | var SingleQuoteRegex = /'/g;
|
42562 | PrimitiveValueEncoding.decimal = decimal, PrimitiveValueEncoding["double"] = double,
|
42563 | PrimitiveValueEncoding.integer = integer, PrimitiveValueEncoding.dateTime = dateTime,
|
42564 | PrimitiveValueEncoding.text = text, PrimitiveValueEncoding.nullEncoding = nullEncoding,
|
42565 | PrimitiveValueEncoding["boolean"] = boolean;
|
42566 | }(PrimitiveValueEncoding = data.PrimitiveValueEncoding || (data.PrimitiveValueEncoding = {}));
|
42567 | }(data = powerbi.data || (powerbi.data = {}));
|
42568 | }(powerbi || (powerbi = {}));
|
42569 | }, function(module, exports) {
|
42570 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
42571 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
42572 | !function(powerbi) {
|
42573 | var data;
|
42574 | !function(data) {
|
42575 | function createSQAggregationOperations(datetimeMinMaxSupported) {
|
42576 | return new SQAggregationOperations(datetimeMinMaxSupported);
|
42577 | }
|
42578 | function getMetadataForUnderlyingType(expr, schema) {
|
42579 | var metadata = data.SQExprBuilder.removeAggregate(expr).getMetadata(schema);
|
42580 | return metadata || (metadata = expr.getMetadata(schema)), metadata;
|
42581 | }
|
42582 | var Agg = powerbi.data.QueryAggregateFunction;
|
42583 | data.createSQAggregationOperations = createSQAggregationOperations;
|
42584 | var SQAggregationOperations = function() {
|
42585 | function SQAggregationOperations(datetimeMinMaxSupported) {
|
42586 | this.datetimeMinMaxSupported = datetimeMinMaxSupported;
|
42587 | }
|
42588 | return SQAggregationOperations.prototype.getSupportedAggregates = function(expr, schema, targetTypes) {
|
42589 | var metadata = getMetadataForUnderlyingType(expr, schema);
|
42590 | if (!metadata) return [];
|
42591 | var valueType = metadata.type, fieldKind = metadata.kind, isPropertyIdentity = metadata.idOnEntityKey;
|
42592 | if (!valueType) return [];
|
42593 | if (1 === fieldKind) return [];
|
42594 | if (valueType.numeric || valueType.integer) {
|
42595 | var aggregates_1 = [ Agg.Sum, Agg.Avg, Agg.Min, Agg.Max, Agg.Count, Agg.CountNonNull, Agg.StandardDeviation, Agg.Variance ], fieldExpr = data.SQExprConverter.asFieldPattern(expr), fieldExprItem = data.FieldExprPattern.toFieldExprEntityItemPattern(fieldExpr), currentSchema = schema.schema(fieldExprItem.schema);
|
42596 | return currentSchema.capabilities.supportsMedian && aggregates_1.push(Agg.Median),
|
42597 | aggregates_1;
|
42598 | }
|
42599 | var aggregates = [];
|
42600 | this.datetimeMinMaxSupported && valueType.dateTime && (_.isEmpty(targetTypes) || powerbi.ValueType.isCompatibleTo(valueType, targetTypes)) && (aggregates.push(Agg.Min),
|
42601 | aggregates.push(Agg.Max));
|
42602 | var distinctCountAggExists = data.SQExprInfo.getAggregate(expr) === Agg.Count;
|
42603 | return isPropertyIdentity && !distinctCountAggExists || aggregates.push(Agg.Count),
|
42604 | aggregates.push(Agg.CountNonNull), aggregates;
|
42605 | }, SQAggregationOperations.prototype.isSupportedAggregate = function(expr, schema, aggregate, targetTypes) {
|
42606 | var supportedAggregates = this.getSupportedAggregates(expr, schema, targetTypes);
|
42607 | return _.contains(supportedAggregates, aggregate);
|
42608 | }, SQAggregationOperations.prototype.createExprWithAggregate = function(expr, schema, aggregateNonNumericFields, targetTypes, preferredAggregate) {
|
42609 | var aggregate;
|
42610 | return aggregate = null != preferredAggregate && this.isSupportedAggregate(expr, schema, preferredAggregate, targetTypes) ? preferredAggregate : expr.getDefaultAggregate(schema, aggregateNonNumericFields),
|
42611 | void 0 !== aggregate && (expr = data.SQExprBuilder.aggregate(expr, aggregate)),
|
42612 | expr;
|
42613 | }, SQAggregationOperations;
|
42614 | }();
|
42615 | }(data = powerbi.data || (powerbi.data = {}));
|
42616 | }(powerbi || (powerbi = {}));
|
42617 | }, function(module, exports) {
|
42618 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
42619 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
42620 | !function(powerbi) {
|
42621 | var data;
|
42622 | !function(data) {
|
42623 | var SQHierarchyExprUtils;
|
42624 | !function(SQHierarchyExprUtils) {
|
42625 | function getConceptualHierarchyLevelFromExpr(conceptualSchema, fieldExpr) {
|
42626 | var hierarchyLevel = getHierarchyLevel(fieldExpr);
|
42627 | return hierarchyLevel ? SQHierarchyExprUtils.getConceptualHierarchyLevel(conceptualSchema, hierarchyLevel.schema, hierarchyLevel.entity, hierarchyLevel.name, hierarchyLevel.level) : void 0;
|
42628 | }
|
42629 | function getConceptualHierarchyLevel(conceptualSchema, schemaName, entity, hierarchy, hierarchyLevel) {
|
42630 | var schema = conceptualSchema.schema(schemaName), conceptualHierarchy = schema.findHierarchy(entity, hierarchy);
|
42631 | return conceptualHierarchy ? conceptualHierarchy.levels.withName(hierarchyLevel) : void 0;
|
42632 | }
|
42633 | function getConceptualHierarchy(sqExpr, federatedSchema) {
|
42634 | if (sqExpr instanceof data.SQHierarchyExpr) {
|
42635 | var hierarchy = sqExpr;
|
42636 | if (sqExpr.arg instanceof data.SQEntityExpr) {
|
42637 | var entityExpr = sqExpr.arg;
|
42638 | return federatedSchema.schema(entityExpr.schema).findHierarchy(entityExpr.entity, hierarchy.hierarchy);
|
42639 | }
|
42640 | if (sqExpr.arg instanceof data.SQPropertyVariationSourceExpr) {
|
42641 | var variationExpr = sqExpr.arg, sourceEntityExpr = variationExpr.arg;
|
42642 | return federatedSchema.schema(sourceEntityExpr.schema).findHierarchyByVariation(sourceEntityExpr.entity, variationExpr.property, variationExpr.name, hierarchy.hierarchy);
|
42643 | }
|
42644 | }
|
42645 | }
|
42646 | function expandExpr(schema, expr, suppressHierarchyLevelExpansion) {
|
42647 | return SQExprHierarchyToHierarchyLevelConverter.convert(expr, schema) || SQExprVariationConverter.expand(expr, schema) || !suppressHierarchyLevelExpansion && SQExprHierarchyLevelConverter.expand(expr, schema) || expr;
|
42648 | }
|
42649 | function isHierarchyOrVariation(schema, expr) {
|
42650 | if (expr instanceof data.SQHierarchyExpr || expr instanceof data.SQHierarchyLevelExpr) return !0;
|
42651 | var conceptualProperty = expr.getConceptualProperty(schema);
|
42652 | if (conceptualProperty) {
|
42653 | var column = conceptualProperty.column;
|
42654 | if (column && column.variations && column.variations.length > 0) return !0;
|
42655 | }
|
42656 | return !1;
|
42657 | }
|
42658 | function getSourceVariationExpr(hierarchyLevelExpr) {
|
42659 | var fieldExprPattern = data.SQExprConverter.asFieldPattern(hierarchyLevelExpr);
|
42660 | if (fieldExprPattern.columnHierarchyLevelVariation) {
|
42661 | var entity = data.SQExprBuilder.entity(fieldExprPattern.columnHierarchyLevelVariation.source.schema, fieldExprPattern.columnHierarchyLevelVariation.source.entity);
|
42662 | return data.SQExprBuilder.columnRef(entity, fieldExprPattern.columnHierarchyLevelVariation.source.name);
|
42663 | }
|
42664 | }
|
42665 | function getSourceHierarchy(hierarchyLevelExpr) {
|
42666 | var fieldExprPattern = data.SQExprConverter.asFieldPattern(hierarchyLevelExpr), hierarchyLevel = fieldExprPattern.hierarchyLevel;
|
42667 | if (hierarchyLevel) {
|
42668 | var entity = data.SQExprBuilder.entity(hierarchyLevel.schema, hierarchyLevel.entity, hierarchyLevel.entityVar);
|
42669 | return data.SQExprBuilder.hierarchy(entity, hierarchyLevel.name);
|
42670 | }
|
42671 | }
|
42672 | function getHierarchySourceAsVariationSource(hierarchyLevelExpr) {
|
42673 | if (hierarchyLevelExpr.arg instanceof data.SQHierarchyExpr) {
|
42674 | var hierarchyRef = hierarchyLevelExpr.arg;
|
42675 | return hierarchyRef.arg instanceof data.SQPropertyVariationSourceExpr ? hierarchyRef.arg : void 0;
|
42676 | }
|
42677 | }
|
42678 | function areHierarchyLevelsOrdered(allLevels, firstExpr, secondExpr) {
|
42679 | if (!(firstExpr instanceof data.SQHierarchyLevelExpr && secondExpr instanceof data.SQHierarchyLevelExpr)) return !1;
|
42680 | var firstLevel = firstExpr, secondLevel = secondExpr;
|
42681 | if (!data.SQExpr.equals(firstLevel.arg, secondLevel.arg)) return !1;
|
42682 | var firstIndex = data.SQExprUtils.indexOfExpr(allLevels, firstLevel), secondIndex = data.SQExprUtils.indexOfExpr(allLevels, secondLevel);
|
42683 | return -1 !== firstIndex && -1 !== secondIndex && secondIndex > firstIndex;
|
42684 | }
|
42685 | function getInsertionIndex(allLevels, orderedSubsetOfLevels, expr) {
|
42686 | for (var insertIndex = 0; insertIndex < orderedSubsetOfLevels.length && areHierarchyLevelsOrdered(allLevels, orderedSubsetOfLevels[insertIndex], expr); ) insertIndex++;
|
42687 | return insertIndex;
|
42688 | }
|
42689 | function getHierarchyLevel(fieldExpr) {
|
42690 | return fieldExpr.hierarchyLevel || fieldExpr.hierarchyLevelAggr || fieldExpr.columnHierarchyLevelVariation && fieldExpr.columnHierarchyLevelVariation.level;
|
42691 | }
|
42692 | SQHierarchyExprUtils.getConceptualHierarchyLevelFromExpr = getConceptualHierarchyLevelFromExpr,
|
42693 | SQHierarchyExprUtils.getConceptualHierarchyLevel = getConceptualHierarchyLevel,
|
42694 | SQHierarchyExprUtils.getConceptualHierarchy = getConceptualHierarchy, SQHierarchyExprUtils.expandExpr = expandExpr,
|
42695 | SQHierarchyExprUtils.isHierarchyOrVariation = isHierarchyOrVariation, SQHierarchyExprUtils.getSourceVariationExpr = getSourceVariationExpr,
|
42696 | SQHierarchyExprUtils.getSourceHierarchy = getSourceHierarchy, SQHierarchyExprUtils.getHierarchySourceAsVariationSource = getHierarchySourceAsVariationSource,
|
42697 | SQHierarchyExprUtils.areHierarchyLevelsOrdered = areHierarchyLevelsOrdered, SQHierarchyExprUtils.getInsertionIndex = getInsertionIndex;
|
42698 | }(SQHierarchyExprUtils = data.SQHierarchyExprUtils || (data.SQHierarchyExprUtils = {}));
|
42699 | var SQExprHierarchyToHierarchyLevelConverter;
|
42700 | !function(SQExprHierarchyToHierarchyLevelConverter) {
|
42701 | function convert(sqExpr, federatedSchema) {
|
42702 | if (sqExpr instanceof data.SQHierarchyExpr) {
|
42703 | var hierarchyExpr = sqExpr, conceptualHierarchy = SQHierarchyExprUtils.getConceptualHierarchy(hierarchyExpr, federatedSchema);
|
42704 | if (conceptualHierarchy) return _.map(conceptualHierarchy.levels, function(hierarchyLevel) {
|
42705 | return data.SQExprBuilder.hierarchyLevel(sqExpr, hierarchyLevel.name);
|
42706 | });
|
42707 | }
|
42708 | }
|
42709 | SQExprHierarchyToHierarchyLevelConverter.convert = convert;
|
42710 | }(SQExprHierarchyToHierarchyLevelConverter = data.SQExprHierarchyToHierarchyLevelConverter || (data.SQExprHierarchyToHierarchyLevelConverter = {}));
|
42711 | var SQExprHierarchyLevelConverter;
|
42712 | !function(SQExprHierarchyLevelConverter) {
|
42713 | function expand(expr, schema) {
|
42714 | var exprs = [];
|
42715 | if (expr instanceof data.SQHierarchyLevelExpr) {
|
42716 | var fieldExpr = data.SQExprConverter.asFieldPattern(expr);
|
42717 | if (fieldExpr.hierarchyLevel) {
|
42718 | var fieldExprItem = data.FieldExprPattern.toFieldExprEntityItemPattern(fieldExpr), hierarchy = schema.schema(fieldExprItem.schema).findHierarchy(fieldExprItem.entity, fieldExpr.hierarchyLevel.name);
|
42719 | if (hierarchy) for (var hierarchyLevels = hierarchy.levels, _i = 0, hierarchyLevels_1 = hierarchyLevels; _i < hierarchyLevels_1.length; _i++) {
|
42720 | var hierarchyLevel = hierarchyLevels_1[_i];
|
42721 | if (hierarchyLevel.name === fieldExpr.hierarchyLevel.level) {
|
42722 | exprs.push(expr);
|
42723 | break;
|
42724 | }
|
42725 | exprs.push(data.SQExprBuilder.hierarchyLevel(data.SQExprBuilder.hierarchy(data.SQExprBuilder.entity(fieldExprItem.schema, fieldExprItem.entity, fieldExprItem.entityVar), hierarchy.name), hierarchyLevel.name));
|
42726 | }
|
42727 | }
|
42728 | }
|
42729 | return _.isEmpty(exprs) ? void 0 : exprs;
|
42730 | }
|
42731 | SQExprHierarchyLevelConverter.expand = expand;
|
42732 | }(SQExprHierarchyLevelConverter || (SQExprHierarchyLevelConverter = {}));
|
42733 | var SQExprVariationConverter;
|
42734 | !function(SQExprVariationConverter) {
|
42735 | function expand(expr, schema) {
|
42736 | var exprs, conceptualProperty = expr.getConceptualProperty(schema);
|
42737 | if (conceptualProperty) {
|
42738 | var column = conceptualProperty.column;
|
42739 | if (column && column.variations && column.variations.length > 0) {
|
42740 | var variations = column.variations, variation = variations[0], fieldExpr = data.SQExprConverter.asFieldPattern(expr), fieldExprItem = data.FieldExprPattern.toFieldExprEntityItemPattern(fieldExpr);
|
42741 | if (exprs = [], variation.defaultHierarchy) for (var hierarchyExpr = data.SQExprBuilder.hierarchy(data.SQExprBuilder.propertyVariationSource(data.SQExprBuilder.entity(fieldExprItem.schema, fieldExprItem.entity, fieldExprItem.entityVar), variation.name, conceptualProperty.name), variation.defaultHierarchy.name), _i = 0, _a = variation.defaultHierarchy.levels; _i < _a.length; _i++) {
|
42742 | var level = _a[_i];
|
42743 | exprs.push(data.SQExprBuilder.hierarchyLevel(hierarchyExpr, level.name));
|
42744 | }
|
42745 | }
|
42746 | }
|
42747 | return exprs;
|
42748 | }
|
42749 | SQExprVariationConverter.expand = expand;
|
42750 | }(SQExprVariationConverter || (SQExprVariationConverter = {}));
|
42751 | }(data = powerbi.data || (powerbi.data = {}));
|
42752 | }(powerbi || (powerbi = {}));
|
42753 | }, function(module, exports) {
|
42754 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
42755 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
42756 | !function(powerbi) {
|
42757 | var data;
|
42758 | !function(data) {
|
42759 | var SQExprGroupUtils;
|
42760 | !function(SQExprGroupUtils) {
|
42761 | function groupExprs(schema, exprs) {
|
42762 | for (var groups = [], i = 0, len = exprs.length; len > i; i++) {
|
42763 | var expr = exprs[i];
|
42764 | expr instanceof data.SQHierarchyLevelExpr ? addChildToGroup(schema, groups, expr, i) : groups.push({
|
42765 | expr: expr,
|
42766 | children: null,
|
42767 | selectQueryIndex: i
|
42768 | });
|
42769 | }
|
42770 | return groups;
|
42771 | }
|
42772 | function addChildToGroup(schema, groups, expr, selectQueryIndex) {
|
42773 | var shouldAddExpressionToNewGroup = !0, exprSource = data.SQHierarchyExprUtils.getSourceVariationExpr(expr) || data.SQHierarchyExprUtils.getSourceHierarchy(expr), lastGroup = _.last(groups);
|
42774 | if (lastGroup && lastGroup.children && data.SQExpr.equals(lastGroup.expr, exprSource)) {
|
42775 | var expandedExpr = data.SQHierarchyExprUtils.expandExpr(schema, expr.arg);
|
42776 | if (expandedExpr instanceof Array) {
|
42777 | var allHierarchyLevels = expandedExpr;
|
42778 | shouldAddExpressionToNewGroup = !data.SQHierarchyExprUtils.areHierarchyLevelsOrdered(allHierarchyLevels, _.last(lastGroup.children), expr);
|
42779 | }
|
42780 | }
|
42781 | shouldAddExpressionToNewGroup ? groups.push({
|
42782 | expr: exprSource,
|
42783 | children: [ expr ],
|
42784 | selectQueryIndex: selectQueryIndex
|
42785 | }) : lastGroup.children.push(expr);
|
42786 | }
|
42787 | SQExprGroupUtils.groupExprs = groupExprs;
|
42788 | }(SQExprGroupUtils = data.SQExprGroupUtils || (data.SQExprGroupUtils = {}));
|
42789 | }(data = powerbi.data || (powerbi.data = {}));
|
42790 | }(powerbi || (powerbi = {}));
|
42791 | }, function(module, exports) {
|
42792 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi, __extends = (window.powerbitests,
|
42793 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
42794 | function __() {
|
42795 | this.constructor = d;
|
42796 | }
|
42797 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
42798 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
42799 | });
|
42800 | !function(powerbi) {
|
42801 | var data;
|
42802 | !function(data) {
|
42803 | function defaultAggregateForDataType(type) {
|
42804 | return type.integer || type.numeric ? data.QueryAggregateFunction.Sum : data.QueryAggregateFunction.Count;
|
42805 | }
|
42806 | function defaultAggregateToQueryAggregateFunction(aggregate) {
|
42807 | switch (aggregate) {
|
42808 | case 6:
|
42809 | return data.QueryAggregateFunction.Avg;
|
42810 |
|
42811 | case 3:
|
42812 | return data.QueryAggregateFunction.CountNonNull;
|
42813 |
|
42814 | case 7:
|
42815 | return data.QueryAggregateFunction.Count;
|
42816 |
|
42817 | case 5:
|
42818 | return data.QueryAggregateFunction.Max;
|
42819 |
|
42820 | case 4:
|
42821 | return data.QueryAggregateFunction.Min;
|
42822 |
|
42823 | case 2:
|
42824 | return data.QueryAggregateFunction.Sum;
|
42825 |
|
42826 | default:
|
42827 | return;
|
42828 | }
|
42829 | }
|
42830 | var StringExtensions = jsCommon.StringExtensions, SQExpr = function() {
|
42831 | function SQExpr(kind) {
|
42832 | this._kind = kind;
|
42833 | }
|
42834 | return SQExpr.equals = function(x, y, ignoreCase) {
|
42835 | return SQExprEqualityVisitor.run(x, y, ignoreCase);
|
42836 | }, SQExpr.prototype.validate = function(schema, aggrUtils, errors) {
|
42837 | var validator = new SQExprValidationVisitor(schema, aggrUtils, errors);
|
42838 | return this.accept(validator), validator.errors;
|
42839 | }, SQExpr.prototype.accept = function(visitor, arg) {}, Object.defineProperty(SQExpr.prototype, "kind", {
|
42840 | get: function() {
|
42841 | return this._kind;
|
42842 | },
|
42843 | enumerable: !0,
|
42844 | configurable: !0
|
42845 | }), SQExpr.isArithmetic = function(expr) {
|
42846 | return 22 === expr.kind;
|
42847 | }, SQExpr.isColumn = function(expr) {
|
42848 | return 1 === expr.kind;
|
42849 | }, SQExpr.isConstant = function(expr) {
|
42850 | return 16 === expr.kind;
|
42851 | }, SQExpr.isEntity = function(expr) {
|
42852 | return 0 === expr.kind;
|
42853 | }, SQExpr.isHierarchy = function(expr) {
|
42854 | return 5 === expr.kind;
|
42855 | }, SQExpr.isHierarchyLevel = function(expr) {
|
42856 | return 6 === expr.kind;
|
42857 | }, SQExpr.isAggregation = function(expr) {
|
42858 | return 3 === expr.kind;
|
42859 | }, SQExpr.isMeasure = function(expr) {
|
42860 | return 2 === expr.kind;
|
42861 | }, SQExpr.isPercentile = function(expr) {
|
42862 | return 27 === expr.kind;
|
42863 | }, SQExpr.isSelectRef = function(expr) {
|
42864 | return 28 === expr.kind;
|
42865 | }, SQExpr.isScopedEval = function(expr) {
|
42866 | return 25 === expr.kind;
|
42867 | }, SQExpr.isWithRef = function(expr) {
|
42868 | return 26 === expr.kind;
|
42869 | }, SQExpr.isTransformTableRef = function(expr) {
|
42870 | return 29 === expr.kind;
|
42871 | }, SQExpr.isTransformOutputRoleRef = function(expr) {
|
42872 | return 30 === expr.kind;
|
42873 | }, SQExpr.isResourcePackageItem = function(expr) {
|
42874 | return 24 === expr.kind;
|
42875 | }, SQExpr.prototype.getMetadata = function(federatedSchema) {
|
42876 | var field = data.SQExprConverter.asFieldPattern(this);
|
42877 | if (field) return field.column || field.columnAggr || field.measure ? this.getMetadataForProperty(field, federatedSchema) : field.hierarchyLevel || field.hierarchyLevelAggr ? this.getMetadataForHierarchyLevel(field, federatedSchema) : field.columnHierarchyLevelVariation ? this.getMetadataForVariation(field, federatedSchema) : field.percentOfGrandTotal ? this.getMetadataForPercentOfGrandTotal() : SQExpr.getMetadataForEntity(field, federatedSchema);
|
42878 | }, SQExpr.prototype.getDefaultAggregate = function(federatedSchema, forceAggregation) {
|
42879 | void 0 === forceAggregation && (forceAggregation = !1);
|
42880 | var property = this.getConceptualProperty(federatedSchema) || this.getHierarchyLevelConceptualProperty(federatedSchema);
|
42881 | if (property) {
|
42882 | var aggregate;
|
42883 | if (property && 0 === property.kind) {
|
42884 | var propertyDefaultAggregate = property.column ? property.column.defaultAggregate : null;
|
42885 | (property.type.integer || property.type.numeric) && 1 !== propertyDefaultAggregate && (aggregate = defaultAggregateToQueryAggregateFunction(propertyDefaultAggregate),
|
42886 | void 0 === aggregate && (aggregate = defaultAggregateForDataType(property.type))),
|
42887 | void 0 === aggregate && forceAggregation && (aggregate = data.QueryAggregateFunction.CountNonNull);
|
42888 | }
|
42889 | return aggregate;
|
42890 | }
|
42891 | }, SQExpr.prototype.getKeyColumns = function(schema) {
|
42892 | var columnRefExpr = SQExprColumnRefInfoVisitor.getColumnRefSQExpr(schema, this);
|
42893 | if (columnRefExpr) {
|
42894 | var keySQExprs = [], keys = this.getPropertyKeys(schema);
|
42895 | if (keys && keys.length > 0) for (var i = 0, len = keys.length; len > i; i++) keySQExprs.push(SQExprBuilder.columnRef(columnRefExpr.source, keys[i].name)); else keySQExprs.push(columnRefExpr);
|
42896 | return keySQExprs;
|
42897 | }
|
42898 | }, SQExpr.prototype.hasGroupOnKeys = function(schema) {
|
42899 | var columnRefExpr = SQExprColumnRefInfoVisitor.getColumnRefSQExpr(schema, this);
|
42900 | if (columnRefExpr) {
|
42901 | var keys = this.getPropertyKeys(schema);
|
42902 | if (!keys || keys.length < 1) return !1;
|
42903 | if (keys.length > 1) return !0;
|
42904 | var keySqExpr = SQExprBuilder.columnRef(columnRefExpr.source, keys[0].name);
|
42905 | return !SQExpr.equals(keySqExpr, this);
|
42906 | }
|
42907 | }, SQExpr.prototype.getPropertyKeys = function(schema) {
|
42908 | var property = this.getConceptualProperty(schema) || this.getHierarchyLevelConceptualProperty(schema);
|
42909 | if (property) return property.column ? property.column.keys : void 0;
|
42910 | }, SQExpr.prototype.getConceptualProperty = function(federatedSchema) {
|
42911 | var field = data.SQExprConverter.asFieldPattern(this);
|
42912 | if (field) {
|
42913 | var fieldExprItem = data.FieldExprPattern.toFieldExprEntityItemPattern(field), propertyName = data.FieldExprPattern.getPropertyName(field);
|
42914 | return propertyName ? federatedSchema.schema(fieldExprItem.schema).findProperty(fieldExprItem.entity, propertyName) : void 0;
|
42915 | }
|
42916 | }, SQExpr.prototype.getTargetEntityForVariation = function(federatedSchema, variationName) {
|
42917 | var property = this.getConceptualProperty(federatedSchema);
|
42918 | if (property && property.column && !_.isEmpty(property.column.variations)) for (var variations = property.column.variations, _i = 0, variations_1 = variations; _i < variations_1.length; _i++) {
|
42919 | var variation = variations_1[_i];
|
42920 | if (variation.name === variationName) return variation.navigationProperty.targetEntity.name;
|
42921 | }
|
42922 | }, SQExpr.prototype.getTargetEntity = function(federatedSchema) {
|
42923 | return SQEntityExprInfoVisitor.getEntityExpr(federatedSchema, this);
|
42924 | }, SQExpr.prototype.getHierarchyLevelConceptualProperty = function(federatedSchema) {
|
42925 | var field = data.SQExprConverter.asFieldPattern(this);
|
42926 | if (field) {
|
42927 | var fieldExprHierachyLevel = field.hierarchyLevel || field.hierarchyLevelAggr;
|
42928 | if (fieldExprHierachyLevel) {
|
42929 | var fieldExprEntity = data.FieldExprPattern.toFieldExprEntityItemPattern(field), hierarchy = federatedSchema.schema(fieldExprEntity.schema).findHierarchy(fieldExprEntity.entity, fieldExprHierachyLevel.name);
|
42930 | if (hierarchy) {
|
42931 | var hierarchyLevel = hierarchy.levels.withName(fieldExprHierachyLevel.level);
|
42932 | if (hierarchyLevel) return hierarchyLevel.column;
|
42933 | }
|
42934 | }
|
42935 | }
|
42936 | }, SQExpr.prototype.getMetadataForVariation = function(field, federatedSchema) {
|
42937 | var columnHierarchyLevelVariation = field.columnHierarchyLevelVariation, fieldExprItem = data.FieldExprPattern.toFieldExprEntityItemPattern(field), sourceProperty = federatedSchema.schema(fieldExprItem.schema).findProperty(fieldExprItem.entity, columnHierarchyLevelVariation.source.name);
|
42938 | if (sourceProperty && sourceProperty.column && sourceProperty.column.variations) for (var _i = 0, _a = sourceProperty.column.variations; _i < _a.length; _i++) {
|
42939 | var variation = _a[_i];
|
42940 | if (variation.defaultHierarchy && variation.defaultHierarchy.levels) for (var _b = 0, _c = variation.defaultHierarchy.levels; _b < _c.length; _b++) {
|
42941 | var level = _c[_b];
|
42942 | if (level.name === columnHierarchyLevelVariation.level.level) {
|
42943 | var property = level.column;
|
42944 | return {
|
42945 | kind: 1 === property.kind ? 1 : 0,
|
42946 | type: property.type,
|
42947 | format: property.format,
|
42948 | idOnEntityKey: property.column ? property.column.idOnEntityKey : !1,
|
42949 | defaultAggregate: property.column ? property.column.defaultAggregate : null
|
42950 | };
|
42951 | }
|
42952 | }
|
42953 | }
|
42954 | }, SQExpr.prototype.getMetadataForHierarchyLevel = function(field, federatedSchema) {
|
42955 | var property = this.getHierarchyLevelConceptualProperty(federatedSchema);
|
42956 | if (property) return this.getPropertyMetadata(field, property);
|
42957 | }, SQExpr.prototype.getMetadataForPercentOfGrandTotal = function() {
|
42958 | return {
|
42959 | kind: 1,
|
42960 | format: "#,##0.00%",
|
42961 | type: powerbi.ValueType.fromExtendedType(powerbi.ExtendedType.Double)
|
42962 | };
|
42963 | }, SQExpr.prototype.getPropertyMetadata = function(field, property) {
|
42964 | var format = property.format, type = property.type, columnAggregate = field.columnAggr || field.hierarchyLevelAggr;
|
42965 | if (columnAggregate) switch (columnAggregate.aggregate) {
|
42966 | case data.QueryAggregateFunction.Count:
|
42967 | case data.QueryAggregateFunction.CountNonNull:
|
42968 | type = powerbi.ValueType.fromExtendedType(powerbi.ExtendedType.Integer), format = void 0;
|
42969 | break;
|
42970 |
|
42971 | case data.QueryAggregateFunction.Avg:
|
42972 | type.integer && (type = powerbi.ValueType.fromExtendedType(powerbi.ExtendedType.Double));
|
42973 | }
|
42974 | return {
|
42975 | kind: 1 === property.kind || columnAggregate && void 0 !== columnAggregate.aggregate ? 1 : 0,
|
42976 | type: type,
|
42977 | format: format,
|
42978 | idOnEntityKey: property.column ? property.column.idOnEntityKey : !1,
|
42979 | aggregate: columnAggregate ? columnAggregate.aggregate : void 0,
|
42980 | defaultAggregate: property.column ? property.column.defaultAggregate : null
|
42981 | };
|
42982 | }, SQExpr.prototype.getMetadataForProperty = function(field, federatedSchema) {
|
42983 | var property = this.getConceptualProperty(federatedSchema);
|
42984 | if (property) return this.getPropertyMetadata(field, property);
|
42985 | }, SQExpr.getMetadataForEntity = function(field, federatedSchema) {
|
42986 | var fieldExprItem = data.FieldExprPattern.toFieldExprEntityItemPattern(field), entity = federatedSchema.schema(fieldExprItem.schema).entities.withName(fieldExprItem.entity);
|
42987 | if (entity && field.entityAggr) switch (field.entityAggr.aggregate) {
|
42988 | case data.QueryAggregateFunction.Count:
|
42989 | case data.QueryAggregateFunction.CountNonNull:
|
42990 | return {
|
42991 | kind: 1,
|
42992 | type: powerbi.ValueType.fromExtendedType(powerbi.ExtendedType.Integer),
|
42993 | format: void 0,
|
42994 | idOnEntityKey: !1,
|
42995 | aggregate: field.entityAggr.aggregate
|
42996 | };
|
42997 | }
|
42998 | }, SQExpr;
|
42999 | }();
|
43000 | data.SQExpr = SQExpr, data.defaultAggregateForDataType = defaultAggregateForDataType,
|
43001 | data.defaultAggregateToQueryAggregateFunction = defaultAggregateToQueryAggregateFunction;
|
43002 | var SQEntityExpr = function(_super) {
|
43003 | function SQEntityExpr(schema, entity, variable) {
|
43004 | _super.call(this, 0), this.schema = schema, this.entity = entity, variable && (this.variable = variable);
|
43005 | }
|
43006 | return __extends(SQEntityExpr, _super), SQEntityExpr.prototype.accept = function(visitor, arg) {
|
43007 | return visitor.visitEntity(this, arg);
|
43008 | }, SQEntityExpr;
|
43009 | }(SQExpr);
|
43010 | data.SQEntityExpr = SQEntityExpr;
|
43011 | var SQArithmeticExpr = function(_super) {
|
43012 | function SQArithmeticExpr(left, right, operator) {
|
43013 | _super.call(this, 22), this.left = left, this.right = right, this.operator = operator;
|
43014 | }
|
43015 | return __extends(SQArithmeticExpr, _super), SQArithmeticExpr.prototype.accept = function(visitor, arg) {
|
43016 | return visitor.visitArithmetic(this, arg);
|
43017 | }, SQArithmeticExpr;
|
43018 | }(SQExpr);
|
43019 | data.SQArithmeticExpr = SQArithmeticExpr;
|
43020 | var SQScopedEvalExpr = function(_super) {
|
43021 | function SQScopedEvalExpr(expression, scope) {
|
43022 | _super.call(this, 25), this.expression = expression, this.scope = scope;
|
43023 | }
|
43024 | return __extends(SQScopedEvalExpr, _super), SQScopedEvalExpr.prototype.accept = function(visitor, arg) {
|
43025 | return visitor.visitScopedEval(this, arg);
|
43026 | }, SQScopedEvalExpr.prototype.getMetadata = function(federatedSchema) {
|
43027 | return this.expression.getMetadata(federatedSchema);
|
43028 | }, SQScopedEvalExpr;
|
43029 | }(SQExpr);
|
43030 | data.SQScopedEvalExpr = SQScopedEvalExpr;
|
43031 | var SQWithRefExpr = function(_super) {
|
43032 | function SQWithRefExpr(expressionName) {
|
43033 | _super.call(this, 26), this.expressionName = expressionName;
|
43034 | }
|
43035 | return __extends(SQWithRefExpr, _super), SQWithRefExpr.prototype.accept = function(visitor, arg) {
|
43036 | return visitor.visitWithRef(this, arg);
|
43037 | }, SQWithRefExpr;
|
43038 | }(SQExpr);
|
43039 | data.SQWithRefExpr = SQWithRefExpr;
|
43040 | var SQPropRefExpr = function(_super) {
|
43041 | function SQPropRefExpr(kind, source, ref) {
|
43042 | _super.call(this, kind), this.source = source, this.ref = ref;
|
43043 | }
|
43044 | return __extends(SQPropRefExpr, _super), SQPropRefExpr;
|
43045 | }(SQExpr);
|
43046 | data.SQPropRefExpr = SQPropRefExpr;
|
43047 | var SQColumnRefExpr = function(_super) {
|
43048 | function SQColumnRefExpr(source, ref) {
|
43049 | _super.call(this, 1, source, ref);
|
43050 | }
|
43051 | return __extends(SQColumnRefExpr, _super), SQColumnRefExpr.prototype.accept = function(visitor, arg) {
|
43052 | return visitor.visitColumnRef(this, arg);
|
43053 | }, SQColumnRefExpr;
|
43054 | }(SQPropRefExpr);
|
43055 | data.SQColumnRefExpr = SQColumnRefExpr;
|
43056 | var SQMeasureRefExpr = function(_super) {
|
43057 | function SQMeasureRefExpr(source, ref) {
|
43058 | _super.call(this, 2, source, ref);
|
43059 | }
|
43060 | return __extends(SQMeasureRefExpr, _super), SQMeasureRefExpr.prototype.accept = function(visitor, arg) {
|
43061 | return visitor.visitMeasureRef(this, arg);
|
43062 | }, SQMeasureRefExpr;
|
43063 | }(SQPropRefExpr);
|
43064 | data.SQMeasureRefExpr = SQMeasureRefExpr;
|
43065 | var SQAggregationExpr = function(_super) {
|
43066 | function SQAggregationExpr(arg, func) {
|
43067 | _super.call(this, 3), this.arg = arg, this.func = func;
|
43068 | }
|
43069 | return __extends(SQAggregationExpr, _super), SQAggregationExpr.prototype.accept = function(visitor, arg) {
|
43070 | return visitor.visitAggr(this, arg);
|
43071 | }, SQAggregationExpr;
|
43072 | }(SQExpr);
|
43073 | data.SQAggregationExpr = SQAggregationExpr;
|
43074 | var SQPercentileExpr = function(_super) {
|
43075 | function SQPercentileExpr(arg, k, exclusive) {
|
43076 | _super.call(this, 27), this.arg = arg, this.k = k, this.exclusive = exclusive;
|
43077 | }
|
43078 | return __extends(SQPercentileExpr, _super), SQPercentileExpr.prototype.getMetadata = function(federatedSchema) {
|
43079 | var argMetadata = this.arg.getMetadata(federatedSchema);
|
43080 | return argMetadata ? {
|
43081 | kind: 1,
|
43082 | type: argMetadata.type
|
43083 | } : void 0;
|
43084 | }, SQPercentileExpr.prototype.accept = function(visitor, arg) {
|
43085 | return visitor.visitPercentile(this, arg);
|
43086 | }, SQPercentileExpr;
|
43087 | }(SQExpr);
|
43088 | data.SQPercentileExpr = SQPercentileExpr;
|
43089 | var SQPropertyVariationSourceExpr = function(_super) {
|
43090 | function SQPropertyVariationSourceExpr(arg, name, property) {
|
43091 | _super.call(this, 4), this.arg = arg, this.name = name, this.property = property;
|
43092 | }
|
43093 | return __extends(SQPropertyVariationSourceExpr, _super), SQPropertyVariationSourceExpr.prototype.accept = function(visitor, arg) {
|
43094 | return visitor.visitPropertyVariationSource(this, arg);
|
43095 | }, SQPropertyVariationSourceExpr;
|
43096 | }(SQExpr);
|
43097 | data.SQPropertyVariationSourceExpr = SQPropertyVariationSourceExpr;
|
43098 | var SQHierarchyExpr = function(_super) {
|
43099 | function SQHierarchyExpr(arg, hierarchy) {
|
43100 | _super.call(this, 5), this.arg = arg, this.hierarchy = hierarchy;
|
43101 | }
|
43102 | return __extends(SQHierarchyExpr, _super), SQHierarchyExpr.prototype.accept = function(visitor, arg) {
|
43103 | return visitor.visitHierarchy(this, arg);
|
43104 | }, SQHierarchyExpr;
|
43105 | }(SQExpr);
|
43106 | data.SQHierarchyExpr = SQHierarchyExpr;
|
43107 | var SQHierarchyLevelExpr = function(_super) {
|
43108 | function SQHierarchyLevelExpr(arg, level) {
|
43109 | _super.call(this, 6), this.arg = arg, this.level = level;
|
43110 | }
|
43111 | return __extends(SQHierarchyLevelExpr, _super), SQHierarchyLevelExpr.prototype.accept = function(visitor, arg) {
|
43112 | return visitor.visitHierarchyLevel(this, arg);
|
43113 | }, SQHierarchyLevelExpr;
|
43114 | }(SQExpr);
|
43115 | data.SQHierarchyLevelExpr = SQHierarchyLevelExpr;
|
43116 | var SQSelectRefExpr = function(_super) {
|
43117 | function SQSelectRefExpr(expressionName) {
|
43118 | _super.call(this, 28), this.expressionName = expressionName;
|
43119 | }
|
43120 | return __extends(SQSelectRefExpr, _super), SQSelectRefExpr.prototype.accept = function(visitor, arg) {
|
43121 | return visitor.visitSelectRef(this, arg);
|
43122 | }, SQSelectRefExpr;
|
43123 | }(SQExpr);
|
43124 | data.SQSelectRefExpr = SQSelectRefExpr;
|
43125 | var SQAndExpr = function(_super) {
|
43126 | function SQAndExpr(left, right) {
|
43127 | _super.call(this, 7), this.left = left, this.right = right;
|
43128 | }
|
43129 | return __extends(SQAndExpr, _super), SQAndExpr.prototype.accept = function(visitor, arg) {
|
43130 | return visitor.visitAnd(this, arg);
|
43131 | }, SQAndExpr;
|
43132 | }(SQExpr);
|
43133 | data.SQAndExpr = SQAndExpr;
|
43134 | var SQBetweenExpr = function(_super) {
|
43135 | function SQBetweenExpr(arg, lower, upper) {
|
43136 | _super.call(this, 8), this.arg = arg, this.lower = lower, this.upper = upper;
|
43137 | }
|
43138 | return __extends(SQBetweenExpr, _super), SQBetweenExpr.prototype.accept = function(visitor, arg) {
|
43139 | return visitor.visitBetween(this, arg);
|
43140 | }, SQBetweenExpr;
|
43141 | }(SQExpr);
|
43142 | data.SQBetweenExpr = SQBetweenExpr;
|
43143 | var SQInExpr = function(_super) {
|
43144 | function SQInExpr(args, values) {
|
43145 | _super.call(this, 9), this.args = args, this.values = values;
|
43146 | }
|
43147 | return __extends(SQInExpr, _super), SQInExpr.prototype.accept = function(visitor, arg) {
|
43148 | return visitor.visitIn(this, arg);
|
43149 | }, SQInExpr;
|
43150 | }(SQExpr);
|
43151 | data.SQInExpr = SQInExpr;
|
43152 | var SQOrExpr = function(_super) {
|
43153 | function SQOrExpr(left, right) {
|
43154 | _super.call(this, 10), this.left = left, this.right = right;
|
43155 | }
|
43156 | return __extends(SQOrExpr, _super), SQOrExpr.prototype.accept = function(visitor, arg) {
|
43157 | return visitor.visitOr(this, arg);
|
43158 | }, SQOrExpr;
|
43159 | }(SQExpr);
|
43160 | data.SQOrExpr = SQOrExpr;
|
43161 | var SQCompareExpr = function(_super) {
|
43162 | function SQCompareExpr(comparison, left, right) {
|
43163 | _super.call(this, 12), this.comparison = comparison, this.left = left, this.right = right;
|
43164 | }
|
43165 | return __extends(SQCompareExpr, _super), SQCompareExpr.prototype.accept = function(visitor, arg) {
|
43166 | return visitor.visitCompare(this, arg);
|
43167 | }, SQCompareExpr;
|
43168 | }(SQExpr);
|
43169 | data.SQCompareExpr = SQCompareExpr;
|
43170 | var SQContainsExpr = function(_super) {
|
43171 | function SQContainsExpr(left, right) {
|
43172 | _super.call(this, 11), this.left = left, this.right = right;
|
43173 | }
|
43174 | return __extends(SQContainsExpr, _super), SQContainsExpr.prototype.accept = function(visitor, arg) {
|
43175 | return visitor.visitContains(this, arg);
|
43176 | }, SQContainsExpr;
|
43177 | }(SQExpr);
|
43178 | data.SQContainsExpr = SQContainsExpr;
|
43179 | var SQStartsWithExpr = function(_super) {
|
43180 | function SQStartsWithExpr(left, right) {
|
43181 | _super.call(this, 13), this.left = left, this.right = right;
|
43182 | }
|
43183 | return __extends(SQStartsWithExpr, _super), SQStartsWithExpr.prototype.accept = function(visitor, arg) {
|
43184 | return visitor.visitStartsWith(this, arg);
|
43185 | }, SQStartsWithExpr;
|
43186 | }(SQExpr);
|
43187 | data.SQStartsWithExpr = SQStartsWithExpr;
|
43188 | var SQExistsExpr = function(_super) {
|
43189 | function SQExistsExpr(arg) {
|
43190 | _super.call(this, 14), this.arg = arg;
|
43191 | }
|
43192 | return __extends(SQExistsExpr, _super), SQExistsExpr.prototype.accept = function(visitor, arg) {
|
43193 | return visitor.visitExists(this, arg);
|
43194 | }, SQExistsExpr;
|
43195 | }(SQExpr);
|
43196 | data.SQExistsExpr = SQExistsExpr;
|
43197 | var SQNotExpr = function(_super) {
|
43198 | function SQNotExpr(arg) {
|
43199 | _super.call(this, 15), this.arg = arg;
|
43200 | }
|
43201 | return __extends(SQNotExpr, _super), SQNotExpr.prototype.accept = function(visitor, arg) {
|
43202 | return visitor.visitNot(this, arg);
|
43203 | }, SQNotExpr;
|
43204 | }(SQExpr);
|
43205 | data.SQNotExpr = SQNotExpr;
|
43206 | var SQConstantExpr = function(_super) {
|
43207 | function SQConstantExpr(type, value, valueEncoded) {
|
43208 | _super.call(this, 16), this.type = type, this.value = value, this.valueEncoded = valueEncoded;
|
43209 | }
|
43210 | return __extends(SQConstantExpr, _super), SQConstantExpr.prototype.accept = function(visitor, arg) {
|
43211 | return visitor.visitConstant(this, arg);
|
43212 | }, SQConstantExpr.prototype.getMetadata = function(federatedSchema) {
|
43213 | return {
|
43214 | kind: 1,
|
43215 | type: this.type
|
43216 | };
|
43217 | }, SQConstantExpr;
|
43218 | }(SQExpr);
|
43219 | data.SQConstantExpr = SQConstantExpr;
|
43220 | var SQDateSpanExpr = function(_super) {
|
43221 | function SQDateSpanExpr(unit, arg) {
|
43222 | _super.call(this, 17), this.unit = unit, this.arg = arg;
|
43223 | }
|
43224 | return __extends(SQDateSpanExpr, _super), SQDateSpanExpr.prototype.accept = function(visitor, arg) {
|
43225 | return visitor.visitDateSpan(this, arg);
|
43226 | }, SQDateSpanExpr;
|
43227 | }(SQExpr);
|
43228 | data.SQDateSpanExpr = SQDateSpanExpr;
|
43229 | var SQDateAddExpr = function(_super) {
|
43230 | function SQDateAddExpr(unit, amount, arg) {
|
43231 | _super.call(this, 18), this.unit = unit, this.arg = arg, this.amount = amount;
|
43232 | }
|
43233 | return __extends(SQDateAddExpr, _super), SQDateAddExpr.prototype.accept = function(visitor, arg) {
|
43234 | return visitor.visitDateAdd(this, arg);
|
43235 | }, SQDateAddExpr;
|
43236 | }(SQExpr);
|
43237 | data.SQDateAddExpr = SQDateAddExpr;
|
43238 | var SQNowExpr = function(_super) {
|
43239 | function SQNowExpr() {
|
43240 | _super.call(this, 19);
|
43241 | }
|
43242 | return __extends(SQNowExpr, _super), SQNowExpr.prototype.accept = function(visitor, arg) {
|
43243 | return visitor.visitNow(this, arg);
|
43244 | }, SQNowExpr;
|
43245 | }(SQExpr);
|
43246 | data.SQNowExpr = SQNowExpr;
|
43247 | var SQDefaultValueExpr = function(_super) {
|
43248 | function SQDefaultValueExpr() {
|
43249 | _super.call(this, 21);
|
43250 | }
|
43251 | return __extends(SQDefaultValueExpr, _super), SQDefaultValueExpr.prototype.accept = function(visitor, arg) {
|
43252 | return visitor.visitDefaultValue(this, arg);
|
43253 | }, SQDefaultValueExpr;
|
43254 | }(SQExpr);
|
43255 | data.SQDefaultValueExpr = SQDefaultValueExpr;
|
43256 | var SQAnyValueExpr = function(_super) {
|
43257 | function SQAnyValueExpr() {
|
43258 | _super.call(this, 20);
|
43259 | }
|
43260 | return __extends(SQAnyValueExpr, _super), SQAnyValueExpr.prototype.accept = function(visitor, arg) {
|
43261 | return visitor.visitAnyValue(this, arg);
|
43262 | }, SQAnyValueExpr;
|
43263 | }(SQExpr);
|
43264 | data.SQAnyValueExpr = SQAnyValueExpr;
|
43265 | var SQFillRuleExpr = function(_super) {
|
43266 | function SQFillRuleExpr(input, fillRule) {
|
43267 | _super.call(this, 23), this.input = input, this.rule = fillRule;
|
43268 | }
|
43269 | return __extends(SQFillRuleExpr, _super), SQFillRuleExpr.prototype.accept = function(visitor, arg) {
|
43270 | return visitor.visitFillRule(this, arg);
|
43271 | }, SQFillRuleExpr;
|
43272 | }(SQExpr);
|
43273 | data.SQFillRuleExpr = SQFillRuleExpr;
|
43274 | var SQResourcePackageItemExpr = function(_super) {
|
43275 | function SQResourcePackageItemExpr(packageName, packageType, itemName) {
|
43276 | _super.call(this, 24), this.packageName = packageName, this.packageType = packageType,
|
43277 | this.itemName = itemName;
|
43278 | }
|
43279 | return __extends(SQResourcePackageItemExpr, _super), SQResourcePackageItemExpr.prototype.accept = function(visitor, arg) {
|
43280 | return visitor.visitResourcePackageItem(this, arg);
|
43281 | }, SQResourcePackageItemExpr;
|
43282 | }(SQExpr);
|
43283 | data.SQResourcePackageItemExpr = SQResourcePackageItemExpr;
|
43284 | var SQTransformTableRefExpr = function(_super) {
|
43285 | function SQTransformTableRefExpr(source) {
|
43286 | _super.call(this, 29), this.source = source;
|
43287 | }
|
43288 | return __extends(SQTransformTableRefExpr, _super), SQTransformTableRefExpr.prototype.accept = function(visitor, arg) {
|
43289 | return visitor.visitTransformTableRef(this, arg);
|
43290 | }, SQTransformTableRefExpr;
|
43291 | }(SQExpr);
|
43292 | data.SQTransformTableRefExpr = SQTransformTableRefExpr;
|
43293 | var SQTransformOutputRoleRefExpr = function(_super) {
|
43294 | function SQTransformOutputRoleRefExpr(role, transform) {
|
43295 | _super.call(this, 30), this.role = role, transform && (this.transform = transform);
|
43296 | }
|
43297 | return __extends(SQTransformOutputRoleRefExpr, _super), SQTransformOutputRoleRefExpr.prototype.accept = function(visitor, arg) {
|
43298 | return visitor.visitTransformOutputRoleRef(this, arg);
|
43299 | }, SQTransformOutputRoleRefExpr;
|
43300 | }(SQExpr);
|
43301 | data.SQTransformOutputRoleRefExpr = SQTransformOutputRoleRefExpr;
|
43302 | var SQExprBuilder;
|
43303 | !function(SQExprBuilder) {
|
43304 | function entity(schema, entity, variable) {
|
43305 | return new SQEntityExpr(schema, entity, variable);
|
43306 | }
|
43307 | function columnRef(source, prop) {
|
43308 | return new SQColumnRefExpr(source, prop);
|
43309 | }
|
43310 | function measureRef(source, prop) {
|
43311 | return new SQMeasureRefExpr(source, prop);
|
43312 | }
|
43313 | function aggregate(source, aggregate) {
|
43314 | return new SQAggregationExpr(source, aggregate);
|
43315 | }
|
43316 | function selectRef(expressionName) {
|
43317 | return new SQSelectRefExpr(expressionName);
|
43318 | }
|
43319 | function percentile(source, k, exclusive) {
|
43320 | return new SQPercentileExpr(source, k, exclusive);
|
43321 | }
|
43322 | function arithmetic(left, right, operator) {
|
43323 | return new SQArithmeticExpr(left, right, operator);
|
43324 | }
|
43325 | function scopedEval(expression, scope) {
|
43326 | return new SQScopedEvalExpr(expression, scope);
|
43327 | }
|
43328 | function withRef(expressionName) {
|
43329 | return new SQWithRefExpr(expressionName);
|
43330 | }
|
43331 | function hierarchy(source, hierarchy) {
|
43332 | return new SQHierarchyExpr(source, hierarchy);
|
43333 | }
|
43334 | function propertyVariationSource(source, name, property) {
|
43335 | return new SQPropertyVariationSourceExpr(source, name, property);
|
43336 | }
|
43337 | function hierarchyLevel(source, level) {
|
43338 | return new SQHierarchyLevelExpr(source, level);
|
43339 | }
|
43340 | function transformTableRef(source) {
|
43341 | return new SQTransformTableRefExpr(source);
|
43342 | }
|
43343 | function transformOutputRoleRef(role, transform) {
|
43344 | return new SQTransformOutputRoleRefExpr(role, transform);
|
43345 | }
|
43346 | function and(left, right) {
|
43347 | return left ? right ? new SQAndExpr(left, right) : left : right;
|
43348 | }
|
43349 | function between(arg, lower, upper) {
|
43350 | return new SQBetweenExpr(arg, lower, upper);
|
43351 | }
|
43352 | function inExpr(args, values) {
|
43353 | return new SQInExpr(args, values);
|
43354 | }
|
43355 | function or(left, right) {
|
43356 | if (!left) return right;
|
43357 | if (!right) return left;
|
43358 | if (left instanceof SQInExpr && right instanceof SQInExpr) {
|
43359 | var inExpr_1 = tryUseInExprs(left, right);
|
43360 | if (inExpr_1) return inExpr_1;
|
43361 | }
|
43362 | return new SQOrExpr(left, right);
|
43363 | }
|
43364 | function tryUseInExprs(left, right) {
|
43365 | if (left.args && right.args) {
|
43366 | var leftArgLen = left.args.length, rightArgLen = right.args.length;
|
43367 | if (leftArgLen === rightArgLen) {
|
43368 | for (var i = 0; leftArgLen > i; ++i) if (!SQExpr.equals(left.args[i], right.args[i])) return;
|
43369 | var combinedValues = left.values.concat(right.values);
|
43370 | return SQExprBuilder.inExpr(left.args, combinedValues);
|
43371 | }
|
43372 | }
|
43373 | }
|
43374 | function compare(kind, left, right) {
|
43375 | return new SQCompareExpr(kind, left, right);
|
43376 | }
|
43377 | function contains(left, right) {
|
43378 | return new SQContainsExpr(left, right);
|
43379 | }
|
43380 | function exists(arg) {
|
43381 | return new SQExistsExpr(arg);
|
43382 | }
|
43383 | function equal(left, right) {
|
43384 | return compare(data.QueryComparisonKind.Equal, left, right);
|
43385 | }
|
43386 | function not(arg) {
|
43387 | return new SQNotExpr(arg);
|
43388 | }
|
43389 | function startsWith(left, right) {
|
43390 | return new SQStartsWithExpr(left, right);
|
43391 | }
|
43392 | function nullConstant() {
|
43393 | return new SQConstantExpr(powerbi.ValueType.fromExtendedType(powerbi.ExtendedType.Null), null, data.PrimitiveValueEncoding.nullEncoding());
|
43394 | }
|
43395 | function now() {
|
43396 | return new SQNowExpr();
|
43397 | }
|
43398 | function defaultValue() {
|
43399 | return new SQDefaultValueExpr();
|
43400 | }
|
43401 | function anyValue() {
|
43402 | return new SQAnyValueExpr();
|
43403 | }
|
43404 | function boolean(value) {
|
43405 | return new SQConstantExpr(powerbi.ValueType.fromExtendedType(powerbi.ExtendedType.Boolean), value, data.PrimitiveValueEncoding["boolean"](value));
|
43406 | }
|
43407 | function dateAdd(unit, amount, arg) {
|
43408 | return new SQDateAddExpr(unit, amount, arg);
|
43409 | }
|
43410 | function dateTime(value, valueEncoded) {
|
43411 | return void 0 === valueEncoded && (valueEncoded = data.PrimitiveValueEncoding.dateTime(value)),
|
43412 | new SQConstantExpr(powerbi.ValueType.fromExtendedType(powerbi.ExtendedType.DateTime), value, valueEncoded);
|
43413 | }
|
43414 | function dateSpan(unit, arg) {
|
43415 | return new SQDateSpanExpr(unit, arg);
|
43416 | }
|
43417 | function decimal(value, valueEncoded) {
|
43418 | return void 0 === valueEncoded && (valueEncoded = data.PrimitiveValueEncoding.decimal(value)),
|
43419 | new SQConstantExpr(powerbi.ValueType.fromExtendedType(powerbi.ExtendedType.Decimal), value, valueEncoded);
|
43420 | }
|
43421 | function double(value, valueEncoded) {
|
43422 | return void 0 === valueEncoded && (valueEncoded = data.PrimitiveValueEncoding["double"](value)),
|
43423 | new SQConstantExpr(powerbi.ValueType.fromExtendedType(powerbi.ExtendedType.Double), value, valueEncoded);
|
43424 | }
|
43425 | function integer(value, valueEncoded) {
|
43426 | return void 0 === valueEncoded && (valueEncoded = data.PrimitiveValueEncoding.integer(value)),
|
43427 | new SQConstantExpr(powerbi.ValueType.fromExtendedType(powerbi.ExtendedType.Integer), value, valueEncoded);
|
43428 | }
|
43429 | function text(value, valueEncoded) {
|
43430 | return new SQConstantExpr(powerbi.ValueType.fromExtendedType(powerbi.ExtendedType.Text), value, valueEncoded || data.PrimitiveValueEncoding.text(value));
|
43431 | }
|
43432 | function typedConstant(value, type) {
|
43433 | return null == value ? nullConstant() : _.isBoolean(value) ? boolean(value) : _.isString(value) ? text(value) : _.isNumber(value) ? type.integer && powerbi.Double.isInteger(value) ? integer(value) : double(value) : value instanceof Date ? dateTime(value) : void 0;
|
43434 | }
|
43435 | function setAggregate(expr, aggregate) {
|
43436 | return FieldExprChangeAggregateRewriter.rewrite(expr, aggregate);
|
43437 | }
|
43438 | function removeAggregate(expr) {
|
43439 | return FieldExprRemoveAggregateRewriter.rewrite(expr);
|
43440 | }
|
43441 | function setPercentOfGrandTotal(expr) {
|
43442 | return SQExprSetPercentOfGrandTotalRewriter.rewrite(expr);
|
43443 | }
|
43444 | function removePercentOfGrandTotal(expr) {
|
43445 | return SQExprRemovePercentOfGrandTotalRewriter.rewrite(expr);
|
43446 | }
|
43447 | function removeEntityVariables(expr) {
|
43448 | return SQExprRemoveEntityVariablesRewriter.rewrite(expr);
|
43449 | }
|
43450 | function fillRule(expr, rule) {
|
43451 | return new SQFillRuleExpr(expr, rule);
|
43452 | }
|
43453 | function resourcePackageItem(packageName, packageType, itemName) {
|
43454 | return new SQResourcePackageItemExpr(packageName, packageType, itemName);
|
43455 | }
|
43456 | SQExprBuilder.entity = entity, SQExprBuilder.columnRef = columnRef, SQExprBuilder.measureRef = measureRef,
|
43457 | SQExprBuilder.aggregate = aggregate, SQExprBuilder.selectRef = selectRef, SQExprBuilder.percentile = percentile,
|
43458 | SQExprBuilder.arithmetic = arithmetic, SQExprBuilder.scopedEval = scopedEval, SQExprBuilder.withRef = withRef,
|
43459 | SQExprBuilder.hierarchy = hierarchy, SQExprBuilder.propertyVariationSource = propertyVariationSource,
|
43460 | SQExprBuilder.hierarchyLevel = hierarchyLevel, SQExprBuilder.transformTableRef = transformTableRef,
|
43461 | SQExprBuilder.transformOutputRoleRef = transformOutputRoleRef, SQExprBuilder.and = and,
|
43462 | SQExprBuilder.between = between, SQExprBuilder.inExpr = inExpr, SQExprBuilder.or = or,
|
43463 | SQExprBuilder.compare = compare, SQExprBuilder.contains = contains, SQExprBuilder.exists = exists,
|
43464 | SQExprBuilder.equal = equal, SQExprBuilder.not = not, SQExprBuilder.startsWith = startsWith,
|
43465 | SQExprBuilder.nullConstant = nullConstant, SQExprBuilder.now = now, SQExprBuilder.defaultValue = defaultValue,
|
43466 | SQExprBuilder.anyValue = anyValue, SQExprBuilder["boolean"] = boolean, SQExprBuilder.dateAdd = dateAdd,
|
43467 | SQExprBuilder.dateTime = dateTime, SQExprBuilder.dateSpan = dateSpan, SQExprBuilder.decimal = decimal,
|
43468 | SQExprBuilder["double"] = double, SQExprBuilder.integer = integer, SQExprBuilder.text = text,
|
43469 | SQExprBuilder.typedConstant = typedConstant, SQExprBuilder.setAggregate = setAggregate,
|
43470 | SQExprBuilder.removeAggregate = removeAggregate, SQExprBuilder.setPercentOfGrandTotal = setPercentOfGrandTotal,
|
43471 | SQExprBuilder.removePercentOfGrandTotal = removePercentOfGrandTotal, SQExprBuilder.removeEntityVariables = removeEntityVariables,
|
43472 | SQExprBuilder.fillRule = fillRule, SQExprBuilder.resourcePackageItem = resourcePackageItem;
|
43473 | }(SQExprBuilder = data.SQExprBuilder || (data.SQExprBuilder = {}));
|
43474 | var SQExprInfo;
|
43475 | !function(SQExprInfo) {
|
43476 | function getAggregate(expr) {
|
43477 | return SQExprAggregateInfoVisitor.getAggregate(expr);
|
43478 | }
|
43479 | SQExprInfo.getAggregate = getAggregate;
|
43480 | }(SQExprInfo = data.SQExprInfo || (data.SQExprInfo = {}));
|
43481 | var SQExprEqualityVisitor = function() {
|
43482 | function SQExprEqualityVisitor(ignoreCase) {
|
43483 | this.ignoreCase = ignoreCase;
|
43484 | }
|
43485 | return SQExprEqualityVisitor.run = function(x, y, ignoreCase) {
|
43486 | return x = x || null, y = y || null, x === y ? !0 : !x != !y ? !1 : ignoreCase ? x.accept(SQExprEqualityVisitor.ignoreCaseInstance, y) : x.accept(SQExprEqualityVisitor.instance, y);
|
43487 | }, SQExprEqualityVisitor.prototype.visitColumnRef = function(expr, comparand) {
|
43488 | return comparand instanceof SQColumnRefExpr && expr.ref === comparand.ref && this.equals(expr.source, comparand.source);
|
43489 | }, SQExprEqualityVisitor.prototype.visitMeasureRef = function(expr, comparand) {
|
43490 | return comparand instanceof SQMeasureRefExpr && expr.ref === comparand.ref && this.equals(expr.source, comparand.source);
|
43491 | }, SQExprEqualityVisitor.prototype.visitAggr = function(expr, comparand) {
|
43492 | return comparand instanceof SQAggregationExpr && expr.func === comparand.func && this.equals(expr.arg, comparand.arg);
|
43493 | }, SQExprEqualityVisitor.prototype.visitPercentile = function(expr, comparand) {
|
43494 | return comparand instanceof SQPercentileExpr && expr.exclusive === comparand.exclusive && expr.k === comparand.k && this.equals(expr.arg, comparand.arg);
|
43495 | }, SQExprEqualityVisitor.prototype.visitHierarchy = function(expr, comparand) {
|
43496 | return comparand instanceof SQHierarchyExpr && expr.hierarchy === comparand.hierarchy && this.equals(expr.arg, comparand.arg);
|
43497 | }, SQExprEqualityVisitor.prototype.visitHierarchyLevel = function(expr, comparand) {
|
43498 | return comparand instanceof SQHierarchyLevelExpr && expr.level === comparand.level && this.equals(expr.arg, comparand.arg);
|
43499 | }, SQExprEqualityVisitor.prototype.visitPropertyVariationSource = function(expr, comparand) {
|
43500 | return comparand instanceof SQPropertyVariationSourceExpr && expr.name === comparand.name && expr.property === comparand.property && this.equals(expr.arg, comparand.arg);
|
43501 | }, SQExprEqualityVisitor.prototype.visitSelectRef = function(expr, comparand) {
|
43502 | return comparand instanceof SQSelectRefExpr && expr.expressionName === comparand.expressionName;
|
43503 | }, SQExprEqualityVisitor.prototype.visitBetween = function(expr, comparand) {
|
43504 | return comparand instanceof SQBetweenExpr && this.equals(expr.arg, comparand.arg) && this.equals(expr.lower, comparand.lower) && this.equals(expr.upper, comparand.upper);
|
43505 | }, SQExprEqualityVisitor.prototype.visitIn = function(expr, comparand) {
|
43506 | if (!(comparand instanceof SQInExpr && this.equalsAll(expr.args, comparand.args))) return !1;
|
43507 | var values = expr.values, compareValues = comparand.values;
|
43508 | if (values.length !== compareValues.length) return !1;
|
43509 | for (var i = 0, len = values.length; len > i; i++) if (!this.equalsAll(values[i], compareValues[i])) return !1;
|
43510 | return !0;
|
43511 | }, SQExprEqualityVisitor.prototype.visitEntity = function(expr, comparand) {
|
43512 | return comparand instanceof SQEntityExpr && expr.schema === comparand.schema && expr.entity === comparand.entity && this.optionalEqual(expr.variable, comparand.variable);
|
43513 | }, SQExprEqualityVisitor.prototype.visitAnd = function(expr, comparand) {
|
43514 | return comparand instanceof SQAndExpr && this.equals(expr.left, comparand.left) && this.equals(expr.right, comparand.right);
|
43515 | }, SQExprEqualityVisitor.prototype.visitOr = function(expr, comparand) {
|
43516 | return comparand instanceof SQOrExpr && this.equals(expr.left, comparand.left) && this.equals(expr.right, comparand.right);
|
43517 | }, SQExprEqualityVisitor.prototype.visitCompare = function(expr, comparand) {
|
43518 | return comparand instanceof SQCompareExpr && expr.comparison === comparand.comparison && this.equals(expr.left, comparand.left) && this.equals(expr.right, comparand.right);
|
43519 | }, SQExprEqualityVisitor.prototype.visitContains = function(expr, comparand) {
|
43520 | return comparand instanceof SQContainsExpr && this.equals(expr.left, comparand.left) && this.equals(expr.right, comparand.right);
|
43521 | }, SQExprEqualityVisitor.prototype.visitDateSpan = function(expr, comparand) {
|
43522 | return comparand instanceof SQDateSpanExpr && expr.unit === comparand.unit && this.equals(expr.arg, comparand.arg);
|
43523 | }, SQExprEqualityVisitor.prototype.visitDateAdd = function(expr, comparand) {
|
43524 | return comparand instanceof SQDateAddExpr && expr.unit === comparand.unit && expr.amount === comparand.amount && this.equals(expr.arg, comparand.arg);
|
43525 | }, SQExprEqualityVisitor.prototype.visitExists = function(expr, comparand) {
|
43526 | return comparand instanceof SQExistsExpr && this.equals(expr.arg, comparand.arg);
|
43527 | }, SQExprEqualityVisitor.prototype.visitNot = function(expr, comparand) {
|
43528 | return comparand instanceof SQNotExpr && this.equals(expr.arg, comparand.arg);
|
43529 | }, SQExprEqualityVisitor.prototype.visitNow = function(expr, comparand) {
|
43530 | return comparand instanceof SQNowExpr;
|
43531 | }, SQExprEqualityVisitor.prototype.visitDefaultValue = function(expr, comparand) {
|
43532 | return comparand instanceof SQDefaultValueExpr;
|
43533 | }, SQExprEqualityVisitor.prototype.visitAnyValue = function(expr, comparand) {
|
43534 | return comparand instanceof SQAnyValueExpr;
|
43535 | }, SQExprEqualityVisitor.prototype.visitResourcePackageItem = function(expr, comparand) {
|
43536 | return comparand instanceof SQResourcePackageItemExpr && expr.packageName === comparand.packageName && expr.packageType === comparand.packageType && expr.itemName === comparand.itemName;
|
43537 | }, SQExprEqualityVisitor.prototype.visitStartsWith = function(expr, comparand) {
|
43538 | return comparand instanceof SQStartsWithExpr && this.equals(expr.left, comparand.left) && this.equals(expr.right, comparand.right);
|
43539 | }, SQExprEqualityVisitor.prototype.visitConstant = function(expr, comparand) {
|
43540 | return comparand instanceof SQConstantExpr && expr.type === comparand.type ? expr.type.text && this.ignoreCase ? StringExtensions.equalIgnoreCase(expr.valueEncoded, comparand.valueEncoded) : expr.valueEncoded === comparand.valueEncoded : !1;
|
43541 | }, SQExprEqualityVisitor.prototype.visitFillRule = function(expr, comparand) {
|
43542 | if (comparand instanceof SQFillRuleExpr && this.equals(expr.input, comparand.input)) {
|
43543 | var leftRule = expr.rule, rightRule = comparand.rule;
|
43544 | if (leftRule === rightRule) return !0;
|
43545 | var leftLinearGradient2 = leftRule.linearGradient2, rightLinearGradient2 = rightRule.linearGradient2;
|
43546 | if (leftLinearGradient2 && rightLinearGradient2) return this.visitLinearGradient2(leftLinearGradient2, rightLinearGradient2);
|
43547 | var leftLinearGradient3 = leftRule.linearGradient3, rightLinearGradient3 = rightRule.linearGradient3;
|
43548 | if (leftLinearGradient3 && rightLinearGradient3) return this.visitLinearGradient3(leftLinearGradient3, rightLinearGradient3);
|
43549 | }
|
43550 | return !1;
|
43551 | }, SQExprEqualityVisitor.prototype.visitLinearGradient2 = function(left2, right2) {
|
43552 | return this.equalsFillRuleStop(left2.min, right2.min) && this.equalsFillRuleStop(left2.max, right2.max);
|
43553 | }, SQExprEqualityVisitor.prototype.visitLinearGradient3 = function(left3, right3) {
|
43554 | return this.equalsFillRuleStop(left3.min, right3.min) && this.equalsFillRuleStop(left3.mid, right3.mid) && this.equalsFillRuleStop(left3.max, right3.max);
|
43555 | }, SQExprEqualityVisitor.prototype.equalsFillRuleStop = function(stop1, stop2) {
|
43556 | return this.equals(stop1.color, stop2.color) ? stop1.value ? this.equals(stop1.value, stop2.value) : stop1.value === stop2.value : !1;
|
43557 | }, SQExprEqualityVisitor.prototype.visitArithmetic = function(expr, comparand) {
|
43558 | return comparand instanceof SQArithmeticExpr && expr.operator === comparand.operator && this.equals(expr.left, comparand.left) && this.equals(expr.right, comparand.right);
|
43559 | }, SQExprEqualityVisitor.prototype.visitScopedEval = function(expr, comparand) {
|
43560 | return comparand instanceof SQScopedEvalExpr && this.equals(expr.expression, comparand.expression) && this.equalsAll(expr.scope, comparand.scope);
|
43561 | }, SQExprEqualityVisitor.prototype.visitWithRef = function(expr, comparand) {
|
43562 | return comparand instanceof SQWithRefExpr && expr.expressionName === comparand.expressionName;
|
43563 | }, SQExprEqualityVisitor.prototype.visitTransformTableRef = function(expr, comparand) {
|
43564 | return comparand instanceof SQTransformTableRefExpr && expr.source === comparand.source;
|
43565 | }, SQExprEqualityVisitor.prototype.visitTransformOutputRoleRef = function(expr, comparand) {
|
43566 | return comparand instanceof SQTransformOutputRoleRefExpr && expr.role === comparand.role && expr.transform === comparand.transform;
|
43567 | }, SQExprEqualityVisitor.prototype.optionalEqual = function(x, y) {
|
43568 | return x && y ? x === y : !0;
|
43569 | }, SQExprEqualityVisitor.prototype.equals = function(x, y) {
|
43570 | return x.accept(this, y);
|
43571 | }, SQExprEqualityVisitor.prototype.equalsAll = function(x, y) {
|
43572 | var len = x.length;
|
43573 | if (len !== y.length) return !1;
|
43574 | for (var i = 0; len > i; i++) if (!this.equals(x[i], y[i])) return !1;
|
43575 | return !0;
|
43576 | }, SQExprEqualityVisitor.instance = new SQExprEqualityVisitor(!1), SQExprEqualityVisitor.ignoreCaseInstance = new SQExprEqualityVisitor(!0),
|
43577 | SQExprEqualityVisitor;
|
43578 | }(), SQExprRootRewriter = function(_super) {
|
43579 | function SQExprRootRewriter() {
|
43580 | _super.apply(this, arguments);
|
43581 | }
|
43582 | return __extends(SQExprRootRewriter, _super), SQExprRootRewriter.prototype.visitDefault = function(expr) {
|
43583 | return expr;
|
43584 | }, SQExprRootRewriter;
|
43585 | }(data.DefaultSQExprVisitor), SQExprValidationVisitor = function(_super) {
|
43586 | function SQExprValidationVisitor(schema, aggrUtils, errors) {
|
43587 | _super.call(this), this.schema = schema, this.aggrUtils = aggrUtils, errors && (this.errors = errors);
|
43588 | }
|
43589 | return __extends(SQExprValidationVisitor, _super), SQExprValidationVisitor.prototype.visitIn = function(expr) {
|
43590 | for (var inExpr = _super.prototype.visitIn.call(this, expr), args = inExpr.args, values = inExpr.values, _i = 0, values_1 = values; _i < values_1.length; _i++) for (var valueTuple = values_1[_i], i = 0, len = valueTuple.length; len > i; ++i) this.validateCompatibleType(args[i], valueTuple[i]);
|
43591 | return inExpr;
|
43592 | }, SQExprValidationVisitor.prototype.visitCompare = function(expr) {
|
43593 | var compareExpr = _super.prototype.visitCompare.call(this, expr);
|
43594 | return this.validateCompatibleType(compareExpr.left, compareExpr.right), compareExpr;
|
43595 | }, SQExprValidationVisitor.prototype.visitColumnRef = function(expr) {
|
43596 | var fieldExpr = data.SQExprConverter.asFieldPattern(expr);
|
43597 | if (fieldExpr) {
|
43598 | var fieldExprItem = data.FieldExprPattern.toFieldExprEntityItemPattern(fieldExpr), entity = this.validateEntity(fieldExprItem.schema, fieldExprItem.entity);
|
43599 | if (entity) {
|
43600 | var prop = entity.properties.withName(fieldExpr.column.name);
|
43601 | prop && 0 === prop.kind && this.isQueryable(fieldExpr) || this.register(3);
|
43602 | }
|
43603 | }
|
43604 | return expr;
|
43605 | }, SQExprValidationVisitor.prototype.visitMeasureRef = function(expr) {
|
43606 | var fieldExpr = data.SQExprConverter.asFieldPattern(expr);
|
43607 | if (fieldExpr) {
|
43608 | var fieldExprItem = data.FieldExprPattern.toFieldExprEntityItemPattern(fieldExpr), entity = this.validateEntity(fieldExprItem.schema, fieldExprItem.entity);
|
43609 | if (entity) {
|
43610 | var prop = entity.properties.withName(fieldExpr.measure.name);
|
43611 | prop && 1 === prop.kind && this.isQueryable(fieldExpr) || this.register(4);
|
43612 | }
|
43613 | }
|
43614 | return expr;
|
43615 | }, SQExprValidationVisitor.prototype.visitAggr = function(expr) {
|
43616 | var aggregateExpr = _super.prototype.visitAggr.call(this, expr), columnRefExpr = SQExprColumnRefInfoVisitor.getColumnRefSQExpr(this.schema, aggregateExpr.arg);
|
43617 | return columnRefExpr && (this.aggrUtils.isSupportedAggregate(expr, this.schema, expr.func, null) || this.register(0)),
|
43618 | aggregateExpr;
|
43619 | }, SQExprValidationVisitor.prototype.visitHierarchy = function(expr) {
|
43620 | var fieldExpr = data.SQExprConverter.asFieldPattern(expr);
|
43621 | if (fieldExpr) {
|
43622 | var fieldExprItem = fieldExpr.hierarchy;
|
43623 | fieldExprItem ? this.validateHierarchy(fieldExprItem.schema, fieldExprItem.entity, fieldExprItem.name) : this.register(5);
|
43624 | }
|
43625 | return expr;
|
43626 | }, SQExprValidationVisitor.prototype.visitHierarchyLevel = function(expr) {
|
43627 | var fieldExpr = data.SQExprConverter.asFieldPattern(expr);
|
43628 | if (fieldExpr) {
|
43629 | var hierarchyLevelFieldExprItem = fieldExpr.hierarchyLevel;
|
43630 | hierarchyLevelFieldExprItem ? this.validateHierarchyLevel(hierarchyLevelFieldExprItem.schema, hierarchyLevelFieldExprItem.entity, hierarchyLevelFieldExprItem.name, hierarchyLevelFieldExprItem.level) : fieldExpr.columnHierarchyLevelVariation || this.register(6);
|
43631 | }
|
43632 | return expr;
|
43633 | }, SQExprValidationVisitor.prototype.visitPercentile = function(expr) {
|
43634 | if (expr.arg.accept(this), _.isEmpty(this.errors)) {
|
43635 | var argMetadata = expr.arg.getMetadata(this.schema);
|
43636 | argMetadata && 0 === argMetadata.kind && argMetadata.type && (argMetadata.type.integer || argMetadata.type.numeric) || this.register(10);
|
43637 | }
|
43638 | return expr;
|
43639 | }, SQExprValidationVisitor.prototype.visitEntity = function(expr) {
|
43640 | return this.validateEntity(expr.schema, expr.entity), expr;
|
43641 | }, SQExprValidationVisitor.prototype.visitContains = function(expr) {
|
43642 | return this.validateOperandsAndTypeForStartOrContains(expr.left, expr.right), expr;
|
43643 | }, SQExprValidationVisitor.prototype.visitStartsWith = function(expr) {
|
43644 | return this.validateOperandsAndTypeForStartOrContains(expr.left, expr.right), expr;
|
43645 | }, SQExprValidationVisitor.prototype.visitArithmetic = function(expr) {
|
43646 | return this.validateArithmeticTypes(expr.left, expr.right), expr;
|
43647 | }, SQExprValidationVisitor.prototype.visitScopedEval = function(expr) {
|
43648 | for (var _i = 0, _a = expr.scope; _i < _a.length; _i++) {
|
43649 | var scopeRef = _a[_i];
|
43650 | SQExpr.isWithRef(scopeRef) || SQExpr.isColumn(scopeRef) || this.register(11);
|
43651 | }
|
43652 | return expr;
|
43653 | }, SQExprValidationVisitor.prototype.visitWithRef = function(expr) {
|
43654 | return expr;
|
43655 | }, SQExprValidationVisitor.prototype.visitTransformTableRef = function(expr) {
|
43656 | return expr;
|
43657 | }, SQExprValidationVisitor.prototype.visitTransformOutputRoleRef = function(expr) {
|
43658 | return expr;
|
43659 | }, SQExprValidationVisitor.prototype.validateOperandsAndTypeForStartOrContains = function(left, right) {
|
43660 | left instanceof SQColumnRefExpr ? this.visitColumnRef(left) : left instanceof SQHierarchyLevelExpr ? this.visitHierarchyLevel(left) : this.register(7),
|
43661 | right instanceof SQConstantExpr && right.type.text ? this.validateCompatibleType(left, right) : this.register(8);
|
43662 | }, SQExprValidationVisitor.prototype.validateArithmeticTypes = function(left, right) {
|
43663 | data.SQExprUtils.supportsArithmetic(left, this.schema) || this.register(7), data.SQExprUtils.supportsArithmetic(right, this.schema) || this.register(8);
|
43664 | }, SQExprValidationVisitor.prototype.validateCompatibleType = function(left, right) {
|
43665 | var leftMetadata = left.getMetadata(this.schema), leftType = leftMetadata && leftMetadata.type, rightMetadata = right.getMetadata(this.schema), rightType = rightMetadata && rightMetadata.type;
|
43666 | leftType && rightType && !leftType.isCompatibleFrom(rightType) && this.register(9);
|
43667 | }, SQExprValidationVisitor.prototype.validateEntity = function(schemaName, entityName) {
|
43668 | var schema = this.schema.schema(schemaName);
|
43669 | if (schema) {
|
43670 | var entity = schema.entities.withName(entityName);
|
43671 | if (entity) return entity;
|
43672 | this.register(2);
|
43673 | } else this.register(1);
|
43674 | }, SQExprValidationVisitor.prototype.validateHierarchy = function(schemaName, entityName, hierarchyName) {
|
43675 | var entity = this.validateEntity(schemaName, entityName);
|
43676 | if (entity) {
|
43677 | var hierarchy = entity.hierarchies.withName(hierarchyName);
|
43678 | if (hierarchy) return hierarchy;
|
43679 | this.register(5);
|
43680 | }
|
43681 | }, SQExprValidationVisitor.prototype.validateHierarchyLevel = function(schemaName, entityName, hierarchyName, levelName) {
|
43682 | var hierarchy = this.validateHierarchy(schemaName, entityName, hierarchyName);
|
43683 | if (hierarchy) {
|
43684 | var hierarchyLevel = hierarchy.levels.withName(levelName);
|
43685 | if (hierarchyLevel) return hierarchyLevel;
|
43686 | this.register(6);
|
43687 | }
|
43688 | }, SQExprValidationVisitor.prototype.register = function(error) {
|
43689 | this.errors || (this.errors = []), this.errors.push(error);
|
43690 | }, SQExprValidationVisitor.prototype.isQueryable = function(fieldExpr) {
|
43691 | var fieldExprItem = data.FieldExprPattern.toFieldExprEntityItemPattern(fieldExpr);
|
43692 | if (fieldExpr.hierarchyLevel || fieldExpr.hierarchyLevelAggr) {
|
43693 | var hierarchyLevelConceptualProperty = data.SQHierarchyExprUtils.getConceptualHierarchyLevelFromExpr(this.schema, fieldExpr);
|
43694 | return hierarchyLevelConceptualProperty && 1 !== hierarchyLevelConceptualProperty.column.queryable;
|
43695 | }
|
43696 | return 1 !== this.schema.schema(fieldExprItem.schema).findProperty(fieldExprItem.entity, data.FieldExprPattern.getPropertyName(fieldExpr)).queryable;
|
43697 | }, SQExprValidationVisitor;
|
43698 | }(data.SQExprRewriter);
|
43699 | data.SQExprValidationVisitor = SQExprValidationVisitor;
|
43700 | var SQExprAggregateInfoVisitor = function(_super) {
|
43701 | function SQExprAggregateInfoVisitor() {
|
43702 | _super.apply(this, arguments);
|
43703 | }
|
43704 | return __extends(SQExprAggregateInfoVisitor, _super), SQExprAggregateInfoVisitor.prototype.visitAggr = function(expr) {
|
43705 | return expr.func;
|
43706 | }, SQExprAggregateInfoVisitor.prototype.visitDefault = function(expr) {}, SQExprAggregateInfoVisitor.getAggregate = function(expr) {
|
43707 | var visitor = new SQExprAggregateInfoVisitor();
|
43708 | return expr.accept(visitor);
|
43709 | }, SQExprAggregateInfoVisitor;
|
43710 | }(data.DefaultSQExprVisitor), SQExprColumnRefInfoVisitor = function(_super) {
|
43711 | function SQExprColumnRefInfoVisitor(schema) {
|
43712 | _super.call(this), this.schema = schema;
|
43713 | }
|
43714 | return __extends(SQExprColumnRefInfoVisitor, _super), SQExprColumnRefInfoVisitor.prototype.visitColumnRef = function(expr) {
|
43715 | return expr;
|
43716 | }, SQExprColumnRefInfoVisitor.prototype.visitHierarchyLevel = function(expr) {
|
43717 | var ref = expr.level, hierarchy = expr.arg, sourceExpr = hierarchy.accept(this);
|
43718 | if (hierarchy && hierarchy.arg instanceof SQPropertyVariationSourceExpr) {
|
43719 | var propertyVariationSource = hierarchy.arg, targetEntity = sourceExpr.getTargetEntityForVariation(this.schema, propertyVariationSource.name);
|
43720 | if (sourceExpr && targetEntity) {
|
43721 | var schemaName = sourceExpr.source.schema, targetEntityExpr = SQExprBuilder.entity(schemaName, targetEntity), schemaHierarchy = this.schema.schema(schemaName).findHierarchy(targetEntity, hierarchy.hierarchy);
|
43722 | if (schemaHierarchy) for (var _i = 0, _a = schemaHierarchy.levels; _i < _a.length; _i++) {
|
43723 | var level = _a[_i];
|
43724 | if (level.name === ref) return new SQColumnRefExpr(targetEntityExpr, level.column.name);
|
43725 | }
|
43726 | }
|
43727 | } else {
|
43728 | var entityExpr = hierarchy.arg, hierarchyLevelRef = data.SQHierarchyExprUtils.getConceptualHierarchyLevel(this.schema, entityExpr.schema, entityExpr.entity, hierarchy.hierarchy, expr.level);
|
43729 | if (hierarchyLevelRef) return new SQColumnRefExpr(hierarchy.arg, hierarchyLevelRef.column.name);
|
43730 | }
|
43731 | }, SQExprColumnRefInfoVisitor.prototype.visitHierarchy = function(expr) {
|
43732 | return expr.arg.accept(this);
|
43733 | }, SQExprColumnRefInfoVisitor.prototype.visitPropertyVariationSource = function(expr) {
|
43734 | var propertyName = expr.property;
|
43735 | return new SQColumnRefExpr(expr.arg, propertyName);
|
43736 | }, SQExprColumnRefInfoVisitor.prototype.visitAggr = function(expr) {
|
43737 | return expr.arg.accept(this);
|
43738 | }, SQExprColumnRefInfoVisitor.prototype.visitDefault = function(expr) {}, SQExprColumnRefInfoVisitor.getColumnRefSQExpr = function(schema, expr) {
|
43739 | var visitor = new SQExprColumnRefInfoVisitor(schema);
|
43740 | return expr.accept(visitor);
|
43741 | }, SQExprColumnRefInfoVisitor;
|
43742 | }(data.DefaultSQExprVisitor), SQEntityExprInfoVisitor = function(_super) {
|
43743 | function SQEntityExprInfoVisitor(schema) {
|
43744 | _super.call(this), this.schema = schema;
|
43745 | }
|
43746 | return __extends(SQEntityExprInfoVisitor, _super), SQEntityExprInfoVisitor.prototype.visitEntity = function(expr) {
|
43747 | return expr;
|
43748 | }, SQEntityExprInfoVisitor.prototype.visitColumnRef = function(expr) {
|
43749 | return SQEntityExprInfoVisitor.getEntity(expr);
|
43750 | }, SQEntityExprInfoVisitor.prototype.visitHierarchyLevel = function(expr) {
|
43751 | var columnRef = SQEntityExprInfoVisitor.getColumnRefSQExpr(this.schema, expr);
|
43752 | return SQEntityExprInfoVisitor.getEntity(columnRef);
|
43753 | }, SQEntityExprInfoVisitor.prototype.visitHierarchy = function(expr) {
|
43754 | return expr.arg.accept(this);
|
43755 | }, SQEntityExprInfoVisitor.prototype.visitPropertyVariationSource = function(expr) {
|
43756 | var columnRef = SQEntityExprInfoVisitor.getColumnRefSQExpr(this.schema, expr);
|
43757 | return SQEntityExprInfoVisitor.getEntity(columnRef);
|
43758 | }, SQEntityExprInfoVisitor.prototype.visitAggr = function(expr) {
|
43759 | var columnRef = SQEntityExprInfoVisitor.getColumnRefSQExpr(this.schema, expr);
|
43760 | return SQEntityExprInfoVisitor.getEntity(columnRef);
|
43761 | }, SQEntityExprInfoVisitor.prototype.visitMeasureRef = function(expr) {
|
43762 | return expr.source.accept(this);
|
43763 | }, SQEntityExprInfoVisitor.getColumnRefSQExpr = function(schema, expr) {
|
43764 | var visitor = new SQExprColumnRefInfoVisitor(schema);
|
43765 | return expr.accept(visitor);
|
43766 | }, SQEntityExprInfoVisitor.getEntity = function(columnRef) {
|
43767 | var field = data.SQExprConverter.asFieldPattern(columnRef), column = field.column;
|
43768 | return SQExprBuilder.entity(column.schema, column.entity, column.entityVar);
|
43769 | }, SQEntityExprInfoVisitor.getEntityExpr = function(schema, expr) {
|
43770 | var visitor = new SQEntityExprInfoVisitor(schema);
|
43771 | return expr.accept(visitor);
|
43772 | }, SQEntityExprInfoVisitor;
|
43773 | }(data.DefaultSQExprVisitor), SQExprChangeAggregateRewriter = function(_super) {
|
43774 | function SQExprChangeAggregateRewriter(func) {
|
43775 | _super.call(this), this.func = func;
|
43776 | }
|
43777 | return __extends(SQExprChangeAggregateRewriter, _super), SQExprChangeAggregateRewriter.prototype.visitAggr = function(expr) {
|
43778 | return expr.func === this.func ? expr : new SQAggregationExpr(expr.arg, this.func);
|
43779 | }, SQExprChangeAggregateRewriter.prototype.visitColumnRef = function(expr) {
|
43780 | return new SQAggregationExpr(expr, this.func);
|
43781 | }, SQExprChangeAggregateRewriter.rewrite = function(expr, func) {
|
43782 | var rewriter = new SQExprChangeAggregateRewriter(func);
|
43783 | return expr.accept(rewriter);
|
43784 | }, SQExprChangeAggregateRewriter;
|
43785 | }(SQExprRootRewriter), FieldExprChangeAggregateRewriter = function() {
|
43786 | function FieldExprChangeAggregateRewriter(sqExpr, aggregate) {
|
43787 | this.sqExpr = sqExpr, this.aggregate = aggregate;
|
43788 | }
|
43789 | return FieldExprChangeAggregateRewriter.rewrite = function(sqExpr, aggregate) {
|
43790 | return data.FieldExprPattern.visit(sqExpr, new FieldExprChangeAggregateRewriter(sqExpr, aggregate));
|
43791 | }, FieldExprChangeAggregateRewriter.prototype.visitPercentOfGrandTotal = function(pattern) {
|
43792 | return pattern.baseExpr = data.SQExprConverter.asFieldPattern(SQExprChangeAggregateRewriter.rewrite(SQExprBuilder.fieldExpr(pattern.baseExpr), this.aggregate)),
|
43793 | SQExprBuilder.fieldExpr({
|
43794 | percentOfGrandTotal: pattern
|
43795 | });
|
43796 | }, FieldExprChangeAggregateRewriter.prototype.visitColumn = function(column) {
|
43797 | return this.defaultRewrite();
|
43798 | }, FieldExprChangeAggregateRewriter.prototype.visitColumnAggr = function(columnAggr) {
|
43799 | return this.defaultRewrite();
|
43800 | }, FieldExprChangeAggregateRewriter.prototype.visitColumnHierarchyLevelVariation = function(columnHierarchyLevelVariation) {
|
43801 | return this.defaultRewrite();
|
43802 | }, FieldExprChangeAggregateRewriter.prototype.visitSelectRef = function(selectRef) {
|
43803 | return this.defaultRewrite();
|
43804 | }, FieldExprChangeAggregateRewriter.prototype.visitEntity = function(entity) {
|
43805 | return this.defaultRewrite();
|
43806 | }, FieldExprChangeAggregateRewriter.prototype.visitEntityAggr = function(entityAggr) {
|
43807 | return this.defaultRewrite();
|
43808 | }, FieldExprChangeAggregateRewriter.prototype.visitHierarchy = function(hierarchy) {
|
43809 | return this.defaultRewrite();
|
43810 | }, FieldExprChangeAggregateRewriter.prototype.visitHierarchyLevel = function(hierarchyLevel) {
|
43811 | return this.defaultRewrite();
|
43812 | }, FieldExprChangeAggregateRewriter.prototype.visitHierarchyLevelAggr = function(hierarchyLevelAggr) {
|
43813 | return this.defaultRewrite();
|
43814 | }, FieldExprChangeAggregateRewriter.prototype.visitMeasure = function(measure) {
|
43815 | return this.defaultRewrite();
|
43816 | }, FieldExprChangeAggregateRewriter.prototype.visitPercentile = function(percentile) {
|
43817 | return this.defaultRewrite();
|
43818 | }, FieldExprChangeAggregateRewriter.prototype.defaultRewrite = function() {
|
43819 | return SQExprChangeAggregateRewriter.rewrite(this.sqExpr, this.aggregate);
|
43820 | }, FieldExprChangeAggregateRewriter;
|
43821 | }(), FieldExprRemoveAggregateRewriter = function() {
|
43822 | function FieldExprRemoveAggregateRewriter(sqExpr) {
|
43823 | this.sqExpr = sqExpr;
|
43824 | }
|
43825 | return FieldExprRemoveAggregateRewriter.rewrite = function(sqExpr) {
|
43826 | return data.FieldExprPattern.visit(sqExpr, new FieldExprRemoveAggregateRewriter(sqExpr));
|
43827 | }, FieldExprRemoveAggregateRewriter.prototype.visitPercentOfGrandTotal = function(pattern) {
|
43828 | return FieldExprRemoveAggregateRewriter.rewrite(SQExprBuilder.fieldExpr(pattern.baseExpr));
|
43829 | }, FieldExprRemoveAggregateRewriter.prototype.visitColumn = function(column) {
|
43830 | return this.defaultRewrite();
|
43831 | }, FieldExprRemoveAggregateRewriter.prototype.visitColumnAggr = function(columnAggr) {
|
43832 | return this.defaultRewrite();
|
43833 | }, FieldExprRemoveAggregateRewriter.prototype.visitColumnHierarchyLevelVariation = function(columnHierarchyLevelVariation) {
|
43834 | return this.defaultRewrite();
|
43835 | }, FieldExprRemoveAggregateRewriter.prototype.visitSelectRef = function(selectRef) {
|
43836 | return this.defaultRewrite();
|
43837 | }, FieldExprRemoveAggregateRewriter.prototype.visitEntity = function(entity) {
|
43838 | return this.defaultRewrite();
|
43839 | }, FieldExprRemoveAggregateRewriter.prototype.visitEntityAggr = function(entityAggr) {
|
43840 | return this.defaultRewrite();
|
43841 | }, FieldExprRemoveAggregateRewriter.prototype.visitHierarchy = function(hierarchy) {
|
43842 | return this.defaultRewrite();
|
43843 | }, FieldExprRemoveAggregateRewriter.prototype.visitHierarchyLevel = function(hierarchyLevel) {
|
43844 | return this.defaultRewrite();
|
43845 | }, FieldExprRemoveAggregateRewriter.prototype.visitHierarchyLevelAggr = function(hierarchyLevelAggr) {
|
43846 | return this.defaultRewrite();
|
43847 | }, FieldExprRemoveAggregateRewriter.prototype.visitMeasure = function(measure) {
|
43848 | return this.defaultRewrite();
|
43849 | }, FieldExprRemoveAggregateRewriter.prototype.visitPercentile = function(percentile) {
|
43850 | return this.defaultRewrite();
|
43851 | }, FieldExprRemoveAggregateRewriter.prototype.defaultRewrite = function() {
|
43852 | return SQExprRemoveAggregateRewriter.rewrite(this.sqExpr);
|
43853 | }, FieldExprRemoveAggregateRewriter;
|
43854 | }(), SQExprRemoveAggregateRewriter = function(_super) {
|
43855 | function SQExprRemoveAggregateRewriter() {
|
43856 | _super.apply(this, arguments);
|
43857 | }
|
43858 | return __extends(SQExprRemoveAggregateRewriter, _super), SQExprRemoveAggregateRewriter.prototype.visitAggr = function(expr) {
|
43859 | return expr.arg;
|
43860 | }, SQExprRemoveAggregateRewriter.rewrite = function(expr) {
|
43861 | return expr.accept(SQExprRemoveAggregateRewriter.instance);
|
43862 | }, SQExprRemoveAggregateRewriter.instance = new SQExprRemoveAggregateRewriter(),
|
43863 | SQExprRemoveAggregateRewriter;
|
43864 | }(SQExprRootRewriter), SQExprRemoveEntityVariablesRewriter = function(_super) {
|
43865 | function SQExprRemoveEntityVariablesRewriter() {
|
43866 | _super.apply(this, arguments);
|
43867 | }
|
43868 | return __extends(SQExprRemoveEntityVariablesRewriter, _super), SQExprRemoveEntityVariablesRewriter.prototype.visitEntity = function(expr) {
|
43869 | return expr.variable ? SQExprBuilder.entity(expr.schema, expr.entity) : expr;
|
43870 | }, SQExprRemoveEntityVariablesRewriter.rewrite = function(expr) {
|
43871 | return expr.accept(SQExprRemoveEntityVariablesRewriter.instance);
|
43872 | }, SQExprRemoveEntityVariablesRewriter.instance = new SQExprRemoveEntityVariablesRewriter(),
|
43873 | SQExprRemoveEntityVariablesRewriter;
|
43874 | }(data.SQExprRewriter), SQExprRemovePercentOfGrandTotalRewriter = function(_super) {
|
43875 | function SQExprRemovePercentOfGrandTotalRewriter() {
|
43876 | _super.apply(this, arguments);
|
43877 | }
|
43878 | return __extends(SQExprRemovePercentOfGrandTotalRewriter, _super), SQExprRemovePercentOfGrandTotalRewriter.rewrite = function(expr) {
|
43879 | return expr.accept(SQExprRemovePercentOfGrandTotalRewriter.instance);
|
43880 | }, SQExprRemovePercentOfGrandTotalRewriter.prototype.visitDefault = function(expr) {
|
43881 | var fieldExpr = data.SQExprConverter.asFieldPattern(expr);
|
43882 | return fieldExpr && fieldExpr.percentOfGrandTotal && (expr = SQExprBuilder.fieldExpr(fieldExpr.percentOfGrandTotal.baseExpr)),
|
43883 | expr;
|
43884 | }, SQExprRemovePercentOfGrandTotalRewriter.instance = new SQExprRemovePercentOfGrandTotalRewriter(),
|
43885 | SQExprRemovePercentOfGrandTotalRewriter;
|
43886 | }(SQExprRootRewriter), SQExprSetPercentOfGrandTotalRewriter = function(_super) {
|
43887 | function SQExprSetPercentOfGrandTotalRewriter() {
|
43888 | _super.apply(this, arguments);
|
43889 | }
|
43890 | return __extends(SQExprSetPercentOfGrandTotalRewriter, _super), SQExprSetPercentOfGrandTotalRewriter.rewrite = function(expr) {
|
43891 | return expr.accept(SQExprSetPercentOfGrandTotalRewriter.instance);
|
43892 | }, SQExprSetPercentOfGrandTotalRewriter.prototype.visitDefault = function(expr) {
|
43893 | var fieldExpr = data.SQExprConverter.asFieldPattern(expr);
|
43894 | return fieldExpr && !fieldExpr.percentOfGrandTotal && (expr = SQExprBuilder.fieldExpr({
|
43895 | percentOfGrandTotal: {
|
43896 | baseExpr: data.SQExprConverter.asFieldPattern(expr)
|
43897 | }
|
43898 | })), expr;
|
43899 | }, SQExprSetPercentOfGrandTotalRewriter.instance = new SQExprSetPercentOfGrandTotalRewriter(),
|
43900 | SQExprSetPercentOfGrandTotalRewriter;
|
43901 | }(SQExprRootRewriter);
|
43902 | }(data = powerbi.data || (powerbi.data = {}));
|
43903 | }(powerbi || (powerbi = {}));
|
43904 | }, function(module, exports) {
|
43905 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi, __extends = (window.powerbitests,
|
43906 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
43907 | function __() {
|
43908 | this.constructor = d;
|
43909 | }
|
43910 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
43911 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
43912 | });
|
43913 | !function(powerbi) {
|
43914 | var data;
|
43915 | !function(data) {
|
43916 | var SQExprUtils, ArrayExtensions = jsCommon.ArrayExtensions, StringExtensions = jsCommon.StringExtensions;
|
43917 | !function(SQExprUtils) {
|
43918 | function supportsArithmetic(expr, schema) {
|
43919 | var metadata = expr.getMetadata(schema), type = metadata && metadata.type;
|
43920 | return metadata && type ? type.numeric || type.dateTime || type.duration : !1;
|
43921 | }
|
43922 | function indexOfExpr(items, searchElement) {
|
43923 | for (var i = 0, len = items.length; len > i; i++) if (data.SQExpr.equals(items[i], searchElement)) return i;
|
43924 | return -1;
|
43925 | }
|
43926 | function indexOfNamedExpr(items, searchElement) {
|
43927 | for (var i = 0, len = items.length; len > i; i++) {
|
43928 | var item = items[i];
|
43929 | if (item && data.SQExpr.equals(item.expr, searchElement)) return i;
|
43930 | }
|
43931 | return -1;
|
43932 | }
|
43933 | function sequenceEqual(x, y) {
|
43934 | var len = x.length;
|
43935 | if (len !== y.length) return !1;
|
43936 | for (var i = 0; len > i; i++) if (!data.SQExpr.equals(x[i], y[i])) return !1;
|
43937 | return !0;
|
43938 | }
|
43939 | function uniqueName(namedItems, expr, exprDefaultName) {
|
43940 | for (var names = {}, i = 0, len = namedItems.length; len > i; i++) names[namedItems[i].name] = !0;
|
43941 | return StringExtensions.findUniqueName(names, exprDefaultName || defaultName(expr));
|
43942 | }
|
43943 | function defaultName(expr, fallback) {
|
43944 | return void 0 === fallback && (fallback = "select"), expr ? expr.accept(SQExprDefaultNameGenerator.instance, fallback) : fallback;
|
43945 | }
|
43946 | function isMeasure(expr) {
|
43947 | return expr.accept(IsMeasureVisitor.instance);
|
43948 | }
|
43949 | function isAnyValue(expr) {
|
43950 | return expr.accept(IsAnyValueVisitor.instance);
|
43951 | }
|
43952 | function isDefaultValue(expr) {
|
43953 | return expr.accept(IsDefaultValueVisitor.instance);
|
43954 | }
|
43955 | function discourageAggregation(expr, schema) {
|
43956 | var capabilities = getSchemaCapabilities(expr, schema);
|
43957 | return capabilities && capabilities.discourageQueryAggregateUsage;
|
43958 | }
|
43959 | function getAggregateBehavior(expr, schema) {
|
43960 | var column = getConceptualColumn(expr, schema);
|
43961 | return column ? column.aggregateBehavior : void 0;
|
43962 | }
|
43963 | function getSchemaCapabilities(expr, schema) {
|
43964 | var field = data.SQExprConverter.asFieldPattern(expr);
|
43965 | if (field) {
|
43966 | var fieldExprItem = data.FieldExprPattern.toFieldExprEntityItemPattern(field), conceptualSchema = schema.schema(fieldExprItem.schema);
|
43967 | return conceptualSchema ? conceptualSchema.capabilities : void 0;
|
43968 | }
|
43969 | }
|
43970 | function getKpiMetadata(expr, schema) {
|
43971 | var kpiStatusProperty = getKpiStatusProperty(expr, schema);
|
43972 | if (kpiStatusProperty) return kpiStatusProperty.kpiValue.measure.kpi.statusMetadata;
|
43973 | var kpiTrendProperty = getKpiTrendProperty(expr, schema);
|
43974 | return kpiTrendProperty ? kpiTrendProperty.kpiValue.measure.kpi.trendMetadata : void 0;
|
43975 | }
|
43976 | function getConceptualEntity(entityExpr, schema) {
|
43977 | var conceptualEntity = schema.schema(entityExpr.schema).entities.withName(entityExpr.entity);
|
43978 | return conceptualEntity;
|
43979 | }
|
43980 | function getKpiStatusProperty(expr, schema) {
|
43981 | var property = expr.getConceptualProperty(schema);
|
43982 | if (property) {
|
43983 | var kpiValue = property.kpiValue;
|
43984 | return kpiValue && kpiValue.measure.kpi.status === property ? property : void 0;
|
43985 | }
|
43986 | }
|
43987 | function getKpiTrendProperty(expr, schema) {
|
43988 | var property = expr.getConceptualProperty(schema);
|
43989 | if (property) {
|
43990 | var kpiValue = property.kpiValue;
|
43991 | return kpiValue && kpiValue.measure.kpi.trend === property ? property : void 0;
|
43992 | }
|
43993 | }
|
43994 | function getDefaultValue(fieldSQExpr, schema) {
|
43995 | var column = getConceptualColumn(fieldSQExpr, schema);
|
43996 | return column ? column.defaultValue : void 0;
|
43997 | }
|
43998 | function getConceptualColumn(fieldSQExpr, schema) {
|
43999 | if (fieldSQExpr && schema) {
|
44000 | var sqField = data.SQExprConverter.asFieldPattern(fieldSQExpr);
|
44001 | if (sqField) {
|
44002 | var column = sqField.column;
|
44003 | if (column) {
|
44004 | if (schema.schema(column.schema) && sqField.column.name) {
|
44005 | var property = schema.schema(column.schema).findProperty(column.entity, sqField.column.name);
|
44006 | if (property) return property.column;
|
44007 | }
|
44008 | } else {
|
44009 | var hierarchyLevelField = sqField.hierarchyLevel;
|
44010 | if (hierarchyLevelField) {
|
44011 | var fieldExprItem = data.FieldExprPattern.toFieldExprEntityItemPattern(sqField), schemaName = fieldExprItem.schema;
|
44012 | if (schema.schema(schemaName)) {
|
44013 | var hierarchy = schema.schema(schemaName).findHierarchy(fieldExprItem.entity, hierarchyLevelField.name);
|
44014 | if (hierarchy) {
|
44015 | var hierarchyLevel = hierarchy.levels.withName(hierarchyLevelField.level);
|
44016 | if (hierarchyLevel && hierarchyLevel.column) return hierarchyLevel.column.column;
|
44017 | }
|
44018 | }
|
44019 | }
|
44020 | }
|
44021 | }
|
44022 | }
|
44023 | }
|
44024 | function getDefaultValues(fieldSQExprs, schema) {
|
44025 | if (!_.isEmpty(fieldSQExprs) && schema) {
|
44026 | for (var result = [], _i = 0, fieldSQExprs_1 = fieldSQExprs; _i < fieldSQExprs_1.length; _i++) {
|
44027 | var sqExpr = fieldSQExprs_1[_i], defaultValue = getDefaultValue(sqExpr, schema);
|
44028 | defaultValue && result.push(defaultValue);
|
44029 | }
|
44030 | return result;
|
44031 | }
|
44032 | }
|
44033 | function getDataViewScopeIdentityComparisonExpr(fieldsExpr, values) {
|
44034 | for (var compareExprs = [], i = 0; i < fieldsExpr.length; i++) compareExprs.push(data.SQExprBuilder.compare(data.QueryComparisonKind.Equal, fieldsExpr[i], values[i]));
|
44035 | if (!_.isEmpty(compareExprs)) {
|
44036 | for (var resultExpr, _i = 0, compareExprs_1 = compareExprs; _i < compareExprs_1.length; _i++) {
|
44037 | var compareExpr = compareExprs_1[_i];
|
44038 | resultExpr = data.SQExprBuilder.and(resultExpr, compareExpr);
|
44039 | }
|
44040 | return resultExpr;
|
44041 | }
|
44042 | }
|
44043 | function getActiveTablesNames(queryDefn) {
|
44044 | var tables = [], entitiesVisitor = new data.SQFromEntitiesVisitor();
|
44045 | if (queryDefn) {
|
44046 | var selectedItems = queryDefn.from();
|
44047 | if (void 0 !== selectedItems) for (var _i = 0, _a = selectedItems.keys(); _i < _a.length; _i++) {
|
44048 | var key = _a[_i];
|
44049 | selectedItems.source(key).accept(entitiesVisitor, null);
|
44050 | }
|
44051 | }
|
44052 | return tables = _.map(entitiesVisitor.entities, function(value) {
|
44053 | return value.entity;
|
44054 | });
|
44055 | }
|
44056 | function isRelatedToMany(schema, sourceExpr, targetExpr) {
|
44057 | return isRelated(schema, sourceExpr, targetExpr, 0, 2) || isRelated(schema, targetExpr, sourceExpr, 2, 0);
|
44058 | }
|
44059 | function isRelatedToOne(schema, sourceExpr, targetExpr) {
|
44060 | return isRelated(schema, sourceExpr, targetExpr, 2, 0) || isRelated(schema, targetExpr, sourceExpr, 0, 2);
|
44061 | }
|
44062 | function isRelated(schema, sourceExpr, targetExpr, sourceMultiplicity, targetMultiplicity) {
|
44063 | var source = SQExprUtils.getConceptualEntity(sourceExpr, schema);
|
44064 | if (_.isEmpty(source.navigationProperties)) return !1;
|
44065 | var target = SQExprUtils.getConceptualEntity(targetExpr, schema), queue = [];
|
44066 | for (queue.push(source); !_.isEmpty(queue); ) {
|
44067 | var current = queue.shift(), navProperties = current.navigationProperties;
|
44068 | if (!_.isEmpty(navProperties)) for (var _i = 0, navProperties_1 = navProperties; _i < navProperties_1.length; _i++) {
|
44069 | var navProperty = navProperties_1[_i];
|
44070 | if (navProperty.isActive && navProperty.targetMultiplicity === targetMultiplicity && navProperty.sourceMultiplicity === sourceMultiplicity) {
|
44071 | if (navProperty.targetEntity === target) return !0;
|
44072 | queue.push(navProperty.targetEntity);
|
44073 | }
|
44074 | }
|
44075 | }
|
44076 | return !1;
|
44077 | }
|
44078 | function isRelatedOneToOne(schema, sourceExpr, targetExpr) {
|
44079 | var source = SQExprUtils.getConceptualEntity(sourceExpr, schema), target = SQExprUtils.getConceptualEntity(targetExpr, schema), sourceNavigations = source.navigationProperties, targetNavigations = target.navigationProperties;
|
44080 | return _.isEmpty(sourceNavigations) && _.isEmpty(targetNavigations) ? !1 : hasOneToOneNavigation(sourceNavigations, target) || hasOneToOneNavigation(targetNavigations, source);
|
44081 | }
|
44082 | function hasOneToOneNavigation(navigationProperties, targetEntity) {
|
44083 | if (_.isEmpty(navigationProperties)) return !1;
|
44084 | for (var _i = 0, navigationProperties_1 = navigationProperties; _i < navigationProperties_1.length; _i++) {
|
44085 | var navigationProperty = navigationProperties_1[_i];
|
44086 | if (navigationProperty.isActive && navigationProperty.targetEntity === targetEntity && 0 === navigationProperty.sourceMultiplicity && 0 === navigationProperty.targetMultiplicity) return !0;
|
44087 | }
|
44088 | return !1;
|
44089 | }
|
44090 | function concatUnique(leftExprs, rightExprs) {
|
44091 | for (var concatExprs = ArrayExtensions.copy(leftExprs), _i = 0, rightExprs_1 = rightExprs; _i < rightExprs_1.length; _i++) {
|
44092 | var expr = rightExprs_1[_i];
|
44093 | -1 === indexOfExpr(concatExprs, expr) && concatExprs.push(expr);
|
44094 | }
|
44095 | return concatExprs;
|
44096 | }
|
44097 | SQExprUtils.supportsArithmetic = supportsArithmetic, SQExprUtils.indexOfExpr = indexOfExpr,
|
44098 | SQExprUtils.indexOfNamedExpr = indexOfNamedExpr, SQExprUtils.sequenceEqual = sequenceEqual,
|
44099 | SQExprUtils.uniqueName = uniqueName, SQExprUtils.defaultName = defaultName, SQExprUtils.isMeasure = isMeasure,
|
44100 | SQExprUtils.isAnyValue = isAnyValue, SQExprUtils.isDefaultValue = isDefaultValue,
|
44101 | SQExprUtils.discourageAggregation = discourageAggregation, SQExprUtils.getAggregateBehavior = getAggregateBehavior,
|
44102 | SQExprUtils.getSchemaCapabilities = getSchemaCapabilities, SQExprUtils.getKpiMetadata = getKpiMetadata,
|
44103 | SQExprUtils.getConceptualEntity = getConceptualEntity, SQExprUtils.getDefaultValue = getDefaultValue,
|
44104 | SQExprUtils.getDefaultValues = getDefaultValues, SQExprUtils.getDataViewScopeIdentityComparisonExpr = getDataViewScopeIdentityComparisonExpr,
|
44105 | SQExprUtils.getActiveTablesNames = getActiveTablesNames, SQExprUtils.isRelatedToMany = isRelatedToMany,
|
44106 | SQExprUtils.isRelatedToOne = isRelatedToOne, SQExprUtils.isRelatedOneToOne = isRelatedOneToOne,
|
44107 | SQExprUtils.concatUnique = concatUnique;
|
44108 | var SQExprDefaultNameGenerator = function(_super) {
|
44109 | function SQExprDefaultNameGenerator() {
|
44110 | _super.apply(this, arguments);
|
44111 | }
|
44112 | return __extends(SQExprDefaultNameGenerator, _super), SQExprDefaultNameGenerator.prototype.visitEntity = function(expr) {
|
44113 | return expr.entity;
|
44114 | }, SQExprDefaultNameGenerator.prototype.visitColumnRef = function(expr) {
|
44115 | return expr.source.accept(this) + "." + expr.ref;
|
44116 | }, SQExprDefaultNameGenerator.prototype.visitMeasureRef = function(expr, fallback) {
|
44117 | return expr.source.accept(this) + "." + expr.ref;
|
44118 | }, SQExprDefaultNameGenerator.prototype.visitAggr = function(expr, fallback) {
|
44119 | return data.QueryAggregateFunction[expr.func] + "(" + expr.arg.accept(this) + ")";
|
44120 | }, SQExprDefaultNameGenerator.prototype.visitPercentile = function(expr, fallback) {
|
44121 | var func = expr.exclusive ? "Percentile.Exc(" : "Percentile.Inc(";
|
44122 | return func + expr.arg.accept(this) + ", " + expr.k + ")";
|
44123 | }, SQExprDefaultNameGenerator.prototype.visitArithmetic = function(expr, fallback) {
|
44124 | return powerbi.data.getArithmeticOperatorName(expr.operator) + "(" + expr.left.accept(this) + ", " + expr.right.accept(this) + ")";
|
44125 | }, SQExprDefaultNameGenerator.prototype.visitConstant = function(expr) {
|
44126 | return "const";
|
44127 | }, SQExprDefaultNameGenerator.prototype.visitTransformOutputRoleRef = function(expr, fallback) {
|
44128 | var name = expr.role;
|
44129 | return expr.transform && (name += "." + expr.transform), name;
|
44130 | }, SQExprDefaultNameGenerator.prototype.visitDefault = function(expr, fallback) {
|
44131 | return fallback || "expr";
|
44132 | }, SQExprDefaultNameGenerator.instance = new SQExprDefaultNameGenerator(), SQExprDefaultNameGenerator;
|
44133 | }(data.DefaultSQExprVisitorWithArg), IsMeasureVisitor = function(_super) {
|
44134 | function IsMeasureVisitor() {
|
44135 | _super.apply(this, arguments);
|
44136 | }
|
44137 | return __extends(IsMeasureVisitor, _super), IsMeasureVisitor.prototype.visitMeasureRef = function(expr) {
|
44138 | return !0;
|
44139 | }, IsMeasureVisitor.prototype.visitAggr = function(expr) {
|
44140 | return !0;
|
44141 | }, IsMeasureVisitor.prototype.visitArithmetic = function(expr) {
|
44142 | return !0;
|
44143 | }, IsMeasureVisitor.prototype.visitDefault = function(expr) {
|
44144 | return !1;
|
44145 | }, IsMeasureVisitor.instance = new IsMeasureVisitor(), IsMeasureVisitor;
|
44146 | }(data.DefaultSQExprVisitor), IsDefaultValueVisitor = function(_super) {
|
44147 | function IsDefaultValueVisitor() {
|
44148 | _super.apply(this, arguments);
|
44149 | }
|
44150 | return __extends(IsDefaultValueVisitor, _super), IsDefaultValueVisitor.prototype.visitCompare = function(expr) {
|
44151 | return expr.comparison !== data.QueryComparisonKind.Equal ? !1 : expr.right.accept(this);
|
44152 | }, IsDefaultValueVisitor.prototype.visitAnd = function(expr) {
|
44153 | return expr.left.accept(this) && expr.right.accept(this);
|
44154 | }, IsDefaultValueVisitor.prototype.visitDefaultValue = function(expr) {
|
44155 | return !0;
|
44156 | }, IsDefaultValueVisitor.prototype.visitDefault = function(expr) {
|
44157 | return !1;
|
44158 | }, IsDefaultValueVisitor.instance = new IsDefaultValueVisitor(), IsDefaultValueVisitor;
|
44159 | }(data.DefaultSQExprVisitor), IsAnyValueVisitor = function(_super) {
|
44160 | function IsAnyValueVisitor() {
|
44161 | _super.apply(this, arguments);
|
44162 | }
|
44163 | return __extends(IsAnyValueVisitor, _super), IsAnyValueVisitor.prototype.visitCompare = function(expr) {
|
44164 | return expr.comparison !== data.QueryComparisonKind.Equal ? !1 : expr.right.accept(this);
|
44165 | }, IsAnyValueVisitor.prototype.visitAnd = function(expr) {
|
44166 | return expr.left.accept(this) && expr.right.accept(this);
|
44167 | }, IsAnyValueVisitor.prototype.visitAnyValue = function(expr) {
|
44168 | return !0;
|
44169 | }, IsAnyValueVisitor.prototype.visitDefault = function(expr) {
|
44170 | return !1;
|
44171 | }, IsAnyValueVisitor.instance = new IsAnyValueVisitor(), IsAnyValueVisitor;
|
44172 | }(data.DefaultSQExprVisitor);
|
44173 | }(SQExprUtils = data.SQExprUtils || (data.SQExprUtils = {}));
|
44174 | }(data = powerbi.data || (powerbi.data = {}));
|
44175 | }(powerbi || (powerbi = {}));
|
44176 | }, function(module, exports) {
|
44177 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
44178 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
44179 | !function(powerbi) {
|
44180 | var data;
|
44181 | !function(data) {
|
44182 | var SemanticQueryRewriter = function() {
|
44183 | function SemanticQueryRewriter(exprRewriter) {
|
44184 | this.exprRewriter = exprRewriter;
|
44185 | }
|
44186 | return SemanticQueryRewriter.prototype.rewriteFrom = function(fromValue) {
|
44187 | for (var fromContents = {}, originalFrom = fromValue, originalFromKeys = originalFrom.keys(), i = 0, len = originalFromKeys.length; len > i; i++) {
|
44188 | var keyName = originalFromKeys[i], originalSource = originalFrom.source(keyName);
|
44189 | if (data.isSQFromEntitySource(originalSource)) {
|
44190 | var originalEntityExpr = data.SQExprBuilder.entity(originalSource.schema, originalSource.entity, keyName), updatedEntityExpr = originalEntityExpr.accept(this.exprRewriter);
|
44191 | fromContents[keyName] = new data.SQFromEntitySource(updatedEntityExpr.schema, updatedEntityExpr.entity);
|
44192 | } else data.isSQFromSubquerySource(originalSource);
|
44193 | }
|
44194 | return new data.SQFrom(fromContents);
|
44195 | }, SemanticQueryRewriter.prototype.rewriteSelect = function(selectItems, from) {
|
44196 | return this.rewriteNamedSQExpressions(selectItems, from);
|
44197 | }, SemanticQueryRewriter.prototype.rewriteGroupBy = function(groupByitems, from) {
|
44198 | return _.isEmpty(groupByitems) ? void 0 : this.rewriteNamedSQExpressions(groupByitems, from);
|
44199 | }, SemanticQueryRewriter.prototype.rewriteNamedSQExpressions = function(expressions, from) {
|
44200 | var _this = this;
|
44201 | return _.map(expressions, function(item) {
|
44202 | return {
|
44203 | name: item.name,
|
44204 | expr: data.SQExprRewriterWithSourceRenames.rewrite(item.expr.accept(_this.exprRewriter), from)
|
44205 | };
|
44206 | });
|
44207 | }, SemanticQueryRewriter.prototype.rewriteOrderBy = function(orderByItems, from) {
|
44208 | if (!_.isEmpty(orderByItems)) {
|
44209 | for (var orderBy = [], i = 0, len = orderByItems.length; len > i; i++) {
|
44210 | var item = orderByItems[i], updatedExpr = data.SQExprRewriterWithSourceRenames.rewrite(item.expr.accept(this.exprRewriter), from);
|
44211 | orderBy.push({
|
44212 | direction: item.direction,
|
44213 | expr: updatedExpr
|
44214 | });
|
44215 | }
|
44216 | return orderBy;
|
44217 | }
|
44218 | }, SemanticQueryRewriter.prototype.rewriteWhere = function(whereItems, from) {
|
44219 | var _this = this;
|
44220 | if (!_.isEmpty(whereItems)) {
|
44221 | for (var where = [], i = 0, len = whereItems.length; len > i; i++) {
|
44222 | var originalWhere = whereItems[i], updatedWhere = {
|
44223 | condition: data.SQExprRewriterWithSourceRenames.rewrite(originalWhere.condition.accept(this.exprRewriter), from)
|
44224 | };
|
44225 | originalWhere.target && (updatedWhere.target = _.map(originalWhere.target, function(e) {
|
44226 | return data.SQExprRewriterWithSourceRenames.rewrite(e.accept(_this.exprRewriter), from);
|
44227 | })), where.push(updatedWhere);
|
44228 | }
|
44229 | return where;
|
44230 | }
|
44231 | }, SemanticQueryRewriter.prototype.rewriteTransform = function(transformItems, from) {
|
44232 | var _this = this;
|
44233 | if (!_.isEmpty(transformItems)) {
|
44234 | for (var transforms = [], _i = 0, transformItems_1 = transformItems; _i < transformItems_1.length; _i++) {
|
44235 | var transformItem = transformItems_1[_i], inputColumns = void 0;
|
44236 | transformItem.input.table && !_.isEmpty(transformItem.input.table.columns) && (inputColumns = _.map(transformItem.input.table.columns, function(c) {
|
44237 | return {
|
44238 | role: c.role,
|
44239 | expression: {
|
44240 | name: c.expression.name,
|
44241 | expr: data.SQExprRewriterWithSourceRenames.rewrite(c.expression.expr.accept(_this.exprRewriter), from)
|
44242 | }
|
44243 | };
|
44244 | }));
|
44245 | var newTransform = {
|
44246 | name: transformItem.name,
|
44247 | algorithm: transformItem.algorithm,
|
44248 | input: {
|
44249 | parameters: transformItem.input.parameters
|
44250 | },
|
44251 | output: transformItem.output
|
44252 | };
|
44253 | transformItem.input.table && (newTransform.input.table = {
|
44254 | name: transformItem.input.table.name,
|
44255 | columns: inputColumns
|
44256 | }), transforms.push(newTransform);
|
44257 | }
|
44258 | return transforms;
|
44259 | }
|
44260 | }, SemanticQueryRewriter;
|
44261 | }();
|
44262 | data.SemanticQueryRewriter = SemanticQueryRewriter;
|
44263 | }(data = powerbi.data || (powerbi.data = {}));
|
44264 | }(powerbi || (powerbi = {}));
|
44265 | }, function(module, exports) {
|
44266 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
44267 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
44268 | !function(powerbi) {
|
44269 | var data;
|
44270 | !function(data) {
|
44271 | function equals(left, right) {
|
44272 | if (left && right) {
|
44273 | if (isSQFromEntitySource(left) && isSQFromEntitySource(right)) return left.equals(right);
|
44274 | if (isSQFromSubquerySource(left) && isSQFromSubquerySource(right)) return left.equals(right);
|
44275 | }
|
44276 | return left === right;
|
44277 | }
|
44278 | function isSQFromEntitySource(source) {
|
44279 | return null != source.entity;
|
44280 | }
|
44281 | function isSQFromSubquerySource(source) {
|
44282 | return null != source.subquery;
|
44283 | }
|
44284 | var ArrayExtensions = jsCommon.ArrayExtensions, SQFromEntitySource = function() {
|
44285 | function SQFromEntitySource(schema, entity) {
|
44286 | this.schema = schema, this.entity = entity;
|
44287 | }
|
44288 | return SQFromEntitySource.prototype.accept = function(visitor, arg) {
|
44289 | return visitor.visitEntity(this, arg);
|
44290 | }, SQFromEntitySource.prototype.equals = function(source) {
|
44291 | return source && this.entity === source.entity && this.schema === source.schema;
|
44292 | }, SQFromEntitySource;
|
44293 | }();
|
44294 | data.SQFromEntitySource = SQFromEntitySource;
|
44295 | var SQFromSubquerySource = function() {
|
44296 | function SQFromSubquerySource(subquery) {
|
44297 | this.subquery = subquery;
|
44298 | }
|
44299 | return SQFromSubquerySource.prototype.accept = function(visitor, arg) {
|
44300 | return visitor.visitSubquery(this, arg);
|
44301 | }, SQFromSubquerySource.prototype.equals = function(source) {
|
44302 | return source && data.SemanticQuery.equals(this.subquery, source.subquery);
|
44303 | }, SQFromSubquerySource;
|
44304 | }();
|
44305 | data.SQFromSubquerySource = SQFromSubquerySource;
|
44306 | var SQFrom = function() {
|
44307 | function SQFrom(items) {
|
44308 | this.items = items || {};
|
44309 | }
|
44310 | return SQFrom.prototype.keys = function() {
|
44311 | return Object.keys(this.items);
|
44312 | }, SQFrom.prototype.source = function(key) {
|
44313 | return this.items[key];
|
44314 | }, SQFrom.prototype.sources = function() {
|
44315 | return this.items;
|
44316 | }, SQFrom.prototype.ensureSource = function(source, desiredVariableName) {
|
44317 | var key = this.getSourceKeyFromItems(source);
|
44318 | if (key) return {
|
44319 | name: key
|
44320 | };
|
44321 | var uniqueName = this.addSource(source, desiredVariableName);
|
44322 | return {
|
44323 | name: uniqueName,
|
44324 | "new": !0
|
44325 | };
|
44326 | }, SQFrom.prototype.remove = function(key) {
|
44327 | delete this.items[key];
|
44328 | }, SQFrom.prototype.getSourceKeyFromItems = function(source) {
|
44329 | var keys = this.keys();
|
44330 | for (var i in keys) {
|
44331 | var key = keys[i], item = this.items[key];
|
44332 | if (isSQFromEntitySource(item) && isSQFromEntitySource(source) && item.equals(source)) return key;
|
44333 | if (isSQFromSubquerySource(item) && isSQFromSubquerySource(source) && item.equals(source)) return key;
|
44334 | }
|
44335 | }, SQFrom.prototype.addSource = function(source, desiredVariableName) {
|
44336 | for (var candidateName = desiredVariableName || source.accept(new SQFromSourceCandidateNameVisitor(), null), uniqueName = candidateName, usedNames = {}, _i = 0, _a = this.keys(); _i < _a.length; _i++) {
|
44337 | var key = _a[_i];
|
44338 | usedNames[key] = !0;
|
44339 | }
|
44340 | return uniqueName = jsCommon.StringExtensions.findUniqueName(usedNames, uniqueName),
|
44341 | this.items[uniqueName] = source, uniqueName;
|
44342 | }, SQFrom.prototype.clone = function() {
|
44343 | var cloned = new SQFrom();
|
44344 | return $.extend(cloned.items, this.items), cloned;
|
44345 | }, SQFrom.prototype.equals = function(comparand) {
|
44346 | var _this = this;
|
44347 | if (!comparand) return !1;
|
44348 | var localKeys = this.keys(), comparandKeys = comparand.keys();
|
44349 | return localKeys.length !== comparandKeys.length ? !1 : ArrayExtensions.sequenceEqual(localKeys, comparandKeys, function(localKey, comparandKey) {
|
44350 | return equals(_this.source(localKey), comparand.source(comparandKey));
|
44351 | });
|
44352 | }, SQFrom;
|
44353 | }();
|
44354 | data.SQFrom = SQFrom, data.equals = equals, data.isSQFromEntitySource = isSQFromEntitySource,
|
44355 | data.isSQFromSubquerySource = isSQFromSubquerySource;
|
44356 | var SQFromSourceCandidateNameVisitor = function() {
|
44357 | function SQFromSourceCandidateNameVisitor() {}
|
44358 | return SQFromSourceCandidateNameVisitor.prototype.visitEntity = function(source) {
|
44359 | var ref = source.entity, idx = ref.lastIndexOf(".");
|
44360 | return idx >= 0 && idx !== ref.length - 1 && (ref = ref.substr(idx + 1)), ref.substring(0, 1).toLowerCase();
|
44361 | }, SQFromSourceCandidateNameVisitor.prototype.visitSubquery = function(source) {
|
44362 | return "q";
|
44363 | }, SQFromSourceCandidateNameVisitor;
|
44364 | }();
|
44365 | data.SQFromSourceCandidateNameVisitor = SQFromSourceCandidateNameVisitor;
|
44366 | var SQFromEntitiesVisitor = function() {
|
44367 | function SQFromEntitiesVisitor() {
|
44368 | this.entities = [];
|
44369 | }
|
44370 | return SQFromEntitiesVisitor.prototype.visitEntity = function(source, key) {
|
44371 | this.entities.push(new data.SQEntityExpr(source.schema, source.entity, key));
|
44372 | }, SQFromEntitiesVisitor.prototype.visitSubquery = function(source, key) {}, SQFromEntitiesVisitor;
|
44373 | }();
|
44374 | data.SQFromEntitiesVisitor = SQFromEntitiesVisitor;
|
44375 | }(data = powerbi.data || (powerbi.data = {}));
|
44376 | }(powerbi || (powerbi = {}));
|
44377 | }, function(module, exports) {
|
44378 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi, __extends = (window.powerbitests,
|
44379 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
44380 | function __() {
|
44381 | this.constructor = d;
|
44382 | }
|
44383 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
44384 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
44385 | });
|
44386 | !function(powerbi) {
|
44387 | var data;
|
44388 | !function(data) {
|
44389 | var ArrayExtensions = jsCommon.ArrayExtensions, SemanticQuery = function() {
|
44390 | function SemanticQuery(from, where, orderBy, select, groupBy, transformItems) {
|
44391 | this.fromValue = from, this.whereItems = where, this.orderByItems = orderBy, this.selectItems = select,
|
44392 | this.groupByItems = groupBy, this.transformItems = transformItems;
|
44393 | }
|
44394 | return SemanticQuery.create = function() {
|
44395 | return SemanticQuery.empty || (SemanticQuery.empty = new SemanticQuery(new data.SQFrom(), null, null, [], null, null)),
|
44396 | SemanticQuery.empty;
|
44397 | }, SemanticQuery.createWithTrimmedFrom = function(from, where, transform, orderBy, select, groupBy) {
|
44398 | var unreferencedKeyFinder = new UnreferencedKeyFinder(from.keys());
|
44399 | if (where) for (var i = 0, len = where.length; len > i; i++) {
|
44400 | var filter = where[i];
|
44401 | filter.condition.accept(unreferencedKeyFinder);
|
44402 | var filterTarget = filter.target;
|
44403 | if (filterTarget) for (var j = 0, jlen = filterTarget.length; jlen > j; j++) filterTarget[j] && filterTarget[j].accept(unreferencedKeyFinder);
|
44404 | }
|
44405 | if (transform) for (var i = 0, len = transform.length; len > i; i++) {
|
44406 | var table = transform[i].input.table;
|
44407 | if (table && !_.isEmpty(table.columns)) for (var _i = 0, _a = table.columns; _i < _a.length; _i++) {
|
44408 | var column = _a[_i];
|
44409 | column.expression.expr.accept(unreferencedKeyFinder);
|
44410 | }
|
44411 | }
|
44412 | if (orderBy) for (var i = 0, len = orderBy.length; len > i; i++) orderBy[i].expr.accept(unreferencedKeyFinder);
|
44413 | for (var i = 0, len = select.length; len > i; i++) select[i].expr.accept(unreferencedKeyFinder);
|
44414 | if (groupBy) for (var i = 0, len = groupBy.length; len > i; i++) groupBy[i].expr.accept(unreferencedKeyFinder);
|
44415 | for (var unreferencedKeys = unreferencedKeyFinder.result(), i = 0, len = unreferencedKeys.length; len > i; i++) from.remove(unreferencedKeys[i]);
|
44416 | return new SemanticQuery(from, where, orderBy, select, groupBy, transform);
|
44417 | }, SemanticQuery.prototype.from = function() {
|
44418 | return this.fromValue.clone();
|
44419 | }, SemanticQuery.prototype.select = function(values) {
|
44420 | return _.isEmpty(arguments) ? this.getSelect() : this.setSelect(values);
|
44421 | }, SemanticQuery.prototype.getSelect = function() {
|
44422 | return SemanticQuery.createNamedExpressionArray(this.selectItems);
|
44423 | }, SemanticQuery.createNamedExpressionArray = function(items) {
|
44424 | return ArrayExtensions.extendWithName(_.map(items, function(s) {
|
44425 | return {
|
44426 | name: s.name,
|
44427 | expr: s.expr
|
44428 | };
|
44429 | }));
|
44430 | }, SemanticQuery.prototype.setSelect = function(values) {
|
44431 | var from = this.fromValue.clone(), selectItems = SemanticQuery.rewriteExpressionsWithSourceRenames(values, from);
|
44432 | return SemanticQuery.createWithTrimmedFrom(from, this.whereItems, this.transformItems, this.orderByItems, selectItems, this.groupByItems);
|
44433 | }, SemanticQuery.rewriteExpressionsWithSourceRenames = function(values, from) {
|
44434 | for (var items = [], i = 0, len = values.length; len > i; i++) {
|
44435 | var value = values[i];
|
44436 | items.push({
|
44437 | name: value.name,
|
44438 | expr: SQExprRewriterWithSourceRenames.rewrite(value.expr, from)
|
44439 | });
|
44440 | }
|
44441 | return items;
|
44442 | }, SemanticQuery.prototype.removeSelect = function(expr) {
|
44443 | for (var originalItems = this.selectItems, selectItems = [], i = 0, len = originalItems.length; len > i; i++) {
|
44444 | var originalExpr = originalItems[i];
|
44445 | data.SQExpr.equals(originalExpr.expr, expr) || selectItems.push(originalExpr);
|
44446 | }
|
44447 | return SemanticQuery.createWithTrimmedFrom(this.fromValue.clone(), this.whereItems, this.transformItems, this.orderByItems, selectItems, this.groupByItems);
|
44448 | }, SemanticQuery.prototype.removeOrderBy = function(expr) {
|
44449 | for (var sorts = this.orderBy(), i = sorts.length - 1; i >= 0; i--) data.SQExpr.equals(sorts[i].expr, expr) && sorts.splice(i, 1);
|
44450 | return SemanticQuery.createWithTrimmedFrom(this.fromValue.clone(), this.whereItems, this.transformItems, sorts, this.selectItems, this.groupByItems);
|
44451 | }, SemanticQuery.prototype.removeTransform = function(transform) {
|
44452 | for (var transforms = this.transforms(), i = 0, len = transforms.length; len > i; i++) if (transforms[i].name === transform.name) {
|
44453 | transforms.splice(i, 1);
|
44454 | break;
|
44455 | }
|
44456 | return SemanticQuery.createWithTrimmedFrom(this.fromValue.clone(), this.whereItems, transforms, this.orderByItems, this.selectItems, this.groupByItems);
|
44457 | }, SemanticQuery.prototype.selectNameOf = function(expr) {
|
44458 | var index = data.SQExprUtils.indexOfNamedExpr(this.selectItems, expr);
|
44459 | return index >= 0 ? this.selectItems[index].name : void 0;
|
44460 | }, SemanticQuery.prototype.setSelectAt = function(index, expr) {
|
44461 | if (!(index >= this.selectItems.length)) {
|
44462 | var select = this.select(), from = this.fromValue.clone(), originalName = select[index].name;
|
44463 | return select[index] = {
|
44464 | name: originalName,
|
44465 | expr: SQExprRewriterWithSourceRenames.rewrite(expr, from)
|
44466 | }, SemanticQuery.createWithTrimmedFrom(from, this.whereItems, this.transformItems, this.orderByItems, select, this.groupByItems);
|
44467 | }
|
44468 | }, SemanticQuery.prototype.addSelect = function(expr, exprName) {
|
44469 | var selectItems = this.select(), from = this.fromValue.clone();
|
44470 | return selectItems.push(this.createNamedExpr(selectItems, from, expr, exprName)),
|
44471 | SemanticQuery.createWithTrimmedFrom(from, this.whereItems, this.transformItems, this.orderByItems, selectItems, this.groupByItems);
|
44472 | }, SemanticQuery.prototype.createNamedExpr = function(currentNames, from, expr, exprName) {
|
44473 | return {
|
44474 | name: data.SQExprUtils.uniqueName(currentNames, expr, exprName),
|
44475 | expr: SQExprRewriterWithSourceRenames.rewrite(expr, from)
|
44476 | };
|
44477 | }, SemanticQuery.prototype.groupBy = function(values) {
|
44478 | return _.isEmpty(arguments) ? this.getGroupBy() : this.setGroupBy(values);
|
44479 | }, SemanticQuery.prototype.getGroupBy = function() {
|
44480 | return SemanticQuery.createNamedExpressionArray(this.groupByItems);
|
44481 | }, SemanticQuery.prototype.setGroupBy = function(values) {
|
44482 | var from = this.fromValue.clone(), groupByItems = SemanticQuery.rewriteExpressionsWithSourceRenames(values, from);
|
44483 | return SemanticQuery.createWithTrimmedFrom(from, this.whereItems, this.transformItems, this.orderByItems, this.selectItems, groupByItems);
|
44484 | }, SemanticQuery.prototype.addGroupBy = function(expr) {
|
44485 | var groupByItems = this.groupBy(), from = this.fromValue.clone();
|
44486 | return groupByItems.push(this.createNamedExpr(groupByItems, from, expr)), SemanticQuery.createWithTrimmedFrom(from, this.whereItems, this.transformItems, this.orderByItems, this.selectItems, groupByItems);
|
44487 | }, SemanticQuery.prototype.orderBy = function(values) {
|
44488 | return _.isEmpty(arguments) ? this.getOrderBy() : this.setOrderBy(values);
|
44489 | }, SemanticQuery.prototype.getOrderBy = function() {
|
44490 | var result = [], orderBy = this.orderByItems;
|
44491 | if (orderBy) for (var i = 0, len = orderBy.length; len > i; i++) {
|
44492 | var clause = orderBy[i];
|
44493 | result.push({
|
44494 | expr: clause.expr,
|
44495 | direction: clause.direction
|
44496 | });
|
44497 | }
|
44498 | return result;
|
44499 | }, SemanticQuery.prototype.setOrderBy = function(values) {
|
44500 | for (var updatedOrderBy = [], from = this.fromValue.clone(), i = 0, len = values.length; len > i; i++) {
|
44501 | var clause = values[i];
|
44502 | updatedOrderBy.push({
|
44503 | expr: SQExprRewriterWithSourceRenames.rewrite(clause.expr, from),
|
44504 | direction: clause.direction
|
44505 | });
|
44506 | }
|
44507 | return SemanticQuery.createWithTrimmedFrom(from, this.whereItems, this.transformItems, updatedOrderBy, this.selectItems, this.groupByItems);
|
44508 | }, SemanticQuery.prototype.where = function(values) {
|
44509 | return _.isEmpty(arguments) ? this.getWhere() : this.setWhere(values);
|
44510 | }, SemanticQuery.prototype.getWhere = function() {
|
44511 | var result = [], whereItems = this.whereItems;
|
44512 | if (whereItems) for (var i = 0, len = whereItems.length; len > i; i++) result.push(whereItems[i]);
|
44513 | return result;
|
44514 | }, SemanticQuery.prototype.setWhere = function(values) {
|
44515 | for (var updatedWhere = [], from = this.fromValue.clone(), i = 0, len = values.length; len > i; i++) {
|
44516 | var filter = values[i], updatedFilter = {
|
44517 | condition: SQExprRewriterWithSourceRenames.rewrite(filter.condition, from)
|
44518 | }, filterTarget = filter.target;
|
44519 | if (filterTarget) {
|
44520 | updatedFilter.target = [];
|
44521 | for (var j = 0, jlen = filterTarget.length; jlen > j; j++) if (filterTarget[j]) {
|
44522 | var updatedTarget = SQExprRewriterWithSourceRenames.rewrite(filterTarget[j], from);
|
44523 | updatedFilter.target.push(updatedTarget);
|
44524 | }
|
44525 | }
|
44526 | updatedWhere.push(updatedFilter);
|
44527 | }
|
44528 | return SemanticQuery.createWithTrimmedFrom(from, updatedWhere, this.transformItems, this.orderByItems, this.selectItems, this.groupByItems);
|
44529 | }, SemanticQuery.prototype.addWhere = function(filter) {
|
44530 | for (var updatedWhere = this.where(), incomingWhere = filter.where(), from = this.fromValue.clone(), i = 0, len = incomingWhere.length; len > i; i++) {
|
44531 | var clause = incomingWhere[i], updatedClause = {
|
44532 | condition: SQExprRewriterWithSourceRenames.rewrite(clause.condition, from)
|
44533 | };
|
44534 | clause.target && (updatedClause.target = _.map(clause.target, function(t) {
|
44535 | return SQExprRewriterWithSourceRenames.rewrite(t, from);
|
44536 | })), updatedWhere.push(updatedClause);
|
44537 | }
|
44538 | return SemanticQuery.createWithTrimmedFrom(from, updatedWhere, this.transformItems, this.orderByItems, this.selectItems, this.groupByItems);
|
44539 | }, SemanticQuery.prototype.transforms = function(transforms) {
|
44540 | return _.isEmpty(arguments) ? this.getTransforms() : this.setTransforms(transforms);
|
44541 | }, SemanticQuery.prototype.getTransforms = function() {
|
44542 | var transforms = [];
|
44543 | if (!_.isEmpty(this.transformItems)) for (var _i = 0, _a = this.transformItems; _i < _a.length; _i++) {
|
44544 | var transform = _a[_i];
|
44545 | transforms.push(transform);
|
44546 | }
|
44547 | return transforms;
|
44548 | }, SemanticQuery.prototype.setTransforms = function(transforms) {
|
44549 | for (var _this = this, from = this.fromValue.clone(), transformItems = [], _i = 0, transforms_1 = transforms; _i < transforms_1.length; _i++) {
|
44550 | var transform = transforms_1[_i], inputColumns = void 0;
|
44551 | transform.input.table && !_.isEmpty(transform.input.table.columns) && (inputColumns = _.map(transform.input.table.columns, function(c) {
|
44552 | return {
|
44553 | role: c.role,
|
44554 | expression: _this.createNamedExpr(ArrayExtensions.extendWithName([]), from, c.expression.expr, c.expression.name)
|
44555 | };
|
44556 | }));
|
44557 | var newTransform = {
|
44558 | name: transform.name,
|
44559 | algorithm: transform.algorithm,
|
44560 | input: {
|
44561 | parameters: transform.input.parameters
|
44562 | },
|
44563 | output: transform.output
|
44564 | };
|
44565 | transform.input.table && (newTransform.input.table = {
|
44566 | name: transform.input.table.name,
|
44567 | columns: inputColumns
|
44568 | }), transformItems.push(newTransform);
|
44569 | }
|
44570 | return SemanticQuery.createWithTrimmedFrom(from, this.whereItems, transforms, this.orderByItems, this.selectItems, this.groupByItems);
|
44571 | }, SemanticQuery.prototype.rewrite = function(exprRewriter) {
|
44572 | var rewriter = new data.SemanticQueryRewriter(exprRewriter), from = rewriter.rewriteFrom(this.fromValue), where = rewriter.rewriteWhere(this.whereItems, from), orderBy = rewriter.rewriteOrderBy(this.orderByItems, from), select = rewriter.rewriteSelect(this.selectItems, from), groupBy = rewriter.rewriteGroupBy(this.groupByItems, from), transform = rewriter.rewriteTransform(this.transformItems, from);
|
44573 | return SemanticQuery.createWithTrimmedFrom(from, where, transform, orderBy, select, groupBy);
|
44574 | }, SemanticQuery.equals = function(x, y) {
|
44575 | return x.from().equals(y.from()) && ArrayExtensions.sequenceEqual(x.where(), y.where(), data.SQFilter.equals) && ArrayExtensions.sequenceEqual(x.orderBy(), y.orderBy(), data.SQUtils.sqSortDefinitionEquals) && ArrayExtensions.sequenceEqual(x.select(), y.select(), data.SQUtils.namedSQExprEquals) && ArrayExtensions.sequenceEqual(x.groupBy(), y.groupBy(), data.SQUtils.namedSQExprEquals) && ArrayExtensions.sequenceEqual(x.transforms(), y.transforms(), data.SQUtils.sqTransformEquals);
|
44576 | }, SemanticQuery;
|
44577 | }();
|
44578 | data.SemanticQuery = SemanticQuery;
|
44579 | var SemanticFilter = function() {
|
44580 | function SemanticFilter(from, where) {
|
44581 | this.fromValue = from, this.whereItems = where;
|
44582 | }
|
44583 | return SemanticFilter.fromSQExpr = function(contract) {
|
44584 | var from = new data.SQFrom(), rewrittenContract = SQExprRewriterWithSourceRenames.rewrite(contract, from), where = [ {
|
44585 | condition: rewrittenContract
|
44586 | } ];
|
44587 | return new SemanticFilter(from, where);
|
44588 | }, SemanticFilter.getDefaultValueFilter = function(fieldSQExprs) {
|
44589 | return SemanticFilter.getDataViewScopeIdentityComparisonFilters(fieldSQExprs, data.SQExprBuilder.defaultValue());
|
44590 | }, SemanticFilter.getAnyValueFilter = function(fieldSQExprs) {
|
44591 | return SemanticFilter.getDataViewScopeIdentityComparisonFilters(fieldSQExprs, data.SQExprBuilder.anyValue());
|
44592 | }, SemanticFilter.getDataViewScopeIdentityComparisonFilters = function(fieldSQExprs, value) {
|
44593 | if (fieldSQExprs instanceof Array) {
|
44594 | var values = Array.apply(null, Array(fieldSQExprs.length)).map(function() {
|
44595 | return value;
|
44596 | });
|
44597 | return SemanticFilter.fromSQExpr(data.SQExprUtils.getDataViewScopeIdentityComparisonExpr(fieldSQExprs, values));
|
44598 | }
|
44599 | return SemanticFilter.fromSQExpr(data.SQExprBuilder.equal(fieldSQExprs, value));
|
44600 | }, SemanticFilter.prototype.from = function() {
|
44601 | return this.fromValue.clone();
|
44602 | }, SemanticFilter.prototype.conditions = function() {
|
44603 | for (var expressions = [], where = this.whereItems, i = 0, len = where.length; len > i; i++) {
|
44604 | var filter = where[i];
|
44605 | expressions.push(filter.condition);
|
44606 | }
|
44607 | return expressions;
|
44608 | }, SemanticFilter.prototype.where = function() {
|
44609 | for (var result = [], whereItems = this.whereItems, i = 0, len = whereItems.length; len > i; i++) result.push(whereItems[i]);
|
44610 | return result;
|
44611 | }, SemanticFilter.prototype.rewrite = function(exprRewriter) {
|
44612 | var rewriter = new data.SemanticQueryRewriter(exprRewriter), from = rewriter.rewriteFrom(this.fromValue), where = rewriter.rewriteWhere(this.whereItems, from);
|
44613 | return new SemanticFilter(from, where);
|
44614 | }, SemanticFilter.prototype.validate = function(schema, aggrUtils, errors) {
|
44615 | var validator = new data.SQExprValidationVisitor(schema, aggrUtils, errors);
|
44616 | return this.rewrite(validator), validator.errors;
|
44617 | }, SemanticFilter.merge = function(filters) {
|
44618 | if (_.isEmpty(filters)) return null;
|
44619 | if (1 === filters.length) return filters[0];
|
44620 | for (var firstFilter = filters[0], from = firstFilter.from(), where = ArrayExtensions.take(firstFilter.whereItems, firstFilter.whereItems.length), i = 1, len = filters.length; len > i; i++) SemanticFilter.applyFilter(filters[i], from, where);
|
44621 | return new SemanticFilter(from, where);
|
44622 | }, SemanticFilter.isDefaultFilter = function(filter) {
|
44623 | return filter && 1 === filter.where().length ? data.SQExprUtils.isDefaultValue(filter.where()[0].condition) : !1;
|
44624 | }, SemanticFilter.isAnyFilter = function(filter) {
|
44625 | return filter && 1 === filter.where().length ? data.SQExprUtils.isAnyValue(filter.where()[0].condition) : !1;
|
44626 | }, SemanticFilter.isSameFilter = function(leftFilter, rightFilter) {
|
44627 | return jsCommon.JsonComparer.equals(leftFilter, rightFilter) ? !(SemanticFilter.isDefaultFilter(leftFilter) && SemanticFilter.isAnyFilter(rightFilter) || SemanticFilter.isAnyFilter(leftFilter) && SemanticFilter.isDefaultFilter(rightFilter)) : !1;
|
44628 | }, SemanticFilter.applyFilter = function(filter, from, where) {
|
44629 | for (var filterWhereItems = filter.whereItems, i = 0; i < filterWhereItems.length; i++) {
|
44630 | var filterWhereItem = filterWhereItems[i], updatedWhereItem = {
|
44631 | condition: SQExprRewriterWithSourceRenames.rewrite(filterWhereItem.condition, from)
|
44632 | };
|
44633 | filterWhereItem.target && (updatedWhereItem.target = _.map(filterWhereItem.target, function(e) {
|
44634 | return SQExprRewriterWithSourceRenames.rewrite(e, from);
|
44635 | })), where.push(updatedWhereItem);
|
44636 | }
|
44637 | }, SemanticFilter;
|
44638 | }();
|
44639 | data.SemanticFilter = SemanticFilter;
|
44640 | var SQExprRewriterWithSourceRenames = function(_super) {
|
44641 | function SQExprRewriterWithSourceRenames(renames) {
|
44642 | _super.call(this), this.renames = renames;
|
44643 | }
|
44644 | return __extends(SQExprRewriterWithSourceRenames, _super), SQExprRewriterWithSourceRenames.prototype.visitEntity = function(expr) {
|
44645 | var updatedName = this.renames[expr.entity];
|
44646 | return updatedName ? new data.SQEntityExpr(expr.schema, expr.entity, updatedName) : _super.prototype.visitEntity.call(this, expr);
|
44647 | }, SQExprRewriterWithSourceRenames.prototype.rewriteFilter = function(filter) {
|
44648 | var updatedTargets = void 0;
|
44649 | filter.target && (updatedTargets = this.rewriteArray(filter.target));
|
44650 | var updatedCondition = filter.condition.accept(this);
|
44651 | if (filter.condition === updatedCondition && filter.target === updatedTargets) return filter;
|
44652 | var updatedFilter = {
|
44653 | condition: updatedCondition
|
44654 | };
|
44655 | return updatedTargets && (updatedFilter.target = updatedTargets), updatedFilter;
|
44656 | }, SQExprRewriterWithSourceRenames.prototype.rewriteArray = function(exprs) {
|
44657 | for (var updatedExprs, i = 0, len = exprs.length; len > i; i++) {
|
44658 | var expr = exprs[i], rewrittenExpr = expr.accept(this);
|
44659 | expr === rewrittenExpr || updatedExprs || (updatedExprs = ArrayExtensions.take(exprs, i)),
|
44660 | updatedExprs && updatedExprs.push(rewrittenExpr);
|
44661 | }
|
44662 | return updatedExprs || exprs;
|
44663 | }, SQExprRewriterWithSourceRenames.rewrite = function(expr, from) {
|
44664 | var renames = QuerySourceRenameDetector.run(expr, from), rewriter = new SQExprRewriterWithSourceRenames(renames);
|
44665 | return expr.accept(rewriter);
|
44666 | }, SQExprRewriterWithSourceRenames;
|
44667 | }(data.SQExprRewriter);
|
44668 | data.SQExprRewriterWithSourceRenames = SQExprRewriterWithSourceRenames;
|
44669 | var QuerySourceRenameDetector = function(_super) {
|
44670 | function QuerySourceRenameDetector(from) {
|
44671 | _super.call(this), this.from = from, this.renames = {};
|
44672 | }
|
44673 | return __extends(QuerySourceRenameDetector, _super), QuerySourceRenameDetector.run = function(expr, from) {
|
44674 | var detector = new QuerySourceRenameDetector(from);
|
44675 | return expr.accept(detector), detector.renames;
|
44676 | }, QuerySourceRenameDetector.prototype.visitEntity = function(expr) {
|
44677 | var existingEntity = this.from.source(expr.variable);
|
44678 | if (!existingEntity || !data.isSQFromEntitySource(existingEntity) || existingEntity.schema !== expr.schema || existingEntity.entity !== expr.entity) {
|
44679 | var actualEntity = this.from.ensureSource(new data.SQFromEntitySource(expr.schema, expr.entity), expr.variable);
|
44680 | this.renames[expr.entity] = actualEntity.name;
|
44681 | }
|
44682 | }, QuerySourceRenameDetector;
|
44683 | }(data.DefaultSQExprVisitorWithTraversal), UnreferencedKeyFinder = function(_super) {
|
44684 | function UnreferencedKeyFinder(keys) {
|
44685 | _super.call(this), this.keys = keys;
|
44686 | }
|
44687 | return __extends(UnreferencedKeyFinder, _super), UnreferencedKeyFinder.prototype.visitEntity = function(expr) {
|
44688 | var index = this.keys.indexOf(expr.variable);
|
44689 | index >= 0 && this.keys.splice(index, 1);
|
44690 | }, UnreferencedKeyFinder.prototype.result = function() {
|
44691 | return this.keys;
|
44692 | }, UnreferencedKeyFinder;
|
44693 | }(data.DefaultSQExprVisitorWithTraversal);
|
44694 | }(data = powerbi.data || (powerbi.data = {}));
|
44695 | }(powerbi || (powerbi = {}));
|
44696 | }, function(module, exports) {
|
44697 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
44698 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
44699 | !function(powerbi) {
|
44700 | var data;
|
44701 | !function(data) {
|
44702 | var SQFilter, ArrayExtensions = jsCommon.ArrayExtensions;
|
44703 | !function(SQFilter) {
|
44704 | function equals(leftFilter, rightFilter) {
|
44705 | return leftFilter || (leftFilter = null), rightFilter || (rightFilter = null), leftFilter === rightFilter ? !0 : !!leftFilter != !!rightFilter ? !1 : targetsEqual(leftFilter, rightFilter) ? data.SQExpr.equals(leftFilter.condition, rightFilter.condition) : !1;
|
44706 | }
|
44707 | function targetsEqual(leftFilter, rightFilter) {
|
44708 | return ArrayExtensions.sequenceEqual(leftFilter.target, rightFilter.target, data.SQExpr.equals);
|
44709 | }
|
44710 | function contains(filters, searchTarget) {
|
44711 | return !_.isEmpty(filters) && _.any(filters, function(filter) {
|
44712 | return equals(filter, searchTarget);
|
44713 | });
|
44714 | }
|
44715 | SQFilter.equals = equals, SQFilter.targetsEqual = targetsEqual, SQFilter.contains = contains;
|
44716 | }(SQFilter = data.SQFilter || (data.SQFilter = {}));
|
44717 | }(data = powerbi.data || (powerbi.data = {}));
|
44718 | }(powerbi || (powerbi = {}));
|
44719 | }, function(module, exports) {
|
44720 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
44721 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
44722 | !function(powerbi) {
|
44723 | var data;
|
44724 | !function(data) {
|
44725 | var SQUtils, ArrayExtensions = jsCommon.ArrayExtensions;
|
44726 | !function(SQUtils) {
|
44727 | function sqSortDefinitionEquals(left, right) {
|
44728 | return left || right ? left && right ? left.direction === right.direction && data.SQExpr.equals(left.expr, right.expr) : !1 : !0;
|
44729 | }
|
44730 | function namedSQExprEquals(left, right) {
|
44731 | return left || right ? left && right ? data.SQExpr.equals(left.expr, right.expr) : !1 : !0;
|
44732 | }
|
44733 | function sqTransformTableColumnsEquals(left, right) {
|
44734 | return left || right ? left && right ? left.role === right.role && namedSQExprEquals(left.expression, right.expression) : !1 : !0;
|
44735 | }
|
44736 | function sqTransformTableEquals(left, right) {
|
44737 | return left || right ? left && right ? ArrayExtensions.sequenceEqual(left.columns, right.columns, function(left, right) {
|
44738 | return sqTransformTableColumnsEquals(left, right);
|
44739 | }) : !1 : !0;
|
44740 | }
|
44741 | function sqTransformInputEquals(left, right) {
|
44742 | return left || right ? left && right ? ArrayExtensions.sequenceEqual(left.parameters, right.parameters, function(left, right) {
|
44743 | return namedSQExprEquals(left, right);
|
44744 | }) && sqTransformTableEquals(left.table, right.table) : !1 : !0;
|
44745 | }
|
44746 | function sqTransformOutputEquals(left, right) {
|
44747 | return left || right ? left && right ? sqTransformTableEquals(left.table, right.table) : !1 : !0;
|
44748 | }
|
44749 | function sqTransformEquals(left, right) {
|
44750 | return left || right ? left && right ? left.algorithm === right.algorithm && sqTransformInputEquals(left.input, right.input) && sqTransformOutputEquals(left.output, right.output) : !1 : !0;
|
44751 | }
|
44752 | SQUtils.sqSortDefinitionEquals = sqSortDefinitionEquals, SQUtils.namedSQExprEquals = namedSQExprEquals,
|
44753 | SQUtils.sqTransformTableColumnsEquals = sqTransformTableColumnsEquals, SQUtils.sqTransformTableEquals = sqTransformTableEquals,
|
44754 | SQUtils.sqTransformInputEquals = sqTransformInputEquals, SQUtils.sqTransformOutputEquals = sqTransformOutputEquals,
|
44755 | SQUtils.sqTransformEquals = sqTransformEquals;
|
44756 | }(SQUtils = data.SQUtils || (data.SQUtils = {}));
|
44757 | }(data = powerbi.data || (powerbi.data = {}));
|
44758 | }(powerbi || (powerbi = {}));
|
44759 | }, function(module, exports) {
|
44760 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
44761 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
44762 | !function(powerbi) {
|
44763 | var data;
|
44764 | !function(data) {
|
44765 | function createCategoricalDataViewBuilder() {
|
44766 | return new CategoricalDataViewBuilder();
|
44767 | }
|
44768 | function getScopeIdentity(source, index, value, valueType) {
|
44769 | var identities = source.identities;
|
44770 | return identities ? identities[index] : data.createDataViewScopeIdentity(SQExprBuilder.equal(source.fields[0], SQExprBuilder.typedConstant(value, valueType)));
|
44771 | }
|
44772 | function pushIfNotExists(items, itemToAdd) {
|
44773 | _.contains(items, itemToAdd) || items.push(itemToAdd);
|
44774 | }
|
44775 | function applySeriesData(target, source, categoryLength) {
|
44776 | var values = source.values;
|
44777 | target.values = values;
|
44778 | var highlights = source.highlights;
|
44779 | highlights && (target.highlights = highlights);
|
44780 | var aggregates;
|
44781 | void 0 !== source.minLocal && (aggregates || (aggregates = {}), aggregates.minLocal = source.minLocal),
|
44782 | void 0 !== source.maxLocal && (aggregates || (aggregates = {}), aggregates.maxLocal = source.maxLocal),
|
44783 | aggregates && (target.source.aggregates = aggregates, _.extend(target, aggregates));
|
44784 | }
|
44785 | var DataViewTransform = powerbi.data.DataViewTransform, SQExprBuilder = powerbi.data.SQExprBuilder;
|
44786 | data.createCategoricalDataViewBuilder = createCategoricalDataViewBuilder;
|
44787 | var CategoricalDataViewBuilder = function() {
|
44788 | function CategoricalDataViewBuilder() {
|
44789 | this.categories = [], this.staticMeasureColumns = [], this.dynamicMeasureColumns = [],
|
44790 | this.columnIndex = 0;
|
44791 | }
|
44792 | return CategoricalDataViewBuilder.prototype.withCategory = function(options) {
|
44793 | var categoryValues = options.values, identityFrom = options.identityFrom, type = options.source.type, categoryColumn = {
|
44794 | source: options.source,
|
44795 | identityFields: options.identityFrom.fields,
|
44796 | identity: options.identityFrom.identities || [],
|
44797 | values: categoryValues
|
44798 | };
|
44799 | if (!options.identityFrom.identities) for (var categoryIndex = 0, categoryLength = categoryValues.length; categoryLength > categoryIndex; categoryIndex++) categoryColumn.identity.push(getScopeIdentity(identityFrom, categoryIndex, categoryValues[categoryIndex], type));
|
44800 | return this.categories || (this.categories = []), this.categories.push(categoryColumn),
|
44801 | this;
|
44802 | }, CategoricalDataViewBuilder.prototype.withCategories = function(categories) {
|
44803 | return _.isEmpty(this.categories) ? this.categories = categories : Array.prototype.push.apply(this.categories, categories),
|
44804 | this;
|
44805 | }, CategoricalDataViewBuilder.prototype.withValues = function(options) {
|
44806 | for (var columns = options.columns, _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
|
44807 | var column = columns_1[_i];
|
44808 | this.staticMeasureColumns.push(column.source);
|
44809 | }
|
44810 | return this.staticSeriesValues = columns, this;
|
44811 | }, CategoricalDataViewBuilder.prototype.withGroupedValues = function(options) {
|
44812 | var groupColumn = options.groupColumn;
|
44813 | this.dynamicSeriesMetadata = {
|
44814 | column: groupColumn.source,
|
44815 | identityFrom: groupColumn.identityFrom,
|
44816 | values: groupColumn.values
|
44817 | };
|
44818 | for (var valueColumns = options.valueColumns, _i = 0, valueColumns_1 = valueColumns; _i < valueColumns_1.length; _i++) {
|
44819 | var valueColumn = valueColumns_1[_i];
|
44820 | this.dynamicMeasureColumns.push(valueColumn.source);
|
44821 | }
|
44822 | return this.dynamicSeriesValues = options.data, this;
|
44823 | }, CategoricalDataViewBuilder.prototype.fillData = function(dataViewValues) {
|
44824 | var categoryColumn = _.first(this.categories), categoryLength = categoryColumn && categoryColumn.values ? categoryColumn.values.length : 0;
|
44825 | if (this.hasDynamicSeries()) for (var seriesIndex = 0; seriesIndex < this.dynamicSeriesMetadata.values.length; seriesIndex++) for (var seriesMeasures = this.dynamicSeriesValues[seriesIndex], measureIndex = 0, measuresLen = this.dynamicMeasureColumns.length; measuresLen > measureIndex; measureIndex++) {
|
44826 | var groupIndex = seriesIndex * measuresLen + measureIndex;
|
44827 | applySeriesData(dataViewValues[groupIndex], seriesMeasures[measureIndex], categoryLength);
|
44828 | }
|
44829 | if (this.hasStaticSeries()) for (var staticColumnsStartingIndex = this.hasDynamicSeries() ? this.dynamicSeriesValues.length * this.dynamicMeasureColumns.length : 0, measureIndex = 0, measuresLen = this.staticMeasureColumns.length; measuresLen > measureIndex; measureIndex++) applySeriesData(dataViewValues[staticColumnsStartingIndex + measureIndex], this.staticSeriesValues[measureIndex], categoryLength);
|
44830 | }, CategoricalDataViewBuilder.prototype.build = function() {
|
44831 | for (var metadataColumns = [], categorical = {}, categoryMetadata = this.categories, dynamicSeriesMetadata = this.dynamicSeriesMetadata, _i = 0, categoryMetadata_1 = categoryMetadata; _i < categoryMetadata_1.length; _i++) {
|
44832 | var columnMetadata = categoryMetadata_1[_i];
|
44833 | pushIfNotExists(metadataColumns, columnMetadata.source);
|
44834 | }
|
44835 | if (this.hasDynamicSeries()) {
|
44836 | pushIfNotExists(metadataColumns, dynamicSeriesMetadata.column), categorical.values = DataViewTransform.createValueColumns([], dynamicSeriesMetadata.identityFrom.fields, dynamicSeriesMetadata.column);
|
44837 | for (var seriesValues = dynamicSeriesMetadata.values, seriesIndex = 0; seriesIndex < seriesValues.length; seriesIndex++) for (var seriesValue = seriesValues[seriesIndex], seriesIdentity = getScopeIdentity(dynamicSeriesMetadata.identityFrom, seriesIndex, seriesValue, dynamicSeriesMetadata.column.type), _a = 0, _b = this.dynamicMeasureColumns; _a < _b.length; _a++) {
|
44838 | var measure = _b[_a], column = _.toPlainObject(measure);
|
44839 | column.groupName = seriesValue, pushIfNotExists(metadataColumns, column), categorical.values.push({
|
44840 | source: column,
|
44841 | values: [],
|
44842 | identity: seriesIdentity
|
44843 | });
|
44844 | }
|
44845 | if (this.hasStaticSeries()) {
|
44846 | var dynamicSeriesGroups_1 = categorical.values.grouped();
|
44847 | categorical.values.grouped = function() {
|
44848 | return dynamicSeriesGroups_1;
|
44849 | }, this.appendStaticMeasureColumns(metadataColumns, categorical.values);
|
44850 | }
|
44851 | } else categorical.values = DataViewTransform.createValueColumns(), this.appendStaticMeasureColumns(metadataColumns, categorical.values);
|
44852 | var categories = this.categories;
|
44853 | _.isEmpty(categories) || (categorical.categories = categories), this.fillData(categorical.values);
|
44854 | var dataView = {
|
44855 | metadata: {
|
44856 | columns: metadataColumns
|
44857 | },
|
44858 | categorical: categorical
|
44859 | };
|
44860 | return this.isLegalDataView(dataView) ? dataView : void 0;
|
44861 | }, CategoricalDataViewBuilder.prototype.appendStaticMeasureColumns = function(metadataColumns, valueColumns) {
|
44862 | if (!_.isEmpty(this.staticMeasureColumns)) for (var _i = 0, _a = this.staticMeasureColumns; _i < _a.length; _i++) {
|
44863 | var column = _a[_i];
|
44864 | pushIfNotExists(metadataColumns, column), valueColumns.push({
|
44865 | source: column,
|
44866 | values: []
|
44867 | });
|
44868 | }
|
44869 | }, CategoricalDataViewBuilder.prototype.isLegalDataView = function(dataView) {
|
44870 | return !(this.hasDynamicSeries() && this.hasStaticSeries() && CategoricalDataViewBuilder.isVisualDataView(dataView.metadata.columns));
|
44871 | }, CategoricalDataViewBuilder.isVisualDataView = function(metadataColumns) {
|
44872 | return !_.isEmpty(metadataColumns) && _.any(metadataColumns, function(metadataColumn) {
|
44873 | return !!metadataColumn.queryName;
|
44874 | });
|
44875 | }, CategoricalDataViewBuilder.prototype.hasDynamicSeries = function() {
|
44876 | return !!this.dynamicSeriesMetadata;
|
44877 | }, CategoricalDataViewBuilder.prototype.hasStaticSeries = function() {
|
44878 | return !!this.staticSeriesValues;
|
44879 | }, CategoricalDataViewBuilder;
|
44880 | }();
|
44881 | }(data = powerbi.data || (powerbi.data = {}));
|
44882 | }(powerbi || (powerbi = {}));
|
44883 | }, function(module, exports) {
|
44884 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
44885 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
44886 | !function(powerbi) {
|
44887 | var data;
|
44888 | !function(data) {
|
44889 | function createStaticEvalContext(colorAllocatorCache, dataView, selectTransforms) {
|
44890 | return new StaticEvalContext(colorAllocatorCache || data.createColorAllocatorCache(), dataView || {
|
44891 | metadata: {
|
44892 | columns: []
|
44893 | }
|
44894 | }, selectTransforms);
|
44895 | }
|
44896 | function getExprValueFromTable(expr, selectTransforms, table, rowIdx) {
|
44897 | var rows = table.rows;
|
44898 | if (!(_.isEmpty(rows) || rows.length <= rowIdx)) {
|
44899 | var cols = table.columns, selectIdx = findSelectIndex(expr, selectTransforms);
|
44900 | if (!(0 > selectIdx)) for (var colIdx = 0, colLen = cols.length; colLen > colIdx; colIdx++) if (selectIdx === cols[colIdx].index) return rows[rowIdx][colIdx];
|
44901 | }
|
44902 | }
|
44903 | function findAggregateValue(expr, selectTransforms, columns) {
|
44904 | var selectIdx = findSelectIndex(expr.arg, selectTransforms);
|
44905 | if (!(0 > selectIdx)) for (var colIdx = 0, colLen = columns.length; colLen > colIdx; colIdx++) {
|
44906 | var column = columns[colIdx], columnAggr = column.aggregates;
|
44907 | if (selectIdx === column.index && columnAggr) {
|
44908 | var aggregateValue = findAggregates(columnAggr, expr);
|
44909 | if (void 0 !== aggregateValue) return aggregateValue;
|
44910 | }
|
44911 | }
|
44912 | }
|
44913 | function findSelectIndex(expr, selectTransforms) {
|
44914 | var queryName;
|
44915 | SQExpr.isSelectRef(expr) && (queryName = expr.expressionName);
|
44916 | for (var selectIdx = 0, selectLen = selectTransforms.length; selectLen > selectIdx; selectIdx++) {
|
44917 | var selectTransform = selectTransforms[selectIdx];
|
44918 | if (selectTransform && (!queryName || selectTransform.queryName)) if (queryName) {
|
44919 | if (selectTransform.queryName === queryName) return selectIdx;
|
44920 | } else if (SQExpr.equals(selectTransform.expr, expr)) return selectIdx;
|
44921 | }
|
44922 | return -1;
|
44923 | }
|
44924 | function findAggregates(aggregates, expr) {
|
44925 | if (SQExpr.isPercentile(expr)) {
|
44926 | var percentile = _.find(aggregates.percentiles, function(percentile) {
|
44927 | return percentile.exclusive === expr.exclusive && percentile.k === expr.k ? !0 : void 0;
|
44928 | });
|
44929 | if (percentile) return percentile.value;
|
44930 | } else if (SQExpr.isAggregation(expr)) switch (expr.func) {
|
44931 | case data.QueryAggregateFunction.Min:
|
44932 | return getOptional(aggregates.min, aggregates.minLocal);
|
44933 |
|
44934 | case data.QueryAggregateFunction.Max:
|
44935 | return getOptional(aggregates.max, aggregates.maxLocal);
|
44936 | }
|
44937 | }
|
44938 | function getOptional(value1, value2) {
|
44939 | return void 0 !== value1 ? value1 : value2;
|
44940 | }
|
44941 | var SQExpr = powerbi.data.SQExpr;
|
44942 | data.createStaticEvalContext = createStaticEvalContext;
|
44943 | var StaticEvalContext = function() {
|
44944 | function StaticEvalContext(colorAllocatorCache, dataView, selectTransforms) {
|
44945 | this.colorAllocatorCache = colorAllocatorCache, this.dataView = dataView, this.selectTransforms = selectTransforms;
|
44946 | }
|
44947 | return StaticEvalContext.prototype.getColorAllocator = function(expr) {
|
44948 | return this.colorAllocatorCache.get(expr);
|
44949 | }, StaticEvalContext.prototype.getExprValue = function(expr) {
|
44950 | var dataView = this.dataView, selectTransforms = this.selectTransforms;
|
44951 | if (dataView && selectTransforms) {
|
44952 | if (SQExpr.isAggregation(expr) || SQExpr.isPercentile(expr)) {
|
44953 | var columnAggregate = findAggregateValue(expr, selectTransforms, dataView.metadata.columns);
|
44954 | if (void 0 !== columnAggregate) return columnAggregate;
|
44955 | }
|
44956 | return dataView.table ? getExprValueFromTable(expr, selectTransforms, dataView.table, 0) : void 0;
|
44957 | }
|
44958 | }, StaticEvalContext.prototype.getRoleValue = function(roleName) {}, StaticEvalContext;
|
44959 | }();
|
44960 | data.getExprValueFromTable = getExprValueFromTable, data.findSelectIndex = findSelectIndex;
|
44961 | }(data = powerbi.data || (powerbi.data = {}));
|
44962 | }(powerbi || (powerbi = {}));
|
44963 | }, function(module, exports) {
|
44964 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
44965 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
44966 | !function(powerbi) {
|
44967 | var data;
|
44968 | !function(data) {
|
44969 | function createMatrixEvalContext(colorAllocatorProvider, dataViewMatrix) {
|
44970 | return data.createStaticEvalContext(colorAllocatorProvider);
|
44971 | }
|
44972 | data.createMatrixEvalContext = createMatrixEvalContext;
|
44973 | }(data = powerbi.data || (powerbi.data = {}));
|
44974 | }(powerbi || (powerbi = {}));
|
44975 | }, function(module, exports) {
|
44976 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
44977 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
44978 | !function(powerbi_1) {
|
44979 | var FormattingEncoder, StringExtensions = jsCommon.StringExtensions, Formatting = jsCommon.Formatting, RegExpExtensions = jsCommon.RegExpExtensions;
|
44980 | !function(FormattingEncoder) {
|
44981 | function removeLiterals(format) {
|
44982 | return literalMatcher.lastIndex = 0, format.replace(literalMatcher, "");
|
44983 | }
|
44984 | function preserveLiterals(format, literals) {
|
44985 | for (literalMatcher.lastIndex = 0; ;) {
|
44986 | var match = literalMatcher.exec(format);
|
44987 | if (!match) break;
|
44988 | var literal = match[0], literalOffset = literalMatcher.lastIndex - literal.length, token = String.fromCharCode(57600 + literals.length);
|
44989 | literals.push(literal), format = format.substr(0, literalOffset) + token + format.substr(literalMatcher.lastIndex),
|
44990 | literalMatcher.lastIndex = literalOffset + 1;
|
44991 | }
|
44992 | return format;
|
44993 | }
|
44994 | function restoreLiterals(format, literals, quoted) {
|
44995 | void 0 === quoted && (quoted = !0);
|
44996 | for (var count = literals.length, i = 0; count > i; i++) {
|
44997 | var token = String.fromCharCode(57600 + i), literal = literals[i];
|
44998 | if (!quoted) {
|
44999 | var firstChar = literal[0];
|
45000 | literal = "\\" === firstChar || 1 === literal.length || literal[literal.length - 1] !== firstChar ? literal.substring(1) : literal.substring(1, literal.length - 1);
|
45001 | }
|
45002 | format = format.replace(token, literal);
|
45003 | }
|
45004 | return format;
|
45005 | }
|
45006 | var literalPatterns = [ "'[^']*'", '"[^"]*"', "\\\\.", "'[^']*$", '"[^"]*$', "\\\\$" ], literalMatcher = new RegExp(literalPatterns.join("|"), "g");
|
45007 | FormattingEncoder.removeLiterals = removeLiterals, FormattingEncoder.preserveLiterals = preserveLiterals,
|
45008 | FormattingEncoder.restoreLiterals = restoreLiterals;
|
45009 | }(FormattingEncoder || (FormattingEncoder = {}));
|
45010 | var DateTimeFormat, IndexedTokensRegex = /({{)|(}})|{(\d+[^}]*)}/g, ZeroPlaceholder = "0", DigitPlaceholder = "#", ExponentialFormatChar = "E", NumericPlaceholders = [ ZeroPlaceholder, DigitPlaceholder ], NumericPlaceholderRegex = new RegExp(NumericPlaceholders.join("|"), "g"), FormattingService = function() {
|
45011 | function FormattingService() {}
|
45012 | return FormattingService.prototype.formatValue = function(value, format, culture) {
|
45013 | if (void 0 === value || null === value) return "";
|
45014 | var gculture = this.getCulture(culture);
|
45015 | return DateTimeFormat.canFormat(value) ? DateTimeFormat.format(value, format, gculture) : NumberFormat.canFormat(value) ? NumberFormat.format(value, format, gculture) : value.toString();
|
45016 | }, FormattingService.prototype.format = function(formatWithIndexedTokens, args, culture) {
|
45017 | var _this = this;
|
45018 | if (!formatWithIndexedTokens) return "";
|
45019 | var result = formatWithIndexedTokens.replace(IndexedTokensRegex, function(match, left, right, argToken) {
|
45020 | if (left) return "{";
|
45021 | if (right) return "}";
|
45022 | var parts = argToken.split(":"), argIndex = parseInt(parts[0], 10), argFormat = parts[1];
|
45023 | return _this.formatValue(args[argIndex], argFormat, culture);
|
45024 | });
|
45025 | return result;
|
45026 | }, FormattingService.prototype.isStandardNumberFormat = function(format) {
|
45027 | return NumberFormat.isStandardFormat(format);
|
45028 | }, FormattingService.prototype.formatNumberWithCustomOverride = function(value, format, nonScientificOverrideFormat, culture) {
|
45029 | var gculture = this.getCulture(culture);
|
45030 | return NumberFormat.formatWithCustomOverride(value, format, nonScientificOverrideFormat, gculture);
|
45031 | }, FormattingService.prototype.dateFormatString = function(unit) {
|
45032 | return this._dateTimeScaleFormatInfo || this.initialize(), this._dateTimeScaleFormatInfo.getFormatString(unit);
|
45033 | }, FormattingService.prototype.setCurrentCulture = function(cultureSelector) {
|
45034 | this._currentCultureSelector !== cultureSelector && (this._currentCulture = this.getCulture(cultureSelector),
|
45035 | this._currentCultureSelector = cultureSelector, this._dateTimeScaleFormatInfo = new DateTimeScaleFormatInfo(this._currentCulture));
|
45036 | }, FormattingService.prototype.getCulture = function(cultureSelector) {
|
45037 | if (null == cultureSelector) return null == this._currentCulture && this.initialize(),
|
45038 | this._currentCulture;
|
45039 | var culture = Globalize.findClosestCulture(cultureSelector);
|
45040 | return culture || (culture = Globalize.culture("en-US")), culture;
|
45041 | }, FormattingService.prototype.initialize = function() {
|
45042 | var cultureName = this.getCurrentCulture();
|
45043 | this.setCurrentCulture(cultureName);
|
45044 | var calendarName = this.getUrlParam("calendar");
|
45045 | if (calendarName) {
|
45046 | var culture = this._currentCulture, c = culture.calendars[calendarName];
|
45047 | c && (culture.calendar = c);
|
45048 | }
|
45049 | }, FormattingService.prototype.getCurrentCulture = function() {
|
45050 | var urlParam = this.getUrlParam("language");
|
45051 | return urlParam ? urlParam : powerbi && powerbi.common && powerbi.common.cultureInfo ? powerbi.common.cultureInfo : window.navigator.userLanguage || window.navigator.language || Globalize.culture().name;
|
45052 | }, FormattingService.prototype.getUrlParam = function(name) {
|
45053 | var param = window.location.search.match(RegExp("[?&]" + name + "=([^&]*)"));
|
45054 | return param ? param[1] : void 0;
|
45055 | }, FormattingService;
|
45056 | }();
|
45057 | !function(DateTimeFormat) {
|
45058 | function canFormat(value) {
|
45059 | var result = value instanceof Date;
|
45060 | return result;
|
45061 | }
|
45062 | function format(value, format, culture) {
|
45063 | format = format || "G";
|
45064 | var isStandard = 1 === format.length;
|
45065 | try {
|
45066 | return isStandard ? formatDateStandard(value, format, culture) : formatDateCustom(value, format, culture);
|
45067 | } catch (e) {
|
45068 | return formatDateStandard(value, "G", culture);
|
45069 | }
|
45070 | }
|
45071 | function formatDateStandard(value, format, culture) {
|
45072 | var patterns = culture.calendar.patterns;
|
45073 | ensurePatterns(culture.calendar);
|
45074 | var output = Formatting.findDateFormat(value, format, culture.name);
|
45075 | return format = 1 === output.format.length ? patterns[output.format] : output.format,
|
45076 | culture = Globalize.culture("en-US"), Globalize.format(output.value, format, culture);
|
45077 | }
|
45078 | function formatDateCustom(value, format, culture) {
|
45079 | var result, literals = [];
|
45080 | if (format = FormattingEncoder.preserveLiterals(format, literals), format.indexOf("F") > -1) {
|
45081 | format = StringExtensions.replaceAll(format, "FFFF", "FFF");
|
45082 | var milliseconds = value.getMilliseconds();
|
45083 | if (milliseconds % 10 >= 1 && (format = StringExtensions.replaceAll(format, "FFF", "fff")),
|
45084 | format = StringExtensions.replaceAll(format, "FFF", "FF"), milliseconds % 100 / 10 >= 1 && (format = StringExtensions.replaceAll(format, "FF", "ff")),
|
45085 | format = StringExtensions.replaceAll(format, "FF", "F"), milliseconds % 1e3 / 100 >= 1 && (format = StringExtensions.replaceAll(format, "F", "f")),
|
45086 | format = StringExtensions.replaceAll(format, "F", ""), "" === format || "%" === format) return "";
|
45087 | }
|
45088 | return format = processCustomDateTimeFormat(format), result = Globalize.format(value, format, culture),
|
45089 | result = localize(result, culture.calendar), result = FormattingEncoder.restoreLiterals(result, literals, !1);
|
45090 | }
|
45091 | function processCustomDateTimeFormat(format) {
|
45092 | return format === _currentCachedFormat ? _currentCachedProcessedFormat : (_currentCachedFormat = format,
|
45093 | format = Formatting.fixDateTimeFormat(format), _currentCachedProcessedFormat = format,
|
45094 | format);
|
45095 | }
|
45096 | function localize(value, dictionary) {
|
45097 | var timeSeparator = dictionary[":"];
|
45098 | if (":" === timeSeparator) return value;
|
45099 | for (var result = "", count = value.length, i = 0; count > i; i++) {
|
45100 | var char = value.charAt(i);
|
45101 | switch (char) {
|
45102 | case ":":
|
45103 | result += timeSeparator;
|
45104 | break;
|
45105 |
|
45106 | default:
|
45107 | result += char;
|
45108 | }
|
45109 | }
|
45110 | return result;
|
45111 | }
|
45112 | function ensurePatterns(calendar) {
|
45113 | var patterns = calendar.patterns;
|
45114 | void 0 === patterns.g && (patterns.g = patterns.f.replace(patterns.D, patterns.d),
|
45115 | patterns.G = patterns.F.replace(patterns.D, patterns.d));
|
45116 | }
|
45117 | var _currentCachedFormat, _currentCachedProcessedFormat;
|
45118 | DateTimeFormat.canFormat = canFormat, DateTimeFormat.format = format;
|
45119 | }(DateTimeFormat || (DateTimeFormat = {}));
|
45120 | var NumberFormat;
|
45121 | !function(NumberFormat) {
|
45122 | function getNonScientificFormatWithPrecision(baseFormat, numericFormat) {
|
45123 | if (!numericFormat || void 0 === baseFormat) return baseFormat;
|
45124 | var newFormat = "{0:" + numericFormat + "}";
|
45125 | return baseFormat.replace("{0}", newFormat);
|
45126 | }
|
45127 | function getNumericFormat(value, baseFormat) {
|
45128 | if (null == baseFormat) return baseFormat;
|
45129 | if (hasFormatComponents(baseFormat)) {
|
45130 | var _a = NumberFormat.getComponents(baseFormat), positive = _a.positive, negative = _a.negative, zero = _a.zero;
|
45131 | return value > 0 ? getNumericFormatFromComponent(value, positive) : 0 === value ? getNumericFormatFromComponent(value, zero) : getNumericFormatFromComponent(value, negative);
|
45132 | }
|
45133 | return getNumericFormatFromComponent(value, baseFormat);
|
45134 | }
|
45135 | function getNumericFormatFromComponent(value, format) {
|
45136 | var match = RegExpExtensions.run(NumericFormatRegex, format);
|
45137 | return match ? match[0] : format;
|
45138 | }
|
45139 | function addDecimalsToFormat(baseFormat, decimals, trailingZeros) {
|
45140 | if (null == decimals) return baseFormat;
|
45141 | if (null == baseFormat && (baseFormat = ZeroPlaceholder), hasFormatComponents(baseFormat)) {
|
45142 | for (var _a = NumberFormat.getComponents(baseFormat), positive = _a.positive, negative = _a.negative, zero = _a.zero, formats = [ positive, negative, zero ], i = 0; i < formats.length; i++) formats[i] = addDecimalsToFormatComponent(formats[i], decimals, trailingZeros);
|
45143 | return formats.join(NumberFormat.NumberFormatComponentsDelimeter);
|
45144 | }
|
45145 | return addDecimalsToFormatComponent(baseFormat, decimals, trailingZeros);
|
45146 | }
|
45147 | function addDecimalsToFormatComponent(format, decimals, trailingZeros) {
|
45148 | if (decimals = Math.abs(decimals), decimals >= 0) {
|
45149 | var literals = [];
|
45150 | format = FormattingEncoder.preserveLiterals(format, literals);
|
45151 | var placeholder = trailingZeros ? ZeroPlaceholder : DigitPlaceholder, decimalPlaceholders = StringExtensions.repeat(placeholder, Math.abs(decimals)), match = RegExpExtensions.run(DecimalFormatRegex, format);
|
45152 | if (match) {
|
45153 | var beforeDecimal = format.substr(0, match.index), formatDecimal = format.substr(match.index + 1, match[1].length), afterDecimal = format.substr(match.index + match[0].length);
|
45154 | if (trailingZeros) formatDecimal = decimalPlaceholders; else {
|
45155 | var decimalChange = decimalPlaceholders.length - formatDecimal.length;
|
45156 | decimalChange > 0 ? formatDecimal += decimalPlaceholders.slice(-decimalChange) : 0 > decimalChange && (formatDecimal = formatDecimal.slice(0, decimalChange));
|
45157 | }
|
45158 | formatDecimal.length > 0 && (formatDecimal = DecimalFormatCharacter + formatDecimal),
|
45159 | format = beforeDecimal + formatDecimal + afterDecimal;
|
45160 | } else decimalPlaceholders.length > 0 && (format = format.replace(LastNumericPlaceholderRegex, "$1" + DecimalFormatCharacter + decimalPlaceholders));
|
45161 | 0 !== literals.length && (format = FormattingEncoder.restoreLiterals(format, literals));
|
45162 | }
|
45163 | return format;
|
45164 | }
|
45165 | function hasFormatComponents(format) {
|
45166 | return -1 !== FormattingEncoder.removeLiterals(format).indexOf(NumberFormat.NumberFormatComponentsDelimeter);
|
45167 | }
|
45168 | function getComponents(format) {
|
45169 | var signFormat = {
|
45170 | hasNegative: !1,
|
45171 | positive: format,
|
45172 | negative: format,
|
45173 | zero: format
|
45174 | }, literals = [];
|
45175 | format = FormattingEncoder.preserveLiterals(format, literals);
|
45176 | var signSpecificFormats = format.split(NumberFormat.NumberFormatComponentsDelimeter), formatCount = signSpecificFormats.length;
|
45177 | return formatCount > 1 && (0 !== literals.length && (signSpecificFormats = _.map(signSpecificFormats, function(signSpecificFormat) {
|
45178 | return FormattingEncoder.restoreLiterals(signSpecificFormat, literals);
|
45179 | })), signFormat.hasNegative = !0, signFormat.positive = signFormat.zero = signSpecificFormats[0],
|
45180 | signFormat.negative = signSpecificFormats[1], formatCount > 2 && (signFormat.zero = signSpecificFormats[2])),
|
45181 | signFormat;
|
45182 | }
|
45183 | function canFormat(value) {
|
45184 | var result = "number" == typeof value;
|
45185 | return result;
|
45186 | }
|
45187 | function isStandardFormat(format) {
|
45188 | return StandardFormatRegex.test(format);
|
45189 | }
|
45190 | function format(value, format, culture) {
|
45191 | format = format || "G";
|
45192 | try {
|
45193 | return isStandardFormat(format) ? formatNumberStandard(value, format, culture) : formatNumberCustom(value, format, culture);
|
45194 | } catch (e) {
|
45195 | return Globalize.format(value, void 0, culture);
|
45196 | }
|
45197 | }
|
45198 | function formatWithCustomOverride(value, format, nonScientificOverrideFormat, culture) {
|
45199 | return formatNumberCustom(value, format, culture, nonScientificOverrideFormat);
|
45200 | }
|
45201 | function formatNumberStandard(value, format, culture) {
|
45202 | var result, precision = format.length > 1 ? parseInt(format.substr(1, format.length - 1), 10) : void 0, numberFormatInfo = culture.numberFormat, formatChar = format.charAt(0);
|
45203 | switch (formatChar) {
|
45204 | case "e":
|
45205 | case "E":
|
45206 | void 0 === precision && (precision = 6);
|
45207 | var mantissaDecimalDigits = StringExtensions.repeat("0", precision);
|
45208 | format = "0." + mantissaDecimalDigits + formatChar + "+000", result = formatNumberCustom(value, format, culture);
|
45209 | break;
|
45210 |
|
45211 | case "f":
|
45212 | case "F":
|
45213 | result = void 0 !== precision ? value.toFixed(precision) : value.toFixed(numberFormatInfo.decimals),
|
45214 | result = localize(result, numberFormatInfo);
|
45215 | break;
|
45216 |
|
45217 | case "g":
|
45218 | case "G":
|
45219 | var abs = Math.abs(value);
|
45220 | if (0 === abs || abs >= 1e-4 && 1e15 > abs) result = void 0 !== precision ? value.toPrecision(precision) : value.toString(); else {
|
45221 | if ("number" != typeof value) return String(value);
|
45222 | result = void 0 !== precision ? value.toExponential(precision) : value.toExponential(),
|
45223 | result = result.replace("e", "E");
|
45224 | }
|
45225 | result = localize(result, numberFormatInfo);
|
45226 | break;
|
45227 |
|
45228 | case "r":
|
45229 | case "R":
|
45230 | result = value.toString(), result = localize(result, numberFormatInfo);
|
45231 | break;
|
45232 |
|
45233 | case "x":
|
45234 | case "X":
|
45235 | if (result = value.toString(16), "X" === formatChar && (result = result.toUpperCase()),
|
45236 | void 0 !== precision) {
|
45237 | var actualPrecision = result.length, isNegative = 0 > value;
|
45238 | isNegative && actualPrecision--;
|
45239 | var paddingZerosCount = precision - actualPrecision, paddingZeros = void 0;
|
45240 | paddingZerosCount > 0 && (paddingZeros = StringExtensions.repeat("0", paddingZerosCount)),
|
45241 | result = isNegative ? "-" + paddingZeros + result.substr(1) : paddingZeros + result;
|
45242 | }
|
45243 | result = localize(result, numberFormatInfo);
|
45244 | break;
|
45245 |
|
45246 | default:
|
45247 | result = Globalize.format(value, format, culture);
|
45248 | }
|
45249 | return result;
|
45250 | }
|
45251 | function formatNumberCustom(value, format, culture, nonScientificOverrideFormat) {
|
45252 | var result, numberFormatInfo = culture.numberFormat;
|
45253 | if (!isFinite(value)) return Globalize.format(value, void 0);
|
45254 | var formatComponents = getComponents(format);
|
45255 | format = value > 0 ? formatComponents.positive : 0 === value ? formatComponents.zero : formatComponents.negative,
|
45256 | formatComponents.hasNegative && (value = Math.abs(value));
|
45257 | var formatMeta = getCustomFormatMetadata(format, !0), literals = [];
|
45258 | if (formatMeta.hasLiterals && (format = FormattingEncoder.preserveLiterals(format, literals)),
|
45259 | formatMeta.hasE && !nonScientificOverrideFormat) {
|
45260 | var scientificMatch = RegExpExtensions.run(ScientificFormatRegex, format);
|
45261 | if (scientificMatch) {
|
45262 | var formatM = format.substr(0, scientificMatch.index), formatE = format.substr(scientificMatch.index + 2), precision = getCustomFormatPrecision(formatM, formatMeta), scale = getCustomFormatScale(formatM, formatMeta);
|
45263 | if (1 !== scale && (value *= scale), "number" != typeof value) return String(value);
|
45264 | var s = value.toExponential(precision), indexOfE = s.indexOf("e"), mantissa = s.substr(0, indexOfE), exp = s.substr(indexOfE + 1), resultM = fuseNumberWithCustomFormat(mantissa, formatM, numberFormatInfo), resultE = fuseNumberWithCustomFormat(exp, formatE, numberFormatInfo);
|
45265 | "+" === resultE.charAt(0) && "+" !== scientificMatch[0].charAt(1) && (resultE = resultE.substr(1));
|
45266 | var e = scientificMatch[0].charAt(0);
|
45267 | result = resultM + e + resultE;
|
45268 | }
|
45269 | }
|
45270 | if (void 0 === result) {
|
45271 | var valueFormatted = void 0, isValueGlobalized = !1, precision = getCustomFormatPrecision(format, formatMeta), scale = getCustomFormatScale(format, formatMeta);
|
45272 | if (1 !== scale && (value *= scale), value = parseFloat(toNonScientific(value, precision)),
|
45273 | nonScientificOverrideFormat) {
|
45274 | var numericFormat = NumberFormat.getNumericFormat(value, format);
|
45275 | nonScientificOverrideFormat = getNonScientificFormatWithPrecision(nonScientificOverrideFormat, numericFormat),
|
45276 | valueFormatted = powerbi_1.formattingService.format(nonScientificOverrideFormat, [ value ], culture.name),
|
45277 | isValueGlobalized = !0;
|
45278 | } else valueFormatted = toNonScientific(value, precision);
|
45279 | result = fuseNumberWithCustomFormat(valueFormatted, format, numberFormatInfo, nonScientificOverrideFormat, isValueGlobalized);
|
45280 | }
|
45281 | return formatMeta.hasLiterals && (result = FormattingEncoder.restoreLiterals(result, literals, !1)),
|
45282 | _lastCustomFormatMeta = formatMeta, result;
|
45283 | }
|
45284 | function toNonScientific(value, precision) {
|
45285 | var result = "", precisionZeros = 0;
|
45286 | precision > 16 && (precisionZeros = precision - 16, precision = 16);
|
45287 | var digitsBeforeDecimalPoint = powerbi_1.Double.log10(Math.abs(value));
|
45288 | if (16 > digitsBeforeDecimalPoint) {
|
45289 | if (digitsBeforeDecimalPoint > 0) {
|
45290 | var maxPrecision = 16 - digitsBeforeDecimalPoint;
|
45291 | precision > maxPrecision && (precisionZeros += precision - maxPrecision, precision = maxPrecision);
|
45292 | }
|
45293 | result = value.toFixed(precision);
|
45294 | } else if (16 === digitsBeforeDecimalPoint) result = value.toFixed(0), precisionZeros += precision,
|
45295 | precisionZeros > 0 && (result += "."); else {
|
45296 | if ("number" != typeof value) return String(value);
|
45297 | result = value.toExponential(15);
|
45298 | var indexOfE = result.indexOf("e");
|
45299 | if (indexOfE > 0) {
|
45300 | var indexOfDot = result.indexOf("."), mantissa = result.substr(0, indexOfE), exp = result.substr(indexOfE + 1), powerZeros = parseInt(exp, 10) - (mantissa.length - indexOfDot - 1);
|
45301 | result = mantissa.replace(".", "") + StringExtensions.repeat("0", powerZeros), precision > 0 && (result = result + "." + StringExtensions.repeat("0", precision));
|
45302 | }
|
45303 | }
|
45304 | return precisionZeros > 0 && (result += StringExtensions.repeat("0", precisionZeros)),
|
45305 | result;
|
45306 | }
|
45307 | function getCustomFormatMetadata(format, calculatePrecision, calculateScale) {
|
45308 | if (void 0 !== _lastCustomFormatMeta && format === _lastCustomFormatMeta.format) return _lastCustomFormatMeta;
|
45309 | for (var literals = [], escaped = FormattingEncoder.preserveLiterals(format, literals), result = {
|
45310 | format: format,
|
45311 | hasLiterals: 0 !== literals.length,
|
45312 | hasE: !1,
|
45313 | hasCommas: !1,
|
45314 | hasDots: !1,
|
45315 | hasPercent: !1,
|
45316 | hasPermile: !1,
|
45317 | precision: void 0,
|
45318 | scale: void 0
|
45319 | }, i = 0, length_1 = escaped.length; length_1 > i; i++) {
|
45320 | var c = escaped.charAt(i);
|
45321 | switch (c) {
|
45322 | case "e":
|
45323 | case "E":
|
45324 | result.hasE = !0;
|
45325 | break;
|
45326 |
|
45327 | case ",":
|
45328 | result.hasCommas = !0;
|
45329 | break;
|
45330 |
|
45331 | case ".":
|
45332 | result.hasDots = !0;
|
45333 | break;
|
45334 |
|
45335 | case "%":
|
45336 | result.hasPercent = !0;
|
45337 | break;
|
45338 |
|
45339 | case "‰":
|
45340 | result.hasPermile = !0;
|
45341 | }
|
45342 | }
|
45343 | var formatComponents = getComponents(format);
|
45344 | return calculatePrecision && (result.precision = getCustomFormatPrecision(formatComponents.positive, result)),
|
45345 | calculateScale && (result.scale = getCustomFormatScale(formatComponents.positive, result)),
|
45346 | result;
|
45347 | }
|
45348 | function getCustomFormatPrecision(format, formatMeta) {
|
45349 | if (formatMeta.precision > -1) return formatMeta.precision;
|
45350 | var result = 0;
|
45351 | if (formatMeta.hasDots) {
|
45352 | formatMeta.hasLiterals && (format = FormattingEncoder.removeLiterals(format));
|
45353 | var dotIndex = format.indexOf(".");
|
45354 | if (dotIndex > -1) {
|
45355 | for (var count = format.length, i = dotIndex; count > i; i++) {
|
45356 | var char = format.charAt(i);
|
45357 | if (char.match(NumericPlaceholderRegex) && result++, char === ExponentialFormatChar) break;
|
45358 | }
|
45359 | result = Math.min(19, result);
|
45360 | }
|
45361 | }
|
45362 | return formatMeta.precision = result, result;
|
45363 | }
|
45364 | function getCustomFormatScale(format, formatMeta) {
|
45365 | if (formatMeta.scale > -1) return formatMeta.scale;
|
45366 | var result = 1;
|
45367 | if (formatMeta.hasPercent && format.indexOf("%") > -1 && (result = 100 * result),
|
45368 | formatMeta.hasPermile && format.indexOf("‰") > -1 && (result = 1e3 * result), formatMeta.hasCommas) {
|
45369 | var dotIndex = format.indexOf(".");
|
45370 | -1 === dotIndex && (dotIndex = format.length);
|
45371 | for (var i = dotIndex - 1; i > -1; i--) {
|
45372 | var char = format.charAt(i);
|
45373 | if ("," !== char) break;
|
45374 | result /= 1e3;
|
45375 | }
|
45376 | }
|
45377 | return formatMeta.scale = result, result;
|
45378 | }
|
45379 | function fuseNumberWithCustomFormat(value, format, numberFormatInfo, nonScientificOverrideFormat, isValueGlobalized) {
|
45380 | var suppressModifyValue = !!nonScientificOverrideFormat, formatParts = format.split(".", 2);
|
45381 | if (2 === formatParts.length) {
|
45382 | var wholeFormat = formatParts[0], fractionFormat = formatParts[1], displayUnit = "";
|
45383 | nonScientificOverrideFormat && (displayUnit = nonScientificOverrideFormat.replace(NumericalPlaceHolderRegex, ""),
|
45384 | value = value.replace(displayUnit, ""));
|
45385 | var globalizedDecimalSeparator = numberFormatInfo["."], decimalSeparator = isValueGlobalized ? globalizedDecimalSeparator : ".", valueParts = value.split(decimalSeparator, 2), wholeValue = 1 === valueParts.length ? valueParts[0] + displayUnit : valueParts[0], fractionValue = 2 === valueParts.length ? valueParts[1] + displayUnit : "";
|
45386 | fractionValue = fractionValue.replace(TrailingZerosRegex, "");
|
45387 | var wholeFormattedValue = fuseNumberWithCustomFormatLeft(wholeValue, wholeFormat, numberFormatInfo, suppressModifyValue), fractionFormattedValue = fuseNumberWithCustomFormatRight(fractionValue, fractionFormat, suppressModifyValue);
|
45388 | return fractionFormattedValue.fmtOnly || "" === fractionFormattedValue.value ? wholeFormattedValue + fractionFormattedValue.value : wholeFormattedValue + globalizedDecimalSeparator + fractionFormattedValue.value;
|
45389 | }
|
45390 | return fuseNumberWithCustomFormatLeft(value, format, numberFormatInfo, suppressModifyValue);
|
45391 | }
|
45392 | function fuseNumberWithCustomFormatLeft(value, format, numberFormatInfo, suppressModifyValue) {
|
45393 | var groupSymbolIndex = format.indexOf(","), enableGroups = groupSymbolIndex > -1 && groupSymbolIndex < Math.max(format.lastIndexOf("0"), format.lastIndexOf("#")) && numberFormatInfo[","], groupDigitCount = 0, groupIndex = 0, groupSizes = numberFormatInfo.groupSizes || [ 3 ], groupSize = groupSizes[0], groupSeparator = numberFormatInfo[","], sign = "", firstChar = value.charAt(0);
|
45394 | "+" !== firstChar && "-" !== firstChar || (sign = numberFormatInfo[firstChar], value = value.substr(1));
|
45395 | for (var isZero = "0" === value, result = "", leftBuffer = "", vi = value.length - 1, fmtOnly = !0, fi = format.length - 1; fi > -1; fi--) {
|
45396 | var formatChar = format.charAt(fi);
|
45397 | switch (formatChar) {
|
45398 | case ZeroPlaceholder:
|
45399 | case DigitPlaceholder:
|
45400 | fmtOnly = !1, "" !== leftBuffer && (result = leftBuffer + result, leftBuffer = ""),
|
45401 | suppressModifyValue || ((vi > -1 || formatChar === ZeroPlaceholder) && enableGroups && (groupDigitCount === groupSize ? (result = groupSeparator + result,
|
45402 | groupIndex++, groupIndex < groupSizes.length && (groupSize = groupSizes[groupIndex]),
|
45403 | groupDigitCount = 1) : groupDigitCount++), vi > -1 ? (isZero && formatChar === DigitPlaceholder || (result = value.charAt(vi) + result),
|
45404 | vi--) : formatChar !== DigitPlaceholder && (result = formatChar + result));
|
45405 | break;
|
45406 |
|
45407 | case ",":
|
45408 | break;
|
45409 |
|
45410 | default:
|
45411 | leftBuffer = formatChar + leftBuffer;
|
45412 | }
|
45413 | }
|
45414 | if (!suppressModifyValue) {
|
45415 | if (vi > -1 && "" !== result) if (enableGroups) for (;vi > -1; ) groupDigitCount === groupSize ? (result = groupSeparator + result,
|
45416 | groupIndex++, groupIndex < groupSizes.length && (groupSize = groupSizes[groupIndex]),
|
45417 | groupDigitCount = 1) : groupDigitCount++, result = value.charAt(vi) + result, vi--; else result = value.substr(0, vi + 1) + result;
|
45418 | return sign + leftBuffer + result;
|
45419 | }
|
45420 | return fmtOnly ? sign + leftBuffer + result : sign + leftBuffer + value + result;
|
45421 | }
|
45422 | function fuseNumberWithCustomFormatRight(value, format, suppressModifyValue) {
|
45423 | var vi = 0, fCount = format.length, vCount = value.length;
|
45424 | if (suppressModifyValue) {
|
45425 | var lastChar = format.charAt(fCount - 1);
|
45426 | return lastChar.match(NumericPlaceholderRegex) ? {
|
45427 | value: value,
|
45428 | fmtOnly: "" === value
|
45429 | } : {
|
45430 | value: value + lastChar,
|
45431 | fmtOnly: "" === value
|
45432 | };
|
45433 | }
|
45434 | for (var result = "", fmtOnly = !0, fi = 0; fCount > fi; fi++) {
|
45435 | var formatChar = format.charAt(fi);
|
45436 | if (vCount > vi) switch (formatChar) {
|
45437 | case ZeroPlaceholder:
|
45438 | case DigitPlaceholder:
|
45439 | result += value[vi++], fmtOnly = !1;
|
45440 | break;
|
45441 |
|
45442 | default:
|
45443 | result += formatChar;
|
45444 | } else formatChar !== DigitPlaceholder && (result += formatChar, fmtOnly = fmtOnly && formatChar !== ZeroPlaceholder);
|
45445 | }
|
45446 | return {
|
45447 | value: result,
|
45448 | fmtOnly: fmtOnly
|
45449 | };
|
45450 | }
|
45451 | function localize(value, dictionary) {
|
45452 | var plus = dictionary["+"], minus = dictionary["-"], dot = dictionary["."], comma = dictionary[","];
|
45453 | if ("+" === plus && "-" === minus && "." === dot && "," === comma) return value;
|
45454 | for (var count = value.length, result = "", i = 0; count > i; i++) {
|
45455 | var char = value.charAt(i);
|
45456 | switch (char) {
|
45457 | case "+":
|
45458 | result += plus;
|
45459 | break;
|
45460 |
|
45461 | case "-":
|
45462 | result += minus;
|
45463 | break;
|
45464 |
|
45465 | case ".":
|
45466 | result += dot;
|
45467 | break;
|
45468 |
|
45469 | case ",":
|
45470 | result += comma;
|
45471 | break;
|
45472 |
|
45473 | default:
|
45474 | result += char;
|
45475 | }
|
45476 | }
|
45477 | return result;
|
45478 | }
|
45479 | var NumericalPlaceHolderRegex = /\{.+\}/, ScientificFormatRegex = /e[+-]*[0#]+/i, StandardFormatRegex = /^[a-z]\d{0,2}$/i, TrailingZerosRegex = /0+$/, DecimalFormatRegex = /\.([0#]*)/g, NumericFormatRegex = /[0#,\.]+[0,#]*/g, LastNumericPlaceholderRegex = /([0#])(?=[^0#]*$)/, DecimalFormatCharacter = ".";
|
45480 | NumberFormat.NumberFormatComponentsDelimeter = ";", NumberFormat.getNumericFormat = getNumericFormat,
|
45481 | NumberFormat.addDecimalsToFormat = addDecimalsToFormat, NumberFormat.hasFormatComponents = hasFormatComponents,
|
45482 | NumberFormat.getComponents = getComponents;
|
45483 | var _lastCustomFormatMeta;
|
45484 | NumberFormat.canFormat = canFormat, NumberFormat.isStandardFormat = isStandardFormat,
|
45485 | NumberFormat.format = format, NumberFormat.formatWithCustomOverride = formatWithCustomOverride,
|
45486 | NumberFormat.getCustomFormatMetadata = getCustomFormatMetadata;
|
45487 | }(NumberFormat = powerbi_1.NumberFormat || (powerbi_1.NumberFormat = {}));
|
45488 | var DateTimeScaleFormatInfo = function() {
|
45489 | function DateTimeScaleFormatInfo(culture) {
|
45490 | var calendar = culture.calendar, patterns = calendar.patterns, monthAbbreviations = calendar.months.namesAbbr, cultureHasMonthAbbr = monthAbbreviations && monthAbbreviations[0], yearMonthPattern = patterns.Y, monthDayPattern = patterns.M, fullPattern = patterns.f, longTimePattern = patterns.T, shortTimePattern = patterns.t, separator = fullPattern.indexOf(",") > -1 ? ", " : " ", hasYearSymbol = 0 === yearMonthPattern.indexOf("yyyy'") && yearMonthPattern.length > 6 && "'" === yearMonthPattern[6];
|
45491 | this.YearPattern = hasYearSymbol ? yearMonthPattern.substr(0, 7) : "yyyy";
|
45492 | var yearPos = fullPattern.indexOf("yy"), monthPos = fullPattern.indexOf("MMMM");
|
45493 | this.MonthPattern = cultureHasMonthAbbr && monthPos > -1 ? yearPos > monthPos ? "MMM yyyy" : "yyyy MMM" : yearMonthPattern,
|
45494 | this.DayPattern = cultureHasMonthAbbr ? monthDayPattern.replace("MMMM", "MMM") : monthDayPattern;
|
45495 | var minutePos = fullPattern.indexOf("mm"), pmPos = fullPattern.indexOf("tt"), shortHourPattern = pmPos > -1 ? shortTimePattern.replace(":mm ", "") : shortTimePattern;
|
45496 | switch (this.HourPattern = minutePos > yearPos ? this.DayPattern + separator + shortHourPattern : shortHourPattern + separator + this.DayPattern,
|
45497 | this.MinutePattern = shortTimePattern, this.SecondPattern = longTimePattern, this.MillisecondPattern = longTimePattern.replace("ss", "ss.fff"),
|
45498 | culture.name) {
|
45499 | case "fi-FI":
|
45500 | this.DayPattern = this.DayPattern.replace("'ta'", ""), this.HourPattern = this.HourPattern.replace("'ta'", "");
|
45501 | }
|
45502 | }
|
45503 | return DateTimeScaleFormatInfo.prototype.getFormatString = function(unit) {
|
45504 | switch (unit) {
|
45505 | case powerbi_1.DateTimeUnit.Year:
|
45506 | return this.YearPattern;
|
45507 |
|
45508 | case powerbi_1.DateTimeUnit.Month:
|
45509 | return this.MonthPattern;
|
45510 |
|
45511 | case powerbi_1.DateTimeUnit.Week:
|
45512 | case powerbi_1.DateTimeUnit.Day:
|
45513 | return this.DayPattern;
|
45514 |
|
45515 | case powerbi_1.DateTimeUnit.Hour:
|
45516 | return this.HourPattern;
|
45517 |
|
45518 | case powerbi_1.DateTimeUnit.Minute:
|
45519 | return this.MinutePattern;
|
45520 |
|
45521 | case powerbi_1.DateTimeUnit.Second:
|
45522 | return this.SecondPattern;
|
45523 |
|
45524 | case powerbi_1.DateTimeUnit.Millisecond:
|
45525 | return this.MillisecondPattern;
|
45526 | }
|
45527 | }, DateTimeScaleFormatInfo;
|
45528 | }();
|
45529 | powerbi_1.formattingService = new FormattingService();
|
45530 | }(powerbi || (powerbi = {}));
|
45531 | }, function(module, exports) {
|
45532 | var powerbi, powerbi = (window.jsCommon, window.powerbi), __extends = (window.powerbitests,
|
45533 | window.InJs, window.debug, window.jasmine, window.Microsoft, this && this.__extends || function(d, b) {
|
45534 | function __() {
|
45535 | this.constructor = d;
|
45536 | }
|
45537 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
45538 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
45539 | });
|
45540 | !function(powerbi) {
|
45541 | var data;
|
45542 | !function(data) {
|
45543 | var SQExprShortSerializer;
|
45544 | !function(SQExprShortSerializer) {
|
45545 | function serialize(expr) {
|
45546 | return JSON.stringify(expr.accept(SQExprSerializer.instance));
|
45547 | }
|
45548 | function serializeArray(exprs) {
|
45549 | for (var str = "[", i = 0, len = exprs.length; len > i; i++) i > 0 && (str += ","),
|
45550 | str += SQExprShortSerializer.serialize(exprs[i]);
|
45551 | return str + "]";
|
45552 | }
|
45553 | SQExprShortSerializer.serialize = serialize, SQExprShortSerializer.serializeArray = serializeArray;
|
45554 | var SQExprSerializer = function(_super) {
|
45555 | function SQExprSerializer() {
|
45556 | _super.apply(this, arguments);
|
45557 | }
|
45558 | return __extends(SQExprSerializer, _super), SQExprSerializer.prototype.visitColumnRef = function(expr) {
|
45559 | return {
|
45560 | col: {
|
45561 | s: expr.source.accept(this),
|
45562 | r: expr.ref
|
45563 | }
|
45564 | };
|
45565 | }, SQExprSerializer.prototype.visitMeasureRef = function(expr) {
|
45566 | return {
|
45567 | measure: {
|
45568 | s: expr.source.accept(this),
|
45569 | r: expr.ref
|
45570 | }
|
45571 | };
|
45572 | }, SQExprSerializer.prototype.visitAggr = function(expr) {
|
45573 | return {
|
45574 | agg: {
|
45575 | a: expr.arg.accept(this),
|
45576 | f: expr.func
|
45577 | }
|
45578 | };
|
45579 | }, SQExprSerializer.prototype.visitEntity = function(expr) {
|
45580 | return {
|
45581 | e: expr.entity
|
45582 | };
|
45583 | }, SQExprSerializer.prototype.visitHierarchyLevel = function(expr) {
|
45584 | return {
|
45585 | h: expr.arg.accept(this),
|
45586 | l: expr.level
|
45587 | };
|
45588 | }, SQExprSerializer.prototype.visitHierarchy = function(expr) {
|
45589 | return {
|
45590 | e: expr.arg.accept(this),
|
45591 | h: expr.hierarchy
|
45592 | };
|
45593 | }, SQExprSerializer.prototype.visitPropertyVariationSource = function(expr) {
|
45594 | return {
|
45595 | e: expr.arg.accept(this),
|
45596 | n: expr.name,
|
45597 | p: expr.property
|
45598 | };
|
45599 | }, SQExprSerializer.prototype.visitAnd = function(expr) {
|
45600 | return {
|
45601 | and: {
|
45602 | l: expr.left.accept(this),
|
45603 | r: expr.right.accept(this)
|
45604 | }
|
45605 | };
|
45606 | }, SQExprSerializer.prototype.visitCompare = function(expr) {
|
45607 | return {
|
45608 | comp: {
|
45609 | k: expr.comparison,
|
45610 | l: expr.left.accept(this),
|
45611 | r: expr.right.accept(this)
|
45612 | }
|
45613 | };
|
45614 | }, SQExprSerializer.prototype.visitConstant = function(expr) {
|
45615 | return {
|
45616 | "const": {
|
45617 | t: expr.type.primitiveType,
|
45618 | v: expr.value
|
45619 | }
|
45620 | };
|
45621 | }, SQExprSerializer.prototype.visitArithmetic = function(expr) {
|
45622 | return {
|
45623 | arithmetic: {
|
45624 | o: expr.operator,
|
45625 | l: expr.left.accept(this),
|
45626 | r: expr.right.accept(this)
|
45627 | }
|
45628 | };
|
45629 | }, SQExprSerializer.prototype.visitScopedEval = function(expr) {
|
45630 | return {
|
45631 | scopedEval: {
|
45632 | e: expr.expression.accept(this),
|
45633 | s: serializeArray(expr.scope)
|
45634 | }
|
45635 | };
|
45636 | }, SQExprSerializer.prototype.visitWithRef = function(expr) {
|
45637 | return {
|
45638 | withRef: {
|
45639 | e: expr.expressionName
|
45640 | }
|
45641 | };
|
45642 | }, SQExprSerializer.prototype.visitTransformTableRef = function(expr) {
|
45643 | return {
|
45644 | transformTableRef: {
|
45645 | source: expr.source
|
45646 | }
|
45647 | };
|
45648 | }, SQExprSerializer.prototype.visitTransformOutputRoleRef = function(expr) {
|
45649 | var ref = {
|
45650 | transformOutputRoleRef: {
|
45651 | role: expr.role
|
45652 | }
|
45653 | };
|
45654 | return expr.transform && (ref.transformOutputRoleRef.transform = expr.transform),
|
45655 | ref;
|
45656 | }, SQExprSerializer.prototype.visitDefault = function(expr) {}, SQExprSerializer.instance = new SQExprSerializer(),
|
45657 | SQExprSerializer;
|
45658 | }(data.DefaultSQExprVisitor);
|
45659 | }(SQExprShortSerializer = data.SQExprShortSerializer || (data.SQExprShortSerializer = {}));
|
45660 | }(data = powerbi.data || (powerbi.data = {}));
|
45661 | }(powerbi || (powerbi = {}));
|
45662 | }, function(module, exports) {
|
45663 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
45664 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
45665 | !function(powerbi) {
|
45666 | var visuals;
|
45667 | !function(visuals) {
|
45668 | var Selector = powerbi.data.Selector, SelectionId = function() {
|
45669 | function SelectionId(selector, highlight) {
|
45670 | this.selector = selector, this.highlight = highlight, this.key = JSON.stringify({
|
45671 | selector: selector ? Selector.getKey(selector) : null,
|
45672 | highlight: highlight
|
45673 | }), this.keyWithoutHighlight = JSON.stringify({
|
45674 | selector: selector ? Selector.getKey(selector) : null
|
45675 | });
|
45676 | }
|
45677 | return SelectionId.prototype.equals = function(other) {
|
45678 | return this.selector && other.selector ? this.highlight === other.highlight && Selector.equals(this.selector, other.selector) : !this.selector == !other.selector && this.highlight === other.highlight;
|
45679 | }, SelectionId.prototype.includes = function(other, ignoreHighlight) {
|
45680 | void 0 === ignoreHighlight && (ignoreHighlight = !1);
|
45681 | var thisSelector = this.selector, otherSelector = other.selector;
|
45682 | if (!thisSelector || !otherSelector) return !1;
|
45683 | var thisData = thisSelector.data, otherData = otherSelector.data;
|
45684 | if (!thisData && thisSelector.metadata && thisSelector.metadata !== otherSelector.metadata) return !1;
|
45685 | if (!ignoreHighlight && this.highlight !== other.highlight) return !1;
|
45686 | if (thisData) {
|
45687 | if (!otherData) return !1;
|
45688 | if (thisData.length > 0) for (var i = 0, ilen = thisData.length; ilen > i; i++) {
|
45689 | var thisValue = thisData[i];
|
45690 | if (!otherData.some(function(otherValue) {
|
45691 | return powerbi.DataViewScopeIdentity.equals(thisValue, otherValue);
|
45692 | })) return !1;
|
45693 | }
|
45694 | }
|
45695 | return !0;
|
45696 | }, SelectionId.prototype.getKey = function() {
|
45697 | return this.key;
|
45698 | }, SelectionId.prototype.getKeyWithoutHighlight = function() {
|
45699 | return this.keyWithoutHighlight;
|
45700 | }, SelectionId.prototype.hasIdentity = function() {
|
45701 | return this.selector && !!this.selector.data;
|
45702 | }, SelectionId.prototype.getSelector = function() {
|
45703 | return this.selector;
|
45704 | }, SelectionId.prototype.getSelectorsByColumn = function() {
|
45705 | return this.selectorsByColumn;
|
45706 | }, SelectionId.createNull = function(highlight) {
|
45707 | return void 0 === highlight && (highlight = !1), new SelectionId(null, highlight);
|
45708 | }, SelectionId.createWithId = function(id, highlight) {
|
45709 | void 0 === highlight && (highlight = !1);
|
45710 | var selector = null;
|
45711 | return id && (selector = {
|
45712 | data: [ id ]
|
45713 | }), new SelectionId(selector, highlight);
|
45714 | }, SelectionId.createWithMeasure = function(measureId, highlight) {
|
45715 | void 0 === highlight && (highlight = !1);
|
45716 | var selector = {
|
45717 | metadata: measureId
|
45718 | }, selectionId = new SelectionId(selector, highlight);
|
45719 | return selectionId.selectorsByColumn = {
|
45720 | metadata: measureId
|
45721 | }, selectionId;
|
45722 | }, SelectionId.createWithIdAndMeasure = function(id, measureId, highlight) {
|
45723 | void 0 === highlight && (highlight = !1);
|
45724 | var selector = {};
|
45725 | id && (selector.data = [ id ]), measureId && (selector.metadata = measureId), id || measureId || (selector = null);
|
45726 | var selectionId = new SelectionId(selector, highlight);
|
45727 | return selectionId;
|
45728 | }, SelectionId.createWithIdAndMeasureAndCategory = function(id, measureId, queryName, highlight) {
|
45729 | void 0 === highlight && (highlight = !1);
|
45730 | var selectionId = this.createWithIdAndMeasure(id, measureId, highlight);
|
45731 | return selectionId.selector && (selectionId.selectorsByColumn = {}, id && queryName && (selectionId.selectorsByColumn.dataMap = {},
|
45732 | selectionId.selectorsByColumn.dataMap[queryName] = id), measureId && (selectionId.selectorsByColumn.metadata = measureId)),
|
45733 | selectionId;
|
45734 | }, SelectionId.createWithIds = function(id1, id2, highlight) {
|
45735 | void 0 === highlight && (highlight = !1);
|
45736 | var selector = null, selectorData = SelectionId.idArray(id1, id2);
|
45737 | return selectorData && (selector = {
|
45738 | data: selectorData
|
45739 | }), new SelectionId(selector, highlight);
|
45740 | }, SelectionId.createWithIdsAndMeasure = function(id1, id2, measureId, highlight) {
|
45741 | void 0 === highlight && (highlight = !1);
|
45742 | var selector = {}, selectorData = SelectionId.idArray(id1, id2);
|
45743 | return selectorData && (selector.data = selectorData), measureId && (selector.metadata = measureId),
|
45744 | id1 || id2 || measureId || (selector = null), new SelectionId(selector, highlight);
|
45745 | }, SelectionId.createWithSelectorForColumnAndMeasure = function(dataMap, measureId, highlight) {
|
45746 | void 0 === highlight && (highlight = !1);
|
45747 | var selectionId, keys = Object.keys(dataMap);
|
45748 | selectionId = 2 === keys.length ? this.createWithIdsAndMeasure(dataMap[keys[0]], dataMap[keys[1]], measureId, highlight) : 1 === keys.length ? this.createWithIdsAndMeasure(dataMap[keys[0]], null, measureId, highlight) : this.createWithIdsAndMeasure(null, null, measureId, highlight);
|
45749 | var selectorsByColumn = {};
|
45750 | return _.isEmpty(dataMap) || (selectorsByColumn.dataMap = dataMap), measureId && (selectorsByColumn.metadata = measureId),
|
45751 | dataMap || measureId || (selectorsByColumn = null), selectionId.selectorsByColumn = selectorsByColumn,
|
45752 | selectionId;
|
45753 | }, SelectionId.createWithHighlight = function(original) {
|
45754 | var newId = new SelectionId(original.getSelector(), !0);
|
45755 | return newId.selectorsByColumn = original.selectorsByColumn, newId;
|
45756 | }, SelectionId.idArray = function(id1, id2) {
|
45757 | if (id1 || id2) {
|
45758 | var data_1 = [];
|
45759 | return id1 && data_1.push(id1), id2 && id2 !== id1 && data_1.push(id2), data_1;
|
45760 | }
|
45761 | }, SelectionId;
|
45762 | }();
|
45763 | visuals.SelectionId = SelectionId;
|
45764 | var SelectionIdBuilder = function() {
|
45765 | function SelectionIdBuilder() {}
|
45766 | return SelectionIdBuilder.builder = function() {
|
45767 | return new SelectionIdBuilder();
|
45768 | }, SelectionIdBuilder.prototype.withCategoryIdentity = function(categoryColumn, identity) {
|
45769 | return categoryColumn && categoryColumn.source && categoryColumn.source.queryName && (this.ensureDataMap()[categoryColumn.source.queryName] = identity),
|
45770 | this;
|
45771 | }, SelectionIdBuilder.prototype.withCategory = function(categoryColumn, index) {
|
45772 | return categoryColumn && categoryColumn.source && categoryColumn.source.queryName && categoryColumn.identity && (this.ensureDataMap()[categoryColumn.source.queryName] = categoryColumn.identity[index]),
|
45773 | this;
|
45774 | }, SelectionIdBuilder.prototype.withSeries = function(seriesColumn, valueColumn) {
|
45775 | return seriesColumn && seriesColumn.source && seriesColumn.source.queryName && valueColumn && (this.ensureDataMap()[seriesColumn.source.queryName] = valueColumn.identity),
|
45776 | this;
|
45777 | }, SelectionIdBuilder.prototype.withMeasure = function(measureId) {
|
45778 | return this.measure = measureId, this;
|
45779 | }, SelectionIdBuilder.prototype.createSelectionId = function() {
|
45780 | return SelectionId.createWithSelectorForColumnAndMeasure(this.ensureDataMap(), this.measure);
|
45781 | }, SelectionIdBuilder.prototype.ensureDataMap = function() {
|
45782 | return this.dataMap || (this.dataMap = {}), this.dataMap;
|
45783 | }, SelectionIdBuilder;
|
45784 | }();
|
45785 | visuals.SelectionIdBuilder = SelectionIdBuilder;
|
45786 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
45787 | }(powerbi || (powerbi = {}));
|
45788 | }, function(module, exports) {
|
45789 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
45790 | window.jasmine, window.Microsoft;
|
45791 | }, function(module, exports, __webpack_require__) {
|
45792 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
45793 | window.jasmine, window.Microsoft;
|
45794 | window.jsCommon = window.jsCommon || {}, window.powerbi = window.powerbi || {},
|
45795 | window.debug = window.debug || {}, window.InJs = window.InJs || {}, __webpack_require__(439);
|
45796 | }, function(module, exports, __webpack_require__) {
|
45797 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
45798 | window.jasmine, window.Microsoft;
|
45799 | __webpack_require__(440), __webpack_require__(441), __webpack_require__(442), __webpack_require__(443),
|
45800 | __webpack_require__(444), __webpack_require__(445), __webpack_require__(446), __webpack_require__(447),
|
45801 | __webpack_require__(448), __webpack_require__(449), __webpack_require__(450);
|
45802 | }, function(module, exports) {
|
45803 | window.jsCommon, window.powerbi, window.powerbitests, window.InJs, window.debug,
|
45804 | window.jasmine, window.Microsoft;
|
45805 | }, function(module, exports) {
|
45806 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
45807 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
45808 | !function(powerbi) {
|
45809 | var visuals;
|
45810 | !function(visuals) {
|
45811 | var telemetry;
|
45812 | !function(telemetry) {
|
45813 | function generateGuid() {
|
45814 | var guid = "", idx = 0;
|
45815 | for (idx = 0; 32 > idx; idx += 1) {
|
45816 | var guidDigitsItem = 16 * Math.random() | 0;
|
45817 | switch (idx) {
|
45818 | case 8:
|
45819 | case 12:
|
45820 | case 16:
|
45821 | case 20:
|
45822 | guid += "-";
|
45823 | }
|
45824 | guid += guidDigitsItem.toString(16);
|
45825 | }
|
45826 | return guid;
|
45827 | }
|
45828 | telemetry.generateGuid = generateGuid;
|
45829 | }(telemetry = visuals.telemetry || (visuals.telemetry = {}));
|
45830 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
45831 | }(powerbi || (powerbi = {}));
|
45832 | }, function(module, exports) {
|
45833 | var powerbi, jsCommon = window.jsCommon, powerbi = window.powerbi;
|
45834 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
45835 | !function(powerbi) {
|
45836 | var visuals;
|
45837 | !function(visuals) {
|
45838 | var telemetry;
|
45839 | !function(telemetry) {
|
45840 | var g = jsCommon.Utility.generateGuid;
|
45841 | telemetry.VisualApiUsage = function(name, apiVersion, custom, parentId, isError, errorSource, errorCode) {
|
45842 | void 0 === isError && (isError = !1), void 0 === errorSource && (errorSource = void 0),
|
45843 | void 0 === errorCode && (errorCode = void 0);
|
45844 | var info = {
|
45845 | name: name,
|
45846 | apiVersion: apiVersion,
|
45847 | custom: custom,
|
45848 | parentId: parentId,
|
45849 | isError: isError,
|
45850 | errorSource: errorSource,
|
45851 | errorCode: errorCode
|
45852 | }, event = {
|
45853 | name: "PBI.Visual.ApiUsage",
|
45854 | category: 1,
|
45855 | time: Date.now(),
|
45856 | id: g(),
|
45857 | getFormattedInfoObject: function() {
|
45858 | var formattedObject = {
|
45859 | name: info.name,
|
45860 | apiVersion: info.apiVersion,
|
45861 | custom: info.custom,
|
45862 | parentId: info.parentId,
|
45863 | isError: info.isError
|
45864 | };
|
45865 | return "undefined" != typeof info.errorSource && (formattedObject.errorSource = powerbi.visuals.telemetry.ErrorSource[info.errorSource]),
|
45866 | "undefined" != typeof info.errorCode && (formattedObject.errorCode = info.errorCode),
|
45867 | formattedObject;
|
45868 | },
|
45869 | info: info,
|
45870 | privateFields: [],
|
45871 | orgInfoFields: []
|
45872 | };
|
45873 | return "undefined" != typeof powerbi.visuals.telemetry.VisualApiUsageLoggers && (event.loggers = powerbi.visuals.telemetry.VisualApiUsageLoggers),
|
45874 | event;
|
45875 | }, telemetry.VisualException = function(visualType, isCustom, apiVersion, source, lineNumber, columnNumber, stack, message) {
|
45876 | var info = {
|
45877 | visualType: visualType,
|
45878 | isCustom: isCustom,
|
45879 | apiVersion: apiVersion,
|
45880 | source: source,
|
45881 | lineNumber: lineNumber,
|
45882 | columnNumber: columnNumber,
|
45883 | stack: stack,
|
45884 | message: message
|
45885 | }, event = {
|
45886 | name: "PBI.Visual.Exception",
|
45887 | category: 2,
|
45888 | time: Date.now(),
|
45889 | id: telemetry.generateGuid(),
|
45890 | getFormattedInfoObject: function() {
|
45891 | var formattedObject = {
|
45892 | visualType: info.visualType,
|
45893 | isCustom: info.isCustom,
|
45894 | apiVersion: info.apiVersion,
|
45895 | source: info.source,
|
45896 | lineNumber: info.lineNumber,
|
45897 | columnNumber: info.columnNumber,
|
45898 | stack: info.stack,
|
45899 | message: info.message
|
45900 | };
|
45901 | return formattedObject;
|
45902 | },
|
45903 | info: info,
|
45904 | privateFields: [],
|
45905 | orgInfoFields: []
|
45906 | };
|
45907 | return "undefined" != typeof telemetry.VisualExceptionLoggers && (event.loggers = telemetry.VisualExceptionLoggers),
|
45908 | event;
|
45909 | };
|
45910 | }(telemetry = visuals.telemetry || (visuals.telemetry = {}));
|
45911 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
45912 | }(powerbi || (powerbi = {}));
|
45913 | }, function(module, exports) {
|
45914 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
45915 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
45916 | !function(powerbi) {
|
45917 | var extensibility;
|
45918 | !function(extensibility) {
|
45919 | function VisualPlugin(options) {
|
45920 | return function(constructor) {
|
45921 | constructor.__transform__ = options.transform;
|
45922 | };
|
45923 | }
|
45924 | extensibility.VisualPlugin = VisualPlugin;
|
45925 | }(extensibility = powerbi.extensibility || (powerbi.extensibility = {}));
|
45926 | }(powerbi || (powerbi = {}));
|
45927 | }, function(module, exports) {
|
45928 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
45929 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
45930 | !function(powerbi) {
|
45931 | var extensibility;
|
45932 | !function(extensibility) {
|
45933 | var SelectionManager = function() {
|
45934 | function SelectionManager(options) {
|
45935 | this.hostServices = options.hostServices, this.selectedIds = [], this.promiseFactory = this.hostServices.promiseFactory();
|
45936 | }
|
45937 | return SelectionManager.prototype.select = function(selectionId, multiSelect) {
|
45938 | void 0 === multiSelect && (multiSelect = !1);
|
45939 | var deferred = this.promiseFactory.defer();
|
45940 | return this.hostServices.shouldRetainSelection() ? this.sendSelectionToHost([ selectionId ]) : (this.selectInternal(selectionId, multiSelect),
|
45941 | this.sendSelectionToHost(this.selectedIds)), deferred.resolve(this.selectedIds),
|
45942 | deferred.promise;
|
45943 | }, SelectionManager.prototype.showContextMenu = function(selectionId, position) {
|
45944 | var deferred = this.promiseFactory.defer();
|
45945 | return this.sendContextMenuToHost(selectionId, position), deferred.resolve(null),
|
45946 | deferred.promise;
|
45947 | }, SelectionManager.prototype.hasSelection = function() {
|
45948 | return this.selectedIds.length > 0;
|
45949 | }, SelectionManager.prototype.clear = function() {
|
45950 | var deferred = this.promiseFactory.defer();
|
45951 | return this.selectedIds = [], this.sendSelectionToHost([]), deferred.resolve(null),
|
45952 | deferred.promise;
|
45953 | }, SelectionManager.prototype.getSelectionIds = function() {
|
45954 | return this.selectedIds;
|
45955 | }, SelectionManager.prototype.sendSelectionToHost = function(ids) {
|
45956 | var selectArgs = {
|
45957 | data: ids.filter(function(value) {
|
45958 | return value.hasIdentity();
|
45959 | }).map(function(value) {
|
45960 | return value.getSelector();
|
45961 | })
|
45962 | }, data2 = this.getSelectorsByColumn(ids);
|
45963 | _.isEmpty(data2) || (selectArgs.data2 = data2), this.hostServices.onSelect(selectArgs);
|
45964 | }, SelectionManager.prototype.sendContextMenuToHost = function(selectionId, position) {
|
45965 | var selectors = this.getSelectorsByColumn([ selectionId ]);
|
45966 | if (!_.isEmpty(selectors)) {
|
45967 | var args = {
|
45968 | data: selectors,
|
45969 | position: position
|
45970 | };
|
45971 | this.hostServices.onContextMenu(args);
|
45972 | }
|
45973 | }, SelectionManager.prototype.getSelectorsByColumn = function(selectionIds) {
|
45974 | return _(selectionIds).filter(function(value) {
|
45975 | return value.hasIdentity;
|
45976 | }).map(function(value) {
|
45977 | return value.getSelectorsByColumn();
|
45978 | }).compact().value();
|
45979 | }, SelectionManager.prototype.selectInternal = function(selectionId, multiSelect) {
|
45980 | SelectionManager.containsSelection(this.selectedIds, selectionId) ? this.selectedIds = multiSelect ? this.selectedIds.filter(function(d) {
|
45981 | return !selectionId.equals(d);
|
45982 | }) : this.selectedIds.length > 1 ? [ selectionId ] : [] : multiSelect ? this.selectedIds.push(selectionId) : this.selectedIds = [ selectionId ];
|
45983 | }, SelectionManager.containsSelection = function(list, id) {
|
45984 | return list.some(function(d) {
|
45985 | return id.equals(d);
|
45986 | });
|
45987 | }, SelectionManager;
|
45988 | }();
|
45989 | extensibility.SelectionManager = SelectionManager;
|
45990 | }(extensibility = powerbi.extensibility || (powerbi.extensibility = {}));
|
45991 | }(powerbi || (powerbi = {}));
|
45992 | }, function(module, exports) {
|
45993 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
45994 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
45995 | !function(powerbi) {
|
45996 | var extensibility;
|
45997 | !function(extensibility) {
|
45998 | var SelectionIdBuilder = function() {
|
45999 | function SelectionIdBuilder() {}
|
46000 | return SelectionIdBuilder.prototype.withCategory = function(categoryColumn, index) {
|
46001 | return categoryColumn && categoryColumn.source && categoryColumn.source.queryName && categoryColumn.identity && (this.ensureDataMap()[categoryColumn.source.queryName] = categoryColumn.identity[index]),
|
46002 | this;
|
46003 | }, SelectionIdBuilder.prototype.withSeries = function(seriesColumn, valueColumn) {
|
46004 | return seriesColumn && seriesColumn.source && seriesColumn.source.queryName && valueColumn && (this.ensureDataMap()[seriesColumn.source.queryName] = valueColumn.identity),
|
46005 | this;
|
46006 | }, SelectionIdBuilder.prototype.withMeasure = function(measureId) {
|
46007 | return this.measure = measureId, this;
|
46008 | }, SelectionIdBuilder.prototype.createSelectionId = function() {
|
46009 | return powerbi.visuals.SelectionId.createWithSelectorForColumnAndMeasure(this.ensureDataMap(), this.measure);
|
46010 | }, SelectionIdBuilder.prototype.ensureDataMap = function() {
|
46011 | return this.dataMap || (this.dataMap = {}), this.dataMap;
|
46012 | }, SelectionIdBuilder;
|
46013 | }();
|
46014 | extensibility.SelectionIdBuilder = SelectionIdBuilder;
|
46015 | }(extensibility = powerbi.extensibility || (powerbi.extensibility = {}));
|
46016 | }(powerbi || (powerbi = {}));
|
46017 | }, function(module, exports) {
|
46018 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
46019 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
46020 | !function(powerbi) {
|
46021 | var extensibility;
|
46022 | !function(extensibility) {
|
46023 | function createVisualAdapter(visualPlugin, telemetryService) {
|
46024 | var visualAdapter = new VisualAdapter(visualPlugin, telemetryService);
|
46025 | return new extensibility.VisualSafeExecutionWrapper(visualAdapter, visualPlugin, telemetryService, visualAdapter.isPluginInError);
|
46026 | }
|
46027 | extensibility.visualApiVersions = [], extensibility.createVisualAdapter = createVisualAdapter;
|
46028 | var VisualAdapter = function() {
|
46029 | function VisualAdapter(visualPlugin, telemetryService) {
|
46030 | this.isPluginInError = !1, this.telemetryService = telemetryService, this.plugin = visualPlugin;
|
46031 | var version = visualPlugin.apiVersion, versionIndex = this.getVersionIndex(version);
|
46032 | version ? versionIndex > -1 ? (this.apiVersionIndex = versionIndex, this.legacy = !1) : this.isPluginInError = !0 : this.legacy = !0;
|
46033 | }
|
46034 | return VisualAdapter.prototype.init = function(options) {
|
46035 | if (options.element.empty(), this.legacy) this.visual = this.plugin.create(), this.visualLegacy.init(options); else {
|
46036 | var host = extensibility.visualApiVersions[this.apiVersionIndex].hostAdapter(options.host);
|
46037 | this.visual = this.plugin.create({
|
46038 | element: options.element.get(0),
|
46039 | host: host
|
46040 | }), this.overloadMethods();
|
46041 | }
|
46042 | }, VisualAdapter.prototype.update = function(options) {
|
46043 | (options.type & powerbi.VisualUpdateType.Resize) === powerbi.VisualUpdateType.Resize && this.visualHasMethod("onResizing") ? (this.plugin.custom && this.visualHasMethod("update") && this.visualLegacy.update(options),
|
46044 | this.onResizing(options.viewport, options.resizeMode)) : this.visualHasMethod("update") ? this.visualLegacy.update(options) : ((!options.type || options.type & powerbi.VisualUpdateType.Data) && this.onDataChanged(_.pick(options, [ "dataViews", "operationKind" ])),
|
46045 | options.type & powerbi.VisualUpdateType.ViewMode && this.onViewModeChanged(options.viewMode));
|
46046 | }, VisualAdapter.prototype.destroy = function() {
|
46047 | this.visualHasMethod("destroy") && this.visualLegacy.destroy();
|
46048 | }, VisualAdapter.prototype.enumerateObjectInstances = function(options) {
|
46049 | return this.visualHasMethod("enumerateObjectInstances") ? this.visualLegacy.enumerateObjectInstances(options) : void 0;
|
46050 | }, VisualAdapter.prototype.enumerateObjectRepetition = function() {
|
46051 | return this.visualHasMethod("enumerateObjectRepetition") ? this.visualLegacy.enumerateObjectRepetition() : void 0;
|
46052 | }, VisualAdapter.prototype.onResizing = function(finalViewport, resizeMode) {
|
46053 | this.visualHasMethod("onResizing") && this.visualLegacy.onResizing(finalViewport, resizeMode);
|
46054 | }, VisualAdapter.prototype.onDataChanged = function(options) {
|
46055 | this.visualHasMethod("onDataChanged") && this.visualLegacy.onDataChanged(options);
|
46056 | }, VisualAdapter.prototype.onViewModeChanged = function(viewMode) {
|
46057 | this.visualHasMethod("onViewModeChanged") && this.visualLegacy.onViewModeChanged(viewMode);
|
46058 | }, VisualAdapter.prototype.onClearSelection = function() {
|
46059 | this.visualHasMethod("onClearSelection") && this.visualLegacy.onClearSelection();
|
46060 | }, VisualAdapter.prototype.canResizeTo = function(viewport) {
|
46061 | return this.visualHasMethod("canResizeTo") ? this.visualLegacy.canResizeTo(viewport) : void 0;
|
46062 | }, VisualAdapter.prototype.unwrap = function() {
|
46063 | return this.visual;
|
46064 | }, Object.defineProperty(VisualAdapter.prototype, "visualNew", {
|
46065 | get: function() {
|
46066 | return this.legacy ? void 0 : this.visual;
|
46067 | },
|
46068 | enumerable: !0,
|
46069 | configurable: !0
|
46070 | }), Object.defineProperty(VisualAdapter.prototype, "visualLegacy", {
|
46071 | get: function() {
|
46072 | return this.legacy ? this.visual : void 0;
|
46073 | },
|
46074 | enumerable: !0,
|
46075 | configurable: !0
|
46076 | }), VisualAdapter.prototype.visualHasMethod = function(methodName) {
|
46077 | var visual = this.legacy ? this.visualLegacy : this.visualNew;
|
46078 | return visual && _.isFunction(visual[methodName]);
|
46079 | }, VisualAdapter.prototype.getVersionIndex = function(version) {
|
46080 | if (version) for (var versionCount = extensibility.visualApiVersions.length, i = 0; versionCount > i; i++) if (extensibility.visualApiVersions[i].version === version) return i;
|
46081 | return -1;
|
46082 | }, VisualAdapter.prototype.overloadMethods = function() {
|
46083 | var overloads = this.getCompiledOverloads();
|
46084 | for (var key in overloads) this[key] = overloads[key];
|
46085 | }, VisualAdapter.prototype.getCompiledOverloads = function() {
|
46086 | for (var overloads = {}, versionIndex = this.apiVersionIndex, visualNew = this.visualNew, i = 0; versionIndex >= i; i++) {
|
46087 | var overloadFactory = extensibility.visualApiVersions[i].overloads;
|
46088 | _.isFunction(overloadFactory) && _.assign(overloads, overloadFactory(visualNew));
|
46089 | }
|
46090 | return overloads;
|
46091 | }, VisualAdapter;
|
46092 | }();
|
46093 | extensibility.VisualAdapter = VisualAdapter;
|
46094 | }(extensibility = powerbi.extensibility || (powerbi.extensibility = {}));
|
46095 | }(powerbi || (powerbi = {}));
|
46096 | }, function(module, exports) {
|
46097 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
46098 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
46099 | !function(powerbi) {
|
46100 | var extensibility;
|
46101 | !function(extensibility) {
|
46102 | function translateVisualPlugin(plugin) {
|
46103 | translateCapabilities(plugin.capabilities);
|
46104 | }
|
46105 | function translateCapabilities(capabilities) {
|
46106 | capabilities && (translateObjects(capabilities.objects), translateDataRoles(capabilities.dataRoles));
|
46107 | }
|
46108 | function translateObjects(objects) {
|
46109 | for (var key in objects) {
|
46110 | var object = objects[key];
|
46111 | if (object) {
|
46112 | var properties = object.properties;
|
46113 | if (properties) for (var pKey in properties) {
|
46114 | var property = properties[pKey];
|
46115 | if (property) {
|
46116 | var propertyType = property.type;
|
46117 | propertyType && propertyType.enumeration && (propertyType.enumeration = powerbi.createEnumType(propertyType.enumeration));
|
46118 | }
|
46119 | }
|
46120 | }
|
46121 | }
|
46122 | }
|
46123 | function translateDataRoles(dataRoles) {
|
46124 | for (var key in dataRoles) {
|
46125 | var dataRole = dataRoles[key];
|
46126 | if (dataRole && dataRole.kind) switch (dataRole.kind.toString().toLowerCase()) {
|
46127 | case "grouping":
|
46128 | dataRole.kind = powerbi.VisualDataRoleKind.Grouping;
|
46129 | break;
|
46130 |
|
46131 | case "measure":
|
46132 | dataRole.kind = powerbi.VisualDataRoleKind.Measure;
|
46133 | break;
|
46134 |
|
46135 | case "groupingormeasure":
|
46136 | dataRole.kind = powerbi.VisualDataRoleKind.GroupingOrMeasure;
|
46137 | }
|
46138 | }
|
46139 | }
|
46140 | extensibility.translateVisualPlugin = translateVisualPlugin;
|
46141 | }(extensibility = powerbi.extensibility || (powerbi.extensibility = {}));
|
46142 | }(powerbi || (powerbi = {}));
|
46143 | }, function(module, exports) {
|
46144 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
46145 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
46146 | !function(powerbi) {
|
46147 | var extensibility;
|
46148 | !function(extensibility) {
|
46149 | var VisualException = powerbi.visuals.telemetry.VisualException, VisualSafeExecutionWrapper = function() {
|
46150 | function VisualSafeExecutionWrapper(wrappedVisual, visualPlugin, telemetryService, isPluginInError, silent) {
|
46151 | this.wrappedVisual = wrappedVisual, this.visualPlugin = visualPlugin, this.telemetryService = telemetryService,
|
46152 | this.isPluginInError = isPluginInError, this.silent = silent, this.telemetryService && (this.perfLoadEvent = this.telemetryService.startEvent(powerbi.visuals.telemetry.VisualApiUsage, visualPlugin.name, visualPlugin.apiVersion, !!visualPlugin.custom, void 0, isPluginInError, powerbi.visuals.telemetry.ErrorSource.User, void 0));
|
46153 | }
|
46154 | return VisualSafeExecutionWrapper.prototype.init = function(options) {
|
46155 | var _this = this;
|
46156 | this.wrappedVisual.init && this.executeSafely(function() {
|
46157 | return _this.wrappedVisual.init(options);
|
46158 | });
|
46159 | }, VisualSafeExecutionWrapper.prototype.destroy = function() {
|
46160 | var _this = this;
|
46161 | this.wrappedVisual.destroy && this.executeSafely(function() {
|
46162 | return _this.wrappedVisual.destroy();
|
46163 | }), this.perfLoadEvent && (this.perfLoadEvent = null);
|
46164 | }, VisualSafeExecutionWrapper.prototype.update = function(options) {
|
46165 | var _this = this;
|
46166 | this.wrappedVisual.update && this.executeSafely(function() {
|
46167 | _this.wrappedVisual.update(options), _this.perfLoadEvent && (_this.perfLoadEvent.resolve(),
|
46168 | _this.perfLoadEvent = null);
|
46169 | });
|
46170 | }, VisualSafeExecutionWrapper.prototype.onResizing = function(finalViewport, resizeMode) {
|
46171 | var _this = this;
|
46172 | this.wrappedVisual.onResizing && this.executeSafely(function() {
|
46173 | return _this.wrappedVisual.onResizing(finalViewport, resizeMode);
|
46174 | });
|
46175 | }, VisualSafeExecutionWrapper.prototype.onDataChanged = function(options) {
|
46176 | var _this = this;
|
46177 | this.wrappedVisual.onDataChanged && this.executeSafely(function() {
|
46178 | return _this.wrappedVisual.onDataChanged(options);
|
46179 | });
|
46180 | }, VisualSafeExecutionWrapper.prototype.onViewModeChanged = function(viewMode) {
|
46181 | var _this = this;
|
46182 | this.wrappedVisual.onViewModeChanged && this.executeSafely(function() {
|
46183 | return _this.wrappedVisual.onViewModeChanged(viewMode);
|
46184 | });
|
46185 | }, VisualSafeExecutionWrapper.prototype.onClearSelection = function() {
|
46186 | var _this = this;
|
46187 | this.wrappedVisual.onClearSelection && this.executeSafely(function() {
|
46188 | return _this.wrappedVisual.onClearSelection();
|
46189 | });
|
46190 | }, VisualSafeExecutionWrapper.prototype.canResizeTo = function(viewport) {
|
46191 | var _this = this;
|
46192 | return this.wrappedVisual.canResizeTo ? this.executeSafely(function() {
|
46193 | return _this.wrappedVisual.canResizeTo(viewport);
|
46194 | }) : void 0;
|
46195 | }, VisualSafeExecutionWrapper.prototype.enumerateObjectInstances = function(options) {
|
46196 | var _this = this;
|
46197 | return this.wrappedVisual.enumerateObjectInstances ? this.executeSafely(function() {
|
46198 | return _this.wrappedVisual.enumerateObjectInstances(options);
|
46199 | }) : void 0;
|
46200 | }, VisualSafeExecutionWrapper.prototype.enumerateObjectRepetition = function() {
|
46201 | var _this = this;
|
46202 | return this.wrappedVisual.enumerateObjectRepetition ? this.executeSafely(function() {
|
46203 | return _this.wrappedVisual.enumerateObjectRepetition();
|
46204 | }) : void 0;
|
46205 | }, VisualSafeExecutionWrapper.prototype.unwrap = function() {
|
46206 | var visual = this.wrappedVisual;
|
46207 | return visual.unwrap ? visual.unwrap() : visual;
|
46208 | }, VisualSafeExecutionWrapper.prototype.isCustomVisual = function() {
|
46209 | return this.visualPlugin.custom;
|
46210 | }, VisualSafeExecutionWrapper.prototype.executeSafely = function(callback) {
|
46211 | try {
|
46212 | return callback();
|
46213 | } catch (exception) {
|
46214 | !this.silent, this.telemetryService && (this.telemetryService.logEvent(VisualException, this.visualPlugin.name, !!this.visualPlugin.custom, this.visualPlugin.apiVersion, exception.fileName, exception.lineNumber, exception.columnNumber, exception.stack, exception.message),
|
46215 | this.perfLoadEvent && (this.perfLoadEvent.reject(), this.perfLoadEvent = null));
|
46216 | }
|
46217 | }, VisualSafeExecutionWrapper;
|
46218 | }();
|
46219 | extensibility.VisualSafeExecutionWrapper = VisualSafeExecutionWrapper;
|
46220 | }(extensibility = powerbi.extensibility || (powerbi.extensibility = {}));
|
46221 | }(powerbi || (powerbi = {}));
|
46222 | }, function(module, exports) {
|
46223 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
46224 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
46225 | !function(powerbi) {
|
46226 | var extensibility;
|
46227 | !function(extensibility) {
|
46228 | var v100;
|
46229 | !function(v100) {
|
46230 | function convertLegacyUpdateType(options) {
|
46231 | var type = options.type || powerbi.VisualUpdateType.Data;
|
46232 | return type & powerbi.VisualUpdateType.Resize && 2 === options.resizeMode && (type |= powerbi.VisualUpdateType.ResizeEnd),
|
46233 | type;
|
46234 | }
|
46235 | v100.convertLegacyUpdateType = convertLegacyUpdateType;
|
46236 | var overloadFactory = function(visual) {
|
46237 | return {
|
46238 | update: function(options) {
|
46239 | visual.update && visual.update({
|
46240 | viewport: options.viewport,
|
46241 | dataViews: options.dataViews,
|
46242 | type: convertLegacyUpdateType(options)
|
46243 | });
|
46244 | },
|
46245 | destroy: function() {
|
46246 | visual.destroy && visual.destroy();
|
46247 | },
|
46248 | enumerateObjectInstances: function(options) {
|
46249 | return visual.enumerateObjectInstances ? visual.enumerateObjectInstances(options) : void 0;
|
46250 | }
|
46251 | };
|
46252 | }, hostAdapter = function(host) {
|
46253 | return {};
|
46254 | };
|
46255 | extensibility.visualApiVersions.push({
|
46256 | version: "1.0.0",
|
46257 | overloads: overloadFactory,
|
46258 | hostAdapter: hostAdapter
|
46259 | });
|
46260 | }(v100 = extensibility.v100 || (extensibility.v100 = {}));
|
46261 | }(extensibility = powerbi.extensibility || (powerbi.extensibility = {}));
|
46262 | }(powerbi || (powerbi = {}));
|
46263 | }, function(module, exports) {
|
46264 | var powerbi, powerbi = (window.jsCommon, window.powerbi);
|
46265 | window.powerbitests, window.InJs, window.debug, window.jasmine, window.Microsoft;
|
46266 | !function(powerbi) {
|
46267 | var extensibility;
|
46268 | !function(extensibility) {
|
46269 | var v110;
|
46270 | !function(v110) {
|
46271 | var overloadFactory = function(visual) {
|
46272 | return {
|
46273 | update: function(options) {
|
46274 | if (visual.update) {
|
46275 | var updateOptions = {
|
46276 | viewport: options.viewport,
|
46277 | dataViews: options.dataViews,
|
46278 | type: extensibility.v100.convertLegacyUpdateType(options)
|
46279 | }, transform = visual.constructor.__transform__;
|
46280 | _.isFunction(transform) ? visual.update(updateOptions, transform(updateOptions.dataViews)) : visual.update(updateOptions);
|
46281 | }
|
46282 | }
|
46283 | };
|
46284 | }, hostAdapter = function(host) {
|
46285 | return {
|
46286 | createSelectionIdBuilder: function() {
|
46287 | return new powerbi.visuals.SelectionIdBuilder();
|
46288 | },
|
46289 | createSelectionManager: function() {
|
46290 | return new extensibility.SelectionManager({
|
46291 | hostServices: host
|
46292 | });
|
46293 | },
|
46294 | colors: powerbi.visuals.ThemeManager.getDefaultTheme()
|
46295 | };
|
46296 | };
|
46297 | extensibility.visualApiVersions.push({
|
46298 | version: "1.1.0",
|
46299 | overloads: overloadFactory,
|
46300 | hostAdapter: hostAdapter
|
46301 | });
|
46302 | }(v110 = extensibility.v110 || (extensibility.v110 = {}));
|
46303 | }(extensibility = powerbi.extensibility || (powerbi.extensibility = {}));
|
46304 | }(powerbi || (powerbi = {}));
|
46305 | } ]); |
\ | No newline at end of file |